From 313e80b1b27b5e6116e9e5f7cb30968b6e25331a Mon Sep 17 00:00:00 2001 From: wxr Date: Wed, 29 Oct 2025 09:12:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=8A=A5=E9=80=81=E5=88=9D?= =?UTF-8?q?=E6=AD=A5=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...inessSubSampleParentRecheckController.java | 106 ++++ .../admin/SampleAnalysisAuditController.java | 3 - .../SampleResultReportingController.java | 73 +++ .../vo/BatchResultDataReportingReqVO.java | 13 + .../vo/BusinessAssayTaskDataGroupRespVO.java | 12 - ...SubParentSampleAssessmentExtendRespVO.java | 20 + ...sSubParentSampleAssessmentGroupRespVO.java | 13 + ...sinessSubSampleAssessmentExtendRespVO.java | 4 + .../BusinessSubSampleAssessmentPageReqVO.java | 3 + .../vo/BusinessSubSampleAssessmentRespVO.java | 3 + .../BusinessSubSampleAssessmentSaveReqVO.java | 3 + ...sinessSubSampleParentRecheckPageReqVO.java | 50 ++ .../BusinessSubSampleParentRecheckRespVO.java | 63 +++ ...sinessSubSampleParentRecheckSaveReqVO.java | 52 ++ ...ReportSubParentSampleAssessmentRespVO.java | 21 + .../vo/RecheckSubSampleParentCreateReqVO.java | 26 + .../RecheckSubSampleParentMethodRespVO.java | 31 ++ .../BusinessSubSampleParentRecheckDO.java | 85 +++ .../mapper/BusinessAssayTaskDataMapper.java | 12 + ...sinessSubParentSampleAssessmentMapper.java | 30 ++ .../BusinessSubSampleAssessmentMapper.java | 34 +- .../BusinessSubSampleParentRecheckMapper.java | 36 ++ ...BusinessSubSampleParentRecheckService.java | 62 +++ ...nessSubSampleParentRecheckServiceImpl.java | 91 ++++ .../SampleAnalysisAuditServiceImpl.java | 44 ++ .../service/SampleAnalysisServiceImpl.java | 5 +- .../service/SampleResultReportingService.java | 23 + .../SampleResultReportingServiceImpl.java | 491 ++++++++++++++++++ .../MaterialAssayStandardMethodPageReqVO.java | 3 + .../vo/MaterialAssayStandardMethodRespVO.java | 3 + .../MaterialAssayStandardMethodSaveReqVO.java | 3 + .../MaterialAssayStandardMethodDO.java | 5 + .../ConfigSubSampleParentMethodMapper.java | 12 + .../MaterialAssayStandardMethodMapper.java | 1 + ...usinessSubParentSampleAssessmentMapper.xml | 102 ++++ .../BusinessSubSampleParentRecheckMapper.xml | 12 + 36 files changed, 1533 insertions(+), 17 deletions(-) create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSubSampleParentRecheckController.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleResultReportingController.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BatchResultDataReportingReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentExtendRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentGroupRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckPageReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckSaveReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/NoReportSubParentSampleAssessmentRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentCreateReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentMethodRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessSubSampleParentRecheckDO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleParentRecheckMapper.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleParentRecheckService.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleParentRecheckServiceImpl.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingService.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingServiceImpl.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleParentRecheckMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSubSampleParentRecheckController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSubSampleParentRecheckController.java new file mode 100644 index 0000000..a2cd20d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/BusinessSubSampleParentRecheckController.java @@ -0,0 +1,106 @@ +package com.zt.plat.module.qms.business.bus.controller.admin; + +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; + +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.util.object.BeanUtils; +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +import com.zt.plat.framework.excel.core.util.ExcelUtils; +import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleParentRecheckDO; +import com.zt.plat.module.qms.business.bus.service.BusinessSubSampleParentRecheckService; +import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; +import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; + +@Tag(name = "管理后台 - 分样复检业务数据") +@RestController +@RequestMapping("/qms/business-sub-sample-parent-recheck") +@Validated +public class BusinessSubSampleParentRecheckController implements BusinessControllerMarker { + + + @Resource + private BusinessSubSampleParentRecheckService businessSubSampleParentRecheckService; + + @PostMapping("/create") + @Operation(summary = "创建分样复检业务数据") + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:create')") + public CommonResult createBusinessSubSampleParentRecheck(@Valid @RequestBody BusinessSubSampleParentRecheckSaveReqVO createReqVO) { + return success(businessSubSampleParentRecheckService.createBusinessSubSampleParentRecheck(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新分样复检业务数据") + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:update')") + public CommonResult updateBusinessSubSampleParentRecheck(@Valid @RequestBody BusinessSubSampleParentRecheckSaveReqVO updateReqVO) { + businessSubSampleParentRecheckService.updateBusinessSubSampleParentRecheck(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除分样复检业务数据") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:delete')") + public CommonResult deleteBusinessSubSampleParentRecheck(@RequestParam("id") Long id) { + businessSubSampleParentRecheckService.deleteBusinessSubSampleParentRecheck(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除分样复检业务数据") + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:delete')") + public CommonResult deleteBusinessSubSampleParentRecheckList(@RequestBody BatchDeleteReqVO req) { + businessSubSampleParentRecheckService.deleteBusinessSubSampleParentRecheckListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得分样复检业务数据") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:query')") + public CommonResult getBusinessSubSampleParentRecheck(@RequestParam("id") Long id) { + BusinessSubSampleParentRecheckDO businessSubSampleParentRecheck = businessSubSampleParentRecheckService.getBusinessSubSampleParentRecheck(id); + return success(BeanUtils.toBean(businessSubSampleParentRecheck, BusinessSubSampleParentRecheckRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得分样复检业务数据分页") + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:query')") + public CommonResult> getBusinessSubSampleParentRecheckPage(@Valid BusinessSubSampleParentRecheckPageReqVO pageReqVO) { + PageResult pageResult = businessSubSampleParentRecheckService.getBusinessSubSampleParentRecheckPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, BusinessSubSampleParentRecheckRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出分样复检业务数据 Excel") + @PreAuthorize("@ss.hasPermission('qms:business-sub-sample-parent-recheck:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportBusinessSubSampleParentRecheckExcel(@Valid BusinessSubSampleParentRecheckPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = businessSubSampleParentRecheckService.getBusinessSubSampleParentRecheckPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "分样复检业务数据.xls", "数据", BusinessSubSampleParentRecheckRespVO.class, + BeanUtils.toBean(list, BusinessSubSampleParentRecheckRespVO.class)); + } + +} \ 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/controller/admin/SampleAnalysisAuditController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisAuditController.java index f118a96..feb4918 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisAuditController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisAuditController.java @@ -18,9 +18,6 @@ import jakarta.annotation.Resource; import static com.zt.plat.framework.common.pojo.CommonResult.success; -import java.util.List; -import java.util.Map; - /** * 分析审核 */ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleResultReportingController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleResultReportingController.java new file mode 100644 index 0000000..1874e5d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleResultReportingController.java @@ -0,0 +1,73 @@ +package com.zt.plat.module.qms.business.bus.controller.admin; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson2.JSONObject; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.service.SampleResultReportingService; + +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; + +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +import java.util.List; +import java.util.Map; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + + +/** + * 结果上报 + */ +@Tag(name = "管理后台 - 结果上报") +@RestController +@RequestMapping("/qms/bus/sample/result-reporting") +@Validated +public class SampleResultReportingController { + + @Resource + private SampleResultReportingService sampleResultReportingService; + + //获取未上报的方法 + @GetMapping("/getUnReportMethodGroupList") + public CommonResult getUnReportMethodGroupList() { + List list = sampleResultReportingService.getUnReportMethodGroupList(); + return success(list); + } + + //获取方法对应的样品 + @GetMapping("/getSampleResultReportingList") + public CommonResult getSampleResultReportingList(Long configAssayMethodId) { + JSONObject result = sampleResultReportingService.getSampleResultReportingList(configAssayMethodId); + return success(result); + } + + //获取复检方法 + @GetMapping("/getRecheckAssayMethodList") + public CommonResult getRecheckMethodList(Long baseSampleId, Long businessSubParentSampleId, Long configAssayMethodId) { + List list = sampleResultReportingService.getRecheckAssayMethodList(baseSampleId, businessSubParentSampleId, configAssayMethodId); + return success(list); + } + + //创建复检样 + @PostMapping("/createRecheckSample") + public CommonResult createRecheckSample(@RequestBody RecheckSubSampleParentCreateReqVO reqVO) { + sampleResultReportingService.createRecheckSample(reqVO); + + return success("成功"); + } + + //上报 + @PostMapping("/batchResultDataReporting") + public CommonResult batchResultDataReporting(@RequestBody BatchResultDataReportingReqVO reqVO) { + sampleResultReportingService.batchResultDataReporting(reqVO); + return success("成功"); + } + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BatchResultDataReportingReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BatchResultDataReportingReqVO.java new file mode 100644 index 0000000..c56d948 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BatchResultDataReportingReqVO.java @@ -0,0 +1,13 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import java.util.List; + +import lombok.Data; + +@Data +public class BatchResultDataReportingReqVO { + + private List businessSubParentSampleIds; + + private Long configAssayMethodId; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskDataGroupRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskDataGroupRespVO.java index 1ae16f5..8a9e48f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskDataGroupRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskDataGroupRespVO.java @@ -2,18 +2,6 @@ package com.zt.plat.module.qms.business.bus.controller.vo; import lombok.Data; -/** - * BusinessAssayTaskDataGroupRespVO - *

- * 更新历史: - *

 版本         更新时间            更新者        更新内容
- * V1.0 2025年9月20日 wxr Add
- * Copyright (C) 云南志者竟成科技有限公司 - *

- * @author 王兴荣 - * @version V1.0 - * @since 2025年9月20日 - */ @Data public class BusinessAssayTaskDataGroupRespVO { diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentExtendRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentExtendRespVO.java new file mode 100644 index 0000000..6e36f5e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentExtendRespVO.java @@ -0,0 +1,20 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class BusinessSubParentSampleAssessmentExtendRespVO extends BusinessSubParentSampleAssessmentRespVO { + + @Schema(description = "检测项目key") + private String dictionaryProjectKey; + + @Schema(description = "检测项目单位") + private String dictionaryProjectUnit; + + @Schema(description = "检测项目缩写") + private String simpleName; + + @Schema(description = "显示名称") + private String showName; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentGroupRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentGroupRespVO.java new file mode 100644 index 0000000..08373a7 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubParentSampleAssessmentGroupRespVO.java @@ -0,0 +1,13 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import lombok.Data; + +@Data +public class BusinessSubParentSampleAssessmentGroupRespVO { + + private Long configAssayMethodId; + + private String configAssayMethodName; + + private Integer sampleCount; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentExtendRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentExtendRespVO.java index 077bb5e..4fcaf8a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentExtendRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentExtendRespVO.java @@ -6,6 +6,10 @@ import lombok.Data; @Data public class BusinessSubSampleAssessmentExtendRespVO extends BusinessSubSampleAssessmentRespVO { + /** 分析方法名称 **/ + @Schema(description = "分析方法名称") + private String configAssayMethodName; + @Schema(description = "检测项目key") private String dictionaryProjectKey; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentPageReqVO.java index 881d5ee..b510534 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentPageReqVO.java @@ -13,6 +13,9 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH @Data public class BusinessSubSampleAssessmentPageReqVO extends PageParam { + @Schema(description = "分样id") + private Long businessSubParentSampleId; + @Schema(description = "分样子样ID", example = "7025") private Long businessSubSampleId; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentRespVO.java index 32f9772..a6b0904 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentRespVO.java @@ -15,6 +15,9 @@ public class BusinessSubSampleAssessmentRespVO { @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23478") @ExcelProperty("ID") private Long id; + + @Schema(description = "分样id") + private Long businessSubParentSampleId; @Schema(description = "分样子样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7025") @ExcelProperty("分样子样ID") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentSaveReqVO.java index 047d4f4..577e637 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleAssessmentSaveReqVO.java @@ -13,6 +13,9 @@ public class BusinessSubSampleAssessmentSaveReqVO { @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23478") private Long id; + + @Schema(description = "分样id") + private Long businessSubParentSampleId; @Schema(description = "分样子样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7025") @NotNull(message = "分样子样ID不能为空") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckPageReqVO.java new file mode 100644 index 0000000..c3646a8 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckPageReqVO.java @@ -0,0 +1,50 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.zt.plat.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 分样复检业务数据分页 Request VO") +@Data +public class BusinessSubSampleParentRecheckPageReqVO extends PageParam { + + @Schema(description = "样品ID", example = "19065") + private Long sampleId; + + @Schema(description = "样品主样ID", example = "26605") + private Long businessBaseSampleId; + + @Schema(description = "样品分样ID", example = "29386") + private Long businessSubParentSampleId; + + @Schema(description = "检测方法配置ID", example = "19087") + private Long configAssayMethodId; + + @Schema(description = "复检样品主样ID", example = "12742") + private Long recheckBusinessBaseSampleId; + + @Schema(description = "复检样品分样ID", example = "24043") + private Long recheckBusinessSubParentSampleId; + + @Schema(description = "复检检测方法配置ID", example = "4026") + private Long recheckConfigAssayMethodId; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "乐观锁", example = "18382") + private Integer updateCount; + + @Schema(description = "备注") + private String remark; + +} \ 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/controller/vo/BusinessSubSampleParentRecheckRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckRespVO.java new file mode 100644 index 0000000..dc1a051 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckRespVO.java @@ -0,0 +1,63 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 分样复检业务数据 Response VO") +@Data +@ExcelIgnoreUnannotated +public class BusinessSubSampleParentRecheckRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4631") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "样品ID", example = "19065") + @ExcelProperty("样品ID") + private Long sampleId; + + @Schema(description = "样品主样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26605") + @ExcelProperty("样品主样ID") + private Long businessBaseSampleId; + + @Schema(description = "样品分样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29386") + @ExcelProperty("样品分样ID") + private Long businessSubParentSampleId; + + @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19087") + @ExcelProperty("检测方法配置ID") + private Long configAssayMethodId; + + @Schema(description = "复检样品主样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12742") + @ExcelProperty("复检样品主样ID") + private Long recheckBusinessBaseSampleId; + + @Schema(description = "复检样品分样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24043") + @ExcelProperty("复检样品分样ID") + private Long recheckBusinessSubParentSampleId; + + @Schema(description = "复检检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4026") + @ExcelProperty("复检检测方法配置ID") + private Long recheckConfigAssayMethodId; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "乐观锁", requiredMode = Schema.RequiredMode.REQUIRED, example = "18382") + @ExcelProperty("乐观锁") + private Integer updateCount; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + +} \ 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/controller/vo/BusinessSubSampleParentRecheckSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckSaveReqVO.java new file mode 100644 index 0000000..b0d6802 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessSubSampleParentRecheckSaveReqVO.java @@ -0,0 +1,52 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import jakarta.validation.constraints.*; + +@Schema(description = "管理后台 - 分样复检业务数据新增/修改 Request VO") +@Data +public class BusinessSubSampleParentRecheckSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4631") + private Long id; + + @Schema(description = "样品ID", example = "19065") + private Long sampleId; + + @Schema(description = "样品主样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26605") + @NotNull(message = "样品主样ID不能为空") + private Long businessBaseSampleId; + + @Schema(description = "样品分样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29386") + @NotNull(message = "样品分样ID不能为空") + private Long businessSubParentSampleId; + + @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19087") + @NotNull(message = "检测方法配置ID不能为空") + private Long configAssayMethodId; + + @Schema(description = "复检样品主样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12742") + @NotNull(message = "复检样品主样ID不能为空") + private Long recheckBusinessBaseSampleId; + + @Schema(description = "复检样品分样ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24043") + @NotNull(message = "复检样品分样ID不能为空") + private Long recheckBusinessSubParentSampleId; + + @Schema(description = "复检检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4026") + @NotNull(message = "复检检测方法配置ID不能为空") + private Long recheckConfigAssayMethodId; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "乐观锁", requiredMode = Schema.RequiredMode.REQUIRED, example = "18382") + @NotNull(message = "乐观锁不能为空") + private Integer updateCount; + + @Schema(description = "备注") + private String remark; + +} \ 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/controller/vo/NoReportSubParentSampleAssessmentRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/NoReportSubParentSampleAssessmentRespVO.java new file mode 100644 index 0000000..58fe2c0 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/NoReportSubParentSampleAssessmentRespVO.java @@ -0,0 +1,21 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import lombok.Data; + +@Data +public class NoReportSubParentSampleAssessmentRespVO { + + private Long baseSampleId; + + private Long businessBaseSampleId; + + private Long businessSubParentSampleId; + + private Long configBaseSampleId; + + private Long configSubSampleParentId; + + private String sampleName; + + private String baseSampleName; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentCreateReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentCreateReqVO.java new file mode 100644 index 0000000..bc37688 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentCreateReqVO.java @@ -0,0 +1,26 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import java.util.List; + +import lombok.Data; + +@Data +public class RecheckSubSampleParentCreateReqVO { + + private String sampleCode; + + private String sampleName; + + private Long baseSampleId; + + private Long businessBaseSampleId; + + private Long businessSubParentSampleId; + + private Long businessSubSampleId; + + + private Long configAssayMethodId; + + List recheckProjectList; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentMethodRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentMethodRespVO.java new file mode 100644 index 0000000..afe6019 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/RecheckSubSampleParentMethodRespVO.java @@ -0,0 +1,31 @@ +package com.zt.plat.module.qms.business.bus.controller.vo; + +import java.util.List; + +import com.zt.plat.module.qms.business.config.controller.vo.*; + +import lombok.Data; + +@Data +public class RecheckSubSampleParentMethodRespVO { + + private Long dictionaryProjectId; + + private String dictionaryProjectName; + + private String dictionaryProjectSimpleName; + + private String dictionaryProjectShowName; + + private Long configAssayMethodId; + + private String configAssayMethodName; + + private Long baseSampleId; + + private String baseSampleName; + + private Integer isRecheckDefault; + + private List methodList; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessSubSampleParentRecheckDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessSubSampleParentRecheckDO.java new file mode 100644 index 0000000..0d4e22d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessSubSampleParentRecheckDO.java @@ -0,0 +1,85 @@ +package com.zt.plat.module.qms.business.bus.dal.dataobject; + +import lombok.*; +import java.util.*; + import java.time.LocalDateTime; + import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 分样复检业务数据 DO +* +* @author 后台管理 +*/ +@TableName("t_bsn_sb_smp_prn_rchk") +@KeySequence("t_bsn_sb_smp_prn_rchk_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class BusinessSubSampleParentRecheckDO extends BusinessBaseDO { + + + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 样品ID + */ + @TableField("SMP_ID") + private Long sampleId; + /** + * 样品主样ID + */ + @TableField("BSN_BSE_SMP_ID") + private Long businessBaseSampleId; + /** + * 样品分样ID + */ + @TableField("BSN_SB_PRN_SMP_ID") + private Long businessSubParentSampleId; + /** + * 检测方法配置ID + */ + @TableField("CFG_ASY_MTHD_ID") + private Long configAssayMethodId; + /** + * 复检样品主样ID + */ + @TableField("RCHK_BSN_BSE_SMP_ID") + private Long recheckBusinessBaseSampleId; + /** + * 复检样品分样ID + */ + @TableField("RCHK_BSN_SB_PRN_SMP_ID") + private Long recheckBusinessSubParentSampleId; + /** + * 复检检测方法配置ID + */ + @TableField("RCHK_CFG_ASY_MTHD_ID") + private Long recheckConfigAssayMethodId; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCode; + /** + * 乐观锁 + */ + @TableField("UPD_CNT") + private Integer updateCount; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + +} \ 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/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 c016b32..f0082da 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 @@ -230,6 +230,18 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(List businessSubParentSampleIds, Long configAssayMethodId) { + return selectList(new LambdaQueryWrapperX() + .in(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, businessSubParentSampleIds) + .eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId)); + } /** * 查询是否上报的分析任务 diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubParentSampleAssessmentMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubParentSampleAssessmentMapper.java index 368efd9..bf781de 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubParentSampleAssessmentMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubParentSampleAssessmentMapper.java @@ -2,12 +2,17 @@ package com.zt.plat.module.qms.business.bus.dal.mapper; import java.util.*; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleAssessmentDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO; +import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 班组判定数据业务 Mapper @@ -17,6 +22,8 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface BusinessSubParentSampleAssessmentMapper extends BaseMapperX { + List selectUnReportMethodGroupList(); + default PageResult selectPage(BusinessSubParentSampleAssessmentPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(BusinessSubParentSampleAssessmentDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId()) @@ -37,5 +44,28 @@ public interface BusinessSubParentSampleAssessmentMapper extends BaseMapperX selectByBusinessSubParentSampleIdAndConfigAssayMethodId(List businessSubParentSampleIds, Long configAssayMethodId) { + return selectJoinList(BusinessSubParentSampleAssessmentExtendRespVO.class, new MPJLambdaWrapperX() + .leftJoin(ConfigAssayMethodProjectDO.class, ConfigAssayMethodProjectDO::getId, BusinessSubParentSampleAssessmentDO::getConfigAssayMethodProjectId) + .leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessSubParentSampleAssessmentDO::getDictionaryProjectId) + .selectAll(BusinessSubParentSampleAssessmentDO.class) + .selectAs(ConfigAssayMethodProjectDO::getDictionaryProjectUnit, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectUnit) + .selectAs(DictionaryProjectDO::getKey, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectKey) + .selectAs(DictionaryProjectDO::getSimpleName, BusinessSubSampleAssessmentExtendRespVO::getSimpleName) + .selectAs(DictionaryProjectDO::getShowName, BusinessSubSampleAssessmentExtendRespVO::getShowName) + .in(BusinessSubParentSampleAssessmentDO::getBusinessSubParentSampleId, businessSubParentSampleIds) + .eq(BusinessSubParentSampleAssessmentDO::getConfigAssayMethodId, configAssayMethodId)); + } + + default List selectByConfigAssayMethodId(Long configAssayMethodId) { + return selectList(new LambdaQueryWrapper() + .eq(BusinessSubParentSampleAssessmentDO::getConfigAssayMethodId, configAssayMethodId)); + } + + List selectNoReportSubParentSampleAssessment(@Param("configAssayMethodId") Long configAssayMethodId); + + List getRecheckAssayMethodList(@Param("baseSampleId") Long baseSampleId, @Param("businessSubParentSampleId") Long businessSubParentSampleId, @Param("configAssayMethodId") Long configAssayMethodId); + } \ 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/dal/mapper/BusinessSubSampleAssessmentMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleAssessmentMapper.java index 98cdd3a..2153908 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleAssessmentMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleAssessmentMapper.java @@ -4,15 +4,17 @@ 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.bus.controller.vo.*; -import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSubSampleAssessmentPageReqVO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO; import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO; +import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import java.util.List; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 子样判定数据业务 Mapper @@ -24,6 +26,7 @@ public interface BusinessSubSampleAssessmentMapper extends BaseMapperX selectPage(BusinessSubSampleAssessmentPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(BusinessSubSampleAssessmentDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId()) .eqIfPresent(BusinessSubSampleAssessmentDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId()) .eqIfPresent(BusinessSubSampleAssessmentDO::getDictionaryProjectId, reqVO.getDictionaryProjectId()) .eqIfPresent(BusinessSubSampleAssessmentDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId()) @@ -44,6 +47,34 @@ public interface BusinessSubSampleAssessmentMapper extends BaseMapperX selectByBusinessSubParentSampleIdAndConfigAssayMethodId(Long businessSubParentSampleId, Long configAssayMethodId) { + return selectJoinList(BusinessSubSampleAssessmentExtendRespVO.class, new MPJLambdaWrapperX() + .leftJoin(ConfigAssayMethodProjectDO.class, ConfigAssayMethodProjectDO::getId, BusinessSubSampleAssessmentDO::getConfigAssayMethodProjectId) + .leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessSubSampleAssessmentDO::getDictionaryProjectId) + .selectAll(BusinessSubSampleAssessmentDO.class) + .selectAs(ConfigAssayMethodProjectDO::getDictionaryProjectUnit, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectUnit) + .selectAs(DictionaryProjectDO::getKey, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectKey) + .selectAs(DictionaryProjectDO::getSimpleName, BusinessSubSampleAssessmentExtendRespVO::getSimpleName) + .selectAs(DictionaryProjectDO::getShowName, BusinessSubSampleAssessmentExtendRespVO::getShowName) + .eq(BusinessSubSampleAssessmentDO::getBusinessSubParentSampleId, businessSubParentSampleId) + .eq(BusinessSubSampleAssessmentDO::getConfigAssayMethodId, configAssayMethodId)); + } + + default List selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(List businessSubParentSampleIds, Long configAssayMethodId) { + return selectJoinList(BusinessSubSampleAssessmentExtendRespVO.class, new MPJLambdaWrapperX() + .leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessSubSampleAssessmentDO::getConfigAssayMethodId) + .leftJoin(ConfigAssayMethodProjectDO.class, ConfigAssayMethodProjectDO::getId, BusinessSubSampleAssessmentDO::getConfigAssayMethodProjectId) + .leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessSubSampleAssessmentDO::getDictionaryProjectId) + .selectAll(BusinessSubSampleAssessmentDO.class) + .selectAs(ConfigAssayMethodDO::getName, BusinessSubSampleAssessmentExtendRespVO::getConfigAssayMethodName) + .selectAs(ConfigAssayMethodProjectDO::getDictionaryProjectUnit, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectUnit) + .selectAs(DictionaryProjectDO::getKey, BusinessSubSampleAssessmentExtendRespVO::getDictionaryProjectKey) + .selectAs(DictionaryProjectDO::getSimpleName, BusinessSubSampleAssessmentExtendRespVO::getSimpleName) + .selectAs(DictionaryProjectDO::getShowName, BusinessSubSampleAssessmentExtendRespVO::getShowName) + .in(BusinessSubSampleAssessmentDO::getBusinessSubParentSampleId, businessSubParentSampleIds) + .eq(BusinessSubSampleAssessmentDO::getConfigAssayMethodId, configAssayMethodId)); + } + default List selectByBusinessSubSampleIdAndConfigAssayMethodId(Long businessSubSampleId, Long configAssayMethodId) { return selectJoinList(BusinessSubSampleAssessmentExtendRespVO.class, new MPJLambdaWrapperX() .leftJoin(ConfigAssayMethodProjectDO.class, ConfigAssayMethodProjectDO::getId, BusinessSubSampleAssessmentDO::getConfigAssayMethodProjectId) @@ -64,4 +95,5 @@ public interface BusinessSubSampleAssessmentMapper extends BaseMapperX { + + default PageResult selectPage(BusinessSubSampleParentRecheckPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(BusinessSubSampleParentRecheckDO::getSampleId, reqVO.getSampleId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getRecheckBusinessBaseSampleId, reqVO.getRecheckBusinessBaseSampleId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getRecheckBusinessSubParentSampleId, reqVO.getRecheckBusinessSubParentSampleId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getRecheckConfigAssayMethodId, reqVO.getRecheckConfigAssayMethodId()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .betweenIfPresent(BusinessSubSampleParentRecheckDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getUpdateCount, reqVO.getUpdateCount()) + .eqIfPresent(BusinessSubSampleParentRecheckDO::getRemark, reqVO.getRemark()) + .orderByDesc(BusinessSubSampleParentRecheckDO::getId)); + } + +} \ 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/service/BusinessSubSampleParentRecheckService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleParentRecheckService.java new file mode 100644 index 0000000..65d0a63 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleParentRecheckService.java @@ -0,0 +1,62 @@ +package com.zt.plat.module.qms.business.bus.service; + +import java.util.*; +import jakarta.validation.*; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleParentRecheckDO; +import com.zt.plat.framework.common.pojo.PageParam; + +/** + * 分样复检业务数据 Service 接口 + * + * @author 后台管理 + */ +public interface BusinessSubSampleParentRecheckService { + + /** + * 创建分样复检业务数据 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + BusinessSubSampleParentRecheckRespVO createBusinessSubSampleParentRecheck(@Valid BusinessSubSampleParentRecheckSaveReqVO createReqVO); + + /** + * 更新分样复检业务数据 + * + * @param updateReqVO 更新信息 + */ + void updateBusinessSubSampleParentRecheck(@Valid BusinessSubSampleParentRecheckSaveReqVO updateReqVO); + + /** + * 删除分样复检业务数据 + * + * @param id 编号 + */ + void deleteBusinessSubSampleParentRecheck(Long id); + + /** + * 批量删除分样复检业务数据 + * + * @param ids 编号 + */ + void deleteBusinessSubSampleParentRecheckListByIds(List ids); + + /** + * 获得分样复检业务数据 + * + * @param id 编号 + * @return 分样复检业务数据 + */ + BusinessSubSampleParentRecheckDO getBusinessSubSampleParentRecheck(Long id); + + /** + * 获得分样复检业务数据分页 + * + * @param pageReqVO 分页查询 + * @return 分样复检业务数据分页 + */ + PageResult getBusinessSubSampleParentRecheckPage(BusinessSubSampleParentRecheckPageReqVO pageReqVO); + +} \ 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/service/BusinessSubSampleParentRecheckServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleParentRecheckServiceImpl.java new file mode 100644 index 0000000..236d7e8 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleParentRecheckServiceImpl.java @@ -0,0 +1,91 @@ +package com.zt.plat.module.qms.business.bus.service; + +import cn.hutool.core.collection.CollUtil; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.util.object.BeanUtils; +import com.zt.plat.module.qms.business.bus.controller.vo.*; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleParentRecheckDO; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleParentRecheckMapper; + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.diffList; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; + +/** + * 分样复检业务数据 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class BusinessSubSampleParentRecheckServiceImpl implements BusinessSubSampleParentRecheckService { + + @Resource + private BusinessSubSampleParentRecheckMapper businessSubSampleParentRecheckMapper; + + @Override + public BusinessSubSampleParentRecheckRespVO createBusinessSubSampleParentRecheck(BusinessSubSampleParentRecheckSaveReqVO createReqVO) { + // 插入 + BusinessSubSampleParentRecheckDO businessSubSampleParentRecheck = BeanUtils.toBean(createReqVO, BusinessSubSampleParentRecheckDO.class); + businessSubSampleParentRecheckMapper.insert(businessSubSampleParentRecheck); + // 返回 + return BeanUtils.toBean(businessSubSampleParentRecheck, BusinessSubSampleParentRecheckRespVO.class); + } + + @Override + public void updateBusinessSubSampleParentRecheck(BusinessSubSampleParentRecheckSaveReqVO updateReqVO) { + // 校验存在 + validateBusinessSubSampleParentRecheckExists(updateReqVO.getId()); + // 更新 + BusinessSubSampleParentRecheckDO updateObj = BeanUtils.toBean(updateReqVO, BusinessSubSampleParentRecheckDO.class); + businessSubSampleParentRecheckMapper.updateById(updateObj); + } + + @Override + public void deleteBusinessSubSampleParentRecheck(Long id) { + // 校验存在 + validateBusinessSubSampleParentRecheckExists(id); + // 删除 + businessSubSampleParentRecheckMapper.deleteById(id); + } + + @Override + public void deleteBusinessSubSampleParentRecheckListByIds(List ids) { + // 校验存在 + validateBusinessSubSampleParentRecheckExists(ids); + // 删除 + businessSubSampleParentRecheckMapper.deleteByIds(ids); + } + + private void validateBusinessSubSampleParentRecheckExists(List ids) { + List list = businessSubSampleParentRecheckMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(BUSINESS_SUB_SAMPLE_PARENT_RECHECK_NOT_EXISTS); + } + } + + private void validateBusinessSubSampleParentRecheckExists(Long id) { + if (businessSubSampleParentRecheckMapper.selectById(id) == null) { + throw exception(BUSINESS_SUB_SAMPLE_PARENT_RECHECK_NOT_EXISTS); + } + } + + @Override + public BusinessSubSampleParentRecheckDO getBusinessSubSampleParentRecheck(Long id) { + return businessSubSampleParentRecheckMapper.selectById(id); + } + + @Override + public PageResult getBusinessSubSampleParentRecheckPage(BusinessSubSampleParentRecheckPageReqVO pageReqVO) { + return businessSubSampleParentRecheckMapper.selectPage(pageReqVO); + } + +} \ 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/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 6b60e81..1108e90 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 @@ -33,6 +33,8 @@ import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDat 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.BusinessBaseSampleDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleAssessmentDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayParameterDataMapper; @@ -42,6 +44,8 @@ import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMappe 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.BusinessBaseSampleMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubParentSampleAssessmentMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubParentSampleMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleAssessmentMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; import com.zt.plat.module.qms.business.config.controller.vo.*; @@ -50,6 +54,7 @@ import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigReportFieldDO import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigRuleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleMethodDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleParentMethodDO; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigProjectMapper; @@ -59,6 +64,7 @@ import com.zt.plat.module.qms.business.config.dal.mapper.ConfigRuleMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSampleReportMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleParentMethodMapper; import com.zt.plat.module.qms.core.qlexpress.cmp.AllowanceCalculatorComponent; import com.zt.plat.module.qms.enums.QmsCommonConstant; @@ -472,6 +478,15 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic @Resource private BusinessBaseSampleMapper businessBaseSampleMapper; + + @Resource + private ConfigSubSampleParentMethodMapper configSubSampleParentMethodMapper; + + @Resource + private BusinessSubParentSampleMapper businessSubParentSampleMapper; + + @Resource + private BusinessSubParentSampleAssessmentMapper businessSubParentSampleAssessmentMapper; @Override @Transactional(rollbackFor = Exception.class) @@ -484,6 +499,9 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic } // List saveBusinessAssayReportDataDOList = new ArrayList<>(); // List updateBusinessAssayReportDataDOList = new ArrayList<>(); + + List businessSubParentSampleAssessmentDOList = new ArrayList<>(); + //分析任务已全部上报 List reportedList = businessAssayTaskDataMapper.selectIsReportedList(null, businessSubSampleId, configAssayMethodId, QmsCommonConstant.YES); //判定结果 @@ -496,8 +514,29 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic //查询主样 BusinessBaseSampleDO businessBaseSampleDO = businessBaseSampleMapper.selectById(businessAssayTaskDataDO.getBusinessBaseSampleId()); +// List businessSubParentSampleIdList = reportedList.stream().map(m -> m.getBusinessSubParentSampleId()).distinct().collect(Collectors.toList()); + //查询分样 + BusinessSubParentSampleDO businessSubParentSampleDO = businessSubParentSampleMapper.selectById(businessAssayTaskDataDO.getBusinessSubParentSampleId()); + //查询分样对应的方法 + ConfigSubSampleParentMethodDO configSubSampleParentMethodDO = configSubSampleParentMethodMapper.selectByConfigSubSampleParentIdAndConfigAssayMethodId(businessSubParentSampleDO.getConfigSubSampleParentId(), configAssayMethodId); + + //循环判定值 + BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = null; + for (BusinessSubSampleAssessmentExtendRespVO businessSubSampleAssessment : businessSubSampleAssessmentList) { + businessSubParentSampleAssessmentDO = new BusinessSubParentSampleAssessmentDO(); + businessSubParentSampleAssessmentDO.setBusinessSubParentSampleId(businessAssayTaskDataDO.getBusinessSubParentSampleId()); + businessSubParentSampleAssessmentDO.setAssessmentStatus(QmsCommonConstant.NORMAL); + businessSubParentSampleAssessmentDO.setAssessmentValue(businessSubSampleAssessment.getAssessmentValue()); + businessSubParentSampleAssessmentDO.setDataType(businessSubSampleAssessment.getDataType()); + businessSubParentSampleAssessmentDO.setDecimalPosition(businessSubSampleAssessment.getDecimalPosition()); + businessSubParentSampleAssessmentDO.setConfigAssayMethodId(businessSubSampleAssessment.getConfigAssayMethodId()); + businessSubParentSampleAssessmentDO.setConfigAssayMethodProjectId(businessSubSampleAssessment.getConfigAssayMethodProjectId()); + businessSubParentSampleAssessmentDO.setDictionaryProjectId(businessSubSampleAssessment.getDictionaryProjectId()); + + businessSubParentSampleAssessmentDOList.add(businessSubParentSampleAssessmentDO); + } /** @@ -590,6 +629,11 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic businessAssayReportDataMapper.updateBatch(updateBusinessAssayReportDataDOList); } **/ + + if (businessSubParentSampleAssessmentDOList.size() > 0) { + businessSubParentSampleAssessmentMapper.insertBatch(businessSubParentSampleAssessmentDOList); + } + businessSubSampleAssessmentMapper.update(new LambdaUpdateWrapper() .set(BusinessSubSampleAssessmentDO::getIsReported, QmsCommonConstant.YES) .set(BusinessSubSampleAssessmentDO::getReporter, nickName) 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 b9bfb66..05c2996 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 @@ -43,6 +43,7 @@ import com.zt.plat.module.qms.common.data.dal.dataobject.DataCollectionDO; import com.zt.plat.module.qms.common.data.service.DataCollectionService; import com.zt.plat.module.qms.enums.QmsCommonConstant; +import cn.hutool.core.collection.CollUtil; import jakarta.annotation.Resource; /** @@ -298,7 +299,9 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService { businessAssayTaskMapper.updateById(businessAssayTaskDO); businessAssayProjectDataMapper.updateBatch(businessAssayProjectDataList); - businessAssayParameterDataMapper.updateBatch(businessAssayParameterDataList); + if (CollUtil.isNotEmpty(businessAssayParameterDataList)) { + businessAssayParameterDataMapper.updateBatch(businessAssayParameterDataList); + } } @Override diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingService.java new file mode 100644 index 0000000..427fee2 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingService.java @@ -0,0 +1,23 @@ +package com.zt.plat.module.qms.business.bus.service; + +import java.util.List; + +import com.alibaba.fastjson2.JSONObject; +import com.zt.plat.module.qms.business.bus.controller.vo.BatchResultDataReportingReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSubParentSampleAssessmentGroupRespVO; +import com.zt.plat.module.qms.business.bus.controller.vo.RecheckSubSampleParentCreateReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.RecheckSubSampleParentMethodRespVO; + +public interface SampleResultReportingService { + + List getUnReportMethodGroupList(); + + JSONObject getSampleResultReportingList(Long configAssayMethodId); + + List getRecheckAssayMethodList(Long baseSampleId, Long businessSubParentSampleId, Long configAssayMethodId); + + void createRecheckSample(RecheckSubSampleParentCreateReqVO reqVO); + + void batchResultDataReporting(BatchResultDataReportingReqVO reqVO); + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingServiceImpl.java new file mode 100644 index 0000000..5d725fd --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/SampleResultReportingServiceImpl.java @@ -0,0 +1,491 @@ +package com.zt.plat.module.qms.business.bus.service; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.cloud.commons.lang.StringUtils; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; +import com.zt.plat.module.qms.business.bus.controller.vo.BatchResultDataReportingReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSubParentSampleAssessmentExtendRespVO; +import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSubParentSampleAssessmentGroupRespVO; +import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSubSampleAssessmentExtendRespVO; +import com.zt.plat.module.qms.business.bus.controller.vo.NoReportSubParentSampleAssessmentRespVO; +import com.zt.plat.module.qms.business.bus.controller.vo.RecheckSubSampleParentCreateReqVO; +import com.zt.plat.module.qms.business.bus.controller.vo.RecheckSubSampleParentMethodRespVO; +import com.zt.plat.module.qms.business.bus.controller.vo.ReportFieldValueData; +import com.zt.plat.module.qms.business.bus.controller.vo.ReportedDataSource; +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.BusinessAssayTaskDataDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessBaseSampleDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleAssessmentDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; +import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleParentRecheckDO; +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.BusinessBaseSampleMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubParentSampleAssessmentMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubParentSampleMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleAssessmentMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; +import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleParentRecheckMapper; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodProjectExtendRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigProjectExtendRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigSampleReportExtendRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigSampleReportReqVO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; +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.dataobject.ConfigReportFieldDO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleMethodDO; +import com.zt.plat.module.qms.business.config.dal.mapper.BaseSampleMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper; +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.ConfigProjectMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportFieldMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSampleReportMapper; +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper; +import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO; +import com.zt.plat.module.qms.enums.QmsCommonConstant; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import jakarta.annotation.Resource; + +@Service +public class SampleResultReportingServiceImpl implements SampleResultReportingService { + + @Resource + private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; + + @Resource + private BusinessSubParentSampleAssessmentMapper businessSubParentSampleAssessmentMapper; + + @Resource + private BusinessSubSampleAssessmentMapper businessSubSampleAssessmentMapper; + + @Resource + private BusinessSubParentSampleMapper businessSubParentSampleMapper; + + @Resource + private BusinessSubSampleMapper businessSubSampleMapper; + + @Resource + private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper; + + + @Override + public List getUnReportMethodGroupList() { + List list = businessSubParentSampleAssessmentMapper.selectUnReportMethodGroupList(); + return list; + } + + @Override + public JSONObject getSampleResultReportingList(Long configAssayMethodId) { + List configAssayMethodProjectDOList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configAssayMethodId); + List> columnList = new ArrayList<>(); + + //动态字段 + for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProject : configAssayMethodProjectDOList) { + columnList.add(new HashMap() { + private static final long serialVersionUID = 2100402322138923549L; + + { + put("title", configAssayMethodProject.getShowName() + "(" + configAssayMethodProject.getDictionaryProjectUnit() + ")"); + put("field", configAssayMethodProject.getSimpleName()); + put("dataType", configAssayMethodProject.getDataType()); + put("decimalPosition", configAssayMethodProject.getDecimalPosition()); + put("isEdit", true); + }}); + } + + List> dataList = new ArrayList<>(); + + //查询结果报送未上报的样品 + List noReportSubParentSampleAssessmentRespList = businessSubParentSampleAssessmentMapper.selectNoReportSubParentSampleAssessment(configAssayMethodId); + //分样id列表 + List businessSubParentSampleIds = noReportSubParentSampleAssessmentRespList.stream().map(m -> m.getBusinessSubParentSampleId()).collect(Collectors.toList()); + //报送的检测项目数据 + List businessSubParentSampleAssessmentDOList = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId); + //获取分析任务数 + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId); + List businessSubSampleIds = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleId()).distinct().collect(Collectors.toList()); + //获取子样数据 + List businessSubSampleDOList = businessSubSampleMapper.selectByIds(businessSubSampleIds); + + //获取结果判定数据 + List businessSubSampleAssessmentExtendRespVOList = businessSubSampleAssessmentMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId); + + //循环未上报的样品 + for (NoReportSubParentSampleAssessmentRespVO noReportSubParentSampleAssessmentRespVO : noReportSubParentSampleAssessmentRespList) { + Map noReportSubParentSampleAssessmentMap = BeanUtil.beanToMap(noReportSubParentSampleAssessmentRespVO); + String sampleCode = businessSubSampleDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleId())).map(m -> m.getSampleAssayCode()).distinct().collect(Collectors.joining(" | ")); + noReportSubParentSampleAssessmentMap.put("sampleCode", sampleCode); + + Map subSampleAssessmentMap = BeanUtil.copyProperties(noReportSubParentSampleAssessmentMap, Map.class); + List curBusinessSubParentSampleAssessmentDOList = businessSubParentSampleAssessmentDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleId())).collect(Collectors.toList()); + noReportSubParentSampleAssessmentMap.put("configAssayMethodName", "报出结果"); + for (BusinessSubParentSampleAssessmentExtendRespVO businessSubParentSampleAssessmentDO : curBusinessSubParentSampleAssessmentDOList) { + noReportSubParentSampleAssessmentMap.put(businessSubParentSampleAssessmentDO.getSimpleName(), businessSubParentSampleAssessmentDO.getAssessmentValue()); + } + + + List businessSubSampleAssessmentList = businessSubSampleAssessmentExtendRespVOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleId())).collect(Collectors.toList()); + + for (BusinessSubSampleAssessmentExtendRespVO businessSubSampleAssessmentExtendRespVO : businessSubSampleAssessmentList) { + subSampleAssessmentMap.put("configAssayMethodName", businessSubSampleAssessmentExtendRespVO.getConfigAssayMethodName()); + subSampleAssessmentMap.put(businessSubSampleAssessmentExtendRespVO.getSimpleName(), businessSubSampleAssessmentExtendRespVO.getAssessmentValue()); + } + + dataList.add(noReportSubParentSampleAssessmentMap); + dataList.add(subSampleAssessmentMap); + } + + + /** + + List businessSubParentSampleIdList = businessSubParentSampleAssessmentDOList.stream().map(m -> m.getBusinessSubParentSampleId()).distinct().collect(Collectors.toList()); + + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId); + + + + for (BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO : businessSubParentSampleAssessmentDOList) { + //Map dataMap = new HashMap<>(); + Map dataMap = BeanUtil.beanToMap(businessSubParentSampleAssessmentDO); + + + dataList.add(dataMap); + } + **/ + + + + JSONObject json = new JSONObject(); + json.put("columns", columnList); + json.put("datas", dataList); + return json; + } + + + @Override + public List getRecheckAssayMethodList(Long baseSampleId, Long businessSubParentSampleId, Long configAssayMethodId) { + //查询检查项目 + List list = businessSubParentSampleAssessmentMapper.getRecheckAssayMethodList(baseSampleId, businessSubParentSampleId, configAssayMethodId); + //过滤默认的 + List resultList = list.stream().filter(f -> f.getIsRecheckDefault() != null && f.getIsRecheckDefault().equals(QmsCommonConstant.YES)).collect(Collectors.toList()); + for (RecheckSubSampleParentMethodRespVO recheckSubSampleParentMethodRespVO : resultList) { + List methodList = new ArrayList<>(); + //根据检查项目过滤方法 + List projectMethodList = list.stream().filter(f -> f.getDictionaryProjectId().equals(recheckSubSampleParentMethodRespVO.getDictionaryProjectId())).collect(Collectors.toList()); + for (RecheckSubSampleParentMethodRespVO recheckSubSampleParentMethod : projectMethodList) { + ConfigAssayMethodRespVO configAssayMethodRespVO = new ConfigAssayMethodRespVO(); + configAssayMethodRespVO.setId(recheckSubSampleParentMethod.getConfigAssayMethodId()); + configAssayMethodRespVO.setName(recheckSubSampleParentMethod.getConfigAssayMethodName()); + methodList.add(configAssayMethodRespVO); + } + recheckSubSampleParentMethodRespVO.setMethodList(methodList); + } + + return resultList; + } + + @Resource + private BaseSampleMapper baseSampleMapper; + + @Resource + private ConfigSubSampleMethodMapper configSubSampleMethodMapper; + + @Resource + private ConfigAssayMethodMapper configAssayMethodMapper; + + @Resource + private ConfigAssayMethodProjectParameterMapper configAssayMethodProjectParameterMapper; + + @Resource + private BusinessAssayProjectDataMapper businessAssayProjectDataMapper; + + @Resource + private BusinessAssayParameterDataMapper businessAssayParameterDataMapper; + + @Resource + private BusinessSubSampleParentRecheckMapper businessSubSampleParentRecheckMapper; + + + @Override + @Transactional(rollbackFor = Exception.class) + public void createRecheckSample(RecheckSubSampleParentCreateReqVO reqVO) { + + List newBusinessAssayTaskDataDOList = new ArrayList<>(); + List newBusinessAssayProjectDataDOList = new ArrayList<>(); + List newBusinessAssayParameterDataDOList = new ArrayList<>(); + List newBusinessSubSampleParentRecheckDOList = new ArrayList<>(); + + //获取分析任务数 + List businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(reqVO.getBusinessSubParentSampleId(), reqVO.getConfigAssayMethodId()); + List businessSubSampleIds = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleId()).distinct().collect(Collectors.toList()); + + //获取子样 + List businessSubSampleDOList = businessSubSampleMapper.selectByIds(businessSubSampleIds); + + for (BusinessSubSampleDO businessSubSampleDO : businessSubSampleDOList) { + + //复检的检测项目 + List recheckProjectList = reqVO.getRecheckProjectList(); + + //根据方法分组 + Map> recheckProjectMap = recheckProjectList.stream().collect(Collectors.groupingBy(RecheckSubSampleParentMethodRespVO::getConfigAssayMethodId)); + + BusinessAssayTaskDataDO businessAssayTaskDataDO = null; + for (Map.Entry> entry : recheckProjectMap.entrySet()) { + Long configAssayMethodId = entry.getKey(); + List projectList = entry.getValue(); + + BusinessSubSampleParentRecheckDO businessSubSampleParentRecheckDO = new BusinessSubSampleParentRecheckDO(); + businessSubSampleParentRecheckDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + businessSubSampleParentRecheckDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessSubSampleParentRecheckDO.setConfigAssayMethodId(reqVO.getConfigAssayMethodId()); + businessSubSampleParentRecheckDO.setRecheckBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + businessSubSampleParentRecheckDO.setRecheckBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessSubSampleParentRecheckDO.setRecheckConfigAssayMethodId(configAssayMethodId); + + newBusinessSubSampleParentRecheckDOList.add(businessSubSampleParentRecheckDO); + + //查询分析方法 + ConfigAssayMethodDO configAssayMethodDO = configAssayMethodMapper.selectById(configAssayMethodId); + ConfigSubSampleMethodDO configSubSampleMethodDO = configSubSampleMethodMapper.selectByConfigSubSampleIdAndConfigAssayMethodId(businessSubSampleDO.getConfigSubSampleId(), configAssayMethodId); + + List configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configAssayMethodId); + + //根据任务数判断是平行还是 + String assayType = configSubSampleMethodDO.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP; + + //根据任务数循环 + for (int i = 0; i < configSubSampleMethodDO.getTaskCount(); i++) { + //子样检测任务 + businessAssayTaskDataDO = new BusinessAssayTaskDataDO(); + businessAssayTaskDataDO.setId(IdWorker.getId()); + businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId()); + businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId()); + businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId()); + businessAssayTaskDataDO.setConfigAssayMethodId(configAssayMethodId); + businessAssayTaskDataDO.setAssayType(assayType); + businessAssayTaskDataDO.setTaskType("复测"); + businessAssayTaskDataDO.setConfigSampleFlowId(businessSubSampleDO.getConfigSampleFlowId()); + businessAssayTaskDataDO.setSampleFlowNodeKey(businessSubSampleDO.getSampleFlowNodeKey()); + businessAssayTaskDataDO.setSampleFlowNodeTime(LocalDateTime.now()); + businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodDO.getAssayDepartmentId()); + businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName()); + + + StringBuilder assayProjectBuilder = new StringBuilder(); + + for (RecheckSubSampleParentMethodRespVO recheckSubSampleParentMethodRespVO : projectList) { + ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO = configAssayMethodProjectList.stream().filter(f -> f.getDictionaryProjectId().equals(recheckSubSampleParentMethodRespVO.getDictionaryProjectId())).findFirst().orElse(null); + + 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); + + newBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO); + + List configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterMapper.selectByConfigAssayMethodProjectId(configAssayMethodId); + 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()); + + + newBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO); + } + } + + assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length()); + businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString()); + newBusinessAssayTaskDataDOList.add(businessAssayTaskDataDO); + } + + } + } + if (CollUtil.isNotEmpty(newBusinessAssayTaskDataDOList)) { + businessAssayTaskDataMapper.insertBatch(newBusinessAssayTaskDataDOList); + } + if (CollUtil.isNotEmpty(newBusinessAssayProjectDataDOList)) { + businessAssayProjectDataMapper.insertBatch(newBusinessAssayProjectDataDOList); + } + if (CollUtil.isNotEmpty(newBusinessAssayParameterDataDOList)) { + businessAssayParameterDataMapper.insertBatch(newBusinessAssayParameterDataDOList); + } + if (CollUtil.isNotEmpty(newBusinessSubSampleParentRecheckDOList)) { + businessSubSampleParentRecheckMapper.insertBatch(newBusinessSubSampleParentRecheckDOList); + } + } + + @Resource + private BusinessAssayReportDataMapper businessAssayReportDataMapper; + + @Resource + private ConfigSampleReportMapper configSampleReportMapper; + + @Resource + private ConfigReportFieldMapper configReportFieldMapper; + + @Resource + private ConfigProjectMapper configProjectMapper; + + @Resource + private BusinessBaseSampleMapper businessBaseSampleMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public void batchResultDataReporting(BatchResultDataReportingReqVO reqVO) { + + //当前登录用户昵称 + String nickName = SecurityFrameworkUtils.getLoginUserNickname(); + + List saveBusinessAssayReportDataDOList = new ArrayList<>(); + List updateBusinessAssayReportDataDOList = new ArrayList<>(); + + List businessSubParentSampleAssessmentExtendList = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(reqVO.getBusinessSubParentSampleIds(), reqVO.getConfigAssayMethodId()); + + List businessSubParentSampleDOList = businessSubParentSampleMapper.selectByIds(reqVO.getBusinessSubParentSampleIds()); + + for (BusinessSubParentSampleDO businessSubParentSampleDO : businessSubParentSampleDOList) { + + BusinessBaseSampleDO businessBaseSampleDO = businessBaseSampleMapper.selectById(businessSubParentSampleDO.getBusinessBaseSampleId()); + + //查询报表 + List businessAssayReportDataDOList = businessAssayReportDataMapper.selectBytBusinessBaseSampleId(businessSubParentSampleDO.getBusinessBaseSampleId()); + + ConfigSampleReportReqVO configSampleReportSearch = new ConfigSampleReportReqVO(); + configSampleReportSearch.setConfigBaseSampleId(businessBaseSampleDO.getConfigBaseSampleId()); + List configSampleReportList = configSampleReportMapper.selectList(configSampleReportSearch); + + List configReportTypeIdList = configSampleReportList.stream().map(m -> m.getConfigReportTypeId()).collect(Collectors.toList()); + + //查询动态和计算的报表字段 + List configReportFieldList = configReportFieldMapper.selectByConfigReportTypeIds(configReportTypeIdList, Arrays.asList(QmsCommonConstant.FIELD_DYNAMIC, QmsCommonConstant.FIELD_CALCULATED)); + //动态报表字段 + List configReportFieldDynamicList = configReportFieldList.stream().filter(f -> QmsCommonConstant.FIELD_DYNAMIC.equals(f.getFieldType())).collect(Collectors.toList()); + //根据检测方法查询字段配置 + List configProjectList = configProjectMapper.selectByConfigAssayMethodId(reqVO.getConfigAssayMethodId()); + + + for (ConfigSampleReportExtendRespVO configSampleReport : configSampleReportList) { + BusinessAssayReportDataDO businessAssayReportDataDO = businessAssayReportDataDOList.stream().filter(f -> f.getConfigReportTypeId().equals(configSampleReport.getConfigReportTypeId()) && f.getConfigSampleReportId().equals(configSampleReport.getId())).findFirst().orElse(null); + if (businessAssayReportDataDO == null) { + businessAssayReportDataDO = new BusinessAssayReportDataDO(); + businessAssayReportDataDO.setBusinessBaseSampleId(businessSubParentSampleDO.getBusinessBaseSampleId()); + businessAssayReportDataDO.setConfigReportTypeId(configSampleReport.getConfigReportTypeId()); + businessAssayReportDataDO.setConfigSampleReportId(configSampleReport.getId()); + businessAssayReportDataDO.setSampleCode(businessBaseSampleDO.getSampleCode()); + + saveBusinessAssayReportDataDOList.add(businessAssayReportDataDO); + } else { + updateBusinessAssayReportDataDOList.add(businessAssayReportDataDO); + } + JSONObject assayDataJson = new JSONObject(); + String assayData = businessAssayReportDataDO.getAssayData(); + if (StringUtils.isNotBlank(assayData)) { + assayDataJson = JSON.parseObject(assayData); + } + //循环判定值 + List businessSubParentSampleAssessmentList = businessSubParentSampleAssessmentExtendList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(businessSubParentSampleDO.getId())).collect(Collectors.toList()); + for (BusinessSubParentSampleAssessmentExtendRespVO businessSubParentSampleAssessment : businessSubParentSampleAssessmentList) { + Long configAssayMethodProjectId = businessSubParentSampleAssessment.getConfigAssayMethodProjectId(); + List configProjectFeildList = configProjectList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectId)).collect(Collectors.toList()); + for (ConfigProjectExtendRespVO configProjectFeild : configProjectFeildList) { + //查询动态报表字段 + ConfigReportFieldDO configReportField = configReportFieldDynamicList.stream().filter(f -> f.getConfigReportTypeId().equals(configSampleReport.getConfigReportTypeId()) && f.getField().equals(configProjectFeild.getSaveColumn())).findFirst().orElse(null); + + if (configReportField == null) { + continue; + } + + ReportFieldValueData reportFieldValueData = new ReportFieldValueData(); + reportFieldValueData.setFieldName(configReportField.getFieldName()); + reportFieldValueData.setFieldValue(businessSubParentSampleAssessment.getAssessmentValue()); + reportFieldValueData.setDataType(configReportField.getDataType()); + reportFieldValueData.setMathSymbol("="); + reportFieldValueData.setUnit(configProjectFeild.getDictionaryProjectUnit()); + assayDataJson.put(configReportField.getField(), reportFieldValueData); + } + } + businessAssayReportDataDO.setAssayData(assayDataJson.toJSONString()); + + //修改已上报数据来源 + String dataSource = businessAssayReportDataDO.getDataSource(); + Set dataSources = StringUtils.isBlank(dataSource) ? new HashSet<>() : new HashSet<>(Arrays.asList(dataSource.split(","))); + String reportedSource = businessAssayReportDataDO.getReportedSource(); + ReportedDataSource reportedDataSource = null; + if (StringUtils.isNotBlank(reportedSource)) { + reportedDataSource = JSON.parseObject(reportedSource, ReportedDataSource.class); + } else { + reportedDataSource = new ReportedDataSource(); + } + reportedDataSource.addDataSource(reqVO.getConfigAssayMethodId().toString(), nickName, LocalDateTime.now()); + Set busDataSources = reportedDataSource.getDetails().stream().map(m -> m.getSourceCode()).collect(Collectors.toSet()); + if (busDataSources.size() == dataSources.size() && busDataSources.equals(dataSources)) { + businessAssayReportDataDO.setIsAllReported(QmsCommonConstant.YES); + } + if (busDataSources.size() > 0) { + //计算 + // TODO + } + businessAssayReportDataDO.setReportedSource(JSON.toJSONString(reportedDataSource)); + + } + } + + if (saveBusinessAssayReportDataDOList.size() > 0) { + businessAssayReportDataMapper.insertBatch(saveBusinessAssayReportDataDOList); + } + if (updateBusinessAssayReportDataDOList.size() > 0) { + businessAssayReportDataMapper.updateBatch(updateBusinessAssayReportDataDOList); + } + + List businessSubParentSampleAssessmentIdList = businessSubParentSampleAssessmentExtendList.stream().map(m -> m.getId()).collect(Collectors.toList()); + + businessSubParentSampleAssessmentMapper.update(new LambdaUpdateWrapper() + .set(BusinessSubParentSampleAssessmentDO::getIsReported, QmsCommonConstant.YES) + .set(BusinessSubParentSampleAssessmentDO::getReporter, nickName) + .set(BusinessSubParentSampleAssessmentDO::getReportTime, LocalDateTime.now()) + .in(BusinessSubParentSampleAssessmentDO::getId, businessSubParentSampleAssessmentIdList)); + } + + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodPageReqVO.java index baeab66..b6eac2e 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodPageReqVO.java @@ -31,6 +31,9 @@ public class MaterialAssayStandardMethodPageReqVO extends PageParam { @Schema(description = "是否默认,1-是,0-否") private Integer isDefault; + @Schema(description = "是否复检默认,1-是,0-否") + private Integer isRecheckDefault; + @Schema(description = "所属部门") private String systemDepartmentCode; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodRespVO.java index 7fe53b2..9530f48 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodRespVO.java @@ -40,6 +40,9 @@ public class MaterialAssayStandardMethodRespVO { @ExcelProperty("是否默认,1-是,0-否") private Integer isDefault; + @Schema(description = "是否复检默认,1-是,0-否") + private Integer isRecheckDefault; + @Schema(description = "所属部门") @ExcelProperty("所属部门") private String systemDepartmentCode; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodSaveReqVO.java index 6d2218b..4a94bd4 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/MaterialAssayStandardMethodSaveReqVO.java @@ -33,6 +33,9 @@ public class MaterialAssayStandardMethodSaveReqVO { @NotNull(message = "是否默认,1-是,0-否不能为空") private Integer isDefault; + @Schema(description = "是否复检默认,1-是,0-否") + private Integer isRecheckDefault; + @Schema(description = "所属部门") private String systemDepartmentCode; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/MaterialAssayStandardMethodDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/MaterialAssayStandardMethodDO.java index 8266da5..e2a98e9 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/MaterialAssayStandardMethodDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/MaterialAssayStandardMethodDO.java @@ -59,6 +59,11 @@ public class MaterialAssayStandardMethodDO extends BusinessBaseDO { @TableField("IS_DFT") private Integer isDefault; /** + * 是否复检默认,1-是,0-否 + */ + @TableField("IS_RCHK_DFT") + private Integer isRecheckDefault; + /** * 所属部门 */ @TableField("SYS_DEPT_CD") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMethodMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMethodMapper.java index 0d2c382..d52beca 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMethodMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigSubSampleParentMethodMapper.java @@ -27,5 +27,17 @@ public interface ConfigSubSampleParentMethodMapper extends BaseMapperX() + .eq(ConfigSubSampleParentMethodDO::getConfigSubSampleParentId, configSubSampleParentId) + .eq(ConfigSubSampleParentMethodDO::getConfigAssayMethodId, configAssayMethodId)); + } } \ 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/MaterialAssayStandardMethodMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/MaterialAssayStandardMethodMapper.java index 9123678..be8405d 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/MaterialAssayStandardMethodMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/MaterialAssayStandardMethodMapper.java @@ -23,6 +23,7 @@ public interface MaterialAssayStandardMethodMapper extends BaseMapperX + + + + + + + \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleParentRecheckMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleParentRecheckMapper.xml new file mode 100644 index 0000000..e7f41de --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSubSampleParentRecheckMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file