Browse Source

质量问题反馈流程修改

wangliang 1 year ago
parent
commit
40916d10c9

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/activiti/service/ActivitiService.java

@@ -132,5 +132,5 @@ public interface ActivitiService {
      * @param task
      * @return
      */
-    public List<Long> getTaskApprove(Task task);
+    public List<String> getTaskApprove(Task task);
 }

+ 4 - 4
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -745,15 +745,15 @@ public class ActivitiServiceImpl implements ActivitiService {
      * @return
      */
     @Override
-    public List<Long> getTaskApprove(Task task) {
-        List<Long> taskApproveUserList = new ArrayList<>();
+    public List<String> getTaskApprove(Task task) {
+        List<String> taskApproveUserList = new ArrayList<>();
         if (Objects.nonNull(task.getAssignee())) {
-            taskApproveUserList.add(Long.parseLong(task.getAssignee()));
+            taskApproveUserList.add(task.getAssignee());
         } else {
             List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
             if (!CollectionUtils.isEmpty(identityLinkList)) {
                 for (IdentityLink i : identityLinkList) {
-                    taskApproveUserList.add(Long.parseLong(i.getUserId()));
+                    taskApproveUserList.add(i.getUserId());
                 }
             }
         }

+ 2 - 7
sop-business/src/main/java/com/qmth/sop/business/entity/TBQualityProblemApply.java

@@ -11,8 +11,6 @@ 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;
@@ -49,11 +47,9 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
     private Long serviceId;
 
     @ApiModelProperty(value = "问题简要")
-    @NotBlank(message = "问题简要不能为空")
     private String summary;
 
     @ApiModelProperty(value = "问题情况说明")
-    @NotBlank(message = "问题情况说明不能为空")
     private String remark;
 
     @ApiModelProperty(value = "责任人id")
@@ -91,6 +87,7 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
 
     @TableField(exist = false)
     @ApiModelProperty(value = "流程表单")
+    @NotNull(message = "流程表单数据不能为空")
     private String formProperties;
 
     @ApiModelProperty(value = "流程审批")
@@ -113,13 +110,11 @@ public class TBQualityProblemApply extends BaseEntity implements Serializable {
         this.attachmentIds = attachmentIds;
     }
 
-    public void setCode(String problemNo, List<Long> attachmentIdList, List<Long> userIdList, Long userId) {
+    public void setCode(String problemNo, 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 FlowApprovePassEnum getFlowApprove() {

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

@@ -18,7 +18,10 @@ import com.qmth.sop.business.service.TBDingService;
 import com.qmth.sop.business.service.TFCustomFlowEntityService;
 import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.*;
+import com.qmth.sop.common.enums.DingExceptionApproveEnum;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.FlowApprovePassEnum;
+import com.qmth.sop.common.enums.InOutTypeEnum;
 import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.Task;
@@ -76,7 +79,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         List<String> approveUserIds = new ArrayList<>();
         approveUserIds.add("431777963202052096");
         FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, approveUserIds, tbDing.getCrmNo());
-        flowApproveParam.setApproveRemark(FlowApproveOperationEnum.START.getTitle());
+        flowApproveParam.setApproveRemark(FlowApprovePassEnum.START.getTitle());
         Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
         TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
         tbDingApply.setCode(tfCustomFlowEntity.getCode(), tbDingApply.getAttachmentIdList(), sysUser.getId());
@@ -235,9 +238,18 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
      */
     @Override
     public Boolean taskApprove(Long taskId, Long userId, DingExceptionApproveEnum dingExceptionApprove) throws InterruptedException {
+        if (Objects.isNull(taskId)) {
+            throw ExceptionResultEnum.FLOW_TASK_ID_IS_NULL.exception();
+        }
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
         Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
 
+        List<String> taskApproveUserList = activitiService.getTaskApprove(task);
+        if (!CollectionUtils.isEmpty(taskApproveUserList) && !taskApproveUserList.contains(sysUser.getId().toString())) {
+            throw ExceptionResultEnum.FLOW_DATA_NOT_ME.exception();
+        }
+
         TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
         Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
 

File diff suppressed because it is too large
+ 17 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java


+ 12 - 5
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -185,7 +185,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         }
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         FlowTaskResult flowTaskResult = JSONObject.parseObject(sopApplyParam.getFormProperties(), FlowTaskResult.class);
-        Map<String,Object> mapVar = this.getApproveUserIds(flowTaskResult);
+        Map<String, Object> mapVar = this.getApproveUserIds(flowTaskResult);
         Long regionUserId = (Long) mapVar.get(SystemConstant.REGION_USER_ID);
         Long engineerUserId = (Long) mapVar.get(SystemConstant.ENGINEER_USER_ID);
         String assistantEngineerUserIds = (String) mapVar.get(SystemConstant.ASSISTANT_ENGINEER_USER_ID);
@@ -214,17 +214,23 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     @Transactional
     public Boolean sopApprove(FlowApproveParam flowApproveParam) throws InterruptedException {
         if (Objects.isNull(flowApproveParam.getTaskId())) {
-            throw ExceptionResultEnum.PARAMS_ERROR.exception("流程节点id不能为空");
+            throw ExceptionResultEnum.FLOW_TASK_ID_IS_NULL.exception();
         }
         if (flowApproveParam.getApprove() != FlowApprovePassEnum.PASS && flowApproveParam.getApprove() != FlowApprovePassEnum.REJECT && flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("sop填报只能为通过或驳回或草稿");
         }
+        if (Objects.isNull(flowApproveParam.getFormProperties())) {
+            throw ExceptionResultEnum.FLOW_FORM_PROPERTIES_IS_NULL.exception();
+        }
+        if (flowApproveParam.getApprove() == FlowApprovePassEnum.REJECT && Objects.isNull(flowApproveParam.getSetup())) {
+            throw ExceptionResultEnum.FLOW_REJECT_SETUP_IS_NULL.exception();
+        }
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Task task = taskService.createTaskQuery().taskId(String.valueOf(flowApproveParam.getTaskId())).singleResult();
         Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
 
-        List<Long> taskApproveUserList = activitiService.getTaskApprove(task);
-        if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT && !CollectionUtils.isEmpty(taskApproveUserList) && !taskApproveUserList.contains(sysUser.getId())) {
+        List<String> taskApproveUserList = activitiService.getTaskApprove(task);
+        if (flowApproveParam.getApprove() != FlowApprovePassEnum.DRAFT && !CollectionUtils.isEmpty(taskApproveUserList) && !taskApproveUserList.contains(sysUser.getId().toString())) {
             throw ExceptionResultEnum.ERROR.exception("不能审批他人的sop数据");
         }
 
@@ -251,7 +257,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                     .set(TBSopInfoDetail::getAssistantEngineerUserIds, assistantEngineerUserIds);
             tbSopInfoDetailService.update(updateWrapper);
         } else {
-            engineerUserId = taskApproveUserList.get(0);
+            engineerUserId = Long.parseLong(taskApproveUserList.get(0));
         }
         List<String> approveUserIds = Objects.nonNull(engineerUserId) ? Arrays.asList(String.valueOf(engineerUserId)) : Arrays.asList(String.valueOf(sysUser.getId()));
         flowApproveParam.setApproveUserIds(approveUserIds);
@@ -275,6 +281,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
      * 获取审批人
      *
      * @param flowTaskResult
+     * @return
      */
     public Map<String, Object> getApproveUserIds(FlowTaskResult flowTaskResult) {
         Map<String, Object> map = new HashMap<>();

+ 2 - 2
sop-business/src/main/resources/mapper/SysUserMapper.xml

@@ -8,7 +8,7 @@
 
     <sql id="flowTaskListCommonSql">
         (select
-        cast(art.ASSIGNEE_ as Decimal(24)) as userId,
+        distinct cast(art.ASSIGNEE_ as Decimal(24)) as userId,
         tfcf.type,
         tfcfe.code,
         tffa.status,
@@ -67,7 +67,7 @@
         </where>
         UNION ALL
         select
-        cast(ari.USER_ID_ as Decimal(24)) as userId,
+        distinct cast(ari.USER_ID_ as Decimal(24)) as userId,
         tfcf.type,
         tfcfe.code,
         tffa.status,

+ 7 - 6
sop-business/src/main/resources/mapper/TBDingApplyMapper.xml

@@ -4,7 +4,7 @@
 
     <select id="flowTaskUnDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyUnDoneResult">
         select
-            cast(art.ASSIGNEE_ as Decimal(24)) as userId,
+            distinct cast(art.ASSIGNEE_ as Decimal(24)) as userId,
             tfcf.type,
             tfcfe.code,
             tffa.status,
@@ -53,8 +53,8 @@
                  left join sys_supplier ss on ss.id = tbuas.supplier_id
                  left join sys_user su1 ON cast(art.ASSIGNEE_ as Decimal(24)) = su1.id
                  left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
-        <where>
-            EXISTS(
+        <where> 1 = 1
+            and EXISTS(
                     select t.* from(select cast(art.PROC_INST_ID_ as Decimal(24)) as flowId
                                   from
                                       ACT_RU_TASK art
@@ -81,6 +81,7 @@
                                         </foreach>
                                     </if>
                                     and ari.TYPE_ = 'candidate') t where t.flowId = art.PROC_INST_ID_)
+                and tfcf.type = 'DING_EXCEPTION_FLOW'
             <if test="serviceId != null and serviceId != ''">
                 and tbs.id = #{serviceId}
             </if>
@@ -104,7 +105,7 @@
 
     <select id="flowTaskDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyDoneResult">
         select t.* from(select
-            tfcf.type,
+            distinct tfcf.type,
             tfcfe.code,
             tffa.status,
             tffa.setup,
@@ -149,8 +150,8 @@
             left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
             left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
             left join sys_supplier ss on ss.id = tbuas.supplier_id
-        where
-            (tffa.status = 'AUDITING' or tffa.status = 'REJECT' or tffa.status = 'FINISH')
+        where 1 = 1 and tfcf.type = 'DING_EXCEPTION_FLOW'
+          and (tffa.status = 'AUDITING' or tffa.status = 'REJECT' or tffa.status = 'FINISH')
           and EXISTS (
             select * from(select
             distinct aht.PROC_INST_ID_

+ 9 - 1
sop-common/src/main/java/com/qmth/sop/common/enums/ExceptionResultEnum.java

@@ -81,7 +81,15 @@ public enum ExceptionResultEnum {
 
     SOP_INFO_NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000027, "没有sop数据"),
 
-    QUALITY_PROBLEM_APPLY_NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000027, "没有质量问题反馈申请数据"),
+    QUALITY_PROBLEM_APPLY_NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000028, "没有质量问题反馈申请数据"),
+
+    FLOW_DATA_NOT_ME(HttpStatus.INTERNAL_SERVER_ERROR, 5000029, "不能审批他人的流程数据"),
+
+    FLOW_TASK_ID_IS_NULL(HttpStatus.INTERNAL_SERVER_ERROR, 5000030, "流程节点id不能为空"),
+
+    FLOW_FORM_PROPERTIES_IS_NULL(HttpStatus.INTERNAL_SERVER_ERROR, 5000031, "流程表单数据不能为空"),
+
+    FLOW_REJECT_SETUP_IS_NULL(HttpStatus.INTERNAL_SERVER_ERROR, 5000032, "驳回步骤未填写"),
 
     /**
      * 401

+ 1 - 1
sop-server/src/main/java/com/qmth/sop/server/api/TBQualityProblemApplyController.java

@@ -69,7 +69,7 @@ public class TBQualityProblemApplyController {
     @ApiOperation(value = "质量问题反馈表审核接口")
     @RequestMapping(value = "/approve", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result submit(@Valid @ApiParam(value = "sop填报信息", required = true) @RequestBody FlowApproveParam flowApproveParam, BindingResult bindingResult) throws InterruptedException {
+    public Result submit(@Valid @ApiParam(value = "质量问题反馈审核信息", required = true) @RequestBody FlowApproveParam flowApproveParam, BindingResult bindingResult) throws InterruptedException {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }

BIN
sop-server/src/main/resources/qualityProblemFlow.zip


File diff suppressed because it is too large
+ 0 - 0
sop-server/src/main/resources/qualityProblemFlow/quality_problem_approve.form


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