|
|
|
|
@ -1,12 +1,14 @@
|
|
|
|
|
package com.biutag.lan.flow.node; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
|
import cn.hutool.core.date.DatePattern; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
|
import com.biutag.enums.RoleEnum; |
|
|
|
|
import com.biutag.exception.BusinessException; |
|
|
|
|
import com.biutag.lan.AdminThreadLocal; |
|
|
|
|
import com.biutag.lan.config.AdminThreadLocal; |
|
|
|
|
import com.biutag.lan.domain.Mail; |
|
|
|
|
import com.biutag.lan.domain.Work; |
|
|
|
|
import com.biutag.lan.enums.CompleteMethod; |
|
|
|
|
import com.biutag.lan.enums.ExtensionState; |
|
|
|
|
import com.biutag.lan.enums.WorkType; |
|
|
|
|
import com.biutag.lan.flow.ActionEnum; |
|
|
|
|
@ -18,6 +20,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@Component |
|
|
|
|
@ -30,7 +33,7 @@ public class ThreeVerifyFlow extends Flow {
|
|
|
|
|
public Flow next(String nextActionKey, String mailId, JSONObject data) { |
|
|
|
|
// 线下
|
|
|
|
|
if (ActionEnum.offline.name().equals(nextActionKey)) { |
|
|
|
|
throw new BusinessException("功能开发中..."); |
|
|
|
|
return offline(nextActionKey, mailId, data); |
|
|
|
|
} |
|
|
|
|
// 线上
|
|
|
|
|
if (ActionEnum.online.name().equals(nextActionKey)) { |
|
|
|
|
@ -40,23 +43,57 @@ public class ThreeVerifyFlow extends Flow {
|
|
|
|
|
if (ActionEnum.applyExtensionSubmit.name().equals(nextActionKey)) { |
|
|
|
|
return applyExtensionSubmit(mailId, data); |
|
|
|
|
} |
|
|
|
|
// 确认保存
|
|
|
|
|
if (ActionEnum.save.name().equals(nextActionKey)) { |
|
|
|
|
return save(mailId, data); |
|
|
|
|
} |
|
|
|
|
throw new BusinessException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Flow online(String nextActionKey, String mailId, JSONObject data) { |
|
|
|
|
String leaderEmpNo = data.getString("leaderEmpNo"); |
|
|
|
|
Assert.hasText(leaderEmpNo, "未选择上级领导!"); |
|
|
|
|
JSONObject verifyFollowupPoliceObj = data.getJSONObject("verifyFollowupPolice"); |
|
|
|
|
Assert.notNull(verifyFollowupPoliceObj, "参数异常"); |
|
|
|
|
public Flow applyExtensionSubmit(String mailId, JSONObject data) { |
|
|
|
|
Integer extensionDays = data.getInteger("extensionDays"); |
|
|
|
|
Assert.notNull(extensionDays, "延期时长不能为空"); |
|
|
|
|
String reason = data.getString("extensionReason"); |
|
|
|
|
Assert.hasText(reason, "延期理由不能为空"); |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
// 更新信件
|
|
|
|
|
|
|
|
|
|
// 给二级机构增加待办
|
|
|
|
|
workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), WorkType.extension_approval.name(), now); |
|
|
|
|
|
|
|
|
|
Mail mail = mailService.getById(mailId); |
|
|
|
|
Flow nextNode = next.get(nextActionKey); |
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
|
.setExtensionDays(extensionDays) |
|
|
|
|
.setExtensionReason(reason) |
|
|
|
|
.setExtensionState(ExtensionState.applying.name()); |
|
|
|
|
mailService.updateById(mail); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String verifyFollowupPolice = JSONObject.of("name", verifyFollowupPoliceObj.getString("name"), |
|
|
|
|
public Flow save(String mailId, JSONObject data) { |
|
|
|
|
JSONObject verifyFollowupPoliceObj = data.getJSONObject("verifyFollowupPolice"); |
|
|
|
|
Assert.notNull(verifyFollowupPoliceObj, "请填写回访人信息"); |
|
|
|
|
String verifyFollowupPolice = JSONObject |
|
|
|
|
.of("name", verifyFollowupPoliceObj.getString("name"), |
|
|
|
|
"empNo", verifyFollowupPoliceObj.getString("empNo"), |
|
|
|
|
"phone", verifyFollowupPoliceObj.getString("phone")).toJSONString(); |
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
|
JSONObject contactPolice = data.getJSONObject("contactPolice"); |
|
|
|
|
Mail mail = mailService.getById(mailId); |
|
|
|
|
Mail source = new Mail() |
|
|
|
|
// 联系群众
|
|
|
|
|
.setContactPoliceName(Optional.ofNullable(contactPolice).map(item -> item.getString("name")).orElse(null)) |
|
|
|
|
.setContactPoliceEmpNo(Optional.ofNullable(contactPolice).map(item -> item.getString("empNo")).orElse(null)) |
|
|
|
|
.setContactPolicePost(Optional.ofNullable(contactPolice).map(item -> item.getString("post")).orElse(null)) |
|
|
|
|
.setContactTime(Optional.ofNullable(data.getString("contactTime")).map(item -> DateUtil.parseLocalDateTime(item, DatePattern.NORM_DATETIME_PATTERN)).orElse(null)) |
|
|
|
|
.setContactDuration(data.getLong("contactDuration")) |
|
|
|
|
.setContactPoliceEmpNo(data.getString("contactDuration")) |
|
|
|
|
.setContactFlag(data.getBoolean("contactFlag")) |
|
|
|
|
// 群众接访
|
|
|
|
|
.setInterviewType(data.getString("interviewType")) |
|
|
|
|
.setInterviewIsLeader(data.getBoolean("interviewIsLeader")) |
|
|
|
|
.setInterviewPoliceEmpNo(data.getString("interviewPoliceEmpNo")) |
|
|
|
|
.setInterviewPoliceName(data.getString("interviewPoliceName")) |
|
|
|
|
.setInterviewDetails(data.getString("interviewDetails")) |
|
|
|
|
.setInterviewAttachments(data.getString("interviewAttachments")) |
|
|
|
|
// 核查办理
|
|
|
|
|
.setVerifyDetails(data.getString("verifyDetails")) |
|
|
|
|
.setVerifyIsTrue(data.getString("verifyIsTrue")) |
|
|
|
|
.setVerifyReportedPolices(data.getString("verifyReportedPolices")) |
|
|
|
|
@ -66,37 +103,83 @@ public class ThreeVerifyFlow extends Flow {
|
|
|
|
|
.setVerifyIsResolved(data.getBoolean("verifyIsResolved")) |
|
|
|
|
.setVerifyFeedback(data.getString("verifyFeedback")) |
|
|
|
|
.setVerifyFollowupPolice(verifyFollowupPolice) |
|
|
|
|
.setVerifyAttachments(data.getString("verifyAttachments")) |
|
|
|
|
.setVerifyAttachments(data.getString("verifyAttachments")); |
|
|
|
|
BeanUtil.copyProperties(source, mail, CopyOptions.create().setIgnoreNullValue(true)); |
|
|
|
|
mailService.updateById(mail); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void applicationCompleted(String nextActionKey, Mail mail, JSONObject data, LocalDateTime now) { |
|
|
|
|
|
|
|
|
|
JSONObject verifyFollowupPoliceObj = data.getJSONObject("verifyFollowupPolice"); |
|
|
|
|
Assert.notNull(verifyFollowupPoliceObj, "参数异常"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Flow nextNode = next.get(nextActionKey); |
|
|
|
|
|
|
|
|
|
JSONObject contactPolice = data.getJSONObject("contactPolice"); |
|
|
|
|
String verifyFollowupPolice = JSONObject |
|
|
|
|
.of("name", verifyFollowupPoliceObj.getString("name"), |
|
|
|
|
"empNo", verifyFollowupPoliceObj.getString("empNo"), |
|
|
|
|
"phone", verifyFollowupPoliceObj.getString("phone")).toJSONString(); |
|
|
|
|
Mail source = new Mail() |
|
|
|
|
// 联系群众
|
|
|
|
|
.setContactPoliceName(Optional.ofNullable(contactPolice).map(item -> item.getString("name")).orElse(null)) |
|
|
|
|
.setContactPoliceEmpNo(Optional.ofNullable(contactPolice).map(item -> item.getString("empNo")).orElse(null)) |
|
|
|
|
.setContactPolicePost(Optional.ofNullable(contactPolice).map(item -> item.getString("post")).orElse(null)) |
|
|
|
|
.setContactTime(Optional.ofNullable(data.getString("contactTime")).map(item -> DateUtil.parseLocalDateTime(item, DatePattern.NORM_DATETIME_PATTERN)).orElse(null)) |
|
|
|
|
.setContactDuration(data.getLong("contactDuration")) |
|
|
|
|
.setContactPoliceEmpNo(data.getString("contactDuration")) |
|
|
|
|
.setContactFlag(data.getBoolean("contactFlag")) |
|
|
|
|
// 群众接访
|
|
|
|
|
.setInterviewType(data.getString("interviewType")) |
|
|
|
|
.setInterviewIsLeader(data.getBoolean("interviewIsLeader")) |
|
|
|
|
.setInterviewPoliceEmpNo(data.getString("interviewPoliceEmpNo")) |
|
|
|
|
.setInterviewPoliceName(data.getString("interviewPoliceName")) |
|
|
|
|
.setInterviewDetails(data.getString("interviewDetails")) |
|
|
|
|
.setInterviewAttachments(data.getString("interviewAttachments")) |
|
|
|
|
// 核查办理
|
|
|
|
|
.setVerifyDetails(data.getString("verifyDetails")) |
|
|
|
|
.setVerifyIsTrue(data.getString("verifyIsTrue")) |
|
|
|
|
.setVerifyReportedPolices(data.getString("verifyReportedPolices")) |
|
|
|
|
.setVerifyProblem(data.getString("verifyProblem")) |
|
|
|
|
.setVerifyNeedAccountability(data.getBoolean("verifyNeedAccountability")) |
|
|
|
|
.setVerifyPunish(data.getString("verifyPunish")) |
|
|
|
|
.setVerifyIsResolved(data.getBoolean("verifyIsResolved")) |
|
|
|
|
.setVerifyFeedback(data.getString("verifyFeedback")) |
|
|
|
|
.setVerifyFollowupPolice(verifyFollowupPolice) |
|
|
|
|
.setVerifyAttachments(data.getString("verifyAttachments")); |
|
|
|
|
BeanUtil.copyProperties(source, mail, CopyOptions.create().setIgnoreNullValue(true)); |
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
|
// 申请办结
|
|
|
|
|
.setCompleteMethod(data.getString("completeMethod")) |
|
|
|
|
.setFlowKey(nextNode.getFlowNode().getKey()) |
|
|
|
|
.setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); |
|
|
|
|
mailService.updateById(mail); |
|
|
|
|
|
|
|
|
|
workService.saveOrUpdate(mail, leaderEmpNo, now); |
|
|
|
|
// 将本人下的件改为已办
|
|
|
|
|
Work work = workService.getOne(mailId, AdminThreadLocal.getEmpNo()); |
|
|
|
|
work.setWorkState(Work.State.done.name()).setUpdateTime(now); |
|
|
|
|
workService.updateById(work); |
|
|
|
|
return nextNode; |
|
|
|
|
workService.updateDone(mail.getId(), AdminThreadLocal.getRoleId(), now); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Flow applyExtensionSubmit(String mailId, JSONObject data) { |
|
|
|
|
Integer extensionDays = data.getInteger("extensionDays"); |
|
|
|
|
Assert.notNull(extensionDays, "延期时长不能为空"); |
|
|
|
|
String reason = data.getString("extensionReason"); |
|
|
|
|
Assert.hasText(reason, "延期理由不能为空"); |
|
|
|
|
public Flow offline(String nextActionKey, String mailId, JSONObject data) { |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
// 更新信件
|
|
|
|
|
Mail mail = mailService.getById(mailId); |
|
|
|
|
applicationCompleted(nextActionKey, mail, data, now); |
|
|
|
|
// 给二级机构专班增加待办
|
|
|
|
|
workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 给二级机构增加待办
|
|
|
|
|
workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), WorkType.extension_approval.name(), now); |
|
|
|
|
|
|
|
|
|
public Flow online(String nextActionKey, String mailId, JSONObject data) { |
|
|
|
|
String leaderEmpNo = data.getString("leaderEmpNo"); |
|
|
|
|
Assert.hasText(leaderEmpNo, "未选择上级领导!"); |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
// 更新信件
|
|
|
|
|
Mail mail = mailService.getById(mailId); |
|
|
|
|
mail.setUpdateTime(now) |
|
|
|
|
.setExtensionDays(extensionDays) |
|
|
|
|
.setExtensionReason(reason) |
|
|
|
|
.setExtensionState(ExtensionState.applying.name()); |
|
|
|
|
mailService.updateById(mail); |
|
|
|
|
applicationCompleted(nextActionKey, mail, data, now); |
|
|
|
|
// 给三级部门领导增加待办
|
|
|
|
|
workService.saveOrUpdate(mail, leaderEmpNo, now); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|