diff --git a/pom.xml b/pom.xml
index 936fd8e..68e5f74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
-
+
com.rzdata
tool-tech
3.8.8
tool-tech
工具与技术交流管理系统
-
+
3.8.8
UTF-8
@@ -285,4 +285,4 @@
-
\ No newline at end of file
+
diff --git a/tool-tech-admin/pom.xml b/tool-tech-admin/pom.xml
index 8d2e4f2..6a1b9d0 100644
--- a/tool-tech-admin/pom.xml
+++ b/tool-tech-admin/pom.xml
@@ -16,7 +16,26 @@
-
+
+ com.google.guava
+ guava
+ 21.0
+
+
+ com.squareup.okhttp3
+ okhttp
+ 4.9.2
+
+
+ com.alibaba
+ fastjson
+ 1.2.76
+
+
+ com.blueland.bpmclient
+ workflow-sdk
+ 0.1.5
+
com.rzdata
@@ -85,17 +104,17 @@
-
- org.apache.maven.plugins
- maven-war-plugin
- 3.1.0
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.1.0
false
${project.artifactId}
-
-
+
+
${project.artifactId}
-
\ No newline at end of file
+
diff --git a/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/ToolController.java b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/ToolController.java
index 7d51e56..c8f94c3 100644
--- a/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/ToolController.java
+++ b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/ToolController.java
@@ -1,15 +1,22 @@
package com.rzdata.web.controller.tool;
+import cn.hutool.core.util.BooleanUtil;
+import cn.hutool.core.util.IdUtil;
+import com.blueland.bpmclient.model.ProcessInstanceModel;
import com.rzdata.common.annotation.Log;
import com.rzdata.common.core.controller.BaseController;
import com.rzdata.common.core.domain.AjaxResult;
import com.rzdata.common.core.page.TableDataInfo;
import com.rzdata.common.enums.BizExceptionCodeEnum;
import com.rzdata.common.enums.BusinessType;
+import com.rzdata.common.enums.RecordStatusEnum;
import com.rzdata.common.exception.RestException;
+import com.rzdata.common.utils.StringUtils;
import com.rzdata.common.utils.poi.ExcelUtil;
import com.rzdata.web.domain.Tool;
import com.rzdata.web.service.IToolService;
+import com.rzdata.web.service.WorkflowService;
+import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -30,6 +37,9 @@ public class ToolController extends BaseController
@Autowired
private IToolService toolService;
+ @Autowired
+ private WorkflowService workflowService;
+
/**
* 查询工具信息列表
*/
@@ -62,6 +72,21 @@ public class ToolController extends BaseController
return success(toolService.selectToolByToolId(toolId));
}
+ /**
+ * 获取工具信息详细信息
+ */
+ @GetMapping(value = "/bpmc/{bpmcId}")
+ public AjaxResult getInfoByBpmcId(@PathVariable("bpmcId") String bpmcId)
+ {
+ return success(toolService.getInfoByBpmcId(bpmcId));
+ }
+
+ @ApiOperation("判断文件名称是否存在 true 存在 false 不存在")
+ @GetMapping("/checkToolExist")
+ public AjaxResult checkToolExist(Tool tTool) {
+ return AjaxResult.success(toolService.checkToolExist(tTool.getToolCode(), tTool.getToolRespDept()));
+ }
+
/**
* 新增工具信息
*/
@@ -69,17 +94,41 @@ public class ToolController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody Tool tTool)
{
- if(toolService.checkToolExist(tTool.getToolCode(), tTool.getToolRespDept())){
- throw new RestException(BizExceptionCodeEnum.A400001001.getCode(), BizExceptionCodeEnum.A400001001.getMessage());
+ boolean add = false;
+ if (StringUtils.isEmpty(tTool.getToolId())) {
+ tTool.setToolId(IdUtil.simpleUUID());
+ add = true;
+ }
+ ProcessInstanceModel processInstanceModel = null;
+ try {
+ if(StringUtils.equals(tTool.getRecordStatus(), RecordStatusEnum.DRAFT.getCode())){
+ processInstanceModel = workflowService.saveExecute(tTool.getBpmClientInputModel(), tTool.getToolId());
+ }else if (StringUtils.equals(tTool.getRecordStatus(), RecordStatusEnum.CANCEL.getCode())){
+ processInstanceModel = workflowService.cancelExecute(tTool.getBpmClientInputModel(), tTool.getToolId());
+ }else{
+ processInstanceModel = workflowService.nextExecute(tTool.getBpmClientInputModel(), tTool.getToolId());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (processInstanceModel!=null&&StringUtils.isNotEmpty(processInstanceModel.getProcInstId())) {
+ if (add) {
+ tTool.setProcInstId(processInstanceModel.getProcInstId());
+ toolService.insertTool(tTool);
+ }else if (BooleanUtil.isTrue(tTool.getEditStatus())){
+ toolService.updateTool(tTool);
+ }
+ return AjaxResult.success("操作成功",processInstanceModel);
+ }else {
+ return AjaxResult.error();
}
- return toAjax(toolService.insertTool(tTool));
}
/**
* 修改工具信息
*/
@Log(title = "工具信息", businessType = BusinessType.UPDATE)
- @PutMapping
+ @PostMapping("/edit")
public AjaxResult edit(@RequestBody Tool tTool)
{
return toAjax(toolService.updateTool(tTool));
diff --git a/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/UseApplyController.java b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/UseApplyController.java
new file mode 100644
index 0000000..4d62afe
--- /dev/null
+++ b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/UseApplyController.java
@@ -0,0 +1,156 @@
+package com.rzdata.web.controller.tool;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.util.BooleanUtil;
+import cn.hutool.core.util.IdUtil;
+import com.blueland.bpmclient.model.ProcessInstanceModel;
+import com.rzdata.common.enums.RecordStatusEnum;
+import com.rzdata.common.utils.DateUtils;
+import com.rzdata.common.utils.StringUtils;
+import com.rzdata.web.service.IUseApplyItemService;
+import com.rzdata.web.service.WorkflowService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.rzdata.common.annotation.Log;
+import com.rzdata.common.core.controller.BaseController;
+import com.rzdata.common.core.domain.AjaxResult;
+import com.rzdata.common.enums.BusinessType;
+import com.rzdata.web.domain.UseApply;
+import com.rzdata.web.service.IUseApplyService;
+import com.rzdata.common.utils.poi.ExcelUtil;
+import com.rzdata.common.core.page.TableDataInfo;
+
+/**
+ * 使用申请Controller
+ *
+ * @author ja
+ * @date 2024-08-21
+ */
+@RestController
+@RequestMapping("/use/apply")
+public class UseApplyController extends BaseController
+{
+ @Autowired
+ private IUseApplyService useApplyService;
+
+ @Autowired
+ private WorkflowService workflowService;
+
+ @Autowired
+ private IUseApplyItemService useApplyItemService;
+
+
+ /**
+ * 查询使用申请列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:apply:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(UseApply useApply)
+ {
+ startPage();
+ List list = useApplyService.selectUseApplyList(useApply);
+ return getDataTable(list);
+ }
+
+ /**
+ * 获取工具信息详细信息
+ */
+ @GetMapping(value = "/bpmc/{bpmcId}")
+ public AjaxResult getInfoByBpmcId(@PathVariable("bpmcId") String bpmcId)
+ {
+ return success(useApplyService.getInfoByBpmcId(bpmcId));
+ }
+
+ /**
+ * 导出使用申请列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:apply:export')")
+ @Log(title = "使用申请", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, UseApply useApply)
+ {
+ List list = useApplyService.selectUseApplyList(useApply);
+ ExcelUtil util = new ExcelUtil(UseApply.class);
+ util.exportExcel(response, list, "使用申请数据");
+ }
+
+ /**
+ * 获取使用申请详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:apply:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(useApplyService.selectUseApplyById(id));
+ }
+
+ /**
+ * 新增使用申请
+ */
+ @Log(title = "使用申请", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody UseApply useApply)
+ {
+ boolean add = false;
+ if (StringUtils.isEmpty(useApply.getId())) {
+ useApply.setId(IdUtil.simpleUUID());
+ add = true;
+ }
+ ProcessInstanceModel processInstanceModel = null;
+ try {
+ if(StringUtils.equals(useApply.getRecordStatus(), RecordStatusEnum.DRAFT.getCode())){
+ processInstanceModel = workflowService.saveExecute(useApply.getBpmClientInputModel(), useApply.getId());
+ }else if (StringUtils.equals(useApply.getRecordStatus(), RecordStatusEnum.CANCEL.getCode())){
+ processInstanceModel = workflowService.cancelExecute(useApply.getBpmClientInputModel(), useApply.getId());
+ }else{
+ processInstanceModel = workflowService.nextExecute(useApply.getBpmClientInputModel(), useApply.getId());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (processInstanceModel!=null&&StringUtils.isNotEmpty(processInstanceModel.getProcInstId())) {
+ if (add) {
+ useApply.setProcInstId(processInstanceModel.getProcInstId());
+ useApplyService.insertUseApply(useApply);
+ useApplyItemService.updateItemList(useApply.getItemList(),useApply.getId());
+ }else if (BooleanUtil.isTrue(useApply.getEditStatus())){
+ useApplyService.updateUseApply(useApply);
+ useApplyItemService.updateItemList(useApply.getItemList(),useApply.getId());
+ }
+ return AjaxResult.success("操作成功",processInstanceModel);
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ /**
+ * 修改使用申请
+ */
+ @Log(title = "使用申请", businessType = BusinessType.UPDATE)
+ @PostMapping("/edit")
+ public AjaxResult edit(@RequestBody UseApply useApply)
+ {
+ return toAjax(useApplyService.updateUseApply(useApply));
+ }
+
+ /**
+ * 删除使用申请
+ */
+ @PreAuthorize("@ss.hasPermi('system:apply:remove')")
+ @Log(title = "使用申请", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(useApplyService.deleteUseApplyByIds(ids));
+ }
+}
diff --git a/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/UseApplyItemController.java b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/UseApplyItemController.java
new file mode 100644
index 0000000..d066d2e
--- /dev/null
+++ b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/UseApplyItemController.java
@@ -0,0 +1,110 @@
+package com.rzdata.web.controller.tool;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.rzdata.common.annotation.Log;
+import com.rzdata.common.core.controller.BaseController;
+import com.rzdata.common.core.domain.AjaxResult;
+import com.rzdata.common.enums.BusinessType;
+import com.rzdata.web.domain.UseApplyItem;
+import com.rzdata.web.service.IUseApplyItemService;
+import com.rzdata.common.utils.poi.ExcelUtil;
+import com.rzdata.common.core.page.TableDataInfo;
+
+/**
+ * 使用申请详情Controller
+ *
+ * @author ja
+ * @date 2024-08-21
+ */
+@RestController
+@RequestMapping("/use/apply/item")
+public class UseApplyItemController extends BaseController
+{
+ @Autowired
+ private IUseApplyItemService useApplyItemService;
+
+ /**
+ * 查询使用申请详情列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:item:list')")
+ @GetMapping("/page")
+ public TableDataInfo page(UseApplyItem useApplyItem)
+ {
+ startPage();
+ List list = useApplyItemService.selectUseApplyItemList(useApplyItem);
+ return getDataTable(list);
+ }
+
+ @GetMapping("/list")
+ public AjaxResult list(UseApplyItem useApplyItem)
+ {
+ return AjaxResult.success(useApplyItemService.selectUseApplyItemList(useApplyItem));
+ }
+
+ /**
+ * 导出使用申请详情列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:item:export')")
+ @Log(title = "使用申请详情", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, UseApplyItem useApplyItem)
+ {
+ List list = useApplyItemService.selectUseApplyItemList(useApplyItem);
+ ExcelUtil util = new ExcelUtil(UseApplyItem.class);
+ util.exportExcel(response, list, "使用申请详情数据");
+ }
+
+ /**
+ * 获取使用申请详情详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:item:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(useApplyItemService.selectUseApplyItemById(id));
+ }
+
+ /**
+ * 新增使用申请详情
+ */
+ @PreAuthorize("@ss.hasPermi('system:item:add')")
+ @Log(title = "使用申请详情", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody UseApplyItem useApplyItem)
+ {
+ return toAjax(useApplyItemService.insertUseApplyItem(useApplyItem));
+ }
+
+ /**
+ * 修改使用申请详情
+ */
+ @PreAuthorize("@ss.hasPermi('system:item:edit')")
+ @Log(title = "使用申请详情", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody UseApplyItem useApplyItem)
+ {
+ return toAjax(useApplyItemService.updateUseApplyItem(useApplyItem));
+ }
+
+ /**
+ * 删除使用申请详情
+ */
+ @PreAuthorize("@ss.hasPermi('system:item:remove')")
+ @Log(title = "使用申请详情", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(useApplyItemService.deleteUseApplyItemByIds(ids));
+ }
+}
diff --git a/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/WorkflowController.java b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/WorkflowController.java
new file mode 100644
index 0000000..5b6d5d0
--- /dev/null
+++ b/tool-tech-admin/src/main/java/com/rzdata/web/controller/tool/WorkflowController.java
@@ -0,0 +1,619 @@
+package com.rzdata.web.controller.tool;
+
+import com.blueland.bpmclient.model.*;
+import com.rzdata.common.core.controller.BaseController;
+import com.rzdata.common.core.domain.AjaxResult;
+import com.rzdata.common.core.domain.entity.SysUser;
+import com.rzdata.common.utils.SecurityUtils;
+import com.rzdata.common.utils.StringUtils;
+import com.rzdata.system.service.ISysConfigService;
+import com.rzdata.system.service.ISysUserService;
+import com.rzdata.web.core.config.BpmcConfig;
+import com.rzdata.web.domain.bo.BpmClientInputModelBo;
+import com.rzdata.web.domain.vo.WorkFlowPageVo;
+import com.rzdata.web.service.WorkflowService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Validated
+@Slf4j
+@RestController
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RequestMapping(value = "/workflow")
+@Api(value = "流程服务", tags = {"流程服务"})
+public class WorkflowController extends BaseController {
+
+ private final WorkflowService workflowService;
+
+ private final ISysUserService userService;
+
+ private final ISysConfigService sysConfigService;
+
+ private final BpmcConfig bpmcConfig;
+
+
+ @CrossOrigin
+ @ApiOperation(value = "获取流程待选人员展示方式", notes = "获取流程待选人员展示方式")
+ @GetMapping(value = "selectUserStyle")
+ @ResponseBody
+ public AjaxResult selectUserStyle() throws Exception {
+ String result = "tree";
+ String value = this.sysConfigService.selectConfigByKey("DMS_FLOW_SELECT_USER_STYLE");
+ if(StringUtils.isNotEmpty(value)) {
+ result = value;
+ }
+ return AjaxResult.success("",result);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "根据流程定义Key获取流程定义信息", notes = "根据流程定义Key获取流程定义信息")
+ @ApiImplicitParams({@ApiImplicitParam(name = "procDefKey", value = "流程定义key", dataType = "string", paramType = "path") })
+ @GetMapping(value = "process/key/{procDefKey}")
+ @ResponseBody
+ public AjaxResult getProcessDefinitionModel(@PathVariable("procDefKey") String procDefKey) throws Exception {
+ ProcessDefinitionModel processDefinitionModel = workflowService.getProcessDefinitionModel(
+ procDefKey);
+ return AjaxResult.success(processDefinitionModel);
+
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "获取流程第一个人工环节定义", notes = "获取流程第一个人工环节定义")
+ @GetMapping(value = "startactdef/{procDefId}")
+ @ResponseBody
+ public AjaxResult getStartActdef(
+ @PathVariable("procDefId") String procDefId) throws Exception{
+ ActivityDefinitionModel activityDefinitionModel = workflowService.getStartactDef(procDefId);
+ return AjaxResult.success(activityDefinitionModel);
+
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "新建流程,获取下一环节流程定义信息", notes = "新建流程,获取下一环节流程定义信息")
+ @PostMapping(value = "nextacts/new")
+ @ResponseBody
+ public AjaxResult getNextActsByNew(@RequestBody SearchQuery searchQuery) {
+ List list = workflowService.getNextActs(searchQuery);
+ return AjaxResult.success(list);
+ }
+
+ /**
+ * 获取下一环节集合,并可以标识已办和自动将未办理环节优先排序
+ *
+ * @param searchQuery
+ * @return
+ */
+ @CrossOrigin
+ @ApiOperation(value = "新建流程,获取下一环节流程定义信息", notes = "新建流程,获取下一环节流程定义信息")
+ @PostMapping(value = "nextacts/new2")
+ @ResponseBody
+ public AjaxResult getNextActsByNew2(@RequestBody SearchQuery searchQuery) {
+ List list = workflowService.getNextActs(searchQuery);
+ return AjaxResult.success(list);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "待办流程,获取下一环节流程定义信息", notes = "待办流程,获取下一环节流程定义信息")
+ @PostMapping(value = "nextacts/pending")
+ @ResponseBody
+ public AjaxResult getNextActsByPending(@RequestBody SearchQuery searchQuery) {
+ List list = workflowService.getNextActs(searchQuery);
+ return AjaxResult.success(list);
+ }
+
+
+ @CrossOrigin
+ @ApiOperation(value = "新建流程,获取下一环节用户定义信息", notes = "新建流程,获取下一环节用户定义信息")
+ @GetMapping(value = "nextactuser/new")
+ @ResponseBody
+ public AjaxResult getNextActUsersByNew(
+ @RequestParam(value = "userOrgId") String userOrgId,
+ @RequestParam(value = "curActDefId") String curActDefId,
+ @RequestParam(value = "destActDefId") String destActDefId,
+ @RequestParam(value = "procDefId") String procDefId, HttpServletRequest request) {
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(userOrgId);
+ searchQuery.setCurActDefId(curActDefId);
+ searchQuery.setDestActDefId(destActDefId);
+ searchQuery.setProcDefId(procDefId);
+ List rs = workflowService.getNextActUsers(searchQuery);
+ return AjaxResult.success(rs);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "新建流程,获取下一环节用户定义信息", notes = "新建流程,获取下一环节用户定义信息")
+ @PostMapping(value = "nextactuser/new")
+ @ResponseBody
+ public AjaxResult getNextActUsersByNew(
+ @RequestParam(value = "userOrgId") String userOrgId,
+ @RequestParam(value = "curActDefId") String curActDefId,
+ @RequestParam(value = "destActDefId") String destActDefId,
+ @RequestParam(value = "procDefId") String procDefId, @RequestBody SearchQuery searchQuery,
+ HttpServletRequest request) {
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(userOrgId);
+ searchQuery.setCurActDefId(curActDefId);
+ searchQuery.setDestActDefId(destActDefId);
+ searchQuery.setProcDefId(procDefId);
+ List rs = workflowService.getNextActUsers(searchQuery);
+ return AjaxResult.success(rs);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "待办流程,获取下一环节用户定义信息", notes = "待办流程,获取下一环节用户定义信息")
+ @GetMapping(value = "nextactuser/pending")
+ @ResponseBody
+ public AjaxResult getNextActUsersByPending(
+ @RequestParam(value = "userOrgId") String userOrgId,
+ @RequestParam(value = "curActInstId") String curActInstId,
+ @RequestParam(value = "destActDefId") String destActDefId,
+ @RequestParam(value = "curActDefId") String curActDefId,
+ @RequestParam(value = "procDefKey") String procDefKey,
+ @RequestParam(value = "procInstId") String procInstId,
+
+ HttpServletRequest request) {
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setTenantId(bpmcConfig.getTenantId());
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(userOrgId);
+ searchQuery.setDestActDefId(destActDefId);
+ searchQuery.setCurActInstId(curActInstId);
+ List rs = workflowService.getNextActUsers(searchQuery);
+ return AjaxResult.success(rs);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "待办流程,获取下一环节用户定义信息", notes = "待办流程,获取下一环节用户定义信息")
+ @PostMapping(value = "nextactuser/pending")
+ @ResponseBody
+ public AjaxResult getNextActUsersByPending(
+ @RequestParam(value = "userOrgId") String userOrgId,
+ @RequestParam(value = "curActInstId") String curActInstId,
+ @RequestParam(value = "destActDefId") String destActDefId, @RequestBody SearchQuery searchQuery,
+ HttpServletRequest request) {
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(userOrgId);
+ searchQuery.setDestActDefId(destActDefId);
+ searchQuery.setCurActInstId(curActInstId);
+ List rs = workflowService.getNextActUsers(searchQuery);
+ return AjaxResult.success(rs);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "获取待办实例信息", notes = "获取待办实例信息")
+ @GetMapping(value = "flowinfo/pending")
+ @ResponseBody
+ public AjaxResult getPendingFlowInstance(
+ @RequestParam(value = "curActInstId") String curActInstId, HttpServletRequest request) throws Exception{
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SysUser user = userService.selectUserByUserName(userId);
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(user.getDeptId().toString());
+ searchQuery.setCurActInstId(curActInstId);
+ searchQuery.setStatus(1);
+ HashMap flowInfoMap = workflowService.getFLowInfo(searchQuery);
+ return AjaxResult.success(flowInfoMap);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "获取已办实例信息", notes = "获取已办实例信息")
+ @GetMapping(value = "flowinfo/yiban")
+ @ResponseBody
+ public AjaxResult getYiBanFlowInstance(
+ @RequestParam(value = "curActInstId") String curActInstId, HttpServletRequest request) throws Exception{
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SysUser user = userService.selectUserByUserName(userId);
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(user.getDeptId().toString());
+ searchQuery.setCurActInstId(curActInstId);
+ searchQuery.setStatus(2);
+ HashMap flowInfoMap = workflowService.getFLowInfo(searchQuery);
+ return AjaxResult.success(flowInfoMap);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "获取办结实例信息", notes = "获取办结实例信息")
+ @GetMapping(value = "flowinfo/banjie")
+ @ResponseBody
+ public AjaxResult getBanJieFlowInstance(
+ @RequestParam(value = "procInstId") String procInstId,
+ HttpServletRequest request) throws Exception{
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SysUser user = userService.selectUserByUserName(userId);
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setUserId(userId);
+ searchQuery.setUserOrgId(user.getDeptId().toString());
+ searchQuery.setProcInstId(procInstId);
+ searchQuery.setStatus(3);
+ HashMap flowInfoMap = workflowService.getFLowInfo(searchQuery);
+ return AjaxResult.success(flowInfoMap);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "新建页面,判断下一环节是否自动提交", notes = "新建页面,判断下一环节是否自动提交")
+ @GetMapping(value = "autocommit/new/{procDefId}/{curActDefId}")
+ @ResponseBody
+ public AjaxResult checkAutoCommitByNew(
+ @PathVariable("procDefId") String procDefId, @PathVariable("curActDefId") String curActDefId) throws Exception{
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setProcDefId(procDefId);
+ searchQuery.setCurActDefId(curActDefId);
+ String actDefId = workflowService.checkAutoCommit(searchQuery);
+ return AjaxResult.success("",actDefId);
+
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "待办页面,判断下一环节是否自动提交", notes = "待办页面,判断下一环节是否自动提交")
+ @GetMapping(value = "autocommit/pending/{curActInstId}")
+ @ResponseBody
+ public AjaxResult checkAutoCommitByPending(
+ @PathVariable("curActInstId") String curActInstId) throws Exception{
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setCurActInstId(curActInstId);
+ String actDefId = workflowService.checkAutoCommit(searchQuery);
+ return AjaxResult.success("",actDefId);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "待办页面,判断下一环节是否自动跳转", notes = "待办页面,判断下一环节是否自动跳转")
+ @GetMapping(value = "autoJump/pending/{curActInstId}")
+ @ResponseBody
+ public AjaxResult checkAutoJumpByPending(
+ @PathVariable("curActInstId") String curActInstId) throws Exception{
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setCurActInstId(curActInstId);
+ Map actDefId = workflowService.checkAutoJump(searchQuery);
+ return AjaxResult.success("",actDefId);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "新建页面,判断下一环节是否自动提交", notes = "新建页面,判断下一环节是否自动提交")
+ @GetMapping(value = "autoJump/new/{procDefId}/{curActDefId}")
+ @ResponseBody
+ public AjaxResult checkAutoJumpByNew(
+ @PathVariable("procDefId") String procDefId, @PathVariable("curActDefId") String curActDefId) throws Exception{
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setProcDefId(procDefId);
+ searchQuery.setCurActDefId(curActDefId);
+ Map actDefId = workflowService.checkAutoJump(searchQuery);
+ return AjaxResult.success("",actDefId);
+
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "提交流程", notes = "提交流程")
+ @PostMapping(value = "submit")
+ @ResponseBody
+ public AjaxResult submitNewFLowInstance(@RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.submit.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "暂存流程", notes = "暂存流程")
+ @PostMapping(value = "save")
+ @ResponseBody
+ public AjaxResult saveFLowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.save.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ /**
+ * 流程作废
+ *
+ * @param bpmClientInputModelBo
+ * @return
+ */
+ @ApiOperation(value = "作废流程", notes = "作废流程")
+ @PostMapping(value = "cancel")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult cancelFlowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.cancel.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ /**
+ * 流程实例撤回到拟稿人环节
+ *
+ * @param bpmClientInputModelBo
+ * @return
+ */
+ @ApiOperation(value = "流程实例撤回到拟稿人环节", notes = "流程实例撤回到拟稿人环节")
+ @PostMapping(value = "backtostart")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult callBackStartFlowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.backtostart.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ /**
+ * 流程实例撤回到上一环节
+ *
+ * @param bpmClientInputModelBo
+ * @return
+ */
+ @ApiOperation(value = "流程实例撤回到上一环节", notes = "流程实例撤回到上一环节")
+ @PostMapping(value = "backtoprev")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult backToPrevFlowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.backtoprev.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ /**
+ * 提交流程驳回参数
+ *
+ * @param bpmClientInputModelBo
+ * @return
+ */
+ @CrossOrigin
+ @ApiOperation(value = "流程驳回", notes = "流程驳回")
+ @PostMapping(value = "reject")
+ @ResponseBody
+ public AjaxResult rejectFlowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.reject.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ /**
+ * 流程撤回
+ *
+ * @param bpmClientInputModelBo
+ * @return
+ */
+ @CrossOrigin
+ @ApiOperation(value = "流程撤回", notes = "流程撤回")
+ @PostMapping(value = "back")
+ @ResponseBody
+ public AjaxResult backFlowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.back.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ @ApiOperation(value = "流程转派", notes = "流程转派")
+ @PostMapping(value = "transfer")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult transferFlowInstance(
+ @RequestBody BpmClientInputModelBo bpmClientInputModelBo) throws Exception{
+ ProcessInstanceModel processInstanceModel = workflowService.processProcInst(bpmClientInputModelBo,
+ WorkflowService.ENUM_ACTION.transfer.name());
+ return AjaxResult.success(processInstanceModel);
+ }
+
+ @ApiOperation(value = "流程日志", notes = "流程日志")
+ @PostMapping(value = "getLog")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getProcInstLog(
+ @RequestBody BpmClientInputModel bpmClientInputModel) {
+ HashMap procInstLog = workflowService.getProcInstLog(bpmClientInputModel);
+ return AjaxResult.success(procInstLog);
+ }
+
+ @ApiOperation(value = "办件阅件列表查询", notes = "办件阅件列表查询")
+ @PostMapping(value = "/list")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getRecordList(@RequestBody SearchQuery searchQuery) {
+ PageResultModel pageResult = workflowService.findRecordList(searchQuery);
+ return AjaxResult.success(pageResult);
+ }
+
+ @ApiOperation(value = "待办/已办列表查询", notes = "待办/已办列表查询")
+ @PostMapping(value = "/toDoList")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getToDoList(@RequestBody SearchQuery searchQuery) throws Exception{
+ //接收人
+ WorkFlowPageVo pageResult = workflowService.findToDoList(searchQuery);
+ return AjaxResult.success(pageResult);
+ }
+
+ @ApiOperation(value = "获取流程实例图形监控链接地址", notes = "获取流程实例图形监控链接地址")
+ @GetMapping(value = "histasklogurl/{procInstId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getHistasklogurl( @PathVariable String procInstId) throws Exception{
+ String url = workflowService.getHistasklogurl(procInstId);
+ return AjaxResult.success("",url);
+ }
+
+ @ApiOperation(value = "获取流程实例图形链接地址", notes = "获取流程实例图形监控链接地址")
+ @GetMapping(value = "getImageUrl/{procDefId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getProcessImageUrl( @PathVariable String procDefId) throws Exception{
+ String url = workflowService.getImageUrl( procDefId);
+ return AjaxResult.success("",url);
+ }
+
+ /**
+ * 获取流程状态
+ *
+ * @param procInstId
+ * @param curActInstId
+ * @return
+ */
+ @ApiOperation(value = "获取流程状态", notes = "获取流程状态")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "procInstId", value = "流程实例id", dataType = "string", paramType = "path"),
+ @ApiImplicitParam(name = "curActInstId", value = "当前环节实例id", dataType = "string", paramType = "path") })
+ @GetMapping(value = "/getFlowStatus/{procInstId}/{curActInstId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getFlowStatus( @PathVariable String procInstId,
+ @PathVariable String curActInstId) throws Exception{
+ int flowStatus = workflowService.getFlowStatus(procInstId, curActInstId);
+ return AjaxResult.success(flowStatus);
+ }
+
+ @ApiOperation(value = "获取流程实例信息,包含当前用户所对应实例状态", notes = "获取流程实例信息,包含当前用户所对应实例状态")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "procInstId", value = "流程实例id", dataType = "string", paramType = "path"),
+ @ApiImplicitParam(name = "curActInstId", value = "当前环节实例id", dataType = "string", paramType = "path") })
+ @GetMapping(value = "instance/{procInstId}/{curActInstId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getFlowProcessInstance(@PathVariable String procInstId, @PathVariable String curActInstId, HttpServletRequest request) throws Exception{
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ ProcessInstanceModel procInst = workflowService.getProcessInstance(procInstId, curActInstId,
+ userId);
+ return AjaxResult.success(procInst);
+ }
+
+ @ApiOperation(value = "获取流程环节定义信息", notes = "获取流程环节定义信息")
+ @GetMapping(value = "activitydefinition/{procDefId}/{actDefId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getFlowActDef(
+ @PathVariable String procDefId, @PathVariable String actDefId) throws Exception{
+ ActivityDefinitionModel activityDefinitionModel = workflowService.getActDef( procDefId, actDefId);
+ return AjaxResult.success(activityDefinitionModel);
+ }
+
+ @ApiOperation(value = "获取流程环节配置的表单", notes = "获取流程环节配置的表单")
+ @GetMapping(value = "getFlowActForm/{procDefId}/{actDefId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getFlowActForm(
+ @PathVariable String procDefId, @PathVariable String actDefId) throws Exception{
+ Map formUrl = workflowService.getFlowActForm( procDefId, actDefId);
+ return AjaxResult.success(formUrl);
+ }
+
+ @ApiOperation(value = "根据流程实例id获取流程实例信息", notes = "根据流程实例id获取流程实例信息")
+ @GetMapping(value = "/procInstInfo/{procInstId}")
+ @ResponseBody
+ @CrossOrigin
+ public AjaxResult getProcInstInfo(@PathVariable String procInstId)throws Exception {
+ Map procInst = workflowService.getProcessInstById( procInstId);
+ return AjaxResult.success(procInst);
+ }
+
+ @ApiOperation(value = "根据流程实例id获取流程实例信息和流程状态", notes = "根据流程实例id获取流程实例信息")
+ @GetMapping(value = "/procInstInfoAndStatus/{procInstId}")
+ @ResponseBody
+ @CrossOrigin
+ public Map procInstInfoAndStatus( @PathVariable String procInstId,
+ HttpServletRequest request) {
+ try {
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setRecUserId(userId);
+ searchQuery.setStatus(1);
+ searchQuery.setProcInstId(procInstId);
+ PageResultModel pageResultModel = workflowService.findRecordList(searchQuery);
+ if (pageResultModel == null || pageResultModel.getTotalCount() == 0) {
+ return null;
+ }else {
+ return pageResultModel.getResult().get(0);
+ }
+ } catch (Exception ex) {
+ log.error("获取流程信息 该用户的流程是待办还是已办", ex);
+ return null;
+ }
+ }
+
+ @ApiOperation(value = "获取当前用户流程实例数量", notes = "获取当前用户流程实例数量。status状态值{1:待办,2:已办,3:办结}")
+ @GetMapping(value = "/count/{status}")
+ @ResponseBody
+ public Map getRecordCount( @PathVariable int status,
+ HttpServletRequest request) {
+ try {
+ String userId = SecurityUtils.getLoginUser().getUsername();
+ SearchQuery searchQuery = new SearchQuery();
+ searchQuery.setRecUserId(userId);
+ searchQuery.setStatus(status);
+ return workflowService.getRecordCount(searchQuery);
+ } catch (Exception ex) {
+ log.error("获取当前用户流程实例数量", ex);
+ Map result = new HashMap<>();
+ result.put("count", 0);
+ return result;
+ }
+ }
+
+ @ApiOperation(value = "根据父流程实例id获取该流程的子流程,从而处理子流程", notes = "根据父流程实例id获取该流程的子流程,从而处理子流程")
+ @GetMapping(value = "/subprocess/{status}/{procInstId}")
+ public List