Просмотр исходного кода

流程新增——新增我的任务

LLL 1 год назад
Родитель
Сommit
c60ae10eaf

+ 43 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/flowpath/service/impl/ItdmRunFlowPathServiceImpl.java

@@ -11,14 +11,22 @@ import org.jeecg.modules.flowpath.entity.ItdmFlowPathStep;
 import org.jeecg.modules.flowpath.entity.ItdmRunFlowPath;
 import org.jeecg.modules.flowpath.entity.ItdmRunFlowPathStep;
 import org.jeecg.modules.flowpath.mapper.*;
+import org.jeecg.modules.flowpath.service.IItdmFlowPathStepService;
 import org.jeecg.modules.flowpath.service.IItdmRunFlowPathService;
+import org.jeecg.modules.itdmFirstPage.entity.ItdmTask;
+import org.jeecg.modules.itdmFirstPage.service.IItdmTaskService;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.jeecg.modules.weituo.service.IItdmWeituoInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 /**
@@ -49,6 +57,22 @@ public class ItdmRunFlowPathServiceImpl extends ServiceImpl<ItdmRunFlowPathMappe
     @Autowired
     private ItdmFZRunFlowPathLogService logService;
 
+    @Autowired
+    @SuppressWarnings("all")
+    private IItdmTaskService taskService;
+    @Autowired
+    @SuppressWarnings("all")
+    private ISysRoleService roleService;
+    @Autowired
+    @SuppressWarnings("all")
+    private ISysUserService userService;
+    @Autowired
+    @SuppressWarnings("all")
+    private IItdmWeituoInfoService weituoInfoService;
+    @Autowired
+    @SuppressWarnings("all")
+    private IItdmFlowPathStepService flowPathStepService;
+
 
 
     @Override
@@ -89,6 +113,25 @@ public class ItdmRunFlowPathServiceImpl extends ServiceImpl<ItdmRunFlowPathMappe
         itdmRunFlowPath.setStatus("0");
         itdmRunFlowPathMapper.insert(itdmRunFlowPath);
 
+        //新增运行流程后,新增一条我的审批
+        ItdmTask itdmTask = new ItdmTask();
+        if(list.get(0).getRoleId()!=null){
+            String role = roleService.getById(list.get(0).getRoleId()).getRoleName();
+            itdmTask.setTaskRole(role);//待办角色
+        }
+        if(list.get(0).getUserIds()!=null){
+            String userName = userService.getUserByName(list.get(0).getUserIds()).getRealname();
+            itdmTask.setTaskUser(userName);//待办人员
+        }
+        Map<String, Object> weituoMap = new HashMap<>();
+        weituoMap.put("weituo_no",itdmCreateRunFlowPath.getWeituoNo());
+        String weituoId = weituoInfoService.listByMap(weituoMap).get(0).getId();
+        itdmTask.setWeituoId(weituoId);//委托id
+        String taskContent = flowPathStepService.getById(list.get(0).getId()).getName();
+        itdmTask.setTaskContent(taskContent);//当前步骤名
+        itdmTask.setTaskStatus(0);//待办
+        taskService.insertTaskAfterJudge(itdmTask);
+
 
         for (int i = 0; i < list.size(); i++) {
             ItdmFlowPathStep itdmFlowPathStep = list.get(i);

+ 1 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/itdmFirstPage/service/IItdmTaskService.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IItdmTaskService extends IService<ItdmTask> {
 
+    /**先根据待办人员、角色、任务判断是否已存在该任务,不存在再新增*/
     public boolean insertTaskAfterJudge(ItdmTask task);
 
 }

+ 1 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/itdmFirstPage/service/impl/ItdmTaskServiceImpl.java

@@ -24,6 +24,7 @@ public class ItdmTaskServiceImpl extends ServiceImpl<ItdmTaskMapper, ItdmTask> i
     @SuppressWarnings("all")
     private ItdmTaskMapper taskMapper;
 
+    /**先根据待办人员、角色、任务判断是否已存在该任务,不存在再新增*/
     public boolean insertTaskAfterJudge(ItdmTask task) {
         if(task.getTaskUser()!=null){
             ItdmTask queryTask = new ItdmTask();