Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
f61abf2e
提交
f61abf2e
authored
4月 07, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
评估报告管理页面修改v1.0.4
上级
24a80904
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
55 行增加
和
6 行删除
+55
-6
TechnologyService.java
...main/java/com/zjty/inspect/service/TechnologyService.java
+1
-0
RuleServiceImpl.java
...n/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
+32
-4
TechnologyServiceImpl.java
.../com/zjty/inspect/service/impl/TechnologyServiceImpl.java
+13
-0
FileUtil.java
src/main/java/com/zjty/inspect/utils/FileUtil.java
+9
-2
没有找到文件。
src/main/java/com/zjty/inspect/service/TechnologyService.java
浏览文件 @
f61abf2e
...
@@ -17,6 +17,7 @@ public interface TechnologyService {
...
@@ -17,6 +17,7 @@ public interface TechnologyService {
*/
*/
public
void
addAdvice
(
TechnologyQo
technologyQo
);
public
void
addAdvice
(
TechnologyQo
technologyQo
);
public
void
add
(
Technology
technology
);
public
void
add
(
Technology
technology
);
public
void
addTech
(
Technology
technology
);
/**
/**
* 查询所有技术
* 查询所有技术
...
...
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
f61abf2e
package
com
.
zjty
.
inspect
.
service
.
impl
;
package
com
.
zjty
.
inspect
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zjty.inspect.dao.RuleCollectionDao
;
import
com.zjty.inspect.dao.RuleCollectionDao
;
import
com.zjty.inspect.dao.RuleDao
;
import
com.zjty.inspect.dao.RuleDao
;
import
com.zjty.inspect.entity.*
;
import
com.zjty.inspect.entity.*
;
...
@@ -17,6 +18,7 @@ import org.springframework.data.jpa.domain.Specification;
...
@@ -17,6 +18,7 @@ import org.springframework.data.jpa.domain.Specification;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
...
@@ -73,7 +75,14 @@ public class RuleServiceImpl implements RuleService {
...
@@ -73,7 +75,14 @@ public class RuleServiceImpl implements RuleService {
ruleCollectionDao
.
save
(
ruleCollection
);
ruleCollectionDao
.
save
(
ruleCollection
);
}
}
public
void
saveRule
(
Rule
rule
)
{
String
suffix
=
rule
.
getSuffix
();
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEqualsAndTechnologyIdEquals
(
rule
.
getTarget
(),
suffix
,
rule
.
getTechnologyId
());
if
(
rule1
!=
null
)
{
return
;
}
ruleDao
.
save
(
rule
);
}
@Override
@Override
public
void
addRule
(
List
<
Rule
>
rules
)
{
public
void
addRule
(
List
<
Rule
>
rules
)
{
ruleDao
.
saveAll
(
rules
);
ruleDao
.
saveAll
(
rules
);
...
@@ -257,7 +266,7 @@ public class RuleServiceImpl implements RuleService {
...
@@ -257,7 +266,7 @@ public class RuleServiceImpl implements RuleService {
}
}
syncData
.
setTechnologies
(
technologySyns
);
syncData
.
setTechnologies
(
technologySyns
);
String
s
=
JSON
.
toJSONString
(
syncData
);
String
s
=
JSON
.
toJSONString
(
syncData
);
String
path
=
System
.
getProperty
(
"user.dir"
)+
File
.
separator
+
"inspect"
+
File
.
separator
+
"
评测微服务数据
.txt"
;
String
path
=
System
.
getProperty
(
"user.dir"
)+
File
.
separator
+
"inspect"
+
File
.
separator
+
"
inspect
.txt"
;
//2.生成json文件
//2.生成json文件
FileUtil
.
write
(
s
,
path
);
FileUtil
.
write
(
s
,
path
);
return
path
;
return
path
;
...
@@ -278,12 +287,31 @@ public class RuleServiceImpl implements RuleService {
...
@@ -278,12 +287,31 @@ public class RuleServiceImpl implements RuleService {
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
//1.导入json文件
String
s
=
readTxt
(
dest
.
getAbsolutePath
());
String
s
=
readTxt
(
dest
.
getAbsolutePath
());
System
.
out
.
println
(
s
);
System
.
out
.
println
(
s
);
//1.导入json文件
if
(!
StringUtils
.
isEmpty
(
s
)){
//2.清洗规则数据
//2.清洗规则数据
//3.将数据添加到数据库中
//3.将数据添加到数据库中
//4.生成json文件
SyncData
syncData
=
JSON
.
parseObject
(
s
,
SyncData
.
class
);
List
<
TechnologySyn
>
technologies
=
syncData
.
getTechnologies
();
if
(
technologies
!=
null
&&
technologies
.
size
()>
0
)
{
for
(
TechnologySyn
technology
:
technologies
)
{
List
<
Rule
>
rules
=
technology
.
getRules
();
if
(
rules
!=
null
&&
rules
.
size
()>
0
){
for
(
Rule
rule
:
rules
)
{
saveRule
(
rule
);
}
}
}
ruleCollectionDao
.
deleteAll
();
List
<
Rule
>
all
=
ruleDao
.
findAll
();
List
<
RuleCollection
>
ruleCollections
=
dataList2RuleCollection
(
all
);
ruleCollectionDao
.
saveAll
(
ruleCollections
);
}
}
}
}
public
String
readTxt
(
String
filePath
){
public
String
readTxt
(
String
filePath
){
...
...
src/main/java/com/zjty/inspect/service/impl/TechnologyServiceImpl.java
浏览文件 @
f61abf2e
...
@@ -13,6 +13,7 @@ import org.springframework.data.domain.PageRequest;
...
@@ -13,6 +13,7 @@ import org.springframework.data.domain.PageRequest;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.CriteriaQuery
;
...
@@ -75,6 +76,18 @@ public class TechnologyServiceImpl implements TechnologyService {
...
@@ -75,6 +76,18 @@ public class TechnologyServiceImpl implements TechnologyService {
technologyDao
.
save
(
technology
);
technologyDao
.
save
(
technology
);
}
}
@Override
public
void
addTech
(
Technology
technology
)
{
Optional
<
Technology
>
optional
=
technologyDao
.
findById
(
technology
.
getId
());
if
(
optional
.
isPresent
()){
Technology
te
=
optional
.
get
();
if
(
te
.
getTechnologyName
().
equals
(
technology
.
getTechnologyName
())){
return
;
}
}
}
@Override
@Override
public
List
<
Technology
>
findAllTechnology
()
{
public
List
<
Technology
>
findAllTechnology
()
{
return
technologyDao
.
findAll
();
return
technologyDao
.
findAll
();
...
...
src/main/java/com/zjty/inspect/utils/FileUtil.java
浏览文件 @
f61abf2e
...
@@ -152,13 +152,20 @@ public class FileUtil {
...
@@ -152,13 +152,20 @@ public class FileUtil {
}
}
}
}
File
file
=
new
File
(
path
);
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
if
(
file
.
exists
()){
file
.
delete
();
}
if
(!
file
.
getParentFile
().
exists
())
{
boolean
mkdir
=
file
.
getParentFile
().
mkdirs
();
if
(!
mkdir
)
{
throw
new
RuntimeException
(
"创建目标文件所在目录失败!"
);
}
}
try
{
try
{
file
.
createNewFile
();
file
.
createNewFile
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
return
file
;
return
file
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论