Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
98f0daaf
提交
98f0daaf
authored
3月 04, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
freemaker
上级
b4a5220c
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
567 行增加
和
0 行删除
+567
-0
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+16
-0
InspectService.java
src/main/java/com/zjty/inspect/service/InspectService.java
+3
-0
InspectServiceImpl.java
...ava/com/zjty/inspect/service/impl/InspectServiceImpl.java
+26
-0
FreemarkerUtils.java
src/main/java/com/zjty/inspect/utils/FreemarkerUtils.java
+27
-0
assessmentDetail.html
src/main/resources/templates/assessmentDetail.html
+246
-0
pg.ftl
src/main/resources/templates/pg.ftl
+249
-0
没有找到文件。
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
98f0daaf
...
...
@@ -2,8 +2,10 @@ package com.zjty.inspect.controller;
import
com.zjty.inspect.entity.InspectParameter
;
import
com.zjty.inspect.entity.ReportVo
;
import
com.zjty.inspect.entity.Warn
;
import
com.zjty.inspect.service.InspectService
;
import
com.zjty.inspect.utils.*
;
import
freemarker.template.TemplateException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.io.FileUtils
;
...
...
@@ -16,6 +18,9 @@ import org.springframework.web.multipart.MultipartFile;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
java.io.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 评估接口
...
...
@@ -73,6 +78,17 @@ public class InspectController {
reportVo
.
setProjectName
(
projectName
);
reportVo
.
setSourceAddress
(
file
.
getCanonicalPath
());
ReportVo
inspect
=
inspectService
.
inspect
(
reportVo
,
inspectParameter
);
Map
map
=
new
HashMap
();
map
.
put
(
"inspect"
,
inspect
);
HashMap
<
String
,
List
<
Warn
>>
warnDetails
=
inspect
.
getWarnDetails
();
map
.
put
(
"warnDetails"
,
warnDetails
);
try
{
String
template
=
FreemarkerUtils
.
getTemplate
(
"pg.ftl"
,
map
);
String
s
=
inspectService
.
generateHtml
(
template
,
map
);
}
catch
(
TemplateException
e
)
{
e
.
printStackTrace
();
}
return
ResponseEntity
.
ok
(
inspect
);
}
...
...
src/main/java/com/zjty/inspect/service/InspectService.java
浏览文件 @
98f0daaf
...
...
@@ -4,6 +4,8 @@ import com.zjty.inspect.entity.InspectParameter;
import
com.zjty.inspect.entity.Report
;
import
com.zjty.inspect.entity.ReportVo
;
import
java.util.Map
;
public
interface
InspectService
{
/**
* 评估
...
...
@@ -11,4 +13,5 @@ public interface InspectService {
* @return
*/
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
);
String
generateHtml
(
String
templateContent
,
Map
model
);
}
src/main/java/com/zjty/inspect/service/impl/InspectServiceImpl.java
浏览文件 @
98f0daaf
...
...
@@ -5,9 +5,13 @@ import com.zjty.inspect.entity.Report;
import
com.zjty.inspect.entity.ReportVo
;
import
com.zjty.inspect.service.InspectService
;
import
com.zjty.inspect.inspect.Inspector
;
import
freemarker.cache.StringTemplateLoader
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.ui.freemarker.FreeMarkerTemplateUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -46,4 +50,26 @@ public class InspectServiceImpl implements InspectService {
return
report
;
}
//执行静态化
public
String
generateHtml
(
String
templateContent
,
Map
model
){
//创建配置对象
Configuration
configuration
=
new
Configuration
(
Configuration
.
getVersion
());
//创建模板加载器
StringTemplateLoader
stringTemplateLoader
=
new
StringTemplateLoader
();
stringTemplateLoader
.
putTemplate
(
"template"
,
templateContent
);
//向configuration配置模板加载器
configuration
.
setTemplateLoader
(
stringTemplateLoader
);
//获取模板
try
{
Template
template
=
configuration
.
getTemplate
(
"template"
);
//调用api进行静态化
String
content
=
FreeMarkerTemplateUtils
.
processTemplateIntoString
(
template
,
model
);
return
content
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
src/main/java/com/zjty/inspect/utils/FreemarkerUtils.java
0 → 100644
浏览文件 @
98f0daaf
package
com
.
zjty
.
inspect
.
utils
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
freemarker.template.TemplateException
;
import
freemarker.template.TemplateExceptionHandler
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.StringWriter
;
import
java.util.Map
;
public
class
FreemarkerUtils
{
public
static
String
getTemplate
(
String
template
,
Map
<
String
,
Object
>
map
)
throws
IOException
,
TemplateException
{
Configuration
cfg
=
new
Configuration
(
Configuration
.
VERSION_2_3_28
);
String
templatePath
=
FreemarkerUtils
.
class
.
getResource
(
"/"
).
getPath
()+
"/templates"
;
cfg
.
setDirectoryForTemplateLoading
(
new
File
(
templatePath
));
cfg
.
setDefaultEncoding
(
"UTF-8"
);
cfg
.
setTemplateExceptionHandler
(
TemplateExceptionHandler
.
RETHROW_HANDLER
);
cfg
.
setLogTemplateExceptions
(
false
);
cfg
.
setWrapUncheckedExceptions
(
true
);
Template
temp
=
cfg
.
getTemplate
(
template
);
StringWriter
stringWriter
=
new
StringWriter
();
temp
.
process
(
map
,
stringWriter
);
return
stringWriter
.
toString
();
}
}
src/main/resources/templates/assessmentDetail.html
0 → 100644
浏览文件 @
98f0daaf
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
应用系统评估详情
</title>
<style>
.detailContent
{
background
:
#f9f9f9
;
height
:
800px
;
}
.detailContentT
{
color
:
#333
;
font-size
:
28px
;
text-align
:
center
;
padding
:
20px
0
;
}
.systemName
{
height
:
215px
;
background
:
#fff
;
margin
:
0
30px
20px
;
}
.systemName
>
img
{
margin
:
20px
10px
-2px
20px
;
}
.keyTec
{
height
:
380px
;
background
:
#fff
;
margin
:
0
30px
;
}
.nav-title
{
color
:
#333
;
font-size
:
22px
;
display
:
inline-block
;
}
.nav-time
{
float
:
right
;
color
:
#333
;
font-size
:
22px
;
margin
:
20px
;
}
.clearfloat
{
clear
:
both
}
.line
{
height
:
2px
;
background
:
rgba
(
72
,
156
,
239
,
.3
);
margin
:
0
30px
;
}
.systemNameCon
{
display
:
flex
;
justify-content
:
space-around
;
align-items
:
center
;
margin
:
20px
0
20px
30px
;
}
.systemNameCon
>
div
{
color
:
#666
;
font-size
:
18px
;
width
:
250px
;
}
.systemNameCon
>
div
>
span
{
color
:
#333
;
font-size
:
18px
;
}
/*keyTec*/
.first
>
div
>
img
,
.second
>
div
>
img
,
.third
>
div
>
img
{
margin
:
20px
10px
-2px
20px
;
}
.first-title
{
margin-bottom
:
10px
;
position
:
relative
;
}
.rightPic
{
position
:
absolute
;
right
:
40px
;
top
:
30px
;
}
.key-title
{
color
:
#d32d2d
;
}
.keySecond-title
{
color
:
#3bb21f
;
}
.keyThird-title
{
color
:
#666
;
}
table
{
width
:
100%
;
}
td
{
text-align
:
center
;
height
:
30px
;
}
tr
td
{
color
:
#d32d2d
;
}
tr
:last-child
td
{
border-bottom
:
1px
dashed
rgba
(
72
,
156
,
239
,
.3
);
}
th
{
border-bottom
:
1px
dashed
rgba
(
72
,
156
,
239
,
.3
);
}
.onAnaly
{
margin
:
0
30px
;
text-align
:
right
;
}
.onAonAnalysis
{
display
:
inline-block
;
color
:
#666
;
padding-right
:
20px
;
}
.onAonAnalysis
>
span
{
color
:
#333
;
}
.className
{
transform
:
rotate
(
180deg
);
}
</style>
</head>
<body>
<div
class=
"detailContent"
>
<p
class=
"detailContentT"
>
应用系统信创评估详情
</p>
<div
class=
"systemName"
>
<img
src=
"./img/system.png"
alt=
""
>
<div
class=
"nav-title"
>
系统名称:
<span>
${projectName}
</span></div>
<div
class=
"nav-time"
>
评估时间:
<span>
${createDate}
</span></div>
<div
class=
"clearfloat"
></div>
<div
class=
"line"
></div>
<div
class=
"systemNameCon"
>
<div>
编号:
<span>
${createDate}
</span></div>
<div>
上传类型:
<span>
${uploadType}
</span></div>
<div>
文件名:
<span>
${fileName}
</span></div>
<div>
架构:
<span>
${framework}
</span></div>
</div>
<div
class=
"systemNameCon"
>
<div>
数据库类型:
<span>
${databaseType}
</span></div>
<div>
依赖管理工具:
<span>
${manager}
</span></div>
<div>
语言:
<span>
${language}
</span></div>
<div></div>
</div>
<div
class=
"systemNameCon"
>
</div>
</div>
<div
class=
"keyTec"
>
<div
class=
"first"
>
<div
class=
"first-title"
>
<img
src=
"./img/key.png"
alt=
""
>
<div
class=
"nav-title key-title"
>
关键技术:
<span>
Java依赖(支持国产化)
</span>
<span>
需替换
</span>
</div>
<div
class=
"rightPic"
>
<img
onclick=
"showDiv()"
id=
"pic"
src=
"./img/down.png"
alt=
""
>
</div>
</div>
<div
class=
"line"
></div>
<div
id=
"slider"
style=
"margin: 0 100px"
>
<table>
<tr>
<th>
关键字
</th>
<th>
所在文件
</th>
<th>
行数
</th>
</tr>
<tr>
<td>
mysql
</td>
<td>
pp.xl
</td>
<td>
100
</td>
</tr>
<tr>
<td>
mysql
</td>
<td>
pp.xl
</td>
<td>
100
</td>
</tr>
<tr>
<td>
mysql
</td>
<td>
pp.xl
</td>
<td>
100
</td>
</tr>
</table>
</div>
</div>
<div
class=
"second"
>
<div
class=
"first-title"
>
<img
src=
"./img/key.png"
alt=
""
>
<div
class=
"nav-title keySecond-title"
>
关键技术:
<span>
Java依赖(支持国产化)
</span>
<span>
无需替换
</span>
</div>
<div
class=
"rightPic"
>
<img
id=
"pic1"
onclick=
"showDiv1()"
src=
"./img/down.png"
alt=
""
>
</div>
</div>
<div
class=
"line"
></div>
<div
id=
"secondClick"
>
</div>
</div>
<div
class=
"third"
>
<div
class=
"first-title"
>
<img
src=
"./img/key.png"
alt=
""
>
<div
class=
"nav-title keyThird-title"
>
关键技术:
<span>
Java依赖(支持国产化)
</span>
<span>
未知
</span>
</div>
<div
class=
"rightPic "
>
<img
id=
"pic2"
onclick=
"showDiv2()"
src=
"./img/down.png"
alt=
""
>
</div>
</div>
<div
class=
"line"
></div>
<div
class=
"onAnaly"
id=
"thirdClick"
>
<div
class=
"onAonAnalysis"
>
关键技术总共:
<span>
1000
</span></div>
<div
class=
"onAonAnalysis"
>
需要改造的关键技术:
<span>
1000
</span></div>
<div
class=
"onAonAnalysis"
>
泰源系统安可改造评估引擎:
<span>
版本号:10.6.9
</span></div>
</div>
</div>
</div>
</div>
<script
type=
"text/javascript"
>
function
showDiv
(){
var
slider
=
document
.
getElementById
(
"slider"
);
slider
.
style
.
display
=
slider
.
style
.
display
==
"none"
?
""
:
"none"
;
if
(
slider
.
style
.
display
==
"none"
)
{
document
.
getElementById
(
"pic"
).
classList
.
add
(
"className"
)
}
else
{
document
.
getElementById
(
"pic"
).
classList
.
remove
(
"className"
)
}
}
function
showDiv1
(){
var
secondClick
=
document
.
getElementById
(
"secondClick"
);
secondClick
.
style
.
display
=
secondClick
.
style
.
display
==
"none"
?
""
:
"none"
;
if
(
secondClick
.
style
.
display
==
"none"
)
{
document
.
getElementById
(
"pic1"
).
classList
.
add
(
"className"
)
}
else
{
document
.
getElementById
(
"pic1"
).
classList
.
remove
(
"className"
)
}
}
function
showDiv2
(){
var
thirdClick
=
document
.
getElementById
(
"thirdClick"
);
thirdClick
.
style
.
display
=
thirdClick
.
style
.
display
==
"none"
?
""
:
"none"
;
if
(
thirdClick
.
style
.
display
==
"none"
)
{
document
.
getElementById
(
"pic2"
).
classList
.
add
(
"className"
)
}
else
{
document
.
getElementById
(
"pic2"
).
classList
.
remove
(
"className"
)
}
}
</script>
</body>
</html>
\ No newline at end of file
src/main/resources/templates/pg.ftl
0 → 100644
浏览文件 @
98f0daaf
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
应用系统评估详情
</title>
<style>
.detailContent
{
background
:
#f9f9f9
;
height
:
800px
;
}
.detailContentT
{
color
:
#333
;
font-size
:
28px
;
text-align
:
center
;
padding
:
20px
0
;
}
.systemName
{
height
:
215px
;
background
:
#fff
;
margin
:
0
30px
20px
;
}
.systemName
>
img
{
margin
:
20px
10px
-2px
20px
;
}
.keyTec
{
height
:
380px
;
background
:
#fff
;
margin
:
0
30px
;
}
.nav-title
{
color
:
#333
;
font-size
:
22px
;
display
:
inline-block
;
}
.nav-time
{
float
:
right
;
color
:
#333
;
font-size
:
22px
;
margin
:
20px
;
}
.clearfloat
{
clear
:
both
}
.line
{
height
:
2px
;
background
:
rgba
(
72
,
156
,
239
,
.3
);
margin
:
0
30px
;
}
.systemNameCon
{
display
:
flex
;
justify-content
:
space-around
;
align-items
:
center
;
margin
:
20px
0
20px
30px
;
}
.systemNameCon
>
div
{
color
:
#666
;
font-size
:
18px
;
width
:
250px
;
}
.systemNameCon
>
div
>
span
{
color
:
#333
;
font-size
:
18px
;
}
/*keyTec*/
.first
>
div
>
img
,
.second
>
div
>
img
,
.third
>
div
>
img
{
margin
:
20px
10px
-2px
20px
;
}
.first-title
{
margin-bottom
:
10px
;
position
:
relative
;
}
.rightPic
{
position
:
absolute
;
right
:
40px
;
top
:
30px
;
}
.key-title
{
color
:
#d32d2d
;
}
.keySecond-title
{
color
:
#3bb21f
;
}
.keyThird-title
{
color
:
#666
;
}
table
{
width
:
100%
;
}
td
{
text-align
:
center
;
height
:
30px
;
}
tr
td
{
color
:
#d32d2d
;
}
tr
:last-child
td
{
border-bottom
:
1px
dashed
rgba
(
72
,
156
,
239
,
.3
);
}
th
{
border-bottom
:
1px
dashed
rgba
(
72
,
156
,
239
,
.3
);
}
.onAnaly
{
margin
:
0
30px
;
text-align
:
right
;
}
.onAonAnalysis
{
display
:
inline-block
;
color
:
#666
;
padding-right
:
20px
;
}
.onAonAnalysis
>
span
{
color
:
#333
;
}
.className
{
transform
:
rotate
(
180deg
);
}
</style>
</head>
<body>
<div
class=
"detailContent"
>
<p
class=
"detailContentT"
>
应用系统信创评估详情
</p>
<div
class=
"systemName"
>
<img
src=
"./img/system.png"
alt=
""
>
<div
class=
"nav-title"
>
系统名称:
<span>
${projectName}
</span></div>
<div
class=
"nav-time"
>
评估时间:
<span>
${createDate}
</span></div>
<div
class=
"clearfloat"
></div>
<div
class=
"line"
></div>
<div
class=
"systemNameCon"
>
<div>
编号:
<span>
${createDate}
</span></div>
<div>
上传类型:
<span>
${uploadType}
</span></div>
<div>
文件名:
<span>
${fileName}
</span></div>
<div>
架构:
<span>
${framework}
</span></div>
</div>
<div
class=
"systemNameCon"
>
<div>
数据库类型:
<span>
${databaseType}
</span></div>
<div>
依赖管理工具:
<span>
${manager}
</span></div>
<div>
语言:
<span>
${language}
</span></div>
<div></div>
</div>
<div
class=
"systemNameCon"
>
</div>
</div>
<div
class=
"keyTec"
>
<
#
if
warnDetails
??
>
<
#
list
warnDetails
as
warn
>
<div
class=
"first"
>
<div
class=
"first-title"
>
<img
src=
"./img/key.png"
alt=
""
>
<div
class=
"nav-title key-title"
>
关键技术:
<span>
${warn.}Java依赖(支持国产化)
</span>
<span>
需替换
</span>
</div>
<div
class=
"rightPic"
>
<img
onclick=
"showDiv()"
id=
"pic"
src=
"./img/down.png"
alt=
""
>
</div>
</div>
<div
class=
"line"
></div>
<div
id=
"slider"
style=
"margin: 0 100px"
>
<table>
<tr>
<th>
关键字
</th>
<th>
所在文件
</th>
<th>
行数
</th>
</tr>
<tr>
<td>
mysql
</td>
<td>
pp.xl
</td>
<td>
100
</td>
</tr>
<tr>
<td>
mysql
</td>
<td>
pp.xl
</td>
<td>
100
</td>
</tr>
<tr>
<td>
mysql
</td>
<td>
pp.xl
</td>
<td>
100
</td>
</tr>
</table>
</div>
</div>
</
#
list>
</
#
if>
<div
class=
"second"
>
<div
class=
"first-title"
>
<img
src=
"./img/key.png"
alt=
""
>
<div
class=
"nav-title keySecond-title"
>
关键技术:
<span>
Java依赖(支持国产化)
</span>
<span>
无需替换
</span>
</div>
<div
class=
"rightPic"
>
<img
id=
"pic1"
onclick=
"showDiv1()"
src=
"./img/down.png"
alt=
""
>
</div>
</div>
<div
class=
"line"
></div>
<div
id=
"secondClick"
>
</div>
</div>
<div
class=
"third"
>
<div
class=
"first-title"
>
<img
src=
"./img/key.png"
alt=
""
>
<div
class=
"nav-title keyThird-title"
>
关键技术:
<span>
Java依赖(支持国产化)
</span>
<span>
未知
</span>
</div>
<div
class=
"rightPic "
>
<img
id=
"pic2"
onclick=
"showDiv2()"
src=
"./img/down.png"
alt=
""
>
</div>
</div>
<div
class=
"line"
></div>
<div
class=
"onAnaly"
id=
"thirdClick"
>
<div
class=
"onAonAnalysis"
>
关键技术总共:
<span>
1000
</span></div>
<div
class=
"onAonAnalysis"
>
需要改造的关键技术:
<span>
1000
</span></div>
<div
class=
"onAonAnalysis"
>
泰源系统安可改造评估引擎:
<span>
版本号:10.6.9
</span></div>
</div>
</div>
</div>
</div>
<script
type=
"text/javascript"
>
function
showDiv
(){
var
slider
=
document
.
getElementById
(
"slider"
);
slider
.
style
.
display
=
slider
.
style
.
display
==
"none"
?
""
:
"none"
;
if
(
slider
.
style
.
display
==
"none"
)
{
document
.
getElementById
(
"pic"
).
classList
.
add
(
"className"
)
}
else
{
document
.
getElementById
(
"pic"
).
classList
.
remove
(
"className"
)
}
}
function
showDiv1
(){
var
secondClick
=
document
.
getElementById
(
"secondClick"
);
secondClick
.
style
.
display
=
secondClick
.
style
.
display
==
"none"
?
""
:
"none"
;
if
(
secondClick
.
style
.
display
==
"none"
)
{
document
.
getElementById
(
"pic1"
).
classList
.
add
(
"className"
)
}
else
{
document
.
getElementById
(
"pic1"
).
classList
.
remove
(
"className"
)
}
}
function
showDiv2
(){
var
thirdClick
=
document
.
getElementById
(
"thirdClick"
);
thirdClick
.
style
.
display
=
thirdClick
.
style
.
display
==
"none"
?
""
:
"none"
;
if
(
thirdClick
.
style
.
display
==
"none"
)
{
document
.
getElementById
(
"pic2"
).
classList
.
add
(
"className"
)
}
else
{
document
.
getElementById
(
"pic2"
).
classList
.
remove
(
"className"
)
}
}
</script>
</body>
</html>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论