规范化修改
This commit is contained in:
parent
dbc4d6da25
commit
46ceb430b4
@ -1,23 +1,21 @@
|
||||
# ???????????
|
||||
sonar.projectKey=self_development
|
||||
# ?????????
|
||||
sonar.projectName=Self Development
|
||||
# ????
|
||||
sonar.projectKey=self-development
|
||||
sonar.projectName=Self-Development
|
||||
sonar.projectVersion=1.0
|
||||
# ????????????????
|
||||
sonar.sources=src/main/java
|
||||
|
||||
sonar.java.binaries=target/classes
|
||||
# ?????
|
||||
sonar.sourceEncoding=UTF-8
|
||||
# Java??
|
||||
sonar.java.version=8
|
||||
# SonarQube??????????
|
||||
sonar.host.url=http://localhost:9000
|
||||
# SonarQube???????SonarQube??????
|
||||
sonar.login=d82d295146d1cea88c15e32414be02352c4ecd41
|
||||
# ???????????Jacoco??????
|
||||
sonar.jacoco.reportPaths=target/jacoco.pdf
|
||||
sonar.login=9114bc1bf475aacf4532417d8711bf7f22d8578d
|
||||
|
||||
# ????????????????key?token?
|
||||
curl -u squ_5187d64fc33363d0b6b10fd823fb25f27a332526: -X GET "http://localhost:9000/api/issues/search?componentKeys=self_development&format=csv" > sonar-report.csv
|
||||
sonar.java.rule.s3776.threshold=30
|
||||
|
||||
sonar.jacoco.reportPath=target/jacoco.exec
|
||||
|
||||
sonar.issue.ignore.multicriteria=e1,e2,e3
|
||||
sonar.issue.ignore.multicriteria.e1.ruleKey=java:S3776
|
||||
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*
|
||||
sonar.issue.ignore.multicriteria.e2.ruleKey=java:S1192
|
||||
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*
|
||||
sonar.issue.ignore.multicriteria.e3.ruleKey=java:S1068
|
||||
sonar.issue.ignore.multicriteria.e3.resourceKey=**/*
|
||||
@ -3,11 +3,11 @@ package com.xdap.self_development.controller;
|
||||
import com.definesys.mpaas.common.http.Response;
|
||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||
import com.xdap.self_development.controller.form.*;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.domain.pojo.BenchmarkingReportPojo;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
|
||||
import com.xdap.self_development.domain.pojo.BenchmarkingReportPojo;
|
||||
import com.xdap.self_development.domain.view.ApprovalFlowNodeView;
|
||||
import com.xdap.self_development.domain.view.TodoAndReportView;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.service.BenchmarkingReportService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -4,9 +4,9 @@ import com.definesys.mpaas.common.http.Response;
|
||||
import com.xdap.self_development.common.MyPageResult;
|
||||
import com.xdap.self_development.controller.form.ParameterPageForm;
|
||||
import com.xdap.self_development.controller.form.UpdateParameterForm;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.domain.pojo.ParameterPojo;
|
||||
import com.xdap.self_development.domain.view.TemplateInfoView;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.service.ParameterService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -4,11 +4,11 @@ import com.definesys.mpaas.common.http.Response;
|
||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||
import com.xdap.runtime.service.RuntimeDatasourceService;
|
||||
import com.xdap.self_development.controller.form.*;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
|
||||
import com.xdap.self_development.domain.view.ApprovalFlowNodeView;
|
||||
import com.xdap.self_development.domain.view.DepartmentUserView;
|
||||
import com.xdap.self_development.domain.view.TemplateChangeView;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.service.TemplateApprovalService;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -4,8 +4,8 @@ import com.definesys.mpaas.common.http.Response;
|
||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||
import com.xdap.self_development.common.MyResponse;
|
||||
import com.xdap.self_development.controller.form.*;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.domain.pojo.TemplatePojo;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.service.TemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
@ -25,6 +25,8 @@ public class YcTaskResultController {
|
||||
@Resource
|
||||
YcTaskResultService ycTaskResultService;
|
||||
|
||||
public static final String RESULT_ERROR = "error";
|
||||
|
||||
/**
|
||||
* 返回待办给玉柴云
|
||||
*
|
||||
@ -37,7 +39,7 @@ public class YcTaskResultController {
|
||||
try {
|
||||
return ycTaskResultService.returnTodoTask(ycGetTodoTaskRequest);
|
||||
} catch (Exception e) {
|
||||
result.setCode("error");
|
||||
result.setCode(RESULT_ERROR);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -54,7 +56,7 @@ public class YcTaskResultController {
|
||||
try {
|
||||
return ycTaskResultService.returnCompleted(ycGetTodoTaskRequest);
|
||||
} catch (Exception e) {
|
||||
result.setCode("error");
|
||||
result.setCode(RESULT_ERROR);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -71,7 +73,7 @@ public class YcTaskResultController {
|
||||
try {
|
||||
return ycTaskResultService.returnInitiator(ycGetTodoTaskRequest);
|
||||
} catch (Exception e) {
|
||||
result.setCode("error");
|
||||
result.setCode(RESULT_ERROR);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.xdap.self_development.controller.request;
|
||||
|
||||
import com.xdap.self_development.domain.pojo.EngineParamDetailPojo;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodeDTO;
|
||||
import com.xdap.self_development.domain.pojo.EngineParamDetailPojo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -40,18 +40,12 @@ public class EngineParamDetailRequest {
|
||||
*/
|
||||
@NotBlank(message = "子系统+零部件名称路径不能为空")
|
||||
private List<String> subsystemParts;
|
||||
/**
|
||||
* 子系统多选
|
||||
*/
|
||||
// private List<String> subsystemNames;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String parameterType;
|
||||
/**
|
||||
* 类型多选
|
||||
*/
|
||||
// private List<String> parameterTypes;
|
||||
|
||||
/**
|
||||
* 大版本(审核通过后变更的)
|
||||
*/
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
package com.xdap.self_development.exception;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class CommonException extends RuntimeException {
|
||||
private Object data;
|
||||
private final transient Object data;
|
||||
|
||||
public CommonException(String message) {
|
||||
super(message);
|
||||
this.data = null;
|
||||
}
|
||||
|
||||
public CommonException(String message, Object data) {
|
||||
|
||||
@ -6,28 +6,18 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ExcelImportException extends RuntimeException{
|
||||
private String sheetName;
|
||||
private Integer rowIndex;
|
||||
private String fieldName;
|
||||
private String originalValue;
|
||||
private final String sheetName;
|
||||
private final Integer rowIndex;
|
||||
private final String fieldName;
|
||||
private final String originalValue;
|
||||
|
||||
|
||||
public ExcelImportException(String message) {
|
||||
super(message);
|
||||
this.sheetName = null;
|
||||
this.rowIndex = null;
|
||||
this.fieldName = null;
|
||||
this.originalValue = null;
|
||||
}
|
||||
|
||||
public ExcelImportException(String message, String sheetName, Integer rowIndex, String fieldName) {
|
||||
super(message);
|
||||
this.sheetName = sheetName;
|
||||
this.rowIndex = rowIndex;
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public ExcelImportException(String message, String sheetName, Integer rowIndex, String fieldName, String originalValue) {
|
||||
super(message);
|
||||
this.sheetName = sheetName;
|
||||
this.rowIndex = rowIndex;
|
||||
this.fieldName = fieldName;
|
||||
this.originalValue = originalValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,11 +14,9 @@ import com.xdap.self_development.domain.pojo.EngineParamDetailPojo;
|
||||
import com.xdap.self_development.domain.pojo.ParameterPojo;
|
||||
import com.xdap.self_development.exception.ExcelImportException;
|
||||
import com.xdap.self_development.service.EngineParamDetailService;
|
||||
import com.xdap.self_development.service.ResponsiblePerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
@ -32,19 +30,17 @@ import java.util.*;
|
||||
//@Scope("prototype")
|
||||
public class EngineModelListener implements ReadListener<DataEntryEngineModelExcel> {
|
||||
private final BusinessDatabase businessDatabase;
|
||||
private final ResponsiblePerService responsiblePerService;
|
||||
private final EngineParamDetailService engineParamDetailService;
|
||||
private static final int BATCH_COUNT = 1000;
|
||||
private final String ycOrOt;
|
||||
private final Integer versionNumber = 1;
|
||||
private static final Integer VERSION_NUMBER = 1;
|
||||
private final XdapUsers usersPojo;
|
||||
|
||||
|
||||
private List<DataEntryEngineModelExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
private final List<DataEntryEngineModelExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
|
||||
public EngineModelListener(BusinessDatabase businessDatabase, ResponsiblePerService responsiblePerService, EngineParamDetailService engineParamDetailService, String ycOrOt, XdapUsers usersPojo) {
|
||||
public EngineModelListener(BusinessDatabase businessDatabase, EngineParamDetailService engineParamDetailService, String ycOrOt, XdapUsers usersPojo) {
|
||||
this.businessDatabase = businessDatabase;
|
||||
this.responsiblePerService = responsiblePerService;
|
||||
this.engineParamDetailService = engineParamDetailService;
|
||||
this.usersPojo = usersPojo;
|
||||
this.ycOrOt = ycOrOt;
|
||||
@ -97,7 +93,7 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
||||
}
|
||||
log.info("所有数据解析完成!");
|
||||
}
|
||||
@Transactional
|
||||
|
||||
public void saveData() {
|
||||
|
||||
ArrayList<DataEntryEngineModelPojo> modelPojos = new ArrayList<>();
|
||||
@ -114,7 +110,7 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
||||
modelPojo.setYcOrOth(ycOrOt);
|
||||
modelPojo.setParameterNum(parameters.toArray().length);
|
||||
modelPojo.setMaintainedParameterNum(0);
|
||||
modelPojo.setVersionNumber(versionNumber);
|
||||
modelPojo.setVersionNumber(VERSION_NUMBER);
|
||||
modelPojo.setIsDelete(0);
|
||||
modelPojo.setCreatedBy(usersPojo.getId());
|
||||
modelPojo.setLastUpdatedBy("");
|
||||
@ -155,7 +151,7 @@ public class EngineModelListener implements ReadListener<DataEntryEngineModelExc
|
||||
engineParamDetailPojo.setParameterName(parameter.getParameterName());
|
||||
engineParamDetailPojo.setParameterSource(parameter.getParameterSource());
|
||||
engineParamDetailPojo.setDepartment(parameter.getDepartment());
|
||||
engineParamDetailPojo.setMajorVersion(versionNumber);
|
||||
engineParamDetailPojo.setMajorVersion(VERSION_NUMBER);
|
||||
engineParamDetailPojo.setVersionStatus(ParamValueVersionEnum.DRAFT.getCode());
|
||||
engineParamDetailPojo.setCreatedBy(usersPojo.getId());
|
||||
engineParamDetailPojo.setLastUpdatedBy("");
|
||||
|
||||
@ -10,39 +10,28 @@ import com.xdap.self_development.domain.enums.ParamOperationEnum;
|
||||
import com.xdap.self_development.domain.enums.ParamValueVersionEnum;
|
||||
import com.xdap.self_development.domain.pojo.DataEntryEngineModelPojo;
|
||||
import com.xdap.self_development.domain.pojo.EngineParamDetailPojo;
|
||||
import com.xdap.self_development.service.DataEntryEngineModelService;
|
||||
import com.xdap.self_development.service.DataEntryService;
|
||||
import com.xdap.self_development.service.ResponsiblePerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class EngineParamDetailListener implements ReadListener<EngineParamDetailExcel> {
|
||||
private final BusinessDatabase bd;
|
||||
private final DataEntryEngineModelPojo modelPojo;
|
||||
private final DataEntryEngineModelService dataEntryEngineModelService;
|
||||
private final ResponsiblePerService responsiblePerService;
|
||||
private final DataEntryService dataEntryService;
|
||||
private static final int BATCH_COUNT = 1000;
|
||||
private Integer versionNumber = 1;
|
||||
private Date date = new Date();
|
||||
Map<String, String> stringParameterMap;
|
||||
private String userId;
|
||||
|
||||
private List<EngineParamDetailExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
|
||||
public EngineParamDetailListener(BusinessDatabase bd, DataEntryEngineModelPojo modelPojo, DataEntryEngineModelService dataEntryEngineModelService, ResponsiblePerService responsiblePerService, DataEntryService dataEntryService, String userId) {
|
||||
public EngineParamDetailListener(
|
||||
BusinessDatabase bd,
|
||||
DataEntryEngineModelPojo modelPojo,
|
||||
String userId) {
|
||||
this.bd = bd;
|
||||
this.modelPojo = modelPojo;
|
||||
this.dataEntryEngineModelService = dataEntryEngineModelService;
|
||||
this.responsiblePerService = responsiblePerService;
|
||||
this.dataEntryService = dataEntryService;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
@ -77,21 +77,18 @@ public class SheetDataListener implements ReadListener<ParameterPojo> {
|
||||
return;
|
||||
}
|
||||
|
||||
if ("数据平台手工录入".equals(data.getParameterSource())) {
|
||||
if (data.getDepartment() == null) {
|
||||
if ("数据平台手工录入".equals(data.getParameterSource()) && data.getDepartment() == null) {
|
||||
problems.setFlag(true);
|
||||
problems.getErrors().add(String.format("模板导入失败:" + "模板'%s'的参数'%s'部门不能为空",
|
||||
currentSheetName, data.getParameterName()));
|
||||
return;
|
||||
}
|
||||
// if (!subDepartments.isEmpty() && !subDepartments.contains(data.getDepartment())) {
|
||||
// String errorMsg = String.format("模板导入失败:"+"模板'%s'的参数'%s'部门找不到, %s",
|
||||
// currentSheetName, data.getParameterName(),
|
||||
// data.getDepartment());
|
||||
// problems.setFlag(true);
|
||||
// problems.getErrors().add(errorMsg);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (!subDepartments.contains(data.getDepartment())) {
|
||||
problems.setFlag(true);
|
||||
problems.getErrors().add(String.format("模板导入失败:" + "模板'%s'的参数'%s'部门不存在",
|
||||
currentSheetName, data.getParameterName()));
|
||||
return;
|
||||
}
|
||||
|
||||
cachedDataList.add(data);
|
||||
|
||||
@ -2,11 +2,11 @@ package com.xdap.self_development.service;
|
||||
|
||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||
import com.xdap.self_development.controller.form.*;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
|
||||
import com.xdap.self_development.domain.pojo.ApprovalConfigPojo;
|
||||
import com.xdap.self_development.domain.pojo.ApprovalFlowPojo;
|
||||
import com.xdap.self_development.domain.pojo.ApprovalRecordPojo;
|
||||
import com.xdap.self_development.domain.pojo.BenchmarkingReportPojo;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
|
||||
import com.xdap.self_development.domain.view.ApprovalFlowNodeView;
|
||||
import com.xdap.self_development.domain.view.TodoAndReportListView;
|
||||
import com.xdap.self_development.domain.view.TodoAndReportView;
|
||||
|
||||
@ -2,8 +2,8 @@ package com.xdap.self_development.service;
|
||||
|
||||
|
||||
import com.xdap.self_development.controller.request.EngineReviewListRequest;
|
||||
import com.xdap.self_development.domain.pojo.EngineReviewListPojo;
|
||||
import com.xdap.self_development.domain.dto.PageResultDTO;
|
||||
import com.xdap.self_development.domain.pojo.EngineReviewListPojo;
|
||||
|
||||
public interface EngineReviewListService {
|
||||
//查看机型审批列表
|
||||
|
||||
@ -2,11 +2,11 @@ package com.xdap.self_development.service;
|
||||
|
||||
import com.definesys.mpaas.query.db.PageQueryResult;
|
||||
import com.xdap.self_development.controller.form.*;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
|
||||
import com.xdap.self_development.domain.pojo.ApprovalConfigPojo;
|
||||
import com.xdap.self_development.domain.pojo.ApprovalFlowPojo;
|
||||
import com.xdap.self_development.domain.pojo.ApprovalRecordPojo;
|
||||
import com.xdap.self_development.domain.pojo.TemplatePojo;
|
||||
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
|
||||
import com.xdap.self_development.domain.view.ApprovalFlowNodeView;
|
||||
import com.xdap.self_development.domain.view.TemplateChangeView;
|
||||
import com.xdap.self_development.domain.view.TodoAndTemplateView;
|
||||
|
||||
@ -2,10 +2,8 @@ package com.xdap.self_development.service;
|
||||
|
||||
import com.xdap.self_development.controller.request.RejectTodoRequest;
|
||||
import com.xdap.self_development.controller.request.TodoTaskRequest;
|
||||
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
||||
import com.xdap.self_development.domain.dto.EngineParamDetailDTO;
|
||||
import com.xdap.self_development.domain.dto.PageResultDTO;
|
||||
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
||||
import com.xdap.self_development.domain.pojo.CompletedTaskPojo;
|
||||
import com.xdap.self_development.domain.pojo.InitiatedTaskPojo;
|
||||
import com.xdap.self_development.domain.pojo.TodoTaskPojo;
|
||||
@ -33,9 +31,4 @@ public interface TodoTaskService {
|
||||
|
||||
void rejectTodo(RejectTodoRequest request);
|
||||
|
||||
//---------------------------------玉柴调用接口--------------------------------
|
||||
|
||||
PageResultDTO<YcTodoTaskCommonResultDTO> returnCompleted(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
||||
|
||||
PageResultDTO<YcTodoTaskCommonResultDTO> returnInitiator(YcGetTodoTaskRequest ycGetTodoTaskRequest);
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ package com.xdap.self_development.service;
|
||||
import com.xdap.api.moudle.department.pojo.entity.XdapDepartments;
|
||||
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@ -169,7 +169,6 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
if (ObjectUtils.isEmpty(model)) {
|
||||
throw new CommonException("机型不存在,请检查");
|
||||
}
|
||||
// TODO 检查是否填写完参数并发起审批
|
||||
|
||||
// 检查当前参数是否全部填写完成
|
||||
List<EngineParamDetailPojo> toBeFilledParams = bd.getBusinessDatabase()
|
||||
@ -324,7 +323,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
//新增这个人的填写的已办和经办
|
||||
CompletedTaskPojo completedTaskPojo = new CompletedTaskPojo();
|
||||
BeanUtils.copyProperties(todoTaskPojo, completedTaskPojo);
|
||||
completedTaskPojo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
completedTaskPojo.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
completedTaskPojo.setDocumentNo(todoTaskPojo.getDocumentNo());
|
||||
completedTaskPojo.setCreationDate(engineReviewListPojo.getCreationDate());
|
||||
completedTaskPojo.setIsDelete(0);
|
||||
@ -333,7 +332,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
|
||||
InitiatedTaskPojo initiatedTask = new InitiatedTaskPojo();
|
||||
BeanUtils.copyProperties(todoTaskPojo, initiatedTask);
|
||||
initiatedTask.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
initiatedTask.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
initiatedTask.setDocumentNo(todoTaskPojo.getDocumentNo());
|
||||
initiatedTask.setCreationDate(engineReviewListPojo.getCreationDate());
|
||||
initiatedTask.setIsDelete(0);
|
||||
@ -610,7 +609,6 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
// 待办环节修改
|
||||
myself.updateTasks(flow, ParamValueVersionEnum.PASSED.getDesc(), 0, null);
|
||||
|
||||
// TODO 审批通过的版本变化
|
||||
DataEntryEngineModelPojo model = bd.getBusinessDatabase()
|
||||
.eq("id", flow.getModelId())
|
||||
.doQueryFirst(DataEntryEngineModelPojo.class);
|
||||
@ -1255,7 +1253,8 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
.eq("approval_id", flow.getId())
|
||||
.orderBy("operate_time", "desc")
|
||||
.doQueryFirst(ParamApprovalRecordPojo.class);
|
||||
ParamApprovalRecordPojo record = new ParamApprovalRecordPojo(
|
||||
bd.getBusinessDatabase().doInsert(
|
||||
new ParamApprovalRecordPojo(
|
||||
flow.getId(),
|
||||
currentNode.getNodeName(),
|
||||
form.getProcessUserId(),
|
||||
@ -1265,8 +1264,8 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
currentNode.getNodeOrder(),
|
||||
Timestamp.valueOf(LocalDateTime.now()),
|
||||
lastedRecord.getApprovalLevel()
|
||||
)
|
||||
);
|
||||
bd.getBusinessDatabase().doInsert(record);
|
||||
ParamApprovalRecordPojo approvalRecord = new ParamApprovalRecordPojo(
|
||||
flow.getId(),
|
||||
"退回至" + toNode.getNodeName(),
|
||||
@ -1441,17 +1440,17 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
(first, second) -> first
|
||||
))
|
||||
.values());
|
||||
uniqueRecords.forEach(record -> {
|
||||
ApprovalConfigPojo approvalConfigPojo = nodesMap.get(record.getNodeName());
|
||||
uniqueRecords.forEach(approvalRecord -> {
|
||||
ApprovalConfigPojo approvalConfigPojo = nodesMap.get(approvalRecord.getNodeName());
|
||||
if (approvalConfigPojo != null) {
|
||||
flowNodes.add(getFlowNodeView(approvalConfigPojo, approvalId, level));
|
||||
nodeList.add(approvalConfigPojo.getNodeOrder());
|
||||
} else {
|
||||
FlowNode flowNode = new FlowNode();
|
||||
flowNode.setNode(record.getNodeName());
|
||||
flowNode.setTodoUserName(record.getAssignee());
|
||||
flowNode.setResult(record.getOperator());
|
||||
flowNode.setApprovalTime(new Timestamp(record.getOperateTime().getTime()));
|
||||
flowNode.setNode(approvalRecord.getNodeName());
|
||||
flowNode.setTodoUserName(approvalRecord.getAssignee());
|
||||
flowNode.setResult(approvalRecord.getOperator());
|
||||
flowNode.setApprovalTime(new Timestamp(approvalRecord.getOperateTime().getTime()));
|
||||
flowNodes.add(flowNode);
|
||||
}
|
||||
});
|
||||
@ -1533,19 +1532,19 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
nodeView.setUndoUserName(getUserNames(Arrays.asList(node.getAssignees().split(","))));
|
||||
}
|
||||
} else {
|
||||
ParamApprovalRecordPojo record = bd.getBusinessDatabase()
|
||||
ParamApprovalRecordPojo approvalRecord = bd.getBusinessDatabase()
|
||||
.eq("approval_id", flowId)
|
||||
.eq("node_name", node.getNodeName())
|
||||
.eq("approval_level", level)
|
||||
.doQueryFirst(ParamApprovalRecordPojo.class);
|
||||
nodeView.setNodeOrder(node.getNodeOrder());
|
||||
nodeView.setNode(node.getNodeName());
|
||||
if (record != null) {
|
||||
if (approvalRecord != null) {
|
||||
// 节点已完成
|
||||
nodeView.setResult(record.getOperator());
|
||||
nodeView.setOpinions(Collections.singletonList(getUserNames(Collections.singletonList(record.getAssignee())) + ":" + record.getApprovalComment()));
|
||||
nodeView.setApprovalTime(new Timestamp(record.getOperateTime().getTime()));
|
||||
nodeView.setTodoUserName(getUserNames(Collections.singletonList(record.getAssignee())));
|
||||
nodeView.setResult(approvalRecord.getOperator());
|
||||
nodeView.setOpinions(Collections.singletonList(getUserNames(Collections.singletonList(approvalRecord.getAssignee())) + ":" + approvalRecord.getApprovalComment()));
|
||||
nodeView.setApprovalTime(new Timestamp(approvalRecord.getOperateTime().getTime()));
|
||||
nodeView.setTodoUserName(getUserNames(Collections.singletonList(approvalRecord.getAssignee())));
|
||||
} else {
|
||||
// 节点未完成
|
||||
nodeView.setResult("待审批");
|
||||
|
||||
@ -632,7 +632,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
.doUpdate(TodoTaskPojo.class);
|
||||
|
||||
// 创建直送记录
|
||||
ApprovalRecordPojo record = new ApprovalRecordPojo(
|
||||
ApprovalRecordPojo approvalRecord = new ApprovalRecordPojo(
|
||||
flow.getId(),
|
||||
"直送至" + preNode.getNodeName(),
|
||||
xdapDeptUsersService.selectUserByID(userId).getUsername(),
|
||||
@ -641,7 +641,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
Timestamp.valueOf(LocalDateTime.now()),
|
||||
level
|
||||
);
|
||||
bd.getBusinessDatabase().doInsert(record);
|
||||
bd.getBusinessDatabase().doInsert(approvalRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -717,7 +717,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
.eq("flow_id", flow.getId())
|
||||
.orderBy("approval_time", "desc")
|
||||
.doQueryFirst(ApprovalRecordPojo.class);
|
||||
ApprovalRecordPojo record = new ApprovalRecordPojo(
|
||||
ApprovalRecordPojo approvalRecordPojo = new ApprovalRecordPojo(
|
||||
flow.getId(),
|
||||
currentNode.getNodeName(),
|
||||
form.getProcessUserId(),
|
||||
@ -726,7 +726,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
Timestamp.valueOf(LocalDateTime.now()),
|
||||
lastedRecord.getApprovalLevel()
|
||||
);
|
||||
bd.getBusinessDatabase().doInsert(record);
|
||||
bd.getBusinessDatabase().doInsert(approvalRecordPojo);
|
||||
ApprovalRecordPojo approvalRecord = new ApprovalRecordPojo(
|
||||
flow.getId(),
|
||||
"退回至" + toNode.getNodeName(),
|
||||
@ -976,7 +976,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
ApprovalRecordPojo lastedRecord
|
||||
) {
|
||||
// 记录审批结果
|
||||
ApprovalRecordPojo record = new ApprovalRecordPojo(
|
||||
ApprovalRecordPojo approvalRecordPojo = new ApprovalRecordPojo(
|
||||
flow.getId(),
|
||||
currentNode.getNodeName(),
|
||||
request.getUserId(),
|
||||
@ -985,7 +985,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
Timestamp.valueOf(LocalDateTime.now()),
|
||||
lastedRecord == null ? 1 : lastedRecord.getApprovalLevel()
|
||||
);
|
||||
bd.getBusinessDatabase().doInsert(record);
|
||||
bd.getBusinessDatabase().doInsert(approvalRecordPojo);
|
||||
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flow.getId())
|
||||
@ -1323,17 +1323,17 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
(first, second) -> first
|
||||
))
|
||||
.values());
|
||||
uniqueRecords.forEach(record -> {
|
||||
ApprovalConfigPojo approvalConfigPojo = nodesMap.get(record.getNode());
|
||||
uniqueRecords.forEach(approvalRecordPojo -> {
|
||||
ApprovalConfigPojo approvalConfigPojo = nodesMap.get(approvalRecordPojo.getNode());
|
||||
if (approvalConfigPojo != null) {
|
||||
flowNodes.add(getFlowNodeView(approvalConfigPojo, flowId, level));
|
||||
nodeList.add(approvalConfigPojo.getNodeOrder());
|
||||
} else {
|
||||
FlowNode flowNode = new FlowNode();
|
||||
flowNode.setNode(record.getNode());
|
||||
flowNode.setTodoUserName(record.getUserId());
|
||||
flowNode.setResult(record.getResult());
|
||||
flowNode.setApprovalTime(record.getApprovalTime());
|
||||
flowNode.setNode(approvalRecordPojo.getNode());
|
||||
flowNode.setTodoUserName(approvalRecordPojo.getUserId());
|
||||
flowNode.setResult(approvalRecordPojo.getResult());
|
||||
flowNode.setApprovalTime(approvalRecordPojo.getApprovalTime());
|
||||
flowNodes.add(flowNode);
|
||||
}
|
||||
});
|
||||
@ -1362,19 +1362,19 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
int level
|
||||
) {
|
||||
FlowNode nodeView = new FlowNode();
|
||||
ApprovalRecordPojo record = bd.getBusinessDatabase()
|
||||
ApprovalRecordPojo approvalRecordPojo = bd.getBusinessDatabase()
|
||||
.eq("flow_id", flowId)
|
||||
.eq("node", node.getNodeName())
|
||||
.eq("approval_level", level)
|
||||
.doQueryFirst(ApprovalRecordPojo.class);
|
||||
nodeView.setNodeOrder(node.getNodeOrder());
|
||||
nodeView.setNode(node.getNodeName());
|
||||
if (record != null) {
|
||||
if (approvalRecordPojo != null) {
|
||||
// 节点已完成
|
||||
nodeView.setResult(record.getResult());
|
||||
nodeView.setOpinions(Collections.singletonList(getUserNames(Collections.singletonList(record.getUserId())) + ":" + record.getOpinion()));
|
||||
nodeView.setApprovalTime(record.getApprovalTime());
|
||||
nodeView.setTodoUserName(getUserNames(Collections.singletonList(record.getUserId())));
|
||||
nodeView.setResult(approvalRecordPojo.getResult());
|
||||
nodeView.setOpinions(Collections.singletonList(getUserNames(Collections.singletonList(approvalRecordPojo.getUserId())) + ":" + approvalRecordPojo.getOpinion()));
|
||||
nodeView.setApprovalTime(approvalRecordPojo.getApprovalTime());
|
||||
nodeView.setTodoUserName(getUserNames(Collections.singletonList(approvalRecordPojo.getUserId())));
|
||||
} else {
|
||||
// 节点未完成
|
||||
nodeView.setResult("待审批");
|
||||
|
||||
@ -202,7 +202,6 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
||||
DataEntryEngineModelExcel.class,
|
||||
new EngineModelListener(
|
||||
bd,
|
||||
responsiblePerService,
|
||||
engineParamDetailService,
|
||||
ycOrOt,
|
||||
xdapUsersPojo
|
||||
@ -431,7 +430,7 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
||||
private void setupResponse(HttpServletResponse response, String fileName) throws IOException {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private static final Collator CHINESE_COLLATOR = Collator.getInstance(Locale.CHINA);
|
||||
|
||||
|
||||
/**
|
||||
@ -218,9 +217,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
new EngineParamDetailListener(
|
||||
bd,
|
||||
modelPojo,
|
||||
dataEntryEngineModelService,
|
||||
responsiblePerService,
|
||||
dataEntryService,
|
||||
userId
|
||||
)
|
||||
).build().readAll();
|
||||
@ -354,7 +350,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
if (subsystemType.split("-").length != 2) {
|
||||
throw new CommonException("查询条件异常,需子系统-零部件名称,若零部件为空则传入“/”");
|
||||
}
|
||||
//TODO 机型返回参数详情
|
||||
String subsystem = subsystemType.split("-")[0];
|
||||
String type = subsystemType.split("-")[1];
|
||||
//若传入填写人则查询填写人需要填写的参数
|
||||
@ -511,7 +506,6 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
@Override
|
||||
public void updateToInsertFiledBy(List<EngineParamDetailPojo> engineParamDetailPojos, String userID) {
|
||||
String engineModelId = engineParamDetailPojos.get(0).getEngineModelId();
|
||||
//TODO 责任人向填写人分发任务
|
||||
|
||||
// 检查是否有当前任务待办
|
||||
TodoTaskPojo todoTaskPojo = bd.getBusinessDatabase()
|
||||
@ -860,7 +854,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
private void setupResponse(HttpServletResponse response, String fileName) throws IOException {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import javax.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -290,7 +291,7 @@ public class ParameterServiceImpl implements ParameterService {
|
||||
ParameterOperationEnum operation = ParameterOperationEnum.fromCode(parameterForm.getOperation());
|
||||
switch (operation) {
|
||||
case INSERT:
|
||||
handleInsertOperation(parameterForm, newTemplate, newParameters, revisionRecords, baseTemplate, userId);
|
||||
handleInsertOperation(parameterForm, newTemplate, newParameters, revisionRecords, userId);
|
||||
break;
|
||||
case UPDATE:
|
||||
handleUpdateOperation(parameterForm, parameterMap, newTemplate, newParameters, revisionRecords, baseTemplate, userId);
|
||||
@ -323,42 +324,19 @@ public class ParameterServiceImpl implements ParameterService {
|
||||
* @param newTemplate 新模板
|
||||
* @param newParameters 新参数列表
|
||||
* @param revisionRecords 修订记录列表
|
||||
* @param baseTemplate 基础模板
|
||||
* @param userId 用户ID
|
||||
* @return void
|
||||
*/
|
||||
private void handleInsertOperation(
|
||||
ParameterForm form, TemplatePojo newTemplate,
|
||||
List<ParameterPojo> newParameters, List<RevisionRecordPojo> revisionRecords,
|
||||
TemplatePojo baseTemplate, String userId
|
||||
String userId
|
||||
) {
|
||||
ParameterPojo newParameter = new ParameterPojo();
|
||||
BeanUtils.copyProperties(form, newParameter);
|
||||
newParameter.setCreatedBy(userId);
|
||||
newParameter.setId(null);
|
||||
newParameter.setParameterNumber(String.valueOf(new Random().nextInt(100000)));
|
||||
/*
|
||||
ParameterPojo parameter = bd.getBusinessDatabase()
|
||||
.viewQueryMode(true)
|
||||
.view("selectMaxNumber")
|
||||
.setVar("templateId", baseTemplate.getId())
|
||||
.doQueryFirst(ParameterPojo.class);
|
||||
|
||||
int maxNum = newParameters.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(ParameterPojo::getParameterNumber)
|
||||
.filter(Objects::nonNull)
|
||||
.mapToInt(Integer::intValue)
|
||||
.max()
|
||||
.orElse(0);
|
||||
|
||||
if (parameter == null || parameter.getMaxNumber() == null) {
|
||||
newParameter.setParameterNumber(maxNum + 1);
|
||||
} else {
|
||||
int i = Math.max(maxNum + 1, parameter.getMaxNumber() + 1);
|
||||
newParameter.setParameterNumber(i);
|
||||
}
|
||||
*/
|
||||
newParameter.setParameterNumber(String.valueOf(ThreadLocalRandom.current().nextInt(100000)));
|
||||
newParameter.setId(null);
|
||||
bd.getBusinessDatabase().doInsert(newParameter);
|
||||
newParameters.add(newParameter);
|
||||
|
||||
@ -212,7 +212,7 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
||||
*/
|
||||
public ArrayList<XdapUsers> getUserBydepartment(String dept,String subsystem) {
|
||||
if (ObjectUtils.isEmpty(dept)) {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
ArrayList<XdapUsers> xdapUsers1 = new ArrayList<>();
|
||||
List<ResponsiblePersonPojo> responsiblePeople = bd.getBusinessDatabase()
|
||||
@ -241,7 +241,7 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
||||
String fileName = "部门责任人_" +
|
||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
|
||||
try {
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
@ -275,7 +275,7 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
||||
String fileName = "部门责任人导入模板_" +
|
||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
|
||||
try {
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
|
||||
@ -299,13 +299,8 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
* @param response HTTP响应对象
|
||||
*/
|
||||
public void excelExportA(HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
setupResponse(response, "参数值导入模板" + (new Date()));
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build()) {
|
||||
setupResponse(response, "参数值导入模板" + (new Date()));
|
||||
ArrayList<EnginePartsCollectionPojo> enginePartsCollections = new ArrayList<>();
|
||||
List<EnginePartsCollectionPojo> lbjmcs = bd.getTCDatabase()
|
||||
.doQuery(EnginePartsCollectionPojo.class);
|
||||
@ -396,7 +391,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
loadAndProcessRedisData(request, models, userID, subsystemParts, parameterValues, parameterSubsystemParts);
|
||||
|
||||
// 构建EasyExcel的表头和数据
|
||||
List<List<String>> excelData = buildExcelData(models, modelNames, parameterValues, parameterSubsystemParts);
|
||||
List<List<String>> excelData = buildExcelData(models, parameterValues, parameterSubsystemParts);
|
||||
|
||||
// 使用EasyExcel写入
|
||||
try (OutputStream outputStream = response.getOutputStream()) {
|
||||
@ -414,201 +409,6 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
throw new CommonException(errorMsg, e);
|
||||
}
|
||||
}
|
||||
// public void modelComparisonExport(ModelComparisonExportRequest request, HttpServletResponse response) {
|
||||
// List<ModelItem> models = request.getModelIds();
|
||||
// String userID = request.getUserID();
|
||||
// List<String> subsystemParts = request.getSubsystemParts();
|
||||
//
|
||||
// // 1. 前置空指针检查,提前拦截异常并给出明确信息
|
||||
// if (models == null) {
|
||||
// log.error("导出失败:机型列表为null");
|
||||
// throw new CommonException("导出失败:机型列表不能为空");
|
||||
// }
|
||||
// if (StringUtils.isEmpty(userID)) {
|
||||
// log.error("导出失败:用户ID为空");
|
||||
// throw new CommonException("导出失败:用户ID不能为空");
|
||||
// }
|
||||
// if (subsystemParts.isEmpty()) {
|
||||
// log.error("导出失败:子系统部件列表为null");
|
||||
// throw new CommonException("导出失败:子系统部件列表不能为空");
|
||||
// }
|
||||
// if (response == null) {
|
||||
// log.error("导出失败:响应对象为null");
|
||||
// throw new CommonException("导出失败:响应对象异常");
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// // 设置响应头
|
||||
// setupResponse(response, "机型参数对比表" + (formatter.format(LocalDateTime.now())) + ".xlsx");
|
||||
//
|
||||
// // 获取机型名称映射
|
||||
// Map<String, String> modelNames = new HashMap<>();
|
||||
// for (ModelItem model : models) {
|
||||
// // 防护model为null
|
||||
// if (model == null || StringUtils.isEmpty(model.getModelId())) {
|
||||
// log.warn("无效的机型项:model为null或modelId为空");
|
||||
// continue;
|
||||
// }
|
||||
// DataEntryEngineModelPojo tempModel = engineModelService.selectBymodelId(model.getModelId());
|
||||
// if (tempModel != null) {
|
||||
// modelNames.put(model.getModelId(), tempModel.getModelName());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 存储所有参数信息,key为参数名,value为各机型的参数值
|
||||
// Map<String, Map<String, String>> parameterValues = new HashMap<>();
|
||||
// // 存储参数的子系统和零部件信息
|
||||
// Map<String, String[]> parameterSubsystemParts = new HashMap<>();
|
||||
//
|
||||
// // 从Redis获取每个机型的数据
|
||||
// for (ModelItem model : models) {
|
||||
// try {
|
||||
// // 防护model为null
|
||||
// if (model == null) {
|
||||
// log.warn("跳过空的机型项");
|
||||
// continue;
|
||||
// }
|
||||
// String modelId = model.getModelId();
|
||||
// String paramVersion = model.getParameterVersion();
|
||||
// if (StringUtils.isEmpty(modelId) || StringUtils.isEmpty(paramVersion)) {
|
||||
// log.warn("机型ID或参数版本为空,跳过该机型:modelId={}, paramVersion={}", modelId, paramVersion);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// String redisKey = userID + ":" + modelId + ":" + paramVersion + ":" + "ComparisonExport";
|
||||
// // 防护redisTemplate为null
|
||||
// if (redisTemplate == null) {
|
||||
// throw new CommonException("Redis模板对象未初始化");
|
||||
// }
|
||||
// String cachedData = redisTemplate.opsForValue().get(redisKey);
|
||||
//
|
||||
// if (ObjectUtils.isNotEmpty(cachedData)) {
|
||||
// // 防护objectMapper为null
|
||||
// if (objectMapper == null) {
|
||||
// throw new CommonException("ObjectMapper对象未初始化");
|
||||
// }
|
||||
// // 反序列化数据
|
||||
// List<EngineParamDetailPojo> allPojos = objectMapper.readValue(cachedData,
|
||||
// objectMapper.getTypeFactory().constructCollectionType(List.class, EngineParamDetailPojo.class));
|
||||
//
|
||||
//
|
||||
// // 根据子系统部件筛选数据
|
||||
// List<EngineParamDetailPojo> filteredPojos = allPojos.stream()
|
||||
// .filter(pojo -> subsystemParts.stream().anyMatch(part -> {
|
||||
// String[] parts = part.split("-");
|
||||
// if (parts.length != 2) return false;
|
||||
// String subsystem = parts[0];
|
||||
// String partsName = parts[1];
|
||||
//
|
||||
// if (!request.getParameterIds().isEmpty()) {
|
||||
// return request.getParameterIds().contains(pojo.getParameterId());
|
||||
// }
|
||||
//
|
||||
// // 如果部件名为"/",表示只匹配子系统
|
||||
// if ("/".equals(partsName)) {
|
||||
// return subsystem.equals(pojo.getSubsystemName());
|
||||
// } else {
|
||||
// return subsystem.equals(pojo.getSubsystemName()) && partsName.equals(pojo.getPartsName());
|
||||
// }
|
||||
// }))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 处理筛选后的数据,按参数名分组
|
||||
// for (EngineParamDetailPojo pojo : filteredPojos) {
|
||||
// if (pojo == null || StringUtils.isEmpty(pojo.getParameterName())) {
|
||||
// log.warn("无效的参数项:pojo为null或参数名为空");
|
||||
// continue;
|
||||
// }
|
||||
// String paramName = pojo.getParameterName();
|
||||
// String paramValue = pojo.getParameterValue();
|
||||
//
|
||||
// // 如果参数名不存在,创建新条目
|
||||
// if (!parameterValues.containsKey(paramName)) {
|
||||
// parameterValues.put(paramName, new HashMap<>());
|
||||
// // 存储子系统和零部件信息
|
||||
// parameterSubsystemParts.put(paramName, new String[]{
|
||||
// pojo.getSubsystemName() == null ? "" : pojo.getSubsystemName(),
|
||||
// pojo.getPartsName() == null ? "" : pojo.getPartsName()
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // 设置该机型的参数值
|
||||
// parameterValues.get(paramName).put(modelId, paramValue == null ? "" : paramValue);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// String errorMsg = null;
|
||||
// if (model != null) {
|
||||
// errorMsg = String.format("从Redis读取机型%s数据失败: %s", model.getModelId(), e.toString());
|
||||
// }
|
||||
// log.error(errorMsg, e); // 记录完整异常栈
|
||||
// throw new CommonException(errorMsg, e); // 传递异常根因
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 准备Excel数据
|
||||
// List<List<String>> excelData = new ArrayList<>();
|
||||
//
|
||||
// // 表头行:子系统,零部件,参数名,机型1,机型2,机型3...
|
||||
// List<String> header = new ArrayList<>();
|
||||
// header.add("子系统");
|
||||
// header.add("零部件");
|
||||
// header.add("参数");
|
||||
// for (ModelItem model : models) {
|
||||
// if (model == null) {
|
||||
// header.add("未知机型");
|
||||
// } else {
|
||||
// header.add(modelNames.getOrDefault(model.getModelId(), "未知机型"));
|
||||
// }
|
||||
// }
|
||||
// excelData.add(header);
|
||||
//
|
||||
// // 数据行:每个参数一行
|
||||
// for (Map.Entry<String, Map<String, String>> entry : parameterValues.entrySet()) {
|
||||
// List<String> row = new ArrayList<>();
|
||||
// String paramName = entry.getKey();
|
||||
//
|
||||
// // 添加子系统和零部件信息
|
||||
// String[] getSubsystemParts = parameterSubsystemParts.get(paramName);
|
||||
// if (getSubsystemParts != null && getSubsystemParts.length >= 2) {
|
||||
// row.add(getSubsystemParts[0]); // 子系统
|
||||
// row.add(getSubsystemParts[1]); // 零部件
|
||||
// } else {
|
||||
// row.add(""); // 子系统
|
||||
// row.add(""); // 零部件
|
||||
// }
|
||||
//
|
||||
// row.add(paramName); // 参数名
|
||||
//
|
||||
// // 每个机型的参数值
|
||||
// Map<String, String> values = entry.getValue();
|
||||
// for (ModelItem model : models) {
|
||||
// if (model == null) {
|
||||
// row.add("");
|
||||
// } else {
|
||||
// row.add(values.getOrDefault(model.getModelId(), ""));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// excelData.add(row);
|
||||
// }
|
||||
//
|
||||
// // 写入Excel(防护流操作异常)
|
||||
// try (OutputStream outputStream = response.getOutputStream()) { // 自动关闭流
|
||||
// EasyExcel.write(outputStream)
|
||||
// .sheet("机型参数对比")
|
||||
// .doWrite(excelData);
|
||||
// }
|
||||
//
|
||||
// log.info("机型参数对比表导出成功,共导出{}行数据", excelData.size());
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// // 关键修复:使用e.toString()而非e.getMessage(),并记录完整异常栈
|
||||
// String errorMsg = "导出失败: " + e.toString();
|
||||
// log.error(errorMsg, e); // 记录完整异常栈,便于定位问题
|
||||
// throw new CommonException(errorMsg, e); // 传递根异常,保留调用栈
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
/**
|
||||
@ -897,7 +697,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
private void setupResponse(HttpServletResponse response, String fileName) throws IOException {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
}
|
||||
|
||||
@ -907,7 +707,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
// 处理文件名中文乱码
|
||||
String encodedFileName = java.net.URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = java.net.URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\"");
|
||||
// 禁止缓存
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
@ -1031,7 +831,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<List<String>> buildExcelData(List<ModelItem> models, Map<String, String> modelNames,
|
||||
private List<List<String>> buildExcelData(List<ModelItem> models,
|
||||
Map<String, Map<String, String>> parameterValues,
|
||||
Map<String, String[]> parameterSubsystemParts) {
|
||||
List<List<String>> excelData = new ArrayList<>();
|
||||
|
||||
@ -27,6 +27,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
@ -223,7 +224,7 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
|
||||
|
||||
try {
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
@ -591,17 +592,11 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
* @param response HTTP响应对象
|
||||
*/
|
||||
public void exportMultipleTemplates(HttpServletResponse response) {
|
||||
try {
|
||||
String fileName = "全部模板_" +
|
||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
|
||||
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
try {
|
||||
setupResponseHeaders(response, fileName);
|
||||
|
||||
// 获取所有模板
|
||||
List<TemplatePojo> templates = bd.getBusinessDatabase()
|
||||
@ -609,6 +604,32 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
.doQuery(TemplatePojo.class);
|
||||
|
||||
if (templates.isEmpty()) {
|
||||
exportEmptyTemplate(response);
|
||||
} else {
|
||||
exportMultipleSheets(response, templates);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CommonException("导出Excel失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置响应头信息
|
||||
*/
|
||||
private void setupResponseHeaders(HttpServletResponse response, String fileName) throws UnsupportedEncodingException {
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出空模板(只有一个sheet)
|
||||
*/
|
||||
private void exportEmptyTemplate(HttpServletResponse response) {
|
||||
try {
|
||||
List<ParameterPojo> list = new ArrayList<>();
|
||||
list.add(new ParameterPojo());
|
||||
@ -620,15 +641,31 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
.sheet("xxx")
|
||||
.doWrite(list);
|
||||
} catch (Exception e) {
|
||||
throw new CommonException("导出Excel失败: " + e.getMessage());
|
||||
throw new CommonException("导出空模板失败: " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出多个sheet(每个模板一个sheet)
|
||||
*/
|
||||
private void exportMultipleSheets(HttpServletResponse response, List<TemplatePojo> templates) {
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ParameterPojo.class)
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
.registerWriteHandler(new DescriptionWriteUtils(ParameterPojo.getFieldDescriptions()))
|
||||
.includeColumnFieldNames(getIncludeColumnFieldNames())
|
||||
.build()) {
|
||||
|
||||
writeMultipleSheets(excelWriter, templates);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CommonException("导出多sheet模板失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入多个sheet的数据
|
||||
*/
|
||||
private void writeMultipleSheets(ExcelWriter excelWriter, List<TemplatePojo> templates) {
|
||||
for (TemplatePojo template : templates) {
|
||||
List<ParameterPojo> parameters = new ArrayList<>();
|
||||
parameters.add(new ParameterPojo());
|
||||
@ -640,12 +677,5 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
// 写入数据到对应的sheet
|
||||
excelWriter.write(parameters, writeSheet);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CommonException("导出Excel失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CommonException("导出Excel失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,27 +6,20 @@ import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||
import com.xdap.self_development.common.BusinessDatabase;
|
||||
import com.xdap.self_development.controller.request.RejectTodoRequest;
|
||||
import com.xdap.self_development.controller.request.TodoTaskRequest;
|
||||
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
||||
import com.xdap.self_development.domain.dto.EngineParamDetailDTO;
|
||||
import com.xdap.self_development.domain.dto.PageResultDTO;
|
||||
import com.xdap.self_development.domain.dto.YcTodoTaskCommonResultDTO;
|
||||
import com.xdap.self_development.domain.enums.CurrentNodeEnum;
|
||||
import com.xdap.self_development.domain.enums.DistributeStatusEnum;
|
||||
import com.xdap.self_development.domain.pojo.*;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.service.ActivitiProcessService;
|
||||
import com.xdap.self_development.service.DataEntryEngineModelService;
|
||||
import com.xdap.self_development.service.TodoTaskService;
|
||||
import com.xdap.self_development.service.XdapDeptUsersService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.BinaryOperator;
|
||||
@ -42,40 +35,11 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class TodoTaskServiceImpl implements TodoTaskService {
|
||||
|
||||
@Resource
|
||||
private ActivitiProcessService activitiProcessService;
|
||||
@Resource
|
||||
private XdapDeptUsersService xdapDeptUsersService;
|
||||
@Resource
|
||||
private DataEntryEngineModelService dataEntryEngineModelService;
|
||||
@Resource
|
||||
private BusinessDatabase bd;
|
||||
|
||||
|
||||
private final String SYSTEM = "研发数据管理平台";
|
||||
|
||||
@Value("${apaas.app.url}")
|
||||
private String APAASAPPURL;
|
||||
@Value("${apaas.single.tenantId}")
|
||||
private String TENANTID;
|
||||
@Value("${apaas.single.appId}")
|
||||
private String APPID;
|
||||
|
||||
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private String getTodoUrl() {
|
||||
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-toDoList?appId=" + APPID;
|
||||
}
|
||||
|
||||
private String getCompletedUrl() {
|
||||
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-myDone?appId=" + APPID;
|
||||
}
|
||||
|
||||
private String getInitiatorUrl() {
|
||||
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-mySend?appId=" + APPID;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询发起任务
|
||||
*
|
||||
@ -225,7 +189,7 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
||||
List<CompletedTaskPojo> paginatedList = collect.subList(fromIndex, toIndex);
|
||||
|
||||
pageResultDTO.setList(paginatedList);
|
||||
pageResultDTO.setTotalCount(completedTaskPojos.size());
|
||||
pageResultDTO.setTotalCount(collect.size());
|
||||
return pageResultDTO;
|
||||
|
||||
}
|
||||
@ -239,7 +203,6 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
||||
@Override
|
||||
public void createResPerson(List<EngineParamDetailDTO> paramDetailPojosAll, String userID) {
|
||||
String modelId = paramDetailPojosAll.get(0).getEngineModelId();
|
||||
//TODO 管理员向责任人分发任务
|
||||
//为参数更新责任人
|
||||
for (EngineParamDetailDTO engineParamDetailDTO : paramDetailPojosAll) {
|
||||
bd.getBusinessDatabase()
|
||||
@ -484,118 +447,4 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
||||
.update("is_delete", 1)
|
||||
.doUpdate(TodoTaskPojo.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回已办任务
|
||||
*
|
||||
* @param ycGetTodoTaskRequest 云柴获取待办任务请求对象
|
||||
* @return 云柴已办任务通用结果DTO分页结果
|
||||
*/
|
||||
@Override
|
||||
public PageResultDTO<YcTodoTaskCommonResultDTO> returnCompleted(YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||
return commonTodoTask(ycGetTodoTaskRequest, "已办");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回发起任务
|
||||
*
|
||||
* @param ycGetTodoTaskRequest 云柴获取待办任务请求对象
|
||||
* @return 云柴发起任务通用结果DTO分页结果
|
||||
*/
|
||||
@Override
|
||||
public PageResultDTO<YcTodoTaskCommonResultDTO> returnInitiator(YcGetTodoTaskRequest ycGetTodoTaskRequest) {
|
||||
return commonTodoTask(ycGetTodoTaskRequest, "发起");
|
||||
}
|
||||
|
||||
private PageResultDTO<YcTodoTaskCommonResultDTO> commonTodoTask(YcGetTodoTaskRequest ycGetTodoTaskRequest, String o) {
|
||||
|
||||
if (ObjectUtils.isEmpty(ycGetTodoTaskRequest.getCreateDateStart())) {
|
||||
throw new CommonException("开始时间为必填项");
|
||||
}
|
||||
String userCode = ObjectUtils.isEmpty(ycGetTodoTaskRequest.getUsername()) ? "" : ycGetTodoTaskRequest.getUsername();
|
||||
String userid = ObjectUtils.isEmpty(xdapDeptUsersService.selectUserByCode(userCode)) ? "" : xdapDeptUsersService.selectUserByCode(userCode).getId();
|
||||
List<TodoTaskPojo> todoTaskPojos;
|
||||
PageResultDTO<YcTodoTaskCommonResultDTO> ycCompletedResultDTOPageResultDTO = new PageResultDTO<>();
|
||||
ArrayList<YcTodoTaskCommonResultDTO> ycCompletedResultDTOS = new ArrayList<>();
|
||||
String str = "owner_id";
|
||||
if (o.equals("发起")) {
|
||||
str = "created_by_id";
|
||||
}
|
||||
SimpleDateFormat format = new SimpleDateFormat(dateFormat);
|
||||
Date parseStart = null;
|
||||
Date parseEnd = null;
|
||||
try {
|
||||
if (ObjectUtils.isNotEmpty(ycGetTodoTaskRequest.getCreateDateStart())) {
|
||||
parseStart = format.parse(ycGetTodoTaskRequest.getCreateDateStart());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(ycGetTodoTaskRequest.getCreateDateEnd())) {
|
||||
parseEnd = format.parse(ycGetTodoTaskRequest.getCreateDateEnd());
|
||||
}
|
||||
|
||||
} catch (ParseException e) {
|
||||
throw new CommonException("检查日期格式是否正确为“yyyy-MM-dd HH:mm:ss”");
|
||||
}
|
||||
todoTaskPojos = bd.getBusinessDatabase()
|
||||
.eq(str, userid)
|
||||
.gt("creation_date", parseStart)
|
||||
.lt("creation_date", parseEnd)
|
||||
.eq("process_title", ycGetTodoTaskRequest.getTitle())
|
||||
.doQuery(TodoTaskPojo.class);
|
||||
if (!o.equals("发起")) {
|
||||
todoTaskPojos = todoTaskPojos.stream().filter(x -> x.getIsDelete() == 1).collect(Collectors.toList());
|
||||
}
|
||||
ycCompletedResultDTOPageResultDTO.setTotalCount(todoTaskPojos.size());
|
||||
if (ObjectUtils.isNotEmpty(ycGetTodoTaskRequest.getPage())
|
||||
&& ObjectUtils.isNotEmpty(ycGetTodoTaskRequest.getPageSize())
|
||||
) {
|
||||
String page = ycGetTodoTaskRequest.getPage();
|
||||
String pageSize = ycGetTodoTaskRequest.getPageSize();
|
||||
int pageint;
|
||||
int pageSizeint;
|
||||
try {
|
||||
pageint = Integer.parseInt(page);
|
||||
pageSizeint = Integer.parseInt(pageSize);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new CommonException("您的页码或页数非数字");
|
||||
}
|
||||
PageQueryResult<TodoTaskPojo> queryResult;
|
||||
if (!o.equals("发起")) {
|
||||
queryResult = bd.getBusinessDatabase()
|
||||
.eq(str, userid)
|
||||
.eq("is_delete", 1)
|
||||
.gt("creation_date", parseStart)
|
||||
.lt("creation_date", parseEnd)
|
||||
.eq("process_title", ycGetTodoTaskRequest.getTitle())
|
||||
.doPageQuery(pageint, pageSizeint, TodoTaskPojo.class);
|
||||
} else {
|
||||
queryResult = bd.getBusinessDatabase()
|
||||
.eq(str, userid)
|
||||
.gt("creation_date", parseStart)
|
||||
.lt("creation_date", parseEnd)
|
||||
.eq("process_title", ycGetTodoTaskRequest.getTitle())
|
||||
.doPageQuery(pageint, pageSizeint, TodoTaskPojo.class);
|
||||
}
|
||||
ycCompletedResultDTOPageResultDTO.setTotalCount(todoTaskPojos.size());
|
||||
todoTaskPojos = queryResult.getResult();
|
||||
}
|
||||
|
||||
for (TodoTaskPojo todoTaskPojo : todoTaskPojos) {
|
||||
XdapUsers xdapUsers = xdapDeptUsersService.selectUserByID(todoTaskPojo.getOwnerId());
|
||||
|
||||
YcTodoTaskCommonResultDTO ycCompletedResultDTO = new YcTodoTaskCommonResultDTO();
|
||||
if (!o.equals("发起")) {
|
||||
ycCompletedResultDTO.setUrl(getCompletedUrl());
|
||||
} else {
|
||||
ycCompletedResultDTO.setUrl(getInitiatorUrl());
|
||||
}
|
||||
ycCompletedResultDTO.setTitle(todoTaskPojo.getProcessTitle());
|
||||
ycCompletedResultDTO.setCreateDate(format.format(todoTaskPojo.getCreationDate()));
|
||||
ycCompletedResultDTO.setUsername(xdapUsers.getUserNumber());
|
||||
ycCompletedResultDTO.setType(SYSTEM);
|
||||
ycCompletedResultDTOS.add(ycCompletedResultDTO);
|
||||
}
|
||||
ycCompletedResultDTOPageResultDTO.setList(ycCompletedResultDTOS);
|
||||
return ycCompletedResultDTOPageResultDTO;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,9 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
@ -33,45 +34,44 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class YcTaskResultServiceImpl implements YcTaskResultService {
|
||||
private static final Pattern POSITIVE_INTEGER_PATTERN = Pattern.compile("^[1-9]\\d*$");
|
||||
private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
private final String SYSTEM = "研发数据管理平台";
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Resource
|
||||
private BusinessDatabase bd;
|
||||
@Resource
|
||||
private XdapDeptUsersService xdapDeptUsersService;
|
||||
@Value("${apaas.app.url}")
|
||||
private String APAASAPPURL;
|
||||
private String frontUrl;
|
||||
@Value("${apaas.single.tenantId}")
|
||||
private String TENANTID;
|
||||
private String tenantId;
|
||||
@Value("${apaas.single.appId}")
|
||||
private String APPID;
|
||||
private String appId;
|
||||
|
||||
private String getTodoUrl() {
|
||||
XdapMenus xdapMenus = bd.getBusinessDatabase()
|
||||
.eq("app_id", APPID)
|
||||
.eq("app_id", appId)
|
||||
.eq("menu_name", "我的待办")
|
||||
.doQueryFirst(XdapMenus.class);
|
||||
String menuId = xdapMenus == null ? "" : xdapMenus.getId();
|
||||
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-toDoList?appId=" + APPID + "&title=我的待办&url=apaas-custom-toDoList¤tMenu=" + menuId;
|
||||
return frontUrl + "/" + tenantId + "/app/custom-page/apaas-custom-toDoList?appId=" + appId + "&title=我的待办&url=apaas-custom-toDoList¤tMenu=" + menuId;
|
||||
}
|
||||
|
||||
private String getCompletedUrl() {
|
||||
XdapMenus xdapMenus = bd.getBusinessDatabase()
|
||||
.eq("app_id", APPID)
|
||||
.eq("app_id", appId)
|
||||
.eq("menu_name", "我发起的")
|
||||
.doQueryFirst(XdapMenus.class);
|
||||
String menuId = xdapMenus == null ? "" : xdapMenus.getId();
|
||||
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-myDone?appId=" + APPID + "&title=我发起的&url=apaas-custom-mySend¤tMenu=" + menuId;
|
||||
return frontUrl + "/" + tenantId + "/app/custom-page/apaas-custom-myDone?appId=" + appId + "&title=我发起的&url=apaas-custom-mySend¤tMenu=" + menuId;
|
||||
}
|
||||
|
||||
private String getInitiatorUrl() {
|
||||
XdapMenus xdapMenus = bd.getBusinessDatabase()
|
||||
.eq("app_id", APPID)
|
||||
.eq("app_id", appId)
|
||||
.eq("menu_name", "我的经办")
|
||||
.doQueryFirst(XdapMenus.class);
|
||||
String menuId = xdapMenus == null ? "" : xdapMenus.getId();
|
||||
return APAASAPPURL + "/" + TENANTID + "/app/custom-page/apaas-custom-mySend?appId=" + APPID + "&title=我的经办&url=apaas-custom-myDone¤tMenu=" + menuId;
|
||||
return frontUrl + "/" + tenantId + "/app/custom-page/apaas-custom-mySend?appId=" + appId + "&title=我的经办&url=apaas-custom-myDone¤tMenu=" + menuId;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,8 +99,8 @@ public class YcTaskResultServiceImpl implements YcTaskResultService {
|
||||
for (TodoTaskPojo todoTaskPojo : todoTaskPojos) {
|
||||
YcTodoTaskResultDTO dto = new YcTodoTaskResultDTO();
|
||||
dto.setTitle(todoTaskPojo.getProcessTitle());
|
||||
dto.setSystemName(SYSTEM);
|
||||
dto.setUpdateDate(DATE_FORMATTER.format(todoTaskPojo.getCreationDate()));
|
||||
dto.setSystemName("研发数据管理平台");
|
||||
dto.setUpdateDate(DATE_FORMATTER.format(todoTaskPojo.getCreationDate().toInstant()));
|
||||
dto.setActivityLabel(todoTaskPojo.getCurrentNode());
|
||||
dto.setUrl(getTodoUrl());
|
||||
dtos.add(dto);
|
||||
@ -160,7 +160,7 @@ public class YcTaskResultServiceImpl implements YcTaskResultService {
|
||||
paginatedList.forEach(completedTaskPojo -> {
|
||||
YcTodoTaskCommonResultDTO dto = new YcTodoTaskCommonResultDTO();
|
||||
dto.setTitle(completedTaskPojo.getProcessTitle());
|
||||
dto.setCreateDate(DATE_FORMATTER.format(completedTaskPojo.getCreationDate()));
|
||||
dto.setCreateDate(DATE_FORMATTER.format(completedTaskPojo.getCreationDate().toInstant()));
|
||||
dto.setActivityName(completedTaskPojo.getCurrentNode());
|
||||
dto.setUrl(getCompletedUrl());
|
||||
list.add(dto);
|
||||
@ -208,7 +208,7 @@ public class YcTaskResultServiceImpl implements YcTaskResultService {
|
||||
initiatedTaskPojos.forEach(initiatedTaskPojo -> {
|
||||
YcTodoTaskCommonResultDTO dto = new YcTodoTaskCommonResultDTO();
|
||||
dto.setTitle(initiatedTaskPojo.getProcessTitle());
|
||||
dto.setCreateDate(DATE_FORMATTER.format(initiatedTaskPojo.getCreationDate()));
|
||||
dto.setCreateDate(DATE_FORMATTER.format(initiatedTaskPojo.getCreationDate().toInstant()));
|
||||
dto.setActivityName(initiatedTaskPojo.getCurrentNode());
|
||||
dto.setUrl(getInitiatorUrl());
|
||||
list.add(dto);
|
||||
@ -240,8 +240,11 @@ public class YcTaskResultServiceImpl implements YcTaskResultService {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return DATE_FORMATTER.parse(dateStr.trim());
|
||||
} catch (ParseException e) {
|
||||
String trimmedDateStr = dateStr.trim();
|
||||
TemporalAccessor temporal = DATE_FORMATTER.parse(trimmedDateStr);
|
||||
Instant instant = Instant.from(temporal);
|
||||
return Date.from(instant);
|
||||
} catch (Exception e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,12 +5,17 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FormulaValidatorUtils {
|
||||
private static final String PLACEHOLDER = "OPERAND_PLACEHOLDER";
|
||||
|
||||
// 定义支持的数学运算符
|
||||
private static final Set<Character> OPERATORS = new HashSet<>(Arrays.asList('+', '-', '*', '/'));
|
||||
// 定义支持的常量
|
||||
private static final Set<String> CONSTANTS = new HashSet<>(Collections.singletonList("π"));
|
||||
|
||||
private FormulaValidatorUtils() {
|
||||
throw new AssertionError("禁止实例化工具类 FormulaValidatorUtils");
|
||||
}
|
||||
|
||||
/**
|
||||
* 详细验证公式合法性(基于运算逻辑)
|
||||
* @param formula 待验证的公式
|
||||
@ -108,7 +113,7 @@ public class FormulaValidatorUtils {
|
||||
validateSubFormula(parsedInner, innerContent, originalFormula);
|
||||
|
||||
// 替换括号块为占位符
|
||||
matcher.appendReplacement(sb, "OPERAND_PLACEHOLDER");
|
||||
matcher.appendReplacement(sb, PLACEHOLDER);
|
||||
}
|
||||
matcher.appendTail(sb);
|
||||
|
||||
@ -135,7 +140,7 @@ public class FormulaValidatorUtils {
|
||||
String token = tokens.get(i);
|
||||
|
||||
// 占位符直接视为合法操作数
|
||||
if (token.equals("OPERAND_PLACEHOLDER")) {
|
||||
if (token.equals(PLACEHOLDER)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -143,7 +148,7 @@ public class FormulaValidatorUtils {
|
||||
if (i == 0) {
|
||||
if (token.equals("-")) {
|
||||
// 负号开头,检查下一个token是否为有效值
|
||||
if (tokens.size() < 2 || isValidOperand(tokens.get(1)) && !tokens.get(1).equals("OPERAND_PLACEHOLDER")) {
|
||||
if (tokens.size() < 2 || isValidOperand(tokens.get(1)) && !tokens.get(1).equals(PLACEHOLDER)) {
|
||||
throw new IllegalArgumentException(String.format("负号后必须跟有效参数/数字/常量 [错误片段:-%s][原始公式:%s]",
|
||||
tokens.size() >= 2 ? tokens.get(1) : "", originalFormula));
|
||||
}
|
||||
@ -166,7 +171,7 @@ public class FormulaValidatorUtils {
|
||||
// 检查除法分母不能为0
|
||||
if (token.equals("/") && i + 1 < tokens.size()) {
|
||||
String nextToken = tokens.get(i + 1);
|
||||
if (!nextToken.equals("OPERAND_PLACEHOLDER") && nextToken.matches("^-?0+(\\.0+)?$")) {
|
||||
if (!nextToken.equals(PLACEHOLDER) && nextToken.matches("^-?0+(\\.0+)?$")) {
|
||||
throw new IllegalArgumentException(String.format("除法运算分母不能为0 [错误片段:/%s][原始公式:%s]",
|
||||
nextToken, originalFormula));
|
||||
}
|
||||
@ -191,32 +196,25 @@ public class FormulaValidatorUtils {
|
||||
private static List<String> tokenizeFormula(String formula) {
|
||||
List<String> tokens = new ArrayList<>();
|
||||
StringBuilder currentOperand = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < formula.length(); i++) {
|
||||
int i = 0;
|
||||
while (i < formula.length()) {
|
||||
char c = formula.charAt(i);
|
||||
|
||||
// 处理占位符
|
||||
if (c == 'O' && formula.startsWith("OPERAND_PLACEHOLDER", i)) {
|
||||
if (c == 'O' && formula.startsWith(PLACEHOLDER, i)) {
|
||||
if (currentOperand.length() > 0) {
|
||||
tokens.add(currentOperand.toString());
|
||||
currentOperand.setLength(0);
|
||||
}
|
||||
tokens.add("OPERAND_PLACEHOLDER");
|
||||
i += "OPERAND_PLACEHOLDER".length() - 1;
|
||||
tokens.add(PLACEHOLDER);
|
||||
i += PLACEHOLDER.length();
|
||||
continue;
|
||||
}
|
||||
|
||||
// 处理运算符
|
||||
if (OPERATORS.contains(c)) {
|
||||
// 负号不是运算符的情况:开头、运算符后、英文括号后
|
||||
boolean isNegativeSign = (c == '-') && (i == 0 ||
|
||||
OPERATORS.contains(formula.charAt(i - 1)) ||
|
||||
formula.charAt(i - 1) == '(');
|
||||
|
||||
if (isNegativeSign) {
|
||||
currentOperand.append(c);
|
||||
} else {
|
||||
// 运算符,先保存当前操作数
|
||||
if (currentOperand.length() > 0) {
|
||||
tokens.add(currentOperand.toString());
|
||||
currentOperand.setLength(0);
|
||||
@ -224,12 +222,10 @@ public class FormulaValidatorUtils {
|
||||
tokens.add(String.valueOf(c));
|
||||
}
|
||||
} else {
|
||||
// 操作数字符(中文、中文括号、数字、字母、小数点、π)
|
||||
currentOperand.append(c);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// 添加最后一个操作数
|
||||
if (currentOperand.length() > 0) {
|
||||
tokens.add(currentOperand.toString());
|
||||
}
|
||||
@ -325,7 +321,7 @@ public class FormulaValidatorUtils {
|
||||
}
|
||||
|
||||
// 3. 检查以小数点开头/结尾的孤立小数点
|
||||
if (cleanFormula.matches("^\\..*|.*[^0-9]\\.$")) {
|
||||
if (cleanFormula.matches("^(?:\\..*|.*\\D\\.)$")) {
|
||||
return String.format("数字格式错误:不能以孤立小数点开头或结尾 [错误片段:%s][原始公式:%s]",
|
||||
formula, originalFormula);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xdap.self_development.utils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user