Compare commits

...

25 Commits

Author SHA1 Message Date
wxr
dd6df68061 升级liteflow及处理荧光数据上传 2025-12-12 08:48:36 +08:00
FCL
468e939ab1 Merge remote-tracking branch 'origin/test' into test 2025-12-11 17:53:16 +08:00
FCL
90b0aa5202 feat:报告转pdf、发起iwork流程。 开发中 2025-12-11 17:52:59 +08:00
yd
33543e5330 fix:物料管理业务逻辑修改。新增库存数据统计查询 2025-12-11 16:32:57 +08:00
yd
6a3d585802 feat:新增盘点表数据 2025-12-10 14:47:46 +08:00
禁止呵呵
9eec0bb05e feat:领用出库、同意出库 2025-12-09 21:19:31 +08:00
禁止呵呵
8fd750a82f Merge remote-tracking branch 'origin/test' into test 2025-12-09 16:10:46 +08:00
禁止呵呵
2790ed7ea1 feat:库存查询,库存记录查询、入库记录查询 2025-12-09 16:10:37 +08:00
FCL
9f4369bcb2 fix:报告纵表细节调整 2025-12-09 15:46:00 +08:00
FCL
920292cfac feat:报告数据算法逻辑调整;增加分页逻辑 2025-12-09 14:39:13 +08:00
禁止呵呵
1187038ba8 feat:库存管理 2025-12-09 09:39:07 +08:00
禁止呵呵
e2678fe7b4 Merge remote-tracking branch 'origin/test' into test 2025-12-09 09:29:22 +08:00
禁止呵呵
c1b975cca0 feat:入库、批量入库 2025-12-09 09:29:14 +08:00
FCL
b7f30012c8 feat:报告数据算法逻辑调整 2025-12-08 17:50:15 +08:00
FCL
000cfca842 feat:报告数据算法逻辑调整 2025-12-08 10:27:36 +08:00
wxr
6b006513af 分析班组添加是否送样标识 2025-12-05 18:32:54 +08:00
禁止呵呵
f2571944c1 fix:版本管理模块字段修改 2025-12-05 17:32:14 +08:00
禁止呵呵
8e3994b6a8 Merge remote-tracking branch 'origin/test' into test 2025-12-05 17:23:52 +08:00
禁止呵呵
c7f3bc0a46 fix:版本管理模块文件名修改,字段修改,版本查询条件修改 2025-12-05 17:23:41 +08:00
wxr
54bc4b8b37 检测方法及委检登记-已提交列表,数据状态问题修复 2025-12-05 17:13:59 +08:00
FCL
d0ee704939 doc:iWork集成说明 2025-12-05 14:50:57 +08:00
yd
9cf4af15c2 feat:物料管理出库相关 2025-12-05 13:47:41 +08:00
yd
ac308f30a2 feat:物料管理盘点相关 2025-12-05 11:48:40 +08:00
yd
60b2761b2c Merge remote-tracking branch 'origin/test' into test 2025-12-04 20:14:33 +08:00
yd
a17621b0dd feat:客户端版本管理 2025-12-04 20:14:24 +08:00
181 changed files with 8384 additions and 471 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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 ==================================*/

View File

@@ -18,6 +18,7 @@
</description>
<properties>
<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 -->

View File

@@ -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;

View File

@@ -5,9 +5,14 @@ import lombok.Data;
@Data
public class BusinessAssayTaskDataGroupRespVO {
/** 方法id **/
private Long configAssayMethodId;
/** 方法名称 **/
private String configAssayMethodName;
/** 方法名称及类别 **/
private String configAssayMethodNameAndCategory;
private String assayType;

View File

@@ -107,6 +107,9 @@ public class BusinessAssayTaskDataReqVO {
@Schema(description = "检测方法配置名称")
private String configAssayMethodName;
@Schema(description = "检测方法配置名称及类别")
private String configAssayMethodNameAndCategory;
@Schema(description = "收样时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

View File

@@ -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;

View File

@@ -17,6 +17,9 @@ public class BusinessSubParentSampleAssessmentGroupReqVO {
@Schema(description = "分析方法名称")
private String configAssayMethodName;
@Schema(description = "检测方法配置名称及类别")
private String configAssayMethodNameAndCategory;
@Schema(description = "分析部门ID")
private Long assayDepartmentId;

View File

@@ -11,6 +11,9 @@ public class BusinessSubParentSampleAssessmentGroupRespVO {
@Schema(description = "分析方法名称")
private String configAssayMethodName;
@Schema(description = "检测方法配置名称及类别")
private String configAssayMethodNameAndCategory;
@Schema(description = "分析部门ID")
private Long assayDepartmentId;

View File

@@ -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;

View File

@@ -40,6 +40,9 @@ public class BusinessSubSampleAnalysisGroupRespVO {
@ExcelProperty("样品状态")
private String sampleStatus;
@Schema(description = "是否送样")
private Integer isSend;
@Schema(description = "收样人")
@ExcelProperty("收样人")
private String sampleReceiver;

View File

@@ -37,6 +37,9 @@ public class BusinessSubSampleAnalysisGroupSaveReqVO {
@NotEmpty(message = "样品状态不能为空")
private String sampleStatus;
@Schema(description = "是否送样")
private Integer isSend;
@Schema(description = "收样人")
private String sampleReceiver;

View File

@@ -63,6 +63,9 @@ public class BusinessSubSampleExtendRespVO extends BusinessSubSampleRespVO {
@Schema(description = "分析部门名称")
private String assayDepartmentName;
@Schema(description = "是否已送样")
private Integer isSendSample;
@Schema(description = "是否打印")
private Integer isPrint;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -63,6 +63,11 @@ public class BusinessSubSampleAnalysisGroupDO extends BusinessBaseDO {
@TableField("SMP_STS")
private String sampleStatus;
/**
* 是否送样
*/
@TableField("IS_SND")
private Integer isSend;
/**
* 收样人
*/
@TableField("SMP_RCVR")

View File

@@ -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)
@@ -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)
@@ -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)

View File

@@ -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));
}

View File

@@ -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())

View File

@@ -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));
}

View File

@@ -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);
}
}
}

View File

@@ -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);
/**
* 获得委检登记业务分页
*

View File

@@ -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);

View File

@@ -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;
@@ -991,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();
}

View File

@@ -501,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);
@@ -583,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;
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -25,6 +25,9 @@ public class ConfigAssayMethodReqVO {
@Schema(description = "方法名称", example = "李四")
private String name;
@Schema(description = "方法名称及类别")
private String methodNameCategory;
@Schema(description = "方法编号")
private String methodCode;

View File

@@ -30,6 +30,9 @@ public class ConfigAssayMethodRespVO {
@ExcelProperty("方法名称")
private String name;
@Schema(description = "方法名称及类别")
private String methodNameCategory;
@Schema(description = "方法编号")
@ExcelProperty("方法编号")
private String methodCode;

View File

@@ -24,6 +24,9 @@ public class ConfigAssayMethodSaveReqVO {
@Schema(description = "方法名称", example = "李四")
private String name;
@Schema(description = "方法名称及类别")
private String methodNameCategory;
@Schema(description = "方法编号")
private String methodCode;

View File

@@ -10,6 +10,9 @@ public class ConfigSubSampleMethodExtendRespVO extends ConfigSubSampleMethodResp
@Schema(description = "分析方法名称")
private String configAssayMethodName;
@Schema(description = "检测方法配置名称及类别")
private String configAssayMethodNameAndCategory;
/** 分析方法编号 **/
@Schema(description = "分析方法编号")
private String configAssayMethodCode;

View File

@@ -57,6 +57,11 @@ public class ConfigAssayMethodDO extends BusinessBaseDO {
@TableField("MTHD_CD")
private String methodCode;
/**
* 方法名称及类别
*/
@TableField("MTHD_NAME_CTGR")
private String methodNameCategory;
/**
* 描述
*/
@TableField("DSP")

View File

@@ -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())

View File

@@ -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));

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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));
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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 = "样品创建时间")

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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("记录数")

View File

@@ -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支持多值")

View File

@@ -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;
//==================扩展字段===========
//样品创建时间

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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));
}
}

View File

@@ -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";
// }
// }
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -22,6 +22,8 @@ public interface ReportDocumentMainCorrelationService {
void deleteByMainId(Long mainId);
void insertBatch(List<ReportDocumentMainCorrelationDO> list);
/**
* 创建检测报告关系表
*

View File

@@ -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) {
// 校验存在

View File

@@ -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);
}

View File

@@ -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());
}
}

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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");

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 {
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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));
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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')")

View File

@@ -1,8 +1,7 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchSaveReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.*;
import com.zt.plat.module.qms.resource.material.service.MaterialBatchAssignService;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -37,11 +36,14 @@ import com.zt.plat.module.qms.resource.material.service.MaterialBatchService;
@Tag(name = "管理后台 - 物料批次")
@RestController
@RequestMapping("/qms/material-batch")
@RequestMapping("/qms/resource/material-batch")
@Validated
@FileUploadController(source = "qms.materialbatch")
public class MaterialBatchController extends AbstractFileUploadController implements BusinessControllerMarker{
@Resource
private MaterialBatchAssignService materialBatchAssignService;
static {
FileUploadController annotation = MaterialBatchController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
@@ -115,4 +117,10 @@ public class MaterialBatchController extends AbstractFileUploadController implem
BeanUtils.toBean(list, MaterialBatchRespVO.class));
}
@PostMapping("/assign")
@Operation(summary = "物料分发")
public CommonResult<MaterialBatchAssignRespVO> assign(@Valid @RequestBody MaterialBatchAssignSaveReqVO createReqVO) {
return success(materialBatchAssignService.assignLab(createReqVO));
}
}

View File

@@ -0,0 +1,118 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckBatchRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckBatchSaveReqVO;
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.material.dal.dataobject.MaterialInventoryCheckBatchDO;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryCheckBatchService;
@Tag(name = "管理后台 - 库存盘点项")
@RestController
@RequestMapping("/qms/material-inventory-check-batch")
@Validated
@FileUploadController(source = "qms.materialinventorycheckbatch")
public class MaterialInventoryCheckBatchController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
FileUploadController annotation = MaterialInventoryCheckBatchController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialInventoryCheckBatchService materialInventoryCheckBatchService;
@PostMapping("/create")
@Operation(summary = "创建库存盘点项")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:create')")
public CommonResult<MaterialInventoryCheckBatchRespVO> createMaterialInventoryCheckBatch(@Valid @RequestBody MaterialInventoryCheckBatchSaveReqVO createReqVO) {
return success(materialInventoryCheckBatchService.createMaterialInventoryCheckBatch(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存盘点项")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:update')")
public CommonResult<Boolean> updateMaterialInventoryCheckBatch(@Valid @RequestBody MaterialInventoryCheckBatchSaveReqVO updateReqVO) {
materialInventoryCheckBatchService.updateMaterialInventoryCheckBatch(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除库存盘点项")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:delete')")
public CommonResult<Boolean> deleteMaterialInventoryCheckBatch(@RequestParam("id") Long id) {
materialInventoryCheckBatchService.deleteMaterialInventoryCheckBatch(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除库存盘点项")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:delete')")
public CommonResult<Boolean> deleteMaterialInventoryCheckBatchList(@RequestBody BatchDeleteReqVO req) {
materialInventoryCheckBatchService.deleteMaterialInventoryCheckBatchListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得库存盘点项")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:query')")
public CommonResult<MaterialInventoryCheckBatchRespVO> getMaterialInventoryCheckBatch(@RequestParam("id") Long id) {
MaterialInventoryCheckBatchDO materialInventoryCheckBatch = materialInventoryCheckBatchService.getMaterialInventoryCheckBatch(id);
return success(BeanUtils.toBean(materialInventoryCheckBatch, MaterialInventoryCheckBatchRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得库存盘点项分页")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:query')")
public CommonResult<PageResult<MaterialInventoryCheckBatchRespVO>> getMaterialInventoryCheckBatchPage(@Valid MaterialInventoryCheckBatchPageReqVO pageReqVO) {
PageResult<MaterialInventoryCheckBatchDO> pageResult = materialInventoryCheckBatchService.getMaterialInventoryCheckBatchPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryCheckBatchRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库存盘点项 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-batch:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryCheckBatchExcel(@Valid MaterialInventoryCheckBatchPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialInventoryCheckBatchDO> list = materialInventoryCheckBatchService.getMaterialInventoryCheckBatchPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "库存盘点项.xls", "数据", MaterialInventoryCheckBatchRespVO.class,
BeanUtils.toBean(list, MaterialInventoryCheckBatchRespVO.class));
}
}

View File

@@ -0,0 +1,135 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckSaveReqVO;
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.material.dal.dataobject.MaterialInventoryCheckDO;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryCheckService;
@Tag(name = "管理后台 - 库存盘点")
@RestController
@RequestMapping("/qms/resource/material-inventory-check")
@Validated
@FileUploadController(source = "qms.materialinventorycheck")
public class MaterialInventoryCheckController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
FileUploadController annotation = MaterialInventoryCheckController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialInventoryCheckService materialInventoryCheckService;
@PostMapping("/create")
@Operation(summary = "创建库存盘点")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:create')")
public CommonResult<MaterialInventoryCheckRespVO> createMaterialInventoryCheck(@Valid @RequestBody MaterialInventoryCheckSaveReqVO createReqVO) {
return success(materialInventoryCheckService.createMaterialInventoryCheck(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存盘点")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:update')")
public CommonResult<Boolean> updateMaterialInventoryCheck(@Valid @RequestBody MaterialInventoryCheckSaveReqVO updateReqVO) {
materialInventoryCheckService.updateMaterialInventoryCheck(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除库存盘点")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:delete')")
public CommonResult<Boolean> deleteMaterialInventoryCheck(@RequestParam("id") Long id) {
materialInventoryCheckService.deleteMaterialInventoryCheck(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除库存盘点")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:delete')")
public CommonResult<Boolean> deleteMaterialInventoryCheckList(@RequestBody BatchDeleteReqVO req) {
materialInventoryCheckService.deleteMaterialInventoryCheckListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得库存盘点")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:query')")
public CommonResult<MaterialInventoryCheckRespVO> getMaterialInventoryCheck(@RequestParam("id") Long id) {
MaterialInventoryCheckDO materialInventoryCheck = materialInventoryCheckService.getMaterialInventoryCheck(id);
return success(BeanUtils.toBean(materialInventoryCheck, MaterialInventoryCheckRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得库存盘点分页")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:query')")
public CommonResult<PageResult<MaterialInventoryCheckRespVO>> getMaterialInventoryCheckPage(@Valid MaterialInventoryCheckPageReqVO pageReqVO) {
PageResult<MaterialInventoryCheckDO> pageResult = materialInventoryCheckService.getMaterialInventoryCheckPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryCheckRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库存盘点 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryCheckExcel(@Valid MaterialInventoryCheckPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialInventoryCheckDO> list = materialInventoryCheckService.getMaterialInventoryCheckPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "库存盘点.xls", "数据", MaterialInventoryCheckRespVO.class,
BeanUtils.toBean(list, MaterialInventoryCheckRespVO.class));
}
@PostMapping("/create-form")
@Operation(summary = "创建库存盘点")
public CommonResult<MaterialInventoryCheckRespVO> createMaterialInventoryCheckForm(@Valid @RequestBody MaterialInventoryCheckSaveReqVO createReqVO) {
return success(materialInventoryCheckService.createMaterialInventoryCheckForm(createReqVO));
}
@GetMapping("/get-form")
@Operation(summary = "获得库存盘点")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check:query')")
public CommonResult<MaterialInventoryCheckRespVO> getMaterialInventoryCheckForm(@RequestParam("id") Long id) {
return success(materialInventoryCheckService.getMaterialInventoryCheckForm(id));
}
}

View File

@@ -0,0 +1,118 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckDetailRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryCheckDetailSaveReqVO;
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.material.dal.dataobject.MaterialInventoryCheckDetailDO;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryCheckDetailService;
@Tag(name = "管理后台 - 库存盘点明细")
@RestController
@RequestMapping("/qms/material-inventory-check-detail")
@Validated
@FileUploadController(source = "qms.materialinventorycheckdetail")
public class MaterialInventoryCheckDetailController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
FileUploadController annotation = MaterialInventoryCheckDetailController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialInventoryCheckDetailService materialInventoryCheckDetailService;
@PostMapping("/create")
@Operation(summary = "创建库存盘点明细")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:create')")
public CommonResult<MaterialInventoryCheckDetailRespVO> createMaterialInventoryCheckDetail(@Valid @RequestBody MaterialInventoryCheckDetailSaveReqVO createReqVO) {
return success(materialInventoryCheckDetailService.createMaterialInventoryCheckDetail(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存盘点明细")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:update')")
public CommonResult<Boolean> updateMaterialInventoryCheckDetail(@Valid @RequestBody MaterialInventoryCheckDetailSaveReqVO updateReqVO) {
materialInventoryCheckDetailService.updateMaterialInventoryCheckDetail(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除库存盘点明细")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryCheckDetail(@RequestParam("id") Long id) {
materialInventoryCheckDetailService.deleteMaterialInventoryCheckDetail(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除库存盘点明细")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryCheckDetailList(@RequestBody BatchDeleteReqVO req) {
materialInventoryCheckDetailService.deleteMaterialInventoryCheckDetailListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得库存盘点明细")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:query')")
public CommonResult<MaterialInventoryCheckDetailRespVO> getMaterialInventoryCheckDetail(@RequestParam("id") Long id) {
MaterialInventoryCheckDetailDO materialInventoryCheckDetail = materialInventoryCheckDetailService.getMaterialInventoryCheckDetail(id);
return success(BeanUtils.toBean(materialInventoryCheckDetail, MaterialInventoryCheckDetailRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得库存盘点明细分页")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:query')")
public CommonResult<PageResult<MaterialInventoryCheckDetailRespVO>> getMaterialInventoryCheckDetailPage(@Valid MaterialInventoryCheckDetailPageReqVO pageReqVO) {
PageResult<MaterialInventoryCheckDetailDO> pageResult = materialInventoryCheckDetailService.getMaterialInventoryCheckDetailPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryCheckDetailRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库存盘点明细 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-detail:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryCheckDetailExcel(@Valid MaterialInventoryCheckDetailPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialInventoryCheckDetailDO> list = materialInventoryCheckDetailService.getMaterialInventoryCheckDetailPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "库存盘点明细.xls", "数据", MaterialInventoryCheckDetailRespVO.class,
BeanUtils.toBean(list, MaterialInventoryCheckDetailRespVO.class));
}
}

View File

@@ -0,0 +1,151 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import com.zt.plat.framework.business.annotation.FileUploadController;
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDetailDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryInboundDetailService;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryService;
import com.zt.plat.module.qms.resource.material.service.MaterialProductService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@RestController
@RequestMapping("/qms/resource/material-inventory")
@Validated
@FileUploadController(source = "qms.materiainfo")
public class MaterialInventoryController extends AbstractFileUploadController implements BusinessControllerMarker {
static {
FileUploadController annotation = MaterialInventoryController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialInventoryInboundDetailService materialInventoryInboundDetailService;
@Resource
private MaterialInventoryService mterialInventoryService;
@PostMapping("/create")
@Operation(summary = "创建入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:create')")
public CommonResult<MaterialInventoryInboundDetailRespVO> createMaterialInventoryInboundDetail(@Valid @RequestBody MaterialInventoryInboundDetailSaveReqVO createReqVO) {
return success(materialInventoryInboundDetailService.createMaterialInventoryInboundDetail(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:update')")
public CommonResult<Boolean> updateMaterialInventoryInboundDetail(@Valid @RequestBody MaterialInventoryInboundDetailSaveReqVO updateReqVO) {
materialInventoryInboundDetailService.updateMaterialInventoryInboundDetail(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryInboundDetail(@RequestParam("id") Long id) {
materialInventoryInboundDetailService.deleteMaterialInventoryInboundDetail(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryInboundDetailList(@RequestBody BatchDeleteReqVO req) {
materialInventoryInboundDetailService.deleteMaterialInventoryInboundDetailListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
public CommonResult<MaterialInventoryInboundDetailRespVO> getMaterialInventoryInboundDetail(@RequestParam("id") Long id) {
MaterialInventoryInboundDetailDO materialInventoryInboundDetail = materialInventoryInboundDetailService.getMaterialInventoryInboundDetail(id);
return success(BeanUtils.toBean(materialInventoryInboundDetail, MaterialInventoryInboundDetailRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得库存明细")
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
public CommonResult<PageResult<MaterialInventoryInboundDetailRespVO>> getMaterialInventoryPage(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO) {
PageResult<MaterialInventoryInboundDetailDO> pageResult = materialInventoryInboundDetailService.getMaterialInventoryInboundDetailPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryInboundDetailRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryInboundDetailExcel(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialInventoryInboundDetailDO> list = materialInventoryInboundDetailService.getMaterialInventoryInboundDetailPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等.xls", "数据", MaterialInventoryInboundDetailRespVO.class,
BeanUtils.toBean(list, MaterialInventoryInboundDetailRespVO.class));
}
@GetMapping("/getList")
@Operation(summary = "获得库存列表")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<PageResult<MaterialInventoryRespVO>> getMaterialProduct(MaterialInventoryRespVO pageReqVO) {
PageResult<MaterialInventoryDO> pageResult = mterialInventoryService.getMaterialInventoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryRespVO.class));
}
@GetMapping("/get_mtrl_inf")
@Operation(summary = "获取实例列表")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<PageResult<MaterialInventoryRespVO>> getInfomation(MaterialInventoryRespVO pageReqVO) {
PageResult<MaterialInventoryDO> pageResult = mterialInventoryService.getMaterialInventoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryRespVO.class));
}
@GetMapping("/agree-out")
@Operation(summary = "同意出库")
@Parameter(name = "id", description = "出库单id", required = true)
public CommonResult<Boolean> agreeOut(@RequestParam("outId") Long outId) {
// PageResult<MaterialInventoryDO> pageResult = mterialInventoryService.getMaterialInventoryPage(pageReqVO);
// return success(BeanUtils.toBean(pageResult, MaterialInventoryRespVO.class));
mterialInventoryService.agreeMaterialInventoryOutbound(outId);
return success(true);
}
}

View File

@@ -3,6 +3,7 @@ package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundSaveReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -37,7 +38,7 @@ import com.zt.plat.module.qms.resource.material.service.MaterialInventoryInbound
@Tag(name = "管理后台 - 入库")
@RestController
@RequestMapping("/qms/material-inventory-inbound")
@RequestMapping("/qms/resource/material-inventory-inbound")
@Validated
@FileUploadController(source = "qms.materialinventoryinbound")
public class MaterialInventoryInboundController extends AbstractFileUploadController implements BusinessControllerMarker{
@@ -115,4 +116,17 @@ public class MaterialInventoryInboundController extends AbstractFileUploadContro
BeanUtils.toBean(list, MaterialInventoryInboundRespVO.class));
}
@PostMapping("/multi-put")
@Operation(summary = "批量上架")
public CommonResult<Boolean> createMaterialInventoryInboundMulti(@Valid @RequestBody MaterialInventoryInboundSaveReqVO createReqVO) {
materialInventoryInboundService.multiCreateMaterialInventoryInbound(createReqVO);
return success(true);
}
@PostMapping("single-put")
@Operation(summary = "单一上架")
public CommonResult<PageResult<MaterialInventoryInboundRespVO>> createMaterialInventoryInboundSingle(@Valid @RequestBody MaterialInventoryInboundSaveReqVO createReqVO) {
return success(materialInventoryInboundService.singleCreateMaterialInventoryInbound(createReqVO));
}
}

View File

@@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.material.service.MaterialInventoryInbound
@Tag(name = "管理后台 - 入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@RestController
@RequestMapping("/qms/material-inventory-inbound-detail")
@RequestMapping("/qms/resource/material-inventory-inbound-detail")
@Validated
@FileUploadController(source = "qms.materialinventoryinbounddetail")
public class MaterialInventoryInboundDetailController extends AbstractFileUploadController implements BusinessControllerMarker{
@@ -115,4 +115,10 @@ public class MaterialInventoryInboundDetailController extends AbstractFileUpload
BeanUtils.toBean(list, MaterialInventoryInboundDetailRespVO.class));
}
@GetMapping("/page-list")
@Operation(summary = "获得入库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页")
public CommonResult<PageResult<MaterialInventoryInboundDetailRespVO>> getMaterialInventoryInboundDetailPageList(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO) {
PageResult<MaterialInventoryInboundDetailRespVO> pageResult = materialInventoryInboundDetailService.getMaterialInventoryInboundDetailPageList(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryInboundDetailRespVO.class));
}
}

View File

@@ -0,0 +1,126 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundSaveReqVO;
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.material.dal.dataobject.MaterialInventoryOutboundDO;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryOutboundService;
@Tag(name = "管理后台 - 出库")
@RestController
@RequestMapping("/qms/resource/material-inventory-outbound")
@Validated
@FileUploadController(source = "qms.materialinventoryoutbound")
public class MaterialInventoryOutboundController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
FileUploadController annotation = MaterialInventoryOutboundController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialInventoryOutboundService materialInventoryOutboundService;
@PostMapping("/create")
@Operation(summary = "创建出库")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:create')")
public CommonResult<MaterialInventoryOutboundRespVO> createMaterialInventoryOutbound(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO createReqVO) {
return success(materialInventoryOutboundService.createMaterialInventoryOutbound(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新出库")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:update')")
public CommonResult<Boolean> updateMaterialInventoryOutbound(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO updateReqVO) {
materialInventoryOutboundService.updateMaterialInventoryOutbound(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除出库")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:delete')")
public CommonResult<Boolean> deleteMaterialInventoryOutbound(@RequestParam("id") Long id) {
materialInventoryOutboundService.deleteMaterialInventoryOutbound(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除出库")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:delete')")
public CommonResult<Boolean> deleteMaterialInventoryOutboundList(@RequestBody BatchDeleteReqVO req) {
materialInventoryOutboundService.deleteMaterialInventoryOutboundListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得出库")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:query')")
public CommonResult<MaterialInventoryOutboundRespVO> getMaterialInventoryOutbound(@RequestParam("id") Long id) {
MaterialInventoryOutboundDO materialInventoryOutbound = materialInventoryOutboundService.getMaterialInventoryOutbound(id);
return success(BeanUtils.toBean(materialInventoryOutbound, MaterialInventoryOutboundRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得出库分页")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:query')")
public CommonResult<PageResult<MaterialInventoryOutboundRespVO>> getMaterialInventoryOutboundPage(@Valid MaterialInventoryOutboundPageReqVO pageReqVO) {
PageResult<MaterialInventoryOutboundDO> pageResult = materialInventoryOutboundService.getMaterialInventoryOutboundPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryOutboundRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出出库 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryOutboundExcel(@Valid MaterialInventoryOutboundPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialInventoryOutboundDO> list = materialInventoryOutboundService.getMaterialInventoryOutboundPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "出库.xls", "数据", MaterialInventoryOutboundRespVO.class,
BeanUtils.toBean(list, MaterialInventoryOutboundRespVO.class));
}
@PostMapping("/create-all")
@Operation(summary = "创建出库")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:create')")
public CommonResult<MaterialInventoryOutboundRespVO> createMaterialInventoryOutboundAll(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO createReqVO) {
return success(materialInventoryOutboundService.createMaterialInventoryOutboundAll(createReqVO));
}
}

View File

@@ -0,0 +1,118 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailSaveReqVO;
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.material.dal.dataobject.MaterialInventoryOutboundDetailDO;
import com.zt.plat.module.qms.resource.material.service.MaterialInventoryOutboundDetailService;
@Tag(name = "管理后台 - 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@RestController
@RequestMapping("/qms/material-inventory-outbound-detail")
@Validated
@FileUploadController(source = "qms.materialinventoryoutbounddetail")
public class MaterialInventoryOutboundDetailController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
FileUploadController annotation = MaterialInventoryOutboundDetailController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialInventoryOutboundDetailService materialInventoryOutboundDetailService;
@PostMapping("/create")
@Operation(summary = "创建出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:create')")
public CommonResult<MaterialInventoryOutboundDetailRespVO> createMaterialInventoryOutboundDetail(@Valid @RequestBody MaterialInventoryOutboundDetailSaveReqVO createReqVO) {
return success(materialInventoryOutboundDetailService.createMaterialInventoryOutboundDetail(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:update')")
public CommonResult<Boolean> updateMaterialInventoryOutboundDetail(@Valid @RequestBody MaterialInventoryOutboundDetailSaveReqVO updateReqVO) {
materialInventoryOutboundDetailService.updateMaterialInventoryOutboundDetail(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryOutboundDetail(@RequestParam("id") Long id) {
materialInventoryOutboundDetailService.deleteMaterialInventoryOutboundDetail(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryOutboundDetailList(@RequestBody BatchDeleteReqVO req) {
materialInventoryOutboundDetailService.deleteMaterialInventoryOutboundDetailListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:query')")
public CommonResult<MaterialInventoryOutboundDetailRespVO> getMaterialInventoryOutboundDetail(@RequestParam("id") Long id) {
MaterialInventoryOutboundDetailDO materialInventoryOutboundDetail = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetail(id);
return success(BeanUtils.toBean(materialInventoryOutboundDetail, MaterialInventoryOutboundDetailRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:query')")
public CommonResult<PageResult<MaterialInventoryOutboundDetailRespVO>> getMaterialInventoryOutboundDetailPage(@Valid MaterialInventoryOutboundDetailPageReqVO pageReqVO) {
PageResult<MaterialInventoryOutboundDetailDO> pageResult = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetailPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryOutboundDetailRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryOutboundDetailExcel(@Valid MaterialInventoryOutboundDetailPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialInventoryOutboundDetailDO> list = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetailPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等.xls", "数据", MaterialInventoryOutboundDetailRespVO.class,
BeanUtils.toBean(list, MaterialInventoryOutboundDetailRespVO.class));
}
}

View File

@@ -0,0 +1,118 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
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.material.dal.dataobject.MaterialLocationDO;
import com.zt.plat.module.qms.resource.material.service.MaterialLocationService;
@Tag(name = "管理后台 - 存放位置")
@RestController
@RequestMapping("/qms/material-location")
@Validated
@FileUploadController(source = "qms.materiallocation")
public class MaterialLocationController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
FileUploadController annotation = MaterialLocationController.class.getAnnotation(FileUploadController.class);
if (annotation != null) {
setFileUploadInfo(annotation);
}
}
@Resource
private MaterialLocationService materialLocationService;
@PostMapping("/create")
@Operation(summary = "创建存放位置")
@PreAuthorize("@ss.hasPermission('qms:material-location:create')")
public CommonResult<MaterialLocationRespVO> createMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO createReqVO) {
return success(materialLocationService.createMaterialLocation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新存放位置")
@PreAuthorize("@ss.hasPermission('qms:material-location:update')")
public CommonResult<Boolean> updateMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO updateReqVO) {
materialLocationService.updateMaterialLocation(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除存放位置")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-location:delete')")
public CommonResult<Boolean> deleteMaterialLocation(@RequestParam("id") Long id) {
materialLocationService.deleteMaterialLocation(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除存放位置")
@PreAuthorize("@ss.hasPermission('qms:material-location:delete')")
public CommonResult<Boolean> deleteMaterialLocationList(@RequestBody BatchDeleteReqVO req) {
materialLocationService.deleteMaterialLocationListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得存放位置")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-location:query')")
public CommonResult<MaterialLocationRespVO> getMaterialLocation(@RequestParam("id") Long id) {
MaterialLocationDO materialLocation = materialLocationService.getMaterialLocation(id);
return success(BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得存放位置分页")
@PreAuthorize("@ss.hasPermission('qms:material-location:query')")
public CommonResult<PageResult<MaterialLocationRespVO>> getMaterialLocationPage(@Valid MaterialLocationPageReqVO pageReqVO) {
PageResult<MaterialLocationDO> pageResult = materialLocationService.getMaterialLocationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialLocationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出存放位置 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-location:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialLocationExcel(@Valid MaterialLocationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialLocationDO> list = materialLocationService.getMaterialLocationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "存放位置.xls", "数据", MaterialLocationRespVO.class,
BeanUtils.toBean(list, MaterialLocationRespVO.class));
}
}

View File

@@ -37,4 +37,7 @@ public class MaterialBatchAssignPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "实例ID")
private String materialInfomationId;
}

View File

@@ -10,13 +10,13 @@ public class MaterialBatchAssignSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15114")
private Long id;
@Schema(description = "源批次ID", example = "23099")
@Schema(description = "源批次ID",requiredMode = Schema.RequiredMode.REQUIRED, example = "23099")
private Long batchId;
@Schema(description = "产品id", example = "10774")
private String productId;
@Schema(description = "库房ID", example = "24720")
@Schema(description = "库房ID",requiredMode = Schema.RequiredMode.REQUIRED, example = "24720")
private Long warehouseId;
@Schema(description = "数量")

View File

@@ -78,5 +78,8 @@ public class MaterialInfomationPageReqVO extends PageParam {
@Schema(description = "大类ids")
List<Long> productIds;
@Schema(description = "入库id")
private Long inventoryInboundId;
}

View File

@@ -0,0 +1,44 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 库存盘点项分页 Request VO")
@Data
public class MaterialInventoryCheckBatchPageReqVO extends PageParam {
@Schema(description = "父id", example = "9310")
private Long checkId;
@Schema(description = "盘点物料大类ID", example = "18437")
private Long checkProductId;
@Schema(description = "盘点部门ID", example = "17789")
private Long checkDepartmentId;
@Schema(description = "应有量")
private String expected;
@Schema(description = "实有量")
private String actual;
@Schema(description = "差异")
private String difference;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,55 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 库存盘点项 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialInventoryCheckBatchRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "12065")
@ExcelProperty("主键")
private Long id;
@Schema(description = "父id", example = "9310")
@ExcelProperty("父id")
private Long checkId;
@Schema(description = "盘点物料大类ID", example = "18437")
@ExcelProperty("盘点物料大类ID")
private Long checkProductId;
@Schema(description = "盘点部门ID", example = "17789")
@ExcelProperty("盘点部门ID")
private Long checkDepartmentId;
@Schema(description = "应有量")
@ExcelProperty("应有量")
private String expected;
@Schema(description = "实有量")
@ExcelProperty("实有量")
private String actual;
@Schema(description = "差异")
@ExcelProperty("差异")
private String difference;
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 库存盘点项新增/修改 Request VO")
@Data
public class MaterialInventoryCheckBatchSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "12065")
private Long id;
@Schema(description = "父id", example = "9310")
private Long checkId;
@Schema(description = "盘点物料大类ID", example = "18437")
private Long checkProductId;
@Schema(description = "盘点部门ID", example = "17789")
private Long checkDepartmentId;
@Schema(description = "应有量")
private String expected;
@Schema(description = "实有量")
private String actual;
@Schema(description = "差异")
private String difference;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
@Schema(description = "盘点明细")
private List<MaterialInventoryCheckDetailSaveReqVO> detailList;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.qms.resource.material.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 MaterialInventoryCheckDetailPageReqVO extends PageParam {
@Schema(description = "盘点批次id", example = "12013")
private Long checkBatchId;
@Schema(description = "物料实例id", example = "2480")
private Long infomationId;
@Schema(description = "是否存在")
private String present;
@Schema(description = "当前数量")
private String currentQuantity;
@Schema(description = "状态", example = "1")
private String status;
@Schema(description = "处置方式,字典配置")
private String disposalMethod;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,54 @@
package com.zt.plat.module.qms.resource.material.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 MaterialInventoryCheckDetailRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16347")
@ExcelProperty("主键")
private Long id;
@Schema(description = "盘点批次id", example = "12013")
@ExcelProperty("盘点批次id")
private Long checkBatchId;
@Schema(description = "物料实例id", example = "2480")
@ExcelProperty("物料实例id")
private Long infomationId;
@Schema(description = "是否存在")
@ExcelProperty("是否存在")
private String present;
@Schema(description = "当前数量")
@ExcelProperty("当前数量")
private String currentQuantity;
@Schema(description = "状态", example = "1")
@ExcelProperty("状态")
private String status;
@Schema(description = "处置方式,字典配置")
@ExcelProperty("处置方式,字典配置")
private String disposalMethod;
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

Some files were not shown because too many files have changed in this diff Show More