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