Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
b0210a28
提交
b0210a28
authored
4月 22, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决内存溢出
上级
e0d50e1c
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
53 行增加
和
87 行删除
+53
-87
EvaluationController.java
...ava/com/zjty/inspect/controller/EvaluationController.java
+24
-41
DocumentWordUtil.java
src/main/java/com/zjty/inspect/utils/DocumentWordUtil.java
+0
-1
FreeMakerUtils.java
src/main/java/com/zjty/inspect/utils/FreeMakerUtils.java
+1
-6
WpsUtil.java
src/main/java/com/zjty/inspect/utils/WpsUtil.java
+28
-39
pg.ftl
src/main/resources/templates/pg.ftl
+0
-0
reportTemplate.ftl
src/main/resources/templates/reportTemplate.ftl
+0
-0
没有找到文件。
src/main/java/com/zjty/inspect/controller/EvaluationController.java
浏览文件 @
b0210a28
...
@@ -151,19 +151,7 @@ public class EvaluationController {
...
@@ -151,19 +151,7 @@ public class EvaluationController {
return
ServerResponse
.
ok
(
new
PageResult
<>(
pageList
.
getTotalElements
(),
pageList
.
getContent
()));
return
ServerResponse
.
ok
(
new
PageResult
<>(
pageList
.
getTotalElements
(),
pageList
.
getContent
()));
}
}
/**
* 获取评估报告内的输出,转换为map结构
*
* @param id id
* @return wps
*/
@GetMapping
(
value
=
"/map/{id}"
)
@ApiOperation
(
"获取评估报告内的map "
)
public
ServerResponse
<
Map
<
String
,
String
>>
findAll
(
@PathVariable
String
id
)
{
Evaluation
evaluation
=
evaluationService
.
findById
(
id
);
Map
<
String
,
String
>
wps
=
WpsUtil
.
createWps
(
evaluation
);
return
ServerResponse
.
ok
(
wps
);
}
@ApiOperation
(
"下载报告"
)
@ApiOperation
(
"下载报告"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"报告主键"
),
@ApiImplicitParam
(
name
=
"id"
,
value
=
"报告主键"
),
...
@@ -177,37 +165,32 @@ public class EvaluationController {
...
@@ -177,37 +165,32 @@ public class EvaluationController {
public
ServerResponse
download
(
@RequestBody
Download
download
){
public
ServerResponse
download
(
@RequestBody
Download
download
){
// return ResponseEntity.ok("http://120.55.57.35:12345/static/uplaods/a36b17568d4e466dacf9f088a29b4dbc.docx");
// return ResponseEntity.ok("http://120.55.57.35:12345/static/uplaods/a36b17568d4e466dacf9f088a29b4dbc.docx");
// return ResponseEntity.ok("http://120.55.57.35:8078/static/defult.docx");
// return ResponseEntity.ok("http://120.55.57.35:8078/static/defult.docx");
String
w
=
null
;
Evaluation
evaluation
=
evaluationService
.
findById
(
download
.
getId
());
Evaluation
evaluation
=
evaluationService
.
findById
(
download
.
getId
());
Map
<
String
,
String
>
wps
=
WpsUtil
.
createWps
(
evaluation
);
System
.
out
.
println
(
"downloadid:"
+
download
.
getId
());
wps
.
put
(
"danjia"
,
download
.
getDanjia
());
System
.
out
.
println
(
"evaluation:"
+
evaluation
);
wps
.
put
(
"yusuan"
,
download
.
getYusuan
());
if
(
evaluation
!=
null
)
{
wps
.
put
(
"gong"
,
download
.
getGong
());
Map
<
String
,
Object
>
wps
=
WpsUtil
.
createWps
(
evaluation
);
wps
.
put
(
"ewai"
,
download
.
getEwai
());
wps
.
put
(
"danjia"
,
download
.
getDanjia
());
Double
aDouble
=
Double
.
valueOf
(
download
.
getDanjia
());
wps
.
put
(
"yusuan"
,
download
.
getYusuan
());
BigDecimal
b1
=
BigDecimal
.
valueOf
(
aDouble
);
wps
.
put
(
"gong"
,
download
.
getGong
());
BigDecimal
b2
=
BigDecimal
.
valueOf
(
1.5
);
wps
.
put
(
"ewai"
,
download
.
getEwai
());
double
v
=
b1
.
subtract
(
b2
).
doubleValue
();
Double
aDouble
=
Double
.
valueOf
(
download
.
getDanjia
());
String
format
=
new
DecimalFormat
(
"0.00"
).
format
(
v
);
BigDecimal
b1
=
BigDecimal
.
valueOf
(
aDouble
);
wps
.
put
(
"rgcz"
,
format
);
BigDecimal
b2
=
BigDecimal
.
valueOf
(
1.5
);
if
(
download
.
getAgree
().
equals
(
"1"
))
{
double
v
=
b1
.
subtract
(
b2
).
doubleValue
();
wps
.
put
(
"agree"
,
"同意"
);
String
format
=
new
DecimalFormat
(
"0.00"
).
format
(
v
);
}
else
{
wps
.
put
(
"rgcz"
,
format
);
wps
.
put
(
"agree"
,
"不同意"
);
if
(
download
.
getAgree
().
equals
(
"1"
))
{
}
wps
.
put
(
"agree"
,
"同意"
);
Set
<
String
>
strings
=
wps
.
keySet
();
}
else
{
for
(
String
str
:
strings
)
{
wps
.
put
(
"agree"
,
"不同意"
);
String
s
=
wps
.
get
(
str
);
if
(!
StringUtils
.
isEmpty
(
s
)&&
s
.
equals
(
"-1"
)){
wps
.
put
(
str
,
"0"
);
}
else
if
(
StringUtils
.
isEmpty
(
s
)){
wps
.
put
(
str
,
"无"
);
}
}
w
=
FreeMakerUtils
.
parseTpl
(
"reportTemplate"
,
wps
);
}
}
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotEmpty
(
w
)){
String
w
=
FreeMakerUtils
.
parseTpl
(
"reportTemplate"
,
wps
);
return
ServerResponse
.
ok
(
w
);
if
(
StringUtils
.
isEmpty
(
w
)){
return
ServerResponse
.
error
(
500
);
}
}
return
ServerResponse
.
ok
(
w
);
return
ServerResponse
.
error
(
500
);
}
}
}
}
src/main/java/com/zjty/inspect/utils/DocumentWordUtil.java
浏览文件 @
b0210a28
...
@@ -102,7 +102,6 @@ public class DocumentWordUtil {
...
@@ -102,7 +102,6 @@ public class DocumentWordUtil {
String
s3
=
tableTile
(
technologyName
,
stra
);
String
s3
=
tableTile
(
technologyName
,
stra
);
String
s4
=
Matcher
.
quoteReplacement
(
s3
);
String
s4
=
Matcher
.
quoteReplacement
(
s3
);
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
s4
);
for
(
int
j
=
0
;
j
<
tables
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
tables
.
size
();
j
++)
{
String
gettb
=
gettb
(
tables
.
get
(
j
));
String
gettb
=
gettb
(
tables
.
get
(
j
));
String
s1
=
Matcher
.
quoteReplacement
(
gettb
);
String
s1
=
Matcher
.
quoteReplacement
(
gettb
);
...
...
src/main/java/com/zjty/inspect/utils/FreeMakerUtils.java
浏览文件 @
b0210a28
...
@@ -24,8 +24,7 @@ public class FreeMakerUtils {
...
@@ -24,8 +24,7 @@ public class FreeMakerUtils {
return
null
;
return
null
;
}
}
}
}
public
static
String
createWord
(
Template
template
,
Map
<
String
,
List
<
TechnologyContent
>>
dataMap
){
public
static
String
createWord
(
Template
template
,
Map
<
String
,
List
<
TechnologyContent
>>
dataMap
)
throws
Exception
{
try
{
//文件路径
//文件路径
String
filePath
=
"/opt/monitor/inspect/static/ins/doc/"
;
String
filePath
=
"/opt/monitor/inspect/static/ins/doc/"
;
...
@@ -49,10 +48,6 @@ public class FreeMakerUtils {
...
@@ -49,10 +48,6 @@ public class FreeMakerUtils {
out
.
flush
();
out
.
flush
();
out
.
close
();
out
.
close
();
return
fileName
;
return
fileName
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
null
;
}
}
public
static
void
writeFile
(
String
file
,
String
conent
)
{
public
static
void
writeFile
(
String
file
,
String
conent
)
{
...
...
src/main/java/com/zjty/inspect/utils/WpsUtil.java
浏览文件 @
b0210a28
...
@@ -17,11 +17,11 @@ import java.util.*;
...
@@ -17,11 +17,11 @@ import java.util.*;
public
class
WpsUtil
{
public
class
WpsUtil
{
public
static
Map
<
String
,
String
>
createWps
(
Evaluation
evaluation
)
{
public
static
Map
<
String
,
Object
>
createWps
(
Evaluation
evaluation
)
{
HashMap
<
String
,
List
<
TechnologyContent
>>
teMap
=
new
HashMap
<>();
HashMap
<
String
,
List
<
TechnologyContent
>>
teMap
=
new
HashMap
<>();
Reform
reform
=
JSON
.
parseObject
(
evaluation
.
getInEva
(),
Reform
.
class
);
Reform
reform
=
JSON
.
parseObject
(
evaluation
.
getInEva
(),
Reform
.
class
);
AssessmentReport
assessmentReport
=
JSON
.
parseObject
(
evaluation
.
getOutEva
(),
AssessmentReport
.
class
);
AssessmentReport
assessmentReport
=
JSON
.
parseObject
(
evaluation
.
getOutEva
(),
AssessmentReport
.
class
);
HashMap
<
String
,
String
>
keyValue
=
new
HashMap
<>();
Map
keyValue
=
new
HashMap
<>();
keyValue
.
put
(
"username"
,
reform
.
getUsername
());
keyValue
.
put
(
"username"
,
reform
.
getUsername
());
keyValue
.
put
(
"mode"
,
getMode
(
reform
.
getMode
()));
keyValue
.
put
(
"mode"
,
getMode
(
reform
.
getMode
()));
keyValue
.
put
(
"projectName"
,
reform
.
getProjectName
());
keyValue
.
put
(
"projectName"
,
reform
.
getProjectName
());
...
@@ -180,46 +180,35 @@ public class WpsUtil {
...
@@ -180,46 +180,35 @@ public class WpsUtil {
TechnologyList
technologyList
=
assessmentReport
.
getTechnologyList
();
TechnologyList
technologyList
=
assessmentReport
.
getTechnologyList
();
keyValue
.
put
(
"technologyDes"
,
technologyList
.
getDes
());
keyValue
.
put
(
"technologyDes"
,
technologyList
.
getDes
());
List
<
TechnologyReport
>
technologyReports
=
technologyList
.
getTechnologyReports
();
List
<
TechnologyReport
>
technologyReports
=
technologyList
.
getTechnologyReports
();
for
(
int
i
=
0
;
i
<
technologyList
.
getTechnologyReports
().
size
();
i
++)
{
// for (int i = 0; i < technologyList.getTechnologyReports().size(); i++) {
int
i2
=
i
+
1
;
// int i2 = i + 1;
keyValue
.
put
(
"technology"
+
i2
,
technologyReports
.
get
(
i
).
getTechnology
());
// keyValue.put("technology" + i2, technologyReports.get(i).getTechnology());
for
(
int
i1
=
0
;
i1
<
technologyReports
.
get
(
i
).
getTechnologyContents
().
size
();
i1
++)
{
// for (int i1 = 0; i1 < technologyReports.get(i).getTechnologyContents().size(); i1++) {
int
i3
=
i1
+
1
;
// int i3 = i1 + 1;
TechnologyContent
technologyContent
=
technologyReports
.
get
(
i
).
getTechnologyContents
().
get
(
i1
);
// TechnologyContent technologyContent = technologyReports.get(i).getTechnologyContents().get(i1);
keyValue
.
put
(
"technologyContentLocal"
+
i2
+
"-"
+
i3
,
technologyContent
.
getLocal
());
// keyValue.put("technologyContentLocal" + i2 + "-" + i3, technologyContent.getLocal());
keyValue
.
put
(
"technologyContentKeyWord"
+
i2
+
"-"
+
i3
,
technologyContent
.
getKeyWord
());
// keyValue.put("technologyContentKeyWord" + i2 + "-" + i3, technologyContent.getKeyWord());
keyValue
.
put
(
"technologyContentFile"
+
i2
+
"-"
+
i3
,
technologyContent
.
getFile
());
// keyValue.put("technologyContentFile" + i2 + "-" + i3, technologyContent.getFile());
keyValue
.
put
(
"technologyContentPosition"
+
i2
+
"-"
+
i3
,
technologyContent
.
getPosition
());
// keyValue.put("technologyContentPosition" + i2 + "-" + i3, technologyContent.getPosition());
keyValue
.
put
(
"technologyContentStrategy"
+
i2
+
"-"
+
i3
,
getMode
(
technologyContent
.
getStrategy
()));
// keyValue.put("technologyContentStrategy" + i2 + "-" + i3, getMode(technologyContent.getStrategy()));
}
// }
}
// }
HashMap
<
String
,
List
<
TechnologyContent
>>
yhMap
=
new
HashMap
<>();
HashMap
<
String
,
List
<
TechnologyContent
>>
nsMap
=
new
HashMap
<>();
HashMap
<
String
,
List
<
TechnologyContent
>>
wzMap
=
new
HashMap
<>();
for
(
TechnologyReport
technologyReport
:
technologyReports
)
{
for
(
TechnologyReport
technologyReport
:
technologyReports
)
{
teMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
if
(
technologyReport
.
getTechnology
().
contains
(
"优化"
)){
}
yhMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
Set
<
String
>
strings
=
teMap
.
keySet
();
}
else
if
(
technologyReport
.
getTechnology
().
contains
(
"不支持"
))
{
nsMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
StringBuilder
youhua
=
new
StringBuilder
();
}
else
if
(
technologyReport
.
getTechnology
().
contains
(
"未知"
)){
StringBuilder
xiugai
=
new
StringBuilder
();
wzMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
StringBuilder
weizhi
=
new
StringBuilder
();
DocumentWordUtil
documentWordUtil
=
new
DocumentWordUtil
();
for
(
String
string
:
strings
)
{
if
(
string
.
contains
(
"优化"
))
{
List
<
TechnologyContent
>
technologyContents
=
teMap
.
get
(
string
);
String
str
=
documentWordUtil
.
getTableString
(
technologyContents
,
string
,
"优化"
);
youhua
.
append
(
str
);
}
else
if
(
string
.
contains
(
"不支持"
))
{
List
<
TechnologyContent
>
technologyContents
=
teMap
.
get
(
string
);
String
str
=
documentWordUtil
.
getTableString
(
technologyContents
,
string
,
"重新开发"
);
xiugai
.
append
(
str
);
}
else
if
(
string
.
contains
(
"未知"
))
{
List
<
TechnologyContent
>
technologyContents
=
teMap
.
get
(
string
);
String
str
=
documentWordUtil
.
getTableString
(
technologyContents
,
string
,
"验证修改或重新开发"
);
weizhi
.
append
(
str
);
}
}
}
}
keyValue
.
put
(
"teyouhua"
,
youhua
.
toString
());
keyValue
.
put
(
"yh"
,
yhMap
);
keyValue
.
put
(
"texiugai"
,
xiugai
.
toString
());
keyValue
.
put
(
"ns"
,
nsMap
);
keyValue
.
put
(
"teweizhi"
,
weizhi
.
toString
());
keyValue
.
put
(
"wz"
,
wzMap
);
Workload
workload
=
assessmentReport
.
getWorkload
();
Workload
workload
=
assessmentReport
.
getWorkload
();
keyValue
.
put
(
"workloadDes"
,
workload
.
getDes
());
keyValue
.
put
(
"workloadDes"
,
workload
.
getDes
());
keyValue
.
put
(
"workloadCost"
,
String
.
valueOf
(
workload
.
getCost
()));
keyValue
.
put
(
"workloadCost"
,
String
.
valueOf
(
workload
.
getCost
()));
...
...
src/main/resources/templates/pg.ftl
浏览文件 @
b0210a28
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/resources/templates/reportTemplate.ftl
浏览文件 @
b0210a28
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论