提交 7abc5cd9 authored 作者: 孙洁清's avatar 孙洁清

Merge branch 'lj-project' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect into lj-project

package com.zjty.inspect.aop; package com.zjty.inspect.aop;
import com.alibaba.fastjson.JSON;
import com.zjty.inspect.entity.ServerResponse; import com.zjty.inspect.entity.ServerResponse;
import com.zjty.inspect.entity.User; import com.zjty.inspect.entity.User;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -10,6 +11,7 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -10,6 +11,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -21,10 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -21,10 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
/** /**
* @author Mcj * @author Mcj
...@@ -54,9 +53,10 @@ public class AopIntercept { ...@@ -54,9 +53,10 @@ public class AopIntercept {
String url = "http://"+address+":12345/user/getLogin/"+sessionId; String url = "http://"+address+":12345/user/getLogin/"+sessionId;
ServerResponse serverResponse = restTemplate.getForObject(url, ServerResponse.class); ServerResponse serverResponse = restTemplate.getForObject(url, ServerResponse.class);
if(serverResponse!=null && serverResponse.getCode()!=200){ if(serverResponse!=null && serverResponse.getCode()!=200){
ResponseEntity.status(403).body(1); ServerResponse.noAuthority();
} }
User user = serverResponse.getData(); Object data = serverResponse.getData();
User user = JSON.parseObject(JSON.toJSONString(data), User.class);
AuthAnnotation authAnnotation = ((MethodSignature)joinPoint.getSignature()).getMethod().getAnnotation(AuthAnnotation.class); AuthAnnotation authAnnotation = ((MethodSignature)joinPoint.getSignature()).getMethod().getAnnotation(AuthAnnotation.class);
String[] code = authAnnotation.code(); String[] code = authAnnotation.code();
if(user!=null){ if(user!=null){
...@@ -77,7 +77,7 @@ public class AopIntercept { ...@@ -77,7 +77,7 @@ public class AopIntercept {
} }
} }
} }
return ResponseEntity.status(403).body("f"); return ServerResponse.noAuthority();
} }
} }
package com.zjty.inspect.config; package com.zjty.inspect.config;
import com.zjty.inspect.entity.ServerResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotReadableException;
...@@ -18,13 +19,18 @@ import java.io.IOException; ...@@ -18,13 +19,18 @@ import java.io.IOException;
public class ExceptionHandlerConfig { public class ExceptionHandlerConfig {
@ExceptionHandler(value = HttpMessageNotReadableException.class) @ExceptionHandler(value = HttpMessageNotReadableException.class)
public ResponseEntity defaultErrorHandler(Exception e) { public ServerResponse defaultErrorHandler(Exception e) {
log.error("异常{}",e); log.error("http请求错误{}",e);
return ResponseEntity.badRequest().build(); return ServerResponse.error();
} }
@ExceptionHandler(value = IOException.class) @ExceptionHandler(value = IOException.class)
public ResponseEntity defaultIOHandler(Exception e) { public ServerResponse defaultIOHandler(Exception e) {
log.error("IO异常{}",e); log.error("IO异常{}",e);
return ResponseEntity.status(500).build(); return ServerResponse.error();
}
@ExceptionHandler(value = Exception.class)
public ServerResponse defaultLargestExceptionHandler(Exception e) {
log.error("最大异常{}",e);
return ServerResponse.error();
} }
} }
package com.zjty.inspect.controller; package com.zjty.inspect.controller;
import com.zjty.inspect.entity.ServerResponse;
import com.zjty.inspect.service.CategoryService; import com.zjty.inspect.service.CategoryService;
import com.zjty.inspect.service.ConfigService; import com.zjty.inspect.service.ConfigService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -11,6 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -11,6 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/category") @RequestMapping("/category")
...@@ -25,7 +28,7 @@ public class CategoryCotroller { ...@@ -25,7 +28,7 @@ public class CategoryCotroller {
*/ */
@ApiOperation("查询所有类型") @ApiOperation("查询所有类型")
@GetMapping @GetMapping
public ResponseEntity getCategorys(){ public ServerResponse<List> getCategorys(){
return ResponseEntity.ok(categoryService.findAll()); return ServerResponse.ok(categoryService.findAll());
} }
} }
...@@ -2,7 +2,7 @@ package com.zjty.inspect.controller; ...@@ -2,7 +2,7 @@ package com.zjty.inspect.controller;
import com.zjty.inspect.aop.AuthAnnotation; import com.zjty.inspect.aop.AuthAnnotation;
import com.zjty.inspect.entity.Config; import com.zjty.inspect.entity.Config;
import com.zjty.inspect.entity.RuleQo; import com.zjty.inspect.entity.ServerResponse;
import com.zjty.inspect.service.ConfigService; import com.zjty.inspect.service.ConfigService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,8 +27,8 @@ public class ConfigController { ...@@ -27,8 +27,8 @@ public class ConfigController {
*/ */
@ApiOperation("查询所有参数配置") @ApiOperation("查询所有参数配置")
@GetMapping @GetMapping
public ResponseEntity getConfigs(){ public ServerResponse<List<Config>> getConfigs(){
return ResponseEntity.ok(configService.findAll()); return ServerResponse.ok(configService.findAll());
} }
/** /**
...@@ -39,9 +39,9 @@ public class ConfigController { ...@@ -39,9 +39,9 @@ public class ConfigController {
*/ */
@PostMapping("/updates") @PostMapping("/updates")
@ApiOperation("根据id修改参数,需要传id和value") @ApiOperation("根据id修改参数,需要传id和value")
@AuthAnnotation(code = {"1300"}) @AuthAnnotation(code = {"0001300"})
public ResponseEntity update(@RequestBody List<Config> configs){ public ServerResponse update(@RequestBody List<Config> configs){
configService.updateConfig(configs); configService.updateConfig(configs);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
} }
...@@ -23,12 +23,18 @@ import java.util.ArrayList; ...@@ -23,12 +23,18 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author mcj
*/
@RestController @RestController
@RequestMapping("/evaluation") @RequestMapping("/evaluation")
@Api(value = "评估报告管理接口", description = "评估报告管理接口,提供页面的增、删、改、查") @Api(value = "评估报告管理接口", description = "评估报告管理接口,提供页面的增、删、改、查")
public class EvaluationController { public class EvaluationController {
@Autowired private final EvaluationService evaluationService;
private EvaluationService evaluationService;
public EvaluationController(EvaluationService evaluationService) {
this.evaluationService = evaluationService;
}
/** /**
...@@ -39,62 +45,61 @@ public class EvaluationController { ...@@ -39,62 +45,61 @@ public class EvaluationController {
*/ */
@PostMapping @PostMapping
@ApiOperation("新增评估报告") @ApiOperation("新增评估报告")
public ResponseEntity rule(@RequestBody Evaluation evaluation) { public ServerResponse<Evaluation> rule(@RequestBody Evaluation evaluation) {
evaluationService.save(evaluation); Evaluation newEvaluation = evaluationService.save(evaluation);
return ResponseEntity.ok(200); return ServerResponse.ok(newEvaluation);
} }
@ApiOperation("根据用户名查询最新的报告输出") @ApiOperation("根据用户名查询最新的报告输出")
@GetMapping(value = "/eva") @GetMapping(value = "/eva")
public ResponseEntity getName(@RequestParam String name, @RequestParam String id) { public ServerResponse<AssessmentReport> getName(@RequestParam String name, @RequestParam String id) {
if (StringUtils.isEmpty(id) || id.equals("null")) { if (StringUtils.isEmpty(id) || "null".equals(id)) {
Evaluation e = evaluationService.findByName(name); Evaluation e = evaluationService.findByName(name);
if (e != null) { if (e != null) {
AssessmentReport assessmentReport = JSON.parseObject(e.getOutEva(), AssessmentReport.class); AssessmentReport assessmentReport = JSON.parseObject(e.getOutEva(), AssessmentReport.class);
return ResponseEntity.ok(assessmentReport); return ServerResponse.ok(assessmentReport);
} }
return ResponseEntity.ok(null); return ServerResponse.ok(null);
} }
Evaluation evaluation = evaluationService.findById(id); Evaluation evaluation = evaluationService.findById(id);
if (evaluation != null) { if (evaluation != null) {
AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class); AssessmentReport assessmentReport = JSON.parseObject(evaluation.getOutEva(), AssessmentReport.class);
return ResponseEntity.ok(assessmentReport); return ServerResponse.ok(assessmentReport);
} }
return ResponseEntity.ok(null); return ServerResponse.ok(null);
} }
@ApiOperation("根据id查询输入") @ApiOperation("根据id查询输入")
@GetMapping(value = "/in/{name}") @GetMapping(value = "/in/{name}")
//@AuthAnnotation(code = {"000800"}) public ServerResponse<Reform> getInName(@PathVariable String name) {
public ResponseEntity getInName(@PathVariable String name) {
Evaluation evaluation = evaluationService.findById(name); Evaluation evaluation = evaluationService.findById(name);
if (evaluation != null) { if (evaluation != null) {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class); Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
return ResponseEntity.ok(reform); return ServerResponse.ok(reform);
} }
return ResponseEntity.ok(null); return ServerResponse.ok(null);
} }
@ApiOperation("根据id查询输入") @ApiOperation("根据id查询输入")
@GetMapping(value = "/all/{id}") @GetMapping(value = "/all/{id}")
@AuthAnnotation(code = {"000800"}) @AuthAnnotation(code = {"000800"})
public ResponseEntity getInId(@PathVariable String id) { public ServerResponse<Evaluation> getInId(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id); Evaluation evaluation = evaluationService.findById(id);
if (evaluation != null) { if (evaluation != null) {
return ResponseEntity.ok(evaluation); return ServerResponse.ok(evaluation);
} }
return ResponseEntity.ok(null); return ServerResponse.ok(null);
} }
@ApiOperation("根据报告id查询excel输入") @ApiOperation("根据报告id查询excel输入")
@GetMapping(value = "/in/excel/{id}") @GetMapping(value = "/in/excel/{id}")
public ResponseEntity exportInName(@PathVariable String id) { public ServerResponse<List<ExcelDataTemp>> exportInName(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id); Evaluation evaluation = evaluationService.findById(id);
if (evaluation != null) { if (evaluation != null) {
List<ExcelDataTemp> excelDataTemp = ExcelUtil.parseExcel2Entity(evaluation); List<ExcelDataTemp> excelDataTemp = ExcelUtil.parseExcel2Entity(evaluation);
return ResponseEntity.ok(excelDataTemp); return ServerResponse.ok(excelDataTemp);
} else { } else {
return ResponseEntity.ok(new ArrayList<ExcelDataTemp>()); return ServerResponse.ok(new ArrayList<>());
} }
} }
...@@ -103,29 +108,27 @@ public class EvaluationController { ...@@ -103,29 +108,27 @@ public class EvaluationController {
* *
* @param evaluation 规则封装 * @param evaluation 规则封装
* @param id id * @param id id
* @return
*/ */
@PostMapping(value = "/{id}") @PostMapping(value = "/{id}")
@ApiOperation("修改评估报告") @ApiOperation("修改评估报告")
@AuthAnnotation(code = {"000800"}) @AuthAnnotation(code = {"000800"})
public ResponseEntity update(@RequestBody Evaluation evaluation, @PathVariable String id) { public ServerResponse<Integer> update(@RequestBody Evaluation evaluation, @PathVariable String id) {
evaluation.setId(id); evaluation.setId(id);
evaluationService.update(evaluation); evaluationService.update(evaluation);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
/** /**
* 根据id删除评估报告 * 根据id删除评估报告
* *
* @param id id * @param id id
* @return
*/ */
@ApiOperation("根据id删除评估报告") @ApiOperation("根据id删除评估报告")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@AuthAnnotation(code = {"000800"}) @AuthAnnotation(code = {"000800"})
public ResponseEntity deleteById(@PathVariable String id) { public ServerResponse<Integer> deleteById(@PathVariable String id) {
evaluationService.delete(id); evaluationService.delete(id);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
/** /**
...@@ -143,23 +146,23 @@ public class EvaluationController { ...@@ -143,23 +146,23 @@ public class EvaluationController {
}) })
@RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST) @RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
@AuthAnnotation(code = {"000800"}) @AuthAnnotation(code = {"000800"})
public ResponseEntity findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) { public ServerResponse<PageResult<Evaluation>> findSearch(@RequestBody Map<String,String> searchMap, @PathVariable int page, @PathVariable int size) {
Page<Evaluation> pageList = evaluationService.findSearch(searchMap, page, size); Page<Evaluation> pageList = evaluationService.findSearch(searchMap, page, size);
return ResponseEntity.ok(new PageResult<Evaluation>(pageList.getTotalElements(), pageList.getContent())); return ServerResponse.ok(new PageResult<>(pageList.getTotalElements(), pageList.getContent()));
} }
/** /**
* 修改评估报告 * 获取评估报告内的输出,转换为map结构
* *
* @param id id * @param id id
* @return * @return wps
*/ */
@GetMapping(value = "/bg/{id}") @GetMapping(value = "/map/{id}")
@ApiOperation("修改评估报告") @ApiOperation("获取评估报告内的map ")
public ResponseEntity findall(@PathVariable String id) { public ServerResponse<Map<String, String>> findAll(@PathVariable String id) {
Evaluation evaluation = evaluationService.findById(id); Evaluation evaluation = evaluationService.findById(id);
Map<String, String> wps = WpsUtil.createWps(evaluation); Map<String, String> wps = WpsUtil.createWps(evaluation);
return ResponseEntity.ok(wps); return ServerResponse.ok(wps);
} }
@ApiOperation("下载报告") @ApiOperation("下载报告")
@ApiImplicitParams({ @ApiImplicitParams({
...@@ -171,7 +174,7 @@ public class EvaluationController { ...@@ -171,7 +174,7 @@ public class EvaluationController {
@ApiImplicitParam(name="agree",value = "0不同意 1同意") @ApiImplicitParam(name="agree",value = "0不同意 1同意")
}) })
@PostMapping("/downloadWps") @PostMapping("/downloadWps")
public ResponseEntity download(@RequestBody Download download){ public ServerResponse download(@RequestBody Download download){
// return ResponseEntity.ok("http://120.55.57.35:12345/static/uplaods/a36b17568d4e466dacf9f088a29b4dbc.docx"); // return ResponseEntity.ok("http://120.55.57.35:12345/static/uplaods/a36b17568d4e466dacf9f088a29b4dbc.docx");
// return ResponseEntity.ok("http://120.55.57.35:8078/static/defult.docx"); // return ResponseEntity.ok("http://120.55.57.35:8078/static/defult.docx");
Evaluation evaluation = evaluationService.findById(download.getId()); Evaluation evaluation = evaluationService.findById(download.getId());
...@@ -193,9 +196,8 @@ public class EvaluationController { ...@@ -193,9 +196,8 @@ public class EvaluationController {
} }
String w = FreeMakerUtils.parseTpl("reportTemplate", wps); String w = FreeMakerUtils.parseTpl("reportTemplate", wps);
if(w==null){ if(w==null){
return ResponseEntity.status(500).build(); return ServerResponse.error(500);
} }
return ResponseEntity.ok(w); return ServerResponse.ok(w);
// return ResponseEntity.ok("http://192.168.1.104:8078/static/defult.docx");
} }
} }
...@@ -10,19 +10,11 @@ import com.zjty.inspect.utils.*; ...@@ -10,19 +10,11 @@ import com.zjty.inspect.utils.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.apache.tomcat.util.http.fileupload.FileItemFactory;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
...@@ -51,8 +43,6 @@ public class InspectController { ...@@ -51,8 +43,6 @@ public class InspectController {
@Autowired @Autowired
private ConfigParamDao configParamDao; private ConfigParamDao configParamDao;
@Value("${upload.location}")
private String uploadPath;
@Autowired @Autowired
private AsyncTask asyncTask; private AsyncTask asyncTask;
...@@ -81,7 +71,7 @@ public class InspectController { ...@@ -81,7 +71,7 @@ public class InspectController {
*/ */
@PostMapping("/path") @PostMapping("/path")
@ApiOperation("上传代码进行评估") @ApiOperation("上传代码进行评估")
public ResponseEntity inspect(Integer years, Integer systemFund, Integer modules public ServerResponse<ReportVo> inspect(Integer years, Integer systemFund, Integer modules
, String valid, Integer framework, Integer safety, Integer disaster, Integer data , String valid, Integer framework, Integer safety, Integer disaster, Integer data
, Integer admin, String projectName, Integer tables, String databaseType, Integer content, Integer method, String username, MultipartFile multfile) throws IOException { , Integer admin, String projectName, Integer tables, String databaseType, Integer content, Integer method, String username, MultipartFile multfile) throws IOException {
...@@ -126,11 +116,11 @@ public class InspectController { ...@@ -126,11 +116,11 @@ public class InspectController {
report.setId(RandomUtil.getRandom()); report.setId(RandomUtil.getRandom());
report.setHtmlAddress(reportVo.getHtmlAddress()); report.setHtmlAddress(reportVo.getHtmlAddress());
reportService.saveReport(report); reportService.saveReport(report);
return ResponseEntity.ok(inspect); return ServerResponse.ok(inspect);
} }
@PostMapping("/rapidAssessment") @PostMapping("/rapidAssessment")
public ResponseEntity rapidAssessment(@RequestBody Reform reform) throws IOException { public ServerResponse rapidAssessment(@RequestBody Reform reform) throws IOException {
String in = JSON.toJSONString(reform); String in = JSON.toJSONString(reform);
Evaluation evaluation = new Evaluation(); Evaluation evaluation = new Evaluation();
evaluation.setInEva(in); evaluation.setInEva(in);
...@@ -146,9 +136,9 @@ public class InspectController { ...@@ -146,9 +136,9 @@ public class InspectController {
} }
//获取admin //获取admin
Config adminConfig = configParamDao.findByName("admin"); Config adminConfig = configParamDao.findByName("admin");
Integer admin; int admin;
if (adminConfig != null) { if (adminConfig != null) {
admin = Integer.valueOf(adminConfig.getValue()); admin = Integer.parseInt(adminConfig.getValue());
} else { } else {
admin = 2; admin = 2;
} }
...@@ -160,7 +150,7 @@ public class InspectController { ...@@ -160,7 +150,7 @@ public class InspectController {
framework = 2; framework = 2;
} }
//应用类型 //应用类型
Integer content = 0; int content = 0;
List<Integer> applicationType = reform.getApplicationType(); List<Integer> applicationType = reform.getApplicationType();
if (applicationType == null || applicationType.size() == 0) { if (applicationType == null || applicationType.size() == 0) {
content = -1; content = -1;
...@@ -256,6 +246,8 @@ public class InspectController { ...@@ -256,6 +246,8 @@ public class InspectController {
assessmentReport.setOrgName(inspect.getFileName()); assessmentReport.setOrgName(inspect.getFileName());
//评估时间 //评估时间
assessmentReport.setTime(inspect.getCreateDate()); assessmentReport.setTime(inspect.getCreateDate());
//设置项目中有的所有语言
assessmentReport.setLanguages(reportVo.getLanguages());
//样式调整 //样式调整
int css = 0; int css = 0;
//API数量 //API数量
...@@ -384,98 +376,40 @@ public class InspectController { ...@@ -384,98 +376,40 @@ public class InspectController {
evaluation.setAuthority(reform.getAuthority()); evaluation.setAuthority(reform.getAuthority());
Evaluation save = evaluationService.save(evaluation); Evaluation save = evaluationService.save(evaluation);
if(save==null){ if(save==null){
return ResponseEntity.status(400).build(); return ServerResponse.badRequest();
} }
return ResponseEntity.ok(save.getId()); return ServerResponse.ok(save.getId());
} }
@PostMapping("/uploadsaaa") @PostMapping("/uploads")
private ResponseEntity uploads(@RequestParam(value = "file") MultipartFile multfile) { private ServerResponse uploads(@RequestParam(value = "file") MultipartFile multfile) {
try { try {
File file = FileUtil.saveToLocal(multfile); File file = FileUtil.saveToLocal(multfile);
String name = file.getName(); String name = file.getName();
String path = file.getCanonicalPath(); String path = file.getCanonicalPath();
return ResponseEntity.ok(new com.zjty.inspect.entity.File(name, path)); return ServerResponse.ok(new com.zjty.inspect.entity.File(name, path));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return ResponseEntity.status(500).build(); return ServerResponse.error(500);
}
} }
@ApiOperation("大文件分片上传")
// @PostMapping("/chunkUpload")
@PostMapping("/uploads")
public ResponseEntity fileChunkUpload(MultipartFileParam param, HttpServletRequest request, HttpServletResponse response){
System.out.println("77777777777777777777");
//自己的业务获取存储路径,可以换成自己的
// OSSInformation ossInformation = ossInformationService.queryOne();
// String root = ossInformation.getRoot();
String root = uploadPath;
//验证文件夹规则,不能包含特殊字符
java.io.File file = new java.io.File(root);
// createDirectoryQuietly(file);
System.out.println("88888888888888");
String path=file.getAbsolutePath();
response.setContentType("text/html;charset=UTF-8");
// response.setStatus对接前端插件
// 200, 201, 202: 当前块上传成功,不需要重传。
// 404, 415. 500, 501: 当前块上传失败,会取消整个文件上传。
// 其他状态码: 出错了,但是会自动重试上传。
try {
/**
* 判断前端Form表单格式是否支持文件上传
*/
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(!isMultipart){
//这里是我向前端发送数据的代码,可理解为 return 数据; 具体的就不贴了
System.out.println("不支持的表单格式");
return ResponseEntity.status(404).body("不支持的表单格式");
}else {
param.setTaskId(param.getIdentifier());
System.out.println("2222222222222222");
File myfile = inspectService.chunkUploadByMappedByteBuffer(param,path);//service层
System.out.println("666666666666");
if (myfile!=null){
String name = myfile.getName();
String myPath = myfile.getCanonicalPath();
return ResponseEntity.ok(new com.zjty.inspect.entity.File(name, myPath));
}else {
return ResponseEntity.ok("继续断点传续!");
} }
}
} catch (Exception e) {
e.printStackTrace();
// System.out.println("上传文件失败");
// response.setStatus(415);
return ResponseEntity.status(415).body("上传文件失败");
}
}
@PostMapping("/gitdownload") @PostMapping("/gitdownload")
private ResponseEntity gitDownloads(String gitAddress, String username, String password) { private ServerResponse gitDownloads(String gitAddress, String username, String password) {
try { try {
String gitPath = GitLabUtil.downLoadProject(gitAddress, username, password); String gitPath = GitLabUtil.downLoadProject(gitAddress, username, password);
return ResponseEntity.ok(gitPath); return ServerResponse.ok(gitPath);
} catch (Exception e) { } catch (Exception e) {
return ResponseEntity.status(400).build(); return ServerResponse.badRequest();
} }
} }
@PostMapping("/importExcelToRapidAssessment") @PostMapping("/importExcelToRapidAssessment")
private ResponseEntity uploadFileToInspect(MultipartFile file, String username) throws IOException { private ServerResponse<Reform> uploadFileToInspect(MultipartFile file, String username) throws IOException {
Reform reform = ExcelUtil.parseExcel(file.getInputStream(),file.getOriginalFilename()); Reform reform = ExcelUtil.parseExcel(file.getInputStream(),file.getOriginalFilename());
reform.setUsername(username); reform.setUsername(username);
System.out.println("1"); System.out.println("1");
return ResponseEntity.ok(reform); return ServerResponse.ok(reform);
} }
} }
package com.zjty.inspect.controller; package com.zjty.inspect.controller;
import com.zjty.inspect.entity.InspectParameter; import com.zjty.inspect.entity.InspectParameter;
import com.zjty.inspect.entity.ServerResponse;
import com.zjty.inspect.service.ParameterService; import com.zjty.inspect.service.ParameterService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -22,15 +23,15 @@ public class ParamController { ...@@ -22,15 +23,15 @@ public class ParamController {
@GetMapping @GetMapping
@ApiOperation("获取参数") @ApiOperation("获取参数")
public ResponseEntity getParam(String id){ public ServerResponse getParam(String id){
return ResponseEntity.ok(parameterService.getParameterById(id)); return ServerResponse.ok(parameterService.getParameterById(id));
} }
@PostMapping @PostMapping
@ApiOperation("保存参数") @ApiOperation("保存参数")
public ResponseEntity saveParam(@RequestBody InspectParameter inspectParameter){ public ServerResponse saveParam(@RequestBody InspectParameter inspectParameter){
parameterService.saveParameter(inspectParameter); parameterService.saveParameter(inspectParameter);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
} }
package com.zjty.inspect.controller; package com.zjty.inspect.controller;
import com.zjty.inspect.entity.ServerResponse;
import com.zjty.inspect.service.ReportService; import com.zjty.inspect.service.ReportService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -25,13 +26,13 @@ public class ReportController { ...@@ -25,13 +26,13 @@ public class ReportController {
@GetMapping("/page/{page}") @GetMapping("/page/{page}")
@ApiOperation("根据页码获取数据") @ApiOperation("根据页码获取数据")
public ResponseEntity getReportByPage(@PathVariable int page){ public ServerResponse getReportByPage(@PathVariable int page){
return ResponseEntity.ok(reportService.findReportByPage(page)); return ServerResponse.ok(reportService.findReportByPage(page));
} }
@GetMapping("/id/{id}") @GetMapping("/id/{id}")
@ApiOperation("根据id获取数据") @ApiOperation("根据id获取数据")
public ResponseEntity getReportById(@PathVariable String id){ public ServerResponse getReportById(@PathVariable String id){
return ResponseEntity.ok(reportService.findReportById(id)); return ServerResponse.ok(reportService.findReportById(id));
} }
} }
...@@ -19,13 +19,14 @@ import java.util.Map; ...@@ -19,13 +19,14 @@ import java.util.Map;
/** /**
* 规则库设置 * 规则库设置
*
* @author Mcj * @author Mcj
* @date 2020-02-26 14:42 * @date 2020-02-26 14:42
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/rule") @RequestMapping("/rule")
@Api(value = "规则页面管理接口",description = "规则页面管理接口,提供页面的增、删、改、查") @Api(value = "规则页面管理接口", description = "规则页面管理接口,提供页面的增、删、改、查")
public class RuleController { public class RuleController {
@Autowired @Autowired
...@@ -34,49 +35,51 @@ public class RuleController { ...@@ -34,49 +35,51 @@ public class RuleController {
/** /**
* test * test
* 新增规则 * 新增规则
*
* @param * @param
* @return * @return
*/ */
@PostMapping @PostMapping
@ApiOperation("新增规则") @ApiOperation("新增规则")
@AuthAnnotation(code = {"001200","001400"}) @AuthAnnotation(code = {"0001200", "0001400"})
public ResponseEntity rule(@RequestBody Rule rule){ public ServerResponse<Rule> rule(@RequestBody Rule rule) {
log.info("规则{}",rule); log.info("规则{}", rule);
Rule rule1 = ruleService.addRulePlus(rule); Rule newRule = ruleService.addRulePlus(rule);
if(rule1!=null){ return ServerResponse.ok(newRule);
return ResponseEntity.ok(rule1);
}
return ResponseEntity.status(500).build();
} }
/** /**
* 修改规则 * 修改规则
*
* @param rule 规则封装 * @param rule 规则封装
* @return * @return
*/ */
@PostMapping(value = "/update") @PostMapping(value = "/update")
@ApiOperation("修改规则") @ApiOperation("修改规则")
@AuthAnnotation(code = {"001200","001400"}) @AuthAnnotation(code = {"0001200", "0001400"})
public ResponseEntity update(@RequestBody Rule rule){ public ServerResponse update(@RequestBody Rule rule) {
ruleService.upRulePlus(rule); ruleService.upRulePlus(rule);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
/** /**
* 根据id删除规则 * 根据id删除规则
*
* @param id * @param id
* @return * @return
*/ */
@ApiOperation("根据数据封装删除规则") @ApiOperation("根据数据封装删除规则")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@AuthAnnotation(code = {"001200","001400"}) @AuthAnnotation(code = {"0001200", "0001400"})
public ResponseEntity deleteByQo(@PathVariable String id){ public ServerResponse deleteByQo(@PathVariable String id) {
ruleService.deleteRulePlus(id); ruleService.deleteRulePlus(id);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
/** /**
* 分页+多条件查询 * 分页+多条件查询
*
* @param searchMap 查询条件封装 * @param searchMap 查询条件封装
* @param page 页码 * @param page 页码
* @param size 页大小 * @param size 页大小
...@@ -84,31 +87,33 @@ public class RuleController { ...@@ -84,31 +87,33 @@ public class RuleController {
*/ */
@ApiOperation("分页查询页面列表") @ApiOperation("分页查询页面列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="page",value = "页码",required=true,paramType="path",dataType="int"), @ApiImplicitParam(name = "page", value = "页码", required = true, paramType = "path", dataType = "int"),
@ApiImplicitParam(name="size",value = "每页记录数",required=true,paramType="path",dataType="int") @ApiImplicitParam(name = "size", value = "每页记录数", required = true, paramType = "path", dataType = "int")
}) })
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST) @RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
@AuthAnnotation(code = {"001200","001400"}) @AuthAnnotation(code = {"0001200", "0001400"})
public ResponseEntity findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){ public ServerResponse<PageResult<Rule>> findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
Page<Rule> pageList = ruleService.findSearch(searchMap, page, size); Page<Rule> pageList = ruleService.findSearch(searchMap, page, size);
return ResponseEntity.ok(new PageResult<Rule>(pageList.getTotalElements(), pageList.getContent()) ); return ServerResponse.ok(new PageResult<>(pageList.getTotalElements(), pageList.getContent()));
} }
/** /**
* 导出所有规则 * 导出所有规则
*
* @return 规则 * @return 规则
*/ */
@ApiOperation("导出所有规则") @ApiOperation("导出所有规则")
@GetMapping("/export") @GetMapping("/export")
public ResponseEntity exportAllRules(){ public ServerResponse exportAllRules() {
String path = ruleService.exportData(); String path = ruleService.exportData();
return ResponseEntity.ok(path); return ServerResponse.ok(path);
} }
@PostMapping("/importRules") @PostMapping("/importRules")
@ApiOperation("导入所有规则") @ApiOperation("导入所有规则")
@AuthAnnotation(code = {"001200"}) @AuthAnnotation(code = {"0001200"})
public ResponseEntity importRules(@RequestParam("file") MultipartFile file){ public ServerResponse importRules(@RequestParam("file") MultipartFile file) {
ruleService.importRules(file); ruleService.importRules(file);
return null; return ServerResponse.ok("");
} }
} }
...@@ -36,14 +36,14 @@ public class TechnologyController { ...@@ -36,14 +36,14 @@ public class TechnologyController {
*/ */
@GetMapping @GetMapping
@ApiOperation("获取所有关键技术") @ApiOperation("获取所有关键技术")
public ResponseEntity getTechnologies(){ public ServerResponse getTechnologies(){
return ResponseEntity.ok(technologyService.findAllTechnology()); return ServerResponse.ok(technologyService.findAllTechnology());
} }
@GetMapping("/names") @GetMapping("/names")
@ApiOperation("获取所有关键技术name") @ApiOperation("获取所有关键技术name")
@AuthAnnotation(code = {"001100"}) @AuthAnnotation(code = {"0001100"})
public ResponseEntity getTechnologiesName(){ public ServerResponse getTechnologiesName(){
return ResponseEntity.ok(technologyService.findAllTechnologyNames()); return ServerResponse.ok(technologyService.findAllTechnologyNames());
} }
/** /**
...@@ -52,9 +52,9 @@ public class TechnologyController { ...@@ -52,9 +52,9 @@ public class TechnologyController {
*/ */
@GetMapping(value = "/{name}") @GetMapping(value = "/{name}")
@ApiOperation("根据name获取所有关键技术") @ApiOperation("根据name获取所有关键技术")
@AuthAnnotation(code = {"001100"}) @AuthAnnotation(code = {"0001100"})
public ResponseEntity getTechnologies(@PathVariable String name){ public ServerResponse getTechnologies(@PathVariable String name){
return ResponseEntity.ok(technologyService.findAllTechnology(name)); return ServerResponse.ok(technologyService.findAllTechnology(name));
} }
/** /**
* 添加关键技术 * 添加关键技术
...@@ -62,19 +62,19 @@ public class TechnologyController { ...@@ -62,19 +62,19 @@ public class TechnologyController {
*/ */
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新添加关键技术") @ApiOperation("新添加关键技术")
@AuthAnnotation(code = {"001100"}) @AuthAnnotation(code = {"0001100"})
public ResponseEntity addTechnologies(@RequestBody Technology technology){ public ServerResponse addTechnologies(@RequestBody Technology technology){
technologyService.add(technology); technologyService.add(technology);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
@PostMapping(value = "/{id}") @PostMapping(value = "/{id}")
@ApiOperation("修改关键技术") @ApiOperation("修改关键技术")
@AuthAnnotation(code = {"001100"}) @AuthAnnotation(code = {"0001100"})
public ResponseEntity update(@RequestBody Technology technology,@PathVariable String id){ public ServerResponse update(@RequestBody Technology technology,@PathVariable String id){
technology.setId(id); technology.setId(id);
technologyService.update(technology); technologyService.update(technology);
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
/** /**
* 分页+多条件查询 * 分页+多条件查询
...@@ -89,10 +89,10 @@ public class TechnologyController { ...@@ -89,10 +89,10 @@ public class TechnologyController {
@ApiImplicitParam(name="size",value = "每页记录数",required=true,paramType="path",dataType="int") @ApiImplicitParam(name="size",value = "每页记录数",required=true,paramType="path",dataType="int")
}) })
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST) @RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
@AuthAnnotation(code = {"001100"}) @AuthAnnotation(code = {"0001100"})
public ResponseEntity findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){ public ServerResponse<PageResult> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Technology> pageList = technologyService.findSearch(searchMap, page, size); Page<Technology> pageList = technologyService.findSearch(searchMap, page, size);
return ResponseEntity.ok(new PageResult<Technology>(pageList.getTotalElements(), pageList.getContent()) ); return ServerResponse.ok(new PageResult<Technology>(pageList.getTotalElements(), pageList.getContent()) );
} }
} }
package com.zjty.inspect.controller; package com.zjty.inspect.controller;
import com.zjty.inspect.config.WebSocketServer; import com.zjty.inspect.config.WebSocketServer;
import com.zjty.inspect.entity.ServerResponse;
import com.zjty.inspect.thread.task.AsyncTask; import com.zjty.inspect.thread.task.AsyncTask;
import com.zjty.inspect.utils.ExceptionMessage; import com.zjty.inspect.utils.ExceptionMessage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -43,7 +44,7 @@ public class WebSocketController { ...@@ -43,7 +44,7 @@ public class WebSocketController {
*/ */
@ApiOperation(value = "推送数据到所有的WebSocket客户端" , notes="推送数据到所有的WebSocket客户端") @ApiOperation(value = "推送数据到所有的WebSocket客户端" , notes="推送数据到所有的WebSocket客户端")
@RequestMapping(value="/push/{msg}",method= RequestMethod.GET) @RequestMapping(value="/push/{msg}",method= RequestMethod.GET)
public ResponseEntity pushToAll(@PathVariable("msg")String msg){ public ServerResponse pushToAll(@PathVariable("msg")String msg){
try { try {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("msg",msg); map.put("msg",msg);
...@@ -51,8 +52,8 @@ public class WebSocketController { ...@@ -51,8 +52,8 @@ public class WebSocketController {
} catch (Exception e) { } catch (Exception e) {
String info = ExceptionMessage.getStackTraceInfo(e); String info = ExceptionMessage.getStackTraceInfo(e);
logger.error("推送消息到客户端报错:"+info); logger.error("推送消息到客户端报错:"+info);
return ResponseEntity.ok("推送消息到客户端报错:"+info); return ServerResponse.error("推送消息到客户端报错:"+info);
} }
return ResponseEntity.ok(200); return ServerResponse.ok(200);
} }
} }
\ No newline at end of file
...@@ -6,7 +6,9 @@ import lombok.AllArgsConstructor; ...@@ -6,7 +6,9 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* <h4>Description : 评估报告</h4> * <h4>Description : 评估报告</h4>
...@@ -65,6 +67,12 @@ public class AssessmentReport { ...@@ -65,6 +67,12 @@ public class AssessmentReport {
@ApiModelProperty(value = "语言",example = "1") @ApiModelProperty(value = "语言",example = "1")
private Integer language; private Integer language;
/**
* 项目中所有语言
*/
@ApiModelProperty(value = "语言",example = "1")
private List<Integer> languages = new ArrayList<>();
/** /**
* 类型预算 1:适配、2:改造 * 类型预算 1:适配、2:改造
*/ */
......
...@@ -55,9 +55,15 @@ public class ReportVo { ...@@ -55,9 +55,15 @@ public class ReportVo {
/** /**
* 语言 * 语言
*/ */
@ApiModelProperty(value = "权限",example = "1") @ApiModelProperty(value = "语言",example = "1")
private Integer language; private Integer language;
/**
* 语言
*/
@ApiModelProperty(value = "语言",example = "1")
private List<Integer> languages;
/** /**
* 生成报告存储地址 * 生成报告存储地址
*/ */
......
package com.zjty.inspect.entity; package com.zjty.inspect.entity;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @author Mcj * @author Mcj
* @date 2020-04-03 09:41 * @date 2020-04-03 09:41
*/ */
@Data @Data
public class ServerResponse implements Serializable { @NoArgsConstructor
private User data; public class ServerResponse<T> implements Serializable {
/**
* 错误码
*/
@JSONField(ordinal = 1)
private Integer code; private Integer code;
/**
* 提示信息
*/
@JSONField(ordinal = 2)
private String msg;
/**
* 具体的内容
*/
@JSONField(ordinal = 3)
private T data;
public ServerResponse(Integer code,String msg,T t){
this.code=code;
this.data=t;
this.msg=msg;
}
public ServerResponse(Integer code,String msg){
this.code=code;
this.msg=msg;
}
public static <T> ServerResponse error(Object data){
return new ServerResponse(400,"请求失败",data);
}
public static <T> ServerResponse noAuthority(){
return new ServerResponse(403,"没有权限","");
}
public static <T> ServerResponse badRequest(){
return new ServerResponse(400,"请求失败","");
}
public static <T> ServerResponse<T> ok(T data) {
return new ServerResponse(200,"成功",data);
}
public static <T> ServerResponse error(){
return new ServerResponse(500,"服务器出错","");
}
} }
...@@ -45,6 +45,7 @@ public enum ApplicationType { ...@@ -45,6 +45,7 @@ public enum ApplicationType {
private Integer code; private Integer code;
private String name; private String name;
private Integer other;
ApplicationType() { ApplicationType() {
} }
......
...@@ -9,26 +9,27 @@ import java.util.Map; ...@@ -9,26 +9,27 @@ import java.util.Map;
@ApiModel(value = "浏览器插件") @ApiModel(value = "浏览器插件")
@Getter @Getter
public enum BrowserPlugEnum { public enum BrowserPlugEnum {
NONE(-1,"无"), NONE(-1,"无",0),
DOWNLOAD(1,"下载/上传"), DOWNLOAD(1,"下载/上传",0),
PRINT(2,"打印调用"), PRINT(2,"打印调用",0),
SCAN(3,"扫描调用"), SCAN(3,"扫描调用",0),
YIWEIMA(4,"一维码/二维码调用"), YIWEIMA(4,"一维码/二维码调用",0),
OCR(5,"OCR调用:请在备注中填写插件名,如需填写多个,请以逗号分隔"), OCR(5,"OCR调用:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
MOBILE(6,"移动设备同步:请在备注中填写插件名,如需填写多个,请以逗号分隔"), MOBILE(6,"移动设备同步:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
TEXT(7,"在线文本编辑类:请在备注中填写插件名,如需填写多个,请以逗号分隔"), TEXT(7,"在线文本编辑类:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
TABLE(8,"在线表单编辑类:请在备注中填写插件名,如需填写多个,请以逗号分隔"), TABLE(8,"在线表单编辑类:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
CHART(9,"在线统计图表展现类:请在备注中填写插件名,如需填写多个,请以逗号分隔"), CHART(9,"在线统计图表展现类:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
VIDEO(10,"在线视频播放类:请在备注中填写插件名,如需填写多个,请以逗号分隔"), VIDEO(10,"在线视频播放类:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
THREED(11,"在线3D建模、渲染、展现:请在备注中填写插件名,如需填写多个,请以逗号分隔"), THREED(11,"在线3D建模、渲染、展现:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
GIS(12,"在线GIS类:请在备注中填写插件名,如需填写多个,请以逗号分隔"), GIS(12,"在线GIS类:请在备注中填写插件名,如需填写多个,请以逗号分隔",1),
PERIPHERAL(13,"外设调用"), PERIPHERAL(13,"外设调用",0),
ANIMATION(14,"动画"), ANIMATION(14,"动画",0),
FLASH(14,"Flash"), FLASH(14,"Flash",0),
OTHER(13,"其他:请在备注中填写插件名和版本,如需填写多个,请以逗号分隔"); OTHER(13,"其他:请在备注中填写插件名和版本,如需填写多个,请以逗号分隔",1);
private Integer code; private Integer code;
private String name; private String name;
private Integer other;
private static Map<String,BrowserPlugEnum> browserPlugEnumMap=new HashMap<>(); private static Map<String,BrowserPlugEnum> browserPlugEnumMap=new HashMap<>();
private static Map<Integer,BrowserPlugEnum> browserPlugCodeEnumMap=new HashMap<>(); private static Map<Integer,BrowserPlugEnum> browserPlugCodeEnumMap=new HashMap<>();
...@@ -41,9 +42,10 @@ public enum BrowserPlugEnum { ...@@ -41,9 +42,10 @@ public enum BrowserPlugEnum {
BrowserPlugEnum() { BrowserPlugEnum() {
} }
BrowserPlugEnum(Integer code, String name) { BrowserPlugEnum(Integer code, String name,Integer other) {
this.code = code; this.code = code;
this.name = name; this.name = name;
this.other=other;
} }
public static BrowserPlugEnum getByName(String name){ public static BrowserPlugEnum getByName(String name){
BrowserPlugEnum browserPlugEnum = browserPlugEnumMap.get(name); BrowserPlugEnum browserPlugEnum = browserPlugEnumMap.get(name);
......
...@@ -9,34 +9,35 @@ import java.util.Map; ...@@ -9,34 +9,35 @@ import java.util.Map;
@ApiModel(value = "微服务") @ApiModel(value = "微服务")
@Getter @Getter
public enum MicroServiceEnum { public enum MicroServiceEnum {
NONE(-1,"无"), NONE(-1,"无",0),
FLUME(0,"Flume"), FLUME(0,"Flume",0),
ZOOKEEPER(1,"Zookeeper"), ZOOKEEPER(1,"Zookeeper",0),
RIBBON(2,"Ribbon"), RIBBON(2,"Ribbon",0),
HYSTIX(3,"Hystix"), HYSTIX(3,"Hystix",0),
HBASE(4,"HBASE"), HBASE(4,"HBASE",0),
HIVE(5,"Hive"), HIVE(5,"Hive",0),
SPARKSTROM(6,"Spark Strom"), SPARKSTROM(6,"Spark Strom",0),
RESTTEMPLATE(7,"RestTemplate"), RESTTEMPLATE(7,"RestTemplate",0),
KVM(8,"KVM"), KVM(8,"KVM",0),
OPENSTACK(9,"Openstack"), OPENSTACK(9,"Openstack",0),
KUBERNETES(10,"Kubernetes"), KUBERNETES(10,"Kubernetes",0),
DOCKER(11,"Docker"), DOCKER(11,"Docker",0),
EXMOBI(12,"Exmobi"), EXMOBI(12,"Exmobi",0),
DATAV(13,"DataV"), DATAV(13,"DataV",0),
RAYDATA(14,"RayData"), RAYDATA(14,"RayData",0),
BIANMU(15,"编目服务:请在备注中填写,如需填写多个,请以逗号分隔"), BIANMU(15,"编目服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
DITU(16,"地图类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), DITU(16,"地图类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
TUBIAO(17,"图表视图类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), TUBIAO(17,"图表视图类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
SHIBIE(18,"识别类微服务:请在备注中填写"), SHIBIE(18,"识别类微服务:请在备注中填写",1),
NEIRONG(19,"内容审查类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), NEIRONG(19,"内容审查类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
FENXI(20,"智能分析类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), FENXI(20,"智能分析类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
DATA(21,"数据引用类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), DATA(21,"数据引用类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
IOQUICK(22,"流媒体加速类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), IOQUICK(22,"流媒体加速类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
JIAMI(23,"加密类微服务:请在备注中填写,如需填写多个,请以逗号分隔"), JIAMI(23,"加密类微服务:请在备注中填写,如需填写多个,请以逗号分隔",1),
OTHER(24,"其他:请在备注中填写,如需填写多个,请以逗号分隔"); OTHER(24,"其他:请在备注中填写,如需填写多个,请以逗号分隔",1);
private Integer code; private Integer code;
private String name; private String name;
private Integer other;
MicroServiceEnum() { MicroServiceEnum() {
} }
...@@ -46,9 +47,10 @@ public enum MicroServiceEnum { ...@@ -46,9 +47,10 @@ public enum MicroServiceEnum {
microServiceEnumMap.put(microServiceEnum.getName(),microServiceEnum); microServiceEnumMap.put(microServiceEnum.getName(),microServiceEnum);
} }
} }
MicroServiceEnum(Integer code, String name) { MicroServiceEnum(Integer code, String name,Integer other) {
this.code = code; this.code = code;
this.name = name; this.name = name;
this.other=other;
} }
public static MicroServiceEnum getByName(String name){ public static MicroServiceEnum getByName(String name){
MicroServiceEnum microServiceEnum = microServiceEnumMap.get(name); MicroServiceEnum microServiceEnum = microServiceEnumMap.get(name);
......
...@@ -6,36 +6,37 @@ import java.util.HashMap; ...@@ -6,36 +6,37 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Getter @Getter
public enum OtherApiEnum { public enum OtherApiEnum {
NONE(-1,"无"), NONE(-1,"无",0),
JNDI(0,"JNDI"), JNDI(0,"JNDI",0),
ML(1,"其他命名与目录类API:请在备注中填写,如需填写多个,请以逗号分隔"), ML(1,"其他命名与目录类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
JMS(2,"JMS"), JMS(2,"JMS",0),
RestFul(3,"RestFul"), RestFul(3,"RestFul",0),
XX(4,"其他消息类API:请在备注中填写,如需填写多个,请以逗号分隔"), XX(4,"其他消息类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
AMQP(5,"AMQP"), AMQP(5,"AMQP",0),
KAFKA(6,"Kafka API"), KAFKA(6,"Kafka API",0),
MQTT(7,"MQTT"), MQTT(7,"MQTT",0),
ROUTE(8,"其他消息路由类API:请在备注中填写,如需填写多个,请以逗号分隔"), ROUTE(8,"其他消息路由类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
ES(9,"ES"), ES(9,"ES",0),
YQ(10,"其他搜索引擎类API:请在备注中填写,如需填写多个,请以逗号分隔"), YQ(10,"其他搜索引擎类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
LOGSTASH(11,"Logstash"), LOGSTASH(11,"Logstash",0),
LOG(12,"其他分析日志类API:请在备注中填写,如需填写多个,请以逗号分隔"), LOG(12,"其他分析日志类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
KIBANA(13,"Kibana"), KIBANA(13,"Kibana",0),
FXKS(14,"其他分析可视化类API:请在备注中填写,如需填写多个,请以逗号分隔"), FXKS(14,"其他分析可视化类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
REDIS(15,"Redis"), REDIS(15,"Redis",0),
JIQ(16,"其他集群类API:请在备注中填写,如需填写多个,请以逗号分隔"), JIQ(16,"其他集群类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
ARCGIS(17,"ARCGIS"), ARCGIS(17,"ARCGIS",0),
GIS(18,"其他GIS类API:请在备注中填写,如需填写多个,请以逗号分隔"), GIS(18,"其他GIS类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
EDIT(19,"在线编辑API:请在备注中填写,如需填写多个,请以逗号分隔"), EDIT(19,"在线编辑API:请在备注中填写,如需填写多个,请以逗号分隔",1),
TUBIAO(20,"统计图表类API:请在备注中填写,如需填写多个,请以逗号分隔"), TUBIAO(20,"统计图表类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
BF(21,"播放类API:请在备注中填写,如需填写多个,请以逗号分隔"), BF(21,"播放类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
YJ(22,"硬件驱动类API:请在备注中填写,如需填写多个,请以逗号分隔"), YJ(22,"硬件驱动类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
OCR(23,"OCR识别类API:请在备注中填写,如需填写多个,请以逗号分隔"), OCR(23,"OCR识别类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
JIAMI(24,"加密类API:请在备注中填写,如需填写多个,请以逗号分隔"), JIAMI(24,"加密类API:请在备注中填写,如需填写多个,请以逗号分隔",1),
OTHER(25,"其他:请在备注中填写,如需填写多个,请以逗号分隔"); OTHER(25,"其他:请在备注中填写,如需填写多个,请以逗号分隔",1);
private Integer code; private Integer code;
private String name; private String name;
private Integer other;
private static Map<String,OtherApiEnum> otherApiEnumMap=new HashMap<>(); private static Map<String,OtherApiEnum> otherApiEnumMap=new HashMap<>();
private static Map<Integer,OtherApiEnum> otherApiCodeEnumMap=new HashMap<>(); private static Map<Integer,OtherApiEnum> otherApiCodeEnumMap=new HashMap<>();
...@@ -50,9 +51,10 @@ public enum OtherApiEnum { ...@@ -50,9 +51,10 @@ public enum OtherApiEnum {
OtherApiEnum() { OtherApiEnum() {
} }
OtherApiEnum(Integer code, String name) { OtherApiEnum(Integer code, String name,Integer other) {
this.code = code; this.code = code;
this.name = name; this.name = name;
this.other=other;
} }
public static OtherApiEnum getByName(String name){ public static OtherApiEnum getByName(String name){
OtherApiEnum otherApiEnum = otherApiEnumMap.get(name); OtherApiEnum otherApiEnum = otherApiEnumMap.get(name);
......
...@@ -6,7 +6,8 @@ public enum RecastMethod { ...@@ -6,7 +6,8 @@ public enum RecastMethod {
* 架构 * 架构
*/ */
RECONSITUTION("适配重构",1), RECONSITUTION("适配重构",1),
MODIFICATION("代码修改",2); MODIFICATION("代码修改",2),
NOMODIFICATION("无需代码修改",3);
RecastMethod(String name, Integer status){ RecastMethod(String name, Integer status){
this.name=name; this.name=name;
......
...@@ -126,10 +126,9 @@ public class Inspector { ...@@ -126,10 +126,9 @@ public class Inspector {
* 配置文件后缀 * 配置文件后缀
* xml:list【路径】 * xml:list【路径】
*/ */
private Map<String, List<Path>> configFileTypePathsMapping = new HashMap<>(512); private Map<String, List<Path>> configFileTypePathsMapping = new HashMap<>(512);
private Map<String, List<Path>> ruleSuffixFilePathMap; private Map<String, List<Path>> ruleSuffixFilePathMap = new HashMap<>(512);
private Map<String, List<Rule>> ruleSuffixMap; private Map<String, List<Rule>> ruleSuffixMap = new HashMap<>(512);
/** /**
* 规则关联的技术 * 规则关联的技术
...@@ -152,7 +151,7 @@ public class Inspector { ...@@ -152,7 +151,7 @@ public class Inspector {
* *
* @return 报告 * @return 报告
*/ */
public ReportVo inspect() throws IOException { public ReportVo inspect() {
//初始化成员变量 //初始化成员变量
initData(); initData();
//扫描文件,进行文件分类 //扫描文件,进行文件分类
...@@ -166,11 +165,11 @@ public class Inspector { ...@@ -166,11 +165,11 @@ public class Inspector {
setReportLanguageAndFrame(); setReportLanguageAndFrame();
//根据扫描结果以及用户配置得出需要使用的规则及技术 //根据扫描结果以及用户配置得出需要使用的规则及技术
ruleTransform(inspectParameter.getRecastMethod()); ruleTransform(inspectParameter.getRecastMethod());
//扫描配置文件 //扫描源代码文件
forEachFilesMap(); forEachFilesMap();
//将得到的告警信息根据技术id进行转换 //将得到的告警信息根据技术id进行转换
Set<String> idSet = warns.stream().map(Warn::getTechnologyId).collect(Collectors.toSet()); Set<String> technologyIds = warns.stream().map(Warn::getTechnologyId).collect(Collectors.toSet());
List<Technology> technologies = technologyDao.findAllById(idSet); List<Technology> technologies = technologyDao.findAllById(technologyIds);
//计算技术金额 //计算技术金额
Integer technologyFund = 0; Integer technologyFund = 0;
...@@ -230,10 +229,7 @@ public class Inspector { ...@@ -230,10 +229,7 @@ public class Inspector {
} }
} }
} }
} }
} }
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
//指定后缀到文件匹配关键字 //指定后缀到文件匹配关键字
...@@ -241,7 +237,7 @@ public class Inspector { ...@@ -241,7 +237,7 @@ public class Inspector {
int fileSize = 0; int fileSize = 0;
List<Integer> collect = ruleSuffixFilePathMap.entrySet().stream().map(Map.Entry::getValue).map(List::size).collect(Collectors.toList()); List<Integer> collect = ruleSuffixFilePathMap.entrySet().stream().map(Map.Entry::getValue).map(List::size).collect(Collectors.toList());
for (Integer integer : collect) { for (Integer integer : collect) {
fileSize=fileSize+integer; fileSize = fileSize + integer;
} }
for (Map.Entry<String, List<Path>> entry : ruleSuffixFilePathMap.entrySet()) { for (Map.Entry<String, List<Path>> entry : ruleSuffixFilePathMap.entrySet()) {
//entry,key为后缀,value为文件列表 //entry,key为后缀,value为文件列表
...@@ -250,6 +246,10 @@ public class Inspector { ...@@ -250,6 +246,10 @@ public class Inspector {
List<Rule> rules = ruleSuffixMap.get(key); List<Rule> rules = ruleSuffixMap.get(key);
for (Path path1 : entry.getValue()) { for (Path path1 : entry.getValue()) {
try { try {
fileNum = fileNum + 1;
map.put("totalFile", fileNum + "/" + fileSize);
System.out.println(fileNum + "/" + fileSize);
asyncTask.sendMessageToAll(map);
//如果文件类型为jar活着class则不读取 //如果文件类型为jar活着class则不读取
if (path1.toAbsolutePath().toString().endsWith("jar") || path1.toAbsolutePath().toString().endsWith("class")) { if (path1.toAbsolutePath().toString().endsWith("jar") || path1.toAbsolutePath().toString().endsWith("class")) {
continue; continue;
...@@ -263,10 +263,7 @@ public class Inspector { ...@@ -263,10 +263,7 @@ public class Inspector {
} catch (IOException e) { } catch (IOException e) {
log.error("解析{}出错,异常信息为{}", path1.toAbsolutePath().toString(), e.getMessage()); log.error("解析{}出错,异常信息为{}", path1.toAbsolutePath().toString(), e.getMessage());
} }
fileNum=fileNum + 1;
map.put("totalFile",fileNum+"/"+fileSize);
System.out.println(fileNum+"/"+fileSize);
asyncTask.sendMessageToAll(map);
} }
} }
} }
...@@ -293,23 +290,34 @@ public class Inspector { ...@@ -293,23 +290,34 @@ public class Inspector {
languageEnums.add(language); languageEnums.add(language);
} }
} }
List<LanguageEnum> languageEnums1 = languageEnums.stream() //设置是否需要重构
List<LanguageEnum> newLanguageEnums = languageEnums.stream()
.filter(e -> e.getCode() != 4 & e.getCode() != 5 & e.getCode() != 6) .filter(e -> e.getCode() != 4 & e.getCode() != 5 & e.getCode() != 6)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!languageEnums1.isEmpty()) { if (!newLanguageEnums.isEmpty()) {
report.setRecastMethod(RecastMethod.RECONSITUTION.getStatus()); report.setRecastMethod(RecastMethod.RECONSITUTION.getStatus());
log.info("inspect:代码解析完成,建议进行适配重构"); log.info("inspect:代码解析完成,建议进行适配重构");
} else { } else {
List<LanguageEnum> enums = languageEnums.stream()
.filter(e -> e.getCode() != 4 & e.getCode() != 6)
.collect(Collectors.toList());
if(enums.isEmpty()){
report.setRecastMethod(RecastMethod.MODIFICATION.getStatus()); report.setRecastMethod(RecastMethod.MODIFICATION.getStatus());
log.info("inspect:代码解析完成,无需进行代码修改");
}else{
report.setRecastMethod(RecastMethod.NOMODIFICATION.getStatus());
log.info("inspect:代码解析完成,建议进行代码修改"); log.info("inspect:代码解析完成,建议进行代码修改");
} }
}
List<Integer> languageCodes = languageEnums.stream()
.map(LanguageEnum::getCode)
.collect(Collectors.toList());
//设置语言 //设置语言
report.setLanguage(most == null ? LanguageEnum.NONE.getCode() : mostStatus); report.setLanguage(most == null ? LanguageEnum.NONE.getCode() : mostStatus);
report.setLanguages(languageCodes);
//设置架构 //设置架构
report.setFramework(languageMatchMap.get("jsp").i > 0 ? Framework.MIXTURE.getStatus() : Framework.SEPARATE.getStatus()); report.setFramework(languageMatchMap.get("jsp").i > 0 ? Framework.MIXTURE.getStatus() : Framework.SEPARATE.getStatus());
//设置是否需要重构
} }
/** /**
...@@ -322,7 +330,7 @@ public class Inspector { ...@@ -322,7 +330,7 @@ public class Inspector {
private void ruleTransform(Integer status) { private void ruleTransform(Integer status) {
//如果需要改造则查询所有规则 //如果需要改造则查询所有规则
if (status == 1) { if (status == 1) {
this.ruleList = ruleService.mcjAllRule(); this.ruleList = ruleService.findRules();
} else { } else {
//只查询前端技术 //只查询前端技术
List<Technology> front = technologyDao.findAllByBackorfrontEquals(1); List<Technology> front = technologyDao.findAllByBackorfrontEquals(1);
...@@ -356,6 +364,9 @@ public class Inspector { ...@@ -356,6 +364,9 @@ public class Inspector {
} }
} }
/**
* 数据清空
*/
private void initData() { private void initData() {
//查询技术,构造支持与非支持技术对象,3个对象 //查询技术,构造支持与非支持技术对象,3个对象
//配置语言 map结构 //配置语言 map结构
...@@ -363,10 +374,10 @@ public class Inspector { ...@@ -363,10 +374,10 @@ public class Inspector {
fileLine = 0; fileLine = 0;
fileNum = 0; fileNum = 0;
dependencyVo = new DependencyVo(); dependencyVo = new DependencyVo();
ruleSuffixFilePathMap = new HashMap<>(); ruleSuffixFilePathMap.clear();
ruleSuffixMap = new HashMap<>(); ruleSuffixMap.clear();
technologyHashMap = new HashMap<>(); technologyHashMap.clear();
supportWarns = new ArrayList<>(); supportWarns.clear();
warns.clear(); warns.clear();
rules.clear(); rules.clear();
//配置 config文件 结构 //配置 config文件 结构
...@@ -378,7 +389,7 @@ public class Inspector { ...@@ -378,7 +389,7 @@ public class Inspector {
} }
private void statisticsConfigFile() { private void statisticsConfigFile() {
this.configFileTypePathsMapping = new HashMap<>(); this.configFileTypePathsMapping.clear();
configFileTypePathsMapping.put("xml", new ArrayList<>()); configFileTypePathsMapping.put("xml", new ArrayList<>());
configFileTypePathsMapping.put("json", new ArrayList<>()); configFileTypePathsMapping.put("json", new ArrayList<>());
configFileTypePathsMapping.put("gradle", new ArrayList<>()); configFileTypePathsMapping.put("gradle", new ArrayList<>());
...@@ -407,7 +418,7 @@ public class Inspector { ...@@ -407,7 +418,7 @@ public class Inspector {
*/ */
private void initRule() { private void initRule() {
//查询所有规则,第一遍扫描文件需要 //查询所有规则,第一遍扫描文件需要
this.ruleList = ruleService.mcjAllRule(); this.ruleList = ruleService.findRules();
//根据后缀名,收集文件进行操作 //根据后缀名,收集文件进行操作
for (Rule rule : ruleList) { for (Rule rule : ruleList) {
if (!ruleSuffixFilePathMap.containsKey(rule.getSuffix())) { if (!ruleSuffixFilePathMap.containsKey(rule.getSuffix())) {
......
...@@ -10,7 +10,7 @@ public interface EvaluationService { ...@@ -10,7 +10,7 @@ public interface EvaluationService {
Evaluation save(Evaluation evaluation); Evaluation save(Evaluation evaluation);
void update(Evaluation evaluation); void update(Evaluation evaluation);
void delete(String id); void delete(String id);
Page<Evaluation> findSearch(Map searchMap, int page, int size); Page<Evaluation> findSearch(Map<String,String> searchMap, int page, int size);
Evaluation findById(String id); Evaluation findById(String id);
Evaluation findByName(String name); Evaluation findByName(String name);
} }
...@@ -54,5 +54,4 @@ public interface RuleService { ...@@ -54,5 +54,4 @@ public interface RuleService {
void importRules(MultipartFile file); void importRules(MultipartFile file);
List<Rule> mcjAllRule();
} }
...@@ -56,7 +56,7 @@ public class RuleServiceImpl implements RuleService { ...@@ -56,7 +56,7 @@ public class RuleServiceImpl implements RuleService {
private RuleCollectionDao ruleCollectionDao; private RuleCollectionDao ruleCollectionDao;
@Override @Override
public List<Rule> mcjAllRule() { public List<Rule> findRules() {
List<Rule> rules = ruleDao.findAll(); List<Rule> rules = ruleDao.findAll();
List<Rule> ruleList = new ArrayList<>(); List<Rule> ruleList = new ArrayList<>();
if (rules != null && rules.size() > 0) { if (rules != null && rules.size() > 0) {
...@@ -258,11 +258,6 @@ public class RuleServiceImpl implements RuleService { ...@@ -258,11 +258,6 @@ public class RuleServiceImpl implements RuleService {
return rules; return rules;
} }
@Override
public List<Rule> findRules() {
return ruleDao.findAll();
}
@Override @Override
public List<RuleCollection> findByName(String name) { public List<RuleCollection> findByName(String name) {
List<RuleCollection> rules = ruleCollectionDao.findAllByTargetLike("%" + name + "%"); List<RuleCollection> rules = ruleCollectionDao.findAllByTargetLike("%" + name + "%");
......
...@@ -130,23 +130,21 @@ public class BudgetUitl { ...@@ -130,23 +130,21 @@ public class BudgetUitl {
if(inspectParameter.getRecastMethod()==1){ if(inspectParameter.getRecastMethod()==1){
//用户需要适配 //用户需要适配
if(report.getRecastMethod()==1){ if(report.getRecastMethod()==1){
double refactorProportion1 = Double.valueOf(doubleHashMap.get(2)); double refactorProportion1 = Double.parseDouble(doubleHashMap.get(2));
inspectParameter.setProportion(refactorProportion1); inspectParameter.setProportion(refactorProportion1);
Budget budget1 = getCodeRefactor("代码重构预算", inspectParameter.getProportion(), pow, systemFund, fund, moneyRate, coefficient); Budget budget1 = getCodeRefactor("代码重构预算", inspectParameter.getProportion(), pow, systemFund, fund, moneyRate, coefficient);
budgetVo.getBudget().add(budget1); budgetVo.getBudget().add(budget1);
return budgetVo; return budgetVo;
} }
double refactorProportion = Double.valueOf(doubleHashMap.get(4)); double refactorProportion = Double.parseDouble(doubleHashMap.get(4));
inspectParameter.setProportion(refactorProportion); inspectParameter.setProportion(refactorProportion);
Budget budget = getCodeRefactor("代码修改预算", inspectParameter.getProportion(), pow, systemFund, fund, moneyRate, coefficient); Budget budget = getCodeRefactor("代码修改预算", inspectParameter.getProportion(), pow, systemFund, fund, moneyRate, coefficient);
budgetVo.getBudget().add(budget); budgetVo.getBudget().add(budget);
}else{ }else{
double refactorProportion = Double.valueOf(doubleHashMap.get(3)); double refactorProportion = Double.parseDouble(doubleHashMap.get(3));
inspectParameter.setProportion(refactorProportion); inspectParameter.setProportion(refactorProportion);
Budget budget = getCodeRefactor("代码适配预算", inspectParameter.getProportion(), pow, systemFund, fund, moneyRate, coefficient); Budget budget = getCodeRefactor("代码适配预算", inspectParameter.getProportion(), pow, systemFund, fund, moneyRate, coefficient);
budgetVo.getBudget().add(budget); budgetVo.getBudget().add(budget);
} }
return budgetVo; return budgetVo;
} }
......
...@@ -69,6 +69,8 @@ public class ExcelUtil { ...@@ -69,6 +69,8 @@ public class ExcelUtil {
if (split.length > 1) { if (split.length > 1) {
reform.setUnitContent(split[0]); reform.setUnitContent(split[0]);
reform.setUnitPhone(split[1]); reform.setUnitPhone(split[1]);
}else if(split.length == 1){
reform.setUnitContent(split[0]);
} }
reform.setUnitName(unitName); reform.setUnitName(unitName);
...@@ -97,9 +99,11 @@ public class ExcelUtil { ...@@ -97,9 +99,11 @@ public class ExcelUtil {
reform.setAddress(yesOrNo(address)); reform.setAddress(yesOrNo(address));
String nativeContent = getExcelCell(7, 4, sheetAt); String nativeContent = getExcelCell(7, 4, sheetAt);
String[] nativeUnit = nativeContent.split("\n"); String[] nativeUnit = nativeContent.split("\n");
if (nativeUnit.length > 0) { if (nativeUnit.length > 1) {
reform.setLocalContact(nativeUnit[0]); reform.setLocalContact(nativeUnit[0]);
reform.setLocalPhone(nativeUnit[1]); reform.setLocalPhone(nativeUnit[1]);
}else if(nativeUnit.length > 0){
reform.setLocalContact(nativeUnit[0]);
} }
String secret = getExcelCell(8, 2, sheetAt); String secret = getExcelCell(8, 2, sheetAt);
...@@ -117,30 +121,8 @@ public class ExcelUtil { ...@@ -117,30 +121,8 @@ public class ExcelUtil {
String type = getExcelCell(12, 2, sheetAt); String type = getExcelCell(12, 2, sheetAt);
ArrayList<Integer> applicationType = new ArrayList<>(); ArrayList<Integer> applicationType = new ArrayList<>();
ApplicationType appType = ApplicationType.getByName(type);
switch (type) { applicationType.add(appType.getCode());
case "办公OA应用类":
applicationType.add(1);
break;
case "门户、信息发布、综合入口服务类":
applicationType.add(2);
break;
case "申报、填报、审批等公共行政服务类":
applicationType.add(4);
break;
case "数据收集、分析、态势感知等大数据应用类":
applicationType.add(5);
break;
case "地图、定位等GIS服务类":
applicationType.add(6);
break;
case "视频、图形等流媒体应用类":
applicationType.add(7);
break;
case "3D、模型等视觉建模应用类":
applicationType.add(8);
break;
}
reform.setApplicationType(applicationType); reform.setApplicationType(applicationType);
String module = getExcelCell(13, 2, sheetAt); String module = getExcelCell(13, 2, sheetAt);
...@@ -164,6 +146,11 @@ public class ExcelUtil { ...@@ -164,6 +146,11 @@ public class ExcelUtil {
BaseDes devFramework = new BaseDes(); BaseDes devFramework = new BaseDes();
FrameWorkEnum frameWorkEnum = FrameWorkEnum.getByName(framework); FrameWorkEnum frameWorkEnum = FrameWorkEnum.getByName(framework);
if (frameWorkEnum != null) { if (frameWorkEnum != null) {
if(frameWorkEnum.getCode()==15){
devFramework.setName(remark);
}else{
devFramework.setName(frameWorkEnum.getName());
}
devFramework.setCode(frameWorkEnum.getCode()); devFramework.setCode(frameWorkEnum.getCode());
devFramework.setVersion(version); devFramework.setVersion(version);
devFramework.setDes(remark); devFramework.setDes(remark);
...@@ -184,8 +171,12 @@ public class ExcelUtil { ...@@ -184,8 +171,12 @@ public class ExcelUtil {
BaseDes font = new BaseDes(); BaseDes font = new BaseDes();
FontTechnologyEnum fontTechnologyEnum = FontTechnologyEnum.getByName(framework); FontTechnologyEnum fontTechnologyEnum = FontTechnologyEnum.getByName(framework);
if (fontTechnologyEnum != null) { if (fontTechnologyEnum != null) {
if(fontTechnologyEnum.getCode()==15){
font.setName(remark);
}else{
font.setName(fontTechnologyEnum.getName());
}
font.setCode(fontTechnologyEnum.getCode()); font.setCode(fontTechnologyEnum.getCode());
font.setName(framework);
font.setDes(remark); font.setDes(remark);
font.setVersion(version); font.setVersion(version);
fontTechnologies.add(font); fontTechnologies.add(font);
...@@ -206,8 +197,12 @@ public class ExcelUtil { ...@@ -206,8 +197,12 @@ public class ExcelUtil {
cs.setVersion(version); cs.setVersion(version);
CSTechnologyEnum csTechnologyEnum = CSTechnologyEnum.getByName(framework); CSTechnologyEnum csTechnologyEnum = CSTechnologyEnum.getByName(framework);
if (csTechnologyEnum != null) { if (csTechnologyEnum != null) {
cs.setCode(csTechnologyEnum.getCode()); if(csTechnologyEnum.getCode()==10){
cs.setName(remark);
}else{
cs.setName(csTechnologyEnum.getName()); cs.setName(csTechnologyEnum.getName());
}
cs.setCode(csTechnologyEnum.getCode());
fontDevTechnologies.add(cs); fontDevTechnologies.add(cs);
} }
} }
...@@ -225,7 +220,11 @@ public class ExcelUtil { ...@@ -225,7 +220,11 @@ public class ExcelUtil {
BaseDes opGA = new BaseDes(); BaseDes opGA = new BaseDes();
OpgaEnum opgaEnum = OpgaEnum.getByName(framework); OpgaEnum opgaEnum = OpgaEnum.getByName(framework);
if (opgaEnum != null) { if (opgaEnum != null) {
if(opgaEnum.getCode()==4){
opGA.setName(remark);
}else{
opGA.setName(framework); opGA.setName(framework);
}
opGA.setCode(opgaEnum.getCode()); opGA.setCode(opgaEnum.getCode());
opGA.setVersion(version); opGA.setVersion(version);
opGA.setDes(remark); opGA.setDes(remark);
...@@ -249,7 +248,11 @@ public class ExcelUtil { ...@@ -249,7 +248,11 @@ public class ExcelUtil {
BaseDes devLanguage = new BaseDes(); BaseDes devLanguage = new BaseDes();
LanguageEnum languageEnum = LanguageEnum.getByName(lan); LanguageEnum languageEnum = LanguageEnum.getByName(lan);
if (languageEnum != null) { if (languageEnum != null) {
if(languageEnum.getCode()==12){
devLanguage.setName(languageEnum.getName()); devLanguage.setName(languageEnum.getName());
}else{
devLanguage.setName(remark);
}
devLanguage.setCode(languageEnum.getCode()); devLanguage.setCode(languageEnum.getCode());
devLanguage.setVersion(version); devLanguage.setVersion(version);
devLanguage.setDes(remark); devLanguage.setDes(remark);
...@@ -273,7 +276,11 @@ public class ExcelUtil { ...@@ -273,7 +276,11 @@ public class ExcelUtil {
if (middlewareEnum != null) { if (middlewareEnum != null) {
BaseDes baseDes = new BaseDes(); BaseDes baseDes = new BaseDes();
baseDes.setDes(remark); baseDes.setDes(remark);
if(middlewareEnum.getCode()==15){
baseDes.setName(remark);
}else{
baseDes.setName(middlewareEnum.name()); baseDes.setName(middlewareEnum.name());
}
baseDes.setCode(middlewareEnum.getCode()); baseDes.setCode(middlewareEnum.getCode());
baseDes.setVersion(version); baseDes.setVersion(version);
middlewareEnums.add(baseDes); middlewareEnums.add(baseDes);
...@@ -291,10 +298,15 @@ public class ExcelUtil { ...@@ -291,10 +298,15 @@ 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);
OtherApi otherApi = new OtherApi(); OtherApi otherApi = new OtherApi();
OtherApiEnum otherApiEnum = OtherApiEnum.getByName(api);
if(otherApiEnum.getOther()==1){
otherApi.setApiName(remark);
}else{
otherApi.setApiName(api); otherApi.setApiName(api);
}
otherApi.setDes(remark); otherApi.setDes(remark);
otherApi.setVersion(version); otherApi.setVersion(version);
otherApi.setCode(String.valueOf(OtherApiEnum.getByName(api).getCode())); otherApi.setCode(String.valueOf(otherApiEnum.getCode()));
otherApis.add(otherApi); otherApis.add(otherApi);
} }
middleware.setOtherApis(otherApis); middleware.setOtherApis(otherApis);
...@@ -310,8 +322,12 @@ public class ExcelUtil { ...@@ -310,8 +322,12 @@ public class ExcelUtil {
BaseDes microService = new BaseDes(); BaseDes microService = new BaseDes();
MicroServiceEnum microServiceEnum = MicroServiceEnum.getByName(name); MicroServiceEnum microServiceEnum = MicroServiceEnum.getByName(name);
if (microServiceEnum != null) { if (microServiceEnum != null) {
microService.setCode(microServiceEnum.getCode()); if(microServiceEnum.getOther()==1){
microService.setName(remark);
}else{
microService.setName(microServiceEnum.getName()); microService.setName(microServiceEnum.getName());
}
microService.setCode(microServiceEnum.getCode());
microService.setDes(remark); microService.setDes(remark);
microService.setVersion(version); microService.setVersion(version);
microServices.add(microService); microServices.add(microService);
...@@ -371,10 +387,14 @@ public class ExcelUtil { ...@@ -371,10 +387,14 @@ public class ExcelUtil {
String brows = getExcelCell(i, 2, sheetAt); String brows = getExcelCell(i, 2, sheetAt);
String version = getExcelCell(i, 3, sheetAt); String version = getExcelCell(i, 3, sheetAt);
String remark = getExcelCell(i, 4, sheetAt); String remark = getExcelCell(i, 4, sheetAt);
CompatibleBrowser name = CompatibleBrowser.getByName(brows); CompatibleBrowser compatibleBrowser = CompatibleBrowser.getByName(brows);
BaseDes baseDes = new BaseDes(); BaseDes baseDes = new BaseDes();
baseDes.setName(name.toString()); if(compatibleBrowser.getCode()==3){
baseDes.setCode(name.getCode()); baseDes.setName(remark);
}else{
baseDes.setName(compatibleBrowser.getName());
}
baseDes.setCode(compatibleBrowser.getCode());
baseDes.setVersion(version); baseDes.setVersion(version);
baseDes.setDes(remark); baseDes.setDes(remark);
compatibleBrowsers.add(baseDes); compatibleBrowsers.add(baseDes);
...@@ -392,9 +412,13 @@ public class ExcelUtil { ...@@ -392,9 +412,13 @@ public class ExcelUtil {
browserPlug.setVersion(version); browserPlug.setVersion(version);
browserPlug.setDes(remark); browserPlug.setDes(remark);
BrowserPlugEnum byName = BrowserPlugEnum.getByName(plugin); BrowserPlugEnum browserPlugEnum = BrowserPlugEnum.getByName(plugin);
browserPlug.setName(byName.getName()); if(browserPlugEnum.getOther()==1){
browserPlug.setCode(byName.getCode()); browserPlug.setName(remark);
}else{
browserPlug.setName(browserPlugEnum.getName());
}
browserPlug.setCode(browserPlugEnum.getCode());
switch (plugin) { switch (plugin) {
case "在线文本编辑类:请在备注中填写插件名和版本": case "在线文本编辑类:请在备注中填写插件名和版本":
break; break;
...@@ -480,7 +504,6 @@ public class ExcelUtil { ...@@ -480,7 +504,6 @@ public class ExcelUtil {
if (inEva != null) { if (inEva != null) {
Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class); Reform reform = JSON.parseObject(evaluation.getInEva(), Reform.class);
arrayList.add(exportEntity("用户名", reform.getUsername())); arrayList.add(exportEntity("用户名", reform.getUsername()));
if(reform.getAssessmentType()==1){ if(reform.getAssessmentType()==1){
arrayList.add(exportEntity("评估类型", "快速评估")); arrayList.add(exportEntity("评估类型", "快速评估"));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论