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

mcj:更新导入excel表格

上级 0e3fb22d
...@@ -23,10 +23,10 @@ public class MvcConfig extends WebMvcConfigurationSupport { ...@@ -23,10 +23,10 @@ public class MvcConfig extends WebMvcConfigurationSupport {
// 多个拦截器组成一个拦截器链 // 多个拦截器组成一个拦截器链
// addPathPatterns 用于添加拦截规则,/**表示拦截所有请求 // addPathPatterns 用于添加拦截规则,/**表示拦截所有请求
// excludePathPatterns 用户排除拦截 // excludePathPatterns 用户排除拦截
registry.addInterceptor(loginInterceptor) // registry.addInterceptor(loginInterceptor)
.addPathPatterns("/**") // .addPathPatterns("/**")
.excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**","/doc.html"); // .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**","/doc.html");
; // ;
super.addInterceptors(registry); super.addInterceptors(registry);
} }
@Override @Override
......
package com.zjty.inspect.controller; package com.zjty.inspect.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.zjty.inspect.entity.AssessmentReport; import com.zjty.inspect.entity.*;
import com.zjty.inspect.entity.Evaluation;
import com.zjty.inspect.entity.PageResult;
import com.zjty.inspect.entity.Reform;
import com.zjty.inspect.service.EvaluationService; import com.zjty.inspect.service.EvaluationService;
import com.zjty.inspect.utils.ExcelUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -25,6 +23,8 @@ public class EvaluationController { ...@@ -25,6 +23,8 @@ public class EvaluationController {
@Autowired @Autowired
private EvaluationService evaluationService; private EvaluationService evaluationService;
/** /**
* 新增评估报告 * 新增评估报告
* @param evaluation 评估报告 * @param evaluation 评估报告
...@@ -64,6 +64,28 @@ public class EvaluationController { ...@@ -64,6 +64,28 @@ public class EvaluationController {
} }
return ResponseEntity.ok(null); return ResponseEntity.ok(null);
} }
@ApiOperation("根据id查询输入")
@GetMapping(value = "/all/{id}")
public ResponseEntity getInId(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id);
if(evaluation!=null){
return ResponseEntity.ok(evaluation);
}
return ResponseEntity.ok(null);
}
@ApiOperation("根据报告id查询excel输入")
@GetMapping(value = "/in/excel/{id}")
public ResponseEntity exportInName(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id);
if(evaluation!=null){
ExcelDataTemp excelDataTemp = ExcelUtil.parseExcel2Entity(evaluation);
return ResponseEntity.ok(excelDataTemp);
}else{
return ResponseEntity.ok(new ExcelDataTemp());
}
}
/** /**
* 修改评估报告 * 修改评估报告
* @param evaluation 规则封装 * @param evaluation 规则封装
......
...@@ -3,6 +3,7 @@ package com.zjty.inspect.controller; ...@@ -3,6 +3,7 @@ package com.zjty.inspect.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.zjty.inspect.aop.AuthAnnotation; import com.zjty.inspect.aop.AuthAnnotation;
import com.zjty.inspect.dao.ConfigParamDao; import com.zjty.inspect.dao.ConfigParamDao;
import com.zjty.inspect.dao.ExcelDataDao;
import com.zjty.inspect.dao.TechnologyDao; import com.zjty.inspect.dao.TechnologyDao;
import com.zjty.inspect.entity.*; import com.zjty.inspect.entity.*;
import com.zjty.inspect.service.*; import com.zjty.inspect.service.*;
...@@ -13,6 +14,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -13,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItem; import org.apache.tomcat.util.http.fileupload.disk.DiskFileItem;
import org.aspectj.lang.annotation.Around;
import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.GitAPIException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -38,6 +40,7 @@ import java.util.*; ...@@ -38,6 +40,7 @@ import java.util.*;
@RequestMapping("/inspect") @RequestMapping("/inspect")
@Api(value = "评估接口管理接口", description = "评估管理接口,提供页面的增、删、改、查") @Api(value = "评估接口管理接口", description = "评估管理接口,提供页面的增、删、改、查")
public class InspectController { public class InspectController {
@Autowired @Autowired
private InspectService inspectService; private InspectService inspectService;
@Autowired @Autowired
...@@ -51,6 +54,8 @@ public class InspectController { ...@@ -51,6 +54,8 @@ public class InspectController {
@Autowired @Autowired
private ConfigParamDao configParamDao; private ConfigParamDao configParamDao;
@Autowired
private ExcelDataDao excelDataDao;
//应用类型转换:小型0 //应用类型转换:小型0
Integer[] small = {3, 4}; Integer[] small = {3, 4};
//应用类型转换:中型2 //应用类型转换:中型2
...@@ -127,6 +132,10 @@ public class InspectController { ...@@ -127,6 +132,10 @@ public class InspectController {
@PostMapping("/rapidAssessment") @PostMapping("/rapidAssessment")
public ResponseEntity rapidAssessment(@RequestBody Reform reform) throws IOException { public ResponseEntity rapidAssessment(@RequestBody Reform reform) throws IOException {
//输入参数 //输入参数
File file = new File(reform.getCodeUrl()+"/参数.xlsx");
if(!file.exists()){
reform = ExcelUtil.parseExcel(new FileInputStream(file), file.getName());
}
String in = JSON.toJSONString(reform); String in = JSON.toJSONString(reform);
Evaluation evaluation = new Evaluation(); Evaluation evaluation = new Evaluation();
evaluation.setInEva(in); evaluation.setInEva(in);
...@@ -207,11 +216,6 @@ public class InspectController { ...@@ -207,11 +216,6 @@ public class InspectController {
reportVo.setDatabaseType(null); reportVo.setDatabaseType(null);
ReportVo inspect = inspectService.inspect(reportVo, inspectParameter); ReportVo inspect = inspectService.inspect(reportVo, inspectParameter);
log.info("inspect:代码评估完成"); log.info("inspect:代码评估完成");
Report report = new Report();
String random = RandomUtil.getRandom();
report.setId(RandomUtil.getRandom());
report.setHtmlAddress(reportVo.getHtmlAddress());
reportService.saveReport(report);
/* /*
马晨俊运算结束 马晨俊运算结束
*/ */
...@@ -229,7 +233,11 @@ public class InspectController { ...@@ -229,7 +233,11 @@ public class InspectController {
//架构 //架构
assessmentReport.setFramework(inspect.getFramework()); assessmentReport.setFramework(inspect.getFramework());
//语言 //语言
assessmentReport.setLanguage(inspect.getLanguage()); if ("".equals(reform.getDevelopLanguageSystem().getName())) {
assessmentReport.setLanguage(inspect.getLanguage());
} else {
assessmentReport.setLanguage(reform.getDevelopLanguageSystem().getCode());
}
//适配还是改造 //适配还是改造
assessmentReport.setType(reform.getMode()); assessmentReport.setType(reform.getMode());
SysScale sysScale = new SysScale(); SysScale sysScale = new SysScale();
...@@ -371,6 +379,8 @@ public class InspectController { ...@@ -371,6 +379,8 @@ public class InspectController {
workLoadUtil.result(reform, assessmentReport, f, 1.5); workLoadUtil.result(reform, assessmentReport, f, 1.5);
//输出参数 //输出参数
assessmentReport.setLocalContact(reform.getLocalContact());
String out = JSON.toJSONString(assessmentReport); String out = JSON.toJSONString(assessmentReport);
evaluation.setOutEva(out); evaluation.setOutEva(out);
evaluation.setUsername(reform.getUsername()); evaluation.setUsername(reform.getUsername());
...@@ -402,11 +412,12 @@ public class InspectController { ...@@ -402,11 +412,12 @@ public class InspectController {
return ResponseEntity.status(400).build(); return ResponseEntity.status(400).build();
} }
} }
@PostMapping("/importExcelToRapidAssessment") @PostMapping("/importExcelToRapidAssessment")
private ResponseEntity uploadFileToInspect(MultipartFile file,String username) throws IOException { private ResponseEntity uploadFileToInspect(MultipartFile file, String username) throws IOException {
Reform reform = ExcelUtil.parseExcel(file); Reform reform = ExcelUtil.parseExcel(file.getInputStream(),file.getOriginalFilename());
reform.setUsername(username); reform.setUsername(username);
ResponseEntity responseEntity = this.rapidAssessment(reform); reform.setProjectName("excel表格导入");
return responseEntity; return ResponseEntity.ok(reform);
} }
} }
package com.zjty.inspect.dao;
import com.zjty.inspect.entity.ExcelDataEntity;
import com.zjty.inspect.entity.ExcelEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ExcelDataDao extends JpaRepository<ExcelEntity,String> {
ExcelEntity findByEvaluationIdEquals(String id);
}
...@@ -30,7 +30,20 @@ public class AssessmentReport { ...@@ -30,7 +30,20 @@ public class AssessmentReport {
* 单位名称 * 单位名称
*/ */
private String orgName; private String orgName;
/**
* 单位联系方式
*/
private String orgPhone;
/**
* 本地开发单位联系人
*/
private String localContact;
/**
* 本地开发单位联系方式
*/
private String localPhone;
/** /**
* 系统名称 * 系统名称
*/ */
......
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import com.zjty.inspect.enums.BrowserPlugEnum;
import lombok.Data; import lombok.Data;
@Data @Data
......
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import com.zjty.inspect.enums.CSTechnologyEnum;
import lombok.Data; import lombok.Data;
@Data @Data
......
...@@ -61,4 +61,7 @@ public class Details { ...@@ -61,4 +61,7 @@ public class Details {
*/ */
@ApiModelProperty(value = "版本") @ApiModelProperty(value = "版本")
private String edition; private String edition;
@ApiModelProperty(value = "内存")
private String memory;
} }
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import com.zjty.inspect.enums.LanguageEnum;
import lombok.Data; import lombok.Data;
@Data @Data
......
package com.zjty.inspect.entity;
import lombok.Data;
import javax.persistence.Entity;
/**
* @author Mcj
* @date 2020-04-11 15:08
*/
@Data
public class ExcelDataEntity {
private String name;
private String value;
private String remark;
private String version;
}
package com.zjty.inspect.entity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author Mcj
* @date 2020-04-11 15:07
*/
@Data
public class ExcelDataTemp {
private String name;
private List<ExcelDataEntity> arrayList = new ArrayList();
}
package com.zjty.inspect.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author Mcj
* @date 2020-04-11 15:13
*/
@Data
@Entity
public class ExcelEntity {
@Id
private String id;
private String evaluationId;
@Column(columnDefinition = "TEXT")
private String jsonData;
}
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import jdk.nashorn.internal.scripts.JS; import com.zjty.inspect.enums.FontTechnologyEnum;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.swing.text.html.CSS;
import javax.swing.text.html.HTML;
@Data @Data
public class FontDevTechnology { public class FontDevTechnology {
......
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import com.zjty.inspect.enums.MicroServiceEnum;
import lombok.Data; import lombok.Data;
@Data @Data
......
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import com.zjty.inspect.enums.OpgaEnum;
import lombok.Data; import lombok.Data;
@Data @Data
......
...@@ -20,9 +20,6 @@ import java.util.List; ...@@ -20,9 +20,6 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "应用系统改造替换表单") @ApiModel(value = "应用系统改造替换表单")
public class Reform { public class Reform {
/*
基础
*/
/** /**
* admin 是否是管理员 * admin 是否是管理员
...@@ -89,7 +86,6 @@ public class Reform { ...@@ -89,7 +86,6 @@ public class Reform {
@ApiModelProperty(value = "原开发费用",example = "1") @ApiModelProperty(value = "原开发费用",example = "1")
private Integer cost = -1; private Integer cost = -1;
/** /**
* 开发单位是否在本地int 1:是 2:否 -1不清楚 * 开发单位是否在本地int 1:是 2:否 -1不清楚
*/ */
...@@ -99,8 +95,13 @@ public class Reform { ...@@ -99,8 +95,13 @@ public class Reform {
/** /**
* 本地开发单位联系方式 * 本地开发单位联系方式
*/ */
@ApiModelProperty(value = "本地开发单位联系方式") @ApiModelProperty(value = "本地开发单位联系")
private String localContact; private String localContact;
/**
* 本地开发单位联系方式
*/
@ApiModelProperty(value = "本地开发单位联系方式")
private String localPhone;
/** /**
* 是否为涉密信息系统 int 1:是 2:否 * 是否为涉密信息系统 int 1:是 2:否
...@@ -201,6 +202,14 @@ public class Reform { ...@@ -201,6 +202,14 @@ public class Reform {
*/ */
@ApiModelProperty(value = "单位名称") @ApiModelProperty(value = "单位名称")
private String unitName; private String unitName;
/**
* 单位联系方式
*/
private String unitPhone;
/**
* 单位联系人
*/
private String unitContent;
/** /**
* 原应用是否通过等级保护/分级保护应用测评 * 原应用是否通过等级保护/分级保护应用测评
* -1、我不清楚 1、是 2、否 * -1、我不清楚 1、是 2、否
......
package com.zjty.inspect.enums; package com.zjty.inspect.enums;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/** /**
* <h4>Description : 应用类型</h4> * <h4>Description : 应用类型</h4>
* *
* @author : M@tr!x [xhyrzldf@foxmail.com] * @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2020-03-05 16:54 * @Date : 2020-03-05 16:54
*/ */
@Getter
public enum ApplicationType { public enum ApplicationType {
OA(0,"办公OA应用类"), OA(0,"办公OA应用类"),
MENHU(1,"门户、信息发布、综合入口服务类"), MENHU(1,"门户、信息发布、综合入口服务类"),
...@@ -34,8 +40,7 @@ public enum ApplicationType { ...@@ -34,8 +40,7 @@ public enum ApplicationType {
XIAOXIN(24,"具备上述多项功能的小型平台"), XIAOXIN(24,"具备上述多项功能的小型平台"),
ZHONXIN(25,"具备上述多项功能的中型平台"), ZHONXIN(25,"具备上述多项功能的中型平台"),
DAXIN(26,"具备上述多项功能的特大型平台") DAXIN(26,"具备上述多项功能的特大型平台")
;
;
private Integer code; private Integer code;
private String name; private String name;
...@@ -47,4 +52,22 @@ public enum ApplicationType { ...@@ -47,4 +52,22 @@ public enum ApplicationType {
this.code = code; this.code = code;
this.name = name; this.name = name;
} }
private static Map<String,ApplicationType> applicationTypeHashMap=new HashMap<>();
private static Map<Integer,ApplicationType> applicationTypeCodeHashMap=new HashMap<>();
static {
for (ApplicationType applicationType : ApplicationType.values()) {
applicationTypeHashMap.put(applicationType.name,applicationType);
applicationTypeCodeHashMap.put(applicationType.code,applicationType);
}
}
public static ApplicationType getByName(String name){
ApplicationType applicationType = applicationTypeHashMap.get(name);
return applicationType;
}
public static ApplicationType getByCode(Integer code){
ApplicationType applicationType = applicationTypeCodeHashMap.get(code);
return applicationType;
}
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
...@@ -31,9 +30,12 @@ public enum BrowserPlugEnum { ...@@ -31,9 +30,12 @@ public enum BrowserPlugEnum {
private Integer code; private Integer code;
private String name; private String name;
private static Map<String,BrowserPlugEnum> browserPlugEnumMap=new HashMap<>(); private static Map<String,BrowserPlugEnum> browserPlugEnumMap=new HashMap<>();
private static Map<Integer,BrowserPlugEnum> browserPlugCodeEnumMap=new HashMap<>();
static { static {
for (BrowserPlugEnum browserPlugEnum : BrowserPlugEnum.values()) { for (BrowserPlugEnum browserPlugEnum : BrowserPlugEnum.values()) {
browserPlugEnumMap.put(browserPlugEnum.getName(),browserPlugEnum); browserPlugEnumMap.put(browserPlugEnum.getName(),browserPlugEnum);
browserPlugCodeEnumMap.put(browserPlugEnum.getCode(),browserPlugEnum);
} }
} }
BrowserPlugEnum() { BrowserPlugEnum() {
...@@ -45,10 +47,10 @@ public enum BrowserPlugEnum { ...@@ -45,10 +47,10 @@ public enum BrowserPlugEnum {
} }
public static BrowserPlugEnum getByName(String name){ public static BrowserPlugEnum getByName(String name){
BrowserPlugEnum browserPlugEnum = browserPlugEnumMap.get(name); BrowserPlugEnum browserPlugEnum = browserPlugEnumMap.get(name);
if(browserPlugEnum == null){
return null;
}
return browserPlugEnum; return browserPlugEnum;
} }
public static BrowserPlugEnum getByCode(Integer code){
BrowserPlugEnum browserPlugEnum = browserPlugCodeEnumMap.get(code);
return browserPlugEnum;
}
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
import java.applet.Applet;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -25,13 +24,14 @@ public enum CSTechnologyEnum { ...@@ -25,13 +24,14 @@ public enum CSTechnologyEnum {
private String name; private String name;
private static Map<String,CSTechnologyEnum> csTechnologyEnumMap=new HashMap<>(); private static Map<String,CSTechnologyEnum> csTechnologyEnumMap=new HashMap<>();
private static Map<Integer,CSTechnologyEnum> csTechnologyEnumCodeMap=new HashMap<>();
static { static {
for (CSTechnologyEnum csTechnologyEnum : CSTechnologyEnum.values()) { for (CSTechnologyEnum csTechnologyEnum : CSTechnologyEnum.values()) {
csTechnologyEnumMap.put(csTechnologyEnum.getName(),csTechnologyEnum); csTechnologyEnumMap.put(csTechnologyEnum.getName(),csTechnologyEnum);
csTechnologyEnumCodeMap.put(csTechnologyEnum.getCode(),csTechnologyEnum);
} }
} }
CSTechnologyEnum() {
}
CSTechnologyEnum(Integer code, String name) { CSTechnologyEnum(Integer code, String name) {
this.code = code; this.code = code;
...@@ -40,9 +40,10 @@ public enum CSTechnologyEnum { ...@@ -40,9 +40,10 @@ public enum CSTechnologyEnum {
public static CSTechnologyEnum getByName(String name){ public static CSTechnologyEnum getByName(String name){
CSTechnologyEnum csTechnologyEnum = csTechnologyEnumMap.get(name); CSTechnologyEnum csTechnologyEnum = csTechnologyEnumMap.get(name);
if(csTechnologyEnum == null){ return csTechnologyEnum;
return QITA; }
} public static CSTechnologyEnum getByCode(Integer code){
CSTechnologyEnum csTechnologyEnum = csTechnologyEnumCodeMap.get(code);
return csTechnologyEnum; return csTechnologyEnum;
} }
} }
package com.zjty.inspect.enums; package com.zjty.inspect.enums;
import com.zjty.inspect.entity.FontTechnologyEnum;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
...@@ -30,12 +29,13 @@ public enum CompatibleBrowser { ...@@ -30,12 +29,13 @@ public enum CompatibleBrowser {
private Integer code; private Integer code;
private String name; private String name;
CompatibleBrowser() {
}
private static Map<String, CompatibleBrowser> compatibleBrowserMap=new HashMap<>(); private static Map<String, CompatibleBrowser> compatibleBrowserMap=new HashMap<>();
private static Map<Integer, CompatibleBrowser> compatibleBrowserCodeMap=new HashMap<>();
static { static {
for (CompatibleBrowser compatibleBrowser : CompatibleBrowser.values()) { for (CompatibleBrowser compatibleBrowser : CompatibleBrowser.values()) {
compatibleBrowserMap.put(compatibleBrowser.getName(),compatibleBrowser); compatibleBrowserMap.put(compatibleBrowser.getName(),compatibleBrowser);
compatibleBrowserCodeMap.put(compatibleBrowser.getCode(),compatibleBrowser);
} }
} }
CompatibleBrowser(Integer code, String name) { CompatibleBrowser(Integer code, String name) {
...@@ -45,9 +45,10 @@ public enum CompatibleBrowser { ...@@ -45,9 +45,10 @@ public enum CompatibleBrowser {
public static CompatibleBrowser getByName(String name) { public static CompatibleBrowser getByName(String name) {
CompatibleBrowser compatibleBrowser = compatibleBrowserMap.get(name); CompatibleBrowser compatibleBrowser = compatibleBrowserMap.get(name);
if (compatibleBrowser == null) { return compatibleBrowser;
return NONE; }
} public static CompatibleBrowser getByCode(Integer code) {
CompatibleBrowser compatibleBrowser = compatibleBrowserCodeMap.get(code);
return compatibleBrowser; return compatibleBrowser;
} }
} }
\ No newline at end of file
...@@ -47,9 +47,12 @@ public enum DatabaseType { ...@@ -47,9 +47,12 @@ public enum DatabaseType {
DatabaseType() { DatabaseType() {
} }
private static Map<String, DatabaseType> databaseTypeMap=new HashMap<>(); private static Map<String, DatabaseType> databaseTypeMap=new HashMap<>();
private static Map<Integer, DatabaseType> databaseTypeCodeMap=new HashMap<>();
static { static {
for (DatabaseType databaseType : DatabaseType.values()) { for (DatabaseType databaseType : DatabaseType.values()) {
databaseTypeMap.put(databaseType.getName(),databaseType); databaseTypeMap.put(databaseType.getName(),databaseType);
databaseTypeCodeMap.put(databaseType.getCode(),databaseType);
} }
} }
DatabaseType(Integer code, String name) { DatabaseType(Integer code, String name) {
...@@ -58,9 +61,10 @@ public enum DatabaseType { ...@@ -58,9 +61,10 @@ public enum DatabaseType {
} }
public static DatabaseType getByName(String name) { public static DatabaseType getByName(String name) {
DatabaseType databaseType = databaseTypeMap.get(name); DatabaseType databaseType = databaseTypeMap.get(name);
if (databaseType == null) { return databaseType;
return OTHER; }
} public static DatabaseType getByCode(Integer code) {
DatabaseType databaseType = databaseTypeCodeMap.get(code);
return databaseType; return databaseType;
} }
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
...@@ -33,9 +33,12 @@ public enum FontTechnologyEnum { ...@@ -33,9 +33,12 @@ public enum FontTechnologyEnum {
FontTechnologyEnum() { FontTechnologyEnum() {
} }
private static Map<String,FontTechnologyEnum> fontTechnologyEnumMap=new HashMap<>(); private static Map<String,FontTechnologyEnum> fontTechnologyEnumMap=new HashMap<>();
private static Map<Integer,FontTechnologyEnum> fontTechnologyEnumCodeMap=new HashMap<>();
static { static {
for (FontTechnologyEnum fontTechnologyEnum : FontTechnologyEnum.values()) { for (FontTechnologyEnum fontTechnologyEnum : FontTechnologyEnum.values()) {
fontTechnologyEnumMap.put(fontTechnologyEnum.getName(),fontTechnologyEnum); fontTechnologyEnumMap.put(fontTechnologyEnum.getName(),fontTechnologyEnum);
fontTechnologyEnumCodeMap.put(fontTechnologyEnum.code,fontTechnologyEnum);
} }
} }
FontTechnologyEnum(String name, int code) { FontTechnologyEnum(String name, int code) {
...@@ -45,9 +48,10 @@ public enum FontTechnologyEnum { ...@@ -45,9 +48,10 @@ public enum FontTechnologyEnum {
public static FontTechnologyEnum getByName(String name){ public static FontTechnologyEnum getByName(String name){
FontTechnologyEnum fontTechnologyEnum = fontTechnologyEnumMap.get(name); FontTechnologyEnum fontTechnologyEnum = fontTechnologyEnumMap.get(name);
if(fontTechnologyEnum == null){ return fontTechnologyEnum;
return QITA; }
} public static FontTechnologyEnum getByCode(Integer code){
FontTechnologyEnum fontTechnologyEnum = fontTechnologyEnumCodeMap.get(code);
return fontTechnologyEnum; return fontTechnologyEnum;
} }
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
...@@ -31,9 +31,12 @@ public enum FrameWorkEnum { ...@@ -31,9 +31,12 @@ public enum FrameWorkEnum {
FrameWorkEnum() { FrameWorkEnum() {
} }
private static Map<String,FrameWorkEnum> frameWorkEnumMap=new HashMap<>(); private static Map<String,FrameWorkEnum> frameWorkEnumMap=new HashMap<>();
private static Map<Integer,FrameWorkEnum> frameWorkEnumCodeMap=new HashMap<>();
static { static {
for (FrameWorkEnum frameWorkEnum : FrameWorkEnum.values()) { for (FrameWorkEnum frameWorkEnum : FrameWorkEnum.values()) {
frameWorkEnumMap.put(frameWorkEnum.getName(),frameWorkEnum); frameWorkEnumMap.put(frameWorkEnum.getName(),frameWorkEnum);
frameWorkEnumCodeMap.put(frameWorkEnum.getCode(),frameWorkEnum);
} }
} }
FrameWorkEnum(Integer code, String name) { FrameWorkEnum(Integer code, String name) {
...@@ -43,9 +46,10 @@ public enum FrameWorkEnum { ...@@ -43,9 +46,10 @@ public enum FrameWorkEnum {
public static FrameWorkEnum getByName(String name){ public static FrameWorkEnum getByName(String name){
FrameWorkEnum frameWorkEnum = frameWorkEnumMap.get(name); FrameWorkEnum frameWorkEnum = frameWorkEnumMap.get(name);
if(frameWorkEnum == null){ return frameWorkEnum;
return QITA; }
} public static FrameWorkEnum getByCode(Integer code){
FrameWorkEnum frameWorkEnum = frameWorkEnumCodeMap.get(code);
return frameWorkEnum; return frameWorkEnum;
} }
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
...@@ -30,9 +30,13 @@ public enum LanguageEnum { ...@@ -30,9 +30,13 @@ public enum LanguageEnum {
LanguageEnum() { LanguageEnum() {
} }
private static Map<String,LanguageEnum> languageEnumMap=new HashMap<>(); private static Map<String,LanguageEnum> languageEnumMap=new HashMap<>();
private static Map<Integer,LanguageEnum> languageEnumCodeMap=new HashMap<>();
static { static {
for (LanguageEnum languageEnum : LanguageEnum.values()) { for (LanguageEnum languageEnum : LanguageEnum.values()) {
languageEnumMap.put(languageEnum.getName(),languageEnum); languageEnumMap.put(languageEnum.getName(),languageEnum);
languageEnumCodeMap.put(languageEnum.getCode(),languageEnum);
} }
} }
LanguageEnum(Integer code, String name) { LanguageEnum(Integer code, String name) {
...@@ -42,9 +46,10 @@ public enum LanguageEnum { ...@@ -42,9 +46,10 @@ public enum LanguageEnum {
public static LanguageEnum getByName(String name){ public static LanguageEnum getByName(String name){
LanguageEnum languageEnum = languageEnumMap.get(name); LanguageEnum languageEnum = languageEnumMap.get(name);
if(languageEnum == null){ return languageEnum;
return QITA; }
} public static LanguageEnum getByCode(Integer code){
LanguageEnum languageEnum = languageEnumCodeMap.get(code);
return languageEnum; return languageEnum;
} }
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
...@@ -28,9 +28,12 @@ public enum MainLanguageEnum { ...@@ -28,9 +28,12 @@ public enum MainLanguageEnum {
MainLanguageEnum() { MainLanguageEnum() {
} }
private static Map<String,MainLanguageEnum> mainLanguageEnumMap=new HashMap<>(); private static Map<String,MainLanguageEnum> mainLanguageEnumMap=new HashMap<>();
private static Map<Integer,MainLanguageEnum> mainLanguageEnumCodeMap=new HashMap<>();
static { static {
for (MainLanguageEnum mainLanguageEnum : MainLanguageEnum.values()) { for (MainLanguageEnum mainLanguageEnum : MainLanguageEnum.values()) {
mainLanguageEnumMap.put(mainLanguageEnum.getName(),mainLanguageEnum); mainLanguageEnumMap.put(mainLanguageEnum.getName(),mainLanguageEnum);
mainLanguageEnumCodeMap.put(mainLanguageEnum.getCode(),mainLanguageEnum);
} }
} }
MainLanguageEnum(Integer code, String name) { MainLanguageEnum(Integer code, String name) {
...@@ -40,9 +43,10 @@ public enum MainLanguageEnum { ...@@ -40,9 +43,10 @@ public enum MainLanguageEnum {
public static MainLanguageEnum getByName(String name){ public static MainLanguageEnum getByName(String name){
MainLanguageEnum mainLanguageEnum = mainLanguageEnumMap.get(name); MainLanguageEnum mainLanguageEnum = mainLanguageEnumMap.get(name);
if(mainLanguageEnum == null){ return mainLanguageEnum;
return QITA; }
} public static MainLanguageEnum getByCode(Integer code){
MainLanguageEnum mainLanguageEnum = mainLanguageEnumMap.get(code);
return mainLanguageEnum; return mainLanguageEnum;
} }
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -54,7 +53,7 @@ public enum MicroServiceEnum { ...@@ -54,7 +53,7 @@ public enum MicroServiceEnum {
public static MicroServiceEnum getByName(String name){ public static MicroServiceEnum getByName(String name){
MicroServiceEnum microServiceEnum = microServiceEnumMap.get(name); MicroServiceEnum microServiceEnum = microServiceEnumMap.get(name);
if(microServiceEnum == null){ if(microServiceEnum == null){
return OTHER; return null;
} }
return microServiceEnum; return microServiceEnum;
} }
......
package com.zjty.inspect.enums; package com.zjty.inspect.enums;
import com.zjty.inspect.entity.FontTechnologyEnum;
import com.zjty.inspect.entity.OpgaEnum;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
...@@ -36,9 +34,12 @@ public enum MiddlewareEnum { ...@@ -36,9 +34,12 @@ public enum MiddlewareEnum {
private Integer code; private Integer code;
private String name; private String name;
private static Map<String, MiddlewareEnum> middlewareEnumMap=new HashMap<>(); private static Map<String, MiddlewareEnum> middlewareEnumMap=new HashMap<>();
private static Map<Integer, MiddlewareEnum> middlewareEnumCodeMap=new HashMap<>();
static { static {
for (MiddlewareEnum middlewareEnum : MiddlewareEnum.values()) { for (MiddlewareEnum middlewareEnum : MiddlewareEnum.values()) {
middlewareEnumMap.put(middlewareEnum.getName(),middlewareEnum); middlewareEnumMap.put(middlewareEnum.getName(),middlewareEnum);
middlewareEnumCodeMap.put(middlewareEnum.getCode(),middlewareEnum);
} }
} }
MiddlewareEnum() { MiddlewareEnum() {
...@@ -50,9 +51,10 @@ public enum MiddlewareEnum { ...@@ -50,9 +51,10 @@ public enum MiddlewareEnum {
} }
public static MiddlewareEnum getByName(String name){ public static MiddlewareEnum getByName(String name){
MiddlewareEnum middlewareEnum = middlewareEnumMap.get(name); MiddlewareEnum middlewareEnum = middlewareEnumMap.get(name);
if(middlewareEnum == null){ return middlewareEnum;
return null; }
} public static MiddlewareEnum getByCode(Integer code){
MiddlewareEnum middlewareEnum = middlewareEnumCodeMap.get(code);
return middlewareEnum; return middlewareEnum;
} }
} }
package com.zjty.inspect.enums; package com.zjty.inspect.enums;
import com.zjty.inspect.entity.FontTechnologyEnum;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
...@@ -48,9 +47,12 @@ public enum OperateSystem { ...@@ -48,9 +47,12 @@ public enum OperateSystem {
OperateSystem() { OperateSystem() {
} }
private static Map<String, OperateSystem> operateSystemMap=new HashMap<>(); private static Map<String, OperateSystem> operateSystemMap=new HashMap<>();
private static Map<Integer, OperateSystem> operateSystemCodeMap=new HashMap<>();
static { static {
for (OperateSystem operateSystem : OperateSystem.values()) { for (OperateSystem operateSystem : OperateSystem.values()) {
operateSystemMap.put(operateSystem.getName(),operateSystem); operateSystemMap.put(operateSystem.getName(),operateSystem);
operateSystemCodeMap.put(operateSystem.getCode(),operateSystem);
} }
} }
OperateSystem(Integer code, String name) { OperateSystem(Integer code, String name) {
...@@ -59,9 +61,10 @@ public enum OperateSystem { ...@@ -59,9 +61,10 @@ public enum OperateSystem {
} }
public static OperateSystem getByName(String name){ public static OperateSystem getByName(String name){
OperateSystem operateSystem = operateSystemMap.get(name); OperateSystem operateSystem = operateSystemMap.get(name);
if(operateSystem == null){ return operateSystem;
return null; }
} public static OperateSystem getByCode(String name){
OperateSystem operateSystem = operateSystemCodeMap.get(name);
return operateSystem; return operateSystem;
} }
} }
package com.zjty.inspect.entity; package com.zjty.inspect.enums;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
...@@ -18,13 +18,14 @@ public enum OpgaEnum { ...@@ -18,13 +18,14 @@ public enum OpgaEnum {
private Integer code; private Integer code;
private String name; private String name;
private static Map<String,OpgaEnum> opgaEnumMap=new HashMap<>(); private static Map<String,OpgaEnum> opgaEnumMap=new HashMap<>();
private static Map<Integer,OpgaEnum> opgaEnumCodeMap=new HashMap<>();
static { static {
for (OpgaEnum opgaEnum : OpgaEnum.values()) { for (OpgaEnum opgaEnum : OpgaEnum.values()) {
opgaEnumMap.put(opgaEnum.getName(),opgaEnum); opgaEnumMap.put(opgaEnum.getName(),opgaEnum);
opgaEnumCodeMap.put(opgaEnum.getCode(),opgaEnum);
} }
} }
OpgaEnum() {
}
OpgaEnum(Integer code, String name) { OpgaEnum(Integer code, String name) {
this.code = code; this.code = code;
...@@ -33,9 +34,10 @@ public enum OpgaEnum { ...@@ -33,9 +34,10 @@ public enum OpgaEnum {
public static OpgaEnum getByName(String name){ public static OpgaEnum getByName(String name){
OpgaEnum opgaEnum = opgaEnumMap.get(name); OpgaEnum opgaEnum = opgaEnumMap.get(name);
if(opgaEnum == null){ return opgaEnum;
return OpgaEnum.QITA; }
} public static OpgaEnum getByCode(Integer code){
OpgaEnum opgaEnum = opgaEnumCodeMap.get(code);
return opgaEnum; return opgaEnum;
} }
} }
package com.zjty.inspect.enums; package com.zjty.inspect.enums;
import com.zjty.inspect.entity.MainLanguageEnum;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Getter @Getter
public enum OtherApiEnum { public enum OtherApiEnum {
(1,"无"), (-1,"无"),
JNDI(1,"JNDI"), JNDI(0,"JNDI"),
ML(1,"其他命名与目录类API:请在备注中填写,如需填写多个,请以逗号分隔"), ML(1,"其他命名与目录类API:请在备注中填写,如需填写多个,请以逗号分隔"),
JMS(1,"JMS"), JMS(2,"JMS"),
RestFul(1,"RestFul"), RestFul(3,"RestFul"),
XX(1,"其他消息类API:请在备注中填写,如需填写多个,请以逗号分隔"), XX(4,"其他消息类API:请在备注中填写,如需填写多个,请以逗号分隔"),
AMQP(1,"AMQP"), AMQP(5,"AMQP"),
KAFKA(1,"Kafka API"), KAFKA(6,"Kafka API"),
MQTT(1,"MQTT"), MQTT(7,"MQTT"),
ROUTE(1,"其他消息路由类API:请在备注中填写,如需填写多个,请以逗号分隔"), ROUTE(8,"其他消息路由类API:请在备注中填写,如需填写多个,请以逗号分隔"),
ES(1,"ES"), ES(9,"ES"),
YQ(1,"其他搜索引擎类API:请在备注中填写,如需填写多个,请以逗号分隔"), YQ(10,"其他搜索引擎类API:请在备注中填写,如需填写多个,请以逗号分隔"),
LOGSTASH(1,"Logstash"), LOGSTASH(11,"Logstash"),
LOG(1,"其他分析日志类API:请在备注中填写,如需填写多个,请以逗号分隔"), LOG(12,"其他分析日志类API:请在备注中填写,如需填写多个,请以逗号分隔"),
KIBANA(1,"Kibana"), KIBANA(13,"Kibana"),
FXKS(1,"其他分析可视化类API:请在备注中填写,如需填写多个,请以逗号分隔"), FXKS(14,"其他分析可视化类API:请在备注中填写,如需填写多个,请以逗号分隔"),
REDIS(1,"Redis"), REDIS(15,"Redis"),
JIQ(1,"其他集群类API:请在备注中填写,如需填写多个,请以逗号分隔"), JIQ(16,"其他集群类API:请在备注中填写,如需填写多个,请以逗号分隔"),
ARCGIS(1,"ARCGIS"), ARCGIS(17,"ARCGIS"),
GIS(1,"其他GIS类API:请在备注中填写,如需填写多个,请以逗号分隔"), GIS(18,"其他GIS类API:请在备注中填写,如需填写多个,请以逗号分隔"),
EDIT(1,"在线编辑API:请在备注中填写,如需填写多个,请以逗号分隔"), EDIT(19,"在线编辑API:请在备注中填写,如需填写多个,请以逗号分隔"),
TUBIAO(1,"统计图表类API:请在备注中填写,如需填写多个,请以逗号分隔"), TUBIAO(20,"统计图表类API:请在备注中填写,如需填写多个,请以逗号分隔"),
BF(1,"播放类API:请在备注中填写,如需填写多个,请以逗号分隔"), BF(21,"播放类API:请在备注中填写,如需填写多个,请以逗号分隔"),
YJ(1,"硬件驱动类API:请在备注中填写,如需填写多个,请以逗号分隔"), YJ(22,"硬件驱动类API:请在备注中填写,如需填写多个,请以逗号分隔"),
OCR(1,"OCR识别类API:请在备注中填写,如需填写多个,请以逗号分隔"), OCR(23,"OCR识别类API:请在备注中填写,如需填写多个,请以逗号分隔"),
JIAMI(1,"加密类API:请在备注中填写,如需填写多个,请以逗号分隔"), JIAMI(24,"加密类API:请在备注中填写,如需填写多个,请以逗号分隔"),
OTHER(1,"其他:请在备注中填写,如需填写多个请以逗号分隔"); OTHER(25,"其他:请在备注中填写,如需填写多个请以逗号分隔");
private Integer code; private Integer code;
private String name; private String name;
private static Map<String,OtherApiEnum> otherApiEnumMap=new HashMap<>(); private static Map<String,OtherApiEnum> otherApiEnumMap=new HashMap<>();
private static Map<Integer,OtherApiEnum> otherApiCodeEnumMap=new HashMap<>();
static { static {
for (OtherApiEnum otherApiEnum : OtherApiEnum.values()) { for (OtherApiEnum otherApiEnum : OtherApiEnum.values()) {
otherApiEnumMap.put(otherApiEnum.getName(),otherApiEnum); otherApiEnumMap.put(otherApiEnum.getName(),otherApiEnum);
} }
for (OtherApiEnum otherApiEnum : OtherApiEnum.values()) {
otherApiCodeEnumMap.put(otherApiEnum.getCode(),otherApiEnum);
}
} }
OtherApiEnum() { OtherApiEnum() {
} }
...@@ -52,9 +56,10 @@ public enum OtherApiEnum { ...@@ -52,9 +56,10 @@ public enum OtherApiEnum {
} }
public static OtherApiEnum getByName(String name){ public static OtherApiEnum getByName(String name){
OtherApiEnum otherApiEnum = otherApiEnumMap.get(name); OtherApiEnum otherApiEnum = otherApiEnumMap.get(name);
if(otherApiEnum == null){ return otherApiEnum;
return null; }
} public static OtherApiEnum getByCode(Integer code){
OtherApiEnum otherApiEnum = otherApiCodeEnumMap.get(code);
return otherApiEnum; return otherApiEnum;
} }
} }
...@@ -2,6 +2,9 @@ package com.zjty.inspect.enums; ...@@ -2,6 +2,9 @@ package com.zjty.inspect.enums;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter @Getter
public enum RpoEnum { public enum RpoEnum {
QLM(0,"与RTO时间的前60秒同步"), QLM(0,"与RTO时间的前60秒同步"),
...@@ -12,6 +15,23 @@ public enum RpoEnum { ...@@ -12,6 +15,23 @@ public enum RpoEnum {
GJ(5,"允许丢失割接准备时期+恢复期间所产生的数据"), GJ(5,"允许丢失割接准备时期+恢复期间所产生的数据"),
GJALL(6,"允许丢失割接前备份以外的所有数据"); GJALL(6,"允许丢失割接前备份以外的所有数据");
private static Map<String,RpoEnum> rpoEnumHashMap=new HashMap<>();
private static Map<Integer,RpoEnum> rpoCodeEnumHashMap=new HashMap<>();
static {
for (RpoEnum rpoEnum : RpoEnum.values()) {
rpoEnumHashMap.put(rpoEnum.getName(),rpoEnum);
rpoCodeEnumHashMap.put(rpoEnum.getCode(),rpoEnum);
}
}
public static RpoEnum getByName(String name){
RpoEnum rpoEnum = rpoEnumHashMap.get(name);
return rpoEnum;
}
public static RpoEnum getByCode(Integer code){
RpoEnum rpoEnum = rpoCodeEnumHashMap.get(code);
return rpoEnum;
}
private Integer code; private Integer code;
private String name; private String name;
......
...@@ -2,25 +2,47 @@ package com.zjty.inspect.enums; ...@@ -2,25 +2,47 @@ package com.zjty.inspect.enums;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter @Getter
public enum RtoEnum { public enum RtoEnum {
YI(0,"1-60秒"), YI(0,"1-60秒"),
SHI(1,"10分钟内"),//平滑过渡 //平滑过渡
SHI(1,"10分钟内"),
SAN(2,"30分钟内"), SAN(2,"30分钟内"),
LIU(3,"60分钟内"), LIU(3,"60分钟内"),
Y(4,"1-5小时"), Y(4,"1-5小时"),
WU(5,"5-10小时"), WU(5,"5-10小时"),
ERS(6,"24小时内"), ERS(6,"24小时内"),
SIB(7,"48小时内"), SIB(7,"48小时内"),
QI(8,"72小时内"),//暂停服务 //暂停服务
ZH(9,"一周内");//休息日或晚间替换 QI(8,"72小时内"),
//休息日或晚间替换
ZH(9,"一周内");
private Integer code; private Integer code;
private String name; private String name;
RtoEnum() { RtoEnum() {
} }
private static Map<String,RtoEnum> rtoEnumHashMap=new HashMap<>();
private static Map<Integer,RtoEnum> rtoCodeEnumHashMap=new HashMap<>();
static {
for (RtoEnum rtoEnum : RtoEnum.values()) {
rtoEnumHashMap.put(rtoEnum.getName(),rtoEnum);
rtoCodeEnumHashMap.put(rtoEnum.getCode(),rtoEnum);
}
}
public static RtoEnum getByName(String name){
RtoEnum rpoEnum = rtoEnumHashMap.get(name);
return rpoEnum;
}
public static RtoEnum getByCode(Integer code){
RtoEnum rpoEnum = rtoEnumHashMap.get(code);
return rpoEnum;
}
RtoEnum(Integer code, String name) { RtoEnum(Integer code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
......
package com.zjty.inspect.service; package com.zjty.inspect.service;
import com.zjty.inspect.entity.Evaluation; import com.zjty.inspect.entity.Evaluation;
import com.zjty.inspect.entity.ExcelEntity;
import com.zjty.inspect.entity.Rule; import com.zjty.inspect.entity.Rule;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -16,4 +17,5 @@ public interface EvaluationService { ...@@ -16,4 +17,5 @@ public interface EvaluationService {
Evaluation findById(String id); Evaluation findById(String id);
Evaluation findByName(String name); Evaluation findByName(String name);
ExcelEntity findExcelEntityById(String id);
} }
package com.zjty.inspect.service.impl; package com.zjty.inspect.service.impl;
import com.zjty.inspect.dao.EvaluationDao; import com.zjty.inspect.dao.EvaluationDao;
import com.zjty.inspect.dao.ExcelDataDao;
import com.zjty.inspect.entity.Evaluation; import com.zjty.inspect.entity.Evaluation;
import com.zjty.inspect.entity.ExcelEntity;
import com.zjty.inspect.entity.Rule; import com.zjty.inspect.entity.Rule;
import com.zjty.inspect.service.EvaluationService; import com.zjty.inspect.service.EvaluationService;
import com.zjty.inspect.utils.TimeUtil; import com.zjty.inspect.utils.TimeUtil;
...@@ -31,6 +33,8 @@ public class EvaluationServiceImpl implements EvaluationService { ...@@ -31,6 +33,8 @@ public class EvaluationServiceImpl implements EvaluationService {
@Autowired @Autowired
private EvaluationDao evaluationDao; private EvaluationDao evaluationDao;
@Autowired
private ExcelDataDao excelDataDao;
@Override @Override
public Evaluation save(Evaluation evaluation) { public Evaluation save(Evaluation evaluation) {
if (StringUtils.isEmpty(evaluation.getInEva())) { if (StringUtils.isEmpty(evaluation.getInEva())) {
...@@ -96,6 +100,10 @@ public class EvaluationServiceImpl implements EvaluationService { ...@@ -96,6 +100,10 @@ public class EvaluationServiceImpl implements EvaluationService {
return null; return null;
} }
@Override
public ExcelEntity findExcelEntityById(String id) {
return excelDataDao.findByEvaluationIdEquals(id);
}
/** /**
* 动态条件构建 * 动态条件构建
......
package com.zjty.inspect.utils; package com.zjty.inspect.utils;
import com.alibaba.fastjson.JSON;
import com.zjty.inspect.entity.*; import com.zjty.inspect.entity.*;
import com.zjty.inspect.enums.CompatibleBrowser; import com.zjty.inspect.enums.*;
import com.zjty.inspect.enums.DatabaseType;
import com.zjty.inspect.enums.MiddlewareEnum;
import com.zjty.inspect.enums.OperateSystem;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
...@@ -12,10 +10,7 @@ import org.apache.poi.ss.usermodel.Row; ...@@ -12,10 +10,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -32,30 +27,90 @@ public class ExcelUtil { ...@@ -32,30 +27,90 @@ public class ExcelUtil {
private static String xlsx = "xlsx"; private static String xlsx = "xlsx";
private static String xls = "xls"; private static String xls = "xls";
public static Reform parseExcel(MultipartFile f1) { public static Reform parseExcel(InputStream fileInputStream, String fileName) {
Reform reform = new Reform();
try { try {
InputStream fileInputStream = f1.getInputStream(); String[] split = Objects.requireNonNull(fileName).split("\\.");
String[] split = Objects.requireNonNull(f1.getOriginalFilename()).split("\\.");
if (xlsx.equals(split[1])) { if (xlsx.equals(split[1])) {
XSSFWorkbook xwb = new XSSFWorkbook(fileInputStream); XSSFWorkbook xwb = new XSSFWorkbook(fileInputStream);
//3、得到Excel工作表对象 //3、得到Excel工作表对象
XSSFSheet sheetAt = xwb.getSheetAt(0); XSSFSheet sheetAt = xwb.getSheetAt(0);
Reform reform = getReform(sheetAt); reform = getReform(sheetAt);
return reform;
} else if (xls.equals(split[1])) { } else if (xls.equals(split[1])) {
HSSFWorkbook xwb = new HSSFWorkbook(fileInputStream); HSSFWorkbook xwb = new HSSFWorkbook(fileInputStream);
//3、得到Excel工作表对象 //3、得到Excel工作表对象
HSSFSheet sheetAt = xwb.getSheetAt(0); HSSFSheet sheetAt = xwb.getSheetAt(0);
Reform reform = getReform(sheetAt); reform = getReform(sheetAt);
return reform;
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return new Reform(); return reform;
}
public static ExcelDataTemp parseExcel2Entity(Evaluation evaluation) {
String inEva = evaluation.getInEva();
ExcelDataTemp excelDataTemp = new ExcelDataTemp();
if (inEva != null) {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
exportEntity("用户名", reform.getUsername());
exportEntity("评估类型", reform.getAssessmentType());
exportEntity("替换方式", reform.getMode());
exportEntity("系统名称", reform.getProjectName());
exportEntity("代码地址", reform.getCodeUrl());
exportEntity("文件名称", reform.getCodeName());
exportEntity("git地址", reform.getGitUrl());
exportEntity("模块数量", reform.getModuleNum());
exportEntity("原开发费用", reform.getCost());
exportEntity("开发单位是否在本地", reform.getAddress());
exportEntity("开发单位联系人", reform.getLocalContact());
exportEntity("开发单位联系方式", reform.getLocalPhone());
exportEntity("是否涉密系统",flipYesOrNo(reform.getSecret()));
exportEntity("容灾能力",flipYesOrNo(reform.getDisasterTolerance()));
exportEntity("安全能力",flipYesOrNo(reform.getSafe()));
exportEntity("架构",flipYesOrNo(reform.getFramework()));
exportEntity("运行时间",reform.getTime());
exportEntity("运行时间",reform.getTime());
exportEntity("数据库表数量",reform.getTableNum());
exportEntity("数据库数据量",reform.getDatabaseNum());
List<Integer> applicationType = reform.getApplicationType();
for (Integer type : applicationType) {
ApplicationType applicationType1 = ApplicationType.getByCode(type);
exportEntity("该应用类型",applicationType1.getName());
}
SystemStructure systemStructure = reform.getSystemStructure();
Details application = systemStructure.getApplication();
exportEntity("应用服务器部署位置",getDeploy(application.getDeploy()));
}
return excelDataTemp;
}
private static ExcelDataTemp getExcelInData(Sheet sheetAt) {
int firstRowNum = sheetAt.getFirstRowNum();
int lastRowNum = sheetAt.getLastRowNum();
ArrayList<ExcelDataEntity> excelDataEntities = new ArrayList<>();
for (int i = 1; i <= lastRowNum; i++) {
ExcelDataEntity excelDataEntity = new ExcelDataEntity();
String content = getExcelCell(i, 1, sheetAt);
excelDataEntity.setName(content);
String value = getExcelCell(i, 2, sheetAt);
excelDataEntity.setValue(value);
String remark = getExcelCell(i, 3, sheetAt);
excelDataEntity.setRemark(remark);
String version = getExcelCell(i, 4, sheetAt);
excelDataEntity.setVersion(version);
excelDataEntities.add(excelDataEntity);
}
ExcelDataTemp excelDataTemp = new ExcelDataTemp();
excelDataTemp.setArrayList(excelDataEntities);
return excelDataTemp;
} }
private static String getExcelCell(int rowNum, int cellNum, Sheet sheetAt) { private static String getExcelCell(int rowNum, int cellNum, Sheet sheetAt) {
...@@ -68,6 +123,15 @@ public class ExcelUtil { ...@@ -68,6 +123,15 @@ public class ExcelUtil {
Reform reform = new Reform(); Reform reform = new Reform();
//单位名称 //单位名称
String unitName = getExcelCell(2, 2, sheetAt); String unitName = getExcelCell(2, 2, sheetAt);
reform.setUnitName(unitName);
//单位联系方式
String unitPhone = getExcelCell(2, 4, sheetAt);
String[] split = unitPhone.split("\n");
if (split.length > 1) {
reform.setUnitContent(split[0]);
reform.setUnitPhone(split[1]);
}
reform.setUnitName(unitName); reform.setUnitName(unitName);
//系统名称 //系统名称
...@@ -79,7 +143,7 @@ public class ExcelUtil { ...@@ -79,7 +143,7 @@ public class ExcelUtil {
String cycle = getExcelCell(5, 2, sheetAt); String cycle = getExcelCell(5, 2, sheetAt);
String s = cycle.replaceAll("年", ""); String s = cycle.replaceAll("年", "");
reform.setCycle(returnNum(s) *12 ); reform.setCycle(returnNum(s) * 12);
String time = getExcelCell(6, 2, sheetAt); String time = getExcelCell(6, 2, sheetAt);
if (!"".equals(time)) { if (!"".equals(time)) {
...@@ -93,10 +157,11 @@ public class ExcelUtil { ...@@ -93,10 +157,11 @@ public class ExcelUtil {
} }
String address = getExcelCell(7, 2, sheetAt); String address = getExcelCell(7, 2, sheetAt);
reform.setAddress(yesOrNo(address)); reform.setAddress(yesOrNo(address));
String phone = getExcelCell(7, 4, sheetAt); String nativeContent = getExcelCell(7, 4, sheetAt);
String[] split = phone.split("\n"); String[] nativeUnit = nativeContent.split("\n");
if (split.length > 0) { if (nativeUnit.length > 0) {
reform.setLocalContact(phone); reform.setLocalContact(nativeUnit[0]);
reform.setLocalPhone(nativeUnit[1]);
} }
String secret = getExcelCell(8, 2, sheetAt); String secret = getExcelCell(8, 2, sheetAt);
...@@ -169,11 +234,13 @@ public class ExcelUtil { ...@@ -169,11 +234,13 @@ public class ExcelUtil {
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
BaseDes devFramework = new BaseDes(); BaseDes devFramework = new BaseDes();
Integer code = FrameWorkEnum.getByName(framework).getCode(); FrameWorkEnum frameWorkEnum = FrameWorkEnum.getByName(framework);
devFramework.setCode(code); if (frameWorkEnum != null) {
devFramework.setVersion(version); devFramework.setCode(frameWorkEnum.getCode());
devFramework.setDes(remark); devFramework.setVersion(version);
devFrameworks.add(devFramework); devFramework.setDes(remark);
devFrameworks.add(devFramework);
}
} }
developLanguageSystem.setDevFrameworks(devFrameworks); developLanguageSystem.setDevFrameworks(devFrameworks);
...@@ -187,12 +254,14 @@ public class ExcelUtil { ...@@ -187,12 +254,14 @@ public class ExcelUtil {
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
BaseDes csDevTechnology = new BaseDes(); BaseDes csDevTechnology = new BaseDes();
CSTechnologyEnum byName = CSTechnologyEnum.getByName(framework); CSTechnologyEnum csTechnologyEnum = CSTechnologyEnum.getByName(framework);
csDevTechnology.setCode(byName.getCode()); if (csTechnologyEnum != null) {
csDevTechnology.setName(framework); csDevTechnology.setCode(csTechnologyEnum.getCode());
csDevTechnology.setDes(remark); csDevTechnology.setName(framework);
csDevTechnology.setVersion(version); csDevTechnology.setDes(remark);
csDevTechnologies.add(csDevTechnology); csDevTechnology.setVersion(version);
csDevTechnologies.add(csDevTechnology);
}
} }
developLanguageSystem.setCsDevTechnologies(csDevTechnologies); developLanguageSystem.setCsDevTechnologies(csDevTechnologies);
...@@ -207,10 +276,12 @@ public class ExcelUtil { ...@@ -207,10 +276,12 @@ public class ExcelUtil {
BaseDes fontDevTechnology = new BaseDes(); BaseDes fontDevTechnology = new BaseDes();
fontDevTechnology.setDes(remark); fontDevTechnology.setDes(remark);
fontDevTechnology.setVersion(version); fontDevTechnology.setVersion(version);
FontTechnologyEnum byName = FontTechnologyEnum.getByName(framework); FontTechnologyEnum fontTechnologyEnum = FontTechnologyEnum.getByName(framework);
fontDevTechnology.setCode(byName.getCode()); if (fontTechnologyEnum != null) {
fontDevTechnology.setName(byName.getName()); fontDevTechnology.setCode(fontTechnologyEnum.getCode());
fontDevTechnologies.add(fontDevTechnology); fontDevTechnology.setName(fontTechnologyEnum.getName());
fontDevTechnologies.add(fontDevTechnology);
}
} }
developLanguageSystem.setFontDevTechnologies(fontDevTechnologies); developLanguageSystem.setFontDevTechnologies(fontDevTechnologies);
...@@ -223,12 +294,14 @@ public class ExcelUtil { ...@@ -223,12 +294,14 @@ public class ExcelUtil {
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
BaseDes opGA = new BaseDes(); BaseDes opGA = new BaseDes();
OpgaEnum byName = OpgaEnum.getByName(framework); OpgaEnum opgaEnum = OpgaEnum.getByName(framework);
opGA.setName(framework); if (opgaEnum != null) {
opGA.setCode(byName.getCode()); opGA.setName(framework);
opGA.setVersion(version); opGA.setCode(opgaEnum.getCode());
opGA.setDes(remark); opGA.setVersion(version);
opGAS.add(opGA); opGA.setDes(remark);
opGAS.add(opGA);
}
} }
developLanguageSystem.setOpGAs(opGAS); developLanguageSystem.setOpGAs(opGAS);
...@@ -245,15 +318,18 @@ public class ExcelUtil { ...@@ -245,15 +318,18 @@ public class ExcelUtil {
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
BaseDes devLanguage = new BaseDes(); BaseDes devLanguage = new BaseDes();
LanguageEnum byName = LanguageEnum.getByName(lan); LanguageEnum languageEnum = LanguageEnum.getByName(lan);
devLanguage.setName(byName.getName()); if (languageEnum != null) {
devLanguage.setCode(byName.getCode()); devLanguage.setName(languageEnum.getName());
devLanguage.setVersion(version); devLanguage.setCode(languageEnum.getCode());
devLanguage.setDes(remark); devLanguage.setVersion(version);
devLanguages.add(devLanguage); devLanguage.setDes(remark);
devLanguages.add(devLanguage);
}
} }
developLanguageSystem.setDevLanguages(devLanguages); developLanguageSystem.setDevLanguages(devLanguages);
reform.setDevelopLanguageSystem(developLanguageSystem);
/** /**
* 中间件/API * 中间件/API
*/ */
...@@ -261,11 +337,14 @@ public class ExcelUtil { ...@@ -261,11 +337,14 @@ public class ExcelUtil {
List<MiddlewareEnum> middlewareEnums = new ArrayList<>(); List<MiddlewareEnum> middlewareEnums = new ArrayList<>();
for (int i = 46; i < 51; i++) { for (int i = 46; i < 51; i++) {
String middleware1 = getExcelCell(i, 2, sheetAt); String middleware1 = getExcelCell(i, 2, sheetAt);
MiddlewareEnum byName = MiddlewareEnum.getByName(middleware1); if (!"".equals(middleware1)) {
middlewareEnums.add(byName); MiddlewareEnum middlewareEnum = MiddlewareEnum.getByName(middleware1);
if (middlewareEnum != null) {
middlewareEnums.add(middlewareEnum);
}
}
} }
middleware.setMiddlewareEnums(middlewareEnums); middleware.setMiddlewareEnums(middlewareEnums);
reform.setMiddleware(middleware);
ArrayList<OtherApi> otherApis = new ArrayList<>(); ArrayList<OtherApi> otherApis = new ArrayList<>();
for (int i = 51; i < 61; i++) { for (int i = 51; i < 61; i++) {
...@@ -286,29 +365,33 @@ public class ExcelUtil { ...@@ -286,29 +365,33 @@ public class ExcelUtil {
List<BaseDes> microServices = new ArrayList<>(); List<BaseDes> microServices = new ArrayList<>();
for (int i = 62; i < 72; i++) { for (int i = 62; i < 72; i++) {
String name = getExcelCell(i, 2, sheetAt); String name = getExcelCell(i, 2, sheetAt);
if ("".equals(name)) { if (name == null || "".equals(name)) {
continue; continue;
} }
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
BaseDes microService = new BaseDes(); BaseDes microService = new BaseDes();
MicroServiceEnum byName = MicroServiceEnum.getByName(name); MicroServiceEnum microServiceEnum = MicroServiceEnum.getByName(name);
microService.setCode(byName.getCode()); if (microServiceEnum != null) {
microService.setName(byName.getName()); microService.setCode(microServiceEnum.getCode());
microService.setDes(remark); microService.setName(microServiceEnum.getName());
microService.setVersion(version); microService.setDes(remark);
microServices.add(microService); microService.setVersion(version);
microServices.add(microService);
}
} }
middleware.setMicroServices(microServices); middleware.setMicroServices(microServices);
reform.setMiddleware(middleware);
//数据库相关 //数据库相关
Database database1 = new Database(); Database database1 = new Database();
ArrayList<DatabaseType> databaseTypes = new ArrayList<>(); ArrayList<DatabaseType> databaseTypes = new ArrayList<>();
for (int i = 74; i < 77; i++) { for (int i = 74; i < 77; i++) {
String database = getExcelCell(i, 2, sheetAt); String database = getExcelCell(i, 2, sheetAt);
DatabaseType byName = DatabaseType.getByName(database); if (!"".equals(database)) {
databaseTypes.add(byName); DatabaseType byName = DatabaseType.getByName(database);
databaseTypes.add(byName);
}
} }
database1.setDatabaseType(databaseTypes); database1.setDatabaseType(databaseTypes);
...@@ -353,18 +436,20 @@ public class ExcelUtil { ...@@ -353,18 +436,20 @@ public class ExcelUtil {
} }
browser.setCompatibleBrowsers(compatibleBrowsers); browser.setCompatibleBrowsers(compatibleBrowsers);
ArrayList<BrowserPlug> browserPlugs = new ArrayList<>(); ArrayList<BaseDes> browserPlugs = new ArrayList<>();
for (int i = 98; i <= 108; i++) { for (int i = 98; i <= 108; i++) {
String plugin = getExcelCell(i, 2, sheetAt); String plugin = getExcelCell(i, 2, sheetAt);
BrowserPlug browserPlug = new BrowserPlug(); BaseDes browserPlug = new BaseDes();
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
browserPlug.setVersion(version); browserPlug.setVersion(version);
browserPlug.setDes(remark); browserPlug.setDes(remark);
BrowserPlugEnum byName = BrowserPlugEnum.getByName(plugin); BrowserPlugEnum byName = BrowserPlugEnum.getByName(plugin);
browserPlug.setBrowserPlugEnum(byName); browserPlug.setName(byName.getName());
browserPlug.setCode(byName.getCode());
switch (plugin) { switch (plugin) {
case "在线文本编辑类:请在备注中填写插件名和版本": case "在线文本编辑类:请在备注中填写插件名和版本":
break; break;
...@@ -384,101 +469,41 @@ public class ExcelUtil { ...@@ -384,101 +469,41 @@ public class ExcelUtil {
} }
browserPlugs.add(browserPlug); browserPlugs.add(browserPlug);
} }
browser.setBrowserPlugs(browserPlugs);
reform.setBrowser(browser);
SystemStructure systemStructure = new SystemStructure(); SystemStructure systemStructure = new SystemStructure();
Details ecsdetails = new Details();
String ecs = getExcelCell(113, 2, sheetAt);
if ("本地".equals(ecs)) {
ecsdetails.setDeploy(1);
} else if ("政务云".equals(ecs)) {
ecsdetails.setDeploy(2);
}
String ecssys = getExcelCell(113, 4, sheetAt); Details sysDetails = getSysDetails(113, 2, sheetAt);
OperateSystem byName = OperateSystem.getByName(ecssys); systemStructure.setApplication(sysDetails);
ecsdetails.setOperateSystem(byName);
String num = getExcelCell(113, 3, sheetAt);
ecsdetails.setNum(returnNum(num));
String cpu = getExcelCell(113, 5, sheetAt);
ecsdetails.setCpuNum(returnNum(cpu));
String ghz = getExcelCell(113, 6, sheetAt);
ecsdetails.setGhz(ghz);
String gb = getExcelCell(113, 7, sheetAt);
ecsdetails.setSpace(returnNum(cpu));
String space = getExcelCell(113, 8, sheetAt);
ecsdetails.setSpace(returnDouble(space));
systemStructure.setApplication(ecsdetails);
Details rdsdetails = new Details();
String rds = getExcelCell(114, 2, sheetAt);
if ("本地".equals(rds)) {
rdsdetails.setDeploy(1);
} else if ("政务云".equals(rds)) {
rdsdetails.setDeploy(2);
}
String rdssys = getExcelCell(114, 4, sheetAt);
OperateSystem rdsByName = OperateSystem.getByName(rdssys);
rdsdetails.setOperateSystem(rdsByName);
String num1 = getExcelCell(113, 3, sheetAt);
rdsdetails.setNum(returnNum(num1));
String cpu1 = getExcelCell(113, 5, sheetAt);
rdsdetails.setCpuNum(returnNum(cpu1));
String ghz1 = getExcelCell(113, 6, sheetAt);
rdsdetails.setGhz(ghz1);
String space1 = getExcelCell(113, 8, sheetAt);
rdsdetails.setSpace(returnDouble(space1));
Details rdsdetails = getSysDetails(114, 2, sheetAt);
systemStructure.setDatabase(rdsdetails); systemStructure.setDatabase(rdsdetails);
Details nasdetails = getSysDetails(115, 2, sheetAt);
Details nasdetails = new Details();
String nas = getExcelCell(115, 2, sheetAt);
if ("本地".equals(nas)) {
nasdetails.setDeploy(1);
} else if ("政务云".equals(nas)) {
nasdetails.setDeploy(2);
}
String nassys = getExcelCell(115, 4, sheetAt);
OperateSystem nasByName = OperateSystem.getByName(nassys);
nasdetails.setOperateSystem(nasByName);
String num2 = getExcelCell(113, 3, sheetAt);
nasdetails.setNum(returnNum(num2));
String cpu2 = getExcelCell(113, 5, sheetAt);
nasdetails.setCpuNum(returnNum(cpu2));
String ghz2 = getExcelCell(113, 6, sheetAt);
nasdetails.setGhz(ghz2);
String space2 = getExcelCell(113, 8, sheetAt);
nasdetails.setSpace(returnDouble(space2));
systemStructure.setStorage(nasdetails); systemStructure.setStorage(nasdetails);
Details slbdetails = new Details();
String slb = getExcelCell(116, 2, sheetAt);
if ("本地".equals(slb)) { Details slbdetails = getSysDetails(116, 2, sheetAt);
slbdetails.setDeploy(1); systemStructure.setSlb(slbdetails);
} else if ("政务云".equals(slb)) {
slbdetails.setDeploy(2);
}
String slbsys = getExcelCell(116, 4, sheetAt);
OperateSystem slbByName = OperateSystem.getByName(slbsys);
slbdetails.setOperateSystem(slbByName);
String num3 = getExcelCell(113, 3, sheetAt); Details cdndetails = getSysDetails(117, 2, sheetAt);
ecsdetails.setNum(returnNum(num3)); systemStructure.setCdn(cdndetails);
String cpu3 = getExcelCell(113, 5, sheetAt);
ecsdetails.setCpuNum(returnNum(cpu3));
String ghz3 = getExcelCell(113, 6, sheetAt);
ecsdetails.setGhz(ghz3);
String space3 = getExcelCell(113, 8, sheetAt);
ecsdetails.setSpace(returnDouble(space3));
systemStructure.setSlb(slbdetails); Details vpsdetails = getSysDetails(118, 2, sheetAt);
systemStructure.setVps(vpsdetails);
reform.setSystemStructure(systemStructure); reform.setSystemStructure(systemStructure);
String rpo = getExcelCell(121, 2, sheetAt);
RpoEnum rpoEnum = RpoEnum.getByName(rpo);
if (rpoEnum != null) {
reform.setRpo(rpoEnum.getCode());
}
String rto = getExcelCell(122, 2, sheetAt);
RtoEnum rtoEnum = RtoEnum.getByName(rto);
if (rtoEnum != null) {
reform.setRto(rtoEnum.getCode());
}
return reform; return reform;
} }
...@@ -492,6 +517,15 @@ public class ExcelUtil { ...@@ -492,6 +517,15 @@ public class ExcelUtil {
} }
} }
private static String flipYesOrNo(Integer target) {
if (target==1) {
return "是";
} else if (target==2) {
return "否";
} else {
return "我不清楚";
}
}
private static int returnNum(String target) { private static int returnNum(String target) {
if (!"".equals(target)) { if (!"".equals(target)) {
return Integer.valueOf(target); return Integer.valueOf(target);
...@@ -508,10 +542,53 @@ public class ExcelUtil { ...@@ -508,10 +542,53 @@ public class ExcelUtil {
} }
} }
public static void main(String[] args) { private static String getDeploy(Integer target){
MultipartFile f = null; if(target==1){
return "本地";
}else if(target==2){
return "政务云";
}else{
return "我不清楚";
}
}
private static Details getSysDetails(int rowNum, int cellNum, Sheet sheetAt) {
Details details = new Details();
String slb = getExcelCell(rowNum, cellNum, sheetAt);
if ("本地".equals(slb)) {
details.setDeploy(1);
} else if ("政务云".equals(slb)) {
details.setDeploy(2);
}
String slbsys = getExcelCell(rowNum, cellNum + 1, sheetAt);
OperateSystem slbByName = OperateSystem.getByName(slbsys);
details.setOperateSystem(slbByName);
String num3 = getExcelCell(rowNum, cellNum + 2, sheetAt);
details.setNum(returnNum(num3));
String cpu3 = getExcelCell(rowNum, cellNum + 3, sheetAt);
details.setCpuNum(returnNum(cpu3));
String ghz3 = getExcelCell(rowNum, cellNum + 4, sheetAt);
details.setGhz(ghz3);
String space3 = getExcelCell(rowNum, cellNum + 5, sheetAt);
details.setSpace(returnDouble(space3));
return details;
} }
public static void main(String[] args) {
ArrayList<Object> objects = new ArrayList<>();
objects.add(null);
System.out.println(objects.size());
}
private static ExcelDataEntity exportEntity(String name, Object value) {
ExcelDataEntity excelDataEntity = new ExcelDataEntity();
excelDataEntity.setName(name);
if (value != null) {
excelDataEntity.setValue(value.toString());
}
return excelDataEntity;
}
} }
...@@ -494,7 +494,10 @@ public class WorkLoadUtil { ...@@ -494,7 +494,10 @@ public class WorkLoadUtil {
String workloadDes = "本系统通过选择"+type+"方式部署到国产化安全自主可控环境上。代码层面的关键工作量包含"+nf.format(totalWorkload)+"人工月(包含对不可预见的估算)"; String workloadDes = "本系统通过选择"+type+"方式部署到国产化安全自主可控环境上。代码层面的关键工作量包含"+nf.format(totalWorkload)+"人工月(包含对不可预见的估算)";
report.getWorkload().setDes(workloadDes); report.getWorkload().setDes(workloadDes);
double multipleHardrage = totalWorkload*r/f; double multipleHardrage = totalWorkload*r/f;
report.getDifficultyAssessment().setDes("本系统通过源代码评估,及用户额外信息提供,认为综合难度系数:"+Double.valueOf(nf.format(multipleHardrage))); if(Double.isNaN(multipleHardrage)){
multipleHardrage = 0;
}
//report.getDifficultyAssessment().setDes("本系统通过源代码评估,及用户额外信息提供,认为综合难度系数:"+Double.valueOf(nf.format(multipleHardrage)));
report.setDifficulty(Double.valueOf(nf.format(multipleHardrage))); report.setDifficulty(Double.valueOf(nf.format(multipleHardrage)));
/** /**
* 人工单价、基础工作量(人月)、难度系数、额外申请(万元)、预算费用 的计算值 * 人工单价、基础工作量(人月)、难度系数、额外申请(万元)、预算费用 的计算值
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论