diff --git a/zt-module-qms/zt-module-qms-server/pom.xml b/zt-module-qms/zt-module-qms-server/pom.xml index 2f4659a..09c96af 100644 --- a/zt-module-qms/zt-module-qms-server/pom.xml +++ b/zt-module-qms/zt-module-qms-server/pom.xml @@ -141,27 +141,27 @@ com.yomahub liteflow-spring-boot-starter - 2.15.0 + 2.15.1 com.yomahub liteflow-script-javax-pro - 2.15.0 + 2.15.1 com.yomahub liteflow-script-groovy - 2.15.0 + 2.15.1 com.yomahub liteflow-script-qlexpress - 2.15.0 + 2.15.1 com.yomahub liteflow-script-graaljs - 2.15.0 + 2.15.1 diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleEntrustController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleEntrustController.java index 3530b91..b58798b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleEntrustController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleEntrustController.java @@ -48,7 +48,7 @@ public class SampleEntrustController { if (response.isSuccess()) { return success(response.getContextBean(SampleEntrustContext.class)); } else { - return error(500, response.getMessage()); + return error(1_032_100_000, response.getMessage()); } } @@ -66,7 +66,7 @@ public class SampleEntrustController { if (response.isSuccess()) { return success(response.getContextBean(SampleEntrustContext.class)); } else { - return error(500, response.getMessage()); + return error(1_032_100_000, response.getMessage()); } } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleFlowController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleFlowController.java index be7aadd..5d2fcab 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleFlowController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleFlowController.java @@ -165,7 +165,7 @@ public class SampleFlowController { if (response.isSuccess()) { return success(response.getContextBean(SampleFlowContext.class)); } else { - return error(500, response.getMessage()); + return error(1_032_100_000, response.getMessage()); } //return success(FlowBus.getNodeMap()); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleTaskAssignController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleTaskAssignController.java index 8d21d95..260e0d2 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleTaskAssignController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleTaskAssignController.java @@ -13,6 +13,7 @@ import java.util.List; import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignManualParam; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignMethodParam; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignSampleParam; @@ -37,11 +38,22 @@ public class SampleTaskAssignController { List list = sampleTaskAssignService.getAssignUserList(); return success(list); } + + @GetMapping("/getAssaySampleList") + public CommonResult getAssaySampleList() { + List list = sampleTaskAssignService.getAssaySampleList(); + return success(list); + } + + @GetMapping("/getAssayMethodList") + public CommonResult getAssayMethodList(Long businessSubSampleId, Long configAssayMethodId) { + List list = sampleTaskAssignService.getAssayMethodList(businessSubSampleId, configAssayMethodId); + return success(list); + } @PostMapping("/changeMethod") - public CommonResult changeMethod() { - - + public CommonResult changeMethod(@RequestBody ChangeAssayMethodReqVO req) { + sampleTaskAssignService.changeMethod(req); return success("成功"); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/ChangeAssayMethodReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/ChangeAssayMethodReqVO.java new file mode 100644 index 0000000..85f692d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/ChangeAssayMethodReqVO.java @@ -0,0 +1,16 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import java.util.List; + +import lombok.Data; + +@Data +public class ChangeAssayMethodReqVO { + + private Long businessSubSampleId; + + private Long configAssayMethodId; + + private List changeConfigAssayMethodIdList; + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/UnAssignTaskedSubSampleRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/UnAssignTaskedSubSampleRespVO.java new file mode 100644 index 0000000..bc37318 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/UnAssignTaskedSubSampleRespVO.java @@ -0,0 +1,50 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class UnAssignTaskedSubSampleRespVO implements Serializable { + + private static final long serialVersionUID = -6009144013166409560L; + + @Schema(description = "联合id") + private String id; + + @Schema(description = "分样子样ID") + private Long businessSubSampleId; + + @Schema(description = "样品名称", example = "张三") + private String sampleName; + + @Schema(description = "样品编号") + private String sampleCode; + + @Schema(description = "分析编号") + private String sampleAssayCode; + + @Schema(description = "归库编号") + private String sampleReturnCode; + + @Schema(description = "样品流程节点时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime sampleFlowNodeTime; + + @Schema(description = "检测方法配置ID", example = "9130") + private Long configAssayMethodId; + + @Schema(description = "分析类型,【字典】【jy_sample_assay_type】单杯、双杯、平行...", example = "2") + private String assayType; + + @Schema(description = "检测项目") + private String assayProject; + + @Schema(description = "分析部门ID", example = "16988") + private Long assayDepartmentId; + + @Schema(description = "分析部门名称", example = "芋艿") + private String assayDepartmentName; + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java index 61eff5a..686963b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.java @@ -170,6 +170,40 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX() .eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId)); } + + /** + * 根据子样查询分析任务 + * @param businessSubSampleId 子样id + * @return + */ + default List selectByBusinessSubSampleId(Long businessSubSampleId) { + return selectList(new LambdaQueryWrapperX() + .eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)); + } + + /** + * 根据子样查询分析任务 + * @param businessSubSampleId 子样id + * @param configAssayMethodId 分析方法 + * @return + */ + default List selectByBusinessSubSampleIdAndConfigAssayMethodId(Long businessSubSampleId, Long configAssayMethodId) { + return selectList(new LambdaQueryWrapperX() + .eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId) + .eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId)); + } + + /** + * 根据分样查询分析任务 + * @param businessSubParentSampleId 分样样id + * @param configAssayMethodId 分析方法 + * @return + */ + default List selectByBusinessSubParentSampleIdAndConfigAssayMethodId(Long businessSubParentSampleId, Long configAssayMethodId) { + return selectList(new LambdaQueryWrapperX() + .eq(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, businessSubParentSampleId) + .eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId)); + } /** * 查询是否上报的分析任务 @@ -211,4 +245,9 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX selectUnAssignTaskedSubSample(); } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustCheckCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustCheckCmp.java index 1086403..9400550 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustCheckCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustCheckCmp.java @@ -24,11 +24,11 @@ public class SampleEntrustCheckCmp extends NodeComponent { if (sampleEntrustRegistration.getConfigEntrustSourceId() == null) { - throw new ServiceException(500, "委托来源id不允许为空"); + throw new ServiceException(1_032_100_000, "委托来源id不允许为空"); } ConfigEntrustSourceDO configEntrustSource = sampleEntrustContext.getConfigEntrustSourceById(sampleEntrustRegistration.getConfigEntrustSourceId()); if (configEntrustSource == null) { - throw new ServiceException(500, "委托来源id不正确"); + throw new ServiceException(1_032_100_000, "委托来源id不正确"); } sampleEntrustRegistration.setDataCheckStatus(QmsCommonConstant.SUCCESS); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustContextInitCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustContextInitCmp.java index 511b548..d8f960a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustContextInitCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustContextInitCmp.java @@ -64,7 +64,7 @@ public class SampleEntrustContextInitCmp extends NodeComponent { SampleEntrustParam sampleEntrustParam = this.getRequestData(); if (sampleEntrustParam == null) { - throw new ServiceException(500, "样品委托参数不允许为空"); + throw new ServiceException(1_032_100_000, "样品委托参数不允许为空"); } //获取样品委托上下文 @@ -99,14 +99,14 @@ public class SampleEntrustContextInitCmp extends NodeComponent { //委托来源id为空并且委托来源key也为空 if (sampleEntrustParam.getConfigEntrustSourceId() == null && StringUtils.isBlank(sampleEntrustParam.getConfigEntrustSourceKey())) { - throw new ServiceException(500, "委托来源id或委托来源key为空"); + throw new ServiceException(1_032_100_000, "委托来源id或委托来源key为空"); } //委托来源的id为空 if (sampleEntrustParam.getConfigEntrustSourceId() == null && StringUtils.isNotBlank(sampleEntrustParam.getConfigEntrustSourceKey()) && StringUtils.isNotBlank(sampleEntrustParam.getEntrustType())) { ConfigEntrustSourceDO configEntrustSourceDO = configEntrustSourceList.stream().filter(f -> f.getKey().equals(sampleEntrustParam.getConfigEntrustSourceKey()) && f.getEntrustType().equals(sampleEntrustParam.getEntrustType())).findFirst().orElse(null); if (configEntrustSourceDO == null) { - throw new ServiceException(500, "样品委托来源不正确"); + throw new ServiceException(1_032_100_000, "样品委托来源不正确"); } sampleEntrustRegistration.setConfigEntrustSourceId(configEntrustSourceDO.getId()); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java index aded939..b450819 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/entrust/SampleEntrustGenSampleDataCmp.java @@ -217,7 +217,7 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent { //查询当前委托样品对应的子样 List entrustConfigSubSampleList = configSubSampleList.stream().filter(f -> configSubSampleIdList.contains(f.getId()) && f.getBaseSampleId().equals(businessSampleEntrustDetailDO.getBaseSampleId())).distinct().collect(Collectors.toList()); if (entrustConfigSubSampleList.size() != 1) { - throw new ServiceException(500, "子样配置不正确"); + throw new ServiceException(1_032_100_000, "子样配置不正确"); } //获取到子样配置 ConfigSubSampleDO configSubSample = entrustConfigSubSampleList.get(0); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleFlowContextInitCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleFlowContextInitCmp.java index 2a60e84..d6d05ec 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleFlowContextInitCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleFlowContextInitCmp.java @@ -41,11 +41,11 @@ public class SampleFlowContextInitCmp extends NodeComponent { SampleFlowParam sampleFlowParam = this.getRequestData(); if (StringUtils.isBlank(sampleFlowParam.getCurrentSampleFlowKey())) { - new ServiceException(500, "样品流程节点currentSampleFlowKey不允许为空"); + new ServiceException(1_032_100_000, "样品流程节点currentSampleFlowKey不允许为空"); } List sampleFlowInfoList = sampleFlowParam.getSampleFlowInfoList(); if (CollUtil.isEmpty(sampleFlowInfoList)) { - new ServiceException(500, "样品流转列表不允许为空"); + new ServiceException(1_032_100_000, "样品流转列表不允许为空"); } List sampleIdList = sampleFlowInfoList.stream().map(m -> m.getId()).collect(Collectors.toList()); SampleFlowContext sampleFlowContext = this.getContextBean(SampleFlowContext.class); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubCheckCmp.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubCheckCmp.java index bb7f82a..ad1abd9 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubCheckCmp.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/liteflow/sample/flow/SampleSubCheckCmp.java @@ -42,7 +42,7 @@ public class SampleSubCheckCmp extends NodeComponent { String currentSampleFlowKey = sampleFlowContext.getCurrentSampleFlowKey(); List sampleIdList = sampleFlowContext.getSampleIdList(); if (CollUtil.isEmpty(sampleIdList)) { - throw new ServiceException(500, "样品ID列表不允许为空"); + throw new ServiceException(1_032_100_000, "样品ID列表不允许为空"); } List businessSubSampleDOList = businessSubSampleMapper.selectByIds(sampleIdList); @@ -56,7 +56,7 @@ public class SampleSubCheckCmp extends NodeComponent { boolean isSampleFlowKeyFail = businessSubSampleDOList.stream().anyMatch(p -> !p.getSampleFlowNodeKey().equals(currentSampleFlowKey)); if (isSampleFlowKeyFail) { - throw new ServiceException(500, "样品列表与当前流程不符"); + throw new ServiceException(1_032_100_000, "样品列表与当前流程不符"); } List configSubSampleIdList = businessSubSampleDOList.stream().map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList()); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java index 795e124..eb8c42c 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisAuditServiceImpl.java @@ -336,7 +336,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic // 查找匹配的允差规则 ConfigAssayMethodProjectAssessmentDO matchedRule = findMatchingRule(configAssayMethodProjectAssessmentDOList, representativeValue); if (matchedRule == null) { - throw new ServiceException(500, "未找到超差判定区间范围,元素ID: " + dictionaryProjectId + ", 值: " + representativeValue); + throw new ServiceException(1_032_100_000, "未找到超差判定区间范围,元素ID: " + dictionaryProjectId + ", 值: " + representativeValue); } // 计算允差值 @@ -344,7 +344,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic try { allowValue = allowanceCalculatorComponent.calculateAllowableValue(new BigDecimal(matchedRule.getMinimumValue()), new BigDecimal(matchedRule.getMaximumValue()), new BigDecimal(matchedRule.getMinimumToleraanceValue()), new BigDecimal(matchedRule.getMaximumToleraanceValue()), new BigDecimal(matchedRule.getToleraanceAdjustmentValue()), representativeValue, matchedRule.getIsUseFormula(), matchedRule.getFormula(), elementScale); } catch (Exception e) { - throw new ServiceException(500, "超差判定计算出错,检测项目ID: " + dictionaryProjectId); + throw new ServiceException(1_032_100_000, "超差判定计算出错,检测项目ID: " + dictionaryProjectId); } // 判断相邻差值是否超差 @@ -477,7 +477,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic String nickName = SecurityFrameworkUtils.getLoginUserNickname(); List unReportedList = businessAssayTaskDataMapper.selectIsReportedList(null, businessSubSampleId, configAssayMethodId, QmsCommonConstant.NO); if (unReportedList.size() > 0) { - throw new ServiceException(500, "存在未上报的数据"); + throw new ServiceException(1_032_100_000, "存在未上报的数据"); } List saveBusinessAssayReportDataDOList = new ArrayList<>(); List updateBusinessAssayReportDataDOList = new ArrayList<>(); @@ -605,7 +605,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic //子样配置数据 ConfigSubSampleDO configSubSampleDO = configSubSampleMapper.selectById(businessSubSampleDO.getConfigSubSampleId()); if (StringUtils.isBlank(configSubSampleDO.getRecheckFlowNodeKey())) { - throw new ServiceException(500, "未配置复检流程,不能发起复检委托!"); + throw new ServiceException(1_032_100_000, "未配置复检流程,不能发起复检委托!"); } List newBusinessAssayTaskDataDOList = new ArrayList<>(); @@ -752,7 +752,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic // 查找匹配的允差规则 ConfigAssayMethodProjectAssessmentDO matchedRule = findMatchingRule(configAssayMethodProjectAssessmentDOList, representativeValue); if (matchedRule == null) { - throw new ServiceException(500, "未找到超差判定区间范围,元素ID: " + businessSubSampleAssessmentDO.getDictionaryProjectId() + ", 值: " + representativeValue); + throw new ServiceException(1_032_100_000, "未找到超差判定区间范围,元素ID: " + businessSubSampleAssessmentDO.getDictionaryProjectId() + ", 值: " + representativeValue); } // 计算允差值 @@ -760,7 +760,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic try { allowValue = allowanceCalculatorComponent.calculateAllowableValue(new BigDecimal(matchedRule.getMinimumValue()), new BigDecimal(matchedRule.getMaximumValue()), new BigDecimal(matchedRule.getMinimumToleraanceValue()), new BigDecimal(matchedRule.getMaximumToleraanceValue()), new BigDecimal(matchedRule.getToleraanceAdjustmentValue()), representativeValue, matchedRule.getIsUseFormula(), matchedRule.getFormula(), elementScale); } catch (Exception e) { - throw new ServiceException(500, "超差判定计算出错,检测项目ID: " + businessSubSampleAssessmentDO.getDictionaryProjectId()); + throw new ServiceException(1_032_100_000, "超差判定计算出错,检测项目ID: " + businessSubSampleAssessmentDO.getDictionaryProjectId()); } // 判断相邻差值是否超差 diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisServiceImpl.java index 08ddff3..b9bfb66 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleAnalysisServiceImpl.java @@ -89,7 +89,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService { BusinessAssayTaskAnalysisSampleProjectRespVO businessAssayTaskAnalysisSampleProjectRespVO = new BusinessAssayTaskAnalysisSampleProjectRespVO(); BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId); if (businessAssayTaskDO == null) { - throw new ServiceException(500, "未找到任务分配单"); + throw new ServiceException(1_032_100_000, "未找到任务分配单"); } businessAssayTaskAnalysisSampleProjectRespVO.setBusinessAssayTaskId(businessAssayTaskId); businessAssayTaskAnalysisSampleProjectRespVO.setBusinessAssayTasNo(businessAssayTaskDO.getTaskNo()); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleEntrustServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleEntrustServiceImpl.java index 89a2e0f..0b7482f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleEntrustServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleEntrustServiceImpl.java @@ -65,7 +65,7 @@ public class SampleEntrustServiceImpl implements SampleEntrustService { LiteflowResponse response = flowExecutor.execute2Resp("sampleEntrustChain" + tenantId, sampleEntrustParam, SampleEntrustContext.class); if (!response.isSuccess()){ log.error("创建委托登记失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } return response; } @@ -111,7 +111,7 @@ public class SampleEntrustServiceImpl implements SampleEntrustService { LiteflowResponse response = flowExecutor.execute2Resp("sampleEntrustChain" + tenantId, sampleEntrustParam, SampleEntrustContext.class); if (!response.isSuccess()){ log.error("更新委托登记失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } return response; } @@ -120,10 +120,10 @@ public class SampleEntrustServiceImpl implements SampleEntrustService { @Transactional(rollbackFor = Exception.class) public void delete(Long id) { if (id == null) { - throw new ServiceException(500, "委托登记id不允许为空"); + throw new ServiceException(1_032_100_000, "委托登记id不允许为空"); } if (businessSampleEntrustRegistrationMapper.selectById(id) == null) { - throw new ServiceException(500, "委托登记业务不存在"); + throw new ServiceException(1_032_100_000, "委托登记业务不存在"); } List sampleEntrustDetailList = businessSampleEntrustDetailMapper.selectList(new LambdaQueryWrapperX().eq(BusinessSampleEntrustDetailDO::getBusinessSampleEntrustRegistrationId, id)); @@ -154,11 +154,11 @@ public class SampleEntrustServiceImpl implements SampleEntrustService { @Transactional(rollbackFor = Exception.class) public void deleteList(List ids) { if (ids == null || ids.size() <= 0) { - throw new ServiceException(500, "委托登记id列表不允许为空"); + throw new ServiceException(1_032_100_000, "委托登记id列表不允许为空"); } List sampleEntrustRegistrationList = businessSampleEntrustRegistrationMapper.selectByIds(ids); if (CollUtil.isEmpty(sampleEntrustRegistrationList) || sampleEntrustRegistrationList.size() != ids.size()) { - throw new ServiceException(500, "委托登记业务不存在"); + throw new ServiceException(1_032_100_000, "委托登记业务不存在"); } List sampleEntrustDetailList = businessSampleEntrustDetailMapper.selectList(new LambdaQueryWrapperX().in(BusinessSampleEntrustDetailDO::getBusinessSampleEntrustRegistrationId, ids)); @@ -190,7 +190,7 @@ public class SampleEntrustServiceImpl implements SampleEntrustService { Long tenantId = TenantContextHolder.getRequiredTenantId(); BusinessSampleEntrustRegistrationDO sampleEntrustRegistration = businessSampleEntrustRegistrationMapper.selectById(req.getId()); if (sampleEntrustRegistration == null) { - throw new ServiceException(500, "委托登记业务不存在"); + throw new ServiceException(1_032_100_000, "委托登记业务不存在"); } SampleEntrustParam sampleEntrustParam = BeanUtils.toBean(sampleEntrustRegistration, SampleEntrustParam.class); sampleEntrustParam.setIsReceiveSample(req.getIsReceiveSample()); @@ -217,7 +217,7 @@ public class SampleEntrustServiceImpl implements SampleEntrustService { LiteflowResponse response = flowExecutor.execute2Resp("sampleEntrustSubmitChain" + tenantId, sampleEntrustParam, SampleEntrustContext.class); if (!response.isSuccess()){ log.error("提交委托登记失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleFlowServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleFlowServiceImpl.java index 2e7f493..cd682b1 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleFlowServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleFlowServiceImpl.java @@ -27,7 +27,7 @@ public class SampleFlowServiceImpl implements SampleFlowService { LiteflowResponse response = flowExecutor.execute2Resp("sampleFlowChain" + tenantId, sampleFlowParam, SampleFlowContext.class); if (!response.isSuccess()){ log.error("样品流转失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } return response; } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignService.java index dd25b32..1ae6995 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignService.java @@ -4,6 +4,7 @@ import java.util.List; import com.yomahub.liteflow.flow.LiteflowResponse; import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignManualParam; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignMethodParam; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignSampleParam; @@ -16,6 +17,26 @@ public interface SampleTaskAssignService { * @return */ List getAssignUserList(); + + /** + * 获取未指派任务子样信息 + * @return + */ + List getAssaySampleList(); + + /** + * 根据子样id查询分析方法 + * @param businessSubSampleId + * @param configAssayMethodId + * @return + */ + List getAssayMethodList(Long businessSubSampleId, Long configAssayMethodId); + + /** + * 修改分析方法 + * @param req + */ + void changeMethod(ChangeAssayMethodReqVO req); /** * 按方法分配任务 @@ -54,4 +75,5 @@ public interface SampleTaskAssignService { */ void removeAssignTaskDetail(BatchDeleteReqVO req); + } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignServiceImpl.java index a12ebdb..5346de9 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleTaskAssignServiceImpl.java @@ -2,12 +2,16 @@ package com.zt.plat.module.qms.business.bus.service; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; @@ -19,16 +23,33 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.security.core.LoginUser; import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; import com.zt.plat.framework.tenant.core.context.TenantContextHolder; +import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayParameterDataDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayParameterDataMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayProjectDataMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayReportDataMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDetailMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignManualParam; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignMethodParam; import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignSampleParam; import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleTaskAssignContext; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodProjectExtendRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodExtendRespVO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectParameterDO; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectParameterMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper; +import com.zt.plat.module.qms.business.dic.dal.mapper.DictionaryProjectMapper; import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.module.system.api.dept.DeptApi; import com.zt.plat.module.system.api.dept.dto.DeptRespDTO; @@ -56,8 +77,32 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService { @Resource private BusinessAssayTaskDetailMapper businessAssayTaskDetailMapper; + @Resource + private BusinessSubSampleMapper businessSubSampleMapper; + @Resource private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; + + @Resource + private BusinessAssayProjectDataMapper businessAssayProjectDataMapper; + + @Resource + private BusinessAssayParameterDataMapper businessAssayParameterDataMapper; + + @Resource + private BusinessAssayReportDataMapper businessAssayReportDataMapper; + + @Resource + private ConfigSubSampleMethodMapper configSubSampleMethodMapper; + + @Resource + private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper; + + @Resource + private ConfigAssayMethodProjectParameterMapper configAssayMethodProjectParameterMapper; + + @Resource + private DictionaryProjectMapper dictionaryProjectMapper; @Override public List getAssignUserList() { @@ -80,20 +125,221 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService { return userListResult.getCheckedData(); } + @Override + public List getAssaySampleList() { + List list = businessAssayTaskDataMapper.selectUnAssignTaskedSubSample(); + return list; + } + + @Override + public List getAssayMethodList(Long businessSubSampleId, Long configAssayMethodId) { + List resutList = new ArrayList<>(); + //当前登录用户 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + Long visitDeptId = loginUser.getVisitDeptId(); + + //子样 + BusinessSubSampleDO businessSubSampleDO = businessSubSampleMapper.selectById(businessSubSampleId); + //原检测项目 + List oldConfigAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configAssayMethodId); + //原检测项目字典id列表 + List oldDictionaryProjectIdList = oldConfigAssayMethodProjectList.stream().map(m -> m.getDictionaryProjectId()).collect(Collectors.toList()); + + + //子样对应的检测任务 + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubSampleId(businessSubSampleId); + + //查询子样配置的方法 + List configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdAndAssayDepartmentId(businessSubSampleDO.getConfigSubSampleId(), visitDeptId); + + JSONObject jsonObject = null; + for (ConfigSubSampleMethodExtendRespVO configSubSampleMethod : configSubSampleMethodList) { + jsonObject = new JSONObject(); + jsonObject.put("configAssayMethodId", configSubSampleMethod.getConfigAssayMethodId()); + jsonObject.put("configAssayMethodName", configSubSampleMethod.getConfigAssayMethodName()); + jsonObject.put("configAssayMethodCode", configSubSampleMethod.getConfigAssayMethodCode()); + + StringBuilder assayProjectBuilder = new StringBuilder(); + List configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configSubSampleMethod.getConfigAssayMethodId()); + + //判定是否存在原检测项目 + boolean isExistProject = configAssayMethodProjectList.stream().anyMatch(m -> oldDictionaryProjectIdList.contains(m.getDictionaryProjectId())); + if (!isExistProject) {//如果不存在,则跳出循环 + continue; + } + + + for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProject : configAssayMethodProjectList) { + assayProjectBuilder.append(configAssayMethodProject.getShowName()).append(","); + } + assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length()); + + jsonObject.put("assayProject", assayProjectBuilder.toString()); + + boolean checked = businessAssayTaskDataDOList.stream().anyMatch(m -> m.getConfigAssayMethodId().equals(configSubSampleMethod.getConfigAssayMethodId())); + boolean disabled = businessAssayTaskDataDOList.stream().anyMatch(m -> m.getConfigAssayMethodId().equals(configSubSampleMethod.getConfigAssayMethodId()) && m.getIsAssignTasked().equals(QmsCommonConstant.YES)); + jsonObject.put("checked", checked); + jsonObject.put("disabled", disabled); + + resutList.add(jsonObject); + } + + return resutList; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void changeMethod(ChangeAssayMethodReqVO req) { + + List updateBusinessAssayReportDataDOList = new ArrayList<>(); + List saveBusinessAssayTaskDataDOList = new ArrayList<>(); + List saveBusinessAssayProjectDataDOList = new ArrayList<>(); + List saveBusinessAssayParameterDataDOList = new ArrayList<>(); + + List removeProjectIdList = new ArrayList<>(); + List removeParameterIdList = new ArrayList<>(); + //子样 + BusinessSubSampleDO businessSubSampleDO = businessSubSampleMapper.selectById(req.getBusinessSubSampleId()); + + //查询检测任务 + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubSampleDO.getBusinessSubParentSampleId(), req.getConfigAssayMethodId()); + + boolean disabled = businessAssayTaskDataDOList.stream().anyMatch(m -> m.getIsAssignTasked().equals(QmsCommonConstant.YES)); + if (disabled) { + throw new ServiceException(10010, "当前样品存在已分配任务,不允许修改分析方法"); + } + //查询报表数据 + List businessAssayReportDataDOList = businessAssayReportDataMapper.selectBytBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + for (BusinessAssayReportDataDO businessAssayReportDataDO : businessAssayReportDataDOList) { + String dataSource = businessAssayReportDataDO.getDataSource(); + if (dataSource.contains(req.getConfigAssayMethodId().toString())) {//判定是否存在 + List dataSourceList = new ArrayList<>(); + String[] dataSourceSplit = dataSource.split(","); + for (int i = 0; i < dataSourceSplit.length; i++) { + dataSourceList.add(Long.parseLong(dataSourceSplit[i])); + } + //移除当前的 + dataSourceList.remove(req.getConfigAssayMethodId()); + //添加新的 + dataSourceList.addAll(req.getChangeConfigAssayMethodIdList()); + + //重新赋值 + businessAssayReportDataDO.setDataSource(CollUtil.join(dataSourceList, ",")); + + //添加到更新列表 + updateBusinessAssayReportDataDOList.add(businessAssayReportDataDO); + } + + } + + for (BusinessAssayTaskDataDO businessAssayTaskDataDO : businessAssayTaskDataDOList) { + //查询旧的 + List businessAssayProjectDataExtendRespVOs = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskDataDO.getId()); + List businessAssayProjectDataIdList = businessAssayProjectDataExtendRespVOs.stream().map(m -> m.getId()).collect(Collectors.toList()); + removeProjectIdList.addAll(businessAssayProjectDataIdList); + List businessAssayParameterDataDOList = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIds(businessAssayProjectDataIdList); + List businessAssayParameterDataDOIdList = businessAssayParameterDataDOList.stream().map(m -> m.getId()).collect(Collectors.toList()); + removeParameterIdList.addAll(businessAssayParameterDataDOIdList); + + int i = 0; + for (Long configAssayMethodId : req.getChangeConfigAssayMethodIdList()) { + Long businessAssayTaskDataId = null; + if (i == 0) { + businessAssayTaskDataId = businessAssayTaskDataDO.getId(); + businessAssayTaskDataDO.setConfigAssayMethodId(configAssayMethodId); + } else { + businessAssayTaskDataId = IdWorker.getId(); + BusinessAssayTaskDataDO newBusinessAssayTaskDataDO = new BusinessAssayTaskDataDO(); + newBusinessAssayTaskDataDO.setId(businessAssayTaskDataId); + newBusinessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + newBusinessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + newBusinessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId()); + newBusinessAssayTaskDataDO.setConfigAssayMethodId(configAssayMethodId); + newBusinessAssayTaskDataDO.setAssayType(businessAssayTaskDataDO.getAssayType()); + newBusinessAssayTaskDataDO.setTaskType(businessAssayTaskDataDO.getTaskType()); + newBusinessAssayTaskDataDO.setConfigSampleFlowId(businessAssayTaskDataDO.getConfigSampleFlowId()); + newBusinessAssayTaskDataDO.setSampleFlowNodeKey(businessAssayTaskDataDO.getSampleFlowNodeKey()); + newBusinessAssayTaskDataDO.setSampleFlowNodeTime(businessAssayTaskDataDO.getSampleFlowNodeTime()); + newBusinessAssayTaskDataDO.setAssayDepartmentId(businessAssayTaskDataDO.getAssayDepartmentId()); + newBusinessAssayTaskDataDO.setAssayDepartmentName(businessAssayTaskDataDO.getAssayDepartmentName()); + + saveBusinessAssayTaskDataDOList.add(newBusinessAssayTaskDataDO); + } + + //查询新的检测项目 + List configAssayMethodProjectDOList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(businessAssayTaskDataDO.getConfigAssayMethodId()); + + StringBuilder assayProjectBuilder = new StringBuilder(); + + for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) { + assayProjectBuilder.append(configAssayMethodProjectDO.getShowName()).append(","); + + //检测项目 + BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO(); + businessAssayProjectDataDO.setId(IdWorker.getId()); + businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId()); + businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId()); + businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId()); + businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType()); + businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition()); + businessAssayProjectDataDO.setIsEnabled(1); + businessAssayProjectDataDO.setIsNotAssessment(0); + + saveBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO); + + List configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterMapper.selectByConfigAssayMethodProjectId(configAssayMethodProjectDO.getId()); + for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) { + BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO(); + businessAssayParameterDataDO.setId(IdWorker.getId()); + businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId()); + businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId()); + businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); + businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); + businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); + + + saveBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO); + } + } + + i++; + } + + + } + + businessAssayTaskDataMapper.updateBatch(businessAssayTaskDataDOList); + businessAssayProjectDataMapper.deleteByIds(removeProjectIdList); + businessAssayParameterDataMapper.deleteByIds(removeParameterIdList); + //更新报表数据来源 + if (updateBusinessAssayReportDataDOList.size() > 0) { + businessAssayReportDataMapper.updateBatch(updateBusinessAssayReportDataDOList); + } + if (saveBusinessAssayTaskDataDOList.size() > 0) { + businessAssayTaskDataMapper.insertBatch(saveBusinessAssayTaskDataDOList); + } + if (saveBusinessAssayProjectDataDOList.size() > 0) { + businessAssayProjectDataMapper.insertBatch(saveBusinessAssayProjectDataDOList); + } + if (saveBusinessAssayParameterDataDOList.size() > 0) { + businessAssayParameterDataMapper.insertBatch(saveBusinessAssayParameterDataDOList); + } + } + @Override @Transactional(rollbackFor = Exception.class) public LiteflowResponse methodAssign(SampleTaskAssignMethodParam param) { if (param.getConfigAssayMethodId() == null) { - throw new ServiceException(500, "无分析方法"); + throw new ServiceException(1_032_100_000, "无分析方法"); } if (CollUtil.isEmpty(param.getAssignAssayUserList())) { - throw new ServiceException(500, "无任务分配人员"); + throw new ServiceException(1_032_100_000, "无任务分配人员"); } Long tenantId = TenantContextHolder.getRequiredTenantId(); LiteflowResponse response = flowExecutor.execute2Resp("sampleTaskAssignChain" + tenantId, param, SampleTaskAssignContext.class); if (!response.isSuccess()){ log.error("按方法分配任务失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } return response; } @@ -102,16 +348,16 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService { @Transactional(rollbackFor = Exception.class) public LiteflowResponse sampleAssign(SampleTaskAssignSampleParam param) { if (param.getAssignAssayUser() == null) { - throw new ServiceException(500, "无任务分配人员"); + throw new ServiceException(1_032_100_000, "无任务分配人员"); } if (CollUtil.isEmpty(param.getAssignSampleIdList())) { - throw new ServiceException(500, "无任务分配样品"); + throw new ServiceException(1_032_100_000, "无任务分配样品"); } Long tenantId = TenantContextHolder.getRequiredTenantId(); LiteflowResponse response = flowExecutor.execute2Resp("sampleTaskAssignChain" + tenantId, param, SampleTaskAssignContext.class); if (!response.isSuccess()){ log.error("按样品分配任务失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } return response; } @@ -120,16 +366,16 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService { @Transactional(rollbackFor = Exception.class) public LiteflowResponse manualAssign(SampleTaskAssignManualParam param) { if (param.getAssignAssayUser() == null) { - throw new ServiceException(500, "无任务分配人员"); + throw new ServiceException(1_032_100_000, "无任务分配人员"); } if (CollUtil.isEmpty(param.getAssayTaskDataIdList())) { - throw new ServiceException(500, "无分配的检测任务"); + throw new ServiceException(1_032_100_000, "无分配的检测任务"); } Long tenantId = TenantContextHolder.getRequiredTenantId(); LiteflowResponse response = flowExecutor.execute2Resp("sampleTaskAssignChain" + tenantId, param, SampleTaskAssignContext.class); if (!response.isSuccess()){ log.error("手动分配任务失败", response.getCause()); - throw new ServiceException(500, response.getCause().getMessage()); + throw new ServiceException(1_032_100_000, response.getCause().getMessage()); } return response; } @@ -148,7 +394,7 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService { public void voidAssign(Long id) { BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(id); if (QmsCommonConstant.SUBMITTED.equals(businessAssayTaskDO.getTaskAssignStatus())) { - throw new ServiceException(500, "任务已提交,不允许作废"); + throw new ServiceException(1_032_100_000, "任务已提交,不允许作废"); } businessAssayTaskDO.setTaskAssignStatus(QmsCommonConstant.VOID); @@ -163,6 +409,7 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService { } @Override + @Transactional(rollbackFor = Exception.class) public void removeAssignTaskDetail(BatchDeleteReqVO req) { List businessAssayTaskDetailDOList = businessAssayTaskDetailMapper.selectByIds(req.getIds()); List businessAssayTaskDataIdList = businessAssayTaskDetailDOList.stream().map(m -> m.getBusinessAssayTaskDataId()).collect(Collectors.toList()); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigReportTemplateController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigReportTemplateController.java index d8b7a72..67641ee 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigReportTemplateController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigReportTemplateController.java @@ -502,7 +502,7 @@ public class ConfigReportTemplateController implements BusinessControllerMarker log.error("生成base64图片失败", e); } if (StringUtils.isBlank(imgBase64)) { - return CommonResult.error(500, "生成Base64图片失败"); + return CommonResult.error(1_032_100_000, "生成Base64图片失败"); } return success(imgBase64); } @@ -535,7 +535,7 @@ public class ConfigReportTemplateController implements BusinessControllerMarker log.error("生成base64图片失败", e); } if (StringUtils.isBlank(imgBase64)) { - return CommonResult.error(500, "生成Base64图片失败"); + return CommonResult.error(1_032_100_000, "生成Base64图片失败"); } return success(imgBase64); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigSubSampleMethodExtendRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigSubSampleMethodExtendRespVO.java new file mode 100644 index 0000000..9cce8d3 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigSubSampleMethodExtendRespVO.java @@ -0,0 +1,19 @@ +package com.zt.plat.module.qms.business.config.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class ConfigSubSampleMethodExtendRespVO extends ConfigSubSampleMethodRespVO { + + /** 分析方法名称 **/ + @Schema(description = "分析方法名称") + private String configAssayMethodName; + + /** 分析方法编号 **/ + @Schema(description = "分析方法编号") + private String configAssayMethodCode; + + @Schema(description = "检测项目") + private String assayProject; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectParameterMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectParameterMapper.java index bc74b61..0ef80f1 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectParameterMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigAssayMethodProjectParameterMapper.java @@ -6,6 +6,9 @@ import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodProjectParameterPageReqVO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectParameterDO; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; + +import java.util.List; + import org.apache.ibatis.annotations.Mapper; /** @@ -33,5 +36,10 @@ public interface ConfigAssayMethodProjectParameterMapper extends BaseMapperX selectByConfigAssayMethodProjectId(Long configAssayMethodProjectId) { + return selectList(new LambdaQueryWrapperX() + .eq(ConfigAssayMethodProjectParameterDO::getConfigAssayMethodProjectId, configAssayMethodProjectId)); + } } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java index 7c2ea5d..cdd6daa 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleMethodMapper.java @@ -2,10 +2,15 @@ package com.zt.plat.module.qms.business.config.dal.mapper; import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodPageReqVO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleMethodDO; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; + +import java.util.List; + import org.apache.ibatis.annotations.Mapper; /** @@ -27,5 +32,15 @@ public interface ConfigSubSampleMethodMapper extends BaseMapperX selectByConfigSubSampleIdAndAssayDepartmentId(Long configSubSampleId, Long assayDepartmentId) { + return selectJoinList(ConfigSubSampleMethodExtendRespVO.class, new MPJLambdaWrapperX() + .leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, ConfigSubSampleMethodDO::getConfigAssayMethodId) + .selectAll(ConfigSubSampleMethodDO.class) + .selectAs(ConfigAssayMethodDO::getName, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodName) + .selectAs(ConfigAssayMethodDO::getMethodCode, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodCode) + .eq(ConfigSubSampleMethodDO::getConfigSubSampleId, configSubSampleId) + .eq(ConfigAssayMethodDO::getAssayDepartmentId, assayDepartmentId)); + } } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/code/SequenceUtil.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/code/SequenceUtil.java index cfa6d1a..b8d970a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/code/SequenceUtil.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/core/code/SequenceUtil.java @@ -25,7 +25,7 @@ public class SequenceUtil { */ public String genCode(String sequenceCode) { if (sequenceApi == null) { - throw new ServiceException(500, "序列号服务为空"); + throw new ServiceException(1_032_100_000, "序列号服务为空"); } String circulationValue = null; List inputStrs = null; @@ -40,7 +40,7 @@ public class SequenceUtil { if (result != null && result.isSuccess() && result.getData() != null) { return result.getData(); } - throw new ServiceException(500, "调用远程服务获取序列号异常"); + throw new ServiceException(1_032_100_000, "调用远程服务获取序列号异常"); } } diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.xml index 6c6d477..fea3294 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.xml +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayTaskDataMapper.xml @@ -51,5 +51,39 @@ tbatd.ASY_TP, tcam.NAME + + \ No newline at end of file