| @@ -49,6 +49,7 @@ | |||
| <artifactId>core</artifactId> | |||
| <version>3.3.3</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| @@ -0,0 +1,223 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.enums.EnumFlowKey; | |||
| import com.iformall.service.FlowableService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.flowable.bpmn.model.BpmnModel; | |||
| import org.flowable.common.engine.impl.identity.Authentication; | |||
| import org.flowable.engine.*; | |||
| import org.flowable.engine.runtime.Execution; | |||
| import org.flowable.engine.runtime.ProcessInstance; | |||
| import org.flowable.engine.task.Comment; | |||
| import org.flowable.image.ProcessDiagramGenerator; | |||
| import org.flowable.task.api.Task; | |||
| import org.flowable.task.api.history.HistoricTaskInstance; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.InputStream; | |||
| import java.io.OutputStream; | |||
| import java.util.*; | |||
| @RestController | |||
| @Api(description = "工作流相关接口") | |||
| @RequestMapping(value = "workflow") | |||
| public class FlowAbleController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private RuntimeService runtimeService; | |||
| @Autowired | |||
| private TaskService taskService; | |||
| @Autowired | |||
| private RepositoryService repositoryService; | |||
| @Autowired | |||
| private ProcessEngine processEngine; | |||
| @ApiOperation("启动流程") | |||
| @PostMapping("/start") | |||
| public ResultData start(@RequestBody Map<String, String> params) { | |||
| logger.debug("[" + getIpAddr() + "] FlowAbleController::start"); | |||
| try{ | |||
| //设置发起人 | |||
| Authentication.setAuthenticatedUserId(super.getUser().getId().toString()); | |||
| String firstTaskUserId = params.get("firstTaskUserId"); | |||
| String secondTaskUserId = params.get("secondTaskUserId"); | |||
| String remark = params.get("remark"); | |||
| HashMap<String, Object> map = new HashMap<>(); | |||
| // 设置节点处理人 | |||
| map.put("firstTaskUser", firstTaskUserId); | |||
| map.put("secondTaskUser", secondTaskUserId); | |||
| // map info | |||
| map.put("starterId", super.getUser().getId()); | |||
| map.put("starter", super.getUser().getName()); | |||
| map.put("startTime",new Date().getTime()); | |||
| map.put("remark",remark); | |||
| ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(EnumFlowKey.CONTRACT.getCode(), map); | |||
| logger.debug("流程启动,流程id:{}",processInstance.getId()); | |||
| return new ResultData(); | |||
| }catch (Exception e){ | |||
| logger.error("启动流程发生错误",e); | |||
| throw new RuntimeException(e); | |||
| }finally { | |||
| Authentication.setAuthenticatedUserId(null); | |||
| } | |||
| } | |||
| /** | |||
| * 用户代办列表 | |||
| */ | |||
| @ApiOperation("用户代办列表") | |||
| @PostMapping(value = "/list") | |||
| @ResponseBody | |||
| public Object list(@RequestBody Map<String, Object> params) { | |||
| String userId = (String)params.get("userId"); | |||
| Integer flowType = (Integer)params.get("flowType"); //1合同审批 2账单审批 | |||
| String flowKey = ""; | |||
| if(1 == flowType){ | |||
| flowKey = EnumFlowKey.CONTRACT.getCode(); | |||
| }else if(2 == flowType){ | |||
| flowKey = EnumFlowKey.BILL.getCode(); | |||
| } | |||
| List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(flowKey).taskCandidateUser(userId).orderByTaskCreateTime().desc().list(); | |||
| List<Map<String,Object>> result = new ArrayList<>(); | |||
| for (Task task : tasks) { | |||
| Map<String,Object> taskInfoMap = new HashedMap(); | |||
| taskInfoMap.put("starter",taskService.getVariable(task.getId(),"starter")); | |||
| taskInfoMap.put("startTime",taskService.getVariable(task.getId(),"startTime")); | |||
| taskInfoMap.put("processInstanceId",task.getProcessInstanceId()); | |||
| taskInfoMap.put("taskId",task.getId()); | |||
| result.add(taskInfoMap); | |||
| } | |||
| return new ResultData(result); | |||
| } | |||
| /** | |||
| * 审批 | |||
| */ | |||
| @ApiOperation("审批") | |||
| @PostMapping(value = "apply") | |||
| public ResultData apply(@RequestBody Map<String, String> params) { | |||
| String taskId = params.get("taskId"); | |||
| String processInstanceId = params.get("processInstanceId"); | |||
| String remark = params.get("remark"); | |||
| Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); | |||
| if (task == null) { | |||
| throw new RuntimeException("流程不存在"); | |||
| } | |||
| taskService.addComment(taskId,processInstanceId,remark); | |||
| taskService.complete(taskId); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 驳回 | |||
| */ | |||
| @ApiOperation("驳回") | |||
| @PostMapping(value = "reject") | |||
| public ResultData reject(@RequestBody Map<String, String> params) { | |||
| String taskId = params.get("taskId"); | |||
| String processInstanceId = params.get("processInstanceId"); | |||
| String remark = params.get("remark"); | |||
| taskService.addComment(taskId,processInstanceId,remark); | |||
| runtimeService.deleteProcessInstance(processInstanceId, "驳回"); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 审批记录 | |||
| * | |||
| * @param processInstanceId 流程实例ID | |||
| */ | |||
| @ApiOperation("审批记录") | |||
| @PostMapping(value = "applyHistory") | |||
| @ResponseBody | |||
| public String applyHistory(String processInstanceId) { | |||
| List<HistoricTaskInstance> list = processEngine.getHistoryService() | |||
| .createHistoricTaskInstanceQuery() | |||
| .processInstanceId(processInstanceId) | |||
| .list(); | |||
| if (list != null && list.size() > 0) { | |||
| for (HistoricTaskInstance hti : list) { | |||
| System.out.print("taskId:" + hti.getId()+","); | |||
| System.out.print("name:" + hti.getName()+","); | |||
| System.out.print("pdId:" + hti.getProcessDefinitionId()+","); | |||
| System.out.print("assignee:" + hti.getAssignee()+","); | |||
| List<Comment> commentList = taskService.getTaskComments(hti.getId()); | |||
| for (Comment c:commentList) { | |||
| System.out.println("备注:"+c.getFullMessage()); | |||
| } | |||
| System.out.println("===================================="); | |||
| } | |||
| } | |||
| return "ok!"; | |||
| } | |||
| /** | |||
| * 生成流程图 | |||
| * | |||
| * @param processId 任务ID | |||
| */ | |||
| @GetMapping(value = "processDiagram") | |||
| public void genProcessDiagram(HttpServletResponse httpServletResponse, String processId) throws Exception { | |||
| ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); | |||
| //流程走完的不显示图 | |||
| if (pi == null) { | |||
| return; | |||
| } | |||
| Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); | |||
| //使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象 | |||
| String InstanceId = task.getProcessInstanceId(); | |||
| List<Execution> executions = runtimeService | |||
| .createExecutionQuery() | |||
| .processInstanceId(InstanceId) | |||
| .list(); | |||
| //得到正在执行的Activity的Id | |||
| List<String> activityIds = new ArrayList<>(); | |||
| List<String> flows = new ArrayList<>(); | |||
| for (Execution exe : executions) { | |||
| List<String> ids = runtimeService.getActiveActivityIds(exe.getId()); | |||
| activityIds.addAll(ids); | |||
| } | |||
| //获取流程图 | |||
| BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId()); | |||
| ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration(); | |||
| ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator(); | |||
| InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engconf.getActivityFontName(), engconf.getLabelFontName(), engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0,true); | |||
| OutputStream out = null; | |||
| byte[] buf = new byte[1024]; | |||
| int legth = 0; | |||
| try { | |||
| out = httpServletResponse.getOutputStream(); | |||
| while ((legth = in.read(buf)) != -1) { | |||
| out.write(buf, 0, legth); | |||
| } | |||
| } finally { | |||
| if (in != null) { | |||
| in.close(); | |||
| } | |||
| if (out != null) { | |||
| out.close(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.enums.EnumFlowPermissionType; | |||
| import com.iformall.service.*; | |||
| import com.iformall.shiro.PasswordHelper; | |||
| import com.iformall.shiro.UserSession; | |||
| @@ -14,6 +15,7 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -23,6 +25,7 @@ import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| @@ -372,4 +375,20 @@ public class MallUserInfoController extends BaseController { | |||
| return new ResultData(Result.ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation(value = "审批权限用户列表", response = String.class) | |||
| @GetMapping("getFlowPermissionList") | |||
| public ResultData getFlowPermissionList() { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::getFlowPermissionList"); | |||
| MallUserInfo mallUserInfo = new MallUserInfo(); | |||
| mallUserInfo.setFlowPermission(EnumFlowPermissionType.CONTRACT.getCode()+""); | |||
| List<MallUserInfo> contractUserList = userInfoService.findList(mallUserInfo); | |||
| mallUserInfo.setFlowPermission(EnumFlowPermissionType.BILL.getCode()+""); | |||
| List<MallUserInfo> billUserList = userInfoService.findList(mallUserInfo); | |||
| Map<String,Object> resultMap = new HashedMap(); | |||
| resultMap.put("contractUserList",contractUserList); | |||
| resultMap.put("billUserList",billUserList); | |||
| return new ResultData(resultMap); | |||
| } | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| package com.iformall.flowable; | |||
| import org.flowable.engine.delegate.TaskListener; | |||
| import org.flowable.task.service.delegate.DelegateTask; | |||
| public class BossTaskHandler implements TaskListener { | |||
| @Override | |||
| public void notify(DelegateTask delegateTask) { | |||
| delegateTask.setAssignee("老板"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.iformall.flowable; | |||
| import org.flowable.spring.SpringProcessEngineConfiguration; | |||
| import org.flowable.spring.boot.EngineConfigurationConfigurer; | |||
| import org.springframework.context.annotation.Configuration; | |||
| /** | |||
| * @author haiyangp | |||
| * date: 2018/4/7 | |||
| * desc: flowable配置----为放置生成的流程图中中文乱码 | |||
| */ | |||
| @Configuration | |||
| public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> { | |||
| @Override | |||
| public void configure(SpringProcessEngineConfiguration engineConfiguration) { | |||
| engineConfiguration.setActivityFontName("宋体"); | |||
| engineConfiguration.setLabelFontName("宋体"); | |||
| engineConfiguration.setAnnotationFontName("宋体"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.iformall.flowable; | |||
| import org.flowable.engine.delegate.TaskListener; | |||
| import org.flowable.task.service.delegate.DelegateTask; | |||
| public class ManagerTaskHandler implements TaskListener { | |||
| @Override | |||
| public void notify(DelegateTask delegateTask) { | |||
| delegateTask.setAssignee("经理"); | |||
| } | |||
| } | |||
| @@ -22,6 +22,8 @@ spring: | |||
| connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" | |||
| #jackson: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| flowable: | |||
| async-executor-activate: false | |||
| # REDIS | |||
| redis: | |||
| @@ -0,0 +1,108 @@ | |||
| <?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:flowable="http://flowable.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" | |||
| typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" | |||
| targetNamespace="http://www.flowable.org/processdef"> | |||
| <process id="Expense" name="ExpenseProcess" isExecutable="true"> | |||
| <documentation>报销流程</documentation> | |||
| <startEvent id="start" name="开始"></startEvent> | |||
| <userTask id="fillTask" name="出差报销" flowable:assignee="${taskUser}"> | |||
| <extensionElements> | |||
| <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"> | |||
| <![CDATA[false]]></modeler:initiator-can-complete> | |||
| </extensionElements> | |||
| </userTask> | |||
| <exclusiveGateway id="judgeTask"></exclusiveGateway> | |||
| <userTask id="directorTak" name="经理审批"> | |||
| <extensionElements> | |||
| <flowable:taskListener event="create" | |||
| class="com.iformall.flowable.ManagerTaskHandler"></flowable:taskListener> | |||
| </extensionElements> | |||
| </userTask> | |||
| <userTask id="bossTask" name="老板审批"> | |||
| <extensionElements> | |||
| <flowable:taskListener event="create" | |||
| class="com.iformall.flowable.BossTaskHandler"></flowable:taskListener> | |||
| </extensionElements> | |||
| </userTask> | |||
| <endEvent id="end" name="结束"></endEvent> | |||
| <sequenceFlow id="directorNotPassFlow" name="驳回" sourceRef="directorTak" targetRef="fillTask"> | |||
| <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression> | |||
| </sequenceFlow> | |||
| <sequenceFlow id="bossNotPassFlow" name="驳回" sourceRef="bossTask" targetRef="fillTask"> | |||
| <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression> | |||
| </sequenceFlow> | |||
| <sequenceFlow id="flow1" sourceRef="start" targetRef="fillTask"></sequenceFlow> | |||
| <sequenceFlow id="flow2" sourceRef="fillTask" targetRef="judgeTask"></sequenceFlow> | |||
| <sequenceFlow id="judgeMore" name="大于500元" sourceRef="judgeTask" targetRef="bossTask"> | |||
| <conditionExpression xsi:type="tFormalExpression"><![CDATA[${money > 500}]]></conditionExpression> | |||
| </sequenceFlow> | |||
| <sequenceFlow id="bossPassFlow" name="通过" sourceRef="bossTask" targetRef="end"> | |||
| <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression> | |||
| </sequenceFlow> | |||
| <sequenceFlow id="directorPassFlow" name="通过" sourceRef="directorTak" targetRef="end"> | |||
| <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression> | |||
| </sequenceFlow> | |||
| <sequenceFlow id="judgeLess" name="小于500元" sourceRef="judgeTask" targetRef="directorTak"> | |||
| <conditionExpression xsi:type="tFormalExpression"><![CDATA[${money <= 500}]]></conditionExpression> | |||
| </sequenceFlow> | |||
| </process> | |||
| <bpmndi:BPMNDiagram id="BPMNDiagram_Expense"> | |||
| <bpmndi:BPMNPlane bpmnElement="Expense" id="BPMNPlane_Expense"> | |||
| <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start"> | |||
| <omgdc:Bounds height="30.0" width="30.0" x="285.0" y="135.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="fillTask" id="BPMNShape_fillTask"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="405.0" y="110.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="judgeTask" id="BPMNShape_judgeTask"> | |||
| <omgdc:Bounds height="40.0" width="40.0" x="585.0" y="130.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="directorTak" id="BPMNShape_directorTak"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="735.0" y="110.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="bossTask" id="BPMNShape_bossTask"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="555.0" y="255.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end"> | |||
| <omgdc:Bounds height="28.0" width="28.0" x="771.0" y="281.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> | |||
| <omgdi:waypoint x="315.0" y="150.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="405.0" y="150.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> | |||
| <omgdi:waypoint x="505.0" y="150.16611295681062"></omgdi:waypoint> | |||
| <omgdi:waypoint x="585.4333333333333" y="150.43333333333334"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="judgeLess" id="BPMNEdge_judgeLess"> | |||
| <omgdi:waypoint x="624.5530726256983" y="150.44692737430168"></omgdi:waypoint> | |||
| <omgdi:waypoint x="735.0" y="150.1392757660167"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="directorNotPassFlow" id="BPMNEdge_directorNotPassFlow"> | |||
| <omgdi:waypoint x="785.0" y="110.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="785.0" y="37.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="455.0" y="37.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="455.0" y="110.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="bossPassFlow" id="BPMNEdge_bossPassFlow"> | |||
| <omgdi:waypoint x="655.0" y="295.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="771.0" y="295.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="judgeMore" id="BPMNEdge_judgeMore"> | |||
| <omgdi:waypoint x="605.4340277777778" y="169.56597222222223"></omgdi:waypoint> | |||
| <omgdi:waypoint x="605.1384083044983" y="255.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="directorPassFlow" id="BPMNEdge_directorPassFlow"> | |||
| <omgdi:waypoint x="785.0" y="190.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="785.0" y="281.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="bossNotPassFlow" id="BPMNEdge_bossNotPassFlow"> | |||
| <omgdi:waypoint x="555.0" y="295.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="455.0" y="295.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="455.0" y="190.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| </bpmndi:BPMNPlane> | |||
| </bpmndi:BPMNDiagram> | |||
| </definitions> | |||
| @@ -0,0 +1,45 @@ | |||
| <?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:flowable="http://flowable.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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef"> | |||
| <process id="contract_flow" name="contractflow" isExecutable="true"> | |||
| <documentation>合同审批流程</documentation> | |||
| <startEvent id="startEvent1"></startEvent> | |||
| <userTask id="firstTask" name="初审" flowable:candidateUsers="${firstTaskUser}"> | |||
| <documentation>初审</documentation> | |||
| </userTask> | |||
| <endEvent id="sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F"></endEvent> | |||
| <sequenceFlow id="sid-AA24EF6A-4416-4FAF-9FF5-E15E46D87BD9" sourceRef="startEvent1" targetRef="firstTask"></sequenceFlow> | |||
| <sequenceFlow id="sid-C4925653-8894-42FF-81F4-412B3D11A3C9" sourceRef="firstTask" targetRef="secondTask"></sequenceFlow> | |||
| <sequenceFlow id="sid-9FCAF465-99E7-4EFE-BEEA-7D59481E684C" sourceRef="secondTask" targetRef="sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F"></sequenceFlow> | |||
| <userTask id="secondTask" name="复审" flowable:candidateUsers="${secondTaskUser}"> | |||
| <documentation>复审</documentation> | |||
| </userTask> | |||
| </process> | |||
| <bpmndi:BPMNDiagram id="BPMNDiagram_contract_flow"> | |||
| <bpmndi:BPMNPlane bpmnElement="contract_flow" id="BPMNPlane_contract_flow"> | |||
| <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1"> | |||
| <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="157.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="firstTask" id="BPMNShape_firstTask"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="285.0" y="132.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F" id="BPMNShape_sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F"> | |||
| <omgdc:Bounds height="28.0" width="28.0" x="835.0" y="158.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="secondTask" id="BPMNShape_secondTask"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="554.0" y="132.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNEdge bpmnElement="sid-C4925653-8894-42FF-81F4-412B3D11A3C9" id="BPMNEdge_sid-C4925653-8894-42FF-81F4-412B3D11A3C9"> | |||
| <omgdi:waypoint x="384.94999999987203" y="172.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="553.9999999998877" y="172.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="sid-9FCAF465-99E7-4EFE-BEEA-7D59481E684C" id="BPMNEdge_sid-9FCAF465-99E7-4EFE-BEEA-7D59481E684C"> | |||
| <omgdi:waypoint x="653.9499999999999" y="172.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="835.0" y="172.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="sid-AA24EF6A-4416-4FAF-9FF5-E15E46D87BD9" id="BPMNEdge_sid-AA24EF6A-4416-4FAF-9FF5-E15E46D87BD9"> | |||
| <omgdi:waypoint x="129.9499996223143" y="172.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="284.9999999998994" y="172.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| </bpmndi:BPMNPlane> | |||
| </bpmndi:BPMNDiagram> | |||
| </definitions> | |||
| @@ -10,14 +10,22 @@ | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>mallinkService</artifactId> | |||
| <!-- | |||
| <dependencies> | |||
| <!-- | |||
| <dependency> | |||
| <groupId>com.iformall</groupId> | |||
| <artifactId>mybatis-tenant</artifactId> | |||
| <version>1.0</version> | |||
| <scope>compile</scope> | |||
| </dependency> | |||
| --> | |||
| <dependency> | |||
| <groupId>org.flowable</groupId> | |||
| <artifactId>flowable-spring-boot-starter-basic</artifactId> | |||
| <version>6.4.0</version> | |||
| </dependency> | |||
| </dependencies> | |||
| --> | |||
| </project> | |||
| @@ -41,8 +41,8 @@ public class MallUserInfo implements Serializable { | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| @@ -94,7 +94,19 @@ public class MallUserInfo implements Serializable { | |||
| @Transient | |||
| private String captcha; | |||
| /**1合同审批 2账单审批**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="flowPermission") | |||
| private String flowPermission; | |||
| public String getFlowPermission() { | |||
| return flowPermission; | |||
| } | |||
| public void setFlowPermission(String flowPermission) { | |||
| this.flowPermission = flowPermission; | |||
| } | |||
| public String getMenus() { | |||
| return menus; | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by luozukai | |||
| * 流程key | |||
| */ | |||
| public enum EnumFlowKey { | |||
| CONTRACT("contract_flow", "合同审批流程key"), | |||
| BILL("bill_flow", "账单审批流程key") | |||
| ; | |||
| public static EnumFlowKey getEnum(Integer code) { | |||
| for (EnumFlowKey value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private String code; | |||
| private String message; | |||
| EnumFlowKey(String code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by luozukai | |||
| */ | |||
| public enum EnumFlowPermissionType { | |||
| // 0无权限 1合同审批 2账单审批 | |||
| DEFAULT(0, "无权限"), | |||
| CONTRACT(1, "合同审批权限"), | |||
| BILL(2, "账单审批权限") | |||
| ; | |||
| public static EnumFlowPermissionType getEnum(Integer code) { | |||
| for (EnumFlowPermissionType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumFlowPermissionType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -96,4 +96,9 @@ public interface MallUserInfoService { | |||
| */ | |||
| MallUserInfo getByOpenId(String openId); | |||
| /** | |||
| * 根据条件用户列表 | |||
| * @return | |||
| */ | |||
| List<MallUserInfo> findList(MallUserInfo record); | |||
| } | |||
| @@ -147,4 +147,10 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public List<MallUserInfo> findList(MallUserInfo record){ | |||
| return mallUserInfoMapper.findList(record); | |||
| } | |||
| } | |||
| @@ -14,10 +14,11 @@ | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | |||
| <result column="open_id" jdbcType="VARCHAR" property="openId"/> | |||
| <result column="flow_permission" property="flowPermission"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`open_id` | |||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`open_id`,`flow_permission` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -67,6 +68,9 @@ | |||
| <if test=" null != openId "> | |||
| and `open_id` = #{openId} | |||
| </if> | |||
| <if test=" null != flowPermission "> | |||
| and JSON_CONTAINS(flow_permission->'$[*]', #{flowPermission}, '$') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||