修改:大部分修改2.0
This commit is contained in:
parent
fbba2a0ca4
commit
00a73659e2
@ -24,6 +24,6 @@ public class BusinessDatabase {
|
||||
|
||||
@Bean
|
||||
public MpaasQuery getTCDatabase() {
|
||||
return queryFactory.buildFromDatasource("yc_lrs_test_relsult");
|
||||
return queryFactory.buildFromDatasource(DatasourceConstant.XDAP_MYSQL_PREFIX + tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,16 @@ public class ActivitiProcessController {
|
||||
@Autowired
|
||||
private EngineReviewListService engineReviewListService;
|
||||
|
||||
// 修改流程主题
|
||||
@PostMapping(value = "/updateFlowTitle")
|
||||
public Response updateFlowTitle(
|
||||
@NotBlank @RequestParam String flowId,
|
||||
@NotBlank @RequestParam String title
|
||||
) {
|
||||
activitiProcessService.updateFlowTitle(flowId, title);
|
||||
return Response.ok();
|
||||
}
|
||||
|
||||
//审批前查看1.存入变更说明到DB,返回变更说明
|
||||
@GetMapping(value = "/initiateApproval")
|
||||
public Response initiateApproval(@RequestParam(value = "modelID") String modelID , @RequestParam(value = "userID") String userID) {
|
||||
|
||||
@ -65,6 +65,15 @@ public class DataEntryEngineModelController {
|
||||
return Response.ok();
|
||||
}
|
||||
|
||||
// 删除机型
|
||||
@GetMapping("/delete")
|
||||
public Response delete(
|
||||
@RequestParam String modelId
|
||||
) {
|
||||
entryEngineModelService.delete(modelId);
|
||||
return Response.ok().setMessage("删除成功");
|
||||
}
|
||||
|
||||
//分页查询
|
||||
@PostMapping("/selectByPage")
|
||||
public Response selectByConditionPage(@RequestBody DataEntryEngineModelPageRequest pageRequest) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xdap.self_development.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.definesys.mpaas.common.http.Response;
|
||||
import com.definesys.mpaas.query.MpaasQueryFactory;
|
||||
import com.xdap.motor.entity.SnowflakeIdWorker;
|
||||
@ -18,8 +19,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -28,5 +32,36 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/custom/delete")
|
||||
public class DeleteController {
|
||||
@Resource
|
||||
private BusinessDatabase yourDataService;
|
||||
|
||||
@PostMapping("/excel/import")
|
||||
public String importExcel(@RequestParam("file") MultipartFile file) {
|
||||
// 校验文件
|
||||
if (file.isEmpty()) {
|
||||
return "上传的文件为空,请选择有效文件!";
|
||||
}
|
||||
// 校验文件格式
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName == null || (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls"))) {
|
||||
return "仅支持 .xlsx 和 .xls 格式的 Excel 文件!";
|
||||
}
|
||||
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
// 创建监听器(注入你的 Service)
|
||||
ExcelImportListener listener = new ExcelImportListener(yourDataService);
|
||||
// 执行 Excel 解析
|
||||
EasyExcel.read(inputStream, ExcelImportEntity.class, listener)
|
||||
// 忽略表头(如果 Excel 第一行是表头,这里设置为 1,否则为 0)
|
||||
.sheet().headRowNumber(1)
|
||||
.doRead();
|
||||
return "Excel 导入成功!";
|
||||
} catch (IOException e) {
|
||||
log.error("Excel 导入失败", e);
|
||||
return "Excel 导入失败:" + e.getMessage();
|
||||
} catch (RuntimeException e) {
|
||||
log.error("数据写入数据库失败", e);
|
||||
return "数据写入失败:" + e.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ public class EngineParamDetailController {
|
||||
//Excel导入
|
||||
@PostMapping("/excelImport")
|
||||
public Response excelImport(@RequestParam(value = "file") MultipartFile file,
|
||||
@RequestParam(value = "userId") String userId,
|
||||
@RequestParam(value = "modelId") String modelId) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
return Response.error("请选择要导入的文件");
|
||||
@ -72,7 +73,7 @@ public class EngineParamDetailController {
|
||||
return Response.error("只支持.xlsx或.xls格式的Excel文件");
|
||||
}
|
||||
try {
|
||||
engineParamDetailService.excelImport(file, modelId);
|
||||
engineParamDetailService.excelImport(file, modelId, userId);
|
||||
} catch (Exception e) {
|
||||
return Response.error("导入失败" + e.getMessage());
|
||||
}
|
||||
@ -81,9 +82,13 @@ public class EngineParamDetailController {
|
||||
|
||||
//导出模板
|
||||
@GetMapping("/excelExport")
|
||||
public Response excelExport(HttpServletResponse response) {
|
||||
public Response excelExport(
|
||||
HttpServletResponse response,
|
||||
@RequestParam String engineModelID,
|
||||
@RequestParam String userId
|
||||
) {
|
||||
try {
|
||||
engineParamDetailService.excelExport(response);
|
||||
engineParamDetailService.excelExport(response, engineModelID, userId);
|
||||
} catch (Exception e) {
|
||||
return Response.error("导出失败" + e.getMessage());
|
||||
}
|
||||
|
||||
@ -27,6 +27,17 @@ public class TemplateApprovalController {
|
||||
@Resource
|
||||
private RuntimeDatasourceService runtimeDatasourceService;
|
||||
|
||||
// 修改流程主题
|
||||
@GetMapping("/updateFlowTitle")
|
||||
public Response updateFlowTitle(
|
||||
@NotBlank @RequestParam String flowId,
|
||||
@NotBlank @RequestParam String title
|
||||
) {
|
||||
templateApprovalService.updateFlowTitle(flowId, title);
|
||||
return Response.ok();
|
||||
}
|
||||
|
||||
|
||||
// 获取是否直送
|
||||
@GetMapping("/getIsDirect")
|
||||
public Response getIsDirect(
|
||||
|
||||
@ -25,8 +25,14 @@ import java.util.List;
|
||||
public class TemplateController {
|
||||
@Resource
|
||||
private TemplateService templateService;
|
||||
@Resource
|
||||
private BusinessDatabase bd;
|
||||
|
||||
@GetMapping("/deleteTemplate")
|
||||
public Response deleteTemplate(
|
||||
@NotBlank @RequestParam String templateId
|
||||
) {
|
||||
templateService.deleteTemplate(templateId);
|
||||
return Response.ok().setMessage("删除成功");
|
||||
}
|
||||
|
||||
// 模板名的模糊搜索
|
||||
@GetMapping("/getTemplateByCondition")
|
||||
|
||||
@ -28,7 +28,8 @@ public class DataEntryEngineModelExcel {
|
||||
/**
|
||||
* 产品简称
|
||||
*/
|
||||
@ExcelProperty("产品简称")
|
||||
// @ExcelProperty("产品简称")
|
||||
@ExcelIgnore
|
||||
private String modelNameSimple;
|
||||
|
||||
/**
|
||||
@ -49,18 +50,18 @@ public class DataEntryEngineModelExcel {
|
||||
@ExcelProperty("平台")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 系列
|
||||
*/
|
||||
@ExcelProperty("系列")
|
||||
private String series;
|
||||
|
||||
/**
|
||||
* 细分市场
|
||||
*/
|
||||
@ExcelProperty("细分市场")
|
||||
private String marketSegment;
|
||||
|
||||
/**
|
||||
* 系列
|
||||
*/
|
||||
@ExcelProperty("系列")
|
||||
private String series;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@ -76,7 +77,8 @@ public class DataEntryEngineModelExcel {
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@ExcelProperty("品牌")
|
||||
@ExcelIgnore
|
||||
// @ExcelProperty("品牌")
|
||||
private String brand;
|
||||
/**
|
||||
* 品牌
|
||||
@ -99,7 +101,8 @@ public class DataEntryEngineModelExcel {
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
@ExcelProperty("生产日期")
|
||||
@ExcelIgnore
|
||||
// @ExcelProperty("生产日期")
|
||||
@DateTimeFormat("yyyy-MM-dd")
|
||||
private Date productionDate;
|
||||
//
|
||||
|
||||
@ -48,26 +48,30 @@ public class EngineParamDetailExcel {
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelProperty("单位")
|
||||
@ExcelIgnore
|
||||
// @ExcelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
/**
|
||||
* 参数来源
|
||||
*/
|
||||
@ExcelProperty("参数来源")
|
||||
// @ExcelProperty("参数来源")
|
||||
@ExcelIgnore
|
||||
private String parameterSource;
|
||||
|
||||
/**
|
||||
* 填写部门
|
||||
*/
|
||||
@ExcelProperty("填写部门")
|
||||
// @ExcelProperty("填写部门")
|
||||
@ExcelIgnore
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 填写人
|
||||
*/
|
||||
@ExcelProperty("填写人")
|
||||
// @ExcelProperty("填写人")
|
||||
@ExcelIgnore
|
||||
private String filledBy;
|
||||
/**
|
||||
* sheetName
|
||||
|
||||
@ -7,6 +7,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class ModelComparisonExportRequest {
|
||||
String userID;
|
||||
List<ModelItem> models;
|
||||
List<ModelItem> modelIds;
|
||||
List<String> subsystemParts;
|
||||
}
|
||||
|
||||
@ -38,15 +38,17 @@ public class EngineParamDetailListener implements ReadListener<EngineParamDetail
|
||||
Map<String, String> stringParameterMap;
|
||||
private RuntimeException importException = null;
|
||||
private ArrayList<String> successSheetName = null;
|
||||
private String userId;
|
||||
|
||||
private List<EngineParamDetailExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
|
||||
|
||||
public EngineParamDetailListener(MpaasQueryFactory sw, DataEntryEngineModelPojo modelPojo, DataEntryEngineModelService dataEntryEngineModelService, ResponsiblePerService responsiblePerService, DataEntryService dataEntryService) {
|
||||
public EngineParamDetailListener(MpaasQueryFactory sw, DataEntryEngineModelPojo modelPojo, DataEntryEngineModelService dataEntryEngineModelService, ResponsiblePerService responsiblePerService, DataEntryService dataEntryService, String userId) {
|
||||
this.sw = sw;
|
||||
this.modelPojo = modelPojo;
|
||||
this.dataEntryEngineModelService = dataEntryEngineModelService;
|
||||
this.responsiblePerService = responsiblePerService;
|
||||
this.dataEntryService = dataEntryService;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +116,7 @@ public class EngineParamDetailListener implements ReadListener<EngineParamDetail
|
||||
|
||||
List<EngineParamDetailPojo> detailPojos =
|
||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("parameter_id",paramDetailExcel.getId())
|
||||
.eq("id",paramDetailExcel.getId())
|
||||
.eq("engine_model_id",modelPojo.getId())
|
||||
.eq("major_version",modelPojo.getVersionNumber())
|
||||
.doQuery(EngineParamDetailPojo.class);
|
||||
@ -123,6 +125,7 @@ public class EngineParamDetailListener implements ReadListener<EngineParamDetail
|
||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.update("minor_version", paramDetailExcel.getParameterValue())
|
||||
.update("version_status",ParamValueVersionEnum.DRAFT.getCode())
|
||||
.update("last_updated_by", userId)
|
||||
.update("operation",String.valueOf(ParamOperation.UPDATE))
|
||||
.rowid("id", detailPojos.get(0).getId())
|
||||
.doUpdate(EngineParamDetailPojo.class);
|
||||
|
||||
@ -53,6 +53,10 @@ public class EngineParamDetailPojo {
|
||||
* 参数名称
|
||||
*/
|
||||
private String parameterName;
|
||||
/**
|
||||
* 参数来源
|
||||
*/
|
||||
private String parameterSource;
|
||||
|
||||
/**
|
||||
* 参数值
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xdap.self_development.pojo.dto;
|
||||
|
||||
import com.xdap.api.moudle.user.pojo.XdapUsers;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ -57,6 +58,8 @@ public class EngineParamDetailDTO {
|
||||
* 填写人
|
||||
*/
|
||||
private String filledBy;
|
||||
|
||||
private XdapUsers filler;
|
||||
/**
|
||||
* 大版本(审核通过后变更的)
|
||||
*/
|
||||
|
||||
@ -68,4 +68,6 @@ public interface ActivitiProcessService {
|
||||
String createBy,
|
||||
Integer enableReturn
|
||||
);
|
||||
|
||||
void updateFlowTitle(@NotBlank String flowId, @NotBlank String title);
|
||||
}
|
||||
|
||||
@ -46,4 +46,6 @@ public interface DataEntryEngineModelService {
|
||||
DataEntryEngineModelPojo selectBymodelId(String modelID);
|
||||
|
||||
PageResultDTO<DataEntryEngineModelDto> selectVersionByConditionPage();
|
||||
|
||||
void delete(String modelId);
|
||||
}
|
||||
|
||||
@ -25,9 +25,9 @@ public interface EngineParamDetailService {
|
||||
|
||||
HashMap<String, List<String>> selectParamList(String modelID,String tcData);
|
||||
|
||||
void excelImport(MultipartFile file,String modelId);
|
||||
void excelImport(MultipartFile file,String modelId, String userId);
|
||||
|
||||
void excelExport(HttpServletResponse response);
|
||||
void excelExport(HttpServletResponse response, String modelId, String userId);
|
||||
|
||||
List<EngineParamDetailDTO> selectValueByParam(EngineParamDetailRequest engineParamDetailRequest);
|
||||
|
||||
|
||||
@ -52,4 +52,6 @@ public interface TemplateApprovalService {
|
||||
ApprovalNodesDTO getApprovalUsers(@NotBlank String templateId);
|
||||
|
||||
boolean getIsDirect(String flowId);
|
||||
|
||||
void updateFlowTitle(String flowId, String title);
|
||||
}
|
||||
|
||||
@ -30,4 +30,6 @@ public interface TemplateService {
|
||||
List<Template> getTemplateVersion(TemplateRowIdForm form);
|
||||
|
||||
Template getTemplateById(@NotBlank String templateId);
|
||||
|
||||
void deleteTemplate(@NotBlank String templateId);
|
||||
}
|
||||
|
||||
@ -66,10 +66,10 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
// 通过机型ID查找参数过滤更新的
|
||||
List<EngineParamDetailPojo> engineParamDetailPojos;
|
||||
try {
|
||||
engineParamDetailPojos = engineParamDetailService.selectByModelNewVersion(modelID)
|
||||
.stream()
|
||||
.filter(x -> ParamOperation.UPDATE.toString()
|
||||
.equals(x.getOperation()) && userID.equals(x.getLastUpdatedBy() == null ? "" : x.getLastUpdatedBy())).collect(Collectors.toList());
|
||||
engineParamDetailPojos = engineParamDetailService.selectByModelNewVersion(modelID).stream()
|
||||
.filter(x -> ParamOperation.UPDATE.toString().equals(x.getOperation())
|
||||
&& userID.equals(x.getLastUpdatedBy() == null ? "" : x.getLastUpdatedBy()))
|
||||
.collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(engineParamDetailPojos)) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
@ -407,7 +407,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
completedTaskPojo.setCreatedById(request.getUserId());
|
||||
completedTaskPojo.setCreatedBy(xdapDeptUsersService.selectUserByID(request.getUserId()).getUsername());
|
||||
completedTaskPojo.setCurrentNode(currentNode.getNodeName());
|
||||
completedTaskPojo.setCurrentProcessor(currentNode.getAssignees());
|
||||
completedTaskPojo.setCurrentProcessor(JSON.toJSONString(currentNode.getAssignees().split(",")));
|
||||
completedTaskPojo.setDataType("数据审批");
|
||||
completedTaskPojo.setOwnerId(request.getUserId());
|
||||
completedTaskPojo.setProcessTitle(flow.getProcessTopic());
|
||||
@ -471,7 +471,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
bd.getBusinessDatabase()
|
||||
.update("version_status", ParamValueVersionEnum.DRAFT.getCode())
|
||||
.update("operation", "")// 清空操作状态
|
||||
.update("minor_version", "")// 小版本清空
|
||||
// .update("minor_version", "")// 小版本清空
|
||||
.update("last_update_date", new Date())
|
||||
.eq("approval_id", flow.getId())
|
||||
.doUpdate(EngineParamDetailPojo.class);
|
||||
@ -491,14 +491,14 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
TodoTaskPojo todoTask = new TodoTaskPojo();
|
||||
todoTask.setCreatedById(userId);
|
||||
todoTask.setCreatedBy(xdapDeptUsersService.selectUserByID(userId).getUsername());
|
||||
todoTask.setCurrentNode(node.getNodeName());
|
||||
todoTask.setCurrentNode("编制");
|
||||
todoTask.setDataType("数据拒绝");
|
||||
todoTask.setDocumentNo(flow.getId());
|
||||
todoTask.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||
todoTask.setIsDelete(0);
|
||||
todoTask.setModelId(flow.getModelId());
|
||||
todoTask.setModelName(flow.getModelName());
|
||||
todoTask.setProcessTitle("拒绝提醒:"+flow.getProcessTopic());
|
||||
todoTask.setProcessTitle("拒绝提醒-"+flow.getProcessTopic());
|
||||
todoTask.setStatusCode(flow.getStatusDescription());
|
||||
todoTask.setVersionNumber(0);
|
||||
todoTask.setOwnerId(flow.getCreatedBy());
|
||||
@ -605,7 +605,9 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
.update("status_description", ParamValueVersionEnum.PASSED.getDesc())
|
||||
.update("approver_persons", "")
|
||||
.update("last_update_date", new Date())
|
||||
.eq("id", flow.getId()).doUpdate(EngineReviewListPojo.class);
|
||||
.update("pre_node", -1)
|
||||
.eq("id", flow.getId())
|
||||
.doUpdate(EngineReviewListPojo.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -621,6 +623,7 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
.update("approver_persons", node.getAssignees())
|
||||
.update("node_name", node.getNodeName())
|
||||
.update("last_update_date", new Date())
|
||||
.update("pre_node", -1)
|
||||
.eq("id", flow.getId())
|
||||
.doUpdate(EngineReviewListPojo.class);
|
||||
// 为下个环节的人生成待办任务
|
||||
@ -631,7 +634,6 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
todoTaskPojo.setProcessTitle(flow.getProcessTopic());
|
||||
todoTaskPojo.setCurrentNode(node.getNodeName());
|
||||
todoTaskPojo.setCurrentProcessor(JSON.toJSONString(Arrays.asList(node.getAssignees().split(","))));
|
||||
// TODO:可以改为用机型去获取
|
||||
todoTaskPojo.setModelId(flow.getModelId());
|
||||
todoTaskPojo.setVersionNumber(modelPojo.getVersionNumber());
|
||||
todoTaskPojo.setOwnerId(nextAssId);
|
||||
@ -646,6 +648,41 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
myself.updateTasks(flow, node.getNodeName(), enableReturn);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateFlowTitle(String flowId, String title) {
|
||||
EngineReviewListPojo flow = bd.getBusinessDatabase()
|
||||
.eq("id", flowId)
|
||||
.ne("status_code", ParamValueVersionEnum.PASSED.getCode())
|
||||
.doQueryFirst(EngineReviewListPojo.class);
|
||||
|
||||
if (flow == null) {
|
||||
throw new CommonException("流程不存在");
|
||||
}
|
||||
|
||||
if (Objects.equals(title, flow.getProcessTopic())) {
|
||||
return;
|
||||
}
|
||||
|
||||
bd.getBusinessDatabase()
|
||||
.eq("id", flowId)
|
||||
.update("process_topic", title)
|
||||
.doUpdate(EngineReviewListPojo.class);
|
||||
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(TodoTaskPojo.class);
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(CompletedTaskPojo.class);
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(InitiatedTaskPojo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台发起审批流程
|
||||
* 从外部平台发起审批时,在本地系统创建相应的审批流程记录
|
||||
@ -787,8 +824,8 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
bd.getBusinessDatabase()
|
||||
.update("status_code", ParamValueVersionEnum.UNDER.getCode())
|
||||
.update("status_description", ParamValueVersionEnum.UNDER.getDesc())
|
||||
.update("node_name", currentNode.getNodeName())
|
||||
.update("approver_persons", "")
|
||||
.update("node_name", preNode.getNodeName())
|
||||
.update("approver_persons", preNode.getAssignees())
|
||||
.update("last_update_date", new Date())
|
||||
.eq("id", flow.getId()).doUpdate(EngineReviewListPojo.class);
|
||||
|
||||
@ -1023,11 +1060,15 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
activitiDataDTOS.add(activitiDataDTO);
|
||||
}
|
||||
activitiDataAndRecordDTO.setActivitiDataDTOS(activitiDataDTOS);
|
||||
// 生成审批记录节点
|
||||
// TODO生成审批记录节点
|
||||
List<FlowNode> flowNodes = new ArrayList<>();
|
||||
EngineReviewListPojo flow = bd.getBusinessDatabase()
|
||||
.eq("id", approvalId)
|
||||
.doQueryFirst(EngineReviewListPojo.class);
|
||||
if (flow == null) {
|
||||
activitiDataAndRecordDTO.setFlowNodes(flowNodes);
|
||||
return activitiDataAndRecordDTO;
|
||||
}
|
||||
ApprovalConfigPojo currentNode = bd.getBusinessDatabase()
|
||||
.eq("approval_id", approvalId)
|
||||
.eq("node_name", flow.getNodeName())
|
||||
@ -1100,8 +1141,6 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
}
|
||||
}
|
||||
|
||||
EngineReviewListPojo engineReviewListPojos = bd.getBusinessDatabase()
|
||||
.eq("id", approvalId).doQueryFirst(EngineReviewListPojo.class);
|
||||
// 查询基础数据
|
||||
activitiDataAndRecordDTO.setCurrentNode(flow.getNodeName());
|
||||
activitiDataAndRecordDTO.setCreateBy(
|
||||
@ -1113,12 +1152,12 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
activitiDataAndRecordDTO.setProcessor(
|
||||
!Objects.equals(flow.getStatusCode(), ParamValueVersionEnum.PASSED.getCode()) ?
|
||||
getUserNames(
|
||||
Arrays.asList(flow.getApproverPersons().split(","))
|
||||
Arrays.asList(currentNode.getAssignees().split(","))
|
||||
) : "无"
|
||||
);
|
||||
activitiDataAndRecordDTO.setModelName(engineReviewListPojos.getModelName());
|
||||
activitiDataAndRecordDTO.setApprovalStatus(engineReviewListPojos.getStatusDescription());
|
||||
activitiDataAndRecordDTO.setProcessTitle(engineReviewListPojos.getProcessTopic());
|
||||
activitiDataAndRecordDTO.setModelName(flow.getModelName());
|
||||
activitiDataAndRecordDTO.setApprovalStatus(flow.getStatusDescription());
|
||||
activitiDataAndRecordDTO.setProcessTitle(flow.getProcessTopic());
|
||||
List<FlowNode> sortedNode = flowNodes.stream()
|
||||
.sorted(Comparator.comparing(FlowNode::getApprovalTime,
|
||||
Comparator.nullsLast(Comparator.naturalOrder()))
|
||||
@ -1195,12 +1234,11 @@ public class ActivitiProcessServiceImpl implements ActivitiProcessService {
|
||||
private String getUserNames(List<String> userIds) {
|
||||
StringJoiner joiner = new StringJoiner(" ");
|
||||
for (String userId : userIds) {
|
||||
String username = bd.getBusinessDatabase()
|
||||
XdapUsers user = bd.getBusinessDatabase()
|
||||
.eq("id", userId)
|
||||
.doQueryFirst(XdapUsers.class)
|
||||
.getUsername();
|
||||
if (username != null) {
|
||||
joiner.add(username);
|
||||
.doQueryFirst(XdapUsers.class);
|
||||
if (user != null) {
|
||||
joiner.add(user.getUsername());
|
||||
} else {
|
||||
// 处理空值情况
|
||||
joiner.add(userId);
|
||||
|
||||
@ -413,8 +413,8 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
todoTask.setIsDelete(0);
|
||||
todoTask.setModelId(report.getId());
|
||||
todoTask.setModelName(report.getProjectName() + "对标报告");
|
||||
todoTask.setProcessTitle(approvalFlow.getProcessTitle());
|
||||
todoTask.setStatusCode(approvalFlow.getFlowStatus());
|
||||
todoTask.setProcessTitle(flow.getProcessTitle());
|
||||
todoTask.setStatusCode(flow.getFlowStatus());
|
||||
todoTask.setVersionNumber(1);
|
||||
todoTask.setOwnerId(person);
|
||||
todoTask.setCurrentProcessor(firstNode.getAssignees());
|
||||
@ -424,23 +424,23 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
|
||||
// 新增我创建的
|
||||
InitiatedTaskPojo initiatedTask = new InitiatedTaskPojo();
|
||||
initiatedTask.setDocumentNo(approvalFlow.getId());
|
||||
initiatedTask.setDocumentNo(flow.getId());
|
||||
initiatedTask.setCreatedById(newForm.getUserId());
|
||||
initiatedTask.setCreatedBy(xdapDeptUsersService.selectUserByID(newForm.getUserId()).getUsername());
|
||||
initiatedTask.setCurrentNode(firstNode.getNodeName());
|
||||
initiatedTask.setCurrentProcessor(firstNode.getAssignees());
|
||||
initiatedTask.setDataType("对标报告审核");
|
||||
initiatedTask.setProcessTitle(approvalFlow.getProcessTitle());
|
||||
initiatedTask.setProcessTitle(flow.getProcessTitle());
|
||||
initiatedTask.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||
initiatedTask.setIsDelete(0);
|
||||
initiatedTask.setModelId(approvalFlow.getTemplateId());
|
||||
initiatedTask.setModelId(flow.getTemplateId());
|
||||
initiatedTask.setEnableReturn(1);
|
||||
bd.getBusinessDatabase().doInsert(initiatedTask);
|
||||
|
||||
// 新增发起记录
|
||||
bd.getBusinessDatabase().doInsert(
|
||||
new ApprovalRecord(
|
||||
approvalFlow.getId(),
|
||||
flow.getId(),
|
||||
"发起审批",
|
||||
xdapDeptUsersService.selectUserByID(newForm.getUserId()).getUsername(),
|
||||
"发起审批",
|
||||
@ -958,14 +958,14 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
TodoTaskPojo todoTask = new TodoTaskPojo();
|
||||
todoTask.setCreatedById(userId);
|
||||
todoTask.setCreatedBy(xdapDeptUsersService.selectUserByID(userId).getUsername());
|
||||
todoTask.setCurrentNode(node.getNodeName());
|
||||
todoTask.setCurrentNode("编制");
|
||||
todoTask.setDataType("对标报告拒绝");
|
||||
todoTask.setDocumentNo(flow.getId());
|
||||
todoTask.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||
todoTask.setIsDelete(0);
|
||||
todoTask.setModelId(report.getId());
|
||||
todoTask.setModelName(report.getTitle());
|
||||
todoTask.setProcessTitle("拒绝提醒:"+flow.getProcessTitle());
|
||||
todoTask.setProcessTitle("拒绝提醒-"+flow.getProcessTitle());
|
||||
todoTask.setStatusCode(flow.getFlowStatus());
|
||||
todoTask.setVersionNumber(0);
|
||||
todoTask.setOwnerId(flow.getCreateBy());
|
||||
@ -1186,9 +1186,11 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
private String getUserNames(List<String> userIds) {
|
||||
StringJoiner joiner = new StringJoiner(" ");
|
||||
for (String userId : userIds) {
|
||||
String username = bd.getBusinessDatabase().eq("id", userId).doQueryFirst(XdapUsers.class).getUsername();
|
||||
if (username != null) {
|
||||
joiner.add(username);
|
||||
XdapUsers user = bd.getBusinessDatabase()
|
||||
.eq("id", userId)
|
||||
.doQueryFirst(XdapUsers.class);
|
||||
if (user != null) {
|
||||
joiner.add(user.getUsername());
|
||||
} else {
|
||||
// 处理空值情况
|
||||
joiner.add(userId);
|
||||
|
||||
@ -15,6 +15,7 @@ import com.xdap.self_development.controller.request.DataEntryEngineModelExcel;
|
||||
import com.xdap.self_development.controller.request.DataEntryEngineModelPageRequest;
|
||||
import com.xdap.self_development.enums.DistributeStatusEnum;
|
||||
import com.xdap.self_development.enums.ParamValueVersionEnum;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.exception.ExcelImportException;
|
||||
import com.xdap.self_development.listener.EngineModelListener;
|
||||
import com.xdap.self_development.pojo.*;
|
||||
@ -454,6 +455,27 @@ public class DataEntryEngineModelServiceImpl implements DataEntryEngineModelServ
|
||||
return pageResultDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String modelId) {
|
||||
EngineReviewListPojo model = sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("model_id", modelId)
|
||||
.doQueryFirst(EngineReviewListPojo.class);
|
||||
if (!ObjectUtils.isEmpty(model)) {
|
||||
throw new CommonException("参数值在审批值,机型无法删除");
|
||||
}
|
||||
|
||||
List<InitiatedTaskPojo> initiatedTaskPojos = sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("model_id", modelId)
|
||||
.doQuery(InitiatedTaskPojo.class);
|
||||
if (!ObjectUtils.isEmpty(initiatedTaskPojos)) {
|
||||
throw new CommonException("机型已分发,无法删除");
|
||||
}
|
||||
|
||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("model_id", modelId)
|
||||
.doDelete(DataEntryEngineModelPojo.class);
|
||||
}
|
||||
|
||||
private void setupResponse(HttpServletResponse response, String fileName) throws IOException {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
|
||||
@ -197,7 +197,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
* @param file
|
||||
*/
|
||||
@Override
|
||||
public void excelImport(MultipartFile file, String modelId) {
|
||||
public void excelImport(MultipartFile file, String modelId, String userId) {
|
||||
|
||||
DataEntryEngineModelPojo modelPojo =
|
||||
dataEntryEngineModelService.selectBymodelId(modelId);
|
||||
@ -205,10 +205,18 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
throw new ExcelImportException("发动机型号不存在");
|
||||
}
|
||||
try {
|
||||
EasyExcel.read(file.getInputStream(), EngineParamDetailExcel.class,
|
||||
new EngineParamDetailListener(sw, modelPojo, dataEntryEngineModelService, responsiblePerService, dataEntryService))
|
||||
.build()
|
||||
.readAll();
|
||||
EasyExcel.read(
|
||||
file.getInputStream(),
|
||||
EngineParamDetailExcel.class,
|
||||
new EngineParamDetailListener(
|
||||
sw,
|
||||
modelPojo,
|
||||
dataEntryEngineModelService,
|
||||
responsiblePerService,
|
||||
dataEntryService,
|
||||
userId
|
||||
)
|
||||
).build().readAll();
|
||||
} catch (IOException e) {
|
||||
log.error("导入失败IO异常");
|
||||
} catch (RuntimeException e) {
|
||||
@ -217,19 +225,22 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelExport(HttpServletResponse response) {
|
||||
try {
|
||||
setupResponse(response, "参数值导入模板" + (formatter.format(LocalDateTime.now())));
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
public void excelExport(
|
||||
HttpServletResponse response,
|
||||
String modelId,
|
||||
String userId
|
||||
) {
|
||||
// 定义Sheet名称集合
|
||||
// List<Parameter> parameterByCondition = dataEntryService.getParameterByCondition(new OptionForm());
|
||||
List<Parameter> parameterByCondition = selectAllByNewVersion();
|
||||
if (ObjectUtils.isEmpty(parameterByCondition)) {
|
||||
List<EngineParamDetailPojo> engineParams = sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("engine_model_id", modelId)
|
||||
.eq("filled_by", userId)
|
||||
.doQuery(EngineParamDetailPojo.class);
|
||||
// List<Parameter> parameterByCondition = selectAllByNewVersion();
|
||||
if (ObjectUtils.isEmpty(engineParams)) {
|
||||
log.error("模板参数为空");
|
||||
throw new ExcelImportException(
|
||||
String.format("模板参数未配置")
|
||||
"模板参数未配置"
|
||||
);
|
||||
}
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
@ -245,16 +256,21 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy =
|
||||
new HorizontalCellStyleStrategy(headWriteCellStyle, new WriteCellStyle());
|
||||
|
||||
List<String> sheetNames =
|
||||
parameterByCondition.stream().map(Parameter::getSubsystemName).distinct().collect(Collectors.toList());
|
||||
List<Parameter> parameters = selectAllByNewVersion();
|
||||
List<String> sheetNames = engineParams.stream()
|
||||
.map(EngineParamDetailPojo::getSubsystemName)
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
// List<Parameter> parameters = selectAllByNewVersion();
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build()) {
|
||||
setupResponse(response, "参数值导入模板" + (formatter.format(LocalDateTime.now())));
|
||||
// 循环创建Sheet
|
||||
for (int i = 0; i < sheetNames.size(); i++) {
|
||||
String sheetName = sheetNames.get(i);
|
||||
List<Parameter> parameterList = parameters.stream().filter(x -> x.getSubsystemName().equals(sheetName)).collect(Collectors.toList());
|
||||
List<EngineParamDetailPojo> parameterList = engineParams.stream()
|
||||
.filter(x -> x.getSubsystemName().equals(sheetName))
|
||||
.collect(Collectors.toList());
|
||||
List<EngineParamDetailExcel> engineParamDetailExcels = new ArrayList<>();
|
||||
for (Parameter parameter : parameterList) {
|
||||
for (EngineParamDetailPojo parameter : parameterList) {
|
||||
EngineParamDetailExcel engineParamDetailExcel = new EngineParamDetailExcel();
|
||||
BeanUtils.copyProperties(parameter, engineParamDetailExcel);
|
||||
engineParamDetailExcel.setId(parameter.getId());
|
||||
@ -381,10 +397,11 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
log.info("找到数据{}条", detailPojos.size());
|
||||
for (EngineParamDetailPojo detailPojo : detailPojos) {
|
||||
String filledBy = null;
|
||||
XdapUsers filler = null;
|
||||
if (ObjectUtils.isNotEmpty(detailPojo.getFilledBy())) {
|
||||
XdapUsers user =
|
||||
xdapDeptUsersService.selectUserByID(detailPojo.getFilledBy());
|
||||
filledBy = ObjectUtils.isEmpty(user) ? "" : user.getUsername();
|
||||
filler = xdapDeptUsersService.selectUserByID(detailPojo.getFilledBy());
|
||||
filledBy = ObjectUtils.isEmpty(filler) ? "" : filler.getUsername();
|
||||
|
||||
}
|
||||
EngineParamDetailDTO engineParamDetailDTO = new EngineParamDetailDTO();
|
||||
BeanUtils.copyProperties(detailPojo, engineParamDetailDTO);
|
||||
@ -399,6 +416,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
engineParamDetailDTO.setResPersonId(detailPojo.getResponsiblePersonId());
|
||||
engineParamDetailDTO.setUnit(unit);
|
||||
engineParamDetailDTO.setFilledBy(filledBy);
|
||||
engineParamDetailDTO.setFiller(filler);
|
||||
engineParamDetailDTO.setApprovalId(detailPojo.getApprovalId());
|
||||
engineParamDetailDTOS.add(engineParamDetailDTO);
|
||||
}
|
||||
@ -579,13 +597,20 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
.rowid("id", engineParamDetailPojo.getId())
|
||||
.doUpdate(engineParamDetailPojo);
|
||||
}
|
||||
// 清除待办
|
||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("model_id", modelPojo.getId())
|
||||
.eq("data_type", CurrentNodeEnum.REPAIR.getDesc())
|
||||
.update("is_delete", 1)
|
||||
.doUpdate(TodoTaskPojo.class);
|
||||
|
||||
//为每个填写人分配任务
|
||||
Set<String> filledBys = engineParamDetailPojos.stream().map(EngineParamDetailPojo::getFilledBy).collect(Collectors.toSet());
|
||||
for (String filledBy : filledBys) {
|
||||
TodoTaskPojo todoTask = new TodoTaskPojo();
|
||||
todoTask.setCreatedById(userID);
|
||||
todoTask.setDocumentNo(UUID.randomUUID().toString());
|
||||
todoTask.setProcessTitle("填写参数");
|
||||
todoTask.setProcessTitle(modelPojo.getModelName()+"-"+"填写参数任务");
|
||||
todoTask.setCurrentNode("待维护");
|
||||
todoTask.setStatusCode(null);
|
||||
todoTask.setModelName(modelPojo.getModelName());
|
||||
@ -609,9 +634,17 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
//这个责任人相关的填写人是否都已经填写完成如果没有则待办不动 如果填写完了待办完成
|
||||
List<EngineParamDetailPojo> detailPojos = selectByResId(userID);
|
||||
List<EngineParamDetailPojo> paramDetailPojos = detailPojos.stream()
|
||||
.filter(x -> x.getEngineModelId().equals(engineModelId) && ObjectUtils.isEmpty(x.getFilledBy())).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(paramDetailPojos) || paramDetailPojos.isEmpty()) {
|
||||
.filter(x -> x.getEngineModelId().equals(engineModelId)
|
||||
&& ObjectUtils.isEmpty(x.getFilledBy()) && Objects.equals(x.getParameterSource(), "数据平台手工录入"))
|
||||
.collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(paramDetailPojos)) {
|
||||
//软删除这个代办人的任务
|
||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.eq("model_id", modelPojo.getId())
|
||||
.eq("data_type", CurrentNodeEnum.JOBSPLIT.getDesc())
|
||||
.eq("owner_id", userID)
|
||||
.update("is_delete", 1)
|
||||
.doUpdate(TodoTaskPojo.class);
|
||||
//更新待办和发起的任务状态
|
||||
sw.buildFromDatasource("xdap_app_223770822127386625")
|
||||
.update("is_delete", 1)
|
||||
@ -691,13 +724,11 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService {
|
||||
if (ObjectUtils.isEmpty(x.getParameterSource())) {
|
||||
return false;
|
||||
}
|
||||
if ("TC分类表".equals(x.getParameterSource())) {
|
||||
else if ("TC分类表".equals(x.getParameterSource())) {
|
||||
return false;
|
||||
}
|
||||
// TODO:还需排除公式计算的
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
else return !Objects.equals(x.getParameterSource(), "公式计算");
|
||||
}).collect(Collectors.toList());
|
||||
if (ObjectUtils.isEmpty(parameterList)) {
|
||||
return new ArrayList<>();
|
||||
|
||||
@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.definesys.mpaas.query.MpaasQueryFactory;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xdap.motor.utils.StringUtils;
|
||||
import com.xdap.self_development.config.BusinessDatabase;
|
||||
import com.xdap.self_development.controller.request.AnalysisRequest;
|
||||
import com.xdap.self_development.controller.request.AnalysisVerRequest;
|
||||
@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -414,10 +416,28 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
|
||||
@Override
|
||||
public void modelComparisonExport(ModelComparisonExportRequest request, HttpServletResponse response) {
|
||||
List<ModelItem> models = request.getModels();
|
||||
List<ModelItem> models = request.getModelIds();
|
||||
String userID = request.getUserID();
|
||||
List<String> subsystemParts = request.getSubsystemParts();
|
||||
|
||||
// 1. 前置空指针检查,提前拦截异常并给出明确信息
|
||||
if (models == null) {
|
||||
log.error("导出失败:机型列表为null");
|
||||
throw new RuntimeException("导出失败:机型列表不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(userID)) {
|
||||
log.error("导出失败:用户ID为空");
|
||||
throw new RuntimeException("导出失败:用户ID不能为空");
|
||||
}
|
||||
if (subsystemParts == null) {
|
||||
log.error("导出失败:子系统部件列表为null");
|
||||
throw new RuntimeException("导出失败:子系统部件列表不能为空");
|
||||
}
|
||||
if (response == null) {
|
||||
log.error("导出失败:响应对象为null");
|
||||
throw new RuntimeException("导出失败:响应对象异常");
|
||||
}
|
||||
|
||||
try {
|
||||
// 设置响应头
|
||||
setupResponse(response, "机型参数对比表" + (formatter.format(LocalDateTime.now())) + ".xlsx");
|
||||
@ -425,6 +445,11 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
// 获取机型名称映射
|
||||
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());
|
||||
@ -439,10 +464,30 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
// 从Redis获取每个机型的数据
|
||||
for (ModelItem model : models) {
|
||||
try {
|
||||
String redisKey = userID + ":" + model.getModelId() + ":" + model.getParameterVersion() + ":" + "ComparisonExport";
|
||||
// 防护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 RuntimeException("Redis模板对象未初始化");
|
||||
}
|
||||
String cachedData = redisTemplate.opsForValue().get(redisKey);
|
||||
|
||||
if (ObjectUtils.isNotEmpty(cachedData)) {
|
||||
// 防护objectMapper为null
|
||||
if (objectMapper == null) {
|
||||
throw new RuntimeException("ObjectMapper对象未初始化");
|
||||
}
|
||||
// 反序列化数据
|
||||
List<EngineParamDetailPojo> allPojos = objectMapper.readValue(cachedData,
|
||||
objectMapper.getTypeFactory().constructCollectionType(List.class, EngineParamDetailPojo.class));
|
||||
@ -466,6 +511,10 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
|
||||
// 处理筛选后的数据,按参数名分组
|
||||
for (EngineParamDetailPojo pojo : filteredPojos) {
|
||||
if (pojo == null || StringUtils.isEmpty(pojo.getParameterName())) {
|
||||
log.warn("无效的参数项:pojo为null或参数名为空");
|
||||
continue;
|
||||
}
|
||||
String paramName = pojo.getParameterName();
|
||||
String paramValue = pojo.getParameterValue();
|
||||
|
||||
@ -473,15 +522,20 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
if (!parameterValues.containsKey(paramName)) {
|
||||
parameterValues.put(paramName, new HashMap<>());
|
||||
// 存储子系统和零部件信息
|
||||
parameterSubsystemParts.put(paramName, new String[]{pojo.getSubsystemName(), pojo.getPartsName()});
|
||||
parameterSubsystemParts.put(paramName, new String[]{
|
||||
pojo.getSubsystemName() == null ? "" : pojo.getSubsystemName(),
|
||||
pojo.getPartsName() == null ? "" : pojo.getPartsName()
|
||||
});
|
||||
}
|
||||
|
||||
// 设置该机型的参数值
|
||||
parameterValues.get(paramName).put(model.getModelId(), paramValue);
|
||||
parameterValues.get(paramName).put(modelId, paramValue == null ? "" : paramValue);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("从Redis读取机型{}数据失败: {}", model.getModelId(), e.getMessage());
|
||||
String errorMsg = String.format("从Redis读取机型%s数据失败: %s", model.getModelId(), e.toString());
|
||||
log.error(errorMsg, e); // 记录完整异常栈
|
||||
throw new RuntimeException(errorMsg, e); // 传递异常根因
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,8 +548,12 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
header.add("零部件");
|
||||
header.add("参数");
|
||||
for (ModelItem model : models) {
|
||||
if (model == null) {
|
||||
header.add("未知机型");
|
||||
} else {
|
||||
header.add(modelNames.getOrDefault(model.getModelId(), "未知机型"));
|
||||
}
|
||||
}
|
||||
excelData.add(header);
|
||||
|
||||
// 数据行:每个参数一行
|
||||
@ -505,7 +563,7 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
|
||||
// 添加子系统和零部件信息
|
||||
String[] getSubsystemParts = parameterSubsystemParts.get(paramName);
|
||||
if (getSubsystemParts != null) {
|
||||
if (getSubsystemParts != null && getSubsystemParts.length >= 2) {
|
||||
row.add(getSubsystemParts[0]); // 子系统
|
||||
row.add(getSubsystemParts[1]); // 零部件
|
||||
} else {
|
||||
@ -518,29 +576,30 @@ public class TcDataQueryServiceImpl implements TcDataQueryService {
|
||||
// 每个机型的参数值
|
||||
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
|
||||
EasyExcel.write(response.getOutputStream())
|
||||
// 写入Excel(防护流操作异常)
|
||||
try (OutputStream outputStream = response.getOutputStream()) { // 自动关闭流
|
||||
EasyExcel.write(outputStream)
|
||||
.sheet("机型参数对比")
|
||||
.doWrite(excelData);
|
||||
}
|
||||
|
||||
log.info("机型参数对比表导出成功");
|
||||
|
||||
// 导出成功后删除Redis中的数据
|
||||
// for (String modelId : modelIds) {
|
||||
// String redisKey = userID + ":" + modelId + ":" + "ComparisonExportComparisonExport";
|
||||
// redisTemplate.delete(redisKey);
|
||||
// log.info("已删除Redis中的数据,KEY: {}", redisKey);
|
||||
// }
|
||||
log.info("机型参数对比表导出成功,共导出{}行数据", excelData.size());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("导出机型参数对比表失败: {}", e.getMessage());
|
||||
throw new RuntimeException("导出失败: " + e.getMessage());
|
||||
// 关键修复:使用e.toString()而非e.getMessage(),并记录完整异常栈
|
||||
String errorMsg = "导出失败: " + e.toString();
|
||||
log.error(errorMsg, e); // 记录完整异常栈,便于定位问题
|
||||
throw new RuntimeException(errorMsg, e); // 传递根异常,保留调用栈
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -474,14 +474,14 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
TodoTaskPojo todoTask = new TodoTaskPojo();
|
||||
todoTask.setCreatedById(userId);
|
||||
todoTask.setCreatedBy(xdapDeptUsersService.selectUserByID(userId).getUsername());
|
||||
todoTask.setCurrentNode(node.getNodeName());
|
||||
todoTask.setCurrentNode("编制");
|
||||
todoTask.setDataType("模板拒绝");
|
||||
todoTask.setDocumentNo(flow.getId());
|
||||
todoTask.setCreationDate(Timestamp.valueOf(LocalDateTime.now()));
|
||||
todoTask.setIsDelete(0);
|
||||
todoTask.setModelId(template.getId());
|
||||
todoTask.setModelName(template.getTemplateName());
|
||||
todoTask.setProcessTitle("拒绝提醒:"+flow.getProcessTitle());
|
||||
todoTask.setProcessTitle("拒绝提醒-"+flow.getProcessTitle());
|
||||
todoTask.setStatusCode(flow.getFlowStatus());
|
||||
todoTask.setVersionNumber(template.getVersion());
|
||||
todoTask.setOwnerId(flow.getCreateBy());
|
||||
@ -542,6 +542,7 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
.rowid("id", flow.getRowId())
|
||||
.update("flow_status", flow.getFlowStatus())
|
||||
.update("current_node", flow.getCurrentNode())
|
||||
.update("pre_node", -1)
|
||||
.doUpdate(ApprovalFlow.class);
|
||||
}
|
||||
|
||||
@ -627,7 +628,7 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
ApprovalFlow flow = bd.getBusinessDatabase()
|
||||
.eq("template_id", templateId)
|
||||
.ne("pre_node", -1)
|
||||
.eq("flow_status", "APPROVING")
|
||||
.ne("flow_status", "COMPLETE")
|
||||
.orderBy("created_time", "desc")
|
||||
.doQueryFirst(ApprovalFlow.class);
|
||||
if (flow == null) {
|
||||
@ -671,6 +672,41 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
return flow.getPreNode() != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateFlowTitle(String flowId, String title) {
|
||||
ApprovalFlow flow = bd.getBusinessDatabase()
|
||||
.eq("id", flowId)
|
||||
.ne("flow_status", "COMPLETE")
|
||||
.doQueryFirst(ApprovalFlow.class);
|
||||
|
||||
if (flow == null) {
|
||||
throw new CommonException("流程不存在");
|
||||
}
|
||||
|
||||
if (Objects.equals(title, flow.getProcessTitle())) {
|
||||
return;
|
||||
}
|
||||
|
||||
bd.getBusinessDatabase()
|
||||
.eq("id", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(ApprovalFlow.class);
|
||||
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(TodoTaskPojo.class);
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(CompletedTaskPojo.class);
|
||||
bd.getBusinessDatabase()
|
||||
.eq("document_no", flowId)
|
||||
.update("process_title", title)
|
||||
.doUpdate(InitiatedTaskPojo.class);
|
||||
}
|
||||
|
||||
public void updateTasks(ApprovalFlow flow, String status, Integer enableReturn) {
|
||||
// 更新已办和发起的节点状态
|
||||
bd.getBusinessDatabase()
|
||||
@ -902,9 +938,11 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
private String getUserNames(List<String> userIds) {
|
||||
StringJoiner joiner = new StringJoiner(" ");
|
||||
for (String userId : userIds) {
|
||||
String username = bd.getBusinessDatabase().eq("id", userId).doQueryFirst(XdapUsers.class).getUsername();
|
||||
if (username != null) {
|
||||
joiner.add(username);
|
||||
XdapUsers user = bd.getBusinessDatabase()
|
||||
.eq("id", userId)
|
||||
.doQueryFirst(XdapUsers.class);
|
||||
if (user != null) {
|
||||
joiner.add(user.getUsername());
|
||||
} else {
|
||||
// 处理空值情况
|
||||
joiner.add(userId);
|
||||
|
||||
@ -223,6 +223,21 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
.doQueryFirst(Template.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTemplate(String templateId) {
|
||||
Template template = bd.getBusinessDatabase()
|
||||
.eq("id", templateId)
|
||||
.doQueryFirst(Template.class);
|
||||
|
||||
if (template == null) {
|
||||
throw new CommonException("模板不存在");
|
||||
}
|
||||
if (!Objects.equals(template.getStatus(), "DRAFT") || template.getVersion() != 1) {
|
||||
throw new CommonException("非草稿版本不允许删除");
|
||||
}
|
||||
bd.getBusinessDatabase().eq("id", templateId).doDelete(Template.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void processSheetData(List<Parameter> dataList, String sheetName,
|
||||
|
||||
@ -10,6 +10,7 @@ import com.xdap.self_development.controller.request.TodoTaskRequest;
|
||||
import com.xdap.self_development.controller.request.YcGetTodoTaskRequest;
|
||||
import com.xdap.self_development.enums.CurrentNodeEnum;
|
||||
import com.xdap.self_development.enums.DistributeStatusEnum;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.pojo.*;
|
||||
import com.xdap.self_development.pojo.dto.*;
|
||||
import com.xdap.self_development.service.DataEntryEngineModelService;
|
||||
@ -244,7 +245,7 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
||||
TodoTaskPojo todoTaskPojo = new TodoTaskPojo();
|
||||
todoTaskPojo.setCreatedById(userID);
|
||||
todoTaskPojo.setDocumentNo(UUID.randomUUID().toString());
|
||||
todoTaskPojo.setProcessTitle("分发参数填写人");
|
||||
todoTaskPojo.setProcessTitle(modelPojo.getModelName()+"-"+"分发参数填写人任务");
|
||||
todoTaskPojo.setCurrentNode("待分解");
|
||||
todoTaskPojo.setCurrentProcessor(JSON.toJSONString(Collections.singletonList(engineParamDetailDTO.getResPersonId())));
|
||||
todoTaskPojo.setStatusCode(null/*String.valueOf(ParamValueVersionEnum.DRAFT.getCode())*/);
|
||||
@ -266,7 +267,9 @@ public class TodoTaskServiceImpl implements TodoTaskService {
|
||||
myself.batchInsertInitiatedTask(taskPojos);
|
||||
List<EngineParamDetailPojo> detailPojos = engineParamDetailService.selectByModelNewVersion(modelId);
|
||||
List<EngineParamDetailPojo> paramDetailPojos = detailPojos.stream()
|
||||
.filter(x -> ObjectUtils.isEmpty(x.getResponsiblePersonId())).collect(Collectors.toList());
|
||||
.filter(x -> ObjectUtils.isEmpty(x.getResponsiblePersonId())
|
||||
&& Objects.equals(x.getParameterSource(), "数据平台手工录入"))
|
||||
.collect(Collectors.toList());
|
||||
// 机型的分发状态改为已分发
|
||||
if (ObjectUtils.isEmpty(paramDetailPojos)) {
|
||||
DistributeStatusEnum byDesc = DistributeStatusEnum.getByDesc("已分发");
|
||||
|
||||
@ -366,6 +366,25 @@ CREATE TABLE yc_datasource_0.yfsjglpt_model_role_permission
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT '角色权限关联表';
|
||||
|
||||
Drop Table if exists ads_prd_f_yfsjglpt_fdjlbjcjb;
|
||||
CREATE TABLE ads_prd_f_yfsjglpt_fdjlbjcjb(
|
||||
ztj VARCHAR(50) COMMENT '状态机',
|
||||
lbjth VARCHAR(255) COMMENT '零部件图号',
|
||||
lbjmc VARCHAR(255) COMMENT '零部件名称'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
COMMENT='发动机零部件层级表';
|
||||
drop table if exists ads_prd_f_tc_flsxb;
|
||||
create table ads_prd_f_tc_flsxb(
|
||||
PITEM_ID VARCHAR(100) comment '图号',
|
||||
PITEM_REVISION VARCHAR(100) comment '版本号',
|
||||
IDATTRTBUTEHAME VARCHAR(100) comment '零部件属性',
|
||||
ATTRIBFIELDHAME VARCHAR(100) comment '映射字段名',
|
||||
FIELDVALUE VARCHAR(100) comment '零部件属性值'
|
||||
) comment 'tc分类属性表';
|
||||
|
||||
-- 插入数据到ads_prd_f_yfsjglpt_fdjlbjcjb表
|
||||
|
||||
|
||||
DELETE
|
||||
FROM yfsjglpt_model_template;
|
||||
DELETE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user