浏览代码

质量问题审核流程修改

wangliang 1 年之前
父节点
当前提交
cebca7eae9

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

@@ -2,6 +2,8 @@ package com.qmth.sop.business.activiti.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.qmth.boot.api.exception.ApiException;
@@ -88,6 +90,9 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Resource
     BasicAttachmentService basicAttachmentService;
 
+    @Resource
+    SysUserService sysUserService;
+
     /**
      * 根据deploymentId查找processDefinitionId
      *
@@ -238,6 +243,7 @@ public class ActivitiServiceImpl implements ActivitiService {
                     if (currSetup != 2 && approve == FlowApprovePassEnum.CANCEL) {
                         throw ExceptionResultEnum.ERROR.exception("只有流程第二步才能撤回!");
                     }
+//                    List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
                     //流程流水日志
                     TFFlowLog tfFlowLog = new TFFlowLog(null, Long.parseLong(task.getAssignee()), null,
                             currFlowTaskResult.getSetup(), Long.parseLong(processFlowId),
@@ -391,24 +397,21 @@ public class ActivitiServiceImpl implements ActivitiService {
     public List<FormPropertyBean> getTaskList(Long userId) {
         Map<String, Object> map = new HashMap<>();
         List<FormPropertyBean> formPropertyList = new LinkedList<>();
-        List<Task> taskList = taskService.createTaskQuery().taskAssignee(String.valueOf(userId)).list();
-        if (!CollectionUtils.isEmpty(taskList)) {
-            for (Task t : taskList) {
-                TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(t.getProcessInstanceId())));
-                Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
-                TFCustomFlow tfCustomFlow = tfCustomFlowService.getById(tfCustomFlowEntity.gettFCustomFlowId());
-                Optional.ofNullable(tfCustomFlow).orElseThrow(() -> ExceptionResultEnum.FLOW_DEPLOYMENT_NO_DATA.exception());
-
-                FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
-                LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
-                for (Task task : taskList) {
-                    FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(setupMap.get(task.getTaskDefinitionKey())), FlowTaskResult.class);
-                    map = this.getFlowFormPropertie(flowResult, map, currFlowTaskResult.getSetup());
+        IPage<WorkTaskResult> workTaskResultIPage = sysUserService.getWorkTaskList(new Page<>(SystemConstant.PAGE_NUMBER_MIN, SystemConstant.PAGE_SIZE_MAX_SELECT), userId);
+        if (Objects.nonNull(workTaskResultIPage) && !CollectionUtils.isEmpty(workTaskResultIPage.getRecords())) {
+            for (WorkTaskResult w : workTaskResultIPage.getRecords()) {
+                List<Task> taskList = taskService.createTaskQuery().taskId(String.valueOf(w.getTaskId())).list();
+                if (!CollectionUtils.isEmpty(taskList)) {
+                    for (Task t : taskList) {
+                        FlowResult flowResult = JSONObject.parseObject(w.getFlowProcessVar(), FlowResult.class);
+                        LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
+                        for (Task task : taskList) {
+                            FlowTaskResult currFlowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(setupMap.get(task.getTaskDefinitionKey())), FlowTaskResult.class);
+                            map = this.getFlowFormPropertie(flowResult, map, currFlowTaskResult.getSetup());
+                        }
+                        formPropertyList.add(new FormPropertyBean(Long.parseLong(t.getProcessInstanceId()), Long.parseLong(t.getId()), userId, (FlowTaskResult) map.get(SystemConstant.FORM_PROPERTIES), w.getStatus(), String.valueOf(w.getCustomFlowEntityid())));
+                    }
                 }
-                TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, Long.parseLong(t.getProcessInstanceId())));
-                Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
-
-                formPropertyList.add(new FormPropertyBean(Long.parseLong(t.getProcessInstanceId()), Long.parseLong(t.getId()), userId, (FlowTaskResult) map.get(SystemConstant.FORM_PROPERTIES), tfFlowApprove.getStatus(), String.valueOf(tfCustomFlowEntity.getId())));
             }
         }
         return formPropertyList;

+ 171 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/WorkTaskResult.java

@@ -0,0 +1,171 @@
+package com.qmth.sop.business.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.enums.FlowStatusEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * @Description: 工作台待办result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2023/8/10
+ */
+public class WorkTaskResult implements Serializable {
+
+    @ApiModelProperty(value = "用户id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long userId;
+
+    @ApiModelProperty(value = "用户姓名")
+    private String userName;
+
+    @ApiModelProperty(value = "流程状态")
+    private FlowStatusEnum status;
+
+    @ApiModelProperty(value = "流程状态str")
+    private String statusStr;
+
+    @ApiModelProperty(value = "流程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long flowId;
+
+    @ApiModelProperty(value = "流程任务节点名称")
+    private String taskName;
+
+    @ApiModelProperty(value = "流程任务节点key")
+    private String taskDefKey;
+
+    @ApiModelProperty(value = "流程任务id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long taskId;
+
+    @ApiModelProperty(value = "流程步骤")
+    private Integer setup;
+
+    @ApiModelProperty(value = "流程过程变量")
+    private String flowProcessVar;
+
+    @ApiModelProperty(value = "流程自定义id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long customFlowId;
+
+    @ApiModelProperty(value = "流程部署id")
+    private String flowDeploymentId;
+
+    @ApiModelProperty(value = "流程实体id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long customFlowEntityid;
+
+    public Long getCustomFlowEntityid() {
+        return customFlowEntityid;
+    }
+
+    public void setCustomFlowEntityid(Long customFlowEntityid) {
+        this.customFlowEntityid = customFlowEntityid;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public FlowStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(FlowStatusEnum status) {
+        this.status = status;
+    }
+
+    public String getStatusStr() {
+        if (Objects.nonNull(status)) {
+            return status.getTitle();
+        } else {
+            return statusStr;
+        }
+    }
+
+    public void setStatusStr(String statusStr) {
+        this.statusStr = statusStr;
+    }
+
+    public Long getFlowId() {
+        return flowId;
+    }
+
+    public void setFlowId(Long flowId) {
+        this.flowId = flowId;
+    }
+
+    public String getTaskName() {
+        return taskName;
+    }
+
+    public void setTaskName(String taskName) {
+        this.taskName = taskName;
+    }
+
+    public String getTaskDefKey() {
+        return taskDefKey;
+    }
+
+    public void setTaskDefKey(String taskDefKey) {
+        this.taskDefKey = taskDefKey;
+    }
+
+    public Long getTaskId() {
+        return taskId;
+    }
+
+    public void setTaskId(Long taskId) {
+        this.taskId = taskId;
+    }
+
+    public Integer getSetup() {
+        return setup;
+    }
+
+    public void setSetup(Integer setup) {
+        this.setup = setup;
+    }
+
+    public String getFlowProcessVar() {
+        return flowProcessVar;
+    }
+
+    public void setFlowProcessVar(String flowProcessVar) {
+        this.flowProcessVar = flowProcessVar;
+    }
+
+    public Long getCustomFlowId() {
+        return customFlowId;
+    }
+
+    public void setCustomFlowId(Long customFlowId) {
+        this.customFlowId = customFlowId;
+    }
+
+    public String getFlowDeploymentId() {
+        return flowDeploymentId;
+    }
+
+    public void setFlowDeploymentId(String flowDeploymentId) {
+        this.flowDeploymentId = flowDeploymentId;
+    }
+}

+ 10 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/SysUserMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.sop.business.bean.dto.UserDto;
 import com.qmth.sop.business.bean.dto.VerifyCodeCheckDto;
+import com.qmth.sop.business.bean.result.WorkTaskResult;
 import com.qmth.sop.business.bean.result.SysUserResult;
 import com.qmth.sop.business.bean.result.UserRoleNameResult;
 import com.qmth.sop.business.entity.SysUser;
@@ -30,6 +31,15 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      */
     String findProcessDefinitionIdByDeploymentId(@Param("deploymentId") String deploymentId);
 
+    /**
+     * 获取工作台待办
+     *
+     * @param iPage
+     * @param userId
+     * @return
+     */
+    IPage<WorkTaskResult> getWorkTaskList(IPage<Map> iPage, @Param("userId") Long userId);
+
     /**
      * 根据机构id查询用户
      *

+ 10 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysUserService.java

@@ -6,6 +6,7 @@ import com.qmth.sop.business.bean.dto.UserDto;
 import com.qmth.sop.business.bean.result.LoginResult;
 import com.qmth.sop.business.bean.result.SysUserResult;
 import com.qmth.sop.business.bean.result.UserRoleNameResult;
+import com.qmth.sop.business.bean.result.WorkTaskResult;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.common.enums.AppSourceEnum;
 
@@ -120,4 +121,13 @@ public interface SysUserService extends IService<SysUser> {
      * @return
      */
     Boolean updatePassword(SysUser sysUser) throws NoSuchAlgorithmException;
+
+    /**
+     * 获取工作台待办
+     *
+     * @param iPage
+     * @param userId
+     * @return
+     */
+    IPage<WorkTaskResult> getWorkTaskList(IPage<Map> iPage, Long userId);
 }

+ 13 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserServiceImpl.java

@@ -13,6 +13,7 @@ import com.qmth.sop.business.bean.dto.VerifyCodeCheckDto;
 import com.qmth.sop.business.bean.result.LoginResult;
 import com.qmth.sop.business.bean.result.SysUserResult;
 import com.qmth.sop.business.bean.result.UserRoleNameResult;
+import com.qmth.sop.business.bean.result.WorkTaskResult;
 import com.qmth.sop.business.cache.CommonCacheService;
 import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.mapper.SysUserMapper;
@@ -438,4 +439,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         }
         return success;
     }
+
+    /**
+     * 获取工作台待办
+     *
+     * @param iPage
+     * @param userId
+     * @return
+     */
+    @Override
+    public IPage<WorkTaskResult> getWorkTaskList(IPage<Map> iPage, Long userId) {
+        return this.baseMapper.getWorkTaskList(iPage, userId);
+    }
 }

+ 3 - 2
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -147,14 +147,15 @@ CREATE TABLE `sys_custom_role` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户角色配置表';
 -------------------------------
 ---2023.8.10 考勤统计
+DROP TABLE IF EXISTS `sys_ding_date`;
 CREATE TABLE `sys_ding_date` (
                                  `id` bigint NOT NULL COMMENT '主键',
                                  `year` bigint NOT NULL COMMENT '年',
                                  `month` bigint NOT NULL COMMENT '月',
                                  `day` bigint NOT NULL COMMENT '日',
-                                 `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '日期类型:WEEKDAY("工作日"),WEEKEND("周末"),LEGAL_HOLIDAYS("法定节假日")',
+                                 `type` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '日期类型:WEEKDAY("工作日"),WEEKEND("周末"),LEGAL_HOLIDAYS("法定节假日")',
                                  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4 COMMENT='考勤特殊日期';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考勤特殊日期';
 INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (1, 2023, 9, 29, 'LEGAL_HOLIDAYS');
 INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (2, 2023, 9, 30, 'LEGAL_HOLIDAYS');
 INSERT INTO `sys_ding_date` (`id`, `year`, `month`, `day`, `type`) VALUES (3, 2023, 10, 1, 'LEGAL_HOLIDAYS');

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

@@ -6,6 +6,57 @@
         select ARP.ID_ from ACT_RE_PROCDEF ARP where ARP.DEPLOYMENT_ID_ = #{deploymentId}
     </select>
 
+    <select id="getWorkTaskList" resultType="com.qmth.sop.business.bean.result.WorkTaskResult">
+        select
+            t.*
+        from
+            (select
+                    cast(art.ASSIGNEE_ as Decimal(24)) as userId,
+                    c.real_name userName,
+                    tffa.status,
+                    art.PROC_INST_ID_ as flowId,
+                    art.NAME_ as taskName,
+                    art.TASK_DEF_KEY_ as taskDefKey,
+                    art.ID_ as taskId,
+                    tffa.setup,
+                    tfcfe.flow_process_var as flowProcessVar,
+                    tfcfe.t_f_custom_flow_id as customFlowId,
+                    tfcf.flow_deployment_id as flowDeploymentId,
+                    tfcfe.id as customFlowEntityid
+                from
+                    ACT_RU_TASK art
+                        left join t_f_flow_approve tffa on tffa.flow_id = tffa.flow_id
+                        left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
+                        left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
+                        left join sys_user c ON art.ASSIGNEE_ = c.id
+                where art.ASSIGNEE_ = cast(#{userId} as char)
+                UNION all
+                select
+                    cast(ari.USER_ID_ as Decimal(24)) as userId,
+                    c.real_name userName,
+                    tffa.status,
+                    art.PROC_INST_ID_ as flowId,
+                    art.NAME_ as taskName,
+                    art.TASK_DEF_KEY_ as taskDefKey,
+                    art.ID_ as taskId,
+                    tffa.setup,
+                    tfcfe.flow_process_var as flowProcessVar,
+                    tfcfe.t_f_custom_flow_id as customFlowId,
+                    tfcf.flow_deployment_id as flowDeploymentId,
+                    tfcfe.id as customFlowEntityid
+                from
+                    ACT_RU_TASK art
+                        left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
+                        left join t_f_flow_approve tffa on tffa.flow_id = art.PROC_INST_ID_
+                        left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
+                        left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
+                        left join sys_user c ON ari.USER_ID_ = c.id
+                where
+                    art.ASSIGNEE_ is null
+                  and ari.USER_ID_ = cast(#{userId} as char)
+                  and ari.TYPE_ = 'candidate') t
+    </select>
+
     <select id="findSysUserResultList" resultType="com.qmth.sop.business.bean.result.SysUserResult">
         select
         su.id as id,

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

@@ -1,14 +1,12 @@
 package com.qmth.sop.common.contant;
 
 import com.aventrix.jnanoid.jnanoid.NanoIdUtils;
-import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.core.uid.service.UidService;
 import com.qmth.sop.common.enums.ExceptionResultEnum;
 import com.qmth.sop.common.enums.UploadFileEnum;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 import java.io.File;
 import java.io.IOException;
@@ -119,7 +117,7 @@ public class SystemConstant {
      * api前缀
      */
     public static final String PREFIX_URL_WIDGET = "/admin/widget";
-    public static final String PREFIX_TEST_FLOW = "/test/flow";
+    public static final String PREFIX_FLOW = "/admin/flow";
     public static final String PREFIX_URL_COMMON = "/admin/common";
     public static final String PREFIX_URL_USER = "/admin/user";
     public static final String PREFIX_URL_USER_ARCHIVES = "/admin/user/archives";

+ 0 - 123
sop-server/src/main/java/com/qmth/sop/server/api/ActivitiFromHtmlController.java

@@ -1,123 +0,0 @@
-package com.qmth.sop.server.api;
-
-import com.qmth.sop.business.activiti.service.ActivitiService;
-import com.qmth.sop.business.bean.bean.FormPropertyBean;
-import com.qmth.sop.business.bean.result.FlowViewResult;
-import com.qmth.sop.business.entity.TFCustomFlow;
-import com.qmth.sop.business.service.TFCustomFlowService;
-import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.FlowApprovePassEnum;
-import com.qmth.sop.common.enums.TFCustomTypeEnum;
-import com.qmth.sop.common.util.Result;
-import com.qmth.sop.common.util.ResultUtil;
-import io.swagger.annotations.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.util.*;
-
-@Api(tags = "测试流程表单htmlController")
-@RestController
-@RequestMapping(SystemConstant.PREFIX_TEST_FLOW)
-public class ActivitiFromHtmlController {
-    private final static Logger log = LoggerFactory.getLogger(ActivitiFromHtmlController.class);
-
-    @Resource
-    ActivitiService activitiService;
-
-    @Resource
-    TFCustomFlowService tfCustomFlowService;
-
-    @ApiOperation(value = "创建流程接口")
-    @RequestMapping(value = "/createDeployment", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result createDeployment() throws IOException {
-        return ResultUtil.ok(activitiService.createDeployment(Arrays.asList(TFCustomTypeEnum.OFFICE_SOP_FLOW, TFCustomTypeEnum.DING_EXCEPTION_FLOW, TFCustomTypeEnum.PROJECT_EXCHANGE_FLOW, TFCustomTypeEnum.QUALITY_PROBLEM_FLOW)));
-//        return ResultUtil.ok(activitiService.createDeployment(Arrays.asList(TFCustomTypeEnum.QUALITY_PROBLEM_FLOW)));
-    }
-
-    @ApiOperation(value = "上传流程接口")
-    @RequestMapping(value = "/upload", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result upload(@ApiParam(required = true, value = "上传文件") @RequestParam MultipartFile file) throws IOException {
-        return ResultUtil.ok(activitiService.upload(file));
-    }
-
-    @ApiOperation(value = "获取流程部署信息")
-    @RequestMapping(value = "/deployment/data", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TFCustomFlow.class)})
-    public Result getDeploymentData() {
-        return ResultUtil.ok(tfCustomFlowService.findFlowDeploymentList());
-    }
-
-    @ApiOperation(value = "获取流程表单属性接口")
-    @RequestMapping(value = "/form_properties/get", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result formPropertiesGet(@ApiParam(value = "流程部署id") @RequestParam(required = false) String flowDeploymentId,
-                                    @ApiParam(value = "流程id") @RequestParam(required = false) String flowId,
-                                    @ApiParam(value = "流程任务id") @RequestParam(required = false) String taskId) {
-        return ResultUtil.ok(activitiService.formPropertiesGet(flowDeploymentId, Objects.nonNull(flowId) ? Long.parseLong(flowId) : null, Objects.nonNull(taskId) ? Long.parseLong(taskId) : null));
-    }
-
-    @ApiOperation(value = "流程审批接口")
-    @RequestMapping(value = "/approve", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result approve(@ApiParam(value = "流程部署id") @RequestParam(required = false) String flowDeploymentId,
-                          @ApiParam(value = "流程操作", required = true) @RequestParam FlowApprovePassEnum approve,
-                          @ApiParam(value = "流程任务id") @RequestParam(required = false) String taskId,
-                          @ApiParam(value = "流程表单数据") @RequestParam(required = false) String formProperties,
-                          @ApiParam(value = "流程审批人") @RequestParam(required = false) List<String> approveUserIds,
-                          @ApiParam(value = "流程审批意见") @RequestParam(required = false) String approveRemark,
-//                                         @ApiParam(value = "上传文件") @RequestParam(required = false) MultipartFile file,
-                          HttpServletRequest request) {
-        Map<String, Object> map = new HashMap<>();
-        Map<String, String> formDataMap = new HashMap<>();
-        Map<String, String[]> parameterMap = request.getParameterMap();
-        Set<Map.Entry<String, String[]>> entrySet = parameterMap.entrySet();
-        for (Map.Entry<String, String[]> entry : entrySet) {
-            String key = entry.getKey();
-            String[] value = entry.getValue();
-            formDataMap.put(key, value[0]);
-        }
-        map.putAll(formDataMap);
-        activitiService.taskApprove(flowDeploymentId, approve, Objects.nonNull(taskId) ? Long.parseLong(taskId) : null, formProperties, approveUserIds, approveRemark, map);
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "获取待办接口")
-    @RequestMapping(value = "/getTaskList", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = FormPropertyBean.class)})
-    public Result getTaskList(@ApiParam(value = "用户id", required = true) @RequestParam String userId) {
-        return ResultUtil.ok(activitiService.getTaskList(Long.parseLong(userId)));
-    }
-
-    @ApiOperation(value = "结束流程接口")
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result delete(@ApiParam(value = "流程id", required = true) String flowId) {
-        return ResultUtil.ok(activitiService.flowEnd(Long.parseLong(flowId)));
-    }
-
-    @ApiOperation(value = "流程转办接口")
-    @RequestMapping(value = "/task/approver/exchange", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
-    public Result taskApproverExchange(@ApiParam(value = "用户id", required = true) String userId,
-                                       @ApiParam(value = "用户id", required = true) String taskId) {
-        return ResultUtil.ok(activitiService.taskApproverExchange(Long.parseLong(userId), Long.parseLong(taskId)));
-    }
-
-    @ApiOperation(value = "获取流程详细信息接口")
-    @RequestMapping(value = "/view", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = FlowViewResult.class)})
-    public Result flowView(@ApiParam(value = "用户id", required = true) String flowId) {
-        return ResultUtil.ok(activitiService.flowView(Long.parseLong(flowId)));
-    }
-}

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

@@ -1,8 +1,30 @@
 package com.qmth.sop.server.api;
 
 
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.activiti.service.ActivitiService;
+import com.qmth.sop.business.bean.bean.FormPropertyBean;
+import com.qmth.sop.business.bean.result.FlowViewResult;
+import com.qmth.sop.business.entity.TFCustomFlow;
+import com.qmth.sop.business.service.TFCustomFlowService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.FlowApprovePassEnum;
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.*;
 
 /**
  * <p>
@@ -12,8 +34,100 @@ import org.springframework.web.bind.annotation.RestController;
  * @author wangliang
  * @since 2023-07-17
  */
+@Api(tags = "流程表单Controller")
 @RestController
-@RequestMapping("/t-fcustom-flow")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_FLOW)
 public class TFCustomFlowController {
+    private final static Logger log = LoggerFactory.getLogger(TFCustomFlowController.class);
+
+    @Resource
+    ActivitiService activitiService;
+
+    @Resource
+    TFCustomFlowService tfCustomFlowService;
+
+    @ApiOperation(value = "创建流程接口")
+    @RequestMapping(value = "/createDeployment", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result createDeployment() throws IOException {
+        return ResultUtil.ok(activitiService.createDeployment(Arrays.asList(TFCustomTypeEnum.OFFICE_SOP_FLOW, TFCustomTypeEnum.DING_EXCEPTION_FLOW, TFCustomTypeEnum.PROJECT_EXCHANGE_FLOW, TFCustomTypeEnum.QUALITY_PROBLEM_FLOW)));
+//        return ResultUtil.ok(activitiService.createDeployment(Arrays.asList(TFCustomTypeEnum.QUALITY_PROBLEM_FLOW)));
+    }
+
+    @ApiOperation(value = "上传流程接口")
+    @RequestMapping(value = "/upload", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result upload(@ApiParam(required = true, value = "上传文件") @RequestParam MultipartFile file) throws IOException {
+        return ResultUtil.ok(activitiService.upload(file));
+    }
+
+    @ApiOperation(value = "获取流程部署信息")
+    @RequestMapping(value = "/deployment/data", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TFCustomFlow.class)})
+    public Result getDeploymentData() {
+        return ResultUtil.ok(tfCustomFlowService.findFlowDeploymentList());
+    }
+
+    @ApiOperation(value = "获取流程表单属性接口")
+    @RequestMapping(value = "/form_properties/get", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result formPropertiesGet(@ApiParam(value = "流程部署id") @RequestParam(required = false) String flowDeploymentId,
+                                    @ApiParam(value = "流程id") @RequestParam(required = false) Long flowId,
+                                    @ApiParam(value = "流程任务id") @RequestParam(required = false) Long taskId) {
+        return ResultUtil.ok(activitiService.formPropertiesGet(flowDeploymentId, flowId, taskId));
+    }
+
+    @ApiOperation(value = "流程审批接口")
+    @RequestMapping(value = "/approve", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result approve(@ApiParam(value = "流程部署id") @RequestParam(required = false) String flowDeploymentId,
+                          @ApiParam(value = "流程操作", required = true) @RequestParam FlowApprovePassEnum approve,
+                          @ApiParam(value = "流程任务id") @RequestParam(required = false) Long taskId,
+                          @ApiParam(value = "流程表单数据") @RequestParam(required = false) String formProperties,
+                          @ApiParam(value = "流程审批人") @RequestParam(required = false) List<String> approveUserIds,
+                          @ApiParam(value = "流程审批意见") @RequestParam(required = false) String approveRemark,
+//                                         @ApiParam(value = "上传文件") @RequestParam(required = false) MultipartFile file,
+                          HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, String> formDataMap = new HashMap<>();
+        Map<String, String[]> parameterMap = request.getParameterMap();
+        Set<Map.Entry<String, String[]>> entrySet = parameterMap.entrySet();
+        for (Map.Entry<String, String[]> entry : entrySet) {
+            String key = entry.getKey();
+            String[] value = entry.getValue();
+            formDataMap.put(key, value[0]);
+        }
+        map.putAll(formDataMap);
+        activitiService.taskApprove(flowDeploymentId, approve, taskId, formProperties, approveUserIds, approveRemark, map);
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "获取待办接口")
+    @RequestMapping(value = "/getTaskList", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = FormPropertyBean.class)})
+    public Result getTaskList(@ApiParam(value = "用户id", required = true) @RequestParam Long userId) {
+        return ResultUtil.ok(activitiService.getTaskList(userId));
+    }
+
+    @ApiOperation(value = "结束流程接口")
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result delete(@ApiParam(value = "流程id", required = true) Long flowId) {
+        return ResultUtil.ok(activitiService.flowEnd(flowId));
+    }
+
+    @ApiOperation(value = "流程转办接口")
+    @RequestMapping(value = "/task/approver/exchange", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result taskApproverExchange(@ApiParam(value = "用户id", required = true) @RequestParam Long userId,
+                                       @ApiParam(value = "用户id", required = true) @RequestParam Long taskId) {
+        return ResultUtil.ok(activitiService.taskApproverExchange(userId, taskId));
+    }
 
+    @ApiOperation(value = "获取流程详细信息接口")
+    @RequestMapping(value = "/view", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = FlowViewResult.class)})
+    public Result flowView(@ApiParam(value = "用户id", required = true) @RequestParam Long flowId) {
+        return ResultUtil.ok(activitiService.flowView(flowId));
+    }
 }

+ 3 - 15
sop-server/src/main/resources/qualityProblemFlow.bpmn

@@ -1,11 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test" id="m1626068475250" name="">
   <process id="QUALITY_PROBLEM_FLOW" isExecutable="true" isClosed="false" processType="None">
-    <userTask id="f_usertask_quality_problem_approve_2" name="项目计划变更审核" activiti:assignee="${assignee2}" activiti:formKey="quality_problem_approve.form">
-      <multiInstanceLoopCharacteristics isSequential="true" activiti:collection="${assigneeList2}" activiti:elementVariable="assignee2">
-        <completionCondition>${nrOfCompletedInstances/nrOfInstances==1 || reject2==1}</completionCondition>
-      </multiInstanceLoopCharacteristics>
-    </userTask>
+    <userTask id="f_usertask_quality_problem_approve_2" name="项目计划变更审核" activiti:candidateUsers="${assigneeList2}" activiti:formKey="quality_problem_approve.form"></userTask>
     <startEvent id="startevent1" name="Start"></startEvent>
     <userTask id="f_usertask_quality_problem_apply_1" name="质量问题反馈申请" activiti:assignee="${assignee1}" activiti:formKey="quality_problem_apply.form">
       <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${assigneeList1}" activiti:elementVariable="assignee1">
@@ -17,11 +13,7 @@
     <sequenceFlow id="flow15" name="驳回" sourceRef="exclusivegateway2" targetRef="f_usertask_quality_problem_apply_1">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve == 'f_usertask_quality_problem_apply_1'}]]></conditionExpression>
     </sequenceFlow>
-    <userTask id="f_usertask_quality_problem_check_3" name="项目计划变更复核" activiti:assignee="${assignee3}" activiti:formKey="quality_problem_check.form">
-      <multiInstanceLoopCharacteristics isSequential="true" activiti:collection="${assigneeList3}" activiti:elementVariable="assignee3">
-        <completionCondition>${nrOfCompletedInstances/nrOfInstances==1 || reject3==1}</completionCondition>
-      </multiInstanceLoopCharacteristics>
-    </userTask>
+    <userTask id="f_usertask_quality_problem_check_3" name="项目计划变更复核" activiti:candidateUsers="${assigneeList3}" activiti:formKey="quality_problem_check.form"></userTask>
     <sequenceFlow id="flow17" name="通过" sourceRef="exclusivegateway2" targetRef="f_usertask_quality_problem_check_3">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve == 'f_usertask_quality_problem_check_3'}]]></conditionExpression>
     </sequenceFlow>
@@ -30,11 +22,7 @@
     <sequenceFlow id="flow19" name="驳回" sourceRef="exclusivegateway3" targetRef="f_usertask_quality_problem_approve_2">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve == 'f_usertask_quality_problem_approve_2'}]]></conditionExpression>
     </sequenceFlow>
-    <userTask id="f_usertask_quality_problem_third_check_4" name="乙方复核" activiti:assignee="${assignee4}" activiti:formKey="quality_problem_check.form">
-      <multiInstanceLoopCharacteristics isSequential="true" activiti:collection="${assigneeList4}" activiti:elementVariable="assignee4">
-        <completionCondition>${nrOfCompletedInstances/nrOfInstances==1 || reject4==1}</completionCondition>
-      </multiInstanceLoopCharacteristics>
-    </userTask>
+    <userTask id="f_usertask_quality_problem_third_check_4" name="乙方复核" activiti:candidateUsers="${assigneeList4}" activiti:formKey="quality_problem_check.form"></userTask>
     <sequenceFlow id="flow20" name="通过" sourceRef="exclusivegateway3" targetRef="f_usertask_quality_problem_third_check_4">
       <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve == 'f_usertask_quality_problem_third_check_4'}]]></conditionExpression>
     </sequenceFlow>

二进制
sop-server/src/main/resources/qualityProblemFlow.zip