提交 ebdffde4 authored 作者: czq's avatar czq

czq

上级 91296989
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;
......@@ -20,9 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 评估接口
......@@ -155,4 +154,157 @@ public class InspectController {
return ResponseEntity.ok(200);
}
@PostMapping("/rapidAssessment")
public ResponseEntity rapidAssessment(@RequestBody Reform reform){
//File file = FileUtil.saveToLocal(multfile);
InspectParameter inspectParameter = new InspectParameter();
inspectParameter.setSourceAddress(reform.getCodeUrl());
inspectParameter.setSystemFund(reform.getCost());
inspectParameter.setAdmin(reform.getAdmin());
inspectParameter.setModules(reform.getModuleNum());
inspectParameter.setSafety(reform.getSafe());
inspectParameter.setTables(reform.getTableNum());
// inspectParameter.setValid(valid);
// inspectParameter.setYears(years);
inspectParameter.setDisaster(reform.getDisasterTolerance());
inspectParameter.setData(reform.getDatabaseNum());
inspectParameter.setFramework(reform.getFramework());
inspectParameter.setPath(reform.getGitUrl());
inspectParameter.setRecastMethod(reform.getMode());
inspectParameter.setId(UUIDUtil.getUUID());
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(reform.getCodeName());
reportVo.setProjectName(reform.getProjectName());
reportVo.setSourceAddress(reform.getCodeUrl());
reportVo.setDatabaseType(null);
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 + "/" + reform.getCodeName() + ".html");
FileUtil.write(s,"./pgbg/"+filePath+"/"+reform.getCodeName()+".html");
reportVo.setHtmlAddress(file1.getCanonicalPath());
System.out.println("内容"+s);
} catch (Exception 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);
/*
马晨俊运算结束
*/
System.out.println(JSON.toJSONString(inspect));
/*
将马晨俊的数据放入输出的表单
*/
AssessmentReport assessmentReport = new AssessmentReport();
//系统名称
assessmentReport.setSysName(inspect.getProjectName());
//软件名称
assessmentReport.setOrgName(inspect.getFileName());
//评估时间
assessmentReport.setTime(inspect.getCreateDate());
//适配预算
assessmentReport.setBudget(inspect.getBudgets().getBudget().get(0).getFund());
//原系统规模,马晨俊没放进去
//技术详情,马晨俊的警告点,同时统计技术的数量
//样式调整
int css = 0;
//API数量
int api = 0;
//插件替换数量
int plugIn = 0;
HashMap<String, List<Warn>> warnDetails = inspect.getWarnDetails();
Set<String> keySet = warnDetails.keySet();
List<TechnologyReport> technologyReports = new ArrayList<>();
for (String key:keySet) {
List<Warn> warns = warnDetails.get(key);
if(warns.size()>0){
TechnologyReport technologyReport = new TechnologyReport();
technologyReport.setTechnology(key);
//少一个策略
List<TechnologyContent> technologyContents = new ArrayList<>();
for (Warn warn:warns) {
TechnologyContent technologyContent = new TechnologyContent();
technologyContent.setFile(warn.getFilePath());
technologyContent.setKeyWord(warn.getRule());
technologyContent.setPosition(warn.getLineNum().toString());
technologyContents.add(technologyContent);
}
if(Objects.equals(key, "Microsoft CSS extensions(不支持)")){
css = technologyContents.size();
}else if(Objects.equals(key, "Microsoft API extensions(不支持)")){
api = technologyContents.size();
}else if(Objects.equals(key, "Microsoft JavaScript extensions(不支持)")){
plugIn = technologyContents.size();
}
technologyReport.setTechnologyContents(technologyContents);
technologyReports.add(technologyReport);
}
}
TechnologyList technologyList = new TechnologyList();
technologyList.setDes(null);
technologyList.setTechnologyReports(technologyReports);
assessmentReport.setTechnologyList(technologyList);
//额外申请
assessmentReport.setApply(reform.getApply());
//难度数据填写
DifficultyAssessment difficultyAssessment = new DifficultyAssessment();
//系统部署架构难度,reform中获取,少一个前后端分离
FrameDifficulty frameDifficulty = new FrameDifficulty();
SystemStructure systemStructure = reform.getSystemStructure();
frameDifficulty.setDisaster(systemStructure.getDisaster());
frameDifficulty.setDistributed(systemStructure.getDistributed());
frameDifficulty.setLoadBalance(systemStructure.getLoadBalance());
frameDifficulty.setOtherDemand(systemStructure.getOtherDemand());
//浏览器难度
BrowserDifficulty browserDifficulty = new BrowserDifficulty();
browserDifficulty.setApi(api);
browserDifficulty.setStyle(css);
browserDifficulty.setPlugInUnit(plugIn);
Browser browser = reform.getBrowser();
browserDifficulty.setOtherDemand(browser.getOtherDemand());
browserDifficulty.setGeography(browser.getGeography());
browserDifficulty.setPeripheral(browser.getPeripheral());
browserDifficulty.setAnimation(browser.getAnimation());
browserDifficulty.setThreeD(browser.getThreeD());
browserDifficulty.setDocument(browser.getDocument());
browserDifficulty.setMedia(browser.getMedia());
browserDifficulty.setFlash(browser.getFlash());
return ResponseEntity.ok(new AssessmentReport());
}
}
......@@ -48,7 +48,7 @@ public class AssessmentReport {
/**
* 预算金额 double
*/
private double budget = 1.1;
private String budget = "53.973348451903085--129.498761216";
/**
* 原系统规模
......
......@@ -47,7 +47,44 @@ public class BrowserDifficulty {
/**
* 用户额外需求
*/
private String demand = "*********";
/**
* 地理信息系统 int 1:是 2:否
*/
private Integer geography;
/**
* 调用外设
*/
private Integer peripheral;
/**
*动画
*/
private Integer animation;
/**
* 3d展示
*/
private Integer threeD;
/**
* 公文显现与编辑
*/
private Integer document;
/**
* 多媒体
*/
private Integer media;
/**
* Flash
*/
private Integer flash;
/**
* 其他
*/
private Integer otherDemand;
}
......@@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* <h4>Description : 应用系统改造替换表单</h4>
*
......@@ -15,31 +17,34 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class Reform {
/*
基础
*/
/**
* 替换方式 int(1:改造 2:适配)
* admin 是否是管理员
*/
private Integer mode ;
private Integer admin;
/**
* 改造解释链接
* username
*/
private String username;
/*
快速评估部分
*/
private String reformUrl;
/**
* 适配解释链接
* 替换方式 int(1:改造 2:适配)
*/
private String adaptationUrl;
private Integer mode ;
/**
* 系统名称
*/
private String projectName;
/**
* 上传类型
*/
private String uploadType;
/**
* 代码地址
......@@ -47,49 +52,76 @@ public class Reform {
private String codeUrl;
/**
* 模块数
* 文件名称
*/
private String codeName;
/**
* git地址
*/
private String moduleNum;
private String gitUrl;
/**
*开发语言
* 模块数
*/
private String language;
private Integer moduleNum;
/**
* 原开发费用
*/
private double cost;
private Integer cost;
/**
* 开发单位是否在本地int 1:是 2:否
*/
private Integer address;
/**
* 是否为涉密信息系统 int 1:是 2:否
*/
private Integer secret;
/**
* 原开发周期
* 容灾能力 int 1:是 2:否
*/
private Integer cycle;
private Integer disasterTolerance;
/**
* 服务设备台数
* 安全能力
* 1:无
* 2:弱
* 3:强
*/
private Integer serverNum;
private Integer safe;
/**
* 架构
*/
private Integer framework;
/**
* 该应用类型
*/
private ApplicationType applicationType;
private Integer applicationType;
/**
* 开发单位是否在本地int 1:是 2:否
* 运行时间
*/
private Integer address;
private Date time;
/**
* 是否为涉密信息系统 int 1:是 2:否
* 数据库表数量
*/
private Integer secret;
private Integer tableNum;
/**
* 详细填写
* 数据库数据量
*/
private Integer databaseNum;
/*
详细填写
*/
private String message;
/**
* 系统部署架构
......
......@@ -56,9 +56,12 @@ public class SystemStructure {
private Integer loadBalance;
/**
* 容灾 int 1:是 2:否
* 容灾
* 1:无0,有+0.05
* 2:有0,无-0.05
* 3:有0,无-0.1
*/
private Integer disaster;
private Integer disaster = 0;
/**
* 其他需求
......
......@@ -11,4 +11,6 @@ public enum OperateSystem {
WINSERVER2006,
WINSERVER2012,
REDHATREALES,
UBUNTU,
AIX,
}
package com.zjty.inspect.utils;
import com.zjty.inspect.entity.AssessmentReport;
/**
* <h4>Description : inspect</h4>
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2020-03-06 13:15
*/
public class AssessmentReportUtils {
/*
计算以下三项,拼接字符串,完成关键技术及替换策略建议:
*/
//关键技术xx个
//本地程序开发项xx个
//中间件依赖修改项xx个
/*
先计算难度,再算基础工作量
*/
//系统框架难度P(混合:1.1 前后分离:1)即系统评估
//系统框架难度e(分布式 0.2 负载均衡 0.1 容灾0.1 其他0.1) e = 1.2*1.1*1.1*1.1 即用户额外信息
//系统框架综合难度 p*e
//浏览器难度P(0.001*样式数量+0.01*API数量+0.01*插件数量+1) max=1.3
//浏览器难度e(1+需求分数/100)*(1+需求分数/100) max=1.3
//浏览器综合难度 p*e开根号
//中间件系统评估
/*
基础工作量评估
*/
//总计J = F(马) * 人工费
//开发修正系数
//测试修正系数
//部署修正系数
//开发的开发量 J*(开发修正系数+0.4)
//测试的开发量 J*(测试修正系数+0.3)
//部署的开发量 J*(部署修正系数+0.3)
//合计的开发量 总数
public AssessmentReport algorithm(AssessmentReport assessmentReport){
return null;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论