|
@@ -2,17 +2,14 @@ package org.jeecg.modules.flowpath.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.modules.flowpath.convert.FlowPathConvert;
|
|
|
-import org.jeecg.modules.flowpath.dto.ItdmPassRunFlowPath;
|
|
|
-import org.jeecg.modules.flowpath.dto.ItdmRejectDQRunFlowPath;
|
|
|
-import org.jeecg.modules.flowpath.dto.ItdmRejectZDRunFlowPath;
|
|
|
-import org.jeecg.modules.flowpath.dto.ItdmSaveRunFlowPath;
|
|
|
+import org.jeecg.modules.flowpath.dto.*;
|
|
|
import org.jeecg.modules.flowpath.entity.ItdmRunFlowPath;
|
|
|
import org.jeecg.modules.flowpath.entity.ItdmRunFlowPathStep;
|
|
|
import org.jeecg.modules.flowpath.mapper.ItdmRunFlowPathLogMapper;
|
|
@@ -30,14 +27,9 @@ import org.jeecg.modules.weituo.entity.ItdmWeituoInfo;
|
|
|
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.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -138,41 +130,74 @@ public class ItdmRunFlowPathStepServiceImpl extends ServiceImpl<ItdmRunFlowPathS
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**通过时选择下一步操作的人(不是id,是用户账号)*/
|
|
|
+ public List<String> selectNextStepUser(ItdmPassSelectNextStepUserRunFlowPath runFlowPath) {
|
|
|
+ ItdmRunFlowPath itdmRunFlowPath = this.itdmRunFlowPathMapper.selectById(runFlowPath.getRunFlowPath());
|
|
|
+
|
|
|
+ ItdmRunFlowPathStep select = this.baseMapper.selectOne(Wrappers.lambdaQuery(ItdmRunFlowPathStep.class)
|
|
|
+ .eq(ItdmRunFlowPathStep::getRunFlowPath, itdmRunFlowPath.getId())
|
|
|
+ .eq(ItdmRunFlowPathStep::getFlowPathSetp, itdmRunFlowPath.getDqSetp())
|
|
|
+
|
|
|
+ );
|
|
|
+ ItdmRunFlowPathStep nextstep = this.baseMapper.selectOne(Wrappers.lambdaQuery(ItdmRunFlowPathStep.class)
|
|
|
+ .eq(ItdmRunFlowPathStep::getRunFlowPath, select.getRunFlowPath())
|
|
|
+ .eq(ItdmRunFlowPathStep::getSort, Integer.parseInt(select.getSort()) + 1)
|
|
|
+
|
|
|
+ );
|
|
|
+ String userIds = nextstep.getUserIds();
|
|
|
+ List<String> userIdList = new ArrayList<>();
|
|
|
+ if(userIds!=null && !userIds.equals("")){
|
|
|
+ userIdList = Arrays.asList(userIds.split(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ return userIdList;
|
|
|
+ }
|
|
|
+
|
|
|
/**通过*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
|
|
|
public void pass1(ItdmPassRunFlowPath itdmRunFlowPathStep) {
|
|
|
+ String nextStepUser = itdmRunFlowPathStep.getNextStepUser();//下一步操作人员的登录账号
|
|
|
|
|
|
+ //根据当前运行流程id查当前运行流程
|
|
|
ItdmRunFlowPath itdmRunFlowPath = this.itdmRunFlowPathMapper.selectById(itdmRunFlowPathStep.getRunFlowPath());
|
|
|
|
|
|
-
|
|
|
+ //根据当前运行流程的主键id和当前步骤id——查对应当前运行流程步骤
|
|
|
ItdmRunFlowPathStep select = this.baseMapper.selectOne(Wrappers.lambdaQuery(ItdmRunFlowPathStep.class)
|
|
|
.eq(ItdmRunFlowPathStep::getRunFlowPath, itdmRunFlowPath.getId())
|
|
|
.eq(ItdmRunFlowPathStep::getFlowPathSetp, itdmRunFlowPath.getDqSetp())
|
|
|
-
|
|
|
);
|
|
|
- if (StringUtils.isBlank(select.getSaveData())) {
|
|
|
|
|
|
+ if (StringUtils.isBlank(select.getSaveData())) {
|
|
|
throw new JeecgBootException("数据为空");
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+ //运行流程步骤表修改——最后修改人员(当前登录用户)、审核时间
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
select.setFqUser(user.getUsername());
|
|
|
select.setShenheTime(new Date());
|
|
|
-
|
|
|
this.baseMapper.updateById(select);
|
|
|
+
|
|
|
+ //根据当前运行流程步骤的运行流程id、步骤顺序+1查————当前运行流程的下一运行步骤
|
|
|
ItdmRunFlowPathStep nextstep = this.baseMapper.selectOne(Wrappers.lambdaQuery(ItdmRunFlowPathStep.class)
|
|
|
.eq(ItdmRunFlowPathStep::getRunFlowPath, select.getRunFlowPath())
|
|
|
.eq(ItdmRunFlowPathStep::getSort, Integer.parseInt(select.getSort()) + 1)
|
|
|
-
|
|
|
);
|
|
|
|
|
|
-
|
|
|
+ //下一步为空,运行流程改为结束状态
|
|
|
if (nextstep == null) {
|
|
|
itdmRunFlowPath.setStatus("2");
|
|
|
itdmRunFlowPathMapper.updateById(itdmRunFlowPath);
|
|
|
|
|
|
+ //修改该委托对应的所有任务状态为2完结
|
|
|
+ if(itdmRunFlowPath!=null){
|
|
|
+ Map<String, Object> weituoMap = new HashMap<>();
|
|
|
+ weituoMap.put("weituo_no",itdmRunFlowPath.getWeituoNo());
|
|
|
+ String weituoId = weituoInfoService.listByMap(weituoMap).get(0).getId();
|
|
|
+ taskService.updateByWeituoId(weituoId);
|
|
|
+ }
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -183,9 +208,11 @@ public class ItdmRunFlowPathStepServiceImpl extends ServiceImpl<ItdmRunFlowPathS
|
|
|
weituoMap.put("weituo_no",itdmRunFlowPath.getWeituoNo());
|
|
|
String weituoId = weituoInfoService.listByMap(weituoMap).get(0).getId();
|
|
|
|
|
|
+ //修改当前运行流程的 当前步骤id、当前步骤用户————由下一运行步骤的所属用户改为选择的用户、当前步骤角色
|
|
|
itdmRunFlowPath.setId(select.getRunFlowPath());
|
|
|
itdmRunFlowPath.setDqSetp(nextstep.getFlowPathSetp());
|
|
|
- itdmRunFlowPath.setDqSetpUserIds(nextstep.getUserIds());
|
|
|
+// itdmRunFlowPath.setDqSetpUserIds(nextstep.getUserIds());
|
|
|
+ itdmRunFlowPath.setDqSetpUserIds(nextStepUser);
|
|
|
itdmRunFlowPath.setDqSetpRoleId(nextstep.getRoleId());
|
|
|
itdmRunFlowPathMapper.updateById(itdmRunFlowPath);
|
|
|
|
|
@@ -201,10 +228,11 @@ public class ItdmRunFlowPathStepServiceImpl extends ServiceImpl<ItdmRunFlowPathS
|
|
|
}
|
|
|
// 然后新增一条该步骤的我的任务
|
|
|
String role = roleService.getById(itdmRunFlowPath.getDqSetpRoleId()).getRoleName();
|
|
|
- String userName = userService.getUserByName(itdmRunFlowPath.getDqSetpUserIds().split(",")[0]).getRealname();
|
|
|
+// String userName = userService.getUserByName(itdmRunFlowPath.getDqSetpUserIds().split(",")[0]).getRealname();
|
|
|
+ String userName = userService.getUserByName(itdmRunFlowPath.getDqSetpUserIds().split(",")[0]).getRealname();//真实姓名
|
|
|
ItdmTask itdmTask = new ItdmTask();
|
|
|
itdmTask.setTaskRole(role);
|
|
|
- itdmTask.setTaskUser(userName);
|
|
|
+ itdmTask.setTaskUser(userName);//真实姓名
|
|
|
itdmTask.setWeituoId(weituoId);//委托id
|
|
|
String taskContent = flowPathStepService.getById(nextstep.getFlowPathSetp()).getName();
|
|
|
itdmTask.setTaskContent(taskContent);//当前步骤名
|