Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
eb3b263d
提交
eb3b263d
authored
3月 07, 2020
作者:
czq
浏览文件
操作
浏览文件
下载
差异文件
czq
上级
ebdffde4
9229a3c4
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
332 行增加
和
88 行删除
+332
-88
.gitignore
.gitignore
+2
-0
MvcConfig.java
src/main/java/com/zjty/inspect/config/MvcConfig.java
+18
-0
ConfigController.java
...in/java/com/zjty/inspect/controller/ConfigController.java
+44
-0
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+57
-51
ConfigParamDao.java
src/main/java/com/zjty/inspect/dao/ConfigParamDao.java
+1
-0
ParameterDao.java
src/main/java/com/zjty/inspect/dao/ParameterDao.java
+2
-0
TechnologyDao.java
src/main/java/com/zjty/inspect/dao/TechnologyDao.java
+1
-1
Budget.java
src/main/java/com/zjty/inspect/entity/Budget.java
+20
-0
BudgetVo.java
src/main/java/com/zjty/inspect/entity/BudgetVo.java
+4
-0
DependencyVo.java
src/main/java/com/zjty/inspect/entity/DependencyVo.java
+2
-2
File.java
src/main/java/com/zjty/inspect/entity/File.java
+10
-0
InspectParameter.java
src/main/java/com/zjty/inspect/entity/InspectParameter.java
+4
-5
Report.java
src/main/java/com/zjty/inspect/entity/Report.java
+1
-4
ReportVo.java
src/main/java/com/zjty/inspect/entity/ReportVo.java
+9
-0
RuleQo.java
src/main/java/com/zjty/inspect/entity/RuleQo.java
+3
-1
CompatibleBrowser.java
src/main/java/com/zjty/inspect/enums/CompatibleBrowser.java
+0
-1
Inspector.java
src/main/java/com/zjty/inspect/inspect/Inspector.java
+0
-0
ConfigService.java
src/main/java/com/zjty/inspect/service/ConfigService.java
+11
-0
ParameterService.java
src/main/java/com/zjty/inspect/service/ParameterService.java
+7
-0
ConfigServiceImpl.java
...java/com/zjty/inspect/service/impl/ConfigServiceImpl.java
+26
-0
ParameterServiceImpl.java
...a/com/zjty/inspect/service/impl/ParameterServiceImpl.java
+14
-0
RuleServiceImpl.java
...n/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
+15
-17
AnalysisFile.java
src/main/java/com/zjty/inspect/utils/AnalysisFile.java
+20
-2
BigDecimalUtil.java
src/main/java/com/zjty/inspect/utils/BigDecimalUtil.java
+23
-0
BudgetUitl.java
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
+38
-3
FileUtil.java
src/main/java/com/zjty/inspect/utils/FileUtil.java
+0
-1
WorkLoadUtil.java
src/main/java/com/zjty/inspect/utils/WorkLoadUtil.java
+0
-0
没有找到文件。
.gitignore
浏览文件 @
eb3b263d
...
...
@@ -4,6 +4,8 @@ target/
**/lib/**
**/.DS_Store
./2020-**-**/**
!**/src/main/**
!**/src/test/**
mvnw
...
...
src/main/java/com/zjty/inspect/config/MvcConfig.java
0 → 100644
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
@Configuration
public
class
MvcConfig
{
public
WebMvcConfigurer
webMvcConfigurer
(){
return
new
WebMvcConfigurer
()
{
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/freemaker/**"
).
addResourceLocations
(
"file:/opt/inspect/freemaker/"
);
}
};
}
}
src/main/java/com/zjty/inspect/controller/ConfigController.java
0 → 100644
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.entity.Config
;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.service.ConfigService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
@Slf4j
@RestController
@RequestMapping
(
"/config"
)
@Api
(
value
=
"参数配置接口管理接口"
,
description
=
"参数配置管理接口,提供页面的增、删、改、查"
)
public
class
ConfigController
{
@Autowired
private
ConfigService
configService
;
/**
* 查询所有参数配置
* @return 参数配置
*/
@ApiOperation
(
"查询所有参数配置"
)
@GetMapping
public
ResponseEntity
getConfigs
(){
return
ResponseEntity
.
ok
(
configService
.
findAll
());
}
/**
* 根据name修改参数
* @param config 参数
* @param name name
* @return
*/
@PostMapping
(
value
=
"/{name}"
)
@ApiOperation
(
"根据name修改参数"
)
public
ResponseEntity
update
(
@RequestBody
Config
config
,
@PathVariable
String
name
){
config
.
setName
(
name
);
configService
.
updateConfig
(
config
);
return
ResponseEntity
.
ok
(
200
);
}
}
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
eb3b263d
...
...
@@ -11,6 +11,7 @@ import com.zjty.inspect.utils.*;
import
freemarker.template.TemplateException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -25,11 +26,13 @@ import java.util.*;
/**
* 评估接口
*
* @author mcj
*/
@Slf4j
@RestController
@RequestMapping
(
"/inspect"
)
@Api
(
value
=
"评估接口管理接口"
,
description
=
"评估管理接口,提供页面的增、删、改、查"
)
@Api
(
value
=
"评估接口管理接口"
,
description
=
"评估管理接口,提供页面的增、删、改、查"
)
public
class
InspectController
{
@Autowired
private
InspectService
inspectService
;
...
...
@@ -42,32 +45,35 @@ public class InspectController {
@Autowired
private
ReportService
reportService
;
/**
* 上传代码进行评估
*
* @param years 系统开发时间
* @param systemFund
系统开发费用
* @param modules 模块数
* @param valid 预算数据是否可用
* @param framework 架构
* @param safety 安全能力
* @param disaster 容灾能力
* @param data 数据量
* @param admin 是否管理员
* @param multfile 文件
* @param systemFund 系统开发费用
* @param modules
模块数
* @param valid
预算数据是否可用
* @param framework
架构
* @param safety
安全能力
* @param disaster
容灾能力
* @param data
数据量
* @param admin
是否管理员
* @param multfile
文件
* @return
* @throws IOException
*/
@PostMapping
(
"/path"
)
@ApiOperation
(
"上传代码进行评估"
)
public
ResponseEntity
inspect
(
Integer
years
,
Integer
systemFund
,
Integer
modules
,
String
valid
,
Integer
framework
,
Integer
safety
,
Integer
disaster
,
Integer
data
,
Integer
admin
,
String
projectName
,
Integer
tables
,
String
databaseType
,
Integer
method
,
MultipartFile
multfile
)
throws
IOException
{
public
ResponseEntity
inspect
(
Integer
years
,
Integer
systemFund
,
Integer
modules
,
String
valid
,
Integer
framework
,
Integer
safety
,
Integer
disaster
,
Integer
data
,
Integer
admin
,
String
projectName
,
Integer
tables
,
String
databaseType
,
Integer
method
,
String
username
,
MultipartFile
multfile
)
throws
IOException
{
File
file
=
FileUtil
.
saveToLocal
(
multfile
);
log
.
info
(
"inspect:代码解压完成,地址为{}"
,
file
.
getCanonicalPath
());
InspectParameter
inspectParameter
=
new
InspectParameter
();
inspectParameter
.
setSourceAddress
(
file
.
getCanonicalPath
());
inspectParameter
.
setUsername
(
username
);
inspectParameter
.
setSystemFund
(
systemFund
);
inspectParameter
.
setAdmin
(
admin
);
inspectParameter
.
setModules
(
modules
);
inspectParameter
.
setSafety
(
safety
);
inspectParameter
.
setTables
(
tables
);
...
...
@@ -76,67 +82,67 @@ public class InspectController {
inspectParameter
.
setDisaster
(
disaster
);
inspectParameter
.
setData
(
data
);
inspectParameter
.
setFramework
(
framework
);
inspectParameter
.
setPath
(
file
.
getCanonicalPath
());
inspectParameter
.
setRecastMethod
(
method
);
inspectParameter
.
setId
(
UUIDUtil
.
getUUID
());
inspectParameter
.
setAdmin
(
admin
);
inspectParameter
.
setSystemFund
(
systemFund
);
inspectParameter
.
setRecastMethod
(
method
);
inspectParameter
.
setSourceAddress
(
file
.
getCanonicalPath
());
ReportVo
reportVo
=
new
ReportVo
();
int
count
=
technologyService
.
findAllTechnologyCount
();
reportVo
.
setTechnologiesNum
(
count
);
int
support
=
technologyService
.
findAllTechnologyNotSupport
();
reportVo
.
setTechnologiesRepair
(
support
);
reportVo
.
setId
(
RandomUtil
.
getRandom
());
reportVo
.
setUploadType
(
"文件上传"
);
reportVo
.
setFileName
(
file
.
getName
());
reportVo
.
setProjectName
(
projectName
);
reportVo
.
setSourceAddress
(
file
.
getCanonicalPath
());
reportVo
.
setDatabaseType
(
databaseType
);
ReportVo
inspect
=
inspectService
.
inspect
(
reportVo
,
inspectParameter
);
ReportVo
inspect
=
inspectService
.
inspect
(
reportVo
,
inspectParameter
);
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
();
}
int
count
=
technologyService
.
findAllTechnologyCount
();
reportVo
.
setTechnologiesNum
(
count
);
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();
// }
Report
report
=
new
Report
();
String
random
=
RandomUtil
.
getRandom
();
report
.
setId
(
RandomUtil
.
getRandom
());
report
.
setHtmlAddress
(
reportVo
.
getHtmlAddress
());
reportService
.
saveReport
(
report
);
inspectParameter
.
setReportId
(
random
);
parameterService
.
saveParameter
(
inspectParameter
);
return
ResponseEntity
.
ok
(
inspect
);
}
/**
* git下载代码进行评估
*
* @param inspectParameter 封装
* @return
*/
@PostMapping
(
"/git"
)
@ApiOperation
(
"git下载代码进行评估"
)
public
ResponseEntity
inspect1
(
@RequestBody
InspectParameter
inspectParameter
){
String
path
=
GitLabUtil
.
downLoadProject
(
inspectParameter
.
getGitAddress
(),
inspectParameter
.
getGitName
());
public
ResponseEntity
inspect1
(
@RequestBody
InspectParameter
inspectParameter
)
{
String
path
=
GitLabUtil
.
downLoadProject
(
inspectParameter
.
getGitAddress
(),
inspectParameter
.
getGitName
());
inspectParameter
.
setId
(
UUIDUtil
.
getUUID
());
inspectParameter
.
setSourceAddress
(
path
);
ReportVo
reportVo
=
new
ReportVo
();
...
...
src/main/java/com/zjty/inspect/dao/ConfigParamDao.java
浏览文件 @
eb3b263d
...
...
@@ -9,4 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
*/
public
interface
ConfigParamDao
extends
JpaRepository
<
Config
,
Integer
>
{
Config
findByName
(
String
name
);
}
src/main/java/com/zjty/inspect/dao/ParameterDao.java
浏览文件 @
eb3b263d
...
...
@@ -4,4 +4,6 @@ import com.zjty.inspect.entity.InspectParameter;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
ParameterDao
extends
JpaRepository
<
InspectParameter
,
String
>
{
InspectParameter
findByUsernameEquals
(
String
username
);
}
src/main/java/com/zjty/inspect/dao/TechnologyDao.java
浏览文件 @
eb3b263d
...
...
@@ -47,5 +47,5 @@ public interface TechnologyDao extends JpaRepository<Technology,String>, JpaSpec
* @param backOrFront
* @return
*/
List
<
Technology
>
findAllByBackorfrontEquals
(
String
backOrFront
);
List
<
Technology
>
findAllByBackorfrontEquals
(
Integer
backOrFront
);
}
src/main/java/com/zjty/inspect/entity/Budget.java
浏览文件 @
eb3b263d
...
...
@@ -34,4 +34,24 @@ public class Budget {
*/
private
String
fundDetail
;
/**
* 占比
*/
private
double
proportion
;
/**
* 系统开发费用
*/
private
Integer
sysFund
;
/**
* 年利率
*/
private
double
moneyRate
;
/**
* 修正系数
*/
private
double
coefficient
;
}
src/main/java/com/zjty/inspect/entity/BudgetVo.java
浏览文件 @
eb3b263d
...
...
@@ -16,5 +16,9 @@ public class BudgetVo {
private
List
<
Budget
>
budget
=
new
ArrayList
<>();
/**
* 修正系数
*/
private
List
<
CoefficientModelVo
>
coefficientModelVos
=
new
ArrayList
<>();
}
src/main/java/com/zjty/inspect/entity/DependencyVo.java
浏览文件 @
eb3b263d
...
...
@@ -13,8 +13,8 @@ import java.util.List;
*/
@Data
public
class
DependencyVo
implements
Serializable
{
private
List
<
ProjectPom
>
depTreeList
=
new
ArrayList
<>();
private
List
<
ProjectPom
>
frontend
=
new
ArrayList
<>();
private
List
<
ProjectPom
>
depTreeList
=
new
ArrayList
<>(
64
);
private
List
<
ProjectPom
>
frontend
=
new
ArrayList
<>(
64
);
public
void
add
(
ProjectPom
projectPom
){
depTreeList
.
add
(
projectPom
);
...
...
src/main/java/com/zjty/inspect/entity/File.java
0 → 100644
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
entity
;
/**
* <h4>Description : inspect</h4>
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2020-03-06 21:25
*/
public
class
File
{
}
src/main/java/com/zjty/inspect/entity/InspectParameter.java
浏览文件 @
eb3b263d
...
...
@@ -22,6 +22,10 @@ public class InspectParameter {
@Id
private
String
id
;
/**
* 用户名
*/
private
String
username
;
/**
* 重构占比
*/
...
...
@@ -87,11 +91,6 @@ public class InspectParameter {
*/
private
Integer
disaster
;
/**
* git地址
*/
private
String
path
;
/**
* null:无效
*/
...
...
src/main/java/com/zjty/inspect/entity/Report.java
浏览文件 @
eb3b263d
...
...
@@ -26,10 +26,7 @@ public class Report {
*/
private
String
htmlAddress
;
//前端适配预算
//代码重构预算
//代码修改预算
private
String
username
;
/**
* 数据创建时间
*/
...
...
src/main/java/com/zjty/inspect/entity/ReportVo.java
浏览文件 @
eb3b263d
...
...
@@ -99,6 +99,15 @@ public class ReportVo {
*/
private
Integer
technologiesRepair
;
/**
* 文件个数
*/
private
Integer
fileNum
;
/**
* 文件行数
*/
private
Integer
fileLine
;
/**
* 评估时间
...
...
src/main/java/com/zjty/inspect/entity/RuleQo.java
浏览文件 @
eb3b263d
...
...
@@ -23,7 +23,9 @@ public class RuleQo {
/**
* 匹配的文件后缀
*/
private
List
<
String
>
suffix
;
private
List
<
String
>
suffixes
;
private
String
suffix
;
/**
* 适配技术id
...
...
src/main/java/com/zjty/inspect/enums/CompatibleBrowser.java
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
enums
;
import
jdk.internal.dynalink.beans.BeansLinker
;
/**
* <h4>Description : 兼容的浏览器</h4>
...
...
src/main/java/com/zjty/inspect/inspect/Inspector.java
浏览文件 @
eb3b263d
差异被折叠。
点击展开。
src/main/java/com/zjty/inspect/service/ConfigService.java
0 → 100644
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
service
;
import
com.zjty.inspect.entity.Config
;
import
java.util.List
;
public
interface
ConfigService
{
public
void
updateConfig
(
Config
config
);
List
<
Config
>
findAll
();
}
src/main/java/com/zjty/inspect/service/ParameterService.java
浏览文件 @
eb3b263d
...
...
@@ -20,4 +20,11 @@ public interface ParameterService {
* @param id id
*/
public
InspectParameter
getParameterById
(
String
id
);
/**
* 根据用户名获取参数
* @param username 用户名
* @return 参数对象
*/
public
InspectParameter
getParameterByUsername
(
String
username
);
}
src/main/java/com/zjty/inspect/service/impl/ConfigServiceImpl.java
0 → 100644
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
service
.
impl
;
import
com.zjty.inspect.dao.ConfigParamDao
;
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
java.util.List
;
@Service
public
class
ConfigServiceImpl
implements
ConfigService
{
@Autowired
private
ConfigParamDao
configParamDao
;
@Override
public
void
updateConfig
(
Config
config
)
{
Config
c
=
configParamDao
.
findByName
(
config
.
getName
());
c
.
setValue
(
config
.
getValue
());
configParamDao
.
save
(
c
);
}
@Override
public
List
<
Config
>
findAll
()
{
return
configParamDao
.
findAll
();
}
}
src/main/java/com/zjty/inspect/service/impl/ParameterServiceImpl.java
浏览文件 @
eb3b263d
...
...
@@ -7,6 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Objects
;
import
java.util.Optional
;
/**
* 参数
* @author Mcj
...
...
@@ -32,4 +35,15 @@ public class ParameterServiceImpl implements ParameterService {
}
return
new
InspectParameter
();
}
/**
* 根据用户名查询参数
* @param username 用户名
* @return 参数
*/
@Override
public
InspectParameter
getParameterByUsername
(
String
username
)
{
InspectParameter
inspectParameter
=
parameterDao
.
findByUsernameEquals
(
username
);
return
inspectParameter
;
}
}
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
eb3b263d
...
...
@@ -44,7 +44,7 @@ public class RuleServiceImpl implements RuleService {
private
TechnologyService
technologyService
;
@Override
public
void
test
(){
public
void
test
()
{
List
<
Rule
>
rules
=
ruleDao
.
findAll
();
for
(
Rule
rule
:
rules
)
{
Technology
technology
=
technologyService
.
findByid
(
rule
.
getTechnologyId
());
...
...
@@ -52,6 +52,7 @@ public class RuleServiceImpl implements RuleService {
}
ruleDao
.
saveAll
(
rules
);
}
/**
* 新增规则
*
...
...
@@ -59,10 +60,10 @@ public class RuleServiceImpl implements RuleService {
*/
@Override
public
void
addRule
(
RuleQo
ruleQo
)
{
for
(
String
suffix
:
ruleQo
.
getSuffix
()
)
{
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEquals
(
ruleQo
.
getTarget
(),
suffix
);
if
(
rule1
!=
null
)
{
List
<
String
>
suffixes
=
ruleQo
.
getSuffixes
();
for
(
String
suffix
:
suffixes
)
{
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEquals
(
ruleQo
.
getTarget
(),
suffix
);
if
(
rule1
!=
null
)
{
return
;
}
Rule
rule
=
new
Rule
();
...
...
@@ -73,6 +74,7 @@ public class RuleServiceImpl implements RuleService {
rule
.
setId
(
UUIDUtil
.
getUUID
());
ruleDao
.
save
(
rule
);
}
}
/**
...
...
@@ -115,19 +117,15 @@ public class RuleServiceImpl implements RuleService {
@Override
public
void
upRule
(
RuleQo
ruleQo
)
{
for
(
String
suffix
:
ruleQo
.
getSuffix
())
{
Rule
rule1
=
ruleDao
.
findByTarget
(
ruleQo
.
getTarget
());
if
(
rule1
!=
null
){
return
;
}
Rule
rule
=
new
Rule
();
rule
.
setTarget
(
ruleQo
.
getTarget
());
rule
.
setSuffix
(
suffix
);
rule
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
rule
.
setId
(
ruleQo
.
getId
());
ruleDao
.
save
(
rule
);
Rule
rule1
=
ruleDao
.
findByTarget
(
ruleQo
.
getId
());
if
(
rule1
==
null
)
{
return
;
}
rule1
.
setTarget
(
ruleQo
.
getTarget
());
rule1
.
setSuffix
(
ruleQo
.
getSuffix
());
rule1
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule1
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
ruleDao
.
save
(
rule1
);
}
@Override
...
...
src/main/java/com/zjty/inspect/utils/AnalysisFile.java
浏览文件 @
eb3b263d
...
...
@@ -38,9 +38,11 @@ public class AnalysisFile {
if
(
string
.
indexOf
(
"compile"
)>
0
){
PomDependency
pomDependency
=
new
PomDependency
();
int
compile
=
string
.
indexOf
(
"compile"
);
int
i
=
compile
+
8
;
int
i
=
compile
+
9
;
String
substring
=
string
.
substring
(
i
);
pomDependency
.
setGradle
(
substring
);
String
[]
split
=
substring
.
split
(
":"
);
pomDependency
.
setGroupId
(
split
[
0
]);
pomDependency
.
setArtifactId
(
split
[
1
]);
dependencies
.
add
(
pomDependency
);
}
}
...
...
@@ -172,4 +174,20 @@ public class AnalysisFile {
projectPom
.
setDependencies
(
dependencies
);
return
projectPom
;
}
public
static
void
main
(
String
[]
args
)
{
String
string
=
" compile 'com.spring.test:spring-core:4.25'"
;
String
[]
split
=
string
.
split
(
":"
);
if
(
string
.
indexOf
(
"compile"
)>-
1
){
PomDependency
pomDependency
=
new
PomDependency
();
int
compile
=
string
.
indexOf
(
"compile"
);
int
i
=
compile
+
9
;
String
substring
=
string
.
substring
(
i
);
String
[]
split1
=
substring
.
split
(
":"
);
System
.
out
.
println
(
split1
[
0
]);
System
.
out
.
println
(
split1
[
1
]);
pomDependency
.
setGradle
(
substring
);
}
}
}
src/main/java/com/zjty/inspect/utils/BigDecimalUtil.java
0 → 100644
浏览文件 @
eb3b263d
package
com
.
zjty
.
inspect
.
utils
;
import
java.math.BigDecimal
;
/**
* @author Mcj
* @date 2020-03-06 16:38
*/
public
class
BigDecimalUtil
{
public
static
double
get2precision
(
double
data
){
BigDecimal
bigDecimal
=
new
BigDecimal
(
data
);
double
value
=
bigDecimal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
return
value
;
}
public
static
void
main
(
String
[]
args
)
{
double
precision
=
BigDecimalUtil
.
get2precision
(
1.1111111
D
);
System
.
out
.
println
(
precision
);
}
}
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
浏览文件 @
eb3b263d
...
...
@@ -6,6 +6,7 @@ import com.zjty.inspect.entity.*;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -120,14 +121,28 @@ public class BudgetUitl {
budgetVo
.
getCoefficientModelVos
().
add
(
coefficientModelVo
);
}
coefficient
=
BigDecimalUtil
.
get2precision
(
coefficient
);
if
(
inspectParameter
.
getRecastMethod
()==
1
){
//用户需要适配
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
4
));
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
codeRefactor
=
new
Budget
();
codeRefactor
.
setBudgetName
(
"代码修改预算"
);
double
fundNotRepair
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
+
fund
;
codeRefactor
.
setProportion
(
refactorProportion
);
codeRefactor
.
setSysFund
(
systemFund
);
codeRefactor
.
setMoneyRate
(
moneyRate
);
codeRefactor
.
setCoefficient
(
coefficient
);
double
fundNotRepair
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
;
double
fundRepair
=
fundNotRepair
*
coefficient
;
fundNotRepair
+=
fund
;
fundRepair
+=
fund
;
fundNotRepair
=
BigDecimalUtil
.
get2precision
(
fundNotRepair
);
fundRepair
=
BigDecimalUtil
.
get2precision
(
fundRepair
);
if
(
fundNotRepair
<
fundRepair
){
codeRefactor
.
setFund
(
fundNotRepair
+
"--"
+
fundRepair
);
}
else
if
(
fundNotRepair
>
fundRepair
){
...
...
@@ -143,9 +158,19 @@ public class BudgetUitl {
double
refactorProportion1
=
Double
.
valueOf
(
doubleHashMap
.
get
(
2
));
inspectParameter
.
setProportion
(
refactorProportion1
);
Budget
codeRefactor1
=
new
Budget
();
codeRefactor1
.
setProportion
(
refactorProportion1
);
codeRefactor1
.
setBudgetName
(
"代码重构预算"
);
double
fundNotRepair1
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
+
fund
;
codeRefactor1
.
setMoneyRate
(
moneyRate
);
codeRefactor1
.
setSysFund
(
systemFund
);
codeRefactor1
.
setCoefficient
(
coefficient
);
double
fundNotRepair1
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
;
double
fundRepair1
=
fundNotRepair1
*
coefficient
;
fundNotRepair1
=
BigDecimalUtil
.
get2precision
(
fundNotRepair1
);
fundRepair1
=
BigDecimalUtil
.
get2precision
(
fundRepair1
);
fundNotRepair1
+=
fund
;
fundRepair1
+=
fund
;
if
(
fundNotRepair1
<
fundRepair1
){
codeRefactor1
.
setFund
(
fundNotRepair1
+
"--"
+
fundRepair1
);
}
else
if
(
fundNotRepair1
>
fundRepair1
){
...
...
@@ -162,9 +187,19 @@ public class BudgetUitl {
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
3
));
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
codeRefactor1
=
new
Budget
();
codeRefactor1
.
setProportion
(
refactorProportion
);
codeRefactor1
.
setBudgetName
(
"代码修改预算"
);
double
fundNotRepair1
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
+
fund
;
codeRefactor1
.
setSysFund
(
systemFund
);
codeRefactor1
.
setMoneyRate
(
moneyRate
);
codeRefactor1
.
setCoefficient
(
coefficient
);
double
fundNotRepair1
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
;
double
fundRepair1
=
fundNotRepair1
*
coefficient
;
fundNotRepair1
+=
fund
;
fundRepair1
+=
fund
;
fundNotRepair1
=
BigDecimalUtil
.
get2precision
(
fundNotRepair1
);
fundRepair1
=
BigDecimalUtil
.
get2precision
(
fundRepair1
);
if
(
fundNotRepair1
<
fundRepair1
){
codeRefactor1
.
setFund
(
fundNotRepair1
+
"--"
+
fundRepair1
);
}
else
if
(
fundNotRepair1
>
fundRepair1
){
...
...
src/main/java/com/zjty/inspect/utils/FileUtil.java
浏览文件 @
eb3b263d
...
...
@@ -51,7 +51,6 @@ public class FileUtil {
File
file3
=
new
File
(
"./"
+
name
+
"/"
+
split1
[
0
]+
"/"
+
split
[
0
]);
excelFile
.
delete
();
log
.
info
(
"end unpack file"
);
System
.
out
.
println
(
file3
.
getCanonicalPath
());
return
file3
;
}
...
...
src/main/java/com/zjty/inspect/utils/WorkLoadUtil.java
0 → 100644
浏览文件 @
eb3b263d
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论