|
|
|
|
@ -8,11 +8,13 @@ import com.biutag.lan.domain.Work;
|
|
|
|
|
import com.biutag.lan.flow.ActionEnum; |
|
|
|
|
import com.biutag.lan.flow.Flow; |
|
|
|
|
import com.biutag.lan.flow.FlowNameEnum; |
|
|
|
|
import com.biutag.lan.flow.FlowNodeEnum; |
|
|
|
|
import com.biutag.lan.service.IDeptService; |
|
|
|
|
import com.biutag.lan.service.MailService; |
|
|
|
|
import com.biutag.lan.service.WorkService; |
|
|
|
|
import com.biutag.lan.vo.system.DeptVo; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
@ -56,33 +58,46 @@ public class SecondDistributeFlow extends Flow {
|
|
|
|
|
List<JSONObject> secondDept = new ArrayList<>(); |
|
|
|
|
JSONObject secondDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId), |
|
|
|
|
"secondDept", secondDept); |
|
|
|
|
// 下发信件(主责单位)
|
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); |
|
|
|
|
|
|
|
|
|
if (myWork.getMainDeptFlag()) { |
|
|
|
|
// 下发信件(主责单位)
|
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); |
|
|
|
|
} else { |
|
|
|
|
// 非主责
|
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, false, |
|
|
|
|
FlowNameEnum.CO_HANDLING.getName(), |
|
|
|
|
FlowNodeEnum.CO_HANDLING.getKey()); |
|
|
|
|
secondDept.add(JSONObject.of("id", mainDeptId)); |
|
|
|
|
} |
|
|
|
|
Integer secondDeptId1 = data.getInteger("secondDeptId1"); |
|
|
|
|
if (Objects.nonNull(secondDeptId1)) { |
|
|
|
|
// 下发信件(次责单位1)
|
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, FlowNameEnum.PENDING_SIGN_CO.getName()); |
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, |
|
|
|
|
FlowNameEnum.PENDING_SIGN_CO.getName(), |
|
|
|
|
FlowNodeEnum.CO_HANDLING.getKey()); |
|
|
|
|
secondDept.add(JSONObject.of("id", secondDeptId1)); |
|
|
|
|
} |
|
|
|
|
Integer secondDeptId2 = data.getInteger("secondDeptId2"); |
|
|
|
|
if (Objects.nonNull(secondDeptId2)) { |
|
|
|
|
// 下发信件(次责单位2)
|
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, FlowNameEnum.PENDING_SIGN_CO.getName()); |
|
|
|
|
workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, |
|
|
|
|
FlowNameEnum.PENDING_SIGN_CO.getName(), |
|
|
|
|
FlowNodeEnum.CO_HANDLING.getKey()); |
|
|
|
|
secondDept.add(JSONObject.of("id", secondDeptId1)); |
|
|
|
|
} |
|
|
|
|
Flow nextNode = next.get(nextActionKey); |
|
|
|
|
// 更新信件
|
|
|
|
|
DeptVo deptVo = deptService.detail(mainDeptId); |
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
|
.setFlowKey(nextNode.getFlowNode().getKey()) |
|
|
|
|
.setFlowBeforeName(nextNode.getFlowNode().getBeforeName()) |
|
|
|
|
.setFlowLimitedLastHandlerTime(now) |
|
|
|
|
.setThreeDeptId(mainDeptId) |
|
|
|
|
.setThreeDeptName(deptVo.getName()) |
|
|
|
|
.setSecondDistributeInfo(secondDistributeInfo.toJSONString()); |
|
|
|
|
mailService.updateById(mail); |
|
|
|
|
return nextNode; |
|
|
|
|
if (myWork.getMainDeptFlag()) { |
|
|
|
|
// 更新信件
|
|
|
|
|
DeptVo deptVo = deptService.detail(mainDeptId); |
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
|
.setFlowKey(nextNode.getFlowNode().getKey()) |
|
|
|
|
.setFlowBeforeName(nextNode.getFlowNode().getBeforeName()) |
|
|
|
|
.setFlowLimitedLastHandlerTime(now) |
|
|
|
|
.setThreeDeptId(mainDeptId) |
|
|
|
|
.setThreeDeptName(deptVo.getName()) |
|
|
|
|
.setSecondDistributeInfo(secondDistributeInfo.toJSONString()); |
|
|
|
|
mailService.updateById(mail); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|