Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
9b205fc8
提交
9b205fc8
authored
3月 07, 2020
作者:
wyl
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect into wyl
上级
71d76121
541a1601
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
95 行增加
和
127 行删除
+95
-127
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+6
-1
RuleDao.java
src/main/java/com/zjty/inspect/dao/RuleDao.java
+1
-1
CoefficientModel.java
src/main/java/com/zjty/inspect/entity/CoefficientModel.java
+1
-1
RuleQo.java
src/main/java/com/zjty/inspect/entity/RuleQo.java
+1
-2
Inspector.java
src/main/java/com/zjty/inspect/inspect/Inspector.java
+36
-34
InspectServiceImpl.java
...ava/com/zjty/inspect/service/impl/InspectServiceImpl.java
+0
-2
RuleServiceImpl.java
...n/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
+10
-5
BudgetUitl.java
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
+39
-80
application.properties
src/main/resources/application.properties
+1
-1
没有找到文件。
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
9b205fc8
...
...
@@ -288,7 +288,12 @@ public class InspectController {
//中间件难度
MiddlewareDifficulty
middlewareDifficulty
=
new
MiddlewareDifficulty
();
//所有的依赖
List
<
PomDependency
>
dependencies
=
inspect
.
getDependencyVo
().
getDepTreeList
().
get
(
0
).
getDependencies
();
List
<
PomDependency
>
dependencies
=
new
ArrayList
<>();
List
<
ProjectPom
>
depTreeList
=
inspect
.
getDependencyVo
().
getDepTreeList
();
for
(
ProjectPom
projectPom
:
depTreeList
)
{
dependencies
.
addAll
(
projectPom
.
getDependencies
());
}
HashMap
<
String
,
Integer
>
num
=
new
HashMap
<>();
for
(
PomDependency
pomDependency:
dependencies
)
{
String
groupId
=
pomDependency
.
getGroupId
();
...
...
src/main/java/com/zjty/inspect/dao/RuleDao.java
浏览文件 @
9b205fc8
...
...
@@ -27,7 +27,7 @@ public interface RuleDao extends JpaRepository<Rule,String>,JpaSpecificationExec
Rule
findByTarget
(
String
target
);
Rule
findByTargetAndSuffixEquals
(
String
target
,
String
suffix
);
Rule
findByTargetAndSuffixEquals
AndTechnologyIdEquals
(
String
target
,
String
suffix
,
String
technologyId
);
/**
* 根据技术id查询规则
...
...
src/main/java/com/zjty/inspect/entity/CoefficientModel.java
浏览文件 @
9b205fc8
...
...
@@ -46,7 +46,7 @@ public class CoefficientModel {
private
Integer
scale
;
public
Double
countCoefficient
(
Integer
data
)
{
if
(
data
==
null
){
if
(
data
==
null
||
data
<
0
){
return
1
D
;
}
if
(
data
<
min
){
...
...
src/main/java/com/zjty/inspect/entity/RuleQo.java
浏览文件 @
9b205fc8
...
...
@@ -23,9 +23,8 @@ public class RuleQo {
/**
* 匹配的文件后缀
*/
private
List
<
String
>
suffix
es
;
private
List
<
String
>
suffix
;
private
String
suffix
;
/**
* 适配技术id
...
...
src/main/java/com/zjty/inspect/inspect/Inspector.java
浏览文件 @
9b205fc8
...
...
@@ -150,8 +150,10 @@ public class Inspector {
* @return
*/
public
ReportVo
inspect
()
{
codeSize
=
0
;
ruleSuffixFilePathMap
=
new
HashMap
<>();
ruleSuffixMap
=
new
HashMap
<>();
technologyHashMap
=
new
HashMap
<>();
warns
.
clear
();
rules
.
clear
();
//查询技术,构造支持与非支持技术对象
...
...
@@ -164,6 +166,9 @@ public class Inspector {
if
(!
ruleSuffixFilePathMap
.
containsKey
(
rule
.
getSuffix
()))
{
ruleSuffixFilePathMap
.
put
(
rule
.
getSuffix
(),
new
ArrayList
<>());
}
if
(!
ruleMap
.
containsKey
(
rule
.
getTarget
()+
":"
+
rule
.
getSuffix
())){
ruleMap
.
put
(
rule
.
getTarget
()+
":"
+
rule
.
getSuffix
(),
rule
);
}
}
try
{
//以下为计算文件名称匹配正则表达式
...
...
@@ -196,41 +201,10 @@ public class Inspector {
@Override
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attrs
)
{
fileNum
+=
1
;
try
{
List
<
String
>
allLines
=
Files
.
readAllLines
(
file
);
fileLine
+=
allLines
.
size
();
}
catch
(
MalformedInputException
e
){
return
FileVisitResult
.
CONTINUE
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
for
(
Map
.
Entry
<
String
,
PathMatcher
>
entry
:
languageSuffixMatcherMapping
.
entrySet
())
{
//通过正则表达式匹配.java类型后缀文件,并+1
if
(
entry
.
getValue
().
matches
(
file
))
{
long
length
=
file
.
toFile
().
length
();
codeSize
+=
length
/
1024
;
languageMatchMap
.
get
(
entry
.
getKey
()).
plus
();
}
}
for
(
Map
.
Entry
<
PathMatcher
,
String
>
entry
:
configFileMatcherSuffixMapping
.
entrySet
())
{
//通过配置文件正则表达式匹配.xml文件,记录文件地址
if
(
entry
.
getKey
().
matches
(
file
))
{
configFileTypePathsMapping
.
get
(
entry
.
getValue
()).
add
(
file
);
}
}
for
(
Map
.
Entry
<
PathMatcher
,
String
>
entry
:
ruleSuffixMap
.
entrySet
())
{
//通过规则匹配后缀正则表达式匹配,记录匹配上的文件地址
if
(
entry
.
getKey
().
matches
(
file
))
{
ruleSuffixFilePathMap
.
get
(
entry
.
getValue
()).
add
(
file
);
}
}
//检查到普通jar包
if
(
file
.
toString
().
endsWith
(
".jar"
))
{
if
(
file
.
getFileName
().
toString
().
endsWith
(
".jar"
))
{
//新建一个pom对象
ProjectPom
projectPom
=
new
ProjectPom
();
//截取jar名称
String
patten
=
RegexUtil
.
patten
(
file
.
getFileName
().
toString
());
//新建一个依赖对象
PomDependency
pomDependency
=
new
PomDependency
();
...
...
@@ -264,6 +238,36 @@ public class Inspector {
}
dependencyVo
.
add
(
projectPom
);
}
fileNum
+=
1
;
try
{
List
<
String
>
allLines
=
Files
.
readAllLines
(
file
);
fileLine
+=
allLines
.
size
();
}
catch
(
MalformedInputException
e
){
return
FileVisitResult
.
CONTINUE
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
for
(
Map
.
Entry
<
String
,
PathMatcher
>
entry
:
languageSuffixMatcherMapping
.
entrySet
())
{
//通过正则表达式匹配.java类型后缀文件,并+1
if
(
entry
.
getValue
().
matches
(
file
))
{
long
length
=
file
.
toFile
().
length
();
codeSize
+=
length
/
1024
;
languageMatchMap
.
get
(
entry
.
getKey
()).
plus
();
}
}
for
(
Map
.
Entry
<
PathMatcher
,
String
>
entry
:
configFileMatcherSuffixMapping
.
entrySet
())
{
//通过配置文件正则表达式匹配.xml文件,记录文件地址
if
(
entry
.
getKey
().
matches
(
file
))
{
configFileTypePathsMapping
.
get
(
entry
.
getValue
()).
add
(
file
);
}
}
for
(
Map
.
Entry
<
PathMatcher
,
String
>
entry
:
ruleSuffixMap
.
entrySet
())
{
//通过规则匹配后缀正则表达式匹配,记录匹配上的文件地址
if
(
entry
.
getKey
().
matches
(
file
))
{
ruleSuffixFilePathMap
.
get
(
entry
.
getValue
()).
add
(
file
);
}
}
//检查到普通jar包
return
FileVisitResult
.
CONTINUE
;
}
...
...
@@ -523,7 +527,6 @@ public class Inspector {
stringBuilder
.
append
(
dependency
.
getGroupId
()).
append
(
":"
).
append
(
dependency
.
getArtifactId
());
if
(
inspectParameter
.
getAdmin
()
==
1
)
{
Rule
rule
=
new
Rule
();
System
.
out
.
println
(
JSON
.
toJSONString
(
techJavaSupport
));
rule
.
setTechnologyId
(
techJavaSupport
.
getId
());
rule
.
setTarget
(
dependency
.
getGroupId
());
rule
.
setTechnologyName
(
techJavaSupport
.
getTechnologyName
());
...
...
@@ -597,7 +600,6 @@ public class Inspector {
}
return
supportStatus
;
}
public
class
Counter
{
private
int
i
=
0
;
...
...
src/main/java/com/zjty/inspect/service/impl/InspectServiceImpl.java
浏览文件 @
9b205fc8
...
...
@@ -66,8 +66,6 @@ public class InspectServiceImpl implements InspectService {
//需要重构
inspector
.
setSuffixLanguageMapping
(
suffixLanguageMapping
);
ReportVo
reportVoReturn
=
inspector
.
inspect
();
return
reportVoReturn
;
}
...
...
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
9b205fc8
...
...
@@ -61,9 +61,9 @@ public class RuleServiceImpl implements RuleService {
*/
@Override
public
void
addRule
(
RuleQo
ruleQo
)
{
List
<
String
>
suffixes
=
ruleQo
.
getSuffix
es
();
List
<
String
>
suffixes
=
ruleQo
.
getSuffix
();
for
(
String
suffix
:
suffixes
)
{
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEquals
(
ruleQo
.
getTarget
(),
suffix
);
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEquals
AndTechnologyIdEquals
(
ruleQo
.
getTarget
(),
suffix
,
ruleQo
.
getTechnologyId
()
);
if
(
rule1
!=
null
)
{
return
;
}
...
...
@@ -118,13 +118,18 @@ public class RuleServiceImpl implements RuleService {
@Override
public
void
upRule
(
RuleQo
ruleQo
)
{
Rule
rule1
=
new
Rule
();
List
<
String
>
suffixes
=
ruleQo
.
getSuffix
();
for
(
String
suffix
:
suffixes
)
{
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEqualsAndTechnologyIdEquals
(
ruleQo
.
getTarget
(),
suffix
,
ruleQo
.
getTechnologyId
());
if
(
rule1
!=
null
)
{
return
;
}
rule1
.
setTarget
(
ruleQo
.
getTarget
());
rule1
.
setSuffix
(
ruleQo
.
getSuffix
()
);
rule1
.
setSuffix
(
suffix
);
rule1
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule1
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
ruleDao
.
save
(
rule1
);
}
}
@Override
...
...
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
浏览文件 @
9b205fc8
...
...
@@ -127,94 +127,53 @@ public class BudgetUitl {
if
(
inspectParameter
.
getRecastMethod
()==
1
){
//用户需要适配
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
4
));
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
codeRefactor
=
new
Budget
();
codeRefactor
.
setBudgetName
(
"代码修改预算"
);
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
){
codeRefactor
.
setFund
(
fundRepair
+
"--"
+
fundNotRepair
);
}
else
{
codeRefactor
.
setFund
(
fundRepair
+
"--"
+
fundNotRepair
);
}
codeRefactor
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair
);
codeRefactor
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair
);
codeRefactor
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
budgetVo
.
getBudget
().
add
(
codeRefactor
);
if
(
report
.
getRecastMethod
()==
1
){
double
refactorProportion1
=
Double
.
valueOf
(
doubleHashMap
.
get
(
2
));
inspectParameter
.
setProportion
(
refactorProportion1
);
Budget
codeRefactor1
=
new
Budget
();
codeRefactor1
.
setProportion
(
refactorProportion1
);
codeRefactor1
.
setBudgetName
(
"代码重构预算"
);
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
){
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
}
else
{
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
}
codeRefactor1
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair1
);
codeRefactor1
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair1
);
codeRefactor1
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
budgetVo
.
getBudget
().
add
(
codeRefactor1
);
Budget
budget1
=
getCodeRefactor
(
"代码重构预算"
,
inspectParameter
.
getProportion
(),
pow
,
systemFund
,
fund
,
moneyRate
,
coefficient
);
budgetVo
.
getBudget
().
add
(
budget1
);
return
budgetVo
;
}
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
4
));
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
budget
=
getCodeRefactor
(
"代码修改预算"
,
inspectParameter
.
getProportion
(),
pow
,
systemFund
,
fund
,
moneyRate
,
coefficient
);
budgetVo
.
getBudget
().
add
(
budget
);
}
else
{
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
3
));
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
codeRefactor1
=
new
Budget
();
codeRefactor1
.
setProportion
(
refactorProportion
);
codeRefactor1
.
setBudgetName
(
"代码修改预算"
);
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
){
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
}
else
{
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
}
codeRefactor1
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair1
);
codeRefactor1
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair1
);
codeRefactor1
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
budgetVo
.
getBudget
().
add
(
codeRefactor1
);
}
Budget
budget
=
getCodeRefactor
(
"代码适配预算"
,
inspectParameter
.
getProportion
(),
pow
,
systemFund
,
fund
,
moneyRate
,
coefficient
);
budgetVo
.
getBudget
().
add
(
budget
);
}
return
budgetVo
;
}
private
Budget
getCodeRefactor
(
String
budgetName
,
double
proportion
,
double
pow
,
int
systemFund
,
int
fund
,
double
moneyRate
,
double
coefficient
){
Budget
codeRefactor1
=
new
Budget
();
codeRefactor1
.
setProportion
(
proportion
);
codeRefactor1
.
setBudgetName
(
budgetName
);
codeRefactor1
.
setSysFund
(
systemFund
);
codeRefactor1
.
setMoneyRate
(
moneyRate
);
codeRefactor1
.
setCoefficient
(
coefficient
);
double
fundNotRepair1
=
proportion
*
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
){
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
}
else
{
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
}
codeRefactor1
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair1
);
codeRefactor1
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair1
);
codeRefactor1
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
return
codeRefactor1
;
}
}
src/main/resources/application.properties
浏览文件 @
9b205fc8
...
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论