|
|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.biutag.lan.flow.node; |
|
|
|
package com.biutag.lan.flow.node; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.biutag.enums.RoleEnum; |
|
|
|
import com.biutag.enums.RoleEnum; |
|
|
|
import com.biutag.lan.config.AdminThreadLocal; |
|
|
|
import com.biutag.lan.config.AdminThreadLocal; |
|
|
|
@ -14,14 +16,11 @@ import com.biutag.lan.service.MailService; |
|
|
|
import com.biutag.lan.service.WorkService; |
|
|
|
import com.biutag.lan.service.WorkService; |
|
|
|
import com.biutag.lan.vo.system.DeptVo; |
|
|
|
import com.biutag.lan.vo.system.DeptVo; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
@ -54,23 +53,31 @@ public class SecondDistributeFlow extends Flow { |
|
|
|
Work myWork = workService.getOne(mailId, AdminThreadLocal.getEmpNo()); |
|
|
|
Work myWork = workService.getOne(mailId, AdminThreadLocal.getEmpNo()); |
|
|
|
myWork.setWorkState(Work.State.done.name()).setUpdateTime(now); |
|
|
|
myWork.setWorkState(Work.State.done.name()).setUpdateTime(now); |
|
|
|
workService.updateById(myWork); |
|
|
|
workService.updateById(myWork); |
|
|
|
|
|
|
|
DeptVo deptVo = deptService.detail(mainDeptId); |
|
|
|
JSONObject secondDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId)); |
|
|
|
JSONObject secondDistributeInfo = StrUtil.isNotBlank(mail.getSecondDistributeInfo()) ? JSON.parseObject(mail.getSecondDistributeInfo()) : new JSONObject(); |
|
|
|
if (myWork.getMainDeptFlag()) { |
|
|
|
if (myWork.getMainDeptFlag()) { |
|
|
|
|
|
|
|
secondDistributeInfo.fluentPut("mainDept", JSONObject.of("id", mainDeptId, "name", deptVo.getName())); |
|
|
|
|
|
|
|
// 校验
|
|
|
|
|
|
|
|
valid(mail); |
|
|
|
// 下发信件(主责单位)
|
|
|
|
// 下发信件(主责单位)
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); |
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 非主责
|
|
|
|
// 非主责
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, false, |
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, false, |
|
|
|
FlowNameEnum.SECONDARY_VERIFY.getName(), |
|
|
|
FlowNameEnum.SECONDARY_VERIFY.getName(), |
|
|
|
FlowNodeEnum.VERIFY.getKey()); |
|
|
|
FlowNodeEnum.SECONDARY_VERIFY.getKey()); |
|
|
|
|
|
|
|
if (!secondDistributeInfo.containsKey("secondDept1")) { |
|
|
|
|
|
|
|
secondDistributeInfo.fluentPut("secondDept1", JSONObject.of("id", mainDeptId, "name", deptVo.getName())); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
secondDistributeInfo.fluentPut("secondDept2", JSONObject.of("id", mainDeptId, "name", deptVo.getName())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Integer secondDeptId1 = data.getInteger("secondDeptId1"); |
|
|
|
Integer secondDeptId1 = data.getInteger("secondDeptId1"); |
|
|
|
if (Objects.nonNull(secondDeptId1)) { |
|
|
|
if (Objects.nonNull(secondDeptId1)) { |
|
|
|
// 下发信件(次责单位1)
|
|
|
|
// 下发信件(次责单位1)
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, |
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, |
|
|
|
FlowNameEnum.PENDING_SIGN_CO.getName(), |
|
|
|
FlowNameEnum.PENDING_SIGN_CO.getName(), |
|
|
|
FlowNodeEnum.VERIFY.getKey()); |
|
|
|
FlowNodeEnum.SECONDARY_VERIFY.getKey()); |
|
|
|
secondDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1)); |
|
|
|
secondDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1)); |
|
|
|
} |
|
|
|
} |
|
|
|
Integer secondDeptId2 = data.getInteger("secondDeptId2"); |
|
|
|
Integer secondDeptId2 = data.getInteger("secondDeptId2"); |
|
|
|
@ -78,23 +85,26 @@ public class SecondDistributeFlow extends Flow { |
|
|
|
// 下发信件(次责单位2)
|
|
|
|
// 下发信件(次责单位2)
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, |
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, |
|
|
|
FlowNameEnum.PENDING_SIGN_CO.getName(), |
|
|
|
FlowNameEnum.PENDING_SIGN_CO.getName(), |
|
|
|
FlowNodeEnum.VERIFY.getKey()); |
|
|
|
FlowNodeEnum.SECONDARY_VERIFY.getKey()); |
|
|
|
secondDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2)); |
|
|
|
secondDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2)); |
|
|
|
} |
|
|
|
} |
|
|
|
Flow nextNode = next.get(nextActionKey); |
|
|
|
Flow nextNode = next.get(nextActionKey); |
|
|
|
|
|
|
|
mail.setSecondDistributeInfo(secondDistributeInfo.toJSONString()); |
|
|
|
if (myWork.getMainDeptFlag()) { |
|
|
|
if (myWork.getMainDeptFlag()) { |
|
|
|
// 更新信件
|
|
|
|
// 更新信件
|
|
|
|
DeptVo deptVo = deptService.detail(mainDeptId); |
|
|
|
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
mail.setUpdateTime(now) |
|
|
|
.setFlowKey(nextNode.getFlowNode().getKey()) |
|
|
|
.setFlowKey(nextNode.getFlowNode().getKey()) |
|
|
|
.setFlowName(nextNode.getFlowNode().getBeforeName()) |
|
|
|
.setFlowName(nextNode.getFlowNode().getBeforeName()) |
|
|
|
.setCurrentOperator(String.format("%s专班", deptVo.getName())) |
|
|
|
.setCurrentOperator(String.format("%s专班", deptVo.getName())) |
|
|
|
.setFlowLimitedLastHandlerTime(now) |
|
|
|
.setFlowLimitedLastHandlerTime(now) |
|
|
|
.setThreeDeptId(mainDeptId) |
|
|
|
.setThreeDeptId(mainDeptId) |
|
|
|
.setThreeDeptName(deptVo.getName()) |
|
|
|
.setThreeDeptName(deptVo.getName()); |
|
|
|
.setSecondDistributeInfo(secondDistributeInfo.toJSONString()); |
|
|
|
Integer mainDeptLevel = data.getInteger("mainDeptLevel"); |
|
|
|
mailService.updateById(mail); |
|
|
|
if (Objects.nonNull(mainDeptLevel)) { |
|
|
|
|
|
|
|
mail.setMainDeptLevel(mainDeptLevel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mailService.updateById(mail); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|