```refactor(workflow): 更改沈总审批为总经理审批并新增商品粮轮换申报

- 在多个工作流服务实现中,将“沈总审批”步骤更改为“总经理审批”。
- 新增“商品粮轮换申报”工作流服务实现。
- 更新工作流类型枚举,将“轮换申报”描述更新为“储备粮轮换申报”,并新增“商品粮轮换申报”类型。BREAKING CHANGE: “沈总审批”更名为“总经理审批”,可能影响依赖特定审批流程的工作流。新增的商品粮轮换申报工作流服务实现需要在相关工作流中进行配置。
```
This commit is contained in:
lijiaqi 2024-08-09 10:04:25 +08:00
parent abe07eef3d
commit 6b1231415a
7 changed files with 280 additions and 31 deletions

View File

@ -92,18 +92,18 @@ public class BudgetWorkFlowService implements IWorkFlowType {
.like(User::getRoles, role.getId()) .like(User::getRoles, role.getId())
); );
if (CollUtil.isNotEmpty(nextUserList) && "1".equals(type)) { if (CollUtil.isNotEmpty(nextUserList) && "1".equals(type)) {
//找到总账号 //找到经理账号
Config admin = configService.getOne(new QueryWrapper<Config>().lambda() Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin") .eq(Config::getParamKey, "sys.admin")
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda() User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue()) .eq(User::getLoginName, admin.getParamValue())
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置经理账号");
nextUserList = new ArrayList<User>(); nextUserList = new ArrayList<User>();
nextUserList.add(adminUser); nextUserList.add(adminUser);
} }
@ -177,7 +177,7 @@ public class BudgetWorkFlowService implements IWorkFlowType {
// 2.2 预算申请第三步 购销仓储部负责人审批 // 2.2 预算申请第三步 购销仓储部负责人审批
return third(vo, workFlow, workFlowStep); return third(vo, workFlow, workFlowStep);
case 4: case 4:
// 2.3 预算申请第四步 总审批 // 2.3 预算申请第四步 经理审批
return fourth(vo, workFlow, workFlowStep); return fourth(vo, workFlow, workFlowStep);
default: default:
throw new ResultException("流程环节错误"); throw new ResultException("流程环节错误");
@ -311,25 +311,25 @@ public class BudgetWorkFlowService implements IWorkFlowType {
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus()); workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
flag = workFlowService.updateById(workFlow); flag = workFlowService.updateById(workFlow);
// 4.找到总审批 // 4.找到经理审批
Config admin = configService.getOne(new QueryWrapper<Config>().lambda() Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin") .eq(Config::getParamKey, "sys.admin")
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda() User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue()) .eq(User::getLoginName, admin.getParamValue())
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置经理账号");
// 5.添加下一步流程环节 // 5.添加下一步流程环节
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(), WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), ""); adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
flag = workFlowStepService.save(nextWorkFlowStep); flag = workFlowStepService.save(nextWorkFlowStep);
// 6.通知总账号 // 6.通知经理账号
String title = String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() + user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
"待您审批"; "待您审批";

View File

@ -147,7 +147,7 @@ public class FumigationWorkFlowService implements IWorkFlowType {
// 2.3 熏蒸申报第四步 购销仓储部负责人审批 // 2.3 熏蒸申报第四步 购销仓储部负责人审批
return fourth(vo, workFlow, workFlowStep); return fourth(vo, workFlow, workFlowStep);
case 5: case 5:
// 2.4 熏蒸申报第五步 总审批 // 2.4 熏蒸申报第五步 经理审批
return fifth(vo, workFlow, workFlowStep); return fifth(vo, workFlow, workFlowStep);
case 6: case 6:
// 2.5 熏蒸申报第六步 粮食与物资管理科角色审批 // 2.5 熏蒸申报第六步 粮食与物资管理科角色审批
@ -300,25 +300,25 @@ public class FumigationWorkFlowService implements IWorkFlowType {
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus()); workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
flag = workFlowService.updateById(workFlow); flag = workFlowService.updateById(workFlow);
// 4.找到总账号 // 4.找到经理账号
Config admin = configService.getOne(new QueryWrapper<Config>().lambda() Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin") .eq(Config::getParamKey, "sys.admin")
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda() User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue()) .eq(User::getLoginName, admin.getParamValue())
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置经理账号");
// 5.添加下一步流程环节 // 5.添加下一步流程环节
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(), WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), ""); adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
flag = workFlowStepService.save(nextWorkFlowStep); flag = workFlowStepService.save(nextWorkFlowStep);
// 6.通知总账号 // 6.通知经理账号
User user = userService.getById(workFlow.getUserId()); User user = userService.getById(workFlow.getUserId());
String title = String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() + user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +

View File

@ -0,0 +1,244 @@
package com.ydool.oa.workFlow.engine.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.exception.ResultException;
import com.ydool.oa.workFlow.data.entity.WorkFlow;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
import com.ydool.oa.workFlow.data.entity.WorkFlowStep;
import com.ydool.oa.workFlow.data.entity.WorkFlowStepLog;
import com.ydool.oa.workFlow.data.vo.WorkFlowStepVo;
import com.ydool.oa.workFlow.engine.service.IWorkFlowType;
import com.ydool.oa.workFlow.enums.WorkFlowStatusEnum;
import com.ydool.oa.workFlow.enums.WorkFlowStepStatusEnum;
import com.ydool.oa.workFlow.enums.WorkFlowStepTypeEnum;
import com.ydool.oa.workFlow.enums.WorkFlowTypeEnum;
import com.ydool.oa.workFlow.service.WorkFlowNoticeService;
import com.ydool.oa.workFlow.service.WorkFlowService;
import com.ydool.oa.workFlow.service.WorkFlowStepLogService;
import com.ydool.oa.workFlow.service.WorkFlowStepService;
import com.ydool.system.entity.Config;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.Role;
import com.ydool.system.entity.User;
import com.ydool.system.service.impl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class GoodsWorkFlowService implements IWorkFlowType {
@Autowired
private WorkFlowService workFlowService;
@Autowired
private WorkFlowStepService workFlowStepService;
@Autowired
private WorkFlowStepLogService workFlowStepLogService;
@Autowired
private WorkFlowNoticeService workFlowNoticeService;
@Autowired
private UserServiceImpl userService;
@Autowired
private JobServiceImpl jobService;
@Autowired
private ConfigServiceImpl configService;
@Autowired
private RoleServiceImpl roleService;
@Autowired
private DeptServiceImpl deptService;
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult first(WorkFlow workFlow) {
User user = userService.getById(workFlow.getUserId());
//是否购销仓储部负责人
Dept dept = deptService.getById(user.getDept());
List<Role> roles = roleService.listByIds(Arrays.asList(user.getRoles().split(",")));
List<String> roleNames = roles.stream().map(Role::getName).collect(Collectors.toList());
if (!("购销仓储部".equals(dept.getName()) && roleNames.contains("部门负责人")))
throw new ResultException("您不是购销仓储部负责人,无法发起流程");
// 1.流程step+1
workFlow.setStep(workFlow.getStep() + 1);
workFlow.setStepType(WorkFlowStepTypeEnum.APPROVAL.getType());
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
boolean flag = workFlowService.updateById(workFlow);
// 2.找到总经理账号
Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin")
.last("limit 1")
);
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue())
.last("limit 1")
);
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总经理账号");
// 3.添加下一步流程环节
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
flag = workFlowStepService.save(nextWorkFlowStep);
// 4.通知总经理账号
String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
"待您审批";
WorkFlowNotice workFlowNotice = new WorkFlowNotice(title, workFlow, adminUser.getId());
flag = workFlowNoticeService.save(workFlowNotice);
if (flag){
return AjaxResult.ok().msg("发起成功");
}else {
throw new ResultException("发起失败");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult execute(WorkFlowStepVo vo, WorkFlow workFlow) {
// 1.查询当前流程环节 并且执行人是当前登录人
WorkFlowStep workFlowStep = workFlowStepService.getOne(new QueryWrapper<WorkFlowStep>().lambda()
.eq(WorkFlowStep::getFlowId, workFlow.getId())
.eq(WorkFlowStep::getStep, workFlow.getStep())
.eq(WorkFlowStep::getUserId, StpUtil.getLoginIdAsString())
.last("limit 1")
);
if (ObjUtil.isNull(workFlowStep)) throw new ResultException("您不是当前流程环节执行人");
// 2.判断执行哪个方法
switch (workFlow.getStep()) {
case 2:
// 2.1 商品粮轮换申报第二步 总经理审批
return second(vo, workFlow, workFlowStep);
case 3:
// 2.2 商品粮轮换申报第三步 粮食与物资管理科角色审批
return third(vo, workFlow, workFlowStep);
default:
throw new ResultException("流程环节错误");
}
}
@Transactional(rollbackFor = Exception.class)
public AjaxResult second(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
User user = userService.getById(workFlow.getUserId());
// 1.流程环节进行变更
workFlowStep.setStatus(WorkFlowStepStatusEnum.PASS.getStatus());
workFlowStep.setRemarks(vo.getRemarks());
boolean flag = workFlowStepService.updateById(workFlowStep);
// 2.记录流程环节日志
WorkFlowStepLog workFlowStepLog = new WorkFlowStepLog(workFlowStep, workFlow.getData());
flag = workFlowStepLogService.save(workFlowStepLog);
// 3.流程step+1 进入下一步
workFlow.setStep(workFlow.getStep() + 1);
workFlow.setStepType(WorkFlowStepTypeEnum.APPROVAL.getType());
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
flag = workFlowService.updateById(workFlow);
// 4.找到粮食与物资管理科角色
Role nextRole = roleService.getOne(new QueryWrapper<Role>().lambda()
.eq(Role::getName, "粮食与物资管理科")
.last("limit 1")
);
if (ObjUtil.isNull(nextRole)) throw new ResultException("系统未配置粮食与物资管理科角色");
List<User> nextUserList = userService.list(new QueryWrapper<User>().lambda()
.like(User::getRoles, nextRole.getId())
);
// 5.添加下一步流程环节
if (CollUtil.isEmpty(nextUserList)) throw new ResultException("系统未配置粮食与物资管理科账号");
List<WorkFlowStep> nextWorkFlowStepList = new ArrayList<WorkFlowStep>();
for (User nextUser : nextUserList) {
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
nextUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
nextWorkFlowStepList.add(nextWorkFlowStep);
}
flag = workFlowStepService.saveBatch(nextWorkFlowStepList);
List<WorkFlowNotice> nextWorkFlowNoticeList = new ArrayList<WorkFlowNotice>();
// 6.通知粮食与物资管理科角色
for (User nextUser : nextUserList) {
String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
"待您审批";
WorkFlowNotice workFlowNotice = new WorkFlowNotice(title, workFlow, nextUser.getId());
nextWorkFlowNoticeList.add(workFlowNotice);
}
flag = workFlowNoticeService.saveBatch(nextWorkFlowNoticeList);
if (flag){
return AjaxResult.ok().msg("审批成功");
}else {
throw new ResultException("审批失败");
}
}
@Transactional(rollbackFor = Exception.class)
public AjaxResult third(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
// 1.流程环节进行变更
workFlowStep.setStatus(WorkFlowStepStatusEnum.PASS.getStatus());
workFlowStep.setRemarks(vo.getRemarks());
boolean flag = workFlowStepService.updateById(workFlowStep);
// 2.记录流程环节日志
WorkFlowStepLog workFlowStepLog = new WorkFlowStepLog(workFlowStep, workFlow.getData());
flag = workFlowStepLogService.save(workFlowStepLog);
// 3.流程完结
workFlow.setStep(workFlow.getStep() + 1);
workFlow.setStepType(WorkFlowStepTypeEnum.END.getType());
workFlow.setStatus(WorkFlowStatusEnum.PASS.getStatus());
flag = workFlowService.updateById(workFlow);
// 4.添加完结流程环节
WorkFlowStep doneWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.END.getType(),
StpUtil.getLoginIdAsString(), WorkFlowStepStatusEnum.DONE.getStatus(), "");
flag = workFlowStepService.save(doneWorkFlowStep);
// 5.记录完结流程环节日志
WorkFlowStepLog doneWorkFlowStepLog = new WorkFlowStepLog(doneWorkFlowStep, workFlow.getData());
flag = workFlowStepLogService.save(doneWorkFlowStepLog);
// 6.通知发起人
String title =
"您的" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
"已通过审批";
WorkFlowNotice workFlowNotice = new WorkFlowNotice(title, workFlow, workFlow.getUserId());
flag = workFlowNoticeService.save(workFlowNotice);
if (flag){
return AjaxResult.ok().msg("审批成功");
}else {
throw new ResultException("审批失败");
}
}
@Override
public String getName() {
return "goods";
}
}

View File

@ -157,7 +157,7 @@ public class LeaveWorkFlowService implements IWorkFlowType {
// 2.1 请假流程第二步 上级领导账号审批或直接结束 // 2.1 请假流程第二步 上级领导账号审批或直接结束
return second(vo, workFlow, workFlowStep); return second(vo, workFlow, workFlowStep);
case 3: case 3:
// 2.2 请假流程第三步 总账号审批 // 2.2 请假流程第三步 经理账号审批
return third(vo, workFlow, workFlowStep); return third(vo, workFlow, workFlowStep);
default: default:
throw new ResultException("流程环节错误"); throw new ResultException("流程环节错误");
@ -266,25 +266,25 @@ public class LeaveWorkFlowService implements IWorkFlowType {
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus()); workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
flag = workFlowService.updateById(workFlow); flag = workFlowService.updateById(workFlow);
// 4.找到总账号 // 4.找到经理账号
Config admin = configService.getOne(new QueryWrapper<Config>().lambda() Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin") .eq(Config::getParamKey, "sys.admin")
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda() User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue()) .eq(User::getLoginName, admin.getParamValue())
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置经理账号");
// 5.添加下一步流程环节 // 5.添加下一步流程环节
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(), WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), ""); adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
flag = workFlowStepService.save(nextWorkFlowStep); flag = workFlowStepService.save(nextWorkFlowStep);
// 6.通知总账号 // 6.通知经理账号
User user = userService.getById(workFlow.getUserId()); User user = userService.getById(workFlow.getUserId());
String title = String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() + user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +

View File

@ -161,7 +161,7 @@ public class RepairWorkFlowService implements IWorkFlowType {
// 2.1维修决算申报第二步 部门或库点负责人审批审批 // 2.1维修决算申报第二步 部门或库点负责人审批审批
return second(vo, workFlow, workFlowStep); return second(vo, workFlow, workFlowStep);
case 3: case 3:
// 2.2 维修决算申报第三步 总审批审批 // 2.2 维修决算申报第三步 经理审批审批
return third(vo, workFlow, workFlowStep); return third(vo, workFlow, workFlowStep);
default: default:
throw new ResultException("流程环节错误"); throw new ResultException("流程环节错误");
@ -186,25 +186,25 @@ public class RepairWorkFlowService implements IWorkFlowType {
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus()); workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
flag = workFlowService.updateById(workFlow); flag = workFlowService.updateById(workFlow);
// 4.找到总账号 // 4.找到经理账号
Config admin = configService.getOne(new QueryWrapper<Config>().lambda() Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin") .eq(Config::getParamKey, "sys.admin")
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda() User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue()) .eq(User::getLoginName, admin.getParamValue())
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置经理账号");
// 5.添加下一步流程环节 // 5.添加下一步流程环节
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(), WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), ""); adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
flag = workFlowStepService.save(nextWorkFlowStep); flag = workFlowStepService.save(nextWorkFlowStep);
// 6.通知总账号 // 6.通知经理账号
String title = String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() + user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
"待您审批"; "待您审批";

View File

@ -81,25 +81,25 @@ public class RotationWorkFlowService implements IWorkFlowType {
workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus()); workFlow.setStatus(WorkFlowStatusEnum.ACTIVE.getStatus());
boolean flag = workFlowService.updateById(workFlow); boolean flag = workFlowService.updateById(workFlow);
// 2.找到总账号 // 2.找到经理账号
Config admin = configService.getOne(new QueryWrapper<Config>().lambda() Config admin = configService.getOne(new QueryWrapper<Config>().lambda()
.eq(Config::getParamKey, "sys.admin") .eq(Config::getParamKey, "sys.admin")
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(admin)) throw new ResultException("系统未配置经理账号");
User adminUser = userService.getOne(new QueryWrapper<User>().lambda() User adminUser = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getLoginName, admin.getParamValue()) .eq(User::getLoginName, admin.getParamValue())
.last("limit 1") .last("limit 1")
); );
if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置总账号"); if (ObjUtil.isNull(adminUser)) throw new ResultException("系统未配置经理账号");
// 3.添加下一步流程环节 // 3.添加下一步流程环节
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(), WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), ""); adminUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
flag = workFlowStepService.save(nextWorkFlowStep); flag = workFlowStepService.save(nextWorkFlowStep);
// 4.通知总账号 // 4.通知经理账号
String title = String title =
user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() + user.getUserName() + "" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
"待您审批"; "待您审批";
@ -127,10 +127,10 @@ public class RotationWorkFlowService implements IWorkFlowType {
// 2.判断执行哪个方法 // 2.判断执行哪个方法
switch (workFlow.getStep()) { switch (workFlow.getStep()) {
case 2: case 2:
// 2.1 轮换申报第二步 总审批 // 2.1 储备粮轮换申报第二步 经理审批
return second(vo, workFlow, workFlowStep); return second(vo, workFlow, workFlowStep);
case 3: case 3:
// 2.2 轮换申报第三步 粮食与物资管理科角色审批 // 2.2 储备粮轮换申报第三步 粮食与物资管理科角色审批
return third(vo, workFlow, workFlowStep); return third(vo, workFlow, workFlowStep);
default: default:
throw new ResultException("流程环节错误"); throw new ResultException("流程环节错误");

View File

@ -8,9 +8,9 @@ public enum WorkFlowTypeEnum {
FUMIGATION("fumigation", "熏蒸申报"), FUMIGATION("fumigation", "熏蒸申报"),
/** /**
* 轮换申报 * 储备粮轮换申报
*/ */
ROTATION("rotation", "轮换申报"), ROTATION("rotation", "储备粮轮换申报"),
/** /**
* 药剂领用 * 药剂领用
@ -31,6 +31,11 @@ public enum WorkFlowTypeEnum {
* 请假申请 * 请假申请
*/ */
LEAVE("leave", "请假申请"), LEAVE("leave", "请假申请"),
/**
* 商品粮轮换申报
*/
GOODS("goods", "商品粮轮换申报"),
; ;