Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
4a40e206
提交
4a40e206
authored
4月 23, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'lj-project' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect into lj-project
上级
1cf270d2
ba4b6ec0
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
64 行增加
和
89 行删除
+64
-89
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
+39
-41
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
浏览文件 @
4a40e206
...
...
@@ -151,19 +151,7 @@ public class EvaluationController {
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
(
"下载报告"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"报告主键"
),
...
...
@@ -177,37 +165,32 @@ public class EvaluationController {
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:8078/static/defult.docx");
String
w
=
null
;
Evaluation
evaluation
=
evaluationService
.
findById
(
download
.
getId
());
Map
<
String
,
String
>
wps
=
WpsUtil
.
createWps
(
evaluation
);
wps
.
put
(
"danjia"
,
download
.
getDanjia
());
wps
.
put
(
"yusuan"
,
download
.
getYusuan
());
wps
.
put
(
"gong"
,
download
.
getGong
());
wps
.
put
(
"ewai"
,
download
.
getEwai
());
Double
aDouble
=
Double
.
valueOf
(
download
.
getDanjia
());
BigDecimal
b1
=
BigDecimal
.
valueOf
(
aDouble
);
BigDecimal
b2
=
BigDecimal
.
valueOf
(
1.5
);
double
v
=
b1
.
subtract
(
b2
).
doubleValue
();
String
format
=
new
DecimalFormat
(
"0.00"
).
format
(
v
);
wps
.
put
(
"rgcz"
,
format
);
if
(
download
.
getAgree
().
equals
(
"1"
))
{
wps
.
put
(
"agree"
,
"同意"
);
}
else
{
wps
.
put
(
"agree"
,
"不同意"
);
}
Set
<
String
>
strings
=
wps
.
keySet
();
for
(
String
str
:
strings
)
{
String
s
=
wps
.
get
(
str
);
if
(!
StringUtils
.
isEmpty
(
s
)&&
s
.
equals
(
"-1"
)){
wps
.
put
(
str
,
"0"
);
}
else
if
(
StringUtils
.
isEmpty
(
s
)){
wps
.
put
(
str
,
"无"
);
System
.
out
.
println
(
"downloadid:"
+
download
.
getId
());
System
.
out
.
println
(
"evaluation:"
+
evaluation
);
if
(
evaluation
!=
null
)
{
Map
<
String
,
Object
>
wps
=
WpsUtil
.
createWps
(
evaluation
);
wps
.
put
(
"danjia"
,
download
.
getDanjia
());
wps
.
put
(
"yusuan"
,
download
.
getYusuan
());
wps
.
put
(
"gong"
,
download
.
getGong
());
wps
.
put
(
"ewai"
,
download
.
getEwai
());
Double
aDouble
=
Double
.
valueOf
(
download
.
getDanjia
());
BigDecimal
b1
=
BigDecimal
.
valueOf
(
aDouble
);
BigDecimal
b2
=
BigDecimal
.
valueOf
(
1.5
);
double
v
=
b1
.
subtract
(
b2
).
doubleValue
();
String
format
=
new
DecimalFormat
(
"0.00"
).
format
(
v
);
wps
.
put
(
"rgcz"
,
format
);
if
(
download
.
getAgree
().
equals
(
"1"
))
{
wps
.
put
(
"agree"
,
"同意"
);
}
else
{
wps
.
put
(
"agree"
,
"不同意"
);
}
w
=
FreeMakerUtils
.
parseTpl
(
"reportTemplate"
,
wps
);
}
String
w
=
FreeMakerUtils
.
parseTpl
(
"reportTemplate"
,
wps
);
if
(
StringUtils
.
isEmpty
(
w
)){
return
ServerResponse
.
error
(
500
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotEmpty
(
w
)){
return
ServerResponse
.
ok
(
w
);
}
return
ServerResponse
.
ok
(
w
);
return
ServerResponse
.
error
(
500
);
}
}
src/main/java/com/zjty/inspect/utils/DocumentWordUtil.java
浏览文件 @
4a40e206
...
...
@@ -102,7 +102,6 @@ public class DocumentWordUtil {
String
s3
=
tableTile
(
technologyName
,
stra
);
String
s4
=
Matcher
.
quoteReplacement
(
s3
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
s4
);
for
(
int
j
=
0
;
j
<
tables
.
size
();
j
++)
{
String
gettb
=
gettb
(
tables
.
get
(
j
));
String
s1
=
Matcher
.
quoteReplacement
(
gettb
);
...
...
src/main/java/com/zjty/inspect/utils/FreeMakerUtils.java
浏览文件 @
4a40e206
...
...
@@ -24,8 +24,7 @@ public class FreeMakerUtils {
return
null
;
}
}
public
static
String
createWord
(
Template
template
,
Map
<
String
,
List
<
TechnologyContent
>>
dataMap
){
try
{
public
static
String
createWord
(
Template
template
,
Map
<
String
,
List
<
TechnologyContent
>>
dataMap
)
throws
Exception
{
//文件路径
String
filePath
=
"/opt/monitor/inspect/static/ins/doc/"
;
...
...
@@ -49,10 +48,6 @@ public class FreeMakerUtils {
out
.
flush
();
out
.
close
();
return
fileName
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
null
;
}
public
static
void
writeFile
(
String
file
,
String
conent
)
{
...
...
src/main/java/com/zjty/inspect/utils/WpsUtil.java
浏览文件 @
4a40e206
...
...
@@ -6,7 +6,9 @@ import com.zjty.inspect.enums.*;
import
io.netty.util.internal.StringUtil
;
import
org.springframework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.text.DateFormat
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -17,11 +19,11 @@ import java.util.*;
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
<>();
Reform
reform
=
JSON
.
parseObject
(
evaluation
.
getInEva
(),
Reform
.
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
(
"mode"
,
getMode
(
reform
.
getMode
()));
keyValue
.
put
(
"projectName"
,
reform
.
getProjectName
());
...
...
@@ -180,46 +182,35 @@ public class WpsUtil {
TechnologyList
technologyList
=
assessmentReport
.
getTechnologyList
();
keyValue
.
put
(
"technologyDes"
,
technologyList
.
getDes
());
List
<
TechnologyReport
>
technologyReports
=
technologyList
.
getTechnologyReports
();
for
(
int
i
=
0
;
i
<
technologyList
.
getTechnologyReports
().
size
();
i
++)
{
int
i2
=
i
+
1
;
keyValue
.
put
(
"technology"
+
i2
,
technologyReports
.
get
(
i
).
getTechnology
());
for
(
int
i1
=
0
;
i1
<
technologyReports
.
get
(
i
).
getTechnologyContents
().
size
();
i1
++)
{
int
i3
=
i1
+
1
;
TechnologyContent
technologyContent
=
technologyReports
.
get
(
i
).
getTechnologyContents
().
get
(
i1
);
keyValue
.
put
(
"technologyContentLocal"
+
i2
+
"-"
+
i3
,
technologyContent
.
getLocal
());
keyValue
.
put
(
"technologyContentKeyWord"
+
i2
+
"-"
+
i3
,
technologyContent
.
getKeyWord
());
keyValue
.
put
(
"technologyContentFile"
+
i2
+
"-"
+
i3
,
technologyContent
.
getFile
());
keyValue
.
put
(
"technologyContentPosition"
+
i2
+
"-"
+
i3
,
technologyContent
.
getPosition
());
keyValue
.
put
(
"technologyContentStrategy"
+
i2
+
"-"
+
i3
,
getMode
(
technologyContent
.
getStrategy
()));
}
}
// for (int i = 0; i < technologyList.getTechnologyReports().size(); i++) {
// int i2 = i + 1;
// keyValue.put("technology" + i2, technologyReports.get(i).getTechnology());
// for (int i1 = 0; i1 < technologyReports.get(i).getTechnologyContents().size(); i1++) {
// int i3 = i1 + 1;
// TechnologyContent technologyContent = technologyReports.get(i).getTechnologyContents().get(i1);
// keyValue.put("technologyContentLocal" + i2 + "-" + i3, technologyContent.getLocal());
// keyValue.put("technologyContentKeyWord" + i2 + "-" + i3, technologyContent.getKeyWord());
// keyValue.put("technologyContentFile" + i2 + "-" + i3, technologyContent.getFile());
// keyValue.put("technologyContentPosition" + i2 + "-" + i3, technologyContent.getPosition());
// 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
)
{
teMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
}
Set
<
String
>
strings
=
teMap
.
keySet
();
StringBuilder
youhua
=
new
StringBuilder
();
StringBuilder
xiugai
=
new
StringBuilder
();
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
);
if
(
technologyReport
.
getTechnology
().
contains
(
"优化"
)){
yhMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
}
else
if
(
technologyReport
.
getTechnology
().
contains
(
"不支持"
))
{
nsMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
}
else
if
(
technologyReport
.
getTechnology
().
contains
(
"未知"
)){
wzMap
.
put
(
technologyReport
.
getTechnology
(),
technologyReport
.
getTechnologyContents
());
}
}
keyValue
.
put
(
"teyouhua"
,
youhua
.
toString
());
keyValue
.
put
(
"texiugai"
,
xiugai
.
toString
());
keyValue
.
put
(
"teweizhi"
,
weizhi
.
toString
());
keyValue
.
put
(
"yh"
,
yhMap
);
keyValue
.
put
(
"ns"
,
nsMap
);
keyValue
.
put
(
"wz"
,
wzMap
);
Workload
workload
=
assessmentReport
.
getWorkload
();
keyValue
.
put
(
"workloadDes"
,
workload
.
getDes
());
keyValue
.
put
(
"workloadCost"
,
String
.
valueOf
(
workload
.
getCost
()));
...
...
@@ -236,10 +227,17 @@ public class WpsUtil {
Basis
deploy
=
workload
.
getDeploy
();
keyValue
.
put
(
"workloadDeployVolume"
,
String
.
valueOf
(
deploy
.
getDevelopmentVolume
()));
keyValue
.
put
(
"workloadDeployCorrectionFactor"
,
String
.
valueOf
(
deploy
.
getCorrectionFactor
()));
double
correctionFactor
=
development
.
getCorrectionFactor
();
double
correctionFactor1
=
test
.
getCorrectionFactor
();
double
correctionFactor2
=
deploy
.
getCorrectionFactor
();
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
correctionFactor
);
BigDecimal
bigDecima2
=
BigDecimal
.
valueOf
(
correctionFactor1
);
BigDecimal
bigDecima3
=
BigDecimal
.
valueOf
(
correctionFactor2
);
double
v
=
bigDecimal
.
add
(
bigDecima2
).
add
(
bigDecima3
).
doubleValue
();
Basis
total
=
workload
.
getTotal
();
String
correction
=
new
DecimalFormat
(
"0.000"
).
format
(
v
);
keyValue
.
put
(
"workloadTotalVolume"
,
String
.
valueOf
(
total
.
getDevelopmentVolume
()));
keyValue
.
put
(
"workloadTotalCorrectionFactor"
,
String
.
valueOf
(
total
.
getCorrectionFactor
())
);
keyValue
.
put
(
"workloadTotalCorrectionFactor"
,
correction
);
DifficultyAssessment
difficultyAssessment
=
assessmentReport
.
getDifficultyAssessment
();
keyValue
.
put
(
"difficultyAssessmentDes"
,
difficultyAssessment
.
getDes
());
...
...
src/main/resources/templates/pg.ftl
浏览文件 @
4a40e206
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/resources/templates/reportTemplate.ftl
浏览文件 @
4a40e206
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论