提交 b51417b0 authored 作者: 马晨俊's avatar 马晨俊

mcj:新增适配重构逻辑

上级 f2c1a0ad
......@@ -112,8 +112,9 @@ public class InspectController {
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("./pgbg/"+filePath+"/"+file.getName()+".html");
reportVo.setHtmlAddress(file1.getCanonicalPath());
System.out.println("内容"+s);
} catch (TemplateException e) {
e.printStackTrace();
......
......@@ -59,8 +59,8 @@ public class ReportVo {
/**
* 适配方式
* 1:适配或者修改
* 2:重构
* 1:适配重构
* 2:代码修改
*/
private Integer recastMethod;
......
......@@ -394,7 +394,13 @@ public class Inspector {
List<String> ids = front.stream().map(Technology::getId).collect(Collectors.toList());
this.ruleList=ruleDao.findAllByTechnologyIdIn(ids);
}else{
this.ruleList=ruleDao.findAll();
if(inspectParameter.getRecastMethod()==1){
this.ruleList=ruleDao.findAll();
}else{
List<Technology> front = technologyDao.findAllByBackorfrontEquals("1");
List<String> ids = front.stream().map(Technology::getId).collect(Collectors.toList());
this.ruleList=ruleDao.findAllByTechnologyIdIn(ids);
}
}
Set<String> id = ruleList.stream().map(Rule::getTechnologyId).collect(Collectors.toSet());
List<Technology> technologies = technologyDao.findAllByIdIn(new ArrayList<>(id));
......
......@@ -34,6 +34,7 @@ public class BudgetUitl {
* @return
*/
public BudgetVo getBudget(Integer fund, ReportVo report, InspectParameter inspectParameter){
BudgetVo budgetVo = new BudgetVo();
// TODO: 2020-03-05 查询年复利率,查询修改,适配和重构占比
......@@ -44,25 +45,6 @@ public class BudgetUitl {
doubleHashMap.put(config.getType(),config.getValue());
}
}
inspectParameter.setMoneyRate(Double.valueOf(doubleHashMap.get(1)));
if(inspectParameter.getRecastMethod()==1){
//用户需要适配
double refactorProportion = Double.valueOf(doubleHashMap.get(3));
inspectParameter.setProportion(refactorProportion);
}else{
//用户需要修改
//代码重构比
if(report.getRecastMethod()==1){
double updateProportion = Double.valueOf(doubleHashMap.get(4));
inspectParameter.setProportion(updateProportion);
}else{
double updateProportion = Double.valueOf(doubleHashMap.get(2));
inspectParameter.setProportion(updateProportion);
}
}
int scale;
Integer systemFund = inspectParameter.getSystemFund();
if(systemFund==0){
......@@ -76,7 +58,7 @@ public class BudgetUitl {
}else{
scale=3;
}
inspectParameter.setMoneyRate(Double.valueOf(doubleHashMap.get(1)));
Double moneyRate = inspectParameter.getMoneyRate();
int years = inspectParameter.getYears();
double pow = Math.pow(moneyRate, years);
......@@ -137,41 +119,64 @@ public class BudgetUitl {
}
budgetVo.getCoefficientModelVos().add(coefficientModelVo);
}
Budget codeRefactor = new Budget();
codeRefactor.setBudgetName("代码重构预算");
//不带修正系数资金
double fundNotRepair = inspectParameter.getProportion() * pow * systemFund + fund;
double fundRepair=fundNotRepair*coefficient;
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);
Budget codeUpdate = new Budget();
codeUpdate.setBudgetName("代码修改替换预算");
double findUpdateNotRepair = inspectParameter.getProportion() * pow * systemFund + fund;
double findUpdateRepair = findUpdateNotRepair * coefficient;
if(findUpdateNotRepair<findUpdateRepair){
codeUpdate.setFund(findUpdateNotRepair +"--"+findUpdateRepair);
}else if(fundNotRepair>fundRepair){
codeUpdate.setFund(findUpdateRepair +"--"+findUpdateNotRepair);
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;
double fundRepair=fundNotRepair*coefficient;
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.setBudgetName("代码重构预算");
double fundNotRepair1 = inspectParameter.getProportion() * pow * systemFund + fund;
double fundRepair1=fundNotRepair1*coefficient;
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);
}
}else{
codeUpdate.setFund(findUpdateRepair +"--"+findUpdateNotRepair);
double refactorProportion = Double.valueOf(doubleHashMap.get(3));
inspectParameter.setProportion(refactorProportion);
Budget codeRefactor1 = new Budget();
codeRefactor1.setBudgetName("代码修改预算");
double fundNotRepair1 = inspectParameter.getProportion() * pow * systemFund + fund;
double fundRepair1=fundNotRepair1*coefficient;
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);
}
codeUpdate.setFundDetail("普通业务开发费用:"+findUpdateNotRepair);
codeUpdate.setFundDetail("普通业务开发费用(修正):"+findUpdateRepair);
codeUpdate.setFundDetail("关键适配技术成本:"+fund);
budgetVo.getBudget().add(codeRefactor);
budgetVo.getBudget().add(codeUpdate);
return budgetVo;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论