Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
4acf2aac
提交
4acf2aac
authored
3月 07, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mcj:修复规则添加bug
上级
90ec662c
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
130 行增加
和
87 行删除
+130
-87
RuleDao.java
src/main/java/com/zjty/inspect/dao/RuleDao.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
+4
-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
+114
-77
没有找到文件。
src/main/java/com/zjty/inspect/dao/RuleDao.java
浏览文件 @
4acf2aac
...
@@ -27,7 +27,7 @@ public interface RuleDao extends JpaRepository<Rule,String>,JpaSpecificationExec
...
@@ -27,7 +27,7 @@ public interface RuleDao extends JpaRepository<Rule,String>,JpaSpecificationExec
Rule
findByTarget
(
String
target
);
Rule
findByTarget
(
String
target
);
Rule
findByTargetAndSuffixEquals
(
String
target
,
String
suffix
);
Rule
findByTargetAndSuffixEquals
AndTechnologyIdEquals
(
String
target
,
String
suffix
,
String
technologyId
);
/**
/**
* 根据技术id查询规则
* 根据技术id查询规则
...
...
src/main/java/com/zjty/inspect/entity/RuleQo.java
浏览文件 @
4acf2aac
...
@@ -23,9 +23,8 @@ public class RuleQo {
...
@@ -23,9 +23,8 @@ public class RuleQo {
/**
/**
* 匹配的文件后缀
* 匹配的文件后缀
*/
*/
private
List
<
String
>
suffix
es
;
private
List
<
String
>
suffix
;
private
String
suffix
;
/**
/**
* 适配技术id
* 适配技术id
...
...
src/main/java/com/zjty/inspect/inspect/Inspector.java
浏览文件 @
4acf2aac
...
@@ -164,6 +164,9 @@ public class Inspector {
...
@@ -164,6 +164,9 @@ public class Inspector {
if
(!
ruleSuffixFilePathMap
.
containsKey
(
rule
.
getSuffix
()))
{
if
(!
ruleSuffixFilePathMap
.
containsKey
(
rule
.
getSuffix
()))
{
ruleSuffixFilePathMap
.
put
(
rule
.
getSuffix
(),
new
ArrayList
<>());
ruleSuffixFilePathMap
.
put
(
rule
.
getSuffix
(),
new
ArrayList
<>());
}
}
if
(!
ruleMap
.
containsKey
(
rule
.
getTarget
()+
":"
+
rule
.
getSuffix
())){
ruleMap
.
put
(
rule
.
getTarget
()+
":"
+
rule
.
getSuffix
(),
rule
);
}
}
}
try
{
try
{
//以下为计算文件名称匹配正则表达式
//以下为计算文件名称匹配正则表达式
...
@@ -226,7 +229,7 @@ public class Inspector {
...
@@ -226,7 +229,7 @@ public class Inspector {
}
}
}
}
//检查到普通jar包
//检查到普通jar包
if
(
file
.
toString
().
endsWith
(
".jar"
))
{
if
(
file
.
getFileName
().
toString
().
endsWith
(
".jar"
))
{
//新建一个pom对象
//新建一个pom对象
ProjectPom
projectPom
=
new
ProjectPom
();
ProjectPom
projectPom
=
new
ProjectPom
();
//截取jar名称
//截取jar名称
...
@@ -523,7 +526,6 @@ public class Inspector {
...
@@ -523,7 +526,6 @@ public class Inspector {
stringBuilder
.
append
(
dependency
.
getGroupId
()).
append
(
":"
).
append
(
dependency
.
getArtifactId
());
stringBuilder
.
append
(
dependency
.
getGroupId
()).
append
(
":"
).
append
(
dependency
.
getArtifactId
());
if
(
inspectParameter
.
getAdmin
()
==
1
)
{
if
(
inspectParameter
.
getAdmin
()
==
1
)
{
Rule
rule
=
new
Rule
();
Rule
rule
=
new
Rule
();
System
.
out
.
println
(
JSON
.
toJSONString
(
techJavaSupport
));
rule
.
setTechnologyId
(
techJavaSupport
.
getId
());
rule
.
setTechnologyId
(
techJavaSupport
.
getId
());
rule
.
setTarget
(
dependency
.
getGroupId
());
rule
.
setTarget
(
dependency
.
getGroupId
());
rule
.
setTechnologyName
(
techJavaSupport
.
getTechnologyName
());
rule
.
setTechnologyName
(
techJavaSupport
.
getTechnologyName
());
...
...
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
4acf2aac
...
@@ -61,9 +61,9 @@ public class RuleServiceImpl implements RuleService {
...
@@ -61,9 +61,9 @@ public class RuleServiceImpl implements RuleService {
*/
*/
@Override
@Override
public
void
addRule
(
RuleQo
ruleQo
)
{
public
void
addRule
(
RuleQo
ruleQo
)
{
List
<
String
>
suffixes
=
ruleQo
.
getSuffix
es
();
List
<
String
>
suffixes
=
ruleQo
.
getSuffix
();
for
(
String
suffix
:
suffixes
)
{
for
(
String
suffix
:
suffixes
)
{
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEquals
(
ruleQo
.
getTarget
(),
suffix
);
Rule
rule1
=
ruleDao
.
findByTargetAndSuffixEquals
AndTechnologyIdEquals
(
ruleQo
.
getTarget
(),
suffix
,
ruleQo
.
getTechnologyId
()
);
if
(
rule1
!=
null
)
{
if
(
rule1
!=
null
)
{
return
;
return
;
}
}
...
@@ -118,13 +118,18 @@ public class RuleServiceImpl implements RuleService {
...
@@ -118,13 +118,18 @@ public class RuleServiceImpl implements RuleService {
@Override
@Override
public
void
upRule
(
RuleQo
ruleQo
)
{
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
.
setTarget
(
ruleQo
.
getTarget
());
rule1
.
setSuffix
(
ruleQo
.
getSuffix
()
);
rule1
.
setSuffix
(
suffix
);
rule1
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule1
.
setTechnologyId
(
ruleQo
.
getTechnologyId
());
rule1
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
rule1
.
setTechnologyName
(
ruleQo
.
getTechnologyName
());
ruleDao
.
save
(
rule1
);
ruleDao
.
save
(
rule1
);
}
}
}
@Override
@Override
...
...
src/main/java/com/zjty/inspect/utils/BudgetUitl.java
浏览文件 @
4acf2aac
...
@@ -129,92 +129,129 @@ public class BudgetUitl {
...
@@ -129,92 +129,129 @@ public class BudgetUitl {
//用户需要适配
//用户需要适配
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
4
));
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
4
));
inspectParameter
.
setProportion
(
refactorProportion
);
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
codeRefactor
=
new
Budget
();
Budget
budget
=
getCodeRefactor
(
"代码修改预算"
,
inspectParameter
.
getProportion
(),
pow
,
systemFund
,
fund
,
moneyRate
,
coefficient
);
codeRefactor
.
setBudgetName
(
"代码修改预算"
);
budgetVo
.
getBudget
().
add
(
budget
);
codeRefactor
.
setProportion
(
refactorProportion
);
codeRefactor
.
setSysFund
(
systemFund
);
// Budget codeRefactor = new Budget();
codeRefactor
.
setMoneyRate
(
moneyRate
);
// codeRefactor.setBudgetName("代码修改预算");
codeRefactor
.
setCoefficient
(
coefficient
);
// codeRefactor.setProportion(refactorProportion);
// codeRefactor.setSysFund(systemFund);
// codeRefactor.setMoneyRate(moneyRate);
double
fundNotRepair
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
;
// codeRefactor.setCoefficient(coefficient);
double
fundRepair
=
fundNotRepair
*
coefficient
;
//
fundNotRepair
+=
fund
;
//
fundRepair
+=
fund
;
// double fundNotRepair = inspectParameter.getProportion() * pow * systemFund;
// double fundRepair=fundNotRepair*coefficient;
fundNotRepair
=
BigDecimalUtil
.
get2precision
(
fundNotRepair
);
// fundNotRepair+=fund;
fundRepair
=
BigDecimalUtil
.
get2precision
(
fundRepair
);
// fundRepair+=fund;
//
if
(
fundNotRepair
<
fundRepair
){
// fundNotRepair = BigDecimalUtil.get2precision(fundNotRepair);
codeRefactor
.
setFund
(
fundNotRepair
+
"--"
+
fundRepair
);
// fundRepair = BigDecimalUtil.get2precision(fundRepair);
}
else
if
(
fundNotRepair
>
fundRepair
){
//
codeRefactor
.
setFund
(
fundRepair
+
"--"
+
fundNotRepair
);
// if(fundNotRepair<fundRepair){
}
else
{
// codeRefactor.setFund(fundNotRepair +"--"+fundRepair);
codeRefactor
.
setFund
(
fundRepair
+
"--"
+
fundNotRepair
);
// }else if(fundNotRepair>fundRepair){
}
// codeRefactor.setFund(fundRepair +"--"+fundNotRepair);
codeRefactor
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair
);
// }else{
codeRefactor
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair
);
// codeRefactor.setFund(fundRepair +"--"+fundNotRepair);
codeRefactor
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
// }
budgetVo
.
getBudget
().
add
(
codeRefactor
);
// codeRefactor.setFundDetail("普通业务开发费用:"+fundNotRepair);
// codeRefactor.setFundDetail("普通业务开发费用(修正):"+fundRepair);
// codeRefactor.setFundDetail("关键适配技术成本:"+fund);
// budgetVo.getBudget().add(codeRefactor);
if
(
report
.
getRecastMethod
()==
1
){
if
(
report
.
getRecastMethod
()==
1
){
double
refactorProportion1
=
Double
.
valueOf
(
doubleHashMap
.
get
(
2
));
double
refactorProportion1
=
Double
.
valueOf
(
doubleHashMap
.
get
(
2
));
inspectParameter
.
setProportion
(
refactorProportion1
);
inspectParameter
.
setProportion
(
refactorProportion1
);
Budget
codeRefactor1
=
new
Budget
();
Budget
budget1
=
getCodeRefactor
(
"代码重构预算"
,
inspectParameter
.
getProportion
(),
pow
,
systemFund
,
fund
,
moneyRate
,
coefficient
);
codeRefactor1
.
setProportion
(
refactorProportion1
);
budgetVo
.
getBudget
().
add
(
budget1
);
codeRefactor1
.
setBudgetName
(
"代码重构预算"
);
// Budget codeRefactor1 = new Budget();
codeRefactor1
.
setMoneyRate
(
moneyRate
);
// codeRefactor1.setProportion(refactorProportion1);
codeRefactor1
.
setSysFund
(
systemFund
);
// codeRefactor1.setBudgetName("代码重构预算");
codeRefactor1
.
setCoefficient
(
coefficient
);
// codeRefactor1.setMoneyRate(moneyRate);
double
fundNotRepair1
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
;
// codeRefactor1.setSysFund(systemFund);
double
fundRepair1
=
fundNotRepair1
*
coefficient
;
// codeRefactor1.setCoefficient(coefficient);
// double fundNotRepair1 = inspectParameter.getProportion() * pow * systemFund;
fundNotRepair1
=
BigDecimalUtil
.
get2precision
(
fundNotRepair1
);
// double fundRepair1=fundNotRepair1*coefficient;
fundRepair1
=
BigDecimalUtil
.
get2precision
(
fundRepair1
);
//
// fundNotRepair1 = BigDecimalUtil.get2precision(fundNotRepair1);
fundNotRepair1
+=
fund
;
// fundRepair1 = BigDecimalUtil.get2precision(fundRepair1);
fundRepair1
+=
fund
;
//
if
(
fundNotRepair1
<
fundRepair1
){
// fundNotRepair1+=fund;
codeRefactor1
.
setFund
(
fundNotRepair1
+
"--"
+
fundRepair1
);
// fundRepair1+=fund;
}
else
if
(
fundNotRepair1
>
fundRepair1
){
// if(fundNotRepair1<fundRepair1){
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
// codeRefactor1.setFund(fundNotRepair1 +"--"+fundRepair1);
}
else
{
// }else if(fundNotRepair1>fundRepair1){
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
// codeRefactor1.setFund(fundRepair1 +"--"+fundNotRepair1);
}
// }else{
codeRefactor1
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair1
);
// codeRefactor1.setFund(fundRepair1 +"--"+fundNotRepair1);
codeRefactor1
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair1
);
// }
codeRefactor1
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
// codeRefactor1.setFundDetail("普通业务开发费用:"+fundNotRepair1);
budgetVo
.
getBudget
().
add
(
codeRefactor1
);
// codeRefactor1.setFundDetail("普通业务开发费用(修正):"+fundRepair1);
// codeRefactor1.setFundDetail("关键适配技术成本:"+fund);
// budgetVo.getBudget().add(codeRefactor1);
}
}
}
else
{
}
else
{
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
3
));
double
refactorProportion
=
Double
.
valueOf
(
doubleHashMap
.
get
(
3
));
inspectParameter
.
setProportion
(
refactorProportion
);
inspectParameter
.
setProportion
(
refactorProportion
);
Budget
codeRefactor1
=
new
Budget
();
codeRefactor1
.
setProportion
(
refactorProportion
);
Budget
budget
=
getCodeRefactor
(
"代码适配预算"
,
inspectParameter
.
getProportion
(),
pow
,
systemFund
,
fund
,
moneyRate
,
coefficient
);
codeRefactor1
.
setBudgetName
(
"代码修改预算"
);
budgetVo
.
getBudget
().
add
(
budget
);
codeRefactor1
.
setSysFund
(
systemFund
);
// Budget codeRefactor1 = new Budget();
codeRefactor1
.
setMoneyRate
(
moneyRate
);
// codeRefactor1.setProportion(refactorProportion);
codeRefactor1
.
setCoefficient
(
coefficient
);
// codeRefactor1.setBudgetName("代码修改预算");
double
fundNotRepair1
=
inspectParameter
.
getProportion
()
*
pow
*
systemFund
;
// codeRefactor1.setSysFund(systemFund);
double
fundRepair1
=
fundNotRepair1
*
coefficient
;
// codeRefactor1.setMoneyRate(moneyRate);
fundNotRepair1
+=
fund
;
// codeRefactor1.setCoefficient(coefficient);
fundRepair1
+=
fund
;
// double fundNotRepair1 = inspectParameter.getProportion() * pow * systemFund;
// double fundRepair1=fundNotRepair1*coefficient;
fundNotRepair1
=
BigDecimalUtil
.
get2precision
(
fundNotRepair1
);
// fundNotRepair1+=fund;
fundRepair1
=
BigDecimalUtil
.
get2precision
(
fundRepair1
);
// fundRepair1+=fund;
//
if
(
fundNotRepair1
<
fundRepair1
){
// fundNotRepair1 = BigDecimalUtil.get2precision(fundNotRepair1);
codeRefactor1
.
setFund
(
fundNotRepair1
+
"--"
+
fundRepair1
);
// fundRepair1 = BigDecimalUtil.get2precision(fundRepair1);
}
else
if
(
fundNotRepair1
>
fundRepair1
){
//
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
// if(fundNotRepair1<fundRepair1){
}
else
{
// codeRefactor1.setFund(fundNotRepair1 +"--"+fundRepair1);
codeRefactor1
.
setFund
(
fundRepair1
+
"--"
+
fundNotRepair1
);
// }else if(fundNotRepair1>fundRepair1){
}
// codeRefactor1.setFund(fundRepair1 +"--"+fundNotRepair1);
codeRefactor1
.
setFundDetail
(
"普通业务开发费用:"
+
fundNotRepair1
);
// }else{
codeRefactor1
.
setFundDetail
(
"普通业务开发费用(修正):"
+
fundRepair1
);
// codeRefactor1.setFund(fundRepair1 +"--"+fundNotRepair1);
codeRefactor1
.
setFundDetail
(
"关键适配技术成本:"
+
fund
);
// }
budgetVo
.
getBudget
().
add
(
codeRefactor1
);
// codeRefactor1.setFundDetail("普通业务开发费用:"+fundNotRepair1);
// codeRefactor1.setFundDetail("普通业务开发费用(修正):"+fundRepair1);
// codeRefactor1.setFundDetail("关键适配技术成本:"+fund);
// budgetVo.getBudget().add(codeRefactor1);
}
}
return
budgetVo
;
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
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论