Browse Source

BUG修复、完善

master
wxc 2 years ago
parent
commit
be099f5c6d
  1. 19
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java
  2. 13
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java
  3. 4
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java
  4. 2
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDeputyApprovalFlow.java
  5. 42
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

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

@ -1,29 +1,27 @@
package com.biutag.lan.flow.node; package com.biutag.lan.flow.node;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.biutag.constants.AppConstants; import com.biutag.constants.AppConstants;
import com.biutag.enums.RoleEnum; 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.Mail; import com.biutag.lan.domain.*;
import com.biutag.lan.domain.MailMark; import com.biutag.lan.enums.MailCategory;
import com.biutag.lan.domain.MailReturn;
import com.biutag.lan.domain.Work;
import com.biutag.lan.enums.MailState; import com.biutag.lan.enums.MailState;
import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.ActionEnum;
import com.biutag.lan.flow.Flow; import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.FlowNodeEnum; import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.MailMarkService; import com.biutag.lan.service.*;
import com.biutag.lan.service.MailReturnService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.WorkService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
@Component @Component
@ -72,11 +70,14 @@ public class FirstApprovalFlow extends Flow {
.setProblemSolvingStatus(problemSolvingStatus) .setProblemSolvingStatus(problemSolvingStatus)
.setSatisfactionStatus(satisfactionStatus) .setSatisfactionStatus(satisfactionStatus)
.setCompletionComment(data.getString("completionComment")) .setCompletionComment(data.getString("completionComment"))
.setMailLabels(Optional.ofNullable(data.getJSONArray("mailLabels")).map(item -> item.toJSONString()).orElse(null))
.setFlowKey(FlowNodeEnum.COMPLETION.getKey()) .setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName()) .setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName())
// 信件状态改为已办结 // 信件状态改为已办结
.setMailState(MailState.completion.getValue()); .setMailState(MailState.completion.getValue());
JSONArray mailLabels = data.getJSONArray("mailLabels");
if (Objects.nonNull(mailLabels) && !mailLabels.isEmpty()) {
mail.setMailLabels(mailLabels.stream().map(Object::toString).collect(Collectors.joining(",")));
}
mailService.updateById(mail); mailService.updateById(mail);
// 认定办结 // 认定办结
MailMark mailMark = new MailMark().setMailId(mailId) MailMark mailMark = new MailMark().setMailId(mailId)

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

@ -90,16 +90,20 @@ public class FirstSignFlow extends Flow {
} }
public Flow thankMailFlow(String mailId, JSONObject data) { public Flow thankMailFlow(String mailId, JSONObject data) {
String mailFirstCategory = data.getString("mailFirstCategory");
Integer secondDeptId = data.getInteger("secondDeptId"); Integer secondDeptId = data.getInteger("secondDeptId");
Integer threeDeptId = data.getInteger("threeDeptId"); Integer threeDeptId = data.getInteger("threeDeptId");
Assert.notNull(secondDeptId, "二级办理单位不能为空"); Assert.notNull(secondDeptId, "二级办理单位不能为空");
Assert.notNull(threeDeptId, "三级办理单位不能为空"); Assert.notNull(threeDeptId, "三级办理单位不能为空");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
MailSource mailSource = mailSourceService.getById(mailId); MailSource mailSource = mailSourceService.getById(mailId);
Mail mail = mailSource.toMail().setSecondDeptId(secondDeptId) Mail mail = mailSource.toMail()
.setMailFirstCategory(mailFirstCategory)
.setMailCategory(mailFirstCategory)
.setSecondDeptId(secondDeptId)
.setThreeDeptId(threeDeptId) .setThreeDeptId(threeDeptId)
.setFlowKey(FlowNodeEnum.COMPLETION.getKey()) .setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName()) .setFlowBeforeName("办结处理")
.setUpdateTime(now); .setUpdateTime(now);
mailService.save(mail); mailService.save(mail);
// 更新为已办 // 更新为已办
@ -108,13 +112,16 @@ public class FirstSignFlow extends Flow {
} }
public Flow invalidMailFlow(String mailId, JSONObject data) { public Flow invalidMailFlow(String mailId, JSONObject data) {
String mailFirstCategory = data.getString("mailFirstCategory");
String invalidationReason = data.getString("invalidationReason"); String invalidationReason = data.getString("invalidationReason");
Assert.hasText(invalidationReason, "判定理由不能为空"); Assert.hasText(invalidationReason, "判定理由不能为空");
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
MailSource mailSource = mailSourceService.getById(mailId); MailSource mailSource = mailSourceService.getById(mailId);
Mail mail = mailSource.toMail() Mail mail = mailSource.toMail()
.setMailFirstCategory(mailFirstCategory)
.setMailCategory(mailFirstCategory)
.setFlowKey(FlowNodeEnum.COMPLETION.getKey()) .setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName()) .setFlowBeforeName("办结处理")
.setUpdateTime(now); .setUpdateTime(now);
mailService.save(mail); mailService.save(mail);
// 更新为已办 // 更新为已办

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

@ -73,7 +73,7 @@ public class SecondApprovalFlow extends Flow {
// 更新已办 // 更新已办
workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.MAIL_RETURN.getDoneName()); workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.MAIL_RETURN.getDoneName());
// 更新三级机构专班的待办 // 更新三级机构专班的待办
workService.updateTodo(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.RETURN_RECTIFICATION.getName()); workService.updateTodo(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mail.getThreeDeptId(), FlowNameEnum.RETURN_RECTIFICATION.getName());
// 更新信件 // 更新信件
mail.setUpdateTime(now) mail.setUpdateTime(now)
.setFlowKey(FlowNodeEnum.VERIFY.getKey()) .setFlowKey(FlowNodeEnum.VERIFY.getKey())
@ -111,7 +111,7 @@ public class SecondApprovalFlow extends Flow {
// 将二级专班角色的信件改为已办 // 将二级专班角色的信件改为已办
workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId(), FlowNameEnum.PENDING_APPROVAL.getDoneName());
// 将二级副职领导新增信件 // 将二级副职领导新增信件
workService.save(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName()); workService.saveOrUpdate(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName());
Flow nextNode = next.get(nextActionKey); Flow nextNode = next.get(nextActionKey);
// 更新信件 // 更新信件
mail.setUpdateTime(now) mail.setUpdateTime(now)

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

@ -53,7 +53,7 @@ public class SecondDeputyApprovalFlow extends Flow {
// 将我的信件改为已办 // 将我的信件改为已办
workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.PENDING_APPROVAL.getDoneName());
// 给二级机构正职领导新增待办 // 给二级机构正职领导新增待办
workService.save(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName()); workService.saveOrUpdate(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName());
Flow nextNode = next.get(nextActionKey); Flow nextNode = next.get(nextActionKey);
// 更新信件 // 更新信件
mail.setUpdateTime(now) mail.setUpdateTime(now)

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

@ -89,17 +89,6 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
return saveBatch(list); return saveBatch(list);
} }
public boolean save(Mail mail, String empNo, LocalDateTime time, String flowName) {
Work work = new Work();
BeanUtils.copyProperties(mail, work);
work.setMailId(mail.getId())
.setPoliceEmpNo(empNo)
.setCreateTime(time)
.setUpdateTime(time)
.setFlowName(flowName);
return save(work);
}
public boolean saveOrUpdate(Mail mail, Integer roleId, Integer deptId, LocalDateTime time, Boolean mainDeptFlag, String flowName) { public boolean saveOrUpdate(Mail mail, Integer roleId, Integer deptId, LocalDateTime time, Boolean mainDeptFlag, String flowName) {
return saveOrUpdate(mail, roleId, deptId, time, mainDeptFlag, flowName, null); return saveOrUpdate(mail, roleId, deptId, time, mainDeptFlag, flowName, null);
} }
@ -138,20 +127,23 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
Integer roleId = AdminThreadLocal.getRoleId(); Integer roleId = AdminThreadLocal.getRoleId();
Integer signRoleId = RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId) ? RoleEnum.SECOND_DEPT_CLASSES.getRoleId() : Integer signRoleId = RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId) ? RoleEnum.SECOND_DEPT_CLASSES.getRoleId() :
RoleEnum.THREE_DEPT_CLASSES.getRoleId(); RoleEnum.THREE_DEPT_CLASSES.getRoleId();
List<Work> collect = countersignDeptIds.stream().map(id -> { countersignDeptIds.forEach(id -> {
Work work = new Work(); Work work = getOne(mail.getId(), signRoleId, id);
BeanUtils.copyProperties(mail, work); if (Objects.isNull(work)) {
work.setMailId(mail.getId()) work = new Work();
.setSignRoleId(signRoleId) BeanUtils.copyProperties(mail, work);
.setSignDeptId(id) work.setMailId(mail.getId())
.setCreateTime(time) .setSignRoleId(signRoleId)
.setUpdateTime(time) .setSignDeptId(id)
.setCreateTime(time);
}
work.setUpdateTime(time)
// 部门会签 // 部门会签
.setWorkType(WorkType.dept_countersign.name()) .setWorkType(WorkType.dept_countersign.name())
.setFlowName(FlowNameEnum.PENDING_COUNTERSIGN.getName()); .setFlowName(FlowNameEnum.PENDING_COUNTERSIGN.getName());
return work; saveOrUpdate(work);
}).collect(Collectors.toList()); });
return saveBatch(collect); return true;
} }
public boolean updateDone(String mailId, Integer roleId, Integer deptId, String flowName) { public boolean updateDone(String mailId, Integer roleId, Integer deptId, String flowName) {
@ -232,7 +224,11 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
workVoPage.getRecords().forEach(item -> { workVoPage.getRecords().forEach(item -> {
// 会签中 // 会签中
if (FlowNameEnum.COUNTERSIGNING.getName().equals(item.getFlowName())) { if (FlowNameEnum.COUNTERSIGNING.getName().equals(item.getFlowName())) {
item.setFlowName(String.format("%s(%s/%s)", item.getFlowName(), item.getCountersignCompleted(), item.getCountersignTotal())); if (item.getCountersignCompleted().equals(item.getCountersignTotal())) {
item.setFlowName(FlowNameEnum.COUNTERSIGNING.getDoneName());
} else {
item.setFlowName(String.format("%s(%s/%s)", item.getFlowName(), item.getCountersignCompleted(), item.getCountersignTotal()));
}
} }
}); });
return workVoPage; return workVoPage;

Loading…
Cancel
Save