Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
876b55e4
提交
876b55e4
authored
3月 07, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect
上级
4acf2aac
2e1f7b9f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
291 行增加
和
6 行删除
+291
-6
EvaluationController.java
...ava/com/zjty/inspect/controller/EvaluationController.java
+79
-0
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+18
-4
EvaluationDao.java
src/main/java/com/zjty/inspect/dao/EvaluationDao.java
+10
-0
BrowserDifficulty.java
src/main/java/com/zjty/inspect/entity/BrowserDifficulty.java
+5
-0
DatabaseDifficulty.java
...main/java/com/zjty/inspect/entity/DatabaseDifficulty.java
+5
-0
Evaluation.java
src/main/java/com/zjty/inspect/entity/Evaluation.java
+45
-0
FrameDifficulty.java
src/main/java/com/zjty/inspect/entity/FrameDifficulty.java
+5
-0
MiddlewareDifficulty.java
...in/java/com/zjty/inspect/entity/MiddlewareDifficulty.java
+5
-0
ProgramDifficulty.java
src/main/java/com/zjty/inspect/entity/ProgramDifficulty.java
+5
-0
Reform.java
src/main/java/com/zjty/inspect/entity/Reform.java
+1
-1
EvaluationService.java
...main/java/com/zjty/inspect/service/EvaluationService.java
+16
-0
CategoryServiceImpl.java
...va/com/zjty/inspect/service/impl/CategoryServiceImpl.java
+2
-0
ConfigServiceImpl.java
...java/com/zjty/inspect/service/impl/ConfigServiceImpl.java
+2
-0
EvaluationServiceImpl.java
.../com/zjty/inspect/service/impl/EvaluationServiceImpl.java
+92
-0
WorkLoadUtil.java
src/main/java/com/zjty/inspect/utils/WorkLoadUtil.java
+0
-0
application.properties
src/main/resources/application.properties
+1
-1
没有找到文件。
src/main/java/com/zjty/inspect/controller/EvaluationController.java
0 → 100644
浏览文件 @
876b55e4
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.entity.Evaluation
;
import
com.zjty.inspect.entity.PageResult
;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.service.EvaluationService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/evaluation"
)
@Api
(
value
=
"评估报告管理接口"
,
description
=
"评估报告管理接口,提供页面的增、删、改、查"
)
public
class
EvaluationController
{
@Autowired
private
EvaluationService
evaluationService
;
/**
* 新增评估报告
* @param evaluation 评估报告
* @return
*/
@PostMapping
@ApiOperation
(
"新增评估报告"
)
public
ResponseEntity
rule
(
@RequestBody
Evaluation
evaluation
){
evaluationService
.
save
(
evaluation
);
return
ResponseEntity
.
ok
(
200
);
}
/**
* 修改评估报告
* @param evaluation 规则封装
* @param id id
* @return
*/
@PostMapping
(
value
=
"/{id}"
)
@ApiOperation
(
"修改评估报告"
)
public
ResponseEntity
update
(
@RequestBody
Evaluation
evaluation
,
@PathVariable
String
id
){
evaluation
.
setId
(
id
);
evaluationService
.
update
(
evaluation
);
return
ResponseEntity
.
ok
(
200
);
}
/**
* 根据id删除评估报告
* @param id id
* @return
*/
@ApiOperation
(
"根据id删除评估报告"
)
@DeleteMapping
(
value
=
"/{id}"
)
public
ResponseEntity
deleteById
(
@PathVariable
String
id
){
evaluationService
.
delete
(
id
);
return
ResponseEntity
.
ok
(
200
);
}
/**
* 分页+多条件查询
* @param searchMap 查询条件封装
* @param page 页码
* @param size 页大小
* @return 分页结果
*/
@ApiOperation
(
"分页查询页面列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"int"
)
})
@RequestMapping
(
value
=
"/search/{page}/{size}"
,
method
=
RequestMethod
.
POST
)
public
ResponseEntity
findSearch
(
@RequestBody
Map
searchMap
,
@PathVariable
int
page
,
@PathVariable
int
size
){
Page
<
Evaluation
>
pageList
=
evaluationService
.
findSearch
(
searchMap
,
page
,
size
);
return
ResponseEntity
.
ok
(
new
PageResult
<
Evaluation
>(
pageList
.
getTotalElements
(),
pageList
.
getContent
())
);
}
}
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
876b55e4
...
...
@@ -3,10 +3,7 @@ package com.zjty.inspect.controller;
import
com.alibaba.fastjson.JSON
;
import
com.zjty.inspect.dao.TechnologyDao
;
import
com.zjty.inspect.entity.*
;
import
com.zjty.inspect.service.InspectService
;
import
com.zjty.inspect.service.ParameterService
;
import
com.zjty.inspect.service.ReportService
;
import
com.zjty.inspect.service.TechnologyService
;
import
com.zjty.inspect.service.*
;
import
com.zjty.inspect.utils.*
;
import
freemarker.template.TemplateException
;
import
io.swagger.annotations.Api
;
...
...
@@ -16,8 +13,11 @@ import org.apache.commons.io.FileUtils;
import
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.Resource
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
...
...
@@ -37,6 +37,8 @@ import java.util.*;
public
class
InspectController
{
@Autowired
private
InspectService
inspectService
;
@Autowired
private
EvaluationService
evaluationService
;
@Autowired
private
TechnologyService
technologyService
;
...
...
@@ -230,6 +232,7 @@ public class InspectController {
List
<
TechnologyContent
>
technologyContents
=
new
ArrayList
<>();
for
(
Warn
warn:
warns
)
{
TechnologyContent
technologyContent
=
new
TechnologyContent
();
//technologyContent.setLocal(warn.get);
technologyContent
.
setFile
(
warn
.
getFilePath
());
technologyContent
.
setKeyWord
(
warn
.
getRule
());
technologyContent
.
setPosition
(
warn
.
getLineNum
().
toString
());
...
...
@@ -334,11 +337,22 @@ public class InspectController {
assessmentReport
.
setDifficultyAssessment
(
difficultyAssessment
);
WorkLoadUtil
workLoadUtil
=
new
WorkLoadUtil
();
//r:人工费
RestTemplate
restTemplate
=
new
RestTemplate
();
//restTemplate.exchange("localhost:8079/config", HttpMethod.GET,new HttpEntity<>())
//计算f
Budget
budget
=
inspect
.
getBudgets
().
getBudget
().
get
(
0
);
double
f
=
budget
.
getProportion
()*
budget
.
getSysFund
()*
budget
.
getMoneyRate
()*
budget
.
getCoefficient
();
System
.
out
.
println
(
"F:"
+
f
);
workLoadUtil
.
result
(
reform
,
assessmentReport
,
f
,
120
);
Evaluation
evaluation
=
new
Evaluation
();
//输入参数
String
in
=
JSON
.
toJSONString
(
reform
);
//输出参数
String
out
=
JSON
.
toJSONString
(
assessmentReport
);
evaluation
.
setInEva
(
in
);
evaluation
.
setOutEva
(
out
);
evaluation
.
setUsername
(
reform
.
getUsername
());
evaluationService
.
save
(
evaluation
);
return
ResponseEntity
.
ok
(
assessmentReport
);
}
...
...
src/main/java/com/zjty/inspect/dao/EvaluationDao.java
0 → 100644
浏览文件 @
876b55e4
package
com
.
zjty
.
inspect
.
dao
;
import
com.zjty.inspect.entity.Evaluation
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
public
interface
EvaluationDao
extends
JpaRepository
<
Evaluation
,
String
>,
JpaSpecificationExecutor
<
Evaluation
>
{
Evaluation
findByUsernameAndIdNot
(
String
username
,
String
id
);
}
src/main/java/com/zjty/inspect/entity/BrowserDifficulty.java
浏览文件 @
876b55e4
...
...
@@ -29,6 +29,11 @@ public class BrowserDifficulty {
*/
private
double
difficulty
=
1.1
;
/**
* 工作量
*/
private
double
load
=
0.0
;
/**
* 样式
*/
...
...
src/main/java/com/zjty/inspect/entity/DatabaseDifficulty.java
浏览文件 @
876b55e4
...
...
@@ -32,6 +32,11 @@ public class DatabaseDifficulty {
*/
private
double
difficulty
=
1.1
;
/**
* 工作量
*/
private
double
load
=
0.0
;
/**
* 依赖
*/
...
...
src/main/java/com/zjty/inspect/entity/Evaluation.java
0 → 100644
浏览文件 @
876b55e4
package
com
.
zjty
.
inspect
.
entity
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.annotations.Generated
;
import
org.hibernate.annotations.GenerationTime
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
java.sql.Timestamp
;
import
java.util.Date
;
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel
(
description
=
"评估报告管理类"
)
public
class
Evaluation
{
@Id
@Column
(
length
=
48
)
private
String
id
;
private
String
username
;
@Column
(
columnDefinition
=
"TEXT"
)
private
String
inEva
;
@Column
(
columnDefinition
=
"TEXT"
)
private
String
outEva
;
/**
* 数据创建时间
*/
@Column
(
name
=
"create_time"
,
columnDefinition
=
"TIMESTAMP DEFAULT CURRENT_TIMESTAMP"
,
insertable
=
false
,
updatable
=
false
)
@CreatedDate
private
Date
createDate
;
/**
* 数据更新时间
*/
@Column
(
name
=
"update_time"
,
columnDefinition
=
"TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
,
insertable
=
false
)
@LastModifiedDate
private
Date
updateDate
;
}
src/main/java/com/zjty/inspect/entity/FrameDifficulty.java
浏览文件 @
876b55e4
...
...
@@ -30,6 +30,11 @@ public class FrameDifficulty {
*/
private
double
difficulty
=
1.1
;
/**
* 工作量
*/
private
double
load
=
0.0
;
/**
* 详情 1:混合 2:前后端分离
*/
...
...
src/main/java/com/zjty/inspect/entity/MiddlewareDifficulty.java
浏览文件 @
876b55e4
...
...
@@ -32,6 +32,11 @@ public class MiddlewareDifficulty {
*/
private
double
difficulty
=
1.1
;
/**
* 工作量
*/
private
double
load
=
0.0
;
/**
* 依赖详情
*/
...
...
src/main/java/com/zjty/inspect/entity/ProgramDifficulty.java
浏览文件 @
876b55e4
...
...
@@ -32,6 +32,11 @@ public class ProgramDifficulty {
*/
private
double
difficulty
=
1.1
;
/**
* 工作量
*/
private
double
load
=
0.0
;
/**
* 依赖详情
*/
...
...
src/main/java/com/zjty/inspect/entity/Reform.java
浏览文件 @
876b55e4
...
...
@@ -144,7 +144,7 @@ public class Reform {
private
Database
database
;
/**
* 迁移策略 1:休息日 2:晚间切换
* 迁移策略 1:休息日 2:晚间切换
3:短暂停止
*/
private
Integer
strategy
;
/**
...
...
src/main/java/com/zjty/inspect/service/EvaluationService.java
0 → 100644
浏览文件 @
876b55e4
package
com
.
zjty
.
inspect
.
service
;
import
com.zjty.inspect.entity.Evaluation
;
import
com.zjty.inspect.entity.Rule
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
import
java.util.Map
;
public
interface
EvaluationService
{
void
save
(
Evaluation
evaluation
);
void
update
(
Evaluation
evaluation
);
void
delete
(
String
id
);
Page
<
Evaluation
>
findSearch
(
Map
searchMap
,
int
page
,
int
size
);
}
src/main/java/com/zjty/inspect/service/impl/CategoryServiceImpl.java
浏览文件 @
876b55e4
...
...
@@ -5,9 +5,11 @@ import com.zjty.inspect.entity.Category;
import
com.zjty.inspect.service.CategoryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
CategoryServiceImpl
implements
CategoryService
{
@Autowired
private
CategoryDao
categoryDao
;
...
...
src/main/java/com/zjty/inspect/service/impl/ConfigServiceImpl.java
浏览文件 @
876b55e4
...
...
@@ -5,12 +5,14 @@ import com.zjty.inspect.entity.Config;
import
com.zjty.inspect.service.ConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ConfigServiceImpl
implements
ConfigService
{
@Autowired
...
...
src/main/java/com/zjty/inspect/service/impl/EvaluationServiceImpl.java
0 → 100644
浏览文件 @
876b55e4
package
com
.
zjty
.
inspect
.
service
.
impl
;
import
com.zjty.inspect.dao.EvaluationDao
;
import
com.zjty.inspect.entity.Evaluation
;
import
com.zjty.inspect.entity.Rule
;
import
com.zjty.inspect.service.EvaluationService
;
import
com.zjty.inspect.utils.TimeUtil
;
import
com.zjty.inspect.utils.UUIDUtil
;
import
io.netty.util.internal.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
EvaluationServiceImpl
implements
EvaluationService
{
@Autowired
private
EvaluationDao
evaluationDao
;
@Override
public
void
save
(
Evaluation
evaluation
)
{
String
uuid
=
UUIDUtil
.
getUUID
();
evaluation
.
setId
(
uuid
);
Evaluation
evaluation1
=
evaluationDao
.
findByUsernameAndIdNot
(
evaluation
.
getUsername
(),
evaluation
.
getId
());
if
(
evaluation1
!=
null
){
return
;
}
evaluationDao
.
save
(
evaluation
);
}
@Override
public
void
update
(
Evaluation
evaluation
)
{
Evaluation
evaluation1
=
evaluationDao
.
findByUsernameAndIdNot
(
evaluation
.
getUsername
(),
evaluation
.
getId
());
if
(
evaluation1
!=
null
){
return
;
}
if
(
StringUtil
.
isNullOrEmpty
(
evaluation
.
getInEva
()))
{
return
;
}
if
(
StringUtil
.
isNullOrEmpty
(
evaluation
.
getOutEva
()))
{
return
;
}
evaluationDao
.
save
(
evaluation
);
}
@Override
public
void
delete
(
String
id
)
{
evaluationDao
.
deleteById
(
id
);
}
@Override
public
Page
<
Evaluation
>
findSearch
(
Map
searchMap
,
int
page
,
int
size
)
{
Specification
<
Evaluation
>
specification
=
createSpecification
(
searchMap
);
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
);
return
evaluationDao
.
findAll
(
specification
,
pageRequest
);
}
/**
* 动态条件构建
*
* @param searchMap
* @return
*/
private
Specification
<
Evaluation
>
createSpecification
(
Map
searchMap
)
{
return
new
Specification
<
Evaluation
>()
{
@Override
public
Predicate
toPredicate
(
Root
<
Evaluation
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
cb
)
{
List
<
Predicate
>
predicateList
=
new
ArrayList
<
Predicate
>();
if
(
searchMap
.
get
(
"username"
)
!=
null
&&
!
""
.
equals
(
searchMap
.
get
(
"username"
)))
{
predicateList
.
add
(
cb
.
like
(
root
.
get
(
"username"
).
as
(
String
.
class
),
"%"
+
(
String
)
searchMap
.
get
(
"username"
)
+
"%"
));
}
return
cb
.
and
(
predicateList
.
toArray
(
new
Predicate
[
predicateList
.
size
()]));
}
};
}
}
src/main/java/com/zjty/inspect/utils/WorkLoadUtil.java
浏览文件 @
876b55e4
差异被折叠。
点击展开。
src/main/resources/application.properties
浏览文件 @
876b55e4
...
...
@@ -50,7 +50,7 @@ spring.resources.static-locations=classpath:/uploads/
# mysql\u6570\u636E\u5E93\u914D\u7F6E
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
#spring.datasource.url=jdbc:mysql://192.168.1.249:3306/bservice?useSSL=false&serverTimezone=UTC&autoReconnect=true&characterEncoding=utf-8
spring.datasource.url
=
jdbc:mysql://
localhost
:3306/adaptation?useSSL=false&serverTimezone=UTC&autoReconnect=true&characterEncoding=utf-8
spring.datasource.url
=
jdbc:mysql://
120.55.57.35
:3306/adaptation?useSSL=false&serverTimezone=UTC&autoReconnect=true&characterEncoding=utf-8
spring.datasource.username
=
root
spring.datasource.password
=
root
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论