diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java index 08dfeb1..602e703 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java @@ -68,6 +68,7 @@ public interface ErrorCodeConstants { ErrorCode MATERIAL_ASSAY_STANDARD_FORECAST_PROJECT_NOT_EXISTS = new ErrorCode(1_032_050_000, "物料检测标准来样品位配置不存在"); ErrorCode CONFIG_SAMPLE_HANDOVER_NOT_EXISTS = new ErrorCode(1_032_050_000, "样品交接配置不存在"); + ErrorCode CONFIG_USER_SIGNATURE_NOT_EXISTS = new ErrorCode(1_032_050_000, "手写签名不存在"); //dictionary ErrorCode DICTIONARY_SAMPLE_FLOW_NODE_NOT_EXISTS = new ErrorCode(1_032_050_000, "样品流程节点字典不存在"); diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsBpmConstant.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsBpmConstant.java index 14b7477..60b2f72 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsBpmConstant.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsBpmConstant.java @@ -7,6 +7,14 @@ public class QmsBpmConstant { * */ public static final String BPM_CALLBACK_BEAN_NAME = "bpmCallbackBean"; + /** + * 流程回调时使用的ActivityId Key + * */ + public static final String BPM_CALLBACK_ACTIVITY_ID = "bpmCallbackActivityId"; + + //驳回标记前缀 + public static final String BPM_CALLBACK_RETURN_FLAG_PREFIX_KEY = "RETURN_FLAG_"; + /** * 流程回调时使用的beanName Key * */ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayReportDataPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayReportDataPageReqVO.java index 4d4e9f8..3a0775e 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayReportDataPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayReportDataPageReqVO.java @@ -58,6 +58,9 @@ public class BusinessAssayReportDataPageReqVO extends PageParam { //==================扩展字段=========== + @Schema(description = "id列表") + private List idList; + @Schema(description = "样品名称") private String sampleName; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigUserSignatureController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigUserSignatureController.java new file mode 100644 index 0000000..52982bd --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/admin/ConfigUserSignatureController.java @@ -0,0 +1,117 @@ +package com.zt.plat.module.qms.business.config.controller.admin; + +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignaturePageReqVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignatureRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignatureSaveReqVO; +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.config.dal.dataobject.ConfigUserSignatureDO; +import com.zt.plat.module.qms.business.config.service.ConfigUserSignatureService; + +@Tag(name = "管理后台 - 手写签名配置") +@RestController +@RequestMapping("/qms/config-user-signature") +@Validated +@FileUploadController(source = "qms.configusersignature") +public class ConfigUserSignatureController extends AbstractFileUploadController implements BusinessControllerMarker{ + + static { + FileUploadController annotation = ConfigUserSignatureController.class.getAnnotation(FileUploadController.class); + if (annotation != null) { + setFileUploadInfo(annotation); + } + } + + @Resource + private ConfigUserSignatureService configUserSignatureService; + + @PostMapping("/create") + @Operation(summary = "创建手写签名配置") + @PreAuthorize("@ss.hasPermission('qms:config-user-signature:create')") + public CommonResult createConfigUserSignature(@Valid @RequestBody ConfigUserSignatureSaveReqVO createReqVO) { + return success(configUserSignatureService.createConfigUserSignature(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新手写签名配置") + @PreAuthorize("@ss.hasPermission('qms:config-user-signature:update')") + public CommonResult updateConfigUserSignature(@Valid @RequestBody ConfigUserSignatureSaveReqVO updateReqVO) { + configUserSignatureService.updateConfigUserSignature(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除手写签名配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:config-user-signature:delete')") + public CommonResult deleteConfigUserSignature(@RequestParam("id") Long id) { + configUserSignatureService.deleteConfigUserSignature(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除手写签名配置") + @PreAuthorize("@ss.hasPermission('qms:config-user-signature:delete')") + public CommonResult deleteConfigUserSignatureList(@RequestBody BatchDeleteReqVO req) { + configUserSignatureService.deleteConfigUserSignatureListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得手写签名配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getConfigUserSignature(@RequestParam("id") Long id) { + ConfigUserSignatureDO configUserSignature = configUserSignatureService.getConfigUserSignature(id); + return success(BeanUtils.toBean(configUserSignature, ConfigUserSignatureRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得手写签名配置分页") + @PreAuthorize("@ss.hasPermission('qms:config-user-signature:query')") + public CommonResult> getConfigUserSignaturePage(@Valid ConfigUserSignaturePageReqVO pageReqVO) { + PageResult pageResult = configUserSignatureService.getConfigUserSignaturePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ConfigUserSignatureRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出手写签名配置 Excel") + @PreAuthorize("@ss.hasPermission('qms:config-user-signature:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportConfigUserSignatureExcel(@Valid ConfigUserSignaturePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = configUserSignatureService.getConfigUserSignaturePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "手写签名配置.xls", "数据", ConfigUserSignatureRespVO.class, + BeanUtils.toBean(list, ConfigUserSignatureRespVO.class)); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignaturePageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignaturePageReqVO.java new file mode 100644 index 0000000..0d30517 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignaturePageReqVO.java @@ -0,0 +1,40 @@ +package com.zt.plat.module.qms.business.config.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 ConfigUserSignaturePageReqVO extends PageParam { + + @Schema(description = "用户id", example = "2926") + private String userId; + + @Schema(description = "用户姓名", example = "赵六") + private String userName; + + @Schema(description = "文件id", example = "9170") + private Long fileId; + + @Schema(description = "签名内容") + private String signatureContent; + + @Schema(description = "禁用标识") + private Integer cancelFlag; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "备注") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignatureRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignatureRespVO.java new file mode 100644 index 0000000..a2d5533 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignatureRespVO.java @@ -0,0 +1,50 @@ +package com.zt.plat.module.qms.business.config.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 ConfigUserSignatureRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17765") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "用户id", example = "2926") + @ExcelProperty("用户id") + private String userId; + + @Schema(description = "用户姓名", example = "赵六") + @ExcelProperty("用户姓名") + private String userName; + + @Schema(description = "文件id", example = "9170") + @ExcelProperty("文件id") + private Long fileId; + + @Schema(description = "签名内容") + @ExcelProperty("签名内容") + private String signatureContent; + + @Schema(description = "禁用标识") + @ExcelProperty("禁用标识") + private Integer cancelFlag; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCode; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignatureSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignatureSaveReqVO.java new file mode 100644 index 0000000..feb1f4e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/controller/vo/ConfigUserSignatureSaveReqVO.java @@ -0,0 +1,34 @@ +package com.zt.plat.module.qms.business.config.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "管理后台 - 手写签名配置新增/修改 Request VO") +@Data +public class ConfigUserSignatureSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17765") + private Long id; + + @Schema(description = "用户id", example = "2926") + private String userId; + + @Schema(description = "用户姓名", example = "赵六") + private String userName; + + @Schema(description = "文件id", example = "9170") + private Long fileId; + + @Schema(description = "签名内容") + private String signatureContent; + + @Schema(description = "禁用标识") + private Integer cancelFlag; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "备注") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigUserSignatureDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigUserSignatureDO.java new file mode 100644 index 0000000..b067b51 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/dataobject/ConfigUserSignatureDO.java @@ -0,0 +1,67 @@ +package com.zt.plat.module.qms.business.config.dal.dataobject; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 手写签名配置 DO +* +* @author 后台管理 +*/ +@TableName("t_cfg_user_sig") +@KeySequence("t_cfg_user_sig_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class ConfigUserSignatureDO extends BusinessBaseDO { + + + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 用户id + */ + @TableField("USER_ID") + private String userId; + /** + * 用户姓名 + */ + @TableField("USER_NAME") + private String userName; + /** + * 文件id + */ + @TableField("FILE_ID") + private Long fileId; + /** + * 签名内容 + */ + @TableField("SIG_CNTT") + private String signatureContent; + /** + * 禁用标识 + */ + @TableField("CNL_FLG") + private Integer cancelFlag; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCode; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigUserSignatureMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigUserSignatureMapper.java new file mode 100644 index 0000000..46e2cad --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/dal/mapper/ConfigUserSignatureMapper.java @@ -0,0 +1,31 @@ +package com.zt.plat.module.qms.business.config.dal.mapper; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignaturePageReqVO; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigUserSignatureDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 手写签名配置 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface ConfigUserSignatureMapper extends BaseMapperX { + + default PageResult selectPage(ConfigUserSignaturePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ConfigUserSignatureDO::getUserId, reqVO.getUserId()) + .likeIfPresent(ConfigUserSignatureDO::getUserName, reqVO.getUserName()) + .eqIfPresent(ConfigUserSignatureDO::getFileId, reqVO.getFileId()) + .eqIfPresent(ConfigUserSignatureDO::getSignatureContent, reqVO.getSignatureContent()) + .eqIfPresent(ConfigUserSignatureDO::getCancelFlag, reqVO.getCancelFlag()) + .eqIfPresent(ConfigUserSignatureDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .betweenIfPresent(ConfigUserSignatureDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(ConfigUserSignatureDO::getRemark, reqVO.getRemark()) + .orderByDesc(ConfigUserSignatureDO::getId)); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigUserSignatureService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigUserSignatureService.java new file mode 100644 index 0000000..1e30349 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigUserSignatureService.java @@ -0,0 +1,66 @@ +package com.zt.plat.module.qms.business.config.service; + +import java.util.*; + +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignaturePageReqVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignatureRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignatureSaveReqVO; +import jakarta.validation.*; +import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigUserSignatureDO; +import com.zt.plat.framework.common.pojo.PageResult; + +/** + * 手写签名配置 Service 接口 + * + * @author 后台管理 + */ +public interface ConfigUserSignatureService { + + ConfigUserSignatureDO getByUserId(Long userId); + + /** + * 创建手写签名配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + ConfigUserSignatureRespVO createConfigUserSignature(@Valid ConfigUserSignatureSaveReqVO createReqVO); + + /** + * 更新手写签名配置 + * + * @param updateReqVO 更新信息 + */ + void updateConfigUserSignature(@Valid ConfigUserSignatureSaveReqVO updateReqVO); + + /** + * 删除手写签名配置 + * + * @param id 编号 + */ + void deleteConfigUserSignature(Long id); + + /** + * 批量删除手写签名配置 + * + * @param ids 编号 + */ + void deleteConfigUserSignatureListByIds(List ids); + + /** + * 获得手写签名配置 + * + * @param id 编号 + * @return 手写签名配置 + */ + ConfigUserSignatureDO getConfigUserSignature(Long id); + + /** + * 获得手写签名配置分页 + * + * @param pageReqVO 分页查询 + * @return 手写签名配置分页 + */ + PageResult getConfigUserSignaturePage(ConfigUserSignaturePageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigUserSignatureServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigUserSignatureServiceImpl.java new file mode 100644 index 0000000..1d162c1 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/config/service/ConfigUserSignatureServiceImpl.java @@ -0,0 +1,103 @@ +package com.zt.plat.module.qms.business.config.service; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignaturePageReqVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignatureRespVO; +import com.zt.plat.module.qms.business.config.controller.vo.ConfigUserSignatureSaveReqVO; +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.config.dal.dataobject.ConfigUserSignatureDO; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.util.object.BeanUtils; + +import com.zt.plat.module.qms.business.config.dal.mapper.ConfigUserSignatureMapper; + +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.CONFIG_USER_SIGNATURE_NOT_EXISTS; + +/** + * 手写签名配置 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class ConfigUserSignatureServiceImpl implements ConfigUserSignatureService { + + @Resource + private ConfigUserSignatureMapper configUserSignatureMapper; + + @Override + public ConfigUserSignatureDO getByUserId(Long userId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(ConfigUserSignatureDO::getUserId, userId) + .eq(ConfigUserSignatureDO::getCancelFlag, 0); + query.orderByDesc(ConfigUserSignatureDO::getUpdateTime); + List list = configUserSignatureMapper.selectList(query); + return CollUtil.isEmpty(list) ? null : list.get(0); + } + + @Override + public ConfigUserSignatureRespVO createConfigUserSignature(ConfigUserSignatureSaveReqVO createReqVO) { + // 插入 + ConfigUserSignatureDO configUserSignature = BeanUtils.toBean(createReqVO, ConfigUserSignatureDO.class); + configUserSignatureMapper.insert(configUserSignature); + // 返回 + return BeanUtils.toBean(configUserSignature, ConfigUserSignatureRespVO.class); + } + + @Override + public void updateConfigUserSignature(ConfigUserSignatureSaveReqVO updateReqVO) { + // 校验存在 + validateConfigUserSignatureExists(updateReqVO.getId()); + // 更新 + ConfigUserSignatureDO updateObj = BeanUtils.toBean(updateReqVO, ConfigUserSignatureDO.class); + configUserSignatureMapper.updateById(updateObj); + } + + @Override + public void deleteConfigUserSignature(Long id) { + // 校验存在 + validateConfigUserSignatureExists(id); + // 删除 + configUserSignatureMapper.deleteById(id); + } + + @Override + public void deleteConfigUserSignatureListByIds(List ids) { + // 校验存在 + validateConfigUserSignatureExists(ids); + // 删除 + configUserSignatureMapper.deleteByIds(ids); + } + + private void validateConfigUserSignatureExists(List ids) { + List list = configUserSignatureMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(CONFIG_USER_SIGNATURE_NOT_EXISTS); + } + } + + private void validateConfigUserSignatureExists(Long id) { + if (configUserSignatureMapper.selectById(id) == null) { + throw exception(CONFIG_USER_SIGNATURE_NOT_EXISTS); + } + } + + @Override + public ConfigUserSignatureDO getConfigUserSignature(Long id) { + return configUserSignatureMapper.selectById(id); + } + + @Override + public PageResult getConfigUserSignaturePage(ConfigUserSignaturePageReqVO pageReqVO) { + return configUserSignatureMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java index db0e47b..71b6397 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java @@ -37,6 +37,8 @@ public interface ReportDocumentDataService { CommonResult insertBatch(List list); + void deleteByMainId(Long mainId); + /** * 更新检测报告明细 * diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java index 74bdcf2..36d89c0 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java @@ -324,6 +324,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService return CommonResult.success("移除成功"); } + @Override + public void deleteByMainId(Long mainId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("MAIN_ID", mainId); + reportDocumentDataMapper.delete(queryWrapper); + } + @Override public ReportDocumentDataRespVO createReportDocumentData(ReportDocumentDataSaveReqVO createReqVO) { // 插入 diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationService.java index aac4c29..2a1c2be 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationService.java @@ -20,6 +20,8 @@ public interface ReportDocumentMainCorrelationService { List listByMainId(Long mainId); + void deleteByMainId(Long mainId); + /** * 创建检测报告关系表 * diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationServiceImpl.java index 6dbbef6..d0188b5 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainCorrelationServiceImpl.java @@ -51,6 +51,14 @@ public class ReportDocumentMainCorrelationServiceImpl implements ReportDocumentM return BeanUtils.toBean(reportDocumentMainCorrelation, ReportDocumentMainCorrelationRespVO.class); } + + @Override + public void deleteByMainId(Long mainId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(ReportDocumentMainCorrelationDO::getMainId, mainId); + reportDocumentMainCorrelationMapper.delete(query); + } + @Override public void updateReportDocumentMainCorrelation(ReportDocumentMainCorrelationSaveReqVO updateReqVO) { // 校验存在 diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainServiceImpl.java index 18f57c4..9653f38 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentMainServiceImpl.java @@ -14,6 +14,8 @@ 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.service.BusinessAssayReportDataService; +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; @@ -22,6 +24,7 @@ import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMa import com.zt.plat.module.qms.enums.QmsBpmConstant; import com.zt.plat.module.qms.enums.QmsCommonConstant; import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; @@ -46,6 +49,7 @@ import static com.zt.plat.module.qms.enums.QmsBpmConstant.BPM_CALLBACK_BEAN_NAME */ @Service("reportDocumentMainService") @Validated +@Slf4j public class ReportDocumentMainServiceImpl implements ReportDocumentMainService, BMPCallbackInterface { @Resource private ReportDocumentMainMapper reportDocumentMainMapper; @@ -53,6 +57,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService, @Resource private ReportDocumentDataService reportDocumentDataService; @Resource private BpmProcessInstanceApi bpmProcessInstanceApi; @Resource private ReportDocumentMainCorrelationService reportDocumentMainCorrelationService; + @Resource private ConfigUserSignatureService configUserSignatureService; /*** * 增加报表数据(按样品) * 传入:报告id、 报表数据ids @@ -83,7 +88,13 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService, } if(isExist) return error(REPORT_DOCUMENT_DATA_NOT_EXISTS.getCode(), "报表数据已在本报告使用,请勿重复添加"); - List assayReportDataList = businessAssayReportDataService.listByIds(addReportDataIdList); +// List assayReportDataList = businessAssayReportDataService.listByIds(addReportDataIdList); + BusinessAssayReportDataPageReqVO reportDataQueryVo = new BusinessAssayReportDataPageReqVO(); + reportDataQueryVo.setIdList(addReportDataIdList); + reportDataQueryVo.setPageNo(1); + reportDataQueryVo.setPageSize(9999); + PageResult assayReportPage = businessAssayReportDataService.queryWaitingDataForReport( reportDataQueryVo); + List assayReportDataList = assayReportPage.getList(); return execAddByBusinessAssayReportData(assayReportDataList, id); } @@ -208,11 +219,15 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService, } @Override + @Transactional(rollbackFor = Exception.class) public void deleteReportDocumentMain(Long id) { // 校验存在 validateReportDocumentMainExists(id); // 删除 reportDocumentMainMapper.deleteById(id); + //删除关联表 + reportDocumentMainCorrelationService.deleteByMainId(id); + reportDocumentDataService.deleteByMainId(id); } @Override @@ -288,24 +303,58 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService, @Transactional(rollbackFor = Exception.class) public CommonResult callback(QmsBpmDTO reqDTO) { JSONObject variables = reqDTO.getVariables(); - //流程状态 3-拒绝 1-通过 2-完成 + + //流程状态 3-拒绝 1-通过 2-完成 4-取消流程 String PROCESS_STATUS = variables.getString(QmsBpmConstant.PROCESS_INSTANCE_VARIABLE_STATUS); String mainId = variables.getString("mainId"); ReportDocumentMainDO entity = getReportDocumentMain(Long.valueOf(mainId)); - if("3".equals(PROCESS_STATUS)){ - //终止 - entity.setFlowStatus(QmsCommonConstant.REJECT); + log.error("流程回调:{}", JSONObject.toJSONString(reqDTO)); + String currentActivityId = variables.getString(QmsBpmConstant.BPM_CALLBACK_ACTIVITY_ID); + String RETURN_FLAG_PREFIX_KEY = variables.getString(QmsBpmConstant.BPM_CALLBACK_RETURN_FLAG_PREFIX_KEY); + String returnFlagKey = RETURN_FLAG_PREFIX_KEY + "Activity_001"; +// if("3".equals(PROCESS_STATUS)){ + //"RETURN_FLAG_Activity_001": true 标识驳回到发起环节 + if(variables.containsKey(returnFlagKey) && variables.getString(returnFlagKey).equals("true")){ + //拒绝(重制) + entity.setFlowStatus(QmsCommonConstant.REJECTED); + entity.setDocumentSignature(""); } - if("2".equals(PROCESS_STATUS)){ + else if("2".equals(PROCESS_STATUS)){ //完成 entity.setFlowStatus(QmsCommonConstant.COMPLETED); + assembleSignature(currentActivityId, entity); + } + else if("4".equals(PROCESS_STATUS)){ + //作废 + entity.setFlowStatus(QmsCommonConstant.VOID); + entity.setDocumentSignature(""); + }else if("1".equals(PROCESS_STATUS)){ + entity.setDocumentSignature(""); } - //todo 处理意见和签名 - reportDocumentMainMapper.updateById(entity); JSONObject ret = new JSONObject(); - - return CommonResult.success(ret); } + + private void assembleSignature(String currentActivityId, ReportDocumentMainDO entity){ + String sign = entity.getDocumentSignature(); + JSONObject signObj = new JSONObject(); + if(!ObjectUtils.isEmpty( sign)) + signObj = JSONObject.parseObject(sign); + if(!signObj.containsKey(currentActivityId)) + return; + JSONObject obj = new JSONObject(); + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + Long userId = loginUser.getId(); + //当前登录用户昵称 + String nickName = SecurityFrameworkUtils.getLoginUserNickname(); + ConfigUserSignatureDO configUserSignatureDO = configUserSignatureService.getByUserId(userId); + if(configUserSignatureDO != null) + obj.put("fileId", configUserSignatureDO.getFileId()); + obj.put("userId", userId); + obj.put("userName", nickName); + signObj.put(currentActivityId, obj); + entity.setDocumentSignature(signObj.toJSONString()); + } + } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/common/data/controller/admin/DataTemplateController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/common/data/controller/admin/DataTemplateController.java index 1473209..b73ef47 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/common/data/controller/admin/DataTemplateController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/common/data/controller/admin/DataTemplateController.java @@ -106,7 +106,7 @@ public class DataTemplateController implements BusinessControllerMarker { @GetMapping("/get") @Operation(summary = "获得表单设计器模板") @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('qms:data-template:query')") +// @PreAuthorize("@ss.hasPermission('qms:data-template:query')") public CommonResult getDataTemplate(@RequestParam("id") Long id) { DataTemplateDO dataTemplate = dataTemplateService.getDataTemplate(id); return success(BeanUtils.toBean(dataTemplate, DataTemplateRespVO.class)); diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayReportDataMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayReportDataMapper.xml index 69d4a66..244a778 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayReportDataMapper.xml +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayReportDataMapper.xml @@ -35,6 +35,13 @@ FROM T_BSN_ASY_RPT_DAT d inner join T_BSN_BSE_SMP s on d.BSN_BSE_SMP_ID = s.id + + and d.id in ( + + #{item} + + ) + and d.CFG_RPT_TP_ID = #{param.configReportTypeId} and NOT EXISTS ( @@ -43,6 +50,7 @@ LEFT JOIN T_RPT_DOC_MAIN m on rd.MAIN_ID = m.ID WHERE rd.SRC_ID = d.id and m.RPT_DOC_TP = #{param.configReportTypeId} + and m.FLW_STS in ('not_start','in_progress','completed','rejected') ); diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSampleEntrustRegistrationMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSampleEntrustRegistrationMapper.xml index 77fae2d..1d7922a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSampleEntrustRegistrationMapper.xml +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessSampleEntrustRegistrationMapper.xml @@ -63,7 +63,7 @@ and NOT EXISTS ( select 1 from T_RPT_DOC_MAIN dm left join T_RPT_DOC_MAIN_CORR dc on dm.id = dc.MAIN_ID - where dc.CORR_ID = m.id and dm.deleted = 0 + where dc.CORR_ID = m.id and dm.FLW_STS in ('not_start','in_progress','completed','rejected') and dm.deleted = 0 ) and m.ENTT_TP = #{param.entrustType} diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigUserSignatureMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigUserSignatureMapper.xml new file mode 100644 index 0000000..017f99d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/business/config/dal/mapper/ConfigUserSignatureMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file