Merge remote-tracking branch 'origin/main'
# Conflicts: # ccag-tvs-sim/ccag-tvs-sim-biz/src/main/java/com/ccag/common/Constant.java
This commit is contained in:
@@ -10,6 +10,7 @@ public class Constant {
|
||||
}
|
||||
|
||||
public static final int HeadLen = 10;
|
||||
public static final int HEAD_LEN = 10;
|
||||
|
||||
public static final int SDM_PORT = 60000;
|
||||
public static final int SQLITE_POOL_SIZE = 20;
|
||||
|
||||
@@ -12,8 +12,6 @@ import com.ccag.entity.req.svs.PushLoadcaseReq;
|
||||
import com.ccag.entity.req.svs.PushStatusReq;
|
||||
import com.ccag.entity.req.system.UpdateSystemApproveStatusReq;
|
||||
import com.ccag.entity.req.task.RejectInputFormReq;
|
||||
import com.ccag.knowledgeservice.KbManagementClientService;
|
||||
import com.ccag.knowledgeservice.entity.KbMenuFileManagement;
|
||||
import com.ccag.service.ModelService;
|
||||
import com.ccag.service.ProjectService;
|
||||
import com.ccag.service.SystemService;
|
||||
@@ -49,9 +47,6 @@ public class TestController {
|
||||
@Autowired
|
||||
private EmbseService embseService;
|
||||
|
||||
@Resource
|
||||
private KbManagementClientService kbManagementClientService;
|
||||
|
||||
@Resource
|
||||
private SvsService svsService;
|
||||
|
||||
@@ -121,7 +116,6 @@ public class TestController {
|
||||
|
||||
// projectService.testTransaction(890);
|
||||
|
||||
log.info("key1:{}",key1);
|
||||
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.ccag.entity.pojo.project;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class LoadcaseMemberBean {
|
||||
public class LoadcaseMemberBean implements Serializable {
|
||||
public long id;
|
||||
public long loadcaseId;
|
||||
private int type;
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.ccag.entity.pojo.project;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class LoadcasePerformanceBean {
|
||||
public class LoadcasePerformanceBean implements Serializable {
|
||||
public long id;
|
||||
public String performanceName;
|
||||
public long loadcaseId;
|
||||
|
||||
@@ -39,7 +39,4 @@ public class User implements Serializable {
|
||||
private String updateBy;
|
||||
private int approvalAdmin;
|
||||
|
||||
public User() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,5 @@ public class KeyValueRawInfo {
|
||||
private String values4;
|
||||
private String values5;
|
||||
|
||||
public KeyValueRawInfo() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,19 +30,18 @@ import java.util.stream.Collectors;
|
||||
public class DataServiceImpl implements DataService {
|
||||
@Resource
|
||||
private AttachmentGrpcClientService attachmentGrpcClientService;
|
||||
|
||||
@Value("${file.rootPath}")
|
||||
private String rootPath;
|
||||
|
||||
private final String ILLEGAL_FILE_PATH = "非法文件路径!";
|
||||
@Override
|
||||
public SdmResponse<ArrayList<JSONObject>> createDir(CreateDirReq req) {
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String strDirName = req.getDirName();
|
||||
if (StringUtils.isNotBlank(strDirName) && strDirName.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
int result = createDir(strParentPath, strDirName);
|
||||
return SdmResponse.validResult(result, Constant.DIR_CREATE_SUCCESS);
|
||||
@@ -99,11 +98,11 @@ public class DataServiceImpl implements DataService {
|
||||
log.info(ThreadLocalContext.getIdCode() + " delDir " + req.getDirName());
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String strDirName = req.getDirName();
|
||||
if (StringUtils.isNotBlank(strDirName) && strDirName.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
int result = delDir(strParentPath, strDirName);
|
||||
return SdmResponse.validResult(result, Constant.DIR_DEL_SUCCESS);
|
||||
@@ -160,11 +159,11 @@ public class DataServiceImpl implements DataService {
|
||||
log.info(ThreadLocalContext.getIdCode() + " delFile " + req.getDirName());
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String strDirName = req.getDirName();
|
||||
if (StringUtils.isNotBlank(strDirName) && strDirName.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
int result = delFile(strParentPath, strDirName);
|
||||
return SdmResponse.validResult(result, Constant.FILE_DEL_SUCCESS);
|
||||
@@ -192,7 +191,7 @@ public class DataServiceImpl implements DataService {
|
||||
public SdmResponse<FileBaseInfo> getFileBaseInfo(GetFileBaseInfoReq req) {
|
||||
String filePath = req.getPath();
|
||||
if (StringUtils.isNotBlank(filePath) && filePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
FileBaseInfo baseInfo = getFileBaseInfo(filePath);
|
||||
if (baseInfo == null) {
|
||||
@@ -238,7 +237,7 @@ public class DataServiceImpl implements DataService {
|
||||
dirPath = strParentPath + "/" + strFileName;
|
||||
}
|
||||
if (StringUtils.isNotBlank(dirPath) && dirPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
List<FileBaseInfo> files = getDirectoryContents(strParentPath, strFileName, req.getIsFilter());
|
||||
if (files == null) {
|
||||
@@ -321,11 +320,11 @@ public class DataServiceImpl implements DataService {
|
||||
public SdmResponse<List<JSONObject>> renameFile(RenameFileReq req) {
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String strOldName = req.getOldName();
|
||||
if (StringUtils.isNotBlank(strOldName) && strOldName.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String strNewName = req.getNewName();
|
||||
int result = renameFile(strParentPath, strOldName, strNewName);
|
||||
@@ -362,7 +361,7 @@ public class DataServiceImpl implements DataService {
|
||||
@Override
|
||||
public SdmResponse<Boolean> fileExists(String path) {
|
||||
if (StringUtils.isNotBlank(path) && path.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
File file = new File(path);
|
||||
return SdmResponse.success(file.exists());
|
||||
@@ -372,11 +371,11 @@ public class DataServiceImpl implements DataService {
|
||||
public SdmResponse<List<JSONObject>> copyFile(CopyFileReq req) {
|
||||
String sourceFilePath = req.getSourceFilePath();
|
||||
if (StringUtils.isNotBlank(sourceFilePath) && sourceFilePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String targetPath = req.getTargetPath();
|
||||
if (StringUtils.isNotBlank(targetPath) && targetPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getUserContext().getUser().getTenantId());
|
||||
sourceFilePath = companyRootPath + "/" + sourceFilePath;
|
||||
@@ -403,7 +402,7 @@ public class DataServiceImpl implements DataService {
|
||||
@Override
|
||||
public SdmResponse<List<JSONObject>> renameDir(String filePath, String newName, Integer type) {
|
||||
if (StringUtils.isNotBlank(filePath) && filePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String oldPath = Tools.getRootPath(rootPath, ThreadLocalContext.getUserContext().getUser().getTenantId()) + File.separator + filePath;
|
||||
File oldFile = new File(oldPath);
|
||||
@@ -420,7 +419,7 @@ public class DataServiceImpl implements DataService {
|
||||
@Override
|
||||
public void downloadFile(DownloadFileReq req, HttpServletResponse response) {
|
||||
if (StringUtils.isNotBlank(req.getPath()) && req.getPath().contains("..")) {
|
||||
log.error(req.getPath() + "非法文件路径!");
|
||||
log.error(req.getPath() + ILLEGAL_FILE_PATH);
|
||||
return;
|
||||
}
|
||||
File file;
|
||||
@@ -470,7 +469,7 @@ public class DataServiceImpl implements DataService {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "chunkTotal不能为空!");
|
||||
}
|
||||
if (StringUtils.isNotBlank(req.getPath()) && req.getPath().contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
MultipartFile file = req.getFile();
|
||||
String fileName = file.getOriginalFilename();
|
||||
@@ -537,11 +536,11 @@ public class DataServiceImpl implements DataService {
|
||||
public SdmResponse<List<JSONObject>> copyRoute(CopyRouteReq req) {
|
||||
String sourceFilePath = req.getSourcePath();
|
||||
if (StringUtils.isNotBlank(sourceFilePath) && sourceFilePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String targetPath = req.getTargetPath();
|
||||
if (StringUtils.isNotBlank(targetPath) && targetPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, ILLEGAL_FILE_PATH);
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getUserContext().getUser().getTenantId());
|
||||
sourceFilePath = companyRootPath + "/" + sourceFilePath;
|
||||
|
||||
@@ -57,28 +57,29 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
||||
private static final String MODEL_NAME = "modelName";
|
||||
private static final String PUSHED = "pushed";
|
||||
private static final String PROJECT_NAME = "projectName";
|
||||
private static final String MODEL_DESCRIPTION = "modelDescription";
|
||||
private static final String S_PRINCIPAL = "sPrincipal";
|
||||
private static final String PLAN_FINISH = "planFinish";
|
||||
|
||||
private final String EXCEL_SUFFIX = ".xlsx";
|
||||
private final String VND_MS_EXCEL= "application/vnd.ms-excel";
|
||||
private final String ATT_FILEN= "attachment;filename=";
|
||||
private final String CONT_DISP= "Content-Disposition";
|
||||
private final String APP_JSON= "application/json";
|
||||
private final String STATUS = "status";
|
||||
private final String FAILURE = "failure";
|
||||
private final String MESSAGE = "message";
|
||||
private final String DATA_LIST = "dataList";
|
||||
@Override
|
||||
public void exportProjectDetail(GetProjectDetailReq getProjectDetailReq, HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
String fileName = URLEncoder.encode("项目详情" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("项目详情" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = projectService.getProjectDetail(getProjectDetailReq);
|
||||
if (ObjectUtils.isEmpty(sdmResponse) || ObjectUtils.isEmpty(sdmResponse.getData())) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -179,11 +180,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "项目详情");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出【项目详情】数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出【项目详情】数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -300,8 +301,8 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
}
|
||||
}
|
||||
|
||||
if (loadCaseBean.getInteger("status") != null) {
|
||||
switch (loadCaseBean.getInteger("status")) {
|
||||
if (loadCaseBean.getInteger(STATUS) != null) {
|
||||
switch (loadCaseBean.getInteger(STATUS)) {
|
||||
case 1:
|
||||
map.put("achievement", "不合格");
|
||||
break;
|
||||
@@ -509,8 +510,8 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
}
|
||||
}
|
||||
|
||||
if (loadCaseBean.getInteger("status") != null) {
|
||||
switch (loadCaseBean.getInteger("status")) {
|
||||
if (loadCaseBean.getInteger(STATUS) != null) {
|
||||
switch (loadCaseBean.getInteger(STATUS)) {
|
||||
case 1:
|
||||
map.put("achievement", "不合格");
|
||||
break;
|
||||
@@ -719,8 +720,8 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (loadCaseBean.getInteger("status") != null) {
|
||||
switch (loadCaseBean.getInteger("status")) {
|
||||
if (loadCaseBean.getInteger(STATUS) != null) {
|
||||
switch (loadCaseBean.getInteger(STATUS)) {
|
||||
case 1:
|
||||
map.put("achievement", "不合格");
|
||||
break;
|
||||
@@ -922,8 +923,8 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (loadCaseBean.getInteger("status") != null) {
|
||||
switch (loadCaseBean.getInteger("status")) {
|
||||
if (loadCaseBean.getInteger(STATUS) != null) {
|
||||
switch (loadCaseBean.getInteger(STATUS)) {
|
||||
case 1:
|
||||
map.put("achievement", "不合格");
|
||||
break;
|
||||
@@ -1141,20 +1142,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
getInputFormTemplateListReq.setPageNum(1);
|
||||
getInputFormTemplateListReq.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
String fileName = URLEncoder.encode("输入表单" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("输入表单" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = systemService.getInputFormTemplateList(getInputFormTemplateListReq);
|
||||
String dataListStr;
|
||||
if (ObjectUtils.isEmpty(sdmResponse)
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString("dataList"))) {
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString(DATA_LIST))) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -1183,11 +1184,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "输入表单");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出【输入表单】数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出【输入表单】数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -1214,20 +1215,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
getLoadcasePerformanceReq.setPageNum(1);
|
||||
getLoadcasePerformanceReq.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
String fileName = URLEncoder.encode("性能指标" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("性能指标" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = projectService.getLoadcasePerformance(getLoadcasePerformanceReq);
|
||||
String dataListStr;
|
||||
if (ObjectUtils.isEmpty(sdmResponse)
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString("dataList"))) {
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString(DATA_LIST))) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -1288,11 +1289,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "性能指标");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出性能指标数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出性能指标数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -1324,20 +1325,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
getLoadcaseReportReq.setPageNum(1);
|
||||
getLoadcaseReportReq.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
String fileName = URLEncoder.encode("仿真报告" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("仿真报告" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = projectService.getLoadcaseReport(getLoadcaseReportReq);
|
||||
String dataListStr;
|
||||
if (ObjectUtils.isEmpty(sdmResponse)
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString("dataList"))) {
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString(DATA_LIST))) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -1371,11 +1372,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "仿真报告");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出【仿真报告】数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出【仿真报告】数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -1401,20 +1402,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
queryProductDemandListReq.setPageNum(1);
|
||||
queryProductDemandListReq.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
String fileName = URLEncoder.encode("仿真需求" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("仿真需求" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = projectService.queryProductDemandList(queryProductDemandListReq);
|
||||
String dataListStr;
|
||||
if (ObjectUtils.isEmpty(sdmResponse)
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString("dataList"))) {
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString(DATA_LIST))) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -1432,27 +1433,27 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
map.put("name", requirementJsonObj.getString("name"));
|
||||
map.put("description", requirementJsonObj.get("description"));
|
||||
map.put("dPrincipalName", requirementJsonObj.getString("dPrincipalName"));
|
||||
switch (requirementJsonObj.getInteger("status")) {
|
||||
switch (requirementJsonObj.getInteger(STATUS)) {
|
||||
case 0:
|
||||
map.put("status", "未开始");
|
||||
map.put(STATUS, "未开始");
|
||||
break;
|
||||
case 1:
|
||||
map.put("status", "进行中");
|
||||
map.put(STATUS, "进行中");
|
||||
break;
|
||||
case 2:
|
||||
map.put("status", "完成");
|
||||
map.put(STATUS, "完成");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
map.put(PLAN_FINISH, requirementJsonObj.getString(PLAN_FINISH));
|
||||
if (StringUtils.isNotBlank(requirementJsonObj.getString(S_PRINCIPAL))) {
|
||||
map.put("planFinish", requirementJsonObj.getString("planFinish"));
|
||||
if (StringUtils.isNotBlank(requirementJsonObj.getString("sPrincipal"))) {
|
||||
List<String> sPrincipalList = new ArrayList<>();
|
||||
sPrincipalJsonArray = JSON.parseArray(requirementJsonObj.getString(S_PRINCIPAL));
|
||||
sPrincipalJsonArray = JSON.parseArray(requirementJsonObj.getString("sPrincipal"));
|
||||
for (Object sPrincipalJson : sPrincipalJsonArray) {
|
||||
sPrincipalList.add(((JSONObject) sPrincipalJson).getString("userName"));
|
||||
}
|
||||
map.put(S_PRINCIPAL, String.join(",", sPrincipalList));
|
||||
map.put("sPrincipal", String.join(",", sPrincipalList));
|
||||
}
|
||||
map.put("inputFormId", null);
|
||||
result.add(map);
|
||||
@@ -1462,11 +1463,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "仿真需求");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出【仿真需求】数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出【仿真需求】数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -1481,9 +1482,9 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("需求名称")).key("name").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("需求描述")).key("description").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("设计负责人")).key("dPrincipalName").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("状态")).key("status").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("计划完成时间")).key(PLAN_FINISH).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("仿真负责人")).key(S_PRINCIPAL).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("状态")).key(STATUS).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("计划完成时间")).key("planFinish").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("仿真负责人")).key("sPrincipal").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("输入表单")).key("inputFormId").build());
|
||||
return customizeHeads;
|
||||
}
|
||||
@@ -1495,20 +1496,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
getProjectLoadcaseListReq.setPageNum(1);
|
||||
getProjectLoadcaseListReq.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
String fileName = URLEncoder.encode("数据分析" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("数据分析" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = projectService.getProjectLoadcaseList(getProjectLoadcaseListReq);
|
||||
String dataListStr;
|
||||
if (ObjectUtils.isEmpty(sdmResponse)
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString("dataList"))) {
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString(DATA_LIST))) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -1579,11 +1580,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "数据分析");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出【数据分析】数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出【数据分析】数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -1611,20 +1612,20 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
queryModelListReq.setPageNum(1);
|
||||
queryModelListReq.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
String fileName = URLEncoder.encode("一维模型库" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + ".xlsx", "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = URLEncoder.encode("一维模型库" + new SimpleDateFormat("yyyyMMdd_").format(new Date()) + UuidUtils.getUUID().substring(0, 4) + EXCEL_SUFFIX, "UTF-8");
|
||||
response.setContentType(VND_MS_EXCEL);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setHeader(CONT_DISP, ATT_FILEN + fileName);
|
||||
SdmResponse sdmResponse = modelService.queryModelList(queryModelListReq);
|
||||
String dataListStr;
|
||||
if (ObjectUtils.isEmpty(sdmResponse)
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString("dataList"))) {
|
||||
|| StringUtils.isEmpty(dataListStr = ((JSONObject) sdmResponse.getData()).getString(DATA_LIST))) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "没有数据");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "没有数据");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException e) {
|
||||
@@ -1638,12 +1639,12 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
for (Object dataJson : dataList) {
|
||||
modelJsonObj = ((JSONObject) dataJson);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(MODEL_NAME, modelJsonObj.getString(MODEL_NAME));
|
||||
map.put(PUSHED, modelJsonObj.getInteger(PUSHED) == 0 ? "未推送" : "已推送");
|
||||
map.put(PROJECT_NAME, modelJsonObj.getString(PROJECT_NAME));
|
||||
map.put("modelName", modelJsonObj.getString("modelName"));
|
||||
map.put("pushed", modelJsonObj.getInteger("pushed") == 0 ? "未推送" : "已推送");
|
||||
map.put("projectName", modelJsonObj.getString("projectName"));
|
||||
map.put("loadcaseName", modelJsonObj.getString("loadcaseName"));
|
||||
map.put("roundName", modelJsonObj.getString("roundName"));
|
||||
map.put(MODEL_DESCRIPTION, modelJsonObj.getString(MODEL_DESCRIPTION));
|
||||
map.put("modelDescription", modelJsonObj.getString("modelDescription"));
|
||||
result.add(map);
|
||||
}
|
||||
List<HeadVO> customizeHeads = buildHeadListModel();
|
||||
@@ -1651,11 +1652,11 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
ExcelUtil.excelHelperDynamicHeader(customizeHeads, result, response, "数据分析");
|
||||
} catch (IOException e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setContentType(APP_JSON);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("status", "failure");
|
||||
map.put("message", "导出【一维模型库】数据Excel失败");
|
||||
map.put(STATUS, FAILURE);
|
||||
map.put(MESSAGE, "导出【一维模型库】数据Excel失败");
|
||||
try {
|
||||
response.getWriter().println(JSON.toJSONString(map));
|
||||
} catch (IOException ioException) {
|
||||
@@ -1666,12 +1667,12 @@ public class ExportExcelServiceImpl implements ExportExcelService {
|
||||
|
||||
private List<HeadVO> buildHeadListModel() {
|
||||
List<HeadVO> customizeHeads = new ArrayList<>();
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("模型名称")).key(MODEL_NAME).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("推送状态")).key(PUSHED).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("项目名称")).key(PROJECT_NAME).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("模型名称")).key("modelName").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("推送状态")).key("pushed").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("项目名称")).key("projectName").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("分析项名称")).key("loadcaseName").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("轮次名称")).key("roundName").build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("模型描述")).key(MODEL_DESCRIPTION).build());
|
||||
customizeHeads.add(HeadVO.builder().headTitle(List.of("模型描述")).key("modelDescription").build());
|
||||
return customizeHeads;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Base64;
|
||||
|
||||
@Component
|
||||
public class EncUtil {
|
||||
private static final String PARAM = "q1w2e3r4t5y6u7i8";
|
||||
//private static final String PARAM = "q1w2e3r4t5y6u7i8";
|
||||
|
||||
/**
|
||||
* AES的加密函数
|
||||
@@ -21,7 +21,8 @@ public class EncUtil {
|
||||
public static String aesEncrypt(String str) throws Exception {
|
||||
if (str == null) return null;
|
||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(PARAM.getBytes(StandardCharsets.UTF_8), "AES"));
|
||||
String inputString = System.getenv("SECRET");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(inputString.getBytes(StandardCharsets.UTF_8), "AES"));
|
||||
byte[] bytes = cipher.doFinal(str.getBytes(StandardCharsets.UTF_8));
|
||||
Base64.Encoder encoder = Base64.getEncoder();
|
||||
return encoder.encodeToString(bytes);
|
||||
@@ -37,7 +38,8 @@ public class EncUtil {
|
||||
public static String aesDecrypt(String str) throws Exception {
|
||||
if (str == null) return null;
|
||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(PARAM.getBytes(StandardCharsets.UTF_8), "AES"));
|
||||
String inputString = System.getenv("SECRET");
|
||||
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(inputString.getBytes(StandardCharsets.UTF_8), "AES"));
|
||||
Base64.Decoder decoder = Base64.getDecoder();
|
||||
byte[] bytes = decoder.decode(str);
|
||||
bytes = cipher.doFinal(bytes);
|
||||
|
||||
Reference in New Issue
Block a user