Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
ddba1ae7
提交
ddba1ae7
authored
3月 06, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
关键技术接口根据name查询功能
上级
a657cb3e
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
58 行增加
和
29 行删除
+58
-29
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+3
-23
InspectService.java
src/main/java/com/zjty/inspect/service/InspectService.java
+4
-0
InspectServiceImpl.java
...ava/com/zjty/inspect/service/impl/InspectServiceImpl.java
+48
-3
RuleServiceImpl.java
...n/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
+1
-1
pg.ftl
src/main/resources/templates/pg.ftl
+2
-2
没有找到文件。
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
ddba1ae7
...
...
@@ -103,29 +103,9 @@ public class InspectController {
int
support
=
technologyService
.
findAllTechnologyNotSupport
();
reportVo
.
setTechnologiesRepair
(
support
);
log
.
info
(
"inspect:代码评估完成"
);
// Map map = new HashMap();
// map.put("inspect", inspect);
// map.put("time", TimeUtil.getTime());
// HashMap<String, List<Warn>> warnMap = inspect.getWarnDetails();
// List<Technology> technologies = inspect.getTechnologies();
// Map techMap = new HashMap();
// for (Technology technology : technologies) {
// techMap.put(technology.getTechnologyName(), technology.getSupport());
// }
// map.put("techMap", techMap);
// map.put("warnMap", warnMap);
// map.put("technologies", technologies);
// try {
// String template = FreemarkerUtils.getTemplate("pg.ftl", map);
// String s = inspectService.generateHtml(template, map);
// String filePath = FileUtil.createFilePath();
// File file1 = new File("./pgbg/" + filePath + "/" + file.getName() + ".html");
// FileUtil.write(s,"./pgbg/"+filePath+"/"+file.getName()+".html");
// reportVo.setHtmlAddress(file1.getCanonicalPath());
// System.out.println("内容"+s);
// } catch (TemplateException e) {
// e.printStackTrace();
// }
String
filePath
=
inspectService
.
freemakerData
(
inspect
,
count
,
support
);
reportVo
.
setHtmlAddress
(
filePath
);
Report
report
=
new
Report
();
String
random
=
RandomUtil
.
getRandom
();
report
.
setId
(
RandomUtil
.
getRandom
());
...
...
src/main/java/com/zjty/inspect/service/InspectService.java
浏览文件 @
ddba1ae7
...
...
@@ -14,4 +14,8 @@ public interface InspectService {
*/
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
);
String
generateHtml
(
String
templateContent
,
Map
model
);
String
freemakerData
(
ReportVo
inspect
,
int
count
,
int
support
);
}
src/main/java/com/zjty/inspect/service/impl/InspectServiceImpl.java
浏览文件 @
ddba1ae7
package
com
.
zjty
.
inspect
.
service
.
impl
;
import
com.zjty.inspect.dao.ReportDao
;
import
com.zjty.inspect.entity.InspectParameter
;
import
com.zjty.inspect.entity.Report
;
import
com.zjty.inspect.entity.ReportVo
;
import
com.zjty.inspect.entity.*
;
import
com.zjty.inspect.enums.Language
;
import
com.zjty.inspect.service.InspectService
;
import
com.zjty.inspect.inspect.Inspector
;
import
com.zjty.inspect.service.ParameterService
;
import
com.zjty.inspect.service.TechnologyService
;
import
com.zjty.inspect.utils.FileUtil
;
import
com.zjty.inspect.utils.FreemarkerUtils
;
import
com.zjty.inspect.utils.RandomUtil
;
import
com.zjty.inspect.utils.TimeUtil
;
import
freemarker.cache.StringTemplateLoader
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
freemarker.template.TemplateException
;
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.io.File
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -33,6 +38,8 @@ public class InspectServiceImpl implements InspectService {
@Autowired
private
ReportDao
reportDao
;
@Autowired
private
TechnologyService
technologyService
;
@Autowired
private
ParameterService
parameterService
;
...
...
@@ -64,8 +71,44 @@ public class InspectServiceImpl implements InspectService {
return
reportVoReturn
;
}
/**
* 处理数据
* @return
* count 总共的关键技术
* notSupport 不支持的关键技术数量
*/
@Override
public
String
freemakerData
(
ReportVo
inspect
,
int
count
,
int
notSupport
)
{
try
{
Map
map
=
new
HashMap
();
map
.
put
(
"inspect"
,
inspect
);
map
.
put
(
"time"
,
TimeUtil
.
getTime
());
HashMap
<
String
,
List
<
Warn
>>
warnMap
=
inspect
.
getWarnDetails
();
List
<
Technology
>
technologies
=
technologyService
.
findAllTechnology
();
Map
techMap
=
new
HashMap
();
for
(
Technology
technology
:
technologies
)
{
techMap
.
put
(
technology
.
getTechnologyName
(),
technology
.
getSupport
());
}
map
.
put
(
"techMap"
,
techMap
);
map
.
put
(
"count"
,
count
);
map
.
put
(
"notSupport"
,
notSupport
);
map
.
put
(
"warnMap"
,
warnMap
);
map
.
put
(
"technologies"
,
technologies
);
String
template
=
FreemarkerUtils
.
getTemplate
(
"pg.ftl"
,
map
);
String
s
=
generateHtml
(
template
,
map
);
String
filePath
=
FileUtil
.
createFilePath
();
FileUtil
.
write
(
s
,
"/opt/inspect/freemaker/"
+
filePath
+
"/"
+
inspect
.
getProjectName
()+
".html"
);
String
fn
=
"/freemaker/"
+
filePath
+
"/"
+
inspect
.
getProjectName
()+
".html"
;
return
fn
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
//执行静态化
public
String
generateHtml
(
String
templateContent
,
Map
model
){
//创建配置对象
Configuration
configuration
=
new
Configuration
(
Configuration
.
getVersion
());
//创建模板加载器
...
...
@@ -85,4 +128,6 @@ public class InspectServiceImpl implements InspectService {
return
null
;
}
}
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
ddba1ae7
...
...
@@ -118,7 +118,7 @@ public class RuleServiceImpl implements RuleService {
@Override
public
void
upRule
(
RuleQo
ruleQo
)
{
Rule
rule1
=
ruleDao
.
findByTarget
(
ruleQo
.
getId
());
if
(
rule1
=
=
null
)
{
if
(
rule1
!
=
null
)
{
return
;
}
rule1
.
setTarget
(
ruleQo
.
getTarget
());
...
...
src/main/resources/templates/pg.ftl
浏览文件 @
ddba1ae7
...
...
@@ -224,8 +224,8 @@
<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>
${count?default("0")}
</span></div>
<div
class=
"onAonAnalysis"
>
需要改造的关键技术:
<span>
${notSupport?default("0")}
</span></div>
<div
class=
"onAonAnalysis"
>
泰源系统安可改造评估引擎:
<span>
版本号:10.6.9
</span></div>
</div>
</div>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论