Преглед изворни кода

新增考前异常流程申请

wangliang пре 1 година
родитељ
комит
06783ddf3f

+ 62 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/AttachmentResult.java

@@ -0,0 +1,62 @@
+package com.qmth.sop.business.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 附件result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2023/8/15
+ */
+public class AttachmentResult implements Serializable {
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "附件url")
+    String url;
+
+    @ApiModelProperty(value = "预览url")
+    String previewUrl;
+
+    public AttachmentResult() {
+
+    }
+
+    public AttachmentResult(Long id, String previewUrl, String url) {
+        this.id = id;
+        this.previewUrl = previewUrl;
+        this.url = url;
+    }
+
+    public String getPreviewUrl() {
+        return previewUrl;
+    }
+
+    public void setPreviewUrl(String previewUrl) {
+        this.previewUrl = previewUrl;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+}

+ 19 - 3
sop-business/src/main/java/com/qmth/sop/business/entity/TBDingApply.java

@@ -7,10 +7,12 @@ import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.InOutTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
 
-import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -47,9 +49,14 @@ public class TBDingApply implements Serializable {
     private String reason;
 
     @ApiModelProperty(value = "附件id")
-    @NotBlank(message = "补卡附件不能为空")
     private String attachmentIds;
 
+    @ApiModelProperty(value = "附件id数组")
+    @TableField(exist = false)
+    @JsonSerialize(using = ToStringSerializer.class)
+    @NotEmpty(message = "补卡附件不能为空")
+    private List<Long> attachmentIdList;
+
     @ApiModelProperty(value = "考勤异常编号")
     @JsonSerialize(using = ToStringSerializer.class)
     private String dingExceptionNo;
@@ -66,11 +73,20 @@ public class TBDingApply implements Serializable {
     @NotNull(message = "流程部署id不能为空")
     private String flowDeploymentId;
 
-    public void setCode(String dingExceptionNo, Long userId) {
+    public void setCode(String dingExceptionNo, List<Long> attachmentIdList, Long userId) {
         this.dingExceptionNo = dingExceptionNo;
         setId(SystemConstant.getDbUuid());
         setCreateId(userId);
         setCreateTime(System.currentTimeMillis());
+        this.attachmentIds = StringUtils.join(attachmentIdList, SystemConstant.LIST_JOIN_SPLIT);
+    }
+
+    public List<Long> getAttachmentIdList() {
+        return attachmentIdList;
+    }
+
+    public void setAttachmentIdList(List<Long> attachmentIdList) {
+        this.attachmentIdList = attachmentIdList;
     }
 
     public String getFlowDeploymentId() {

+ 32 - 1
sop-business/src/main/java/com/qmth/sop/business/entity/TBQualityProblemApply.java

@@ -10,10 +10,13 @@ import com.qmth.sop.common.enums.QualityProblemReasonEnum;
 import com.qmth.sop.common.enums.QualityProblemTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -56,6 +59,11 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private String userIds;
 
+    @ApiModelProperty(value = "责任人id数组")
+    @TableField(exist = false)
+    @JsonSerialize(using = ToStringSerializer.class)
+    private List<Long> userIdList;
+
     @ApiModelProperty(value = "问题类型,UPDATE:修正类,OPTIMIZE:优化类,NO_PROBLEM:不是问题")
     private QualityProblemTypeEnum type;
 
@@ -66,6 +74,11 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private String attachmentIds;
 
+    @ApiModelProperty(value = "附件id")
+    @TableField(exist = false)
+    @JsonSerialize(using = ToStringSerializer.class)
+    private List<Long> attachmentIdList;
+
     @ApiModelProperty(value = "影响度:A,B,C,D")
     @TableField("Influence_degree")
     private InfluenceDegreeEnum influenceDegree;
@@ -94,11 +107,29 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
         this.attachmentIds = attachmentIds;
     }
 
-    public void setCode(String problemNo, Long userId) {
+    public void setCode(String problemNo, List<Long> attachmentIdList, List<Long> userIdList, Long userId) {
         this.problemNo = problemNo;
         setId(SystemConstant.getDbUuid());
         setCreateId(userId);
         setCreateTime(System.currentTimeMillis());
+        this.attachmentIds = !CollectionUtils.isEmpty(attachmentIdList) ? StringUtils.join(attachmentIdList, SystemConstant.LIST_JOIN_SPLIT) : null;
+        this.userIds = !CollectionUtils.isEmpty(userIdList) ? StringUtils.join(userIdList, SystemConstant.LIST_JOIN_SPLIT) : null;
+    }
+
+    public List<Long> getUserIdList() {
+        return userIdList;
+    }
+
+    public void setUserIdList(List<Long> userIdList) {
+        this.userIdList = userIdList;
+    }
+
+    public List<Long> getAttachmentIdList() {
+        return attachmentIdList;
+    }
+
+    public void setAttachmentIdList(List<Long> attachmentIdList) {
+        this.attachmentIdList = attachmentIdList;
     }
 
     public String getFormProperties() {

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -49,7 +49,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, Arrays.asList(String.valueOf(sysUser.getId()))));
         TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.CUSTOM_FLOW_ENTITY);
-        tbDingApply.setCode(tfCustomFlowEntity.getCode(), sysUser.getId());
+        tbDingApply.setCode(tfCustomFlowEntity.getCode(), tbDingApply.getAttachmentIdList(), sysUser.getId());
         tfCustomFlowEntity.setObjId(tbDingApply.getId());
         tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
         return this.saveOrUpdate(tbDingApply);

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java

@@ -67,7 +67,7 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbQualityProblemApply.getFlowDeploymentId(), FlowApprovePassEnum.START, tbQualityProblemApply.getFormProperties(), Arrays.asList(String.valueOf(sysUser.getId()))));
         TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.CUSTOM_FLOW_ENTITY);
-        tbQualityProblemApply.setCode(tfCustomFlowEntity.getCode(), sysUser.getId());
+        tbQualityProblemApply.setCode(tfCustomFlowEntity.getCode(), tbQualityProblemApply.getAttachmentIdList(), tbQualityProblemApply.getUserIdList(), sysUser.getId());
         tfCustomFlowEntity.setObjId(tbQualityProblemApply.getId());
         tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
         return this.saveOrUpdate(tbQualityProblemApply);

+ 1 - 0
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -90,6 +90,7 @@ public class SystemConstant {
     public static final int MAX_SEQUENCE_CIRCLE_COUNT = 20;
     public static final int SEQUENCE_THREAD_SLEEP = 500;
     public static final String ERROR_METHOD = "method";
+    public static final String LIST_JOIN_SPLIT = ",";
 
     /**
      * 表达式

+ 6 - 2
sop-server/src/main/java/com/qmth/sop/server/api/SysController.java

@@ -1,5 +1,6 @@
 package com.qmth.sop.server.api;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -15,6 +16,7 @@ import com.qmth.sop.business.bean.dto.OrgDtoNotTree;
 import com.qmth.sop.business.bean.dto.RoleDto;
 import com.qmth.sop.business.bean.dto.UserDto;
 import com.qmth.sop.business.bean.params.LoginParam;
+import com.qmth.sop.business.bean.result.AttachmentResult;
 import com.qmth.sop.business.bean.result.EditResult;
 import com.qmth.sop.business.bean.result.LoginResult;
 import com.qmth.sop.business.bean.result.MenuResult;
@@ -154,7 +156,7 @@ public class SysController {
     @ApiOperation(value = "文件上传接口")
     @RequestMapping(value = "/file/upload", method = RequestMethod.POST)
     @Transactional
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = AttachmentResult.class)})
     public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
                              @ApiParam(value = "上传文件类型", required = true) @RequestParam UploadFileEnum type) throws Exception {
         BasicAttachment basicAttachment = null;
@@ -169,7 +171,9 @@ public class SysController {
                 ResultUtil.error(e.getMessage());
             }
         }
-        return ResultUtil.ok(new EditResult(basicAttachment.getId(), basicAttachmentService.filePreview(basicAttachment.getPath())));
+        JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
+        String filePath = (String) jsonObject.get(SystemConstant.PATH);
+        return ResultUtil.ok(new AttachmentResult(basicAttachment.getId(), basicAttachmentService.filePreview(basicAttachment.getPath()), filePath));
     }
 
     @ApiOperation(value = "下载导入模板")