Browse Source

BUG 修复

master
wxc 2 years ago
parent
commit
a3d93e4054
  1. 12
      mailbox-lan/pom.xml
  2. 4
      mailbox-lan/sql/0318.sql
  3. 13
      mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java
  4. 5
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailFlow.java
  5. 27
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/CoHandlingReq.java
  6. 1
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java
  7. 5
      mailbox-lan/src/main/java/com/biutag/lan/enums/WorkType.java
  8. 9
      mailbox-lan/src/main/java/com/biutag/lan/flow/Flow.java
  9. 4
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java
  10. 16
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java
  11. 13
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java
  12. 4
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java
  13. 34
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java
  14. 2
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondReportingFlow.java
  15. 18
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java
  16. 9
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java
  17. 11
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java
  18. 34
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java
  19. 9
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  20. 40
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  21. 6
      mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java
  22. 6
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

12
mailbox-lan/pom.xml

@ -44,12 +44,6 @@
<artifactId>tongweb-spring-boot-starter-3.x</artifactId> <artifactId>tongweb-spring-boot-starter-3.x</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
@ -139,6 +133,12 @@
<version>2.2.0-M1</version> <version>2.2.0-M1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-dysmsapi20170525</artifactId>
<version>2.0.24</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>

4
mailbox-lan/sql/0318.sql

@ -0,0 +1,4 @@
ALTER TABLE "mailbox"."mail_flow"
ADD COLUMN "remark" text;
COMMENT ON COLUMN "mailbox"."mail_flow"."remark" IS '备注';

13
mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java

@ -1,9 +1,11 @@
package com.biutag.lan.controller; package com.biutag.lan.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.biutag.aop.NotPower; import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult; import com.biutag.core.AjaxResult;
import com.biutag.lan.domain.bo.CoHandlingReq;
import com.biutag.lan.domain.bo.FlowAction; import com.biutag.lan.domain.bo.FlowAction;
import com.biutag.lan.domain.bo.InvalidCompletion; import com.biutag.lan.domain.bo.InvalidCompletion;
import com.biutag.lan.domain.bo.MailOuter; import com.biutag.lan.domain.bo.MailOuter;
@ -62,4 +64,15 @@ public class MailController {
return AjaxResult.success(mailService.invalidCompletion(completion)); return AjaxResult.success(mailService.invalidCompletion(completion));
} }
/**
* 编辑协办民警
* @param coHandlingReq
* @return
*/
@NotPower
@PostMapping("coHandling/add")
public AjaxResult<Boolean> addCoHandling(@RequestBody CoHandlingReq coHandlingReq) {
return AjaxResult.success(mailService.saveCoHandling(coHandlingReq));
}
} }

5
mailbox-lan/src/main/java/com/biutag/lan/domain/MailFlow.java

@ -83,4 +83,9 @@ public class MailFlow {
*/ */
private Long limitedTime; private Long limitedTime;
/**
* 备注
*/
private String remark;
} }

27
mailbox-lan/src/main/java/com/biutag/lan/domain/bo/CoHandlingReq.java

@ -0,0 +1,27 @@
package com.biutag.lan.domain.bo;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Setter
@Getter
public class CoHandlingReq {
private String mailId;
private List<Police> polices;
@Setter
@Getter
public static class Police {
private String empNo;
private String name;
private String mobile;
}
}

1
mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java

@ -24,6 +24,7 @@ public class MailOuter {
* 联系人姓名 * 联系人姓名
*/ */
@NotBlank(message = "请输入联系人姓名") @NotBlank(message = "请输入联系人姓名")
@Length(min = 2, max = 20, message = "请输入正确的联系人姓名(长度为2-20字)")
private String contactName; private String contactName;
/** /**

5
mailbox-lan/src/main/java/com/biutag/lan/enums/WorkType.java

@ -10,6 +10,9 @@ public enum WorkType {
extension_approval, extension_approval,
// 协办 // 协办
co_handling; co_handling,
// 次责单位
secondary;
} }

9
mailbox-lan/src/main/java/com/biutag/lan/flow/Flow.java

@ -1,7 +1,9 @@
package com.biutag.lan.flow; package com.biutag.lan.flow;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.biutag.exception.BusinessException;
import com.biutag.lan.domain.FlowNode; import com.biutag.lan.domain.FlowNode;
import com.biutag.lan.domain.Mail;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -28,6 +30,13 @@ public abstract class Flow {
return this; return this;
} }
public boolean valid(Mail mail) {
if (!mail.getFlowKey().equals(flowNode.getKey())) {
throw new BusinessException("该信件已被其他专班处理,请刷新后重试");
}
return true;
}
public abstract Flow next(String nextActionKey, String mailId, JSONObject data); public abstract Flow next(String nextActionKey, String mailId, JSONObject data);
} }

4
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java

@ -63,6 +63,8 @@ public class FirstApprovalFlow extends Flow {
workService.updateDoneByRole(mailId, FlowNameEnum.PENDING_APPROVAL.getDoneName()); workService.updateDoneByRole(mailId, FlowNameEnum.PENDING_APPROVAL.getDoneName());
// 更新信件(信件已办结) // 更新信件(信件已办结)
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
Boolean problemSolvingStatus = data.getBoolean("problemSolvingStatus"); Boolean problemSolvingStatus = data.getBoolean("problemSolvingStatus");
String satisfactionStatus = data.getString("satisfactionStatus"); String satisfactionStatus = data.getString("satisfactionStatus");
mail.setUpdateTime(now) mail.setUpdateTime(now)
@ -105,6 +107,8 @@ public class FirstApprovalFlow extends Flow {
// 更新已办 // 更新已办
workService.updateDoneByRole(mailId, FlowNameEnum.MAIL_RETURN.getDoneName()); workService.updateDoneByRole(mailId, FlowNameEnum.MAIL_RETURN.getDoneName());
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
MailReturn mailReturn = new MailReturn() MailReturn mailReturn = new MailReturn()
.setMailId(mailId) .setMailId(mailId)
.setReason(reason) .setReason(reason)

16
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java

@ -45,31 +45,35 @@ public class FirstDistributeFlow extends Flow {
Assert.notNull(mainDeptId, "未选择主办层级"); Assert.notNull(mainDeptId, "未选择主办层级");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
// 将我的工作待办改成已办 // 将我的工作待办改成已办
workService.updateDoneByRole(mailId, FlowNameEnum.PENDING_DISTRIBUTE.getDoneName()); workService.updateDoneByRole(mailId, FlowNameEnum.PENDING_DISTRIBUTE.getDoneName());
// 更新信件
JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId)); DeptVo deptVo = deptService.detail(mainDeptId);
JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId, "name", deptVo.getName()));
// 下发信件(主责单位) // 下发信件(主责单位)
workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName());
Integer secondDeptId1 = data.getInteger("secondDeptId1"); Integer secondDeptId1 = data.getInteger("secondDeptId1");
if (Objects.nonNull(secondDeptId1)) { if (Objects.nonNull(secondDeptId1)) {
DeptVo secondDept = deptService.detail(secondDeptId1);
// 下发信件(次责单位1) // 下发信件(次责单位1)
workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false,
FlowNameEnum.PENDING_SIGN_CO.getName(), FlowNameEnum.PENDING_SIGN_CO.getName(),
FlowNodeEnum.SECOND_SIGN.getKey()); FlowNodeEnum.SECOND_SIGN.getKey());
firstDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1)); firstDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1, "name", secondDept.getName()));
} }
Integer secondDeptId2 = data.getInteger("secondDeptId2"); Integer secondDeptId2 = data.getInteger("secondDeptId2");
if (Objects.nonNull(secondDeptId2)) { if (Objects.nonNull(secondDeptId2)) {
DeptVo secondDept = deptService.detail(secondDeptId2);
// 下发信件(次责单位2) // 下发信件(次责单位2)
workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false,
FlowNameEnum.PENDING_SIGN_CO.getName(), FlowNameEnum.PENDING_SIGN_CO.getName(),
FlowNodeEnum.SECOND_SIGN.getKey()); FlowNodeEnum.SECOND_SIGN.getKey());
firstDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2)); firstDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2, "name", secondDept.getName()));
} }
Flow nextNode = next.get(nextActionKey); Flow nextNode = next.get(nextActionKey);
// 更新信件
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())

13
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java

@ -29,9 +29,6 @@ public class FirstSignFlow extends Flow {
private final MailService mailService; private final MailService mailService;
private final MailSourceService mailSourceService; private final MailSourceService mailSourceService;
private final WorkService workService; private final WorkService workService;
private final MailApprovalService mailApprovalService;
private final MailExtensionApprovalService mailExtensionApprovalService;
private final MailCountersignService mailCountersignService;
private final NoticeService noticeService; private final NoticeService noticeService;
@Override @Override
@ -40,8 +37,11 @@ public class FirstSignFlow extends Flow {
String mailFirstCategory = data.getString("mailFirstCategory"); String mailFirstCategory = data.getString("mailFirstCategory");
Assert.hasText(mailFirstCategory, "参数错误"); Assert.hasText(mailFirstCategory, "参数错误");
// 将首次签收标识 改为是 // 将首次签收标识 改为是
MailSource mailSource = mailSourceService.getById(mailId) MailSource mailSource = mailSourceService.getById(mailId);
.setSignFlag(true); if (mailSource.getSignFlag()) {
throw new BusinessException("该信件已被其他专班处理,请刷新后重试");
}
mailSource.setSignFlag(true);
mailSourceService.updateById(mailSource); mailSourceService.updateById(mailSource);
// 感谢信 // 感谢信
if (mailFirstCategory.equals(MailCategory.THANK_MAIL.getName())) { if (mailFirstCategory.equals(MailCategory.THANK_MAIL.getName())) {
@ -144,9 +144,6 @@ public class FirstSignFlow extends Flow {
if (mailService.exists(mailId)) { if (mailService.exists(mailId)) {
// 如果存在则删除相关数据 // 如果存在则删除相关数据
mailService.removeById(mailId); mailService.removeById(mailId);
mailApprovalService.remove(mailId);
mailExtensionApprovalService.remove(mailId);
mailCountersignService.remove(mailId);
} }
} }
} }

4
mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java

@ -44,6 +44,8 @@ public class SecondApprovalFlow extends Flow {
data.getList("countersignDeptIds", Integer.class)); data.getList("countersignDeptIds", Integer.class));
} }
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
// 线下 // 线下
if (mail.getCompleteMethod().equals(CompleteMethod.offline.name())) { if (mail.getCompleteMethod().equals(CompleteMethod.offline.name())) {
return offlineApproval(mail, data); return offlineApproval(mail, data);
@ -60,6 +62,8 @@ public class SecondApprovalFlow extends Flow {
String reason = data.getString("reason"); String reason = data.getString("reason");
Assert.hasText(reason, "参数错误"); Assert.hasText(reason, "参数错误");
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
MailReturn mailReturn = new MailReturn() MailReturn mailReturn = new MailReturn()
.setMailId(mailId) .setMailId(mailId)
.setReason(reason) .setReason(reason)

34
mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java

@ -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;
} }

2
mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondReportingFlow.java

@ -26,6 +26,8 @@ public class SecondReportingFlow extends Flow {
public Flow next(String nextActionKey, String mailId, JSONObject data) { public Flow next(String nextActionKey, String mailId, JSONObject data) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
// 将二级专班信件改为已办 // 将二级专班信件改为已办
workService.updateDoneByRole(mailId, FlowNameEnum.PENDING_REPORT.getDoneName()); workService.updateDoneByRole(mailId, FlowNameEnum.PENDING_REPORT.getDoneName());
// 将市局专班信件改为待办 // 将市局专班信件改为待办

18
mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java

@ -6,6 +6,7 @@ import com.biutag.exception.BusinessException;
import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailReturn; import com.biutag.lan.domain.MailReturn;
import com.biutag.lan.domain.MailSource;
import com.biutag.lan.domain.Work; import com.biutag.lan.domain.Work;
import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.ActionEnum;
import com.biutag.lan.flow.Flow; import com.biutag.lan.flow.Flow;
@ -37,6 +38,8 @@ public class SecondSignFlow extends Flow {
private final NoticeService noticeService; private final NoticeService noticeService;
private final MailSourceService mailSourceService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Flow next(String nextActionKey, String mailId, JSONObject data) { public Flow next(String nextActionKey, String mailId, JSONObject data) {
@ -47,6 +50,8 @@ public class SecondSignFlow extends Flow {
} }
public Flow mailReturn(String mailId, JSONObject data) { public Flow mailReturn(String mailId, JSONObject data) {
String reason = data.getString("reason");
Assert.hasText(reason, "参数错误");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Integer roleId = AdminThreadLocal.getRoleId(); Integer roleId = AdminThreadLocal.getRoleId();
Integer deptId = AdminThreadLocal.getDeptId(); Integer deptId = AdminThreadLocal.getDeptId();
@ -54,8 +59,6 @@ public class SecondSignFlow extends Flow {
if (work.getWorkState().equals(Work.State.done.name())) { if (work.getWorkState().equals(Work.State.done.name())) {
throw new BusinessException("该信件已被其他专班处理"); throw new BusinessException("该信件已被其他专班处理");
} }
String reason = data.getString("reason");
Assert.hasText(reason, "参数错误");
MailReturn mailReturn = new MailReturn() MailReturn mailReturn = new MailReturn()
.setMailId(mailId) .setMailId(mailId)
.setReason(reason) .setReason(reason)
@ -77,6 +80,9 @@ public class SecondSignFlow extends Flow {
mail.setUpdateTime(now) mail.setUpdateTime(now)
.setFlowKey(FlowNodeEnum.FIRST_SIGN.getKey()) .setFlowKey(FlowNodeEnum.FIRST_SIGN.getKey())
.setFlowName(FlowNameEnum.MAIL_RETURN.getName()); .setFlowName(FlowNameEnum.MAIL_RETURN.getName());
// 将信件源表的签收设置为未签收
MailSource mailSource = mailSourceService.getById(mailId).setSignFlag(false);
mailSourceService.updateById(mailSource);
} else { } else {
JSONObject firstDistributeInfo = JSON.parseObject(mail.getFirstDistributeInfo()); JSONObject firstDistributeInfo = JSON.parseObject(mail.getFirstDistributeInfo());
JSONObject secondDept1 = firstDistributeInfo.getJSONObject("secondDept1"); JSONObject secondDept1 = firstDistributeInfo.getJSONObject("secondDept1");
@ -107,6 +113,9 @@ public class SecondSignFlow extends Flow {
if (work.getWorkState().equals(Work.State.done.name())) { if (work.getWorkState().equals(Work.State.done.name())) {
throw new BusinessException("该信件已被其他专班处理"); throw new BusinessException("该信件已被其他专班处理");
} }
// 更新信件
Mail mail = mailService.getById(mailId);
// 更新我的工作 // 更新我的工作
work.setPoliceEmpNo(empNo) work.setPoliceEmpNo(empNo)
.setUpdateTime(now) .setUpdateTime(now)
@ -115,10 +124,11 @@ public class SecondSignFlow extends Flow {
if (!work.getMainDeptFlag()) { if (!work.getMainDeptFlag()) {
work.setFlowName(FlowNameEnum.PENDING_DISTRIBUTE_CO.getName()) work.setFlowName(FlowNameEnum.PENDING_DISTRIBUTE_CO.getName())
.setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey()); .setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey());
} else {
// 校验
valid(mail);
} }
workService.updateById(work); workService.updateById(work);
// 更新信件
Mail mail = mailService.getById(mailId);
Flow nextNode = next.get(nextActionKey); Flow nextNode = next.get(nextActionKey);
// 主责单位 // 主责单位
if (work.getMainDeptFlag()) { if (work.getMainDeptFlag()) {

9
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java

@ -54,6 +54,8 @@ public class ThreeContactWriterFlow extends Flow {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
// 更新信件 // 更新信件
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
Flow nextNode = next.get(nextActionKey); Flow nextNode = next.get(nextActionKey);
mail.setUpdateTime(now) mail.setUpdateTime(now)
.setContactPoliceName(contactPolice.getString("name")) .setContactPoliceName(contactPolice.getString("name"))
@ -74,12 +76,7 @@ public class ThreeContactWriterFlow extends Flow {
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId()); Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId());
work.setFlowName(FlowNameEnum.INTERVIEW_WRITER.getName()).setUpdateTime(now); work.setFlowName(FlowNameEnum.INTERVIEW_WRITER.getName()).setUpdateTime(now);
workService.updateById(work); workService.updateById(work);
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
JSONArray coHandingPolices = data.getJSONArray("coHandingPolices");
if (Objects.nonNull(coHandingPolices) && !coHandingPolices.isEmpty()) {
mail.setCoHandlingPolices(coHandingPolices.toJSONString());
}
mailService.updateById(mail); mailService.updateById(mail);
return nextNode; return nextNode;
} }

11
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java

@ -35,13 +35,16 @@ public class ThreeInterviewWriterFlow extends Flow {
if (ActionEnum.mailReturn.getValue().equals(nextActionKey)) { if (ActionEnum.mailReturn.getValue().equals(nextActionKey)) {
return threeSignFlow.mailReturn(mailId, data); return threeSignFlow.mailReturn(mailId, data);
} }
Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
// 更新我的工作 // 更新我的工作
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId()); Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId());
work.setFlowName(FlowNameEnum.VERIFY.getName()).setUpdateTime(now); work.setFlowName(FlowNameEnum.VERIFY.getName()).setUpdateTime(now);
workService.updateById(work); workService.updateById(work);
// 更新信件 // 更新信件
Mail mail = mailService.getById(mailId);
Flow nextNode = next.get(nextActionKey); Flow nextNode = next.get(nextActionKey);
mail.setUpdateTime(now) mail.setUpdateTime(now)
.setInterviewType(data.getString("interviewType")) .setInterviewType(data.getString("interviewType"))
@ -52,12 +55,6 @@ public class ThreeInterviewWriterFlow extends Flow {
.setInterviewAttachments(data.getString("interviewAttachments")) .setInterviewAttachments(data.getString("interviewAttachments"))
.setFlowKey(nextNode.getFlowNode().getKey()) .setFlowKey(nextNode.getFlowNode().getKey())
.setFlowName(nextNode.getFlowNode().getBeforeName()); .setFlowName(nextNode.getFlowNode().getBeforeName());
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
JSONArray coHandingPolices = data.getJSONArray("coHandingPolices");
if (Objects.nonNull(coHandingPolices) && !coHandingPolices.isEmpty()) {
mail.setCoHandlingPolices(coHandingPolices.toJSONString());
}
mailService.updateById(mail); mailService.updateById(mail);
return nextNode; return nextNode;
} }

34
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java

@ -53,15 +53,17 @@ public class ThreeSignFlow extends Flow {
} }
public Flow mailReturn(String mailId, JSONObject data) { public Flow mailReturn(String mailId, JSONObject data) {
String reason = data.getString("reason");
Assert.hasText(reason, "参数错误");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Integer deptId = AdminThreadLocal.getDeptId(); Integer deptId = AdminThreadLocal.getDeptId();
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(),deptId); Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(),deptId);
if (work.getWorkState().equals(Work.State.done.name())) { if (work.getWorkState().equals(Work.State.done.name())) {
throw new BusinessException("该信件已被其他专班处理"); throw new BusinessException("该信件已被其他专班处理");
} }
String reason = data.getString("reason");
Assert.hasText(reason, "参数错误");
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
MailReturn mailReturn = new MailReturn() MailReturn mailReturn = new MailReturn()
.setMailId(mailId) .setMailId(mailId)
.setReason(reason) .setReason(reason)
@ -115,32 +117,6 @@ public class ThreeSignFlow extends Flow {
return nextNode; return nextNode;
} }
public void saveCoHandling(Mail mail, JSONObject data) {
LocalDateTime now = LocalDateTime.now();
// 处理协办民警
JSONArray coHandlingPolices = data.getJSONArray("coHandlingPolices");
if (Objects.nonNull(coHandlingPolices) && coHandlingPolices.size() > 0) {
for (Object coHandingPolice : coHandlingPolices) {
Map obj = (LinkedHashMap) coHandingPolice;
Object empNoObj = obj.get("empNo");
if (Objects.isNull(empNoObj)) {
continue;
}
String empNo = empNoObj.toString();
Work coWork = workService.getOne(mail.getId(), empNo);
if (Objects.nonNull(coWork)) {
continue;
}
Work work = new Work();
BeanUtils.copyProperties(mail, work);
work.setMailId(mail.getId())
.setPoliceEmpNo(empNo)
.setCreateTime(now)
.setWorkState(Work.State.todo.name())
.setWorkType(WorkType.co_handling.name());
workService.save(work);
}
}
}
} }

9
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java

@ -90,6 +90,8 @@ public class ThreeVerifyFlow extends Flow {
public Flow save(String mailId, JSONObject data) { public Flow save(String mailId, JSONObject data) {
JSONObject contactPolice = data.getJSONObject("contactPolice"); JSONObject contactPolice = data.getJSONObject("contactPolice");
Mail mail = mailService.getById(mailId); Mail mail = mailService.getById(mailId);
// 校验
valid(mail);
Mail source = new Mail() Mail source = new Mail()
// 联系群众 // 联系群众
.setContactPoliceName(Optional.ofNullable(contactPolice).map(item -> item.getString("name")).orElse(null)) .setContactPoliceName(Optional.ofNullable(contactPolice).map(item -> item.getString("name")).orElse(null))
@ -124,13 +126,6 @@ public class ThreeVerifyFlow extends Flow {
"mobile", verifyFollowupPoliceObj.getString("mobile")).toJSONString(); "mobile", verifyFollowupPoliceObj.getString("mobile")).toJSONString();
source.setVerifyFollowupPolice(verifyFollowupPolice); source.setVerifyFollowupPolice(verifyFollowupPolice);
} }
BeanUtil.copyProperties(source, mail, CopyOptions.create().setIgnoreNullValue(true));
JSONArray coHandlingPolices = data.getJSONArray("coHandlingPolices");
if (Objects.nonNull(coHandlingPolices) && !coHandlingPolices.isEmpty()) {
// 处理协办民警
threeSignFlow.saveCoHandling(mail, data);
mail.setCoHandlingPolices(coHandlingPolices.toJSONString());
}
mailService.updateById(mail); mailService.updateById(mail);
return null; return null;
} }

40
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -12,6 +14,7 @@ import com.biutag.enums.RoleEnum;
import com.biutag.exception.BusinessException; import com.biutag.exception.BusinessException;
import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.*; import com.biutag.lan.domain.*;
import com.biutag.lan.domain.bo.CoHandlingReq;
import com.biutag.lan.domain.bo.FlowAction; import com.biutag.lan.domain.bo.FlowAction;
import com.biutag.lan.domain.bo.InvalidCompletion; import com.biutag.lan.domain.bo.InvalidCompletion;
import com.biutag.lan.domain.bo.MailOuter; import com.biutag.lan.domain.bo.MailOuter;
@ -40,6 +43,8 @@ import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.bouncycastle.asn1.iana.IANAObjectIdentifiers.mail;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class MailService extends ServiceImpl<MailMapper, Mail> { public class MailService extends ServiceImpl<MailMapper, Mail> {
@ -220,6 +225,13 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
.setLimitedTime(flow.getFlowNode().getLimitedTime()) .setLimitedTime(flow.getFlowNode().getLimitedTime())
.setConsumingTime(consumingTime) .setConsumingTime(consumingTime)
.setCreateTime(now); .setCreateTime(now);
if (Objects.nonNull(flowAction.getData().getString("comment"))) {
mailFlow.setRemark(flowAction.getData().getString("comment"));
} else if (Objects.nonNull(flowAction.getData().getString("comments"))) {
mailFlow.setRemark(flowAction.getData().getString("comments"));
} else if (Objects.nonNull(flowAction.getData().getString("reason"))) {
mailFlow.setRemark(flowAction.getData().getString("reason"));
}
mailFlowService.save(mailFlow); mailFlowService.save(mailFlow);
}); });
// 下一节点操作 // 下一节点操作
@ -398,4 +410,32 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
return updateById(mail); return updateById(mail);
} }
@Transactional(rollbackFor = Exception.class)
public boolean saveCoHandling(CoHandlingReq coHandlingReq) {
LocalDateTime now = LocalDateTime.now();
// 处理协办民警
List<CoHandlingReq.Police> polices = coHandlingReq.getPolices();
Mail mail = getById(coHandlingReq.getMailId());
mail.setCoHandlingPolices(JSON.toJSONString(polices));
updateById(mail);
for (CoHandlingReq.Police police : polices) {
String empNo = police.getEmpNo();
if (Objects.isNull(empNo)) {
continue;
}
Work coWork = workService.getOne(mail.getId(), empNo);
if (Objects.nonNull(coWork)) {
continue;
}
Work work = new Work();
BeanUtils.copyProperties(mail, work);
work.setMailId(mail.getId())
.setPoliceEmpNo(empNo)
.setCreateTime(now)
.setWorkState(Work.State.todo.name())
.setWorkType(WorkType.co_handling.name());
workService.save(work);
}
return true;
}
} }

6
mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java

@ -25,7 +25,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
private final SimpMessagingTemplate messagingTemplate; private final SimpMessagingTemplate messagingTemplate;
@Async
public void save(Integer roleId, Integer deptId, String content, Integer workId) { public void save(Integer roleId, Integer deptId, String content, Integer workId) {
Notice notice = new Notice().setRoleId(roleId).setDeptId(deptId).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId); Notice notice = new Notice().setRoleId(roleId).setDeptId(deptId).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId);
save(notice); save(notice);
@ -33,7 +33,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId)); log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId));
} }
@Async
public void save(String empNo, String content, Integer workId) { public void save(String empNo, String content, Integer workId) {
Notice notice = new Notice().setEmpNo(empNo).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId); Notice notice = new Notice().setEmpNo(empNo).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId);
save(notice); save(notice);
@ -41,7 +41,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
log.info("发送通知:{}", String.format("/topic/user/%s", empNo)); log.info("发送通知:{}", String.format("/topic/user/%s", empNo));
} }
@Async
public void sendNoticeDoneByRole() { public void sendNoticeDoneByRole() {
Integer roleId = AdminThreadLocal.getRoleId(); Integer roleId = AdminThreadLocal.getRoleId();
Integer deptId = AdminThreadLocal.getDeptId(); Integer deptId = AdminThreadLocal.getDeptId();

6
mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

@ -122,7 +122,11 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
work.setWorkState(Work.State.todo.name()) work.setWorkState(Work.State.todo.name())
.setUpdateTime(time) .setUpdateTime(time)
.setMainDeptFlag(mainDeptFlag) .setMainDeptFlag(mainDeptFlag)
.setFlowName(flowName).setFlowKey(flowKey); .setFlowName(flowName)
.setFlowKey(flowKey);
if (!mainDeptFlag) {
work.setWorkType(WorkType.secondary.name());
}
boolean flag = saveOrUpdate(work); boolean flag = saveOrUpdate(work);
noticeService.save(work.getSignRoleId(), work.getSignDeptId(), String.format("%s 的来信未签收,请尽快签收!", work.getContactName()), work.getId()); noticeService.save(work.getSignRoleId(), work.getSignDeptId(), String.format("%s 的来信未签收,请尽快签收!", work.getContactName()), work.getId());

Loading…
Cancel
Save