Compare commits
34 Commits
d41f69cc51
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| dd6df68061 | |||
|
|
468e939ab1 | ||
|
|
90b0aa5202 | ||
|
|
33543e5330 | ||
|
|
6a3d585802 | ||
|
|
9eec0bb05e | ||
|
|
8fd750a82f | ||
|
|
2790ed7ea1 | ||
|
|
9f4369bcb2 | ||
|
|
920292cfac | ||
|
|
1187038ba8 | ||
|
|
e2678fe7b4 | ||
|
|
c1b975cca0 | ||
|
|
b7f30012c8 | ||
|
|
000cfca842 | ||
| 6b006513af | |||
|
|
f2571944c1 | ||
|
|
8e3994b6a8 | ||
|
|
c7f3bc0a46 | ||
| 54bc4b8b37 | |||
|
|
d0ee704939 | ||
|
|
9cf4af15c2 | ||
|
|
ac308f30a2 | ||
|
|
60b2761b2c | ||
|
|
a17621b0dd | ||
| 9ec70c1721 | |||
|
|
3a5f6994a7 | ||
|
|
b355668284 | ||
| 8d75bc0765 | |||
| 0b44562b58 | |||
| 90a1dfbd37 | |||
| 61d91d29b0 | |||
|
|
d84f1adf65 | ||
|
|
4b9d27e8fc |
1191
doc/中铜技术文档/iWork集成说明.md
Normal file
1191
doc/中铜技术文档/iWork集成说明.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -119,5 +119,9 @@ zt:
|
||||
version: ${zt.info.version}
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
|
||||
ignore-urls:
|
||||
- /admin-api/qms/system-version-management/get-by-platform/**
|
||||
security:
|
||||
permit-all-urls:
|
||||
- /admin-api/qms/system-version-management/get-by-platform/**
|
||||
debug: false
|
||||
|
||||
@@ -140,6 +140,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode REPORT_DOCUMENT_DATA_NOT_EXISTS = new ErrorCode(1_032_100_000, "检测报告明细不存在");
|
||||
ErrorCode REPORT_DOCUMENT_TYPE_NOT_EXISTS = new ErrorCode(1_032_100_000, "报告类型配置不存在");
|
||||
ErrorCode REPORT_DOCUMENT_MAIN_CORRELATION_NOT_EXISTS = new ErrorCode(1_032_100_000, "报告主数据关系不存在");
|
||||
ErrorCode REPORT_DOCUMENT_FILE_NOT_EXISTS = new ErrorCode(1_032_100_000, "检测报告附件不存在");
|
||||
|
||||
ErrorCode BUSINESS_SAMPLE_DISPATCH_NOT_EXISTS = new ErrorCode(1_032_100_000, "样品调拨不存在");
|
||||
ErrorCode BUSINESS_SAMPLE_DISPATCH_DETAIL_NOT_EXISTS = new ErrorCode(1_032_100_000, "样品调拨明细不存在");
|
||||
@@ -159,6 +160,18 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MATERIAL_INVENTORY_INBOUND_NOT_EXISTS = new ErrorCode(1_032_150_000, "入库,出库不存在");
|
||||
ErrorCode MATERIAL_INVENTORY_INBOUND_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "入库明细,出库明细等不存在");
|
||||
|
||||
ErrorCode SYSTEM_VERSION_MANAGEMENT_NOT_EXISTS = new ErrorCode(1_032_150_000, "客户端版本管理不存在");
|
||||
|
||||
ErrorCode MATERIAL_LOCATION_NOT_EXISTS = new ErrorCode(1_032_150_000, "存放位置不存在");
|
||||
ErrorCode MATERIAL_INVENTORY_CHECK_NOT_EXISTS = new ErrorCode(1_032_150_000, "库存盘点不存在");
|
||||
ErrorCode MATERIAL_INVENTORY_CHECK_BATCH_NOT_EXISTS = new ErrorCode(1_032_150_000, "库存盘点项不存在");
|
||||
ErrorCode MATERIAL_INVENTORY_CHECK_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "库存盘点明细不存在");
|
||||
ErrorCode MATERIAL_INVENTORY_OUTBOUND_NOT_EXISTS = new ErrorCode(1_032_150_000, "出库不存在");
|
||||
ErrorCode MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等不存在");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*================================= tx 1_032_200_000 ~ 1_032_249_999 ==================================*/
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
QMS模块。
|
||||
</description>
|
||||
<properties>
|
||||
<zzjc.tio.version>3.9.1.v20251013-RELEASE</zzjc.tio.version>
|
||||
<zzjc.tio.version>3.9.1.v20251204-RELEASE</zzjc.tio.version>
|
||||
<liteflow.version>2.15.2</liteflow.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
@@ -141,27 +142,27 @@
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>2.15.1</version>
|
||||
<version>${liteflow.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-script-javax-pro</artifactId>
|
||||
<version>2.15.1</version>
|
||||
<version>${liteflow.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-script-groovy</artifactId>
|
||||
<version>2.15.1</version>
|
||||
<version>${liteflow.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-script-qlexpress</artifactId>
|
||||
<version>2.15.1</version>
|
||||
<version>${liteflow.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-script-graaljs</artifactId>
|
||||
<version>2.15.1</version>
|
||||
<version>${liteflow.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pdfbox -->
|
||||
|
||||
@@ -110,6 +110,9 @@ public class BusinessSampleEntrustRegistrationController implements BusinessCont
|
||||
@GetMapping("/queryWaitingDataForReport")
|
||||
@Operation(summary = "查询待编制数据")
|
||||
public CommonResult<PageResult<BusinessSampleEntrustRegistrationExtendRespVO>> queryWaitingDataForReport(@Valid BusinessSampleEntrustRegistrationPageReqVO pageReqVO) {
|
||||
Long configReportTypeId = pageReqVO.getConfigReportTypeId();
|
||||
if(configReportTypeId == null)
|
||||
return CommonResult.error(0, "缺少configReportTypeId参数,请刷新后重试!");
|
||||
PageResult<BusinessSampleEntrustRegistrationExtendRespVO> result = businessSampleEntrustRegistrationService.queryWaitingDataForReport(pageReqVO);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public class SampleAnalysisAuditController implements BusinessControllerMarker {
|
||||
}
|
||||
|
||||
@GetMapping("/getSampleResultAssessmentList")
|
||||
public CommonResult<JSONObject> getSampleResultAssessmentList(Long configAssayMethodId, String asmtReportedStatus) {
|
||||
JSONObject result = sampleAnalysisAuditService.getSampleResultAssessmentList(configAssayMethodId, asmtReportedStatus);
|
||||
public CommonResult<JSONObject> getSampleResultAssessmentList(BusinessAssayTaskDataReqVO reqVO) {
|
||||
JSONObject result = sampleAnalysisAuditService.getSampleResultAssessmentList(reqVO);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ public class SampleResultReportingController implements BusinessControllerMarker
|
||||
|
||||
//获取方法对应的样品
|
||||
@GetMapping("/getSampleResultReportingList")
|
||||
public CommonResult<?> getSampleResultReportingList(Long configAssayMethodId) {
|
||||
JSONObject result = sampleResultReportingService.getSampleResultReportingList(configAssayMethodId);
|
||||
public CommonResult<?> getSampleResultReportingList(BusinessSubParentSampleAssessmentGroupReqVO reqVO) {
|
||||
JSONObject result = sampleResultReportingService.getSampleResultReportingList(reqVO);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ public class BusinessAssayTaskDataExtendRespVO extends BusinessAssayTaskDataResp
|
||||
@Schema(description = "分析方法名称")
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
@Schema(description = "子样配置id")
|
||||
private Long configSubSampleId;
|
||||
|
||||
|
||||
@@ -5,9 +5,14 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BusinessAssayTaskDataGroupRespVO {
|
||||
|
||||
/** 方法id **/
|
||||
private Long configAssayMethodId;
|
||||
|
||||
/** 方法名称 **/
|
||||
private String configAssayMethodName;
|
||||
|
||||
/** 方法名称及类别 **/
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
private String assayType;
|
||||
|
||||
|
||||
@@ -107,6 +107,13 @@ public class BusinessAssayTaskDataReqVO {
|
||||
|
||||
@Schema(description = "检测方法配置名称")
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
@Schema(description = "收样时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] sampleReceiveTime;
|
||||
|
||||
@Schema(description = "样品编号")
|
||||
private String sampleCode;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.zt.plat.module.qms.business.config.controller.vo.ConfigQCSampleMethodExtendRespVO;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,9 @@ public class BusinessAssayTaskExtendRespVO extends BusinessAssayTaskRespVO {
|
||||
/** 分析方法名称 **/
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
/** 分析方法对应的分析项目 **/
|
||||
private String configAssayMethodProjectShowNames;
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ public class BusinessAssayTaskPageReqVO extends PageParam {
|
||||
@Schema(description = "签名信息")
|
||||
private String documentSignature;
|
||||
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "2")
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "2")
|
||||
private String finishStatus;
|
||||
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "1")
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "1")
|
||||
private String flowStatus;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
|
||||
@@ -99,10 +99,10 @@ public class BusinessAssayTaskReqVO {
|
||||
@Schema(description = "签名信息")
|
||||
private String documentSignature;
|
||||
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "2")
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "2")
|
||||
private String finishStatus;
|
||||
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "1")
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "1")
|
||||
private String flowStatus;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||
|
||||
@Schema(description = "管理后台 - 检测任务分配业务 Response VO")
|
||||
@Data
|
||||
@@ -116,12 +117,13 @@ public class BusinessAssayTaskRespVO {
|
||||
@ExcelProperty("签名信息")
|
||||
private String documentSignature;
|
||||
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "2")
|
||||
@ExcelProperty("完成状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved")
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "2")
|
||||
@ExcelProperty("完成状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed")
|
||||
private String finishStatus;
|
||||
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "1")
|
||||
@ExcelProperty("流程状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved")
|
||||
@Dict(dicCode = "flow_status")
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "1")
|
||||
@ExcelProperty("流程状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed")
|
||||
private String flowStatus;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
|
||||
@@ -102,10 +102,10 @@ public class BusinessAssayTaskSaveReqVO {
|
||||
@Schema(description = "签名信息")
|
||||
private String documentSignature;
|
||||
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "2")
|
||||
@Schema(description = "完成状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "2")
|
||||
private String finishStatus;
|
||||
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved", example = "1")
|
||||
@Schema(description = "流程状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed", example = "1")
|
||||
private String flowStatus;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
|
||||
@@ -17,6 +17,11 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BusinessSampleEntrustDetailExtendRespVO extends BusinessSampleEntrustDetailRespVO {
|
||||
|
||||
/**
|
||||
* 样品类型key
|
||||
*/
|
||||
private String sampleTypeDictionaryBusinessKey;
|
||||
|
||||
/** 样品大类名称 **/
|
||||
private String baseSampleName;
|
||||
|
||||
|
||||
@@ -156,4 +156,7 @@ public class BusinessSampleEntrustRegistrationPageReqVO extends PageParam {
|
||||
//====================扩展字段======================
|
||||
@Schema(description = "委托来源名称")
|
||||
private String configEntrustSourceName;
|
||||
|
||||
@Schema(description = "报表配置id")
|
||||
private Long configReportTypeId;
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.zt.plat.module.qms.business.bus.controller.vo;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,10 +17,17 @@ public class BusinessSubParentSampleAssessmentGroupReqVO {
|
||||
|
||||
@Schema(description = "分析方法名称")
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
@Schema(description = "分析部门ID")
|
||||
private Long assayDepartmentId;
|
||||
|
||||
@Schema(description = "分析部门名称")
|
||||
private String assayDepartmentName;
|
||||
|
||||
@Schema(description = "收样时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] sampleReceiveTime;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ public class BusinessSubParentSampleAssessmentGroupRespVO {
|
||||
|
||||
@Schema(description = "分析方法名称")
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
@Schema(description = "分析部门ID")
|
||||
private Long assayDepartmentId;
|
||||
|
||||
@@ -31,6 +31,9 @@ public class BusinessSubSampleAnalysisGroupPageReqVO extends PageParam {
|
||||
@Schema(description = "样品状态", example = "1")
|
||||
private String sampleStatus;
|
||||
|
||||
@Schema(description = "是否送样")
|
||||
private Integer isSend;
|
||||
|
||||
@Schema(description = "收样人")
|
||||
private String sampleReceiver;
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ public class BusinessSubSampleAnalysisGroupRespVO {
|
||||
@ExcelProperty("样品状态")
|
||||
private String sampleStatus;
|
||||
|
||||
@Schema(description = "是否送样")
|
||||
private Integer isSend;
|
||||
|
||||
@Schema(description = "收样人")
|
||||
@ExcelProperty("收样人")
|
||||
private String sampleReceiver;
|
||||
|
||||
@@ -37,6 +37,9 @@ public class BusinessSubSampleAnalysisGroupSaveReqVO {
|
||||
@NotEmpty(message = "样品状态不能为空")
|
||||
private String sampleStatus;
|
||||
|
||||
@Schema(description = "是否送样")
|
||||
private Integer isSend;
|
||||
|
||||
@Schema(description = "收样人")
|
||||
private String sampleReceiver;
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@ public class BusinessSubSampleExtendRespVO extends BusinessSubSampleRespVO {
|
||||
|
||||
@Schema(description = "分析部门名称")
|
||||
private String assayDepartmentName;
|
||||
|
||||
@Schema(description = "是否已送样")
|
||||
private Integer isSendSample;
|
||||
|
||||
@Schema(description = "是否打印")
|
||||
private Integer isPrint;
|
||||
|
||||
@@ -145,6 +145,9 @@ public class BusinessSubSamplePageReqVO extends PageParam {
|
||||
@Schema(description = "分析部门状态")
|
||||
private String assayDepartmentStatus;
|
||||
|
||||
@Schema(description = "是否已送样")
|
||||
private Integer isSendSample;
|
||||
|
||||
@Schema(description = "样品流程节点KEY列表")
|
||||
private List<String> sampleFlowNodeKeyList;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zt.plat.module.qms.business.bus.controller.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -22,4 +24,7 @@ public class NoReportSubParentSampleAssessmentRespVO {
|
||||
private String taskType;
|
||||
|
||||
private String assayType;
|
||||
|
||||
|
||||
private LocalDateTime sampleReceiveTime;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.zt.plat.module.qms.business.config.controller.vo.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -20,6 +21,9 @@ public class RecheckSubSampleParentMethodRespVO {
|
||||
private Long configAssayMethodId;
|
||||
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
private Long baseSampleId;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.business.bus.dal.dataobject;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -109,4 +110,20 @@ public class BusinessAssayReportDataDO extends BusinessBaseDO {
|
||||
//样品创建时间
|
||||
@TableField(exist = false)
|
||||
private LocalDateTime baseSampleCreateTime;
|
||||
|
||||
//样品类型key
|
||||
@TableField(exist = false)
|
||||
private String sampleTypeKey;
|
||||
|
||||
//委托样品名称
|
||||
@TableField(exist = false)
|
||||
private String entrustSampleName;
|
||||
|
||||
//委托样品编号
|
||||
@TableField(exist = false)
|
||||
private String entrustSampleCode;
|
||||
|
||||
//委托明细排序
|
||||
@TableField(exist = false)
|
||||
private Integer entrustDetailSort;
|
||||
}
|
||||
@@ -160,12 +160,12 @@ public class BusinessAssayTaskDO extends BusinessBaseDO {
|
||||
@TableField("DOC_SIG")
|
||||
private String documentSignature;
|
||||
/**
|
||||
* 完成状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved
|
||||
* 完成状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed
|
||||
*/
|
||||
@TableField("FIN_STS")
|
||||
private String finishStatus;
|
||||
/**
|
||||
* 流程状态,未开始-not_start、审核中-running、已退回-returned、已通过-approved
|
||||
* 流程状态,未开始-not_start、审核中-in_progress、已退回-returned、已通过-completed
|
||||
*/
|
||||
@TableField("FLW_STS")
|
||||
private String flowStatus;
|
||||
|
||||
@@ -63,6 +63,11 @@ public class BusinessSubSampleAnalysisGroupDO extends BusinessBaseDO {
|
||||
@TableField("SMP_STS")
|
||||
private String sampleStatus;
|
||||
/**
|
||||
* 是否送样
|
||||
*/
|
||||
@TableField("IS_SND")
|
||||
private Integer isSend;
|
||||
/**
|
||||
* 收样人
|
||||
*/
|
||||
@TableField("SMP_RCVR")
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zt.plat.module.qms.business.bus.dal.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl.On;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
@@ -16,7 +15,6 @@ import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataRe
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAnalysisGroupDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentProjectDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
|
||||
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
|
||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||
@@ -26,7 +24,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -47,6 +44,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
.eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, BusinessAssayTaskDataDO::getAssayDepartmentId))
|
||||
.selectAll(BusinessAssayTaskDataDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
|
||||
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
|
||||
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
|
||||
@@ -136,7 +134,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
if (ObjectUtil.isNotEmpty(reqVO.getSampleStatus())) {
|
||||
mpjLambdaWrapper.eq(BusinessSubSampleAnalysisGroupDO::getSampleStatus, reqVO.getSampleStatus());
|
||||
}
|
||||
mpjLambdaWrapper.orderByDesc(BusinessAssayTaskDataDO::getId);
|
||||
mpjLambdaWrapper.orderByAsc(BusinessAssayTaskDataDO::getSampleFlowNodeTime);
|
||||
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, mpjLambdaWrapper);
|
||||
}
|
||||
|
||||
@@ -149,6 +147,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
.eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, BusinessAssayTaskDataDO::getAssayDepartmentId))
|
||||
.selectAll(BusinessAssayTaskDataDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
|
||||
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
|
||||
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
|
||||
@@ -238,7 +237,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
if (ObjectUtil.isNotEmpty(reqVO.getSampleStatus())) {
|
||||
mpjLambdaWrapper.eq(BusinessSubSampleAnalysisGroupDO::getSampleStatus, reqVO.getSampleStatus());
|
||||
}
|
||||
mpjLambdaWrapper.orderByDesc(BusinessAssayTaskDataDO::getId);
|
||||
mpjLambdaWrapper.orderByAsc(BusinessAssayTaskDataDO::getSampleFlowNodeTime);
|
||||
return selectJoinPage(reqVO, BusinessAssayTaskDataExtendRespVO.class, mpjLambdaWrapper);
|
||||
}
|
||||
|
||||
@@ -264,6 +263,31 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
.eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO));
|
||||
}
|
||||
|
||||
default List<BusinessAssayTaskDataExtendRespVO> selectBySampleAssayCodesAndConfigAssayMethodId(List<String> sampleAssayCodes, Long configAssayMethodId) {
|
||||
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
|
||||
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
|
||||
.selectAll(BusinessAssayTaskDataDO.class)
|
||||
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
|
||||
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
|
||||
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
|
||||
.in(BusinessSubSampleDO::getSampleAssayCode, sampleAssayCodes)
|
||||
.eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId)
|
||||
.eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO));
|
||||
}
|
||||
|
||||
default List<BusinessAssayTaskDataExtendRespVO> selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(List<String> sampleAssayCodes, String configAssayMethodDictionaryBusinessKey) {
|
||||
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
|
||||
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId)
|
||||
.selectAll(BusinessAssayTaskDataDO.class)
|
||||
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
|
||||
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
|
||||
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
|
||||
.in(BusinessSubSampleDO::getSampleAssayCode, sampleAssayCodes)
|
||||
.eq(ConfigAssayMethodDO::getDictionaryBusinessKey, configAssayMethodDictionaryBusinessKey)
|
||||
.eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO));
|
||||
}
|
||||
|
||||
default List<BusinessAssayTaskDataExtendRespVO> selectResultAssessmentList(BusinessAssayTaskDataReqVO reqVO) {
|
||||
MPJLambdaWrapper<BusinessAssayTaskDataDO> mpjLambdaWrapper = new MPJLambdaWrapper<BusinessAssayTaskDataDO>()
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDataDO::getConfigAssayMethodId)
|
||||
@@ -274,6 +298,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
.eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, BusinessAssayTaskDataDO::getAssayDepartmentId))
|
||||
.selectAll(BusinessAssayTaskDataDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, BusinessAssayTaskDataExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.selectAs(ConfigAssayMethodDO::getConfigReportTemplateKey, BusinessAssayTaskDataExtendRespVO::getConfigReportTemplateKey)
|
||||
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
|
||||
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
|
||||
@@ -302,6 +327,9 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(reqVO.getSampleReceiveTime()) && reqVO.getSampleReceiveTime().length == 2) {
|
||||
mpjLambdaWrapper.between(BusinessSubSampleAnalysisGroupDO::getSampleReceiveTime, reqVO.getSampleReceiveTime()[0], reqVO.getSampleReceiveTime()[1]);
|
||||
}
|
||||
mpjLambdaWrapper.eq(BusinessSubSampleAnalysisGroupDO::getSampleStatus, "已收样");//已收样
|
||||
mpjLambdaWrapper.orderByAsc(BusinessAssayTaskDataDO::getBusinessSubSampleId).orderByAsc(BusinessAssayTaskDataDO::getReportTime);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface BusinessAssayTaskDetailMapper extends BaseMapperX<BusinessAssay
|
||||
.eqIfPresent(BusinessAssayTaskDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.betweenIfPresent(BusinessAssayTaskDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(BusinessAssayTaskDetailDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(BusinessAssayTaskDetailDO::getId));
|
||||
.orderByAsc(BusinessAssayTaskDetailDO::getSampleCode));
|
||||
}
|
||||
|
||||
default List<BusinessAssayTaskDetailExtendRespVO> selectList(BusinessAssayTaskDetailReqVO reqVO) {
|
||||
@@ -80,7 +80,7 @@ public interface BusinessAssayTaskDetailMapper extends BaseMapperX<BusinessAssay
|
||||
.eqIfPresent(BusinessAssayTaskDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.betweenIfPresent(BusinessAssayTaskDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(BusinessAssayTaskDetailDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(BusinessAssayTaskDetailDO::getId));
|
||||
.orderByAsc(BusinessAssayTaskDetailDO::getSampleCode));
|
||||
}
|
||||
|
||||
default List<BusinessAssayTaskDetailDO> selectByBusinessAssayTaskId(Long businessAssayTaskId) {
|
||||
|
||||
@@ -29,6 +29,7 @@ public interface BusinessAssayTaskMapper extends BaseMapperX<BusinessAssayTaskDO
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDO::getConfigAssayMethodId)
|
||||
.selectAll(BusinessAssayTaskDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, BusinessAssayTaskExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.eqIfPresent(BusinessAssayTaskDO::getTaskNo, reqVO.getTaskNo())
|
||||
.likeIfPresent(BusinessAssayTaskDO::getTaskName, reqVO.getTaskName())
|
||||
.eqIfPresent(BusinessAssayTaskDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
|
||||
@@ -73,6 +74,7 @@ public interface BusinessAssayTaskMapper extends BaseMapperX<BusinessAssayTaskDO
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDO::getConfigAssayMethodId)
|
||||
.selectAll(BusinessAssayTaskDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, BusinessAssayTaskExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.eqIfPresent(BusinessAssayTaskDO::getTaskNo, reqVO.getTaskNo())
|
||||
.likeIfPresent(BusinessAssayTaskDO::getTaskName, reqVO.getTaskName())
|
||||
.eqIfPresent(BusinessAssayTaskDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
|
||||
@@ -136,6 +138,7 @@ public interface BusinessAssayTaskMapper extends BaseMapperX<BusinessAssayTaskDO
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, BusinessAssayTaskDO::getConfigAssayMethodId)
|
||||
.selectAll(BusinessAssayTaskDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, BusinessAssayTaskExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, BusinessAssayTaskExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.eq(BusinessAssayTaskDO::getId, id));
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,14 @@ public interface BusinessSampleEntrustDetailMapper extends BaseMapperX<BusinessS
|
||||
return selectList(new LambdaQueryWrapperX<BusinessSampleEntrustDetailDO>().eq(BusinessSampleEntrustDetailDO::getBusinessSampleEntrustRegistrationId, businessSampleEntrustRegistrationId));
|
||||
}
|
||||
|
||||
default List<BusinessSampleEntrustDetailExtendRespVO> selectExtendByBusinessSampleEntrustRegistrationId(Long businessSampleEntrustRegistrationId) {
|
||||
return selectJoinList(BusinessSampleEntrustDetailExtendRespVO.class, new MPJLambdaWrapperX<BusinessSampleEntrustDetailDO>()
|
||||
.leftJoin(BaseSampleDO.class, BaseSampleDO::getId, BusinessSampleEntrustDetailDO::getBaseSampleId)
|
||||
.selectAll(BusinessSampleEntrustDetailDO.class)
|
||||
.selectAs(BaseSampleDO::getDictionaryBusinessKey, BusinessSampleEntrustDetailExtendRespVO::getSampleTypeDictionaryBusinessKey)
|
||||
.eq(BusinessSampleEntrustDetailDO::getBusinessSampleEntrustRegistrationId, businessSampleEntrustRegistrationId));
|
||||
}
|
||||
|
||||
default List<BusinessSampleEntrustDetailDO> selectByBusinessSampleEntrustRegistrationIds(List<Long> businessSampleEntrustRegistrationIds) {
|
||||
return selectList(new LambdaQueryWrapperX<BusinessSampleEntrustDetailDO>().in(BusinessSampleEntrustDetailDO::getBusinessSampleEntrustRegistrationId, businessSampleEntrustRegistrationIds));
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface BusinessSubParentSampleAssessmentProjectMapper extends BaseMapp
|
||||
.eq(BusinessSubParentSampleAssessmentProjectDO::getConfigAssayMethodId, configAssayMethodId));
|
||||
}
|
||||
|
||||
List<NoReportSubParentSampleAssessmentRespVO> selectNoReportSubParentSampleAssessment(@Param("configAssayMethodId") Long configAssayMethodId);
|
||||
List<NoReportSubParentSampleAssessmentRespVO> selectNoReportSubParentSampleAssessment(@Param("reqVO") BusinessSubParentSampleAssessmentGroupReqVO reqVO);
|
||||
|
||||
List<RecheckSubSampleParentMethodRespVO> getRecheckAssayMethodList(@Param("baseSampleId") Long baseSampleId, @Param("businessSubParentSampleId") Long businessSubParentSampleId, @Param("configAssayMethodId") Long configAssayMethodId);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ public interface BusinessSubSampleAnalysisGroupMapper extends BaseMapperX<Busine
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
|
||||
.likeIfPresent(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleStatus, reqVO.getSampleStatus())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getIsSend, reqVO.getIsSend())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleReceiver, reqVO.getSampleReceiver())
|
||||
.betweenIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleReceiveTime, reqVO.getSampleReceiveTime())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
|
||||
@@ -144,6 +144,7 @@ public interface BusinessSubSampleMapper extends BaseMapperX<BusinessSubSampleDO
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleStatus, reqVO.getAssayDepartmentStatus())
|
||||
.eqIfPresent(BusinessSubSampleAnalysisGroupDO::getIsSend, reqVO.getIsSendSample())
|
||||
.orderByDesc(BusinessSubSampleDO::getSampleFlowNodeTime).orderByAsc(BusinessSubSampleDO::getSampleCode));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,16 @@ package com.zt.plat.module.qms.business.bus.liteflow.sample.flow;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ql.util.express.DefaultContext;
|
||||
import com.ql.util.express.ExpressRunner;
|
||||
import com.alibaba.qlexpress4.Express4Runner;
|
||||
import com.alibaba.qlexpress4.QLOptions;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.zt.plat.framework.common.exception.ServiceException;
|
||||
@@ -41,7 +43,7 @@ public class SampleSubProcessUpdateCmp extends NodeComponent {
|
||||
// private ConfigSubSampleService configSubSampleService;
|
||||
|
||||
@Resource
|
||||
private ExpressRunner expressRunner;
|
||||
private Express4Runner express4Runner;
|
||||
|
||||
@Resource
|
||||
private ConfigRuleMapper configRuleMapper;
|
||||
@@ -89,7 +91,7 @@ public class SampleSubProcessUpdateCmp extends NodeComponent {
|
||||
for (SampleFlowNode flowNode : nextFlowNodeList) {
|
||||
ConfigRuleDO conditionRule = configRuleMapper.selectLatestConfigRuleByCode(flowNode.getCondition());
|
||||
Boolean isMeetCondition = false;
|
||||
DefaultContext<String, Object> context = new DefaultContext<>();
|
||||
Map<String, Object> context = new HashMap<>();
|
||||
ConfigSubSampleDO configSubSample = sampleFlowContext.getConfigSubSampleById(businessSubSample.getConfigSubSampleId());
|
||||
Boolean hasSubSimpleCodeRule = configSubSample != null && StringUtils.isNotBlank(configSubSample.getSimpleCodeRule());
|
||||
Boolean hasSubSampleEncrypt = businessHandoverRecordSubDOList.stream().filter(f -> f.getBusinessSubSampleId().equals(businessSubSample.getId())).anyMatch(m -> QmsCommonConstant.FlOW_NODE_SAMPLE_ENCRYPT.equals(m.getSampleFlowNodeKey()));
|
||||
@@ -105,7 +107,8 @@ public class SampleSubProcessUpdateCmp extends NodeComponent {
|
||||
context.put("hasSubSimpleCodeRule", hasSubSimpleCodeRule);
|
||||
context.put("hasSubSampleEncrypt", hasSubSampleEncrypt);
|
||||
try {
|
||||
isMeetCondition = (Boolean) expressRunner.execute(conditionRule.getExpression(), context, null, false, false);
|
||||
// isMeetCondition = (Boolean) express4Runner.execute(conditionRule.getExpression(), context, null, false, false);
|
||||
isMeetCondition = (Boolean) express4Runner.execute(conditionRule.getExpression(), context, QLOptions.DEFAULT_OPTIONS).getResult();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(1_032_100_000, e.getMessage());
|
||||
@@ -140,6 +143,16 @@ public class SampleSubProcessUpdateCmp extends NodeComponent {
|
||||
}
|
||||
sampleFlowContext.setBusinessSubSampleAnalysisGroupList(curDeptSubSampleAnalysisGroupDOList);
|
||||
}
|
||||
|
||||
//如果是班组送样,需要更新分析班组表
|
||||
if (QmsCommonConstant.FLOW_NODE_ANALYSIS_SEND.equals(currentSampleFlowKey)) {
|
||||
List<BusinessSubSampleAnalysisGroupDO> curDeptSubSampleAnalysisGroupDOList = businessSubSampleAnalysisGroupDOList.stream().filter(f -> f.getAssayDepartmentId().equals(loginUser.getVisitDeptId())).collect(Collectors.toList());
|
||||
for (BusinessSubSampleAnalysisGroupDO businessSubSampleAnalysisGroupDO : curDeptSubSampleAnalysisGroupDOList) {
|
||||
businessSubSampleAnalysisGroupDO.setIsSend(QmsCommonConstant.YES);
|
||||
}
|
||||
sampleFlowContext.setBusinessSubSampleAnalysisGroupList(curDeptSubSampleAnalysisGroupDOList);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.zt.plat.framework.common.pojo.PageParam;
|
||||
*/
|
||||
public interface BusinessSampleEntrustRegistrationService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建委检登记业务
|
||||
*
|
||||
@@ -56,6 +58,8 @@ public interface BusinessSampleEntrustRegistrationService {
|
||||
*/
|
||||
BusinessSampleEntrustRegistrationDO getBusinessSampleEntrustRegistration(Long id);
|
||||
|
||||
List<BusinessSampleEntrustRegistrationDO> listByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得委检登记业务分页
|
||||
*
|
||||
|
||||
@@ -89,6 +89,11 @@ public class BusinessSampleEntrustRegistrationServiceImpl implements BusinessSam
|
||||
return businessSampleEntrustRegistrationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusinessSampleEntrustRegistrationDO> listByIds(List<Long> ids) {
|
||||
return businessSampleEntrustRegistrationMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BusinessSampleEntrustRegistrationExtendRespVO> getBusinessSampleEntrustRegistrationPage(BusinessSampleEntrustRegistrationPageReqVO pageReqVO) {
|
||||
return businessSampleEntrustRegistrationMapper.selectPage(pageReqVO);
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.BusinessAssayTaskDataReqVO;
|
||||
|
||||
/**
|
||||
* <b>SampleAnalysisAuditService</b>
|
||||
@@ -13,7 +14,7 @@ public interface SampleAnalysisAuditService {
|
||||
|
||||
void crossAuditByByTaskId(Long businessAssayTaskId, String auditStatus);
|
||||
|
||||
JSONObject getSampleResultAssessmentList(Long configAssayMethodId, String asmtReportedStatus);
|
||||
JSONObject getSampleResultAssessmentList(BusinessAssayTaskDataReqVO reqVO);
|
||||
|
||||
JSONObject getParallelResultAssessment(Long businessSubSampleId, Long configAssayMethodId);
|
||||
|
||||
|
||||
@@ -4,13 +4,10 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
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.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.collections4.map.HashedMap;
|
||||
@@ -23,18 +20,17 @@ import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONFactory;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.alibaba.nacos.shaded.io.grpc.Attributes.Key;
|
||||
import com.alibaba.qlexpress4.Express4Runner;
|
||||
import com.alibaba.qlexpress4.QLOptions;
|
||||
import com.alibaba.qlexpress4.QLResult;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.ql.util.express.DefaultContext;
|
||||
import com.ql.util.express.ExpressRunner;
|
||||
import com.zt.plat.framework.common.exception.ServiceException;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.business.bus.controller.vo.*;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayParameterDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO;
|
||||
@@ -67,7 +63,6 @@ import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleAssessmen
|
||||
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper;
|
||||
import com.zt.plat.module.qms.business.config.controller.vo.*;
|
||||
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO;
|
||||
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;
|
||||
@@ -104,7 +99,7 @@ import jakarta.annotation.Resource;
|
||||
public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditService {
|
||||
|
||||
@Resource
|
||||
private ExpressRunner expressRunner;
|
||||
private Express4Runner express4Runner;
|
||||
|
||||
@Resource
|
||||
private AllowanceCalculatorComponent allowanceCalculatorComponent;
|
||||
@@ -152,7 +147,9 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
private ConfigSubSampleMethodMapper configSubSampleMethodMapper;
|
||||
|
||||
@Override
|
||||
public JSONObject getSampleResultAssessmentList(Long configAssayMethodId, String asmtReportedStatus) {
|
||||
public JSONObject getSampleResultAssessmentList(BusinessAssayTaskDataReqVO reqVO) {
|
||||
Long configAssayMethodId = reqVO.getConfigAssayMethodId();
|
||||
String asmtReportedStatus = reqVO.getAsmtReportedStatus();
|
||||
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configAssayMethodId);
|
||||
List<Map<String, Object>> columnList = new ArrayList<>();
|
||||
|
||||
@@ -173,6 +170,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
BusinessAssayTaskDataReqVO search = new BusinessAssayTaskDataReqVO();
|
||||
search.setConfigAssayMethodId(configAssayMethodId);
|
||||
search.setAsmtReportedStatus(asmtReportedStatus);
|
||||
search.setSampleReceiveTime(reqVO.getSampleReceiveTime());
|
||||
List<BusinessAssayTaskDataExtendRespVO> resultAssessmentList = businessAssayTaskDataMapper.selectResultAssessmentList(search);
|
||||
|
||||
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskDataExtendRespVO : resultAssessmentList) {
|
||||
@@ -439,8 +437,8 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
|
||||
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
|
||||
if (QmsCommonConstant.APPROVE.equals(auditStatus)) {
|
||||
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.APPROVED);
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.APPROVED);
|
||||
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.COMPLETED);
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.COMPLETED);
|
||||
businessAssayTaskDO.setReportTime(LocalDateTime.now());
|
||||
businessAssayTaskDO.setReportOperator(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
businessAssayTaskDO.setReportOperatorId(SecurityFrameworkUtils.getLoginUserId());
|
||||
@@ -643,8 +641,9 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
|
||||
|
||||
} else {
|
||||
businessAssayTaskDO.setTaskAssayStatus(QmsCommonConstant.SAVED);
|
||||
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.PENDING);
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.NOT_START);
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.RETURNED);
|
||||
}
|
||||
businessAssayTaskMapper.updateById(businessAssayTaskDO);
|
||||
|
||||
@@ -987,12 +986,14 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
||||
int elementScale = businessSubSampleAssessmentProjectDO.getDecimalPosition();
|
||||
// 计算代表值(均值\)
|
||||
// BigDecimal representativeValue = calculateRepresentativeValue(sortedValues, elementScale);
|
||||
DefaultContext<String, Object> context = new DefaultContext<>();
|
||||
Map<String, Object> context = new HashMap<>();
|
||||
context.put("values", sortedValues);
|
||||
context.put("scale", elementScale);
|
||||
BigDecimal representativeValue = null;
|
||||
try {
|
||||
representativeValue = (BigDecimal) expressRunner.execute(calculateAssessmentValue.getExpression(), context, null, false, false);
|
||||
//representativeValue = (BigDecimal) expressRunner.execute(calculateAssessmentValue.getExpression(), context, null, false, false);
|
||||
QLResult expressResult = express4Runner.execute(calculateAssessmentValue.getExpression(), context, QLOptions.builder().precise(true).build());//高精度计算
|
||||
representativeValue = (BigDecimal) expressResult.getResult();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1098,8 +1098,8 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
|
||||
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
|
||||
businessAssayTaskDO.setTaskAssayStatus(QmsCommonConstant.SUBMITTED);
|
||||
businessAssayTaskDO.setAssaySubmitTime(LocalDateTime.now());
|
||||
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.NOT_START);
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.NOT_START);
|
||||
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.IN_PROGRESS);
|
||||
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||
businessAssayTaskMapper.updateById(businessAssayTaskDO);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.business.bus.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -114,21 +115,22 @@ public class SampleEntrustServiceImpl implements SampleEntrustService {
|
||||
sampleEntrustRegistration.put(key, value);
|
||||
});
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.add(sampleEntrustRegistration);
|
||||
|
||||
List<BusinessSampleEntrustDetailExtendRespVO> sampleEntrustDetailExtendRespVOList = new ArrayList<>();
|
||||
List<BusinessSampleEntrustDetailDO> sampleEntrustDetailList = businessSampleEntrustDetailMapper.selectByBusinessSampleEntrustRegistrationId(id);
|
||||
BusinessSampleEntrustDetailExtendRespVO businessSampleEntrustDetailExtendRespVO = null;
|
||||
for (BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO : sampleEntrustDetailList) {
|
||||
businessSampleEntrustDetailExtendRespVO = BeanUtils.toBean(businessSampleEntrustDetailDO, BusinessSampleEntrustDetailExtendRespVO.class);
|
||||
|
||||
List<BusinessSampleEntrustProjectExtendRespVO> businessSampleEntrustProjectExtendRespVOList = businessSampleEntrustProjectMapper.selectByBusinessSampleEntrustDetailId(businessSampleEntrustDetailDO.getId());
|
||||
List<BusinessSampleEntrustDetailExtendRespVO> sampleEntrustDetailExtendRespVOList = businessSampleEntrustDetailMapper.selectExtendByBusinessSampleEntrustRegistrationId(id);
|
||||
for (BusinessSampleEntrustDetailExtendRespVO businessSampleEntrustDetailExtendRespVO : sampleEntrustDetailExtendRespVOList) {
|
||||
List<BusinessSampleEntrustProjectExtendRespVO> businessSampleEntrustProjectExtendRespVOList = businessSampleEntrustProjectMapper.selectByBusinessSampleEntrustDetailId(businessSampleEntrustDetailExtendRespVO.getId());
|
||||
|
||||
businessSampleEntrustDetailExtendRespVO.setSampleEntrustDetailProjectList(businessSampleEntrustProjectExtendRespVOList);
|
||||
|
||||
sampleEntrustDetailExtendRespVOList.add(businessSampleEntrustDetailExtendRespVO);
|
||||
}
|
||||
//样品类型分组统计
|
||||
Map<String, Long> groupMap = sampleEntrustDetailExtendRespVOList.stream().collect(Collectors.groupingBy(BusinessSampleEntrustDetailExtendRespVO::getSampleTypeDictionaryBusinessKey, Collectors.counting()));
|
||||
for (Map.Entry<String, Long> entry : groupMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Long val = entry.getValue();
|
||||
sampleEntrustRegistration.put(key + "Count", val);
|
||||
}
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.add(sampleEntrustRegistration);
|
||||
|
||||
String sampleEntrustDetailJsonString = JSON.toJSONString(sampleEntrustDetailExtendRespVOList, context);
|
||||
result.put("sampleEntrustRegistration", jsonArray);
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface SampleResultReportingService {
|
||||
|
||||
List<BusinessSubParentSampleAssessmentGroupRespVO> getUnReportMethodGroupList(BusinessSubParentSampleAssessmentGroupReqVO reqVO);
|
||||
|
||||
JSONObject getSampleResultReportingList(Long configAssayMethodId);
|
||||
JSONObject getSampleResultReportingList(BusinessSubParentSampleAssessmentGroupReqVO reqVO);
|
||||
|
||||
List<RecheckSubSampleParentMethodRespVO> getRecheckAssayMethodList(Long baseSampleId, Long businessSubParentSampleId, Long configAssayMethodId);
|
||||
|
||||
|
||||
@@ -115,8 +115,8 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getSampleResultReportingList(Long configAssayMethodId) {
|
||||
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(configAssayMethodId);
|
||||
public JSONObject getSampleResultReportingList(BusinessSubParentSampleAssessmentGroupReqVO reqVO) {
|
||||
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectMapper.selectByConfigAssayMethodId(reqVO.getConfigAssayMethodId());
|
||||
List<Map<String, Object>> columnList = new ArrayList<>();
|
||||
|
||||
//动态字段
|
||||
@@ -136,7 +136,7 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
|
||||
//查询结果报送未上报的样品
|
||||
List<NoReportSubParentSampleAssessmentRespVO> noReportSubParentSampleAssessmentRespList = businessSubParentSampleAssessmentProjectMapper.selectNoReportSubParentSampleAssessment(configAssayMethodId);
|
||||
List<NoReportSubParentSampleAssessmentRespVO> noReportSubParentSampleAssessmentRespList = businessSubParentSampleAssessmentProjectMapper.selectNoReportSubParentSampleAssessment(reqVO);
|
||||
|
||||
if (CollUtil.isEmpty(noReportSubParentSampleAssessmentRespList)) {//没有查询到未上报的数据
|
||||
JSONObject json = new JSONObject();
|
||||
@@ -148,18 +148,18 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
//分样id列表
|
||||
List<Long> businessSubParentSampleIds = noReportSubParentSampleAssessmentRespList.stream().map(m -> m.getBusinessSubParentSampleId()).collect(Collectors.toList());
|
||||
//报送的检测项目数据
|
||||
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentDOList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId);
|
||||
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentDOList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, reqVO.getConfigAssayMethodId());
|
||||
//获取分析任务数
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId);
|
||||
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, reqVO.getConfigAssayMethodId());
|
||||
List<Long> businessSubSampleIds = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleId()).distinct().collect(Collectors.toList());
|
||||
//获取子样数据
|
||||
List<BusinessSubSampleDO> businessSubSampleDOList = businessSubSampleMapper.selectByIds(businessSubSampleIds);
|
||||
|
||||
//获取结果判定数据
|
||||
List<BusinessSubSampleAssessmentProjectExtendRespVO> businessSubSampleAssessmentExtendRespVOList = businessSubSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId);
|
||||
List<BusinessSubSampleAssessmentProjectExtendRespVO> businessSubSampleAssessmentExtendRespVOList = businessSubSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIds, reqVO.getConfigAssayMethodId());
|
||||
|
||||
//获取复测业务数据
|
||||
List<BusinessSubSampleParentRecheckDO> businessSubSampleParentRecheckDOList = businessSubSampleParentRecheckMapper.selectByRecheckBusinessSubParentSampleIdsAndRecheckConfigAssayMethodId(businessSubParentSampleIds, configAssayMethodId);
|
||||
List<BusinessSubSampleParentRecheckDO> businessSubSampleParentRecheckDOList = businessSubSampleParentRecheckMapper.selectByRecheckBusinessSubParentSampleIdsAndRecheckConfigAssayMethodId(businessSubParentSampleIds, reqVO.getConfigAssayMethodId());
|
||||
|
||||
//循环未上报的样品
|
||||
for (NoReportSubParentSampleAssessmentRespVO noReportSubParentSampleAssessmentRespVO : noReportSubParentSampleAssessmentRespList) {
|
||||
@@ -170,6 +170,7 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
Map<String, Object> subSampleAssessmentBeforeMap = BeanUtil.copyProperties(noReportSubParentSampleAssessmentMap, Map.class);
|
||||
Map<String, Object> subSampleAssessmentMap = BeanUtil.copyProperties(noReportSubParentSampleAssessmentMap, Map.class);
|
||||
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> curBusinessSubParentSampleAssessmentDOList = businessSubParentSampleAssessmentDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleId())).collect(Collectors.toList());
|
||||
noReportSubParentSampleAssessmentMap.put("sampleReceiveTime", noReportSubParentSampleAssessmentRespVO.getSampleReceiveTime());
|
||||
noReportSubParentSampleAssessmentMap.put("configAssayMethodName", "报出结果");
|
||||
StringBuilder businessSubParentSampleAssessmentIds = new StringBuilder();
|
||||
for (BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentDO : curBusinessSubParentSampleAssessmentDOList) {
|
||||
@@ -187,6 +188,7 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
List<BusinessSubSampleAssessmentProjectExtendRespVO> businessSubSampleAssessmentExtendBeforeList = businessSubSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubSampleParentRecheckDO.getBusinessSubParentSampleId(), businessSubSampleParentRecheckDO.getConfigAssayMethodId());
|
||||
StringBuilder businessSubSampleAssessmentIdsBefore = new StringBuilder();
|
||||
for (BusinessSubSampleAssessmentProjectExtendRespVO businessSubSampleAssessmentProjectExtendRespVO : businessSubSampleAssessmentExtendBeforeList) {
|
||||
subSampleAssessmentBeforeMap.put("sampleReceiveTime", noReportSubParentSampleAssessmentRespVO.getSampleReceiveTime());
|
||||
subSampleAssessmentBeforeMap.put("configAssayMethodName", businessSubSampleAssessmentProjectExtendRespVO.getConfigAssayMethodName());
|
||||
subSampleAssessmentBeforeMap.put(businessSubSampleAssessmentProjectExtendRespVO.getSimpleName(), businessSubSampleAssessmentProjectExtendRespVO.getAssessmentValue());
|
||||
businessSubSampleAssessmentIdsBefore.append(businessSubSampleAssessmentProjectExtendRespVO.getId()).append(",");
|
||||
@@ -202,6 +204,7 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
List<BusinessSubSampleAssessmentProjectExtendRespVO> businessSubSampleAssessmentList = businessSubSampleAssessmentExtendRespVOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleId())).collect(Collectors.toList());
|
||||
StringBuilder businessSubSampleAssessmentIds = new StringBuilder();
|
||||
for (BusinessSubSampleAssessmentProjectExtendRespVO businessSubSampleAssessmentProjectExtendRespVO : businessSubSampleAssessmentList) {
|
||||
subSampleAssessmentMap.put("sampleReceiveTime", noReportSubParentSampleAssessmentRespVO.getSampleReceiveTime());
|
||||
subSampleAssessmentMap.put("configAssayMethodName", businessSubSampleAssessmentProjectExtendRespVO.getConfigAssayMethodName());
|
||||
subSampleAssessmentMap.put(businessSubSampleAssessmentProjectExtendRespVO.getSimpleName(), businessSubSampleAssessmentProjectExtendRespVO.getAssessmentValue());
|
||||
businessSubSampleAssessmentIds.append(businessSubSampleAssessmentProjectExtendRespVO.getId()).append(",");
|
||||
@@ -498,7 +501,7 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentList = businessSubParentSampleAssessmentExtendList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(businessSubParentSampleDO.getId())).collect(Collectors.toList());
|
||||
for (BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessment : businessSubParentSampleAssessmentList) {
|
||||
Long configAssayMethodProjectId = businessSubParentSampleAssessment.getConfigAssayMethodProjectId();
|
||||
List<ConfigProjectExtendRespVO> configProjectFeildList = configProjectList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectId)).collect(Collectors.toList());
|
||||
List<ConfigProjectExtendRespVO> configProjectFeildList = configProjectList.stream().filter(f -> f.getConfigAssayMethodProjectId() != null && 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);
|
||||
@@ -580,7 +583,9 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
||||
List<BusinessSubParentSampleDO> currentBusinessSubParentSampleDOList = businessSubParentSampleMapper.selectByBusinessBaseSampleIds(currentBusinessBaseSampleIdList);
|
||||
List<Long> currentBusinessSubParentSampleIdList = currentBusinessSubParentSampleDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
||||
List<BusinessSubParentSampleAssessmentDO> currentBusinessSubParentSampleAssessmentDOList = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIds(currentBusinessSubParentSampleIdList);
|
||||
long count = currentBusinessSubParentSampleAssessmentDOList.stream().filter(f -> !reqVO.getBusinessSubParentSampleIds().contains(f.getBusinessSubParentSampleId()) && !f.getConfigAssayMethodId().equals(reqVO.getConfigAssayMethodId()) && f.getIsReported().equals(QmsCommonConstant.NO)).count();
|
||||
|
||||
//排除不在reqVO.getBusinessSubParentSampleIds()并且方法reqVO.getConfigAssayMethodId()的数据,其他数据校验是否已上报
|
||||
long count = currentBusinessSubParentSampleAssessmentDOList.stream().filter(f -> !(reqVO.getBusinessSubParentSampleIds().contains(f.getBusinessSubParentSampleId()) && f.getConfigAssayMethodId().equals(reqVO.getConfigAssayMethodId())) && f.getIsReported().equals(QmsCommonConstant.NO)).count();
|
||||
if (count > 0) {//如果还存在未上报的数据,则继续
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
|
||||
jsonObject = new JSONObject();
|
||||
jsonObject.put("configAssayMethodId", configSubSampleMethod.getConfigAssayMethodId());
|
||||
jsonObject.put("configAssayMethodName", configSubSampleMethod.getConfigAssayMethodName());
|
||||
jsonObject.put("configAssayMethodNameAndCategory", configSubSampleMethod.getConfigAssayMethodNameAndCategory());
|
||||
jsonObject.put("configAssayMethodCode", configSubSampleMethod.getConfigAssayMethodCode());
|
||||
|
||||
StringBuilder assayProjectBuilder = new StringBuilder();
|
||||
|
||||
@@ -24,6 +24,9 @@ public class ConfigAssayMethodPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "方法名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "方法名称及类别")
|
||||
private String methodNameCategory;
|
||||
|
||||
@Schema(description = "方法编号")
|
||||
private String methodCode;
|
||||
|
||||
@@ -25,6 +25,9 @@ public class ConfigAssayMethodReqVO {
|
||||
@Schema(description = "方法名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "方法名称及类别")
|
||||
private String methodNameCategory;
|
||||
|
||||
@Schema(description = "方法编号")
|
||||
private String methodCode;
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ public class ConfigAssayMethodRespVO {
|
||||
@ExcelProperty("方法名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "方法名称及类别")
|
||||
private String methodNameCategory;
|
||||
|
||||
@Schema(description = "方法编号")
|
||||
@ExcelProperty("方法编号")
|
||||
private String methodCode;
|
||||
|
||||
@@ -24,6 +24,9 @@ public class ConfigAssayMethodSaveReqVO {
|
||||
@Schema(description = "方法名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "方法名称及类别")
|
||||
private String methodNameCategory;
|
||||
|
||||
@Schema(description = "方法编号")
|
||||
private String methodCode;
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class ConfigSubSampleMethodExtendRespVO extends ConfigSubSampleMethodResp
|
||||
@Schema(description = "分析方法名称")
|
||||
private String configAssayMethodName;
|
||||
|
||||
@Schema(description = "检测方法配置名称及类别")
|
||||
private String configAssayMethodNameAndCategory;
|
||||
|
||||
/** 分析方法编号 **/
|
||||
@Schema(description = "分析方法编号")
|
||||
private String configAssayMethodCode;
|
||||
|
||||
@@ -57,6 +57,11 @@ public class ConfigAssayMethodDO extends BusinessBaseDO {
|
||||
@TableField("MTHD_CD")
|
||||
private String methodCode;
|
||||
/**
|
||||
* 方法名称及类别
|
||||
*/
|
||||
@TableField("MTHD_NAME_CTGR")
|
||||
private String methodNameCategory;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@TableField("DSP")
|
||||
|
||||
@@ -27,6 +27,7 @@ public interface ConfigAssayMethodMapper extends BaseMapperX<ConfigAssayMethodDO
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDictionaryBusinessKey, reqVO.getDictionaryBusinessKey())
|
||||
.likeIfPresent(ConfigAssayMethodDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getMethodNameCategory, reqVO.getMethodNameCategory())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getMethodCode, reqVO.getMethodCode())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDescription, reqVO.getDescription())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getIsEnabled, reqVO.getIsEnabled())
|
||||
@@ -51,6 +52,7 @@ public interface ConfigAssayMethodMapper extends BaseMapperX<ConfigAssayMethodDO
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDictionaryBusinessKey, reqVO.getDictionaryBusinessKey())
|
||||
.likeIfPresent(ConfigAssayMethodDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getMethodNameCategory, reqVO.getMethodNameCategory())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getMethodCode, reqVO.getMethodCode())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDescription, reqVO.getDescription())
|
||||
.eqIfPresent(ConfigAssayMethodDO::getDataCollectionKey, reqVO.getDataCollectionKey())
|
||||
|
||||
@@ -43,6 +43,7 @@ public interface ConfigSubSampleMethodMapper extends BaseMapperX<ConfigSubSample
|
||||
.leftJoin(ConfigAssayMethodDO.class, ConfigAssayMethodDO::getId, ConfigSubSampleMethodDO::getConfigAssayMethodId)
|
||||
.selectAll(ConfigSubSampleMethodDO.class)
|
||||
.selectAs(ConfigAssayMethodDO::getName, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodName)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodNameCategory, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodNameAndCategory)
|
||||
.selectAs(ConfigAssayMethodDO::getMethodCode, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodCode)
|
||||
.eq(ConfigSubSampleMethodDO::getConfigSubSampleId, configSubSampleId)
|
||||
.eq(ConfigAssayMethodDO::getAssayDepartmentId, assayDepartmentId));
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.async;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class AsyncConfig {
|
||||
@Bean("asyncTaskExecutor")
|
||||
public Executor asyncTaskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(5);
|
||||
executor.setMaxPoolSize(10);
|
||||
executor.setQueueCapacity(100);
|
||||
executor.setThreadNamePrefix("Async-");
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTy
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentDataService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentTypeService;
|
||||
import com.zt.plat.module.qms.common.data.service.DataTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -62,16 +63,12 @@ public class ReportDocumentDataController extends AbstractFileUploadController i
|
||||
@GetMapping("/queryReportDetail")
|
||||
@Operation(summary = "查询报告明细数据")
|
||||
@Parameter(name = "mainId", description = "报告id", required = true, example = "1024")
|
||||
public CommonResult<List<JSONObject>> queryReportDetail(@RequestParam("mainId") Long mainId) {
|
||||
public CommonResult<?> queryReportDetail(@RequestParam("mainId") Long mainId, @RequestParam(name = "pageFlag", required = false) String pageFlag) {
|
||||
|
||||
ReportDocumentMainDO mainDO = reportDocumentMainService.getReportDocumentMain(mainId);
|
||||
Long typeId = mainDO.getReportDocumentTypeId();
|
||||
ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(typeId);
|
||||
Long confId = typeDO.getConfigReportTypeId();
|
||||
// Map<String, Object> param = new HashMap<>();
|
||||
// List<ReportDocumentDataDO> list = reportDocumentDataService.listByMainDataId(mainId).getData();
|
||||
// return success(BeanUtils.toBean(list, ReportDocumentDataRespVO.class));
|
||||
CommonResult<List<JSONObject>> result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO);
|
||||
CommonResult<JSONArray> result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO, pageFlag);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO;
|
||||
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 com.zt.plat.framework.business.annotation.FileUploadController;
|
||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||
|
||||
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.*;
|
||||
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.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentFileDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentFileService;
|
||||
|
||||
@Tag(name = "管理后台 - 检测报告附件")
|
||||
@RestController
|
||||
@RequestMapping("/qms/report-document-file")
|
||||
@Validated
|
||||
@FileUploadController(source = "qms.reportdocumentfile")
|
||||
public class ReportDocumentFileController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||
|
||||
static {
|
||||
FileUploadController annotation = ReportDocumentFileController.class.getAnnotation(FileUploadController.class);
|
||||
if (annotation != null) {
|
||||
setFileUploadInfo(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private ReportDocumentFileService reportDocumentFileService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检测报告附件")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:create')")
|
||||
public CommonResult<ReportDocumentFileRespVO> createReportDocumentFile(@Valid @RequestBody ReportDocumentFileSaveReqVO createReqVO) {
|
||||
return success(reportDocumentFileService.createReportDocumentFile(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新检测报告附件")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:update')")
|
||||
public CommonResult<Boolean> updateReportDocumentFile(@Valid @RequestBody ReportDocumentFileSaveReqVO updateReqVO) {
|
||||
reportDocumentFileService.updateReportDocumentFile(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除检测报告附件")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:delete')")
|
||||
public CommonResult<Boolean> deleteReportDocumentFile(@RequestParam("id") Long id) {
|
||||
reportDocumentFileService.deleteReportDocumentFile(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除检测报告附件")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:delete')")
|
||||
public CommonResult<Boolean> deleteReportDocumentFileList(@RequestBody BatchDeleteReqVO req) {
|
||||
reportDocumentFileService.deleteReportDocumentFileListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得检测报告附件")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:query')")
|
||||
public CommonResult<ReportDocumentFileRespVO> getReportDocumentFile(@RequestParam("id") Long id) {
|
||||
ReportDocumentFileDO reportDocumentFile = reportDocumentFileService.getReportDocumentFile(id);
|
||||
return success(BeanUtils.toBean(reportDocumentFile, ReportDocumentFileRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检测报告附件分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:query')")
|
||||
public CommonResult<PageResult<ReportDocumentFileRespVO>> getReportDocumentFilePage(@Valid ReportDocumentFilePageReqVO pageReqVO) {
|
||||
PageResult<ReportDocumentFileDO> pageResult = reportDocumentFileService.getReportDocumentFilePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ReportDocumentFileRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出检测报告附件 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportReportDocumentFileExcel(@Valid ReportDocumentFilePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ReportDocumentFileDO> list = reportDocumentFileService.getReportDocumentFilePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检测报告附件.xls", "数据", ReportDocumentFileRespVO.class,
|
||||
BeanUtils.toBean(list, ReportDocumentFileRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,26 +14,27 @@ import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigUserSignatureDO;
|
||||
import com.zt.plat.module.qms.business.config.service.ConfigUserSignatureService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentDataDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentDataService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentTypeService;
|
||||
import com.zt.plat.module.qms.common.data.dal.dataobject.DataTemplateDO;
|
||||
import com.zt.plat.module.qms.common.data.service.DataTemplateService;
|
||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkOperationRespDTO;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkWorkflowCreateReqDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
@@ -59,6 +60,19 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
@Resource private ReportDocumentDataService reportDocumentDataService;
|
||||
@Resource private ReportDocumentTypeService reportDocumentTypeService;
|
||||
@Resource private ConfigUserSignatureService configUserSignatureService;
|
||||
@Resource private DataTemplateService dataTemplateService;
|
||||
|
||||
@RequestMapping("/testAsyncTask")
|
||||
public CommonResult<String> testAsyncTask(@RequestParam Long id) {
|
||||
ReportDocumentMainSaveReqVO reqVO = new ReportDocumentMainSaveReqVO();
|
||||
reqVO.setId(id);
|
||||
reqVO.setFlowStatus("async");
|
||||
reportDocumentMainService.updateReportDocumentMain(reqVO);
|
||||
|
||||
reportDocumentMainService.testAsyncTask(id);
|
||||
return CommonResult.success("success");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检测报告")
|
||||
@@ -78,6 +92,11 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
if(typeDO == null){
|
||||
return error(REPORT_DOCUMENT_TYPE_NOT_EXISTS, "报告类型不存在,请刷新后重试");
|
||||
}
|
||||
String dataTemplateKey = typeDO.getReportKey();
|
||||
DataTemplateDO dataTemplateDO = dataTemplateService.getLatestDataByKey(dataTemplateKey);
|
||||
if(dataTemplateDO == null)
|
||||
return error(REPORT_DOCUMENT_TYPE_NOT_EXISTS, "表单编辑器模板不存在,请联系管理员处理");
|
||||
vo.setDataTemplateId(dataTemplateDO.getId());
|
||||
vo.setDocumentTitle(typeDO.getName());
|
||||
vo.setFlowKey(typeDO.getFlowKey());
|
||||
vo.setDocumentType(typeDO.getDocumentType());
|
||||
@@ -189,58 +208,32 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
|
||||
//处理抬头数据
|
||||
|
||||
if("true".equals(editFlag)){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String formData = vo.getFormData();
|
||||
JSONObject formDataJson = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty(formData))
|
||||
formDataJson = JSONObject.parseObject(formData);
|
||||
List<ReportDocumentDataDO> dataList = reportDocumentDataService.listByMainDataId(id).getData();
|
||||
ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(reportDocumentMain.getReportDocumentTypeId());
|
||||
String customConfig = typeDO.getCustomConfig();
|
||||
String defaultConclusion = "";
|
||||
if(!ObjectUtils.isEmpty(customConfig)){
|
||||
JSONObject config = JSONObject.parseObject(customConfig);
|
||||
defaultConclusion = config.getString("defaultConclusion");
|
||||
}
|
||||
formDataJson.put("conclusion", defaultConclusion);
|
||||
if(!dataList.isEmpty())
|
||||
formDataJson.put("sampleName", dataList.get(0).getSampleName());
|
||||
//处理检测标准
|
||||
String standard = assembleStandard(dataList);
|
||||
formDataJson.put("standard", standard);
|
||||
formDataJson.put("reportTime", sdf.format(new Date()));
|
||||
vo.setFormData(formDataJson.toJSONString());
|
||||
// ReportDocumentMainSaveReqVO updateVO = new ReportDocumentMainSaveReqVO();
|
||||
// updateVO.setId(reportDocumentMain.getId());
|
||||
// updateVO.setFormData(formDataJson.toJSONString());
|
||||
// reportDocumentMainService.updateReportDocumentMain(updateVO);
|
||||
}
|
||||
// if("true".equals(editFlag)){
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// String formData = vo.getFormData();
|
||||
// JSONObject formDataJson = new JSONObject();
|
||||
// if(!ObjectUtils.isEmpty(formData))
|
||||
// formDataJson = JSONObject.parseObject(formData);
|
||||
// List<ReportDocumentDataDO> dataList = reportDocumentDataService.listByMainDataId(id).getData();
|
||||
// ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(reportDocumentMain.getReportDocumentTypeId());
|
||||
// String customConfig = typeDO.getCustomConfig();
|
||||
// String defaultConclusion = "";
|
||||
// if(!ObjectUtils.isEmpty(customConfig)){
|
||||
// JSONObject config = JSONObject.parseObject(customConfig);
|
||||
// defaultConclusion = config.getString("defaultConclusion");
|
||||
// }
|
||||
// formDataJson.put("conclusion", defaultConclusion);
|
||||
// if(!dataList.isEmpty())
|
||||
// formDataJson.put("sampleName", dataList.get(0).getSampleName());
|
||||
// //处理检测标准
|
||||
// String standard = assembleStandard(dataList);
|
||||
// formDataJson.put("standard", standard);
|
||||
// formDataJson.put("reportTime", sdf.format(new Date()));
|
||||
// vo.setFormData(formDataJson.toJSONString());
|
||||
// }
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
private String assembleStandard(List<ReportDocumentDataDO> dataList){
|
||||
|
||||
Set<String> standardSet = new HashSet<>();
|
||||
for(ReportDocumentDataDO data : dataList){
|
||||
String content = data.getDocumentContent();
|
||||
if(ObjectUtils.isEmpty( content))
|
||||
continue;
|
||||
JSONObject json = JSONObject.parseObject(content);
|
||||
for(String key : json.keySet()){
|
||||
JSONObject obj = json.getJSONObject(key);
|
||||
String methodName = obj.getString("methodName");
|
||||
if(ObjectUtils.isEmpty(methodName))
|
||||
continue;
|
||||
standardSet.add(methodName);
|
||||
}
|
||||
}
|
||||
if(standardSet.isEmpty())
|
||||
return "";
|
||||
return String.join(",", standardSet);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检测报告业务分页")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:report-document-main:query')")
|
||||
@@ -261,4 +254,23 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
|
||||
ExcelUtils.write(response, "检测报告业务.xls", "数据", ReportDocumentMainRespVO.class, list);
|
||||
}
|
||||
|
||||
@GetMapping("/testCreateIworkWorkflow")
|
||||
@Operation(summary = "测试发起iwork流程")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:report-document-main:query')")
|
||||
public CommonResult<IWorkOperationRespDTO> createIworkWorkflow() {
|
||||
IWorkWorkflowCreateReqDTO req = new IWorkWorkflowCreateReqDTO();
|
||||
req.setJbr("1001");
|
||||
req.setYybm("2001");
|
||||
req.setFb("3001");
|
||||
req.setSqsj("2025-01-01");
|
||||
req.setYyqx("对外邮寄");
|
||||
// req.setYyfkUrl("https://files.example.com/evidence.pdf");
|
||||
req.setYysy("与客户合同用印");
|
||||
req.setXyywjUrl("http://172.16.46.63:30002/yudao/20251204/%E6%B5%8B%E8%AF%95pdf_1764818842846.pdf?response-cache-control=no-cache%2C%20no-store%2C%20must-revalidate&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20251209T093343Z&X-Amz-SignedHeaders=host&X-Amz-Credential=EKplIEnbNgfYBAZbEJNa%2F20251209%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Expires=86400&X-Amz-Signature=37d63249667ea855f9a51bdf47bbb044d5860c302721f52fff2ba644985bae4c");
|
||||
req.setYysx("检测报告用印");
|
||||
req.setYwxtdjbh("JY-20251209-0001");
|
||||
// CommonResult<IWorkOperationRespDTO> ret = reportDocumentMainService.createIWorkflow(req);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,4 +43,16 @@ public class ReportDocumentDataPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "样品大类名称")
|
||||
private String baseSampleName;
|
||||
|
||||
@Schema(description = "样品类型key")
|
||||
private String sampleTypeKey;
|
||||
|
||||
@Schema(description = "委托样品名称")
|
||||
private String entrustSampleName;
|
||||
|
||||
@Schema(description = "委托样品编号")
|
||||
private String entrustSampleCode;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -56,6 +56,22 @@ public class ReportDocumentDataRespVO {
|
||||
@ExcelProperty("样品大类名称")
|
||||
private String baseSampleName;
|
||||
|
||||
@Schema(description = "样品类型key")
|
||||
@ExcelProperty("样品类型key")
|
||||
private String sampleTypeKey;
|
||||
|
||||
@Schema(description = "委托样品名称")
|
||||
@ExcelProperty("委托样品名称")
|
||||
private String entrustSampleName;
|
||||
|
||||
@Schema(description = "委托样品编号")
|
||||
@ExcelProperty("委托样品编号")
|
||||
private String entrustSampleCode;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
//==================扩展字段===========
|
||||
|
||||
@Schema(description = "样品创建时间")
|
||||
|
||||
@@ -40,4 +40,16 @@ public class ReportDocumentDataSaveReqVO {
|
||||
@Schema(description = "样品大类名称")
|
||||
private String baseSampleName;
|
||||
|
||||
@Schema(description = "样品类型key")
|
||||
private String sampleTypeKey;
|
||||
|
||||
@Schema(description = "委托样品名称")
|
||||
private String entrustSampleName;
|
||||
|
||||
@Schema(description = "委托样品编号")
|
||||
private String entrustSampleCode;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.controller.vo;
|
||||
|
||||
import lombok.*;
|
||||
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 ReportDocumentFilePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "报告id", example = "20899")
|
||||
private Long mainId;
|
||||
|
||||
@Schema(description = "文件表ID", example = "25498")
|
||||
private Long fileId;
|
||||
|
||||
@Schema(description = "文件名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "文件类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "版本")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检测报告附件 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ReportDocumentFileRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29698")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "报告id", example = "20899")
|
||||
@ExcelProperty("报告id")
|
||||
private Long mainId;
|
||||
|
||||
@Schema(description = "文件表ID", example = "25498")
|
||||
@ExcelProperty("文件表ID")
|
||||
private Long fileId;
|
||||
|
||||
@Schema(description = "文件名称", example = "李四")
|
||||
@ExcelProperty("文件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "路径")
|
||||
@ExcelProperty("路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("文件地址")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "文件类型", example = "1")
|
||||
@ExcelProperty("文件类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "版本")
|
||||
@ExcelProperty("版本")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
@ExcelProperty("所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检测报告附件新增/修改 Request VO")
|
||||
@Data
|
||||
public class ReportDocumentFileSaveReqVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29698")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "报告id", example = "20899")
|
||||
private Long mainId;
|
||||
|
||||
@Schema(description = "文件表ID", example = "25498")
|
||||
private Long fileId;
|
||||
|
||||
@Schema(description = "文件名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "文件类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "版本")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -88,4 +88,10 @@ public class ReportDocumentMainPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "表单设计器模板id")
|
||||
private Long dataTemplateId;
|
||||
|
||||
@Schema(description = "附件版本")
|
||||
private Integer documentVersion;
|
||||
|
||||
@Schema(description = "异步执行状态")
|
||||
private String executionStatus;
|
||||
}
|
||||
@@ -115,6 +115,13 @@ public class ReportDocumentMainRespVO {
|
||||
@ExcelProperty("表单设计器模板id")
|
||||
private Long dataTemplateId;
|
||||
|
||||
@Schema(description = "附件版本")
|
||||
@ExcelProperty("附件版本")
|
||||
private Integer documentVersion;
|
||||
|
||||
@Schema(description = "异步执行状态")
|
||||
@ExcelProperty("异步执行状态")
|
||||
private String executionStatus;
|
||||
//==============================扩展字段=======================================
|
||||
@Schema(description = "记录数")
|
||||
@ExcelProperty("记录数")
|
||||
|
||||
@@ -90,6 +90,11 @@ public class ReportDocumentMainSaveReqVO {
|
||||
@Schema(description = "表单设计器模板id")
|
||||
private Long dataTemplateId;
|
||||
|
||||
@Schema(description = "附件版本")
|
||||
private Integer documentVersion;
|
||||
|
||||
@Schema(description = "异步执行状态")
|
||||
private String executionStatus;
|
||||
|
||||
//====================附加属性==============================
|
||||
@Schema(description = "委托id,支持多值")
|
||||
|
||||
@@ -75,8 +75,26 @@ public class ReportDocumentDataDO extends BusinessBaseDO {
|
||||
@TableField("BSE_SMP_NAME")
|
||||
private String baseSampleName;
|
||||
|
||||
//样品类型key
|
||||
@TableField("SMP_TP_KY")
|
||||
private String sampleTypeKey;
|
||||
|
||||
/**
|
||||
* 委托样品名称
|
||||
*/
|
||||
@TableField("ENTT_SMP_NAME")
|
||||
private String entrustSampleName;
|
||||
/**
|
||||
* 委托样品编号
|
||||
*/
|
||||
@TableField("ENTT_SMP_CD")
|
||||
private String entrustSampleCode;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("SRT")
|
||||
private Integer sort;
|
||||
//==================扩展字段===========
|
||||
|
||||
//样品创建时间
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
/**
|
||||
* 检测报告附件 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("t_rpt_doc_file")
|
||||
@KeySequence("t_rpt_doc_file_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class ReportDocumentFileDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 报告id
|
||||
*/
|
||||
@TableField("MAIN_ID")
|
||||
private Long mainId;
|
||||
/**
|
||||
* 文件表ID
|
||||
*/
|
||||
@TableField("FILE_ID")
|
||||
private Long fileId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@TableField("PATH")
|
||||
private String path;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
@TableField("URL")
|
||||
private String url;
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
@TableField("TP")
|
||||
private String type;
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
@TableField("VER")
|
||||
private Integer version;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
private String systemDepartmentCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("RMK")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -141,4 +141,12 @@ public class ReportDocumentMainDO extends BusinessBaseDO {
|
||||
//表单设计器模板id
|
||||
@TableField("DAT_TMPL_ID")
|
||||
private Long dataTemplateId;
|
||||
|
||||
//表单设计器模板id
|
||||
@TableField("DOC_VER")
|
||||
private Integer documentVersion;
|
||||
|
||||
//异步执行状态
|
||||
@TableField("EXC_STS")
|
||||
private String executionStatus;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.dal.mapper;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentFileDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 检测报告附件 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReportDocumentFileMapper extends BaseMapperX<ReportDocumentFileDO> {
|
||||
|
||||
default PageResult<ReportDocumentFileDO> selectPage(ReportDocumentFilePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ReportDocumentFileDO>()
|
||||
.eqIfPresent(ReportDocumentFileDO::getMainId, reqVO.getMainId())
|
||||
.eqIfPresent(ReportDocumentFileDO::getFileId, reqVO.getFileId())
|
||||
.likeIfPresent(ReportDocumentFileDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ReportDocumentFileDO::getPath, reqVO.getPath())
|
||||
.eqIfPresent(ReportDocumentFileDO::getUrl, reqVO.getUrl())
|
||||
.eqIfPresent(ReportDocumentFileDO::getType, reqVO.getType())
|
||||
.eqIfPresent(ReportDocumentFileDO::getVersion, reqVO.getVersion())
|
||||
.eqIfPresent(ReportDocumentFileDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.betweenIfPresent(ReportDocumentFileDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(ReportDocumentFileDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(ReportDocumentFileDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.service;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zt.plat.framework.common.exception.ServiceException;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.security.core.LoginUser;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.infra.api.file.FileApi;
|
||||
import com.zt.plat.module.infra.api.file.dto.FileCreateReqDTO;
|
||||
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentFileDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
|
||||
import com.zt.plat.module.qms.common.data.dal.dataobject.DataTemplateDO;
|
||||
import com.zt.plat.module.qms.common.data.service.DataTemplateService;
|
||||
import com.zt.plat.module.qms.core.code.SequenceUtil;
|
||||
import com.zt.plat.module.system.api.iwork.IWorkIntegrationApi;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkOperationRespDTO;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkWorkflowCreateReqDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.REPORT_DOCUMENT_FILE_NOT_EXISTS;
|
||||
|
||||
/*
|
||||
* 处理报告附件和发起iwork流程
|
||||
* */
|
||||
@Service("reportDocumentAssistService")
|
||||
@Slf4j
|
||||
public class ReportDocumentAssistService {
|
||||
@Resource
|
||||
private IWorkIntegrationApi iWorkIntegrationApi;
|
||||
|
||||
@Value("${zzjc.html2pdf.addr:}")
|
||||
private String html2pdfAddr;
|
||||
|
||||
@Resource private ReportDocumentDataService reportDocumentDataService;
|
||||
@Resource private ReportDocumentTypeService reportDocumentTypeService;
|
||||
@Resource private ReportDocumentFileService reportDocumentFileService;
|
||||
@Resource private DataTemplateService dataTemplateService;
|
||||
@Resource private SequenceUtil sequenceUtil;
|
||||
@Resource private FileApi fileApi;
|
||||
|
||||
private String sequenceKey = "QMS_REPORT_IWORK_CODE";
|
||||
|
||||
// todo 判断是否更新pdf
|
||||
public boolean checkUpdateDocFile(JSONObject variables){
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* 更新报告附件,并发起iwork流程*/
|
||||
public void updateDocFileAndCreateIWorkflow(JSONObject variables, ReportDocumentMainDO entity) throws IOException {
|
||||
// boolean updateDocFileFlag = true;
|
||||
boolean createIworkWorkflowFlag = false;
|
||||
JSONArray bpmFieldExtensions = variables.getJSONArray("bpmFieldExtensions");
|
||||
if(bpmFieldExtensions == null)
|
||||
bpmFieldExtensions = new JSONArray();
|
||||
for(int i = 0; i < bpmFieldExtensions.size(); i++){
|
||||
JSONObject extension = bpmFieldExtensions.getJSONObject(i);
|
||||
String fieldName = extension.getString("fieldName");
|
||||
String stringValue = extension.getString("stringValue");
|
||||
if(fieldName.equals("creatIWorkFlow") && stringValue.equals("1")){
|
||||
createIworkWorkflowFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ReportDocumentFileDO docFile = generatePdf(entity);
|
||||
if(createIworkWorkflowFlag){
|
||||
createIWorkflow(entity, docFile);
|
||||
}
|
||||
// todo 判断是否更新pdf
|
||||
|
||||
// if(!updateDocFileFlag && createIworkWorkflowFlag){
|
||||
// ReportDocumentFileDO docFile = reportDocumentFileService.getReportDocumentFile(entity.getId());
|
||||
// createIWorkflow(entity, docFile);
|
||||
// return;
|
||||
// }
|
||||
|
||||
//更新报告pdf
|
||||
|
||||
// if(updateDocFileFlag){
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
* 发起iwork用印*/
|
||||
public CommonResult<IWorkOperationRespDTO> createIWorkflow(ReportDocumentMainDO entity, ReportDocumentFileDO docFile) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
IWorkWorkflowCreateReqDTO dto = new IWorkWorkflowCreateReqDTO();
|
||||
dto.setJbr(String.valueOf(loginUser.getId()));
|
||||
dto.setYybm(String.valueOf(loginUser.getVisitDeptId()));
|
||||
dto.setFb(String.valueOf(loginUser.getVisitCompanyId()));
|
||||
dto.setSqsj(sdf.format(new Date()));
|
||||
dto.setYyqx("检测报告用印");
|
||||
dto.setYysy("检测报告用印");
|
||||
// dto.setXyywjUrl(docFile.getUrl());
|
||||
dto.setXyywjUrl("http://172.16.46.63:30002/yudao/20251204/%E6%B5%8B%E8%AF%95pdf_1764818842846.pdf?response-cache-control=no-cache%2C%20no-store%2C%20must-revalidate&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20251209T093343Z&X-Amz-SignedHeaders=host&X-Amz-Credential=EKplIEnbNgfYBAZbEJNa%2F20251209%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Expires=86400&X-Amz-Signature=37d63249667ea855f9a51bdf47bbb044d5860c302721f52fff2ba644985bae4c");
|
||||
dto.setYwxtdjbh(sequenceUtil.genCode(sequenceKey));
|
||||
return iWorkIntegrationApi.createWorkflow(dto);
|
||||
}
|
||||
|
||||
/*
|
||||
* 生成新版pdf文件
|
||||
* 在reportDocumentFile创建新pdf文件
|
||||
* */
|
||||
public ReportDocumentFileDO generatePdf(ReportDocumentMainDO mainDO) throws IOException {
|
||||
String pageFlag = "1"; //分页处理
|
||||
Long typeId = mainDO.getReportDocumentTypeId();
|
||||
ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(typeId);
|
||||
DataTemplateDO templateDO = dataTemplateService.getDataTemplate(mainDO.getDataTemplateId());
|
||||
CommonResult<JSONArray> result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO, pageFlag);
|
||||
JSONArray data = result.getData();
|
||||
String templateContent = templateDO.getFormContent();
|
||||
JSONObject templateData = new JSONObject();
|
||||
JSONArray tableList = data.getJSONArray(0);
|
||||
templateData.put("headerData", tableList.getJSONObject(0).clone());
|
||||
templateData.put("tableList", tableList);
|
||||
templateData.put("formData", mainDO.getFormData());
|
||||
templateData.put("signatureData", mainDO.getDocumentSignature());
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("Template", templateContent);
|
||||
bodyJson.put("Data", templateData.toJSONString());
|
||||
String bodyStr = bodyJson.toJSONString();
|
||||
log.info("html2pdf body: " + bodyStr);
|
||||
log.info("html2pdf--start at {}", LocalDateTime.now());
|
||||
HttpResponse response = HttpUtil.createPost(html2pdfAddr)
|
||||
.body(bodyStr)
|
||||
.timeout(15000)
|
||||
.execute();
|
||||
log.info("html2pdf--end at {}", LocalDateTime.now());
|
||||
InputStream inputStream = response.bodyStream(); // 关键:返回原始 InputStream
|
||||
|
||||
//尝试从响应头中提取文件名
|
||||
String contentDisposition = response.header("Content-Disposition");
|
||||
String defaultName = "检测报告.pdf";
|
||||
String filename = extractFilename(contentDisposition).orElse(defaultName);
|
||||
//inputStream转byte[]
|
||||
byte[] fileBytes = IOUtils.toByteArray(inputStream);
|
||||
|
||||
//上传到文件服务
|
||||
FileCreateReqDTO fileCreateReqDTO = new FileCreateReqDTO();
|
||||
fileCreateReqDTO.setName(filename);
|
||||
fileCreateReqDTO.setDirectory(null);
|
||||
fileCreateReqDTO.setType(null);
|
||||
fileCreateReqDTO.setContent(fileBytes);
|
||||
CommonResult<FileRespDTO> fileResult = fileApi.createFileWithReturn(fileCreateReqDTO);
|
||||
if (fileResult == null || !fileResult.isSuccess() || fileResult.getData() == null) {
|
||||
throw new ServiceException(REPORT_DOCUMENT_FILE_NOT_EXISTS.getCode(), "通过文件服务创建附件失败: " + Optional.ofNullable(fileResult).map(CommonResult::getMsg).orElse("未知错误"));
|
||||
}
|
||||
FileRespDTO fileRespDTO = fileResult.getData();
|
||||
//写入ReportDocumentFile
|
||||
ReportDocumentFileSaveReqVO fileSaveReqVO = new ReportDocumentFileSaveReqVO();
|
||||
fileSaveReqVO.setMainId(mainDO.getId());
|
||||
fileSaveReqVO.setFileId(fileRespDTO.getId());
|
||||
fileSaveReqVO.setName(filename);
|
||||
fileSaveReqVO.setPath(fileRespDTO.getDirectory());
|
||||
fileSaveReqVO.setUrl(fileRespDTO.getUrl());
|
||||
fileSaveReqVO.setVersion(mainDO.getDocumentVersion());
|
||||
reportDocumentFileService.createReportDocumentFile(fileSaveReqVO);
|
||||
return BeanUtils.toBean(fileRespDTO, ReportDocumentFileDO.class);
|
||||
}
|
||||
|
||||
private Optional<String> extractFilename(String contentDisposition) {
|
||||
if (contentDisposition != null && contentDisposition.contains("filename=")) {
|
||||
String filename = contentDisposition.substring(contentDisposition.indexOf("filename=") + 9);
|
||||
filename = filename.replaceAll("\"", "").trim();
|
||||
return Optional.of(filename);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
// private String encodeFilename(String filename) {
|
||||
// try {
|
||||
// return URLEncoder.encode(filename, StandardCharsets.UTF_8.toString())
|
||||
// .replaceAll("\\+", "%20");
|
||||
// } catch (Exception e) {
|
||||
// return "download.bin";
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface ReportDocumentDataService {
|
||||
|
||||
CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig);
|
||||
CommonResult<JSONArray> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig, String pageFlag);
|
||||
|
||||
CommonResult<List<ReportDocumentDataDO>> listByMainDataId(Long mainDataId);
|
||||
CommonResult<Long> countMainDataId(Long mainDataId);
|
||||
|
||||
@@ -27,6 +27,7 @@ import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.e
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.REPORT_DOCUMENT_DATA_NOT_EXISTS;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.REPORT_DOCUMENT_TYPE_NOT_EXISTS;
|
||||
import static com.zt.plat.module.qms.enums.QmsCommonConstant.FIELD_DYNAMIC;
|
||||
import static com.zt.plat.module.qms.enums.QmsCommonConstant.FIELD_CALCULATED;
|
||||
import static com.zt.plat.module.qms.enums.QmsCommonConstant.FIELD_FIXED;
|
||||
|
||||
/**
|
||||
@@ -43,10 +44,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
private final String colPrefix = "col";
|
||||
private final String sampleCodeKey = "SMP_CD";
|
||||
private final String sampleNameKey = "SMP_NAME";
|
||||
private final String name_code_merge = "merge";
|
||||
private final String name_code_name = "name";
|
||||
private final String name_code_code = "code";
|
||||
private final String name_code_split = "split";
|
||||
private final String sampleNameAndCodeKey = "SMP_NAME_CD";
|
||||
private final String entrustSampleNameKey = "ENTT_SMP_NAME";
|
||||
private final String entrustSampleCodeKey = "ENTT_SMP_CD";
|
||||
private final String entrustSampleNameCodeKey = "ENTT_SMP_NAME_CD";
|
||||
private final String rowTypeKey = "rowType"; //行类型
|
||||
private final String rowTypeTitle = "title"; //行类型-标题
|
||||
private final String rowTypeLimit = "limit"; //行类型-检出限
|
||||
private final String rangeKey = "minLimitValue";
|
||||
private final String emptyText = "以下为空白";
|
||||
|
||||
@@ -55,10 +59,16 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* 组装动态报表数据
|
||||
* */
|
||||
@Override
|
||||
public CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO typeDO) {
|
||||
public CommonResult<JSONArray> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO typeDO, String pageFlag) {
|
||||
if(typeDO == null || typeDO.getConfigReportTypeId() == null)
|
||||
return CommonResult.error(REPORT_DOCUMENT_TYPE_NOT_EXISTS.getCode(), "报告配置为空,或未配置报表类型,请联系管理员处理!");
|
||||
String customConfig = typeDO.getCustomConfig();
|
||||
JSONObject configJson = JSONObject.parseObject(customConfig);
|
||||
String verticalFlag = configJson.getString("verticalFlag");
|
||||
String maxRowCountStr = configJson.getString("maxRowCount"); //最大行数
|
||||
Integer maxRowCount = 3;
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr))
|
||||
maxRowCount = Integer.parseInt(maxRowCountStr);
|
||||
//查询报表字段配置
|
||||
ConfigReportFieldPageReqVO fieldParam = new ConfigReportFieldPageReqVO();
|
||||
fieldParam.setConfigReportTypeId(typeDO.getConfigReportTypeId());
|
||||
@@ -67,38 +77,167 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
if(fieldListAll.isEmpty())
|
||||
return CommonResult.error(REPORT_DOCUMENT_TYPE_NOT_EXISTS.getCode(), "未配置报表字段,请联系管理员处理!");
|
||||
List<ReportDocumentDataDO> dataList = listByMainDataId(mainData.getId()).getData();
|
||||
//处理字段,提取有数据的字段
|
||||
List<ConfigReportFieldDO> fieldList = new ArrayList<>();
|
||||
List<String> hasFields = new ArrayList<>();
|
||||
for(ConfigReportFieldDO fieldDO : fieldListAll){
|
||||
String field = fieldDO.getField();
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
//先处理固定列
|
||||
if(FIELD_FIXED.equals(fieldType)){
|
||||
if(!hasFields.contains( field)){
|
||||
fieldList.add(fieldDO);
|
||||
hasFields.add(field);
|
||||
|
||||
//拆分dataList,按样品分类key拆分
|
||||
List<List<ReportDocumentDataDO>> dataListGroup = new ArrayList<>();
|
||||
String[] sampleTypeKeys = new String[]{"inspectionAnalysisSample", "comprehensiveInspectionSample"}; //商检分析样、商检综合样
|
||||
for(String sampleTypeKey : sampleTypeKeys){
|
||||
List<ReportDocumentDataDO> dataListByKey = new ArrayList<>();
|
||||
for(ReportDocumentDataDO dataDO: dataList){
|
||||
if(sampleTypeKey.equals(dataDO.getSampleTypeKey())){
|
||||
dataListByKey.add(dataDO);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for(ReportDocumentDataDO dataDO : dataList){
|
||||
String documentContent = dataDO.getDocumentContent();
|
||||
JSONObject dataJson = JSONObject.parseObject(documentContent);
|
||||
if(dataJson == null)
|
||||
continue;
|
||||
if(dataJson.containsKey(field)){
|
||||
if(!hasFields.contains( fieldName)){
|
||||
if(!dataListByKey.isEmpty())
|
||||
dataListGroup.add(dataListByKey);
|
||||
}
|
||||
if(dataListGroup.isEmpty())
|
||||
dataListGroup.add(dataList);
|
||||
JSONArray rowList = new JSONArray();
|
||||
for(int i = 0; i < dataListGroup.size(); i++){
|
||||
List<ReportDocumentDataDO> dataListByKey = dataListGroup.get(i);
|
||||
//处理字段,提取有数据的字段
|
||||
List<ConfigReportFieldDO> fieldList = new ArrayList<>();
|
||||
List<String> hasFields = new ArrayList<>();
|
||||
for(ConfigReportFieldDO fieldDO : fieldListAll){
|
||||
String field = fieldDO.getField();
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
//先处理固定列
|
||||
if(FIELD_FIXED.equals(fieldType)){
|
||||
if(!hasFields.contains( field)){
|
||||
fieldList.add(fieldDO);
|
||||
hasFields.add(fieldName);
|
||||
hasFields.add(field);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for(ReportDocumentDataDO dataDO : dataListByKey){
|
||||
String documentContent = dataDO.getDocumentContent();
|
||||
JSONObject dataJson = JSONObject.parseObject(documentContent);
|
||||
if(dataJson == null)
|
||||
continue;
|
||||
if(dataJson.containsKey(field)){
|
||||
if(!hasFields.contains( fieldName)){
|
||||
fieldList.add(fieldDO);
|
||||
hasFields.add(fieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assembleStep1(rowList, fieldList, dataListByKey, customConfig, i); //处理后的组数对象
|
||||
}
|
||||
if(!"1".equals(verticalFlag)){
|
||||
//处理空数据,填充/
|
||||
rowList = assembleEmpty(configJson, rowList);
|
||||
|
||||
//处理数据分页
|
||||
if("1".equals(pageFlag)){
|
||||
JSONArray pageRowList = assemblePageRowList(rowList, configJson);
|
||||
return CommonResult.success(pageRowList);
|
||||
}
|
||||
}
|
||||
//以下为空白
|
||||
if(rowList.size() < maxRowCount){
|
||||
JSONObject t = new JSONObject();
|
||||
t.put(colPrefix + "01", emptyText);
|
||||
rowList.add(t.clone());
|
||||
}
|
||||
while(rowList.size() < maxRowCount){
|
||||
JSONObject t = new JSONObject();
|
||||
t.put(colPrefix + "01", " ");
|
||||
rowList.add(t.clone());
|
||||
}
|
||||
return CommonResult.success(rowList);
|
||||
}
|
||||
|
||||
/*
|
||||
* 处理分页
|
||||
*
|
||||
* */
|
||||
private JSONArray assemblePageRowList(JSONArray rowList, JSONObject configJson){
|
||||
JSONArray pageRowList = new JSONArray();
|
||||
Integer maxRowCount = 20;
|
||||
String maxRowCountStr = configJson.getString("maxRowCount"); //最大行数
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
|
||||
int rowLength = rowList.size();
|
||||
if(rowLength <= maxRowCount){
|
||||
pageRowList.add(rowList);
|
||||
return pageRowList;
|
||||
}
|
||||
JSONArray remainingRows = new JSONArray();
|
||||
remainingRows.addAll(rowList);
|
||||
while(remainingRows.size() > 0){
|
||||
JSONArray pageRow = new JSONArray();
|
||||
for(int i = 0; i < maxRowCount ; i++){
|
||||
if(remainingRows.isEmpty())
|
||||
break;
|
||||
pageRow.add(remainingRows.getJSONObject(0));
|
||||
remainingRows.remove(0);
|
||||
}
|
||||
/*
|
||||
在每页开头插入“标题行”
|
||||
如果最后一行是标题,直接移到下一页;如果不是,往上寻找最近的“标题行”
|
||||
*/
|
||||
JSONObject lastTitleRow = pageRow.getJSONObject(pageRow.size() - 1);
|
||||
String rowType = lastTitleRow.getString(rowTypeKey);
|
||||
if(rowTypeTitle.equals(rowType)){
|
||||
//如果最后一行是“标题行”,移除
|
||||
pageRow.remove(pageRow.size() - 1);
|
||||
}else {
|
||||
for(int i = pageRow.size() - 1; i >= 0; i--){
|
||||
JSONObject t = pageRow.getJSONObject(i);
|
||||
rowType = t.getString(rowTypeKey);
|
||||
if(rowTypeTitle.equals(rowType)){
|
||||
lastTitleRow = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!remainingRows.isEmpty()){
|
||||
JSONObject firstRemainingRow = remainingRows.getJSONObject(0);
|
||||
if(!rowTypeTitle.equals(firstRemainingRow.getString(rowTypeKey))){
|
||||
remainingRows.add(0, lastTitleRow);
|
||||
}
|
||||
}
|
||||
pageRowList.add(pageRow);
|
||||
}
|
||||
|
||||
//组装数据
|
||||
List<JSONObject> step1Arr = assembleStep1(fieldList, dataList, customConfig); //处理后的组数对象
|
||||
return CommonResult.success(step1Arr);
|
||||
//在最后一页插入“以下为空”
|
||||
JSONArray pageRow = pageRowList.getJSONArray(pageRowList.size() - 1);
|
||||
if(pageRow.size() < maxRowCount){
|
||||
JSONObject t = new JSONObject();
|
||||
t.put(colPrefix + "01", emptyText);
|
||||
pageRow.add(t.clone());
|
||||
}
|
||||
return pageRowList;
|
||||
}
|
||||
|
||||
private JSONArray assembleEmpty(JSONObject configJson, JSONArray rowList){
|
||||
JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"]
|
||||
if(fixedCol == null) fixedCol = new JSONArray();
|
||||
JSONArray fixedColRight = configJson.getJSONArray("fixedColRight"); //右侧固定列
|
||||
if(fixedColRight == null) fixedColRight = new JSONArray();
|
||||
String dynamicColCountStr = configJson.getString("dynamicColCount"); //动态列(检测项)数量
|
||||
Integer dynamicColCount = 0;
|
||||
Integer fixedColCount_left = 0;
|
||||
Integer fixedColCount_right = 0;
|
||||
if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr);
|
||||
fixedColCount_left = fixedCol.size();
|
||||
fixedColCount_right = fixedColRight.size();
|
||||
|
||||
for(int i = 0; i < rowList.size(); i++){
|
||||
JSONObject row = rowList.getJSONObject(i);
|
||||
if(" ".equals(row.getString(colPrefix + "01")))
|
||||
continue;
|
||||
int colIndex = 1;
|
||||
while(colIndex <= dynamicColCount){
|
||||
String colKey = colPrefix + parseNumToString(colIndex + fixedColCount_left, 2);
|
||||
if(!row.containsKey(colKey))
|
||||
row.put(colKey, "/");
|
||||
colIndex ++;
|
||||
}
|
||||
}
|
||||
return rowList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,130 +245,193 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* @param fieldList 要显示的字段列表。固定字段在最前
|
||||
* @param customConfig 报告配置项
|
||||
* */
|
||||
private List<JSONObject> assembleStep1(List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
private JSONArray assembleStep1(JSONArray rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig, int groupIndex){
|
||||
if(dataList.isEmpty())
|
||||
return new ArrayList<>();
|
||||
return new JSONArray();
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
Integer dynamicColCount = 3;
|
||||
Integer fixedColCount = 0;
|
||||
Integer maxRowCount = 3;
|
||||
Integer fixedColCount_left = 0;
|
||||
|
||||
String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量
|
||||
// String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量
|
||||
JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["sampleName", "sampleCode"]
|
||||
JSONArray fixedColShow = jsonObject.getJSONArray("fixedColShow"); //固定列,举例:["产品名称", "编 号"]
|
||||
String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数
|
||||
// String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式:merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示
|
||||
JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"]
|
||||
if(fixedCol == null) fixedCol = new JSONArray();
|
||||
JSONArray fixedColRight = jsonObject.getJSONArray("fixedColRight"); //右侧固定列
|
||||
if(fixedColRight == null) fixedColRight = new JSONArray();
|
||||
String hasRemark = jsonObject.getString("hasRemark"); //是否有备注
|
||||
String hasRange = jsonObject.getString("hasRange"); //是否有检出限
|
||||
String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表
|
||||
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key
|
||||
if("1".equals(verticalFlag)){ //纵表
|
||||
return assembleVerticalData(fieldList, dataList, customConfig);
|
||||
return assembleVerticalData(rowList, fieldList, dataList, customConfig);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(fixedFields)){ //固定列
|
||||
return assembleFixedFieldsData(fieldList, dataList, customConfig);
|
||||
return assembleFixedFieldsData(rowList, fieldList, dataList, customConfig);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr);
|
||||
if(fixedCol != null) fixedColCount = fixedCol.size();
|
||||
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
|
||||
Integer eleCount = 0; //元素数量,即元素列总数
|
||||
|
||||
for(ConfigReportFieldDO fieldDO : fieldList){
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
if(FIELD_DYNAMIC.equals(fieldType))
|
||||
eleCount ++;
|
||||
}
|
||||
Integer rowCountOneSample = eleCount / dynamicColCount + (eleCount % dynamicColCount == 0 ? 0 : 1); //每个样品要占的行数
|
||||
Integer colCountOneSample = fixedColCount + dynamicColCount; //每个样品要占的列数
|
||||
Integer dataLength = dataList.size();
|
||||
Integer emptyRowCount = dataLength < maxRowCount ? 1 : 0; //空行数
|
||||
// Integer allRowCount = 1 + dataLength + emptyRowCount + 1; //标题 + 样品数 + 空行
|
||||
|
||||
if("1".equals(hasRange))
|
||||
emptyRowCount ++;
|
||||
|
||||
// if(rowCountOneSample > 1){
|
||||
// allRowCount = (1 + dataLength + emptyRowCount + 9) * rowCountOneSample + emptyRowCount; //(标题 + 样品数 + 空行) * 但样品行数 + 末尾行
|
||||
// }
|
||||
List<JSONObject> rowList = new ArrayList<>();
|
||||
for(int i = 0; i < maxRowCount; i++){
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("col01", " ");
|
||||
rowList.add( row);
|
||||
}
|
||||
|
||||
|
||||
fixedColCount_left = fixedCol.size();
|
||||
Integer colCountOneSample = fixedColCount_left + dynamicColCount; //每个样品要占的列数
|
||||
//=============处理表头============
|
||||
JSONObject t = new JSONObject();
|
||||
JSONObject r = new JSONObject(); //检出限
|
||||
int rowAssist = 1;
|
||||
int colIndex = fixedColCount + 1;
|
||||
boolean lastObjFlag = true;
|
||||
//取第一行数据,用来处理检出限
|
||||
JSONObject firstData = new JSONObject(); //取第一行数据,用于处理检出限
|
||||
if(dataLength > 0)
|
||||
firstData = JSONObject.parseObject(dataList.get(0).getDocumentContent());
|
||||
JSONObject firstData = JSONObject.parseObject(dataList.get(0).getDocumentContent()); //取第一行数据,用于处理检出限
|
||||
if("1".equals(hasRemark)){
|
||||
//在最后一列增加备注
|
||||
t.put(colPrefix + parseNumToString(colCountOneSample + 1, 2), "备注");
|
||||
}
|
||||
for(ConfigReportFieldDO fieldDO : fieldList){
|
||||
//取fieldList的动态字段,并分组
|
||||
List<List<ConfigReportFieldDO>> dynamicFieldListGroup = new ArrayList<>();
|
||||
int fieldIndex = 1;
|
||||
List<ConfigReportFieldDO> list = new ArrayList<>();
|
||||
for(int i = 0; i < fieldList.size(); i++){
|
||||
ConfigReportFieldDO fieldDO = fieldList.get(i);
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
String field = fieldDO.getField();
|
||||
if(FIELD_FIXED.equals(fieldType)){ //这里只处理动态列。固定列在 addTitleToRowList 处理
|
||||
if(FIELD_FIXED.equals(fieldType))
|
||||
continue;
|
||||
list.add(fieldDO);
|
||||
if(fieldIndex % dynamicColCount == 0){
|
||||
dynamicFieldListGroup.add(list);
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String colKey = parseNumToString(colIndex, 2);
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
//查询当前字段的检出限
|
||||
JSONObject fieldObj = firstData.getJSONObject( field);
|
||||
String rangeVal = "";
|
||||
if(fieldObj != null){
|
||||
rangeVal = fieldObj.getString(rangeKey);
|
||||
}
|
||||
r.put(colPrefix + colKey, rangeVal);
|
||||
r.put(colPrefix + "01", "方法检出限");
|
||||
lastObjFlag = true;
|
||||
if(colIndex % colCountOneSample == 0){
|
||||
addTitleToRowList(fixedCol, rowAssist, t, dataLength, emptyRowCount, rowList, fieldList);
|
||||
if("1".equals(hasRange))
|
||||
addRangeToRowList(rowAssist, r, dataLength, emptyRowCount, rowList);
|
||||
t = new JSONObject();
|
||||
r = new JSONObject();
|
||||
|
||||
if("1".equals(hasRemark)){
|
||||
//在最后一列增加备注
|
||||
t.put(colPrefix + parseNumToString(colCountOneSample + 1, 2), "备注");
|
||||
fieldIndex ++;
|
||||
}
|
||||
if(!list.isEmpty())
|
||||
dynamicFieldListGroup.add(list);
|
||||
int colIndex = 1;
|
||||
for(int i = 0; i < dynamicFieldListGroup.size(); i++){
|
||||
List<ConfigReportFieldDO> dynamicFieldList = dynamicFieldListGroup.get(i);
|
||||
t = new JSONObject();
|
||||
t.put(rowTypeKey, rowTypeTitle);
|
||||
r = new JSONObject();
|
||||
r.put(rowTypeKey, rowTypeLimit);
|
||||
colIndex = fixedColCount_left + 1; //第二组以后,从固定列数开始
|
||||
for(ConfigReportFieldDO fieldDO : dynamicFieldList) {
|
||||
String field = fieldDO.getField();
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String colKey = parseNumToString(colIndex, 2);
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
//查询当前字段的检出限
|
||||
JSONObject fieldObj = firstData.getJSONObject(field);
|
||||
String rangeVal = "";
|
||||
if (fieldObj != null) {
|
||||
rangeVal = fieldObj.getString(rangeKey);
|
||||
}
|
||||
rowAssist++;
|
||||
colIndex = fixedColCount + 1; //第二组以后,从固定列数开始
|
||||
lastObjFlag = false;
|
||||
continue;
|
||||
r.put(colPrefix + colKey, rangeVal);
|
||||
r.put(colPrefix + "01", "方法检出限");
|
||||
colIndex ++;
|
||||
}
|
||||
//处理备注列
|
||||
if(i == 0 && groupIndex == 0 && "1".equals(hasRemark)){
|
||||
//在最后一列增加备注
|
||||
t.put(colPrefix + parseNumToString(colCountOneSample + 1, 2), "备注");
|
||||
}
|
||||
if(i > 0 || groupIndex > 0){ //插入空行
|
||||
JSONObject emptyRow = new JSONObject();
|
||||
emptyRow.put(colPrefix + "01", " ");
|
||||
rowList.add(emptyRow);
|
||||
}
|
||||
addTitleToRowList(fixedCol, fixedColRight, dynamicColCount, t, rowList, fieldList);
|
||||
//插入样品数据
|
||||
addDataToRowList(fixedCol, fixedColRight, dynamicFieldList, dataList, rowList, fixedColCount_left, dynamicColCount, hasRemark);
|
||||
//检出限
|
||||
if("1".equals(hasRange)){
|
||||
rowList.add(r);
|
||||
}
|
||||
colIndex++;
|
||||
}
|
||||
if(lastObjFlag){
|
||||
addTitleToRowList(fixedCol, rowAssist, t, dataLength, emptyRowCount, rowList, fieldList);
|
||||
if("1".equals(hasRange))
|
||||
addRangeToRowList(rowAssist, r, dataLength, emptyRowCount, rowList);
|
||||
}
|
||||
return rowList;
|
||||
}
|
||||
|
||||
//=============处理数据============
|
||||
int dataIndex = 1;
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
* */
|
||||
private void addTitleToRowList(JSONArray fixedCol, JSONArray fixedColRight, Integer dynamicColCount, JSONObject t, JSONArray rowList, List<ConfigReportFieldDO> fieldList){
|
||||
//处理固定列
|
||||
int index = 1;
|
||||
String colKey = "";
|
||||
//固定列-左
|
||||
for(int i=0;i<fixedCol.size();i++) {
|
||||
String col = fixedCol.getString(i);
|
||||
for(ConfigReportFieldDO fieldDO : fieldList) {
|
||||
colKey = "";
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
String field = fieldDO.getField();
|
||||
if (FIELD_DYNAMIC.equals(fieldType) || FIELD_CALCULATED.equals(fieldType))
|
||||
continue;
|
||||
if(sampleNameAndCodeKey.equals( col) && sampleNameAndCodeKey.equals(field)
|
||||
|| sampleNameKey.equals( col) && sampleNameKey.equals(field)
|
||||
|| sampleCodeKey.equals( col) && sampleCodeKey.equals(field)
|
||||
|| entrustSampleNameKey.equals( col) && entrustSampleNameKey.equals(field)
|
||||
|| entrustSampleCodeKey.equals( col) && entrustSampleCodeKey.equals(field)
|
||||
|| entrustSampleNameCodeKey.equals( col) && entrustSampleNameCodeKey.equals(field)){
|
||||
colKey = parseNumToString(index, 2);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(colKey)){
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//固定列-右
|
||||
index = fixedCol.size() + dynamicColCount + 1;
|
||||
for(int i=0;i<fixedColRight.size();i++) {
|
||||
String col = fixedColRight.getString(i);
|
||||
for(ConfigReportFieldDO fieldDO : fieldList) {
|
||||
colKey = "";
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
String field = fieldDO.getField();
|
||||
if (FIELD_DYNAMIC.equals(fieldType) || FIELD_CALCULATED.equals(fieldType))
|
||||
continue;
|
||||
if(sampleNameAndCodeKey.equals( col) && sampleNameAndCodeKey.equals(field)
|
||||
|| sampleNameKey.equals( col) && sampleNameKey.equals(field)
|
||||
|| sampleCodeKey.equals( col) && sampleCodeKey.equals(field)
|
||||
|| entrustSampleNameKey.equals( col) && entrustSampleNameKey.equals(field)
|
||||
|| entrustSampleCodeKey.equals( col) && entrustSampleCodeKey.equals(field)
|
||||
|| entrustSampleNameCodeKey.equals( col) && entrustSampleNameCodeKey.equals(field)){
|
||||
colKey = parseNumToString(index, 2);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(colKey)){
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
rowList.add(t.clone());
|
||||
}
|
||||
|
||||
//添加行数据
|
||||
private void addDataToRowList(JSONArray fixedCol, JSONArray fixedColRight, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, JSONArray rowList, int fixedColCount, int dynamicColCount, String hasRemark){
|
||||
int colIndex = 0;
|
||||
JSONObject t = new JSONObject();
|
||||
for(ReportDocumentDataDO dataDO : dataList){
|
||||
String documentContent = dataDO.getDocumentContent();
|
||||
String externalContent = dataDO.getExternalContent();
|
||||
JSONObject s = JSONObject.parseObject(documentContent);
|
||||
JSONObject e = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty(externalContent)){
|
||||
e = JSONObject.parseObject(externalContent);
|
||||
//判断样品是否有值,若无值则跳过
|
||||
boolean hasValue = false;
|
||||
for(ConfigReportFieldDO fieldDO : fieldList) {
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
if (FIELD_FIXED.equals(fieldType)) //这里只处理动态列。固定列在 addDataToRowList 处理
|
||||
continue;
|
||||
String field = fieldDO.getField();
|
||||
JSONObject fieldObj = s.getJSONObject(field);
|
||||
String fieldValue = "";
|
||||
if (fieldObj != null)
|
||||
fieldValue = fieldObj.getString("fieldValue");
|
||||
if(!ObjectUtils.isEmpty(fieldValue))
|
||||
hasValue = true;
|
||||
}
|
||||
if(!hasValue)
|
||||
continue;
|
||||
JSONObject e = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty(externalContent))
|
||||
e = JSONObject.parseObject(externalContent);
|
||||
String remark = e.getString("remark");
|
||||
colIndex = fixedColCount + 1;
|
||||
rowAssist = 1;
|
||||
t = new JSONObject();
|
||||
int colCountOneSample = fixedColCount + dynamicColCount;
|
||||
if("1".equals(hasRemark)){
|
||||
t.put(colPrefix + parseNumToString(colCountOneSample + 1, 2), remark);
|
||||
}
|
||||
@@ -249,157 +451,63 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(mathSymbol) && !"=".equals(mathSymbol))
|
||||
fieldValue = mathSymbol + fieldValue;
|
||||
if(ObjectUtils.isEmpty(fieldValue))
|
||||
fieldValue = "/";
|
||||
t.put(colPrefix + colKey, fieldValue);
|
||||
lastObjFlag = true;
|
||||
if(colIndex % colCountOneSample == 0){
|
||||
addFixedDataToRowList(fixedCol, dataDO, rowAssist, t, dataLength, emptyRowCount, dataIndex, rowList, fieldList);
|
||||
t = new JSONObject();
|
||||
if("1".equals(hasRemark)){
|
||||
t.put(colPrefix + parseNumToString(colCountOneSample + 1, 2), remark);
|
||||
}
|
||||
rowAssist++;
|
||||
colIndex = fixedColCount + 1; //第二组以后,从固定列数开始
|
||||
lastObjFlag = false;
|
||||
continue;
|
||||
}
|
||||
colIndex++;
|
||||
}
|
||||
if(lastObjFlag){
|
||||
addFixedDataToRowList(fixedCol, dataDO, rowAssist, t, dataLength, emptyRowCount, dataIndex, rowList, fieldList);
|
||||
}
|
||||
dataIndex ++;
|
||||
}
|
||||
|
||||
//==============以下为空白=================
|
||||
//实际使用行数小于总行数,显示“”以下为空白“
|
||||
if(dataLength < maxRowCount){
|
||||
String colKey = colPrefix + "01";
|
||||
t = new JSONObject();
|
||||
t.put(colKey, emptyText);
|
||||
int rowIndex = (dataLength + emptyRowCount) * (rowAssist) + 2;
|
||||
if(rowAssist == 1)
|
||||
rowIndex = dataLength + emptyRowCount;
|
||||
if(rowCountOneSample == 1)
|
||||
rowIndex = dataLength + 2;
|
||||
rowList.set(rowIndex, t.clone());
|
||||
}
|
||||
//前面的计数是从1开始,移除第一个元素
|
||||
if(!rowList.isEmpty())
|
||||
rowList.remove(0);
|
||||
return rowList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
* */
|
||||
private void addTitleToRowList(JSONArray fixedCol, Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, List<JSONObject> rowList, List<ConfigReportFieldDO> fieldList){
|
||||
int rowIndex = (1 + dataLength + emptyRowCount) * (rowAssist - 1) + 1; //(标题 + 数据行 + 空行)
|
||||
//处理固定列
|
||||
int index = 1;
|
||||
String colKey = "";
|
||||
for(int i=0;i<fixedCol.size();i++) {
|
||||
String col = fixedCol.getString(i);
|
||||
for(ConfigReportFieldDO fieldDO : fieldList) {
|
||||
String fieldName = fieldDO.getFieldName();
|
||||
String fieldType = fieldDO.getFieldType();
|
||||
String field = fieldDO.getField();
|
||||
if (FIELD_DYNAMIC.equals(fieldType))
|
||||
continue;
|
||||
if("sampleNameCode".equals( col) && "SMP_NAME_CD".equals(field)){
|
||||
// String sampleNameCode = "样品名称及编号";
|
||||
// String sampleNameCode = fieldName;
|
||||
colKey = parseNumToString(index, 2);
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if("sampleName".equals( col) && "SMP_NAME".equals(field)){
|
||||
colKey = parseNumToString(index, 2);
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if("sampleCode".equals( col) && "SMP_CD".equals(field)){
|
||||
colKey = parseNumToString(index, 2);
|
||||
t.put(colPrefix + colKey, fieldName);
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
rowList.set(rowIndex, t.clone());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理检出限
|
||||
* 如果是
|
||||
* */
|
||||
private void addRangeToRowList(Integer rowAssist, JSONObject r, Integer dataLength, Integer emptyRowCount, List<JSONObject> rowList){
|
||||
int rowIndex = (dataLength + emptyRowCount + 1 ) * (rowAssist);
|
||||
rowList.set(rowIndex, r.clone());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加固定列的数据
|
||||
* */
|
||||
private void addFixedDataToRowList(JSONArray fixedCol, ReportDocumentDataDO dataDO, Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, Integer dataIndex, List<JSONObject> rowList, List<ConfigReportFieldDO> fieldList){
|
||||
int rowIndex = (1 + dataLength + emptyRowCount) * (rowAssist - 1) + dataIndex + 1; //(标题 + 数据行 + 空行)
|
||||
t.put("id", dataDO.getId());
|
||||
//处理固定列
|
||||
int index = 1;
|
||||
//处理固定列
|
||||
String colKey = "";
|
||||
if(fixedCol != null && !fixedCol.isEmpty()){
|
||||
t.put("id", dataDO.getId());
|
||||
//处理固定列-左
|
||||
int index = 1;
|
||||
String colKey = "";
|
||||
for(int i=0;i<fixedCol.size();i++){
|
||||
String col = fixedCol.getString(i);
|
||||
colKey = parseNumToString(index, 2);
|
||||
if("sampleName".equals(col)){
|
||||
if(sampleNameKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName());
|
||||
}
|
||||
else if("sampleCode".equals(col)){
|
||||
else if(sampleCodeKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
}
|
||||
else if("sampleNameCode".equals( col)){
|
||||
else if(sampleNameAndCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName() + " " + dataDO.getSampleCode());
|
||||
}else if(entrustSampleNameKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName());
|
||||
}else if(entrustSampleCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleCode());
|
||||
}else if(entrustSampleNameCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName() + " " + dataDO.getEntrustSampleCode());
|
||||
}
|
||||
index ++;
|
||||
}
|
||||
//处理固定列-右
|
||||
index = fixedColRight.size() + dynamicColCount + 1;
|
||||
for(int i=0;i<fixedColRight.size();i++){
|
||||
String col = fixedColRight.getString(i);
|
||||
colKey = parseNumToString(index, 2);
|
||||
if(sampleNameKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName());
|
||||
}
|
||||
else if(sampleCodeKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
}
|
||||
else if(sampleNameAndCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName() + " " + dataDO.getSampleCode());
|
||||
}else if(entrustSampleNameKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName());
|
||||
}else if(entrustSampleCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleCode());
|
||||
}else if(entrustSampleNameCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName() + " " + dataDO.getEntrustSampleCode());
|
||||
}
|
||||
index ++;
|
||||
}
|
||||
//添加入行数据
|
||||
rowList.add(t.clone());
|
||||
}
|
||||
// if(name_code_merge.equals(nameCodeType)){
|
||||
// String merge = dataDO.getSampleName() + " " + dataDO.getSampleCode();
|
||||
// t.put(colPrefix + colKey, merge);
|
||||
// rowList.set(rowIndex, t.clone());
|
||||
// return;
|
||||
// }
|
||||
// if(name_code_name.equals(nameCodeType)){
|
||||
// t.put(colPrefix + colKey, dataDO.getSampleName());
|
||||
// rowList.set(rowIndex, t.clone());
|
||||
// return;
|
||||
// }
|
||||
// if(name_code_code.equals(nameCodeType)){
|
||||
// t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
// rowList.set(rowIndex, t.clone());
|
||||
// return;
|
||||
// }
|
||||
// for(ConfigReportFieldDO fieldDO : fieldList){
|
||||
// String fieldName = fieldDO.getFieldName();
|
||||
// String fieldType = fieldDO.getFieldType();
|
||||
// String field = fieldDO.getField();
|
||||
// if(FIELD_FIXED.equals(fieldType)){
|
||||
// colKey = parseNumToString(index, 2);
|
||||
// String val = "";
|
||||
// if(sampleNameKey.equals( field))
|
||||
// val = dataDO.getSampleName();
|
||||
// else if(sampleCodeKey.equals( field))
|
||||
// val = dataDO.getSampleCode();
|
||||
// t.put(colPrefix + colKey, val);
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
rowList.set(rowIndex, t.clone());
|
||||
}
|
||||
|
||||
|
||||
private String parseNumToString(int num, int len){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i = 0; i < len - String.valueOf(num).length(); i++){
|
||||
@@ -411,7 +519,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
/**
|
||||
* 组装固定检测项的数据,以检测项作为数据Key
|
||||
* */
|
||||
private List<JSONObject> assembleFixedFieldsData(List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
private JSONArray assembleFixedFieldsData(JSONArray rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
|
||||
Integer maxRowCount = 3;
|
||||
@@ -421,15 +529,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key
|
||||
JSONArray fixedFieldsArray = JSONArray.parseArray(fixedFields);
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
|
||||
|
||||
List<JSONObject> rowList = new ArrayList<>();
|
||||
for(int i = 0; i < maxRowCount; i++){
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("sampleNameCode", " ");
|
||||
row.put("sampleName", " ");
|
||||
row.put("sampleCode", " ");
|
||||
rowList.add( row);
|
||||
}
|
||||
// for(int i = 0; i < maxRowCount; i++){
|
||||
// JSONObject row = new JSONObject();
|
||||
// row.put("sampleNameCode", " ");
|
||||
// row.put("sampleName", " ");
|
||||
// row.put("sampleCode", " ");
|
||||
// rowList.add( row);
|
||||
// }
|
||||
for(ReportDocumentDataDO dataDO : dataList) {
|
||||
JSONObject t = new JSONObject();
|
||||
String documentContent = dataDO.getDocumentContent();
|
||||
@@ -476,6 +582,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
t.put("sampleCode", emptyText);
|
||||
rowList.add( t);
|
||||
}
|
||||
while(rowList.size() < maxRowCount){
|
||||
JSONObject t = new JSONObject();
|
||||
t.put("sampleNameCode", " ");
|
||||
t.put("sampleName", " ");
|
||||
t.put("sampleCode", " ");
|
||||
rowList.add( t);
|
||||
}
|
||||
return rowList;
|
||||
}
|
||||
|
||||
@@ -483,17 +596,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* 组装纵表数据
|
||||
* 第1列固定为:元素; 第2列:方法检出限(%);第三列开始为各个样品
|
||||
* */
|
||||
private List<JSONObject> assembleVerticalData(List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
private JSONArray assembleVerticalData(JSONArray rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
Integer dynamicColCount = 3;
|
||||
Integer fixedColCount = 2;
|
||||
Integer maxRowCount = 3;
|
||||
String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量
|
||||
String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量
|
||||
String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数
|
||||
String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式:merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示
|
||||
Integer fixedColCount = 1;
|
||||
Integer maxRowCount = 20;
|
||||
String hasRemark = jsonObject.getString("hasRemark"); //是否有备注
|
||||
String hasRange = jsonObject.getString("hasRange"); //是否有检出限
|
||||
if("1".equals(hasRange))
|
||||
fixedColCount ++;
|
||||
//取数据第一行,用于处理方法检出限
|
||||
String content = "";
|
||||
if(!ObjectUtils.isEmpty(dataList))
|
||||
@@ -502,11 +613,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
if(!ObjectUtils.isEmpty(content)){
|
||||
firstData = JSONObject.parseObject(content);
|
||||
}
|
||||
List<JSONObject> rowList = new ArrayList<>();
|
||||
//处理第一行-样品编号
|
||||
int colIndex = fixedColCount + 1;
|
||||
int rowIndex = 1;
|
||||
JSONObject t = new JSONObject();
|
||||
t.put(colPrefix + "01", "元素");
|
||||
if("1".equals(hasRange)){
|
||||
t.put(colPrefix + "02", "方法检出限");
|
||||
}
|
||||
for(ReportDocumentDataDO dataDO : dataList){
|
||||
String colKey = parseNumToString(colIndex, 2);
|
||||
t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
@@ -565,7 +679,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
public CommonResult<List<ReportDocumentDataDO>> listByMainDataId(Long mainDataId) {
|
||||
QueryWrapper<ReportDocumentDataDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("MAIN_ID", mainDataId);
|
||||
queryWrapper.orderByAsc("ID");
|
||||
queryWrapper.orderByAsc("SRT");
|
||||
List<ReportDocumentDataDO> list = reportDocumentDataMapper.selectList(queryWrapper);
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentFileDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 检测报告附件 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface ReportDocumentFileService {
|
||||
|
||||
ReportDocumentFileDO getByMainIdAndVersion(Long mainId, Integer version);
|
||||
|
||||
|
||||
/**
|
||||
* 创建检测报告附件
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
ReportDocumentFileRespVO createReportDocumentFile(@Valid ReportDocumentFileSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新检测报告附件
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateReportDocumentFile(@Valid ReportDocumentFileSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除检测报告附件
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteReportDocumentFile(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除检测报告附件
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteReportDocumentFileListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得检测报告附件
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 检测报告附件
|
||||
*/
|
||||
ReportDocumentFileDO getReportDocumentFile(Long id);
|
||||
|
||||
/**
|
||||
* 获得检测报告附件分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 检测报告附件分页
|
||||
*/
|
||||
PageResult<ReportDocumentFileDO> getReportDocumentFilePage(ReportDocumentFilePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentFileDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.mapper.ReportDocumentFileMapper;
|
||||
|
||||
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.module.qms.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 检测报告附件 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ReportDocumentFileServiceImpl implements ReportDocumentFileService {
|
||||
|
||||
@Resource
|
||||
private ReportDocumentFileMapper reportDocumentFileMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public ReportDocumentFileDO getByMainIdAndVersion(Long mainId, Integer version) {
|
||||
LambdaQueryWrapper<ReportDocumentFileDO> query = new LambdaQueryWrapper<>();
|
||||
query.eq(ReportDocumentFileDO::getMainId, mainId);
|
||||
query.eq(ReportDocumentFileDO::getVersion, version);
|
||||
return reportDocumentFileMapper.selectOne(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportDocumentFileRespVO createReportDocumentFile(ReportDocumentFileSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ReportDocumentFileDO reportDocumentFile = BeanUtils.toBean(createReqVO, ReportDocumentFileDO.class);
|
||||
reportDocumentFileMapper.insert(reportDocumentFile);
|
||||
// 返回
|
||||
return BeanUtils.toBean(reportDocumentFile, ReportDocumentFileRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReportDocumentFile(ReportDocumentFileSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateReportDocumentFileExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ReportDocumentFileDO updateObj = BeanUtils.toBean(updateReqVO, ReportDocumentFileDO.class);
|
||||
reportDocumentFileMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReportDocumentFile(Long id) {
|
||||
// 校验存在
|
||||
validateReportDocumentFileExists(id);
|
||||
// 删除
|
||||
reportDocumentFileMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReportDocumentFileListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateReportDocumentFileExists(ids);
|
||||
// 删除
|
||||
reportDocumentFileMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateReportDocumentFileExists(List<Long> ids) {
|
||||
List<ReportDocumentFileDO> list = reportDocumentFileMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(REPORT_DOCUMENT_FILE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateReportDocumentFileExists(Long id) {
|
||||
if (reportDocumentFileMapper.selectById(id) == null) {
|
||||
throw exception(REPORT_DOCUMENT_FILE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportDocumentFileDO getReportDocumentFile(Long id) {
|
||||
return reportDocumentFileMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ReportDocumentFileDO> getReportDocumentFilePage(ReportDocumentFilePageReqVO pageReqVO) {
|
||||
return reportDocumentFileMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,8 @@ public interface ReportDocumentMainCorrelationService {
|
||||
|
||||
void deleteByMainId(Long mainId);
|
||||
|
||||
void insertBatch(List<ReportDocumentMainCorrelationDO> list);
|
||||
|
||||
/**
|
||||
* 创建检测报告关系表
|
||||
*
|
||||
|
||||
@@ -59,6 +59,11 @@ public class ReportDocumentMainCorrelationServiceImpl implements ReportDocumentM
|
||||
reportDocumentMainCorrelationMapper.delete(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertBatch(List<ReportDocumentMainCorrelationDO> list) {
|
||||
reportDocumentMainCorrelationMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReportDocumentMainCorrelation(ReportDocumentMainCorrelationSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
|
||||
@@ -3,8 +3,11 @@ package com.zt.plat.module.qms.business.reportdoc.service;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleEntrustRegistrationDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkOperationRespDTO;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkWorkflowCreateReqDTO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,7 +26,7 @@ public interface ReportDocumentMainService {
|
||||
CommonResult<String> execAddDataByEntrust(ReportDocumentMainSaveReqVO reqVO);
|
||||
|
||||
//添加数据到报告-按表表数据
|
||||
CommonResult<String> execAddByBusinessAssayReportData(List<BusinessAssayReportDataDO> assayReportDataList, Long id);
|
||||
CommonResult<String> execAddByBusinessAssayReportData(List<BusinessAssayReportDataDO> assayReportDataList, Long id, List<BusinessSampleEntrustRegistrationDO> entrustList);
|
||||
|
||||
//移除数据
|
||||
CommonResult<String> execRemoveData(ReportDocumentMainSaveReqVO reqVO);
|
||||
@@ -82,4 +85,6 @@ public interface ReportDocumentMainService {
|
||||
//发起流程
|
||||
CommonResult<ReportDocumentMainRespVO> createProcessInstance(ReportDocumentMainSaveReqVO entity);
|
||||
|
||||
|
||||
void testAsyncTask(Long id);
|
||||
}
|
||||
@@ -17,28 +17,34 @@ import com.zt.plat.module.qms.api.task.BMPCallbackInterface;
|
||||
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
|
||||
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayReportDataPageReqVO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayReportDataDO;
|
||||
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleEntrustRegistrationDO;
|
||||
import com.zt.plat.module.qms.business.bus.service.BusinessAssayReportDataService;
|
||||
import com.zt.plat.module.qms.business.bus.service.BusinessSampleEntrustRegistrationService;
|
||||
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigUserSignatureDO;
|
||||
import com.zt.plat.module.qms.business.config.service.ConfigUserSignatureService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentDataDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainCorrelationDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.mapper.ReportDocumentMainMapper;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.qms.enums.QmsBpmConstant;
|
||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||
import com.zt.plat.module.system.api.iwork.IWorkIntegrationApi;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkOperationRespDTO;
|
||||
import com.zt.plat.module.system.api.iwork.dto.IWorkWorkflowCreateReqDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
@@ -62,7 +68,30 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
@Resource private BpmProcessInstanceApi bpmProcessInstanceApi;
|
||||
@Resource private BpmTaskApi bpmTaskApi;
|
||||
@Resource private ReportDocumentMainCorrelationService reportDocumentMainCorrelationService;
|
||||
@Resource private ReportDocumentTypeService reportDocumentTypeService;
|
||||
@Resource private ConfigUserSignatureService configUserSignatureService;
|
||||
@Resource private BusinessSampleEntrustRegistrationService businessSampleEntrustRegistrationService;
|
||||
@Resource private ReportDocumentAssistService reportDocumentAssistService;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 测试异步执行
|
||||
* */
|
||||
@Async("asyncTaskExecutor")
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void testAsyncTask(Long id) {
|
||||
ReportDocumentMainDO entity = reportDocumentMainMapper.selectById(id);
|
||||
entity.setFlowStatus("success");
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
reportDocumentMainMapper.updateById(entity);
|
||||
}
|
||||
|
||||
/***
|
||||
* 增加报表数据(按样品)
|
||||
* 传入:报告id、 报表数据ids
|
||||
@@ -93,14 +122,13 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
}
|
||||
if(isExist)
|
||||
return error(REPORT_DOCUMENT_DATA_NOT_EXISTS.getCode(), "报表数据已在本报告使用,请勿重复添加");
|
||||
// List<BusinessAssayReportDataDO> assayReportDataList = businessAssayReportDataService.listByIds(addReportDataIdList);
|
||||
BusinessAssayReportDataPageReqVO reportDataQueryVo = new BusinessAssayReportDataPageReqVO();
|
||||
reportDataQueryVo.setIdList(addReportDataIdList);
|
||||
reportDataQueryVo.setPageNo(1);
|
||||
reportDataQueryVo.setPageSize(9999);
|
||||
PageResult<BusinessAssayReportDataDO> assayReportPage = businessAssayReportDataService.queryWaitingDataForReport( reportDataQueryVo);
|
||||
List<BusinessAssayReportDataDO> assayReportDataList = assayReportPage.getList();
|
||||
return execAddByBusinessAssayReportData(assayReportDataList, id);
|
||||
return execAddByBusinessAssayReportData(assayReportDataList, id, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,39 +136,44 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
public CommonResult<String> execAddDataByEntrust(ReportDocumentMainSaveReqVO reqVO) {
|
||||
Long id = reqVO.getId();
|
||||
String businessSampleEntrustRegistrationIds = reqVO.getBusinessSampleEntrustRegistrationIds();
|
||||
if(ObjectUtils.isEmpty(businessSampleEntrustRegistrationIds) || id == null)
|
||||
if(id == null)
|
||||
return error(REPORT_DOCUMENT_DATA_NOT_EXISTS.getCode(), "缺少id参数,请刷新后重试");
|
||||
if(ObjectUtils.isEmpty(businessSampleEntrustRegistrationIds))
|
||||
return error(REPORT_DOCUMENT_DATA_NOT_EXISTS.getCode(), "缺少businessSampleEntrustRegistrationIds参数,请刷新后重试");
|
||||
List<ReportDocumentMainCorrelationDO> reportRelationList = reportDocumentMainCorrelationService.listByMainId(id);
|
||||
//todo 判断修改的场景。处理方法:删除reportRelation、ReportDocumentData
|
||||
List<Long> businessSampleEntrustRegistrationIdList = new ArrayList<>();
|
||||
String[] split = businessSampleEntrustRegistrationIds.split(",");
|
||||
for (String s : split) {
|
||||
Long aLong = Long.valueOf(s);
|
||||
businessSampleEntrustRegistrationIdList.add(aLong);
|
||||
}
|
||||
List<BusinessSampleEntrustRegistrationDO> entrustList = businessSampleEntrustRegistrationService.listByIds(businessSampleEntrustRegistrationIdList);
|
||||
BusinessAssayReportDataPageReqVO reportDataQueryVo = new BusinessAssayReportDataPageReqVO();
|
||||
reportDataQueryVo.setBusinessSampleEntrustRegistrationIdList(businessSampleEntrustRegistrationIdList);
|
||||
reportDataQueryVo.setPageNo(1);
|
||||
reportDataQueryVo.setPageSize(9999);
|
||||
PageResult<BusinessAssayReportDataDO> assayReportPage = businessAssayReportDataService.queryWaitingDataForReport( reportDataQueryVo);
|
||||
List<BusinessAssayReportDataDO> assayReportDataList = assayReportPage.getList();
|
||||
CommonResult<String> ret = execAddByBusinessAssayReportData(assayReportDataList, id);
|
||||
CommonResult<String> ret = execAddByBusinessAssayReportData(assayReportDataList, id, entrustList);
|
||||
if(!ret.isSuccess())
|
||||
return ret;
|
||||
//保存报告关系表
|
||||
List<ReportDocumentMainCorrelationDO> correlationList = new ArrayList<>();
|
||||
for(Long businessSampleEntrustRegistrationId : businessSampleEntrustRegistrationIdList){
|
||||
ReportDocumentMainCorrelationSaveReqVO correlationEntity = new ReportDocumentMainCorrelationSaveReqVO();
|
||||
ReportDocumentMainCorrelationDO correlationEntity = new ReportDocumentMainCorrelationDO();
|
||||
correlationEntity.setMainId( id);
|
||||
correlationEntity.setCorrelationId(businessSampleEntrustRegistrationId);
|
||||
correlationEntity.setCorrelationType(ReportDocumentMainCorrelationService.CorrelationType_entrust);
|
||||
reportDocumentMainCorrelationService.createReportDocumentMainCorrelation(correlationEntity);
|
||||
correlationList.add(correlationEntity);
|
||||
}
|
||||
if(!correlationList.isEmpty())
|
||||
reportDocumentMainCorrelationService.insertBatch(correlationList);
|
||||
|
||||
return CommonResult.success("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> execAddByBusinessAssayReportData(List<BusinessAssayReportDataDO> assayReportDataList, Long id){
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult<String> execAddByBusinessAssayReportData(List<BusinessAssayReportDataDO> assayReportDataList, Long id, List<BusinessSampleEntrustRegistrationDO> entrustList){
|
||||
if(ObjectUtils.isEmpty(assayReportDataList))
|
||||
return error(REPORT_DOCUMENT_DATA_NOT_EXISTS.getCode(), "您选择的委托还没产生可编制报告的数据,请稍后重试!");
|
||||
List<ReportDocumentDataDO> insertList = new ArrayList<>();
|
||||
@@ -152,16 +185,75 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
reportDocumentDataDO.setSampleName(assayReportData.getSampleName());
|
||||
reportDocumentDataDO.setBaseSampleName(assayReportData.getBaseSampleName());
|
||||
reportDocumentDataDO.setDocumentContent(assayReportData.getAssayData());
|
||||
reportDocumentDataDO.setSampleTypeKey(assayReportData.getSampleTypeKey());
|
||||
reportDocumentDataDO.setEntrustSampleCode(assayReportData.getEntrustSampleCode());
|
||||
reportDocumentDataDO.setEntrustSampleName(assayReportData.getEntrustSampleName());
|
||||
reportDocumentDataDO.setSort(assayReportData.getEntrustDetailSort());
|
||||
insertList.add(reportDocumentDataDO);
|
||||
}
|
||||
if(!insertList.isEmpty())
|
||||
reportDocumentDataService.insertBatch(insertList);
|
||||
ReportDocumentMainDO reportDocumentMainDO = reportDocumentMainMapper.selectById(id);
|
||||
updateCommonField(reportDocumentMainDO);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String formData = reportDocumentMainDO.getFormData();
|
||||
JSONObject formDataJson = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty(formData))
|
||||
formDataJson = JSONObject.parseObject(formData);
|
||||
ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(reportDocumentMainDO.getReportDocumentTypeId());
|
||||
String customConfig = typeDO.getCustomConfig();
|
||||
String defaultConclusion = "";
|
||||
if(!ObjectUtils.isEmpty(customConfig)){
|
||||
JSONObject config = JSONObject.parseObject(customConfig);
|
||||
defaultConclusion = config.getString("defaultConclusion");
|
||||
}
|
||||
formDataJson.put("conclusion", defaultConclusion);
|
||||
if(!assayReportDataList.isEmpty())
|
||||
formDataJson.put("sampleName", assayReportDataList.get(0).getSampleName());
|
||||
//处理检测标准
|
||||
String standard = assembleStandard(assayReportDataList);
|
||||
formDataJson.put("standard", standard);
|
||||
formDataJson.put("reportTime", sdf.format(new Date()));
|
||||
|
||||
//委托单号
|
||||
String entrustCode = "";
|
||||
if(!ObjectUtils.isEmpty(entrustList)){
|
||||
for(BusinessSampleEntrustRegistrationDO entrust : entrustList){
|
||||
entrustCode += entrust.getEntrustNumber() + ",";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(entrustCode))
|
||||
entrustCode = entrustCode.substring(0, entrustCode.length() - 1);
|
||||
formDataJson.put("entrustCode", entrustCode);
|
||||
|
||||
reportDocumentMainDO.setFormData(formDataJson.toJSONString());
|
||||
reportDocumentMainMapper.updateById(reportDocumentMainDO);
|
||||
return CommonResult.success("操作成功");
|
||||
}
|
||||
|
||||
//组装检测标准
|
||||
private String assembleStandard(List<BusinessAssayReportDataDO> dataList){
|
||||
Set<String> standardSet = new HashSet<>();
|
||||
for(BusinessAssayReportDataDO data : dataList){
|
||||
String content = data.getAssayData();
|
||||
if(ObjectUtils.isEmpty( content))
|
||||
continue;
|
||||
JSONObject json = JSONObject.parseObject(content);
|
||||
for(String key : json.keySet()){
|
||||
JSONObject obj = json.getJSONObject(key);
|
||||
String methodName = obj.getString("methodName");
|
||||
if(ObjectUtils.isEmpty(methodName))
|
||||
continue;
|
||||
standardSet.add(methodName);
|
||||
}
|
||||
}
|
||||
if(standardSet.isEmpty())
|
||||
return "";
|
||||
return String.join(",", standardSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCommonField(ReportDocumentMainDO reportDocumentMainDO) {
|
||||
if(reportDocumentMainDO == null)
|
||||
@@ -324,12 +416,15 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
return CommonResult.success(respVO);
|
||||
}
|
||||
|
||||
|
||||
//流程回调
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult<JSONObject> callback(QmsBpmDTO reqDTO) {
|
||||
JSONObject variables = reqDTO.getVariables();
|
||||
|
||||
//todo 幂等性
|
||||
|
||||
JSONObject variables = reqDTO.getVariables();
|
||||
//流程状态 1-提交(含退回) 4-取消流程
|
||||
String PROCESS_STATUS = variables.getString(QmsBpmConstant.PROCESS_INSTANCE_VARIABLE_STATUS);
|
||||
String mainId = variables.getString("mainId");
|
||||
@@ -357,7 +452,6 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//"RETURN_FLAG_Activity_001": true 标识驳回到发起环节
|
||||
if(variables.containsKey(returnFlagKey) && variables.getString(returnFlagKey).equals("true")){
|
||||
//驳回。流程需要配置退回到发起节点
|
||||
@@ -375,11 +469,29 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
if("1".equals(lastActivityFlag))
|
||||
entity.setFlowStatus(QmsCommonConstant.COMPLETED); //结束审批
|
||||
}
|
||||
boolean updateDocFileFlag = reportDocumentAssistService.checkUpdateDocFile(variables);
|
||||
if(updateDocFileFlag){
|
||||
Integer version = entity.getDocumentVersion();
|
||||
if(version == null)
|
||||
version = 1;
|
||||
else
|
||||
version++;
|
||||
entity.setDocumentVersion(version); //版本+1
|
||||
}
|
||||
reportDocumentMainMapper.updateById(entity);
|
||||
|
||||
try {
|
||||
reportDocumentAssistService.updateDocFileAndCreateIWorkflow( variables, entity);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
JSONObject ret = new JSONObject();
|
||||
return CommonResult.success(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void assembleSignature(String currentActivityId, ReportDocumentMainDO entity){
|
||||
if(ObjectUtils.isEmpty(currentActivityId) || "null".equals(currentActivityId))
|
||||
return;
|
||||
@@ -406,4 +518,6 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
entity.setDocumentSignature(signObj.toJSONString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.zt.plat.module.qms.core.code;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
|
||||
public class SampleEncryptUtil {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zt.plat.module.qms.core.legend.security;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
@@ -2,11 +2,13 @@ package com.zt.plat.module.qms.core.qlexpress.cmp;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ql.util.express.DefaultContext;
|
||||
import com.ql.util.express.ExpressRunner;
|
||||
import com.alibaba.qlexpress4.Express4Runner;
|
||||
import com.alibaba.qlexpress4.QLOptions;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -19,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class AllowanceCalculatorComponent {
|
||||
|
||||
@Resource
|
||||
private ExpressRunner expressRunner;
|
||||
private Express4Runner express4Runner;
|
||||
|
||||
/**
|
||||
* 计算允差值:支持原生线性公式 和 Express 自定义公式混合模式
|
||||
@@ -80,11 +82,12 @@ public class AllowanceCalculatorComponent {
|
||||
* 使用 Express 执行自定义公式
|
||||
*/
|
||||
private BigDecimal evaluateCustomFormula(String formula, BigDecimal xValue, int scale) {
|
||||
DefaultContext<String, Object> context = new DefaultContext<>();
|
||||
Map<String, Object> context = new HashMap<>();
|
||||
context.put("X", xValue); // 用户公式中使用 X 作为变量名
|
||||
|
||||
try {
|
||||
Object result = expressRunner.execute(formula, context, null, true, false);
|
||||
// Object result = expressRunner.execute(formula, context, null, true, false);
|
||||
Object result = express4Runner.execute(formula, context, QLOptions.builder().precise(true).build());
|
||||
|
||||
if (result == null) {
|
||||
throw new RuntimeException("Express 公式返回结果为 null");
|
||||
|
||||
@@ -3,16 +3,19 @@ package com.zt.plat.module.qms.core.qlexpress.config;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.ql.util.express.ExpressRunner;
|
||||
import com.alibaba.qlexpress4.Express4Runner;
|
||||
import com.alibaba.qlexpress4.InitOptions;
|
||||
import com.alibaba.qlexpress4.security.QLSecurityStrategy;
|
||||
import com.zt.plat.module.qms.core.qlexpress.function.RoundToScaleHalfEven;
|
||||
|
||||
@Configuration
|
||||
public class QlExpressRuleEngineConfig {
|
||||
|
||||
@Bean
|
||||
public ExpressRunner expressRunner() {
|
||||
//需要高精度计算支持
|
||||
ExpressRunner expressRunner = new ExpressRunner(true, false);
|
||||
public Express4Runner expressRunner() {
|
||||
//兼容 3 的行为,则在新建 Express4Runner 时, 要将安全策略设置为 “开放”
|
||||
InitOptions initOptions = InitOptions.builder().securityStrategy(QLSecurityStrategy.open()).build();
|
||||
Express4Runner expressRunner = new Express4Runner(initOptions);
|
||||
expressRunner.addFunction("roundToScale", new RoundToScaleHalfEven());
|
||||
return expressRunner;
|
||||
}
|
||||
|
||||
@@ -3,18 +3,20 @@ package com.zt.plat.module.qms.core.qlexpress.function;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import com.ql.util.express.Operator;
|
||||
import com.alibaba.qlexpress4.runtime.Parameters;
|
||||
import com.alibaba.qlexpress4.runtime.QContext;
|
||||
import com.alibaba.qlexpress4.runtime.function.CustomFunction;
|
||||
|
||||
public class RoundToScaleHalfEven extends Operator {
|
||||
|
||||
public class RoundToScaleHalfEven implements CustomFunction {
|
||||
|
||||
@Override
|
||||
public Object executeInner(Object[] list) throws Exception {
|
||||
if (list.length != 2) {
|
||||
public Object call(QContext qContext, Parameters parameters) throws Throwable {
|
||||
if (parameters.size() != 2) {
|
||||
throw new Exception("roundToScale函数需要2个参数:数值和小数位数");
|
||||
}
|
||||
|
||||
double value = Double.parseDouble(list[0].toString());
|
||||
int scale = Integer.parseInt(list[1].toString());
|
||||
double value = Double.parseDouble(parameters.get(0).get().toString());
|
||||
int scale = Integer.parseInt(parameters.get(1).get().toString());
|
||||
|
||||
BigDecimal bd = BigDecimal.valueOf(value);
|
||||
bd = bd.setScale(scale, RoundingMode.HALF_EVEN);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
|
||||
import com.zt.plat.module.infra.api.file.FileApi;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.iwork.IWorkIntegrationApi;
|
||||
import com.zt.plat.module.system.api.permission.PermissionApi;
|
||||
import com.zt.plat.module.system.api.sequence.SequenceApi;
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
@@ -12,6 +13,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(value = "qmsRpcConfiguration", proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, SequenceApi.class, AdminUserApi.class, DeptApi.class, BpmProcessInstanceApi.class, BpmTaskApi.class, PermissionApi.class})
|
||||
@EnableFeignClients(clients = {FileApi.class, SequenceApi.class, AdminUserApi.class, DeptApi.class, BpmProcessInstanceApi.class, BpmTaskApi.class, PermissionApi.class, IWorkIntegrationApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zt.plat.module.qms.iot.tcpserver;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import tech.zzjc.tio.core.ChannelContext;
|
||||
import tech.zzjc.tio.core.Tio;
|
||||
|
||||
@@ -10,8 +10,9 @@ import com.zt.plat.module.qms.iot.tcpserver.handler.IotDataHander;
|
||||
import com.zt.plat.module.qms.iot.tcpserver.publisher.BalanceDataPublisher;
|
||||
import com.fhs.common.spring.SpringContextUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tech.zzjc.tio.cluster.TioClusterConfig;
|
||||
import tech.zzjc.tio.cluster.TioClusterVo;
|
||||
@@ -81,7 +82,7 @@ public class IotDeviceBalanceHandler implements IotDataHander {
|
||||
String[] dataArray = analysisData(data, weightUnit);
|
||||
weightData = dataArray[0];
|
||||
weightUnit = dataArray[1];
|
||||
if (!NumberUtils.isNumber(weightData)) {
|
||||
if (!NumberUtils.isParsable(weightData)) {
|
||||
log.error("{},天平接收到的数据不正确!接收到的数据:{} 16进制:{}", realClient, data, IotUtils.bytesToHex(data.getBytes("UTF-8")));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementRespVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementSaveReqVO;
|
||||
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 com.zt.plat.framework.business.annotation.FileUploadController;
|
||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||
|
||||
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.*;
|
||||
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.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.clientManage.dal.dataobject.VersionManagementDO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.service.VersionManagementService;
|
||||
|
||||
@Tag(name = "管理后台 - 客户端版本管理")
|
||||
@RestController
|
||||
@RequestMapping("/qms/version-management")
|
||||
@Validated
|
||||
@FileUploadController(source = "qms.versionmanagement")
|
||||
public class VersionManagementController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||
|
||||
static {
|
||||
FileUploadController annotation = VersionManagementController.class.getAnnotation(FileUploadController.class);
|
||||
if (annotation != null) {
|
||||
setFileUploadInfo(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private VersionManagementService systemVersionManagementService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建客户端版本管理")
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:create')")
|
||||
public CommonResult<VersionManagementRespVO> createSystemVersionManagement(@Valid @RequestBody VersionManagementSaveReqVO createReqVO) {
|
||||
return success(systemVersionManagementService.createSystemVersionManagement(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新客户端版本管理")
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:update')")
|
||||
public CommonResult<Boolean> updateSystemVersionManagement(@Valid @RequestBody VersionManagementSaveReqVO updateReqVO) {
|
||||
systemVersionManagementService.updateSystemVersionManagement(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除客户端版本管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:delete')")
|
||||
public CommonResult<Boolean> deleteSystemVersionManagement(@RequestParam("id") Long id) {
|
||||
systemVersionManagementService.deleteSystemVersionManagement(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除客户端版本管理")
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:delete')")
|
||||
public CommonResult<Boolean> deleteSystemVersionManagementList(@RequestBody BatchDeleteReqVO req) {
|
||||
systemVersionManagementService.deleteSystemVersionManagementListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得客户端版本管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:query')")
|
||||
public CommonResult<VersionManagementRespVO> getSystemVersionManagement(@RequestParam("id") Long id) {
|
||||
VersionManagementDO systemVersionManagement = systemVersionManagementService.getSystemVersionManagement(id);
|
||||
return success(BeanUtils.toBean(systemVersionManagement, VersionManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得客户端版本管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:query')")
|
||||
public CommonResult<PageResult<VersionManagementRespVO>> getSystemVersionManagementPage(@Valid VersionManagementPageReqVO pageReqVO) {
|
||||
PageResult<VersionManagementDO> pageResult = systemVersionManagementService.getSystemVersionManagementPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, VersionManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出客户端版本管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('qms:version-management:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSystemVersionManagementExcel(@Valid VersionManagementPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<VersionManagementDO> list = systemVersionManagementService.getSystemVersionManagementPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "客户端版本管理.xls", "数据", VersionManagementRespVO.class,
|
||||
BeanUtils.toBean(list, VersionManagementRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get-by-platform")
|
||||
@Operation(summary = "根据更新平台和安装包类型获取最新客户端版本管理信息")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:version-management:query')")
|
||||
public CommonResult<PageResult<VersionManagementRespVO>> getSystemVersionManagementByPlatformAndType(@Valid VersionManagementPageReqVO pageReqVO) {
|
||||
|
||||
if (pageReqVO.getCustDeviceCode() == null ) {
|
||||
return CommonResult.error(400, "客户端编号不能为空");
|
||||
}
|
||||
if (pageReqVO.getUpdatePlatform() == null ) {
|
||||
return CommonResult.error(400, "更新平台不能为空");
|
||||
}
|
||||
PageResult<VersionManagementDO> pageResult = systemVersionManagementService.getLts(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, VersionManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/publish")
|
||||
CommonResult<Boolean> publish(@RequestParam("id") Long id) {
|
||||
systemVersionManagementService.publish(id);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.controller.vo;
|
||||
|
||||
import lombok.*;
|
||||
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 VersionManagementPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "客户端code", example = "赵六")
|
||||
private String custDeviceCode;
|
||||
|
||||
@Schema(description = "客户端名称", example = "赵六")
|
||||
private String custDeviceName;
|
||||
|
||||
@Schema(description = "更新标题")
|
||||
private String updateTitle;
|
||||
|
||||
@Schema(description = "更新内容")
|
||||
private String updateContent;
|
||||
|
||||
@Schema(description = "更新平台")
|
||||
private String updatePlatform;
|
||||
|
||||
@Schema(description = "安装包类型")
|
||||
private String updateType;
|
||||
|
||||
@Schema(description = "上线发行")
|
||||
private Integer issuanceFlag;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import com.zt.plat.framework.excel.core.annotations.DictFormat;
|
||||
import com.zt.plat.framework.excel.core.convert.DictConvert;
|
||||
|
||||
@Schema(description = "管理后台 - 客户端版本管理 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class VersionManagementRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18365")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "客户端code", requiredMode = Schema.RequiredMode.REQUIRED, example = "20524")
|
||||
@ExcelProperty(value = "客户端code", converter = DictConvert.class)
|
||||
@DictFormat("T_SYS_VER_MNGT_CUST_DEV") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String custDeviceCode;
|
||||
|
||||
@Schema(description = "客户端名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty(value = "客户端名称", converter = DictConvert.class)
|
||||
@DictFormat("T_SYS_VER_MNGT_CUST_DEV") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String custDeviceName;
|
||||
|
||||
@Schema(description = "更新标题")
|
||||
@ExcelProperty("更新标题")
|
||||
private String updateTitle;
|
||||
|
||||
@Schema(description = "更新内容")
|
||||
@ExcelProperty("更新内容")
|
||||
private String updateContent;
|
||||
|
||||
@Schema(description = "更新平台", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "更新平台", converter = DictConvert.class)
|
||||
@DictFormat("T_SYSVER_MNGT_UPD_PLTF") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String updatePlatform;
|
||||
|
||||
@Schema(description = "安装包类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty(value = "安装包类型", converter = DictConvert.class)
|
||||
@DictFormat("T_SYSVER_MNGT_UPD_TP") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String updateType;
|
||||
|
||||
@Schema(description = "当前版本,必须大于当前线上发行版本号")
|
||||
@ExcelProperty("当前版本,必须大于当前线上发行版本号")
|
||||
private String currentVersion;
|
||||
|
||||
@Schema(description = "最低版本")
|
||||
@ExcelProperty("最低版本")
|
||||
private String minimumVersion;
|
||||
|
||||
@Schema(description = "下载地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("下载地址")
|
||||
private String downloadUrl;
|
||||
|
||||
@Schema(description = "下载文件id", example = "11223344")
|
||||
@ExcelProperty("下载文件id")
|
||||
private String downloadId;
|
||||
|
||||
@Schema(description = "文件md5值")
|
||||
@ExcelProperty("文件md5值")
|
||||
private String fileMd5;
|
||||
|
||||
@Schema(description = "文件sha1值")
|
||||
@ExcelProperty("文件sha1值")
|
||||
private String fileEncryptAlgorithm;
|
||||
|
||||
@Schema(description = "上线发行", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("上线发行")
|
||||
private Integer issuanceFlag;
|
||||
|
||||
@Schema(description = "是否静默更新")
|
||||
@ExcelProperty("是否静默更新")
|
||||
private Integer noneAdviceFlag;
|
||||
|
||||
@Schema(description = "是否强制更新")
|
||||
@ExcelProperty("是否强制更新")
|
||||
private Integer mustUpdateFlag;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
@ExcelProperty("所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "创建日期")
|
||||
@ExcelProperty("创建日期")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
@ExcelProperty("创建者")
|
||||
private String creator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 客户端版本管理新增/修改 Request VO")
|
||||
@Data
|
||||
public class VersionManagementSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18365")
|
||||
private Long id;
|
||||
|
||||
// @Schema(description = "客户端code", requiredMode = Schema.RequiredMode.REQUIRED, example = "20524")
|
||||
// @NotEmpty(message = "客户端code不能为空")
|
||||
// private String custDeviceCode;
|
||||
|
||||
// @Schema(description = "客户端名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
// @NotEmpty(message = "客户端名称不能为空")
|
||||
// private String custDeviceName;
|
||||
@Schema(description = "客户端code", requiredMode = Schema.RequiredMode.REQUIRED, example = "20524")
|
||||
@NotEmpty(message = "客户端名称不能为空")
|
||||
private String custDeviceCode;
|
||||
|
||||
@Schema(description = "客户端名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "客户端名称不能为空")
|
||||
private String custDeviceName;
|
||||
|
||||
@Schema(description = "更新标题")
|
||||
private String updateTitle;
|
||||
|
||||
@Schema(description = "更新内容")
|
||||
private String updateContent;
|
||||
|
||||
@Schema(description = "更新平台", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// @NotEmpty(message = "更新平台不能为空")
|
||||
private String updatePlatform;
|
||||
|
||||
@Schema(description = "安装包类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
// @NotEmpty(message = "安装包类型不能为空")
|
||||
private String updateType;
|
||||
|
||||
@Schema(description = "当前版本,必须大于当前线上发行版本号")
|
||||
private String currentVersion;
|
||||
|
||||
@Schema(description = "最低版本")
|
||||
private String minimumVersion;
|
||||
|
||||
@Schema(description = "下载地址", example = "https://www.iocoder.cn")
|
||||
private String downloadUrl;
|
||||
|
||||
@Schema(description = "文件md5值")
|
||||
private String fileMd5;
|
||||
|
||||
@Schema(description = "文件sha1值")
|
||||
private String fileEncryptAlgorithm;
|
||||
|
||||
@Schema(description = "上线发行", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// @NotNull(message = "上线发行不能为空")
|
||||
private Integer issuanceFlag;
|
||||
|
||||
@Schema(description = "是否静默更新")
|
||||
private Integer noneAdviceFlag;
|
||||
|
||||
@Schema(description = "是否强制更新")
|
||||
private Integer mustUpdateFlag;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
@Schema(description = "上传文件列表")
|
||||
private List<uploadFileVo> files;
|
||||
|
||||
@Schema(description = "上传文件Uid")
|
||||
private String downloadId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "附件实例")
|
||||
@Data
|
||||
public class uploadFileVo {
|
||||
private String id;
|
||||
|
||||
private String url;
|
||||
|
||||
private String name;
|
||||
|
||||
private String uid;
|
||||
|
||||
private String status;
|
||||
|
||||
private String md5;
|
||||
|
||||
private String sha1;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
/**
|
||||
* 客户端版本管理 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("t_ver_mngt")
|
||||
@KeySequence("t_ver_mngt_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class VersionManagementDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 客户端code
|
||||
*
|
||||
* 枚举 {@link TODO T_SYS_VER_MNGT_CUST_DEV 对应的类}
|
||||
*/
|
||||
@TableField("CUST_DEV_CD")
|
||||
private String custDeviceCode;
|
||||
/**
|
||||
* 客户端名称
|
||||
*
|
||||
* 枚举 {@link TODO T_SYS_VER_MNGT_CUST_DEV 对应的类}
|
||||
*/
|
||||
@TableField("CUST_DEV_NAME")
|
||||
private String custDeviceName;
|
||||
/**
|
||||
* 更新标题
|
||||
*/
|
||||
@TableField("UPD_TTL")
|
||||
private String updateTitle;
|
||||
/**
|
||||
* 更新内容
|
||||
*/
|
||||
@TableField("UPD_CNTT")
|
||||
private String updateContent;
|
||||
/**
|
||||
* 更新平台
|
||||
*
|
||||
* 枚举 {@link TODO T_SYSVER_MNGT_UPD_PLTF 对应的类}
|
||||
*/
|
||||
@TableField("UPD_PLTF")
|
||||
private String updatePlatform;
|
||||
/**
|
||||
* 安装包类型
|
||||
*
|
||||
* 枚举 {@link TODO T_SYSVER_MNGT_UPD_TP 对应的类}
|
||||
*/
|
||||
@TableField("UPD_TP")
|
||||
private String updateType;
|
||||
/**
|
||||
* 当前版本,必须大于当前线上发行版本号
|
||||
*/
|
||||
@TableField("CRNT_VER")
|
||||
private String currentVersion;
|
||||
/**
|
||||
* 最低版本
|
||||
*/
|
||||
@TableField("MIN_VER")
|
||||
private String minimumVersion;
|
||||
/**
|
||||
* 下载地址
|
||||
*/
|
||||
@TableField("DL_URL")
|
||||
private String downloadUrl;
|
||||
/**
|
||||
* 文件md5值
|
||||
*/
|
||||
@TableField("FILE_MD5")
|
||||
private String fileMd5;
|
||||
/**
|
||||
* 文件sha1值
|
||||
*/
|
||||
@TableField("FILE_ENCR_ALG")
|
||||
private String fileEncryptAlgorithm;
|
||||
/**
|
||||
* 上线发行
|
||||
*/
|
||||
@TableField("ISSC_FLG")
|
||||
private Integer issuanceFlag;
|
||||
/**
|
||||
* 是否静默更新
|
||||
*/
|
||||
@TableField("NNE_ADV_FLG")
|
||||
private Integer noneAdviceFlag;
|
||||
/**
|
||||
* 是否强制更新
|
||||
*/
|
||||
@TableField("MUST_UPD_FLG")
|
||||
private Integer mustUpdateFlag;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
private String systemDepartmentCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("RMK")
|
||||
private String remark;
|
||||
|
||||
@TableField("CREATOR")
|
||||
private String creator;
|
||||
|
||||
@TableField("DL_ID")
|
||||
private String downloadId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.dal.mapper;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.module.qms.resource.clientManage.dal.dataobject.VersionManagementDO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户端版本管理 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface VersionManagementMapper extends BaseMapperX<VersionManagementDO> {
|
||||
|
||||
default PageResult<VersionManagementDO> selectPage(VersionManagementPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<VersionManagementDO>()
|
||||
.eqIfPresent(VersionManagementDO::getCustDeviceCode, reqVO.getCustDeviceCode())
|
||||
.eqIfPresent(VersionManagementDO::getCustDeviceName, reqVO.getCustDeviceName())
|
||||
.eqIfPresent(VersionManagementDO::getUpdateTitle, reqVO.getUpdateTitle())
|
||||
.eqIfPresent(VersionManagementDO::getUpdateContent, reqVO.getUpdateContent())
|
||||
.eqIfPresent(VersionManagementDO::getUpdatePlatform, reqVO.getUpdatePlatform())
|
||||
.eqIfPresent(VersionManagementDO::getIssuanceFlag, reqVO.getIssuanceFlag())
|
||||
.eqIfPresent(VersionManagementDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.eqIfPresent(VersionManagementDO::getCreator, reqVO.getCreator())
|
||||
.betweenIfPresent(VersionManagementDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(VersionManagementDO::getId));
|
||||
}
|
||||
|
||||
|
||||
default PageResult<VersionManagementDO> selectLts(VersionManagementPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<VersionManagementDO>()
|
||||
.eqIfPresent(VersionManagementDO::getUpdatePlatform, reqVO.getUpdatePlatform())
|
||||
.eqIfPresent(VersionManagementDO::getUpdateType, reqVO.getUpdateType())
|
||||
.eqIfPresent(VersionManagementDO::getCustDeviceCode, reqVO.getCustDeviceCode())
|
||||
.eq(VersionManagementDO::getIssuanceFlag,1)
|
||||
.orderByDesc(VersionManagementDO::getCreateTime)
|
||||
// .last("LIMIT 1")
|
||||
);
|
||||
}
|
||||
|
||||
default List<VersionManagementDO> selectBySameCustDeviceCode(Long id) {
|
||||
// 先根据id查询出目标记录的custDeviceCode
|
||||
VersionManagementDO target = selectById(id);
|
||||
if (target == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 查询相同custDeviceCode的所有记录
|
||||
return selectList(new LambdaQueryWrapperX<VersionManagementDO>()
|
||||
.eq(VersionManagementDO::getCustDeviceCode, target.getCustDeviceCode())
|
||||
.eq(VersionManagementDO::getIssuanceFlag, 1)
|
||||
.orderByDesc(VersionManagementDO::getCreateTime));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementRespVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import com.zt.plat.module.qms.resource.clientManage.dal.dataobject.VersionManagementDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 客户端版本管理 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface VersionManagementService {
|
||||
|
||||
/**
|
||||
* 创建客户端版本管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
VersionManagementRespVO createSystemVersionManagement(@Valid VersionManagementSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新客户端版本管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateSystemVersionManagement(@Valid VersionManagementSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除客户端版本管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSystemVersionManagement(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除客户端版本管理
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteSystemVersionManagementListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得客户端版本管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 客户端版本管理
|
||||
*/
|
||||
VersionManagementDO getSystemVersionManagement(Long id);
|
||||
|
||||
/**
|
||||
* 获得客户端版本管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 客户端版本管理分页
|
||||
*/
|
||||
PageResult<VersionManagementDO> getSystemVersionManagementPage(VersionManagementPageReqVO pageReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 获得客户端版本管理接口方法
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 客户端版本管理分页
|
||||
*/
|
||||
PageResult<VersionManagementDO> getLts(VersionManagementPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 版本发布
|
||||
* @param id
|
||||
*/
|
||||
void publish (Long id);
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.zt.plat.module.qms.resource.clientManage.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementRespVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementSaveReqVO;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.uploadFileVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.clientManage.dal.dataobject.VersionManagementDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.zt.plat.module.qms.resource.clientManage.dal.mapper.VersionManagementMapper;
|
||||
|
||||
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.module.qms.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 客户端版本管理 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class versionManagementServiceImpl implements VersionManagementService {
|
||||
|
||||
@Resource
|
||||
private VersionManagementMapper systemVersionManagementMapper;
|
||||
|
||||
@Override
|
||||
public VersionManagementRespVO createSystemVersionManagement(VersionManagementSaveReqVO createReqVO) {
|
||||
//多条数据取第一条
|
||||
if (createReqVO.getFiles().size() > 0) {
|
||||
uploadFileVo uploadFileVo = createReqVO.getFiles().get(0);
|
||||
createReqVO.setDownloadUrl(uploadFileVo.getUrl());
|
||||
createReqVO.setFileMd5(uploadFileVo.getMd5());
|
||||
createReqVO.setFileEncryptAlgorithm(uploadFileVo.getSha1());
|
||||
createReqVO.setDownloadId(uploadFileVo.getId());
|
||||
}
|
||||
|
||||
// 插入
|
||||
VersionManagementDO systemVersionManagement = BeanUtils.toBean(createReqVO, VersionManagementDO.class);
|
||||
|
||||
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();//获取当前登录人通用方法
|
||||
systemVersionManagement.setCreator(String.valueOf(SecurityFrameworkUtils.getLoginUser().getId()));
|
||||
|
||||
systemVersionManagementMapper.insert(systemVersionManagement);
|
||||
// 返回
|
||||
return BeanUtils.toBean(systemVersionManagement, VersionManagementRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSystemVersionManagement(VersionManagementSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateSystemVersionManagementExists(updateReqVO.getId());
|
||||
|
||||
//多条数据取第一条
|
||||
if (updateReqVO.getFiles().size() > 0) {
|
||||
uploadFileVo uploadFileVo = updateReqVO.getFiles().get(0);
|
||||
updateReqVO.setDownloadUrl(uploadFileVo.getUrl());
|
||||
updateReqVO.setFileMd5(uploadFileVo.getMd5());
|
||||
updateReqVO.setFileEncryptAlgorithm(uploadFileVo.getSha1());
|
||||
updateReqVO.setDownloadId(uploadFileVo.getId());
|
||||
}
|
||||
|
||||
// 更新
|
||||
VersionManagementDO updateObj = BeanUtils.toBean(updateReqVO, VersionManagementDO.class);
|
||||
|
||||
updateObj.setUpdater(String.valueOf(SecurityFrameworkUtils.getLoginUser().getId()));
|
||||
|
||||
systemVersionManagementMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSystemVersionManagement(Long id) {
|
||||
// 校验存在
|
||||
validateSystemVersionManagementExists(id);
|
||||
// 删除
|
||||
systemVersionManagementMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSystemVersionManagementListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateSystemVersionManagementExists(ids);
|
||||
// 删除
|
||||
systemVersionManagementMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateSystemVersionManagementExists(List<Long> ids) {
|
||||
List<VersionManagementDO> list = systemVersionManagementMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(SYSTEM_VERSION_MANAGEMENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateSystemVersionManagementExists(Long id) {
|
||||
if (systemVersionManagementMapper.selectById(id) == null) {
|
||||
throw exception(SYSTEM_VERSION_MANAGEMENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionManagementDO getSystemVersionManagement(Long id) {
|
||||
return systemVersionManagementMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<VersionManagementDO> getSystemVersionManagementPage(VersionManagementPageReqVO pageReqVO) {
|
||||
return systemVersionManagementMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<VersionManagementDO> getLts(VersionManagementPageReqVO pageReqVO) {
|
||||
|
||||
|
||||
return systemVersionManagementMapper.selectLts(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(Long id) {
|
||||
// 校验存在
|
||||
validateSystemVersionManagementExists(id);
|
||||
|
||||
// 下线当前发布的版本
|
||||
List<VersionManagementDO> versionManagementDOS = systemVersionManagementMapper.selectBySameCustDeviceCode(id);
|
||||
|
||||
if (versionManagementDOS.size() > 0) {
|
||||
|
||||
VersionManagementDO versionManagementDO = versionManagementDOS.get(0);
|
||||
VersionManagementDO offlineVO = new VersionManagementDO();
|
||||
offlineVO.setId(versionManagementDO.getId());
|
||||
offlineVO.setIssuanceFlag(2);
|
||||
systemVersionManagementMapper.updateById(offlineVO);
|
||||
}
|
||||
|
||||
|
||||
VersionManagementDO onlineVO = new VersionManagementDO();
|
||||
onlineVO.setId(id);
|
||||
onlineVO.setIssuanceFlag(1);
|
||||
systemVersionManagementMapper.updateById(onlineVO);
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,20 @@ 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 static com.zt.plat.framework.common.pojo.CommonResult.error;
|
||||
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_BATCH_ASSIGN_NOT_EXISTS;
|
||||
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchAssignDO;
|
||||
import com.zt.plat.module.qms.resource.material.service.MaterialBatchAssignService;
|
||||
|
||||
@Tag(name = "管理后台 - 物料批次分发")
|
||||
@RestController
|
||||
@RequestMapping("/qms/material-batch-assign")
|
||||
@RequestMapping("/qms/resource/material-batch-assign")
|
||||
@Validated
|
||||
@FileUploadController(source = "qms.materialbatchassign")
|
||||
public class MaterialBatchAssignController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||
@@ -94,6 +96,21 @@ public class MaterialBatchAssignController extends AbstractFileUploadController
|
||||
return success(BeanUtils.toBean(materialBatchAssign, MaterialBatchAssignRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get-by-inf")
|
||||
@Operation(summary = "获得物料批次分发")
|
||||
@Parameter(name = "productId", description = "产品大类编号", required = true)
|
||||
// @PreAuthorize("@ss.hasPermission('qms:material-batch-assign:query')")
|
||||
public CommonResult<PageResult<MaterialBatchAssignRespVO>> getMaterialBatchAssignByInfiId(MaterialBatchAssignPageReqVO pageReqVO) {
|
||||
|
||||
if(pageReqVO.getMaterialInfomationId()==null||pageReqVO.getMaterialInfomationId().length()==0){
|
||||
return error(MATERIAL_BATCH_ASSIGN_NOT_EXISTS,"示例编号不能为空");
|
||||
}
|
||||
|
||||
PageResult<MaterialBatchAssignDO> pageResult = materialBatchAssignService.getMaterialBatchAssignByInfId(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MaterialBatchAssignRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得物料批次分发分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-batch-assign:query')")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user