|
@@ -11,7 +11,9 @@ import com.google.common.collect.Maps;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.activiti.engine.RuntimeService;
|
|
|
import org.activiti.engine.TaskService;
|
|
|
+import org.activiti.engine.runtime.ProcessInstance;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
+import org.activiti.engine.task.TaskQuery;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.checkerframework.checker.units.qual.Area;
|
|
@@ -24,6 +26,7 @@ import org.jeecg.common.util.RedisUtil;
|
|
|
import org.jeecg.modules.activiti.entity.*;
|
|
|
import org.jeecg.modules.activiti.mapper.TbTableInfoMapper;
|
|
|
import org.jeecg.modules.activiti.service.IActBusinessService;
|
|
|
+import org.jeecg.modules.activiti.service.IActReModelService;
|
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoPracticeService;
|
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoService;
|
|
|
import org.jeecg.modules.activiti.service.Impl.ActBusinessServiceImpl;
|
|
@@ -65,7 +68,10 @@ public class ActBusinessController {
|
|
|
IActBusinessService iActBusinessService;
|
|
|
|
|
|
@Autowired
|
|
|
- TbTableInfoMapper tbTableInfoMapper;
|
|
|
+ private TbTableInfoMapper tbTableInfoMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IActReModelService iActReModelService;
|
|
|
|
|
|
/*添加申请草稿状态*/
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
@@ -112,7 +118,8 @@ public class ActBusinessController {
|
|
|
actBusiness.setTableName(tableName);
|
|
|
actBusiness.setPkOrg(sysUser.getOrgCode());//公司id
|
|
|
actBusinessService.save(actBusiness);
|
|
|
- submit(actBusiness,node);
|
|
|
+ String processInstId = submit(actBusiness,node);
|
|
|
+ SkipFireStep(processInstId,sysUser);
|
|
|
result.success("操作成功");
|
|
|
|
|
|
} catch (IOException e) {
|
|
@@ -123,7 +130,7 @@ public class ActBusinessController {
|
|
|
}
|
|
|
|
|
|
//提交
|
|
|
- public void submit(ActBusiness act,ProcessNodeVo node){
|
|
|
+ public String submit(ActBusiness act,ProcessNodeVo node){
|
|
|
//获取审核人
|
|
|
String assignees="";
|
|
|
if(node.getUsers()!=null){
|
|
@@ -167,6 +174,75 @@ public class ActBusinessController {
|
|
|
actBusiness.setResult(1);
|
|
|
actBusiness.setApplyTime(new Date());
|
|
|
actBusinessService.updateById(actBusiness);
|
|
|
+ return processInstanceId;
|
|
|
+ }
|
|
|
+ // 跳过第一步
|
|
|
+ private void SkipFireStep(String procInstId, LoginUser loginUser) {
|
|
|
+ ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
|
|
|
+
|
|
|
+ List<Task> tasks = taskService.createTaskQuery().processInstanceId(procInstId).list();
|
|
|
+ String firstTaskId = "";
|
|
|
+ if (tasks.size() > 0) {
|
|
|
+ firstTaskId = tasks.get(0).getId();
|
|
|
+ // 完成第一步发起
|
|
|
+ taskService.complete(tasks.get(0).getId());
|
|
|
+
|
|
|
+ // 设置下一步待办
|
|
|
+ tasks = taskService.createTaskQuery().processInstanceId(procInstId).list();
|
|
|
+
|
|
|
+ // 判断下一个节点
|
|
|
+ if (tasks != null && tasks.size() > 0) {
|
|
|
+ //修改公司id
|
|
|
+ List<String> listTaskId = new ArrayList<>();
|
|
|
+ for (Task t : tasks) {
|
|
|
+ listTaskId.add(t.getId());
|
|
|
+ }
|
|
|
+ //修改下一个任务公司id
|
|
|
+ iActReModelService.updateTaskPkOrgById(loginUser.getOrgCode(), listTaskId);
|
|
|
+ //修改已办公司id
|
|
|
+ iActReModelService.updateTaskInstPkOrgByIds(loginUser.getOrgCode(), listTaskId);
|
|
|
+ ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+ for (Task t : tasks) {
|
|
|
+ // 避免重复添加
|
|
|
+ List<String> list = actBusinessService.selectIRunIdentity(t.getId(), "candidate");
|
|
|
+ if (list == null || list.size() == 0) {
|
|
|
+
|
|
|
+ taskService.addCandidateUser(t.getId(), loginUser.getUsername());
|
|
|
+ taskService.setPriority(t.getId(), 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 记录实际审批人员
|
|
|
+ actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
|
|
|
+ ActivitiConstant.EXECUTOR_TYPE, loginUser.getUsername(), firstTaskId, procInstId);
|
|
|
+ /*
|
|
|
+ // 跳过第一步审批人
|
|
|
+ Task task = null;
|
|
|
+ TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(userId).active();
|
|
|
+ List<Task> todoList = query.list();//获取申请人的待办任务列表
|
|
|
+ for (Task tmp : todoList) {
|
|
|
+ if(tmp.getProcessInstanceId().equals(processId)){
|
|
|
+ task = tmp;//获取当前流程实例,当前申请人的待办任务
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取审核人
|
|
|
+ String assignees="";
|
|
|
+ if(nextNode.getUsers()!=null){
|
|
|
+ for(LoginUser l: nextNode.getUsers()){
|
|
|
+ if(assignees.equals("")){
|
|
|
+ assignees=l.getUsername();
|
|
|
+ }else{
|
|
|
+ assignees=assignees+","+l.getUsername();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String,Object> variables = new HashMap<>();
|
|
|
+ variables.put("nextApprover", assignees);//设置下一步办理人的流程变量
|
|
|
+ taskService.complete(task.getId(),variables);*/
|
|
|
}
|
|
|
|
|
|
|