update
This commit is contained in:
parent
f361186ef4
commit
d5c6b52544
|
@ -141,20 +141,17 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
// 2.1 熏蒸申报第二步 库点分管人(角色)填写
|
||||
return second(vo, workFlow, workFlowStep);
|
||||
case 3:
|
||||
// 2.2 熏蒸申报第三步 库点分管人(角色)审批
|
||||
// 2.2 熏蒸申报第三步 库点负责人(角色)填写审批
|
||||
return third(vo, workFlow, workFlowStep);
|
||||
case 4:
|
||||
// 2.3 熏蒸申报第四步 库点负责人(角色)审批
|
||||
// 2.3 熏蒸申报第四步 购销仓储部负责人审批
|
||||
return fourth(vo, workFlow, workFlowStep);
|
||||
case 5:
|
||||
// 2.4 熏蒸申报第五步 购销仓储部负责人审批
|
||||
// 2.4 熏蒸申报第五步 沈总审批
|
||||
return fifth(vo, workFlow, workFlowStep);
|
||||
case 6:
|
||||
// 2.5 熏蒸申报第六步 沈总审批
|
||||
// 2.5 熏蒸申报第六步 粮食与物资管理科(角色)审批
|
||||
return sixth(vo, workFlow, workFlowStep);
|
||||
case 7:
|
||||
// 2.6 熏蒸申报第七步 粮食与物资管理科(角色)审批
|
||||
return seventh(vo, workFlow, workFlowStep);
|
||||
default:
|
||||
throw new ResultException("流程环节错误");
|
||||
}
|
||||
|
@ -179,66 +176,6 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
workFlow.setData(vo.getData());
|
||||
flag = workFlowService.updateById(workFlow);
|
||||
|
||||
// 4.找到库点分管人账号
|
||||
Role role = roleService.getOne(new QueryWrapper<Role>().lambda()
|
||||
.eq(Role::getName, "库点分管人")
|
||||
.last("limit 1")
|
||||
);
|
||||
if (ObjUtil.isEmpty(role)) {
|
||||
throw new ResultException("未找到库点分管人角色");
|
||||
}
|
||||
List<User> nextUserList = userService.list(new QueryWrapper<User>().lambda()
|
||||
.eq(User::getDept, user.getDept())
|
||||
.like(User::getRoles, role.getId())
|
||||
);
|
||||
if (CollUtil.isEmpty(nextUserList)) {
|
||||
throw new ResultException("未找到库点分管人");
|
||||
}
|
||||
// 5.添加下一步流程环节
|
||||
List<WorkFlowStep> nextWorkFlowStepList = new ArrayList<WorkFlowStep>();
|
||||
nextUserList.forEach(businessDeptUser -> {
|
||||
WorkFlowStep nextWorkFlowStep = new WorkFlowStep(workFlow, WorkFlowStepTypeEnum.APPROVAL.getType(),
|
||||
businessDeptUser.getId(), WorkFlowStepStatusEnum.NOT_START.getStatus(), "");
|
||||
nextWorkFlowStepList.add(nextWorkFlowStep);
|
||||
});
|
||||
flag = workFlowStepService.saveBatch(nextWorkFlowStepList);
|
||||
|
||||
// 6.通知库点分管人账号
|
||||
String title =
|
||||
user.getUserName() + "的" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
|
||||
"待您审批";
|
||||
List<WorkFlowNotice> workFlowNoticeList = new ArrayList<WorkFlowNotice>();
|
||||
nextUserList.forEach(businessDeptUser -> {
|
||||
WorkFlowNotice workFlowNotice = new WorkFlowNotice(title, workFlow, businessDeptUser.getId());
|
||||
workFlowNoticeList.add(workFlowNotice);
|
||||
});
|
||||
flag = workFlowNoticeService.saveBatch(workFlowNoticeList);
|
||||
|
||||
if (flag) {
|
||||
return AjaxResult.ok().msg("审批成功");
|
||||
} else {
|
||||
throw new ResultException("审批失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult third(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 role = roleService.getOne(new QueryWrapper<Role>().lambda()
|
||||
.eq(Role::getName, "库点负责人")
|
||||
|
@ -266,7 +203,7 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
// 6.通知库点负责人账号
|
||||
String title =
|
||||
user.getUserName() + "的" + WorkFlowTypeEnum.valueOf(workFlow.getType().toUpperCase()).getName() +
|
||||
"待您审批";
|
||||
"待您填写审批";
|
||||
List<WorkFlowNotice> workFlowNoticeList = new ArrayList<WorkFlowNotice>();
|
||||
nextUserList.forEach(businessDeptUser -> {
|
||||
WorkFlowNotice workFlowNotice = new WorkFlowNotice(title, workFlow, businessDeptUser.getId());
|
||||
|
@ -281,7 +218,7 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult fourth(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
public AjaxResult third(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
User user = userService.getById(workFlow.getUserId());
|
||||
// 1.流程环节进行变更
|
||||
workFlowStep.setStatus(WorkFlowStepStatusEnum.PASS.getStatus());
|
||||
|
@ -347,7 +284,7 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult fifth(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
public AjaxResult fourth(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
// 1.流程环节进行变更
|
||||
workFlowStep.setStatus(WorkFlowStepStatusEnum.PASS.getStatus());
|
||||
workFlowStep.setRemarks(vo.getRemarks());
|
||||
|
@ -397,7 +334,7 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult sixth(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
public AjaxResult fifth(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
// 1.流程环节进行变更
|
||||
workFlowStep.setStatus(WorkFlowStepStatusEnum.PASS.getStatus());
|
||||
workFlowStep.setRemarks(vo.getRemarks());
|
||||
|
@ -454,9 +391,8 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult seventh(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
public AjaxResult sixth(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
// 1.流程环节进行变更
|
||||
workFlowStep.setStatus(WorkFlowStepStatusEnum.PASS.getStatus());
|
||||
workFlowStep.setRemarks(vo.getRemarks());
|
||||
|
@ -495,6 +431,12 @@ public class FumigationWorkFlowService implements IWorkFlowType {
|
|||
throw new ResultException("审批失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public AjaxResult seventh(WorkFlowStepVo vo, WorkFlow workFlow, WorkFlowStep workFlowStep) {
|
||||
//
|
||||
// }
|
||||
@Override
|
||||
public String getName() {
|
||||
return "fumigation";
|
||||
|
|
Loading…
Reference in New Issue