Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
f349f5ad
提交
f349f5ad
authored
3月 04, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect
# Conflicts: # src/main/java/com/zjty/inspect/dao/TechnologyDao.java
上级
f8006732
609ce0b5
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
155 行增加
和
9 行删除
+155
-9
pom.xml
pom.xml
+11
-1
Swagger2Configuration.java
...n/java/com/zjty/inspect/config/Swagger2Configuration.java
+36
-0
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+6
-0
ParamController.java
...ain/java/com/zjty/inspect/controller/ParamController.java
+5
-0
RuleController.java
...main/java/com/zjty/inspect/controller/RuleController.java
+13
-0
TechnologyController.java
...ava/com/zjty/inspect/controller/TechnologyController.java
+26
-0
RuleDao.java
src/main/java/com/zjty/inspect/dao/RuleDao.java
+4
-0
TechnologyDao.java
src/main/java/com/zjty/inspect/dao/TechnologyDao.java
+5
-5
Rule.java
src/main/java/com/zjty/inspect/entity/Rule.java
+4
-0
RuleQo.java
src/main/java/com/zjty/inspect/entity/RuleQo.java
+2
-0
Technology.java
src/main/java/com/zjty/inspect/entity/Technology.java
+2
-3
RuleService.java
src/main/java/com/zjty/inspect/service/RuleService.java
+2
-0
TechnologyService.java
...main/java/com/zjty/inspect/service/TechnologyService.java
+4
-0
RuleServiceImpl.java
...n/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
+11
-0
TechnologyServiceImpl.java
.../com/zjty/inspect/service/impl/TechnologyServiceImpl.java
+24
-0
没有找到文件。
pom.xml
浏览文件 @
f349f5ad
...
...
@@ -23,10 +23,20 @@
</profiles>
<properties>
<java.version>
1.8
</java.version>
<swagger.version>
2.9.2
</swagger.version>
</properties>
<dependencies>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jgit
</groupId>
...
...
src/main/java/com/zjty/inspect/config/Swagger2Configuration.java
0 → 100644
浏览文件 @
f349f5ad
package
com
.
zjty
.
inspect
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
//
@Configuration
@EnableSwagger2
public
class
Swagger2Configuration
{
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.zjty.inspect"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
}
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"评估api文档"
)
.
description
(
"评估api文档"
)
// .termsOfServiceUrl("/")
.
version
(
"1.0"
)
.
build
();
}
}
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
f349f5ad
...
...
@@ -7,6 +7,8 @@ import com.zjty.inspect.utils.FileUtil;
import
com.zjty.inspect.utils.GitLabUtil
;
import
com.zjty.inspect.utils.MavenUtil
;
import
com.zjty.inspect.utils.UUIDUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,6 +26,7 @@ import java.io.*;
*/
@RestController
@RequestMapping
(
"/inspect"
)
@Api
(
value
=
"cms页面管理接口"
,
description
=
"cms页面管理接口,提供页面的增、删、改、查"
)
public
class
InspectController
{
@Autowired
private
InspectService
inspectService
;
...
...
@@ -39,6 +42,7 @@ public class InspectController {
* @throws IOException
*/
@PostMapping
(
"/path"
)
@ApiOperation
(
"上传代码进行评估"
)
public
ResponseEntity
inspect
(
Integer
years
,
Integer
systemFund
,
Integer
modules
,
String
valid
,
Double
framework
,
Double
safety
,
Double
disaster
,
Integer
data
,
Integer
admin
,
MultipartFile
multfile
)
throws
IOException
{
...
...
@@ -69,6 +73,7 @@ public class InspectController {
* @return
*/
@PostMapping
(
"/git"
)
@ApiOperation
(
"git下载代码进行评估"
)
public
ResponseEntity
inspect1
(
@RequestBody
InspectParameter
inspectParameter
){
String
path
=
GitLabUtil
.
downLoadProject
(
inspectParameter
.
getGitAddress
(),
inspectParameter
.
getGitName
());
inspectParameter
.
setId
(
UUIDUtil
.
getUUID
());
...
...
@@ -79,6 +84,7 @@ public class InspectController {
}
@PostMapping
(
"/frontend"
)
@ApiOperation
(
"git下载代码进行评估"
)
public
ResponseEntity
inspect
(
MultipartFile
file
)
throws
IOException
{
return
ResponseEntity
.
ok
(
200
);
...
...
src/main/java/com/zjty/inspect/controller/ParamController.java
浏览文件 @
f349f5ad
...
...
@@ -2,6 +2,8 @@ package com.zjty.inspect.controller;
import
com.zjty.inspect.entity.InspectParameter
;
import
com.zjty.inspect.service.ParameterService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -12,17 +14,20 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequestMapping
(
"/param"
)
@Api
(
value
=
"参数页面管理接口"
,
description
=
"参数页面管理接口,提供页面的增、删、改、查"
)
public
class
ParamController
{
@Autowired
private
ParameterService
parameterService
;
@GetMapping
@ApiOperation
(
"获取参数"
)
public
ResponseEntity
getParam
(
String
id
){
return
ResponseEntity
.
ok
(
parameterService
.
getParameterById
(
id
));
}
@PostMapping
@ApiOperation
(
"保存参数"
)
public
ResponseEntity
saveParam
(
@RequestBody
InspectParameter
inspectParameter
){
parameterService
.
saveParameter
(
inspectParameter
);
return
ResponseEntity
.
ok
(
200
);
...
...
src/main/java/com/zjty/inspect/controller/RuleController.java
浏览文件 @
f349f5ad
...
...
@@ -2,6 +2,8 @@ package com.zjty.inspect.controller;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.service.RuleService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping
(
"/rule"
)
@Api
(
value
=
"规则页面管理接口"
,
description
=
"规则页面管理接口,提供页面的增、删、改、查"
)
public
class
RuleController
{
@Autowired
...
...
@@ -25,6 +28,7 @@ public class RuleController {
* @return
*/
@PostMapping
@ApiOperation
(
"新增规则"
)
public
ResponseEntity
rule
(
@RequestBody
RuleQo
ruleQo
){
ruleService
.
addRule
(
ruleQo
);
return
ResponseEntity
.
ok
(
200
);
...
...
@@ -36,6 +40,7 @@ public class RuleController {
* @return
*/
@PostMapping
(
value
=
"/{id}"
)
@ApiOperation
(
"修改规则"
)
public
ResponseEntity
update
(
@RequestBody
RuleQo
ruleQo
,
@PathVariable
String
id
){
ruleQo
.
setId
(
id
);
ruleService
.
upRule
(
ruleQo
);
...
...
@@ -46,15 +51,23 @@ public class RuleController {
* @param id id
* @return
*/
@ApiOperation
(
"根据id删除规则"
)
@DeleteMapping
(
value
=
"/{id}"
)
public
ResponseEntity
deleteById
(
@PathVariable
String
id
){
ruleService
.
deleteById
(
id
);
return
ResponseEntity
.
ok
(
200
);
}
@ApiOperation
(
"根据name查询规则"
)
@GetMapping
(
value
=
"/{name}"
)
public
ResponseEntity
getName
(
@PathVariable
String
name
)
{
ruleService
.
findByName
(
name
);
return
ResponseEntity
.
ok
(
200
);
}
/**
* 查询所有规则
* @return 规则
*/
@ApiOperation
(
"查询所有规则"
)
@GetMapping
public
ResponseEntity
getRules
(){
return
ResponseEntity
.
ok
(
ruleService
.
findAll
());
...
...
src/main/java/com/zjty/inspect/controller/TechnologyController.java
浏览文件 @
f349f5ad
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.entity.Technology
;
import
com.zjty.inspect.entity.TechnologyQo
;
import
com.zjty.inspect.service.TechnologyService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -14,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"/technology"
)
@RestController
@Api
(
value
=
"适配技术页面管理接口"
,
description
=
"适配技术页面管理接口,提供页面的增、删、改、查"
)
public
class
TechnologyController
{
@Autowired
...
...
@@ -24,15 +28,22 @@ public class TechnologyController {
* @return List
*/
@GetMapping
@ApiOperation
(
"获取所有关键技术"
)
public
ResponseEntity
getTechnologies
(){
return
ResponseEntity
.
ok
(
technologyService
.
findAllTechnology
());
}
@GetMapping
(
"/names"
)
@ApiOperation
(
"获取所有关键技术name"
)
public
ResponseEntity
getTechnologiesName
(){
return
ResponseEntity
.
ok
(
technologyService
.
findAllTechnologyNames
());
}
/**
* 获取所有关键技术
* @return List
*/
@GetMapping
(
value
=
"/{name}"
)
@ApiOperation
(
"根据name获取所有关键技术"
)
public
ResponseEntity
getTechnologies
(
@PathVariable
String
name
){
return
ResponseEntity
.
ok
(
technologyService
.
findAllTechnology
(
name
));
}
...
...
@@ -41,8 +52,23 @@ public class TechnologyController {
* @return List
*/
@PostMapping
@ApiOperation
(
"添加关键技术"
)
public
ResponseEntity
addTechnologies
(
@RequestBody
TechnologyQo
technologyQo
){
technologyService
.
addAdvice
(
technologyQo
);
return
ResponseEntity
.
ok
(
200
);
}
@PostMapping
(
"/add"
)
@ApiOperation
(
"新添加关键技术"
)
public
ResponseEntity
addTechnologies
(
@RequestBody
Technology
technology
){
technologyService
.
add
(
technology
);
return
ResponseEntity
.
ok
(
200
);
}
@PostMapping
(
value
=
"/{id}"
)
@ApiOperation
(
"修改关键技术"
)
public
ResponseEntity
update
(
@RequestBody
Technology
technology
,
@PathVariable
String
id
){
technology
.
setId
(
id
);
technologyService
.
update
(
technology
);
return
ResponseEntity
.
ok
(
200
);
}
}
src/main/java/com/zjty/inspect/dao/RuleDao.java
浏览文件 @
f349f5ad
...
...
@@ -4,6 +4,8 @@ package com.zjty.inspect.dao;
import
com.zjty.inspect.entity.Rule
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
public
interface
RuleDao
extends
JpaRepository
<
Rule
,
String
>
{
/**
* 根据目标关键字查询规则
...
...
@@ -19,4 +21,6 @@ public interface RuleDao extends JpaRepository<Rule,String> {
* @return
*/
Rule
findAllByTargetEqualsAndTechnologyIdEquals
(
String
target
,
String
techId
);
List
<
Rule
>
findAllByTargetLike
(
String
target
);
}
src/main/java/com/zjty/inspect/dao/TechnologyDao.java
浏览文件 @
f349f5ad
...
...
@@ -2,6 +2,7 @@ package com.zjty.inspect.dao;
import
com.zjty.inspect.entity.Technology
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.List
;
...
...
@@ -14,11 +15,6 @@ public interface TechnologyDao extends JpaRepository<Technology,String> {
*/
Technology
findAllByTechnologyNameEquals
(
String
name
);
/**
* 根据名称模糊查询
* @param name 技术名称
* @return
*/
List
<
Technology
>
findAllByTechnologyNameLike
(
String
name
);
/**
...
...
@@ -27,4 +23,8 @@ public interface TechnologyDao extends JpaRepository<Technology,String> {
* @return
*/
List
<
Technology
>
findAllByIdIn
(
List
<
String
>
ids
);
@Query
(
"select technologyName from Technology "
)
List
<
String
>
getTechnologyNames
();
}
src/main/java/com/zjty/inspect/entity/Rule.java
浏览文件 @
f349f5ad
...
...
@@ -29,6 +29,10 @@ public class Rule {
@Id
@Column
(
length
=
48
)
private
String
id
;
/**
* 关键技术名称
*/
private
String
technologyName
;
/**
* 目标关键字
*/
...
...
src/main/java/com/zjty/inspect/entity/RuleQo.java
浏览文件 @
f349f5ad
...
...
@@ -27,4 +27,6 @@ public class RuleQo {
* 适配技术id
*/
private
String
technologyId
;
private
String
technologyName
;
}
src/main/java/com/zjty/inspect/entity/Technology.java
浏览文件 @
f349f5ad
...
...
@@ -46,10 +46,9 @@ public class Technology {
private
Integer
support
;
/**
* 1:前端技术
* 2:后端技术
* 技术类型
*/
private
Integer
backOrFront
=
2
;
private
String
backOrFront
;
/**
* 数据创建时间
*/
...
...
src/main/java/com/zjty/inspect/service/RuleService.java
浏览文件 @
f349f5ad
...
...
@@ -38,4 +38,6 @@ public interface RuleService {
* @return 规则
*/
List
<
Rule
>
findAll
();
List
<
Rule
>
findByName
(
String
name
);
}
src/main/java/com/zjty/inspect/service/TechnologyService.java
浏览文件 @
f349f5ad
...
...
@@ -14,12 +14,16 @@ public interface TechnologyService {
* 新增关键技术点
*/
public
void
addAdvice
(
TechnologyQo
technologyQo
);
public
void
add
(
Technology
technology
);
/**
* 查询所有技术
* @return List
*/
public
List
<
Technology
>
findAllTechnology
();
public
List
<
String
>
findAllTechnologyNames
();
public
List
<
Technology
>
findAllTechnology
(
String
name
);
void
update
(
Technology
technology
);
}
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
f349f5ad
...
...
@@ -39,6 +39,7 @@ public class RuleServiceImpl implements RuleService {
// TODO: 2020-02-27 适配技术与扫描关键字关联
Rule
rule
=
new
Rule
();
rule
.
setTarget
(
ruleQo
.
getTarget
());
rule
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
rule
.
setSuffix
(
ruleQo
.
getSuffix
());
rule
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule
.
setId
(
UUIDUtil
.
getUUID
());
...
...
@@ -50,6 +51,7 @@ public class RuleServiceImpl implements RuleService {
Rule
rule
=
new
Rule
();
rule
.
setTarget
(
ruleQo
.
getTarget
());
rule
.
setSuffix
(
ruleQo
.
getSuffix
());
rule
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
rule
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule
.
setId
(
ruleQo
.
getId
());
ruleDao
.
save
(
rule
);
...
...
@@ -74,4 +76,13 @@ public class RuleServiceImpl implements RuleService {
public
List
<
Rule
>
findAll
()
{
return
ruleDao
.
findAll
();
}
@Override
public
List
<
Rule
>
findByName
(
String
name
)
{
List
<
Rule
>
rules
=
ruleDao
.
findAllByTargetLike
(
"%"
+
name
+
"%"
);
if
(
rules
!=
null
&&
rules
.
size
()>
0
){
return
rules
;
}
return
null
;
}
}
src/main/java/com/zjty/inspect/service/impl/TechnologyServiceImpl.java
浏览文件 @
f349f5ad
...
...
@@ -48,11 +48,30 @@ public class TechnologyServiceImpl implements TechnologyService {
technologyDao
.
save
(
technology
);
}
@Override
public
void
add
(
Technology
technology
)
{
if
(
technology
.
getId
()
==
null
)
{
technology
.
setId
(
UUIDUtil
.
getUUID
());
Technology
te
=
technologyDao
.
findAllByTechnologyNameEquals
(
technology
.
getTechnologyName
());
if
(
te
!=
null
){
return
;
}
}
else
{
technology
.
setId
(
technology
.
getId
());
}
technologyDao
.
save
(
technology
);
}
@Override
public
List
<
Technology
>
findAllTechnology
()
{
return
technologyDao
.
findAll
();
}
@Override
public
List
<
String
>
findAllTechnologyNames
()
{
return
technologyDao
.
getTechnologyNames
();
}
@Override
public
List
<
Technology
>
findAllTechnology
(
String
name
)
{
List
<
Technology
>
allByTechnologyNameLike
=
technologyDao
.
findAllByTechnologyNameLike
(
"%"
+
name
+
"%"
);
...
...
@@ -61,4 +80,9 @@ public class TechnologyServiceImpl implements TechnologyService {
}
return
technologyDao
.
findAllByTechnologyNameLike
(
"%"
+
name
+
"%"
);
}
@Override
public
void
update
(
Technology
technology
)
{
technologyDao
.
save
(
technology
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论