diff --git a/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java b/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java index 4fbc657..3b1d30d 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java @@ -1,7 +1,7 @@ package com.biutag.lan.aop.aspect; import com.alibaba.fastjson2.JSON; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.aop.Log; import com.biutag.entity.system.SystemLogOperate; import com.biutag.mapper.system.SystemLogOperateMapper; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java b/mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java similarity index 99% rename from mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java rename to mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java index 4299b1a..26781c7 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java @@ -1,4 +1,4 @@ -package com.biutag.lan; +package com.biutag.lan.config; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.util.StrUtil; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java b/mailbox-lan/src/main/java/com/biutag/lan/config/AdminThreadLocal.java similarity index 98% rename from mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java rename to mailbox-lan/src/main/java/com/biutag/lan/config/AdminThreadLocal.java index a8d2afd..80dd492 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/AdminThreadLocal.java @@ -1,4 +1,4 @@ -package com.biutag.lan; +package com.biutag.lan.config; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java index 3856397..b7da12e 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java @@ -2,7 +2,6 @@ package com.biutag.lan.config; import com.biutag.config.GlobalConfig; -import com.biutag.lan.AdminInterceptor; import com.biutag.util.YmlUtils; import jakarta.annotation.Resource; import org.jetbrains.annotations.NotNull; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java index 7161b28..3715e96 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java @@ -2,7 +2,7 @@ package com.biutag.lan.config.stp; import cn.dev33.satoken.stp.StpInterface; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.entity.system.Menu; import com.biutag.entity.system.Perm; import com.biutag.mapper.system.MenuMapper; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java index c2036c2..282be7a 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java @@ -30,6 +30,7 @@ public class FileController { return AjaxResult.success(JSONObject.of("filepath", filepath)); } + @NotPower @ResponseBody @PostMapping("upload/base64") public AjaxResult upload(@RequestBody JSONObject file) { diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java index 1a965ff..7e744a8 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java @@ -6,7 +6,7 @@ import com.alibaba.fastjson2.JSONObject; import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.bo.MailTotal; import com.biutag.lan.flow.FlowNodeEnum; import com.biutag.lan.service.MailMarkService; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java index 5ab9583..94c0e0c 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java @@ -1,13 +1,12 @@ package com.biutag.lan.controller; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.alibaba.fastjson2.JSONObject; import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; -import com.biutag.lan.domain.MailSource; import com.biutag.lan.domain.bo.FlowAction; import com.biutag.lan.domain.bo.InvalidCompletion; import com.biutag.lan.domain.bo.MailOuter; -import com.biutag.lan.domain.bo.MailSourceBo; import com.biutag.lan.domain.vo.MailFlowDetail; import com.biutag.lan.service.MailService; import jakarta.validation.Valid; @@ -29,7 +28,7 @@ public class MailController { return AjaxResult.success(mailService.getMailFlowDetail(id)); } - @NotPower + @SaCheckPermission("mail:add") @PostMapping("add") public AjaxResult add(@RequestBody @Valid MailOuter mail) { return AjaxResult.success(mailService.save(mail)); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java index 566f159..0b75548 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java @@ -3,20 +3,11 @@ package com.biutag.lan.controller.datascreen; import com.biutag.aop.NotLogin; import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; -import com.biutag.entity.system.Duty; -import com.biutag.enums.DeptTypeEnum; -import com.biutag.lan.AdminThreadLocal; import com.biutag.lan.domain.Mail; -import com.biutag.lan.domain.MailSource; import com.biutag.lan.domain.vo.MailDetail; -import com.biutag.lan.domain.vo.MailFlowDetail; import com.biutag.lan.service.DataScreenService; import com.biutag.lan.service.IDutyService; -import com.biutag.lan.service.IIndexService; import com.biutag.lan.service.MailService; -import com.biutag.util.DateUtils; -import com.biutag.util.StringUtils; -import com.google.gson.JsonObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import jakarta.annotation.Resource; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java index 756feac..9164727 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java @@ -1,8 +1,7 @@ package com.biutag.lan.controller.system; import com.alibaba.fastjson2.JSONArray; -import com.biutag.aop.NotLogin; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.aop.Log; import com.biutag.aop.NotPower; import com.biutag.lan.service.IMenuService; @@ -18,7 +17,6 @@ import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; import java.util.List; @RestController diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java index d577e16..973b405 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java @@ -4,7 +4,7 @@ import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; import com.biutag.core.PageResult; import com.biutag.entity.system.PoliceUser; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.aop.Log; import com.biutag.lan.service.IPoliceUserService; import com.biutag.lan.validate.commons.IdValidate; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java index 233015c..d23a402 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java @@ -138,6 +138,12 @@ public class Mail { * 联系民警 */ private String contactPoliceEmpNo; + + /** + * 联系民警职位 + */ + private String contactPolicePost; + /** * 联系群众时间 */ @@ -151,7 +157,7 @@ public class Mail { /** * 是否联系群众 */ - private String contactFlag; + private Boolean contactFlag; /** * 接访形式 @@ -333,4 +339,14 @@ public class Mail { */ private String invalidationReason; + /** + * 市局下发信息 + */ + private String firstDistributeInfo; + + /** + * 二级单位下发信息 + */ + private String secondDistributeInfo; + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java index 2072419..477a56f 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java @@ -4,9 +4,13 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.biutag.enums.RoleEnum; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailCountersign; import com.biutag.lan.domain.MailExtensionApproval; +import com.biutag.lan.domain.Work; +import com.biutag.lan.enums.WorkType; +import com.biutag.lan.flow.FlowNodeEnum; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; @@ -86,6 +90,11 @@ public class MailVo { */ private String mailLevel; + /** + * 信件当前流程 + */ + private String flowKey; + /** * 流程限时最后操作时间 */ @@ -107,12 +116,40 @@ public class MailVo { */ private Integer flowLimitedTime; + + private String secondDeptName; + /** - * 协办核查民警(String) + * 协办核查民警(json) */ - private String coHandlingPolices; + private JSONArray coHandlingPolices; - private String secondDeptName; + /** + * 联系民警名称 + */ + private String contactPoliceName; + + /** + * 联系民警 + */ + private String contactPoliceEmpNo; + + + /** + * 联系民警职位 + */ + private String contactPolicePost; + + /** + * 联系群众时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime contactTime; + + /** + * 是否联系群众 + */ + private Boolean contactFlag; /** * 接访形式 @@ -256,6 +293,21 @@ public class MailVo { */ private Long contactDuration; + /** + * 是否是简易流程 + */ + private Boolean simpleFlowFlag; + + /** + * 市局下发信息 + */ + private JSONObject firstDistributeInfo; + + /** + * 二级单位下发信息 + */ + private JSONObject secondDistributeInfo; + /** * 部门会签 */ @@ -268,6 +320,11 @@ public class MailVo { BeanUtils.copyProperties(mail, mailVo); // 附件 mailVo.setAttachments(Optional.ofNullable(mail.getAttachments()).map(JSON::parseArray).orElse(new JSONArray())); + + // 协办民警 + if (StrUtil.isNotBlank(mail.getCoHandlingPolices())) { + mailVo.setCoHandlingPolices(JSON.parseArray(mail.getCoHandlingPolices())); + } // 接访附件(佐证材料) if (StrUtil.isNotBlank(mail.getInterviewAttachments())) { mailVo.setInterviewAttachments(JSON.parseArray(mail.getInterviewAttachments())); @@ -292,6 +349,19 @@ public class MailVo { if (StrUtil.isNotBlank(mail.getVerifyAttachments())) { mailVo.setVerifyAttachments(JSON.parseArray(mail.getVerifyAttachments())); } + + // 下发信息 + if (StrUtil.isNotBlank(mail.getFirstDistributeInfo())) { + JSONObject jsonObject = JSON.parseObject(mail.getFirstDistributeInfo()); + mailVo.setFirstDistributeInfo(JSON.parseObject(mail.getFirstDistributeInfo())); + mailVo.setSecondaryResponsibleFlag(jsonObject.getJSONArray("secondDept").size() > 0); + } + // 下发信息 + if (StrUtil.isNotBlank(mail.getSecondDistributeInfo())) { + JSONObject jsonObject = JSON.parseObject(mail.getSecondDistributeInfo()); + mailVo.setSecondDistributeInfo(jsonObject); + mailVo.setSecondaryResponsibleFlag(jsonObject.getJSONArray("secondDept").size() > 0); + } return mailVo; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/ActionEnum.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/ActionEnum.java index a7b6e18..0d39b57 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/ActionEnum.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/ActionEnum.java @@ -6,6 +6,7 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum ActionEnum { + save("save", "确认保存"), offline("offline", "线下审批"), online("online", "线上审批"), countersign("countersign", "发起会签"), diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java index 44b0e00..288abc4 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java @@ -45,8 +45,6 @@ public class FlowConfig { Action onlineAction = Action.of("online", "提交办结", "primary", false, "提交线上办结"); - - Action approvedSumbitAction = Action.of("approvedSubmit", "审批通过", "primary", false, "审批通过"); Action reportAction = Action.of("report", "呈报市局", "primary", false, "呈报市局"); @@ -129,7 +127,7 @@ public class FlowConfig { // 线上申请办结 .next("online", threeLeaderApprovalFlow) // 线下申请办结 - .next("offline", threeLeaderApprovalFlow); + .next("offline", secondApprovalFlow); // 三级机构领导审批 threeLeaderApprovalFlow diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java index d1376c7..7e0c30b 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java @@ -21,7 +21,7 @@ public enum FlowNodeEnum { SECOND_DEPUTY_APPROVAL("second_deputy_approval", "二级机构分管领导审批", 12), SECOND_LEADER_APPROVAL("second_leader_approval", "二级机构正职领导审批", 13), SECOND_REPORTING("second_reporting", "二级机构专班呈报", 14), - FIRST_APPROVAL("first_approval", "市局专班审批", 15), + FIRST_APPROVAL("first_approval", "待审批", 15), COUNTERSIGN("countersign", "部门会签", 16), COMPLETION("completion", "已办结", 17); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java index 4047394..950f010 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CountersignFlow.java @@ -2,7 +2,7 @@ package com.biutag.lan.flow.node; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSONObject; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.*; import com.biutag.lan.flow.Flow; import com.biutag.lan.service.*; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java index de3ed72..0e84c0e 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONObject; import com.biutag.constants.AppConstants; 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.MailMark; import com.biutag.lan.domain.MailReturn; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java index 4afe55f..1105235 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstDistributeFlow.java @@ -18,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; /** @@ -40,17 +42,23 @@ public class FirstDistributeFlow extends Flow { Mail mail = mailService.getById(mailId); // 将我的工作待办改成已办 workService.updateDone(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(),now); + + List secondDept = new ArrayList<>(); + JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId), + "secondDept", secondDept); // 下发信件(主责单位) workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mainDeptId, now, true); Integer secondDeptId1 = data.getInteger("secondDeptId1"); if (Objects.nonNull(secondDeptId1)) { // 下发信件(次责单位1) workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false); + firstDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1)); } Integer secondDeptId2 = data.getInteger("secondDeptId2"); if (Objects.nonNull(secondDeptId2)) { // 下发信件(次责单位2) workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false); + firstDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2)); } Flow nextNode = next.get(nextActionKey); // 更新信件 @@ -60,7 +68,8 @@ public class FirstDistributeFlow extends Flow { .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()) .setFlowLimitedLastHandlerTime(now) .setSecondDeptId(mainDeptId) - .setSecondDeptName(deptVo.getName()); + .setSecondDeptName(deptVo.getName()) + .setFirstDistributeInfo(firstDistributeInfo.toJSONString()); mailService.updateById(mail); return nextNode; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java index 6c72e3b..c596cb6 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java @@ -2,7 +2,7 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; 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.MailSource; import com.biutag.lan.domain.Work; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java index 4401f33..e6dcdff 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondApprovalFlow.java @@ -2,9 +2,11 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.exception.BusinessException; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailReturn; +import com.biutag.lan.enums.CompleteMethod; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; import com.biutag.lan.flow.FlowNodeEnum; @@ -40,24 +42,16 @@ public class SecondApprovalFlow extends Flow { return mailService.countersign(next.get(nextActionKey), mailId, data.getString("countersignRequirement"), data.getList("countersignDeptIds", Integer.class)); } - String leaderEmpNo = data.getString("leaderEmpNo"); - Assert.hasText(leaderEmpNo, "参数错误"); - - LocalDateTime now = LocalDateTime.now(); Mail mail = mailService.getById(mailId); - // 审批意见 - mailApprovalService.saveOrUpdate(mailId, mail.getFlowKey(), data.getString("approvalComment"), leaderEmpNo, now); - // 将二级专班角色的信件改为已办 - workService.updateDone(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); - // 将二级副职领导新增信件 - workService.save(mail, leaderEmpNo, now); - Flow nextNode = next.get(nextActionKey); - // 更新信件 - mail.setUpdateTime(now) - .setFlowKey(nextNode.getFlowNode().getKey()) - .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); - mailService.updateById(mail); - return nextNode; + // 线下 + if (mail.getCompleteMethod().equals(CompleteMethod.offline.name())) { + return offlineApproval(mail, data); + } + // 线上 + if (mail.getCompleteMethod().equals(CompleteMethod.online.name())) { + return onlineApproval(nextActionKey, mail, data); + } + throw new BusinessException(); } public Flow mailReturn(String mailId, JSONObject data) { @@ -86,4 +80,43 @@ public class SecondApprovalFlow extends Flow { return null; } + public Flow offlineApproval(Mail mail, JSONObject data) { + String approvalComment = data.getString("approvalComment"); + Assert.hasText(approvalComment, "审批意见不能为空"); + LocalDateTime now = LocalDateTime.now(); + // 审批意见 + mailApprovalService.saveOrUpdate(mail.getId(), mail.getFlowKey(), data.getString("approvalComment"), null, now); + // 将二级专班角色的信件改为已办 + workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); + // 将市局专班信件改为待办 + workService.updateTodo(mail.getId(), RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), now); + // 更新信件 + mail.setUpdateTime(now) + .setFlowKey(FlowNodeEnum.FIRST_APPROVAL.getKey()) + .setFlowBeforeName(FlowNodeEnum.FIRST_APPROVAL.getFullName()); + mailService.updateById(mail); + return null; + } + + public Flow onlineApproval(String nextActionKey, Mail mail, JSONObject data) { + String leaderEmpNo = data.getString("leaderEmpNo"); + Assert.hasText(leaderEmpNo, "参数错误"); + String approvalComment = data.getString("approvalComment"); + Assert.hasText(approvalComment, "审批意见不能为空"); + LocalDateTime now = LocalDateTime.now(); + // 审批意见 + mailApprovalService.saveOrUpdate(mail.getId(), mail.getFlowKey(), data.getString("approvalComment"), leaderEmpNo, now); + // 将二级专班角色的信件改为已办 + workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); + // 将二级副职领导新增信件 + workService.save(mail, leaderEmpNo, now); + Flow nextNode = next.get(nextActionKey); + // 更新信件 + mail.setUpdateTime(now) + .setFlowKey(nextNode.getFlowNode().getKey()) + .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); + mailService.updateById(mail); + return nextNode; + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDeputyApprovalFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDeputyApprovalFlow.java index fa522fc..5c5846a 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDeputyApprovalFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDeputyApprovalFlow.java @@ -2,7 +2,7 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; @@ -15,8 +15,6 @@ import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Collectors; @RequiredArgsConstructor @Component diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java index 6a789b7..72874ac 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java @@ -2,14 +2,12 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; -import com.biutag.lan.domain.MailMark; import com.biutag.lan.domain.Work; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; import com.biutag.lan.service.IDeptService; -import com.biutag.lan.service.MailMarkService; import com.biutag.lan.service.MailService; import com.biutag.lan.service.WorkService; import com.biutag.lan.vo.system.DeptVo; @@ -19,6 +17,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; @RequiredArgsConstructor @@ -52,6 +52,9 @@ public class SecondDistributeFlow extends Flow { myWork.setWorkState(Work.State.done.name()).setUpdateTime(now); workService.updateById(myWork); + List 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); @@ -59,11 +62,13 @@ public class SecondDistributeFlow extends Flow { if (Objects.nonNull(secondDeptId1)) { // 下发信件(次责单位1) workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false); + 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); + secondDept.add(JSONObject.of("id", secondDeptId1)); } Flow nextNode = next.get(nextActionKey); // 更新信件 @@ -73,7 +78,8 @@ public class SecondDistributeFlow extends Flow { .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()) .setFlowLimitedLastHandlerTime(now) .setThreeDeptId(mainDeptId) - .setThreeDeptName(deptVo.getName()); + .setThreeDeptName(deptVo.getName()) + .setSecondDistributeInfo(secondDistributeInfo.toJSONString()); mailService.updateById(mail); return nextNode; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondLeaderApprovalFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondLeaderApprovalFlow.java index b11df26..dcea1c7 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondLeaderApprovalFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondLeaderApprovalFlow.java @@ -2,7 +2,7 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java index ee5efec..26d324e 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java @@ -1,9 +1,11 @@ package com.biutag.lan.flow.node; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; 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.MailReturn; import com.biutag.lan.domain.Work; @@ -19,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; /** * 二级机构签收 @@ -56,7 +60,7 @@ public class SecondSignFlow extends Flow { .setMailId(mailId) .setReason(reason) .setHandlerEmpNo(AdminThreadLocal.getEmpNo()) - .setHandlerDeptId(AdminThreadLocal.getDeptId()) + .setHandlerDeptId(deptId) .setHandlerDeptName(AdminThreadLocal.getDeptName()) .setCreateTime(now); mailReturnService.save(mailReturn); @@ -65,11 +69,25 @@ public class SecondSignFlow extends Flow { workService.updateById(work); // 更新市局专班的待办 workService.updateTodo(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), now); - // 更新信件 Mail mail = mailService.getById(mailId); - mail.setUpdateTime(now) - .setFlowKey(FlowNodeEnum.FIRST_DISTRIBUTE.getKey()) - .setFlowBeforeName("信件退回"); + // 主责单位 + if (work.getMainDeptFlag()) { + mail.setUpdateTime(now) + .setFlowKey(FlowNodeEnum.FIRST_DISTRIBUTE.getKey()) + .setFlowBeforeName("信件退回"); + } else { + JSONObject firstDistributeInfo = JSON.parseObject(mail.getFirstDistributeInfo()); + JSONObject secondDept1 = firstDistributeInfo.getJSONObject("secondDept1"); + if (Objects.nonNull(secondDept1) && secondDept1.getInteger("id").equals(deptId)) { + secondDept1.put("returnFlag", true); + } + JSONObject secondDept2 = firstDistributeInfo.getJSONObject("secondDept2"); + if (Objects.nonNull(secondDept2) && secondDept2.getInteger("id").equals(deptId)) { + secondDept2.put("returnFlag", true); + } + mail.setFirstDistributeInfo(firstDistributeInfo.toJSONString()); + } + // 更新信件 mailService.updateById(mail); return null; } @@ -90,11 +108,14 @@ public class SecondSignFlow extends Flow { // 更新信件 Mail mail = mailService.getById(mailId); Flow nextNode = next.get(nextActionKey); - mail.setUpdateTime(now) - .setFlowKey(nextNode.getFlowNode().getKey()) - .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); - mailService.updateById(mail); + // 主责单位 + if (work.getMainDeptFlag()) { + mail.setUpdateTime(now) + .setFlowKey(nextNode.getFlowNode().getKey()) + .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); + mailService.updateById(mail); + } return nextNode; } -} +} \ No newline at end of file diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java index 932d1d3..1d9f7e8 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSONObject; import com.biutag.lan.domain.Mail; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; +import com.biutag.lan.flow.FlowNodeEnum; import com.biutag.lan.service.MailService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -46,12 +47,19 @@ public class ThreeContactWriterFlow extends Flow { mail.setUpdateTime(now) .setContactPoliceName(contactPolice.getString("name")) .setContactPoliceEmpNo(contactPolice.getString("empNo")) + .setContactPolicePost(contactPolice.getString("post")) .setContactTime(DateUtil.parseLocalDateTime(contactTime, DatePattern.NORM_DATETIME_PATTERN)) .setContactDuration(data.getLong("contactDuration")) .setContactPoliceEmpNo(data.getString("contactDuration")) + .setContactFlag(data.getBoolean("contactFlag")) .setFlowKey(nextNode.getFlowNode().getKey()) .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()) .setFlowLimitedLastHandlerTime(now); + // 如果是简易流程 + if (mail.getSimpleFlowFlag()) { + mail.setFlowKey(FlowNodeEnum.VERIFY.getKey()) + .setFlowBeforeName(FlowNodeEnum.VERIFY.getFullName()); + } mailService.updateById(mail); return nextNode; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeLeaderApprovalFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeLeaderApprovalFlow.java index 398f2a0..19e2b4b 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeLeaderApprovalFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeLeaderApprovalFlow.java @@ -2,7 +2,7 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailReturn; import com.biutag.lan.flow.ActionEnum; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java index 6f0550c..9b7cb64 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java @@ -3,7 +3,7 @@ package com.biutag.lan.flow.node; 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.MailReturn; import com.biutag.lan.domain.Work; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java index 6c991de..2d8b3bf 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java @@ -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; } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/FavoriteService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/FavoriteService.java index 06e6dbb..6d30651 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/FavoriteService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/FavoriteService.java @@ -5,10 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Favorite; import com.biutag.lan.domain.MailSource; -import com.biutag.lan.domain.Work; import com.biutag.lan.domain.bo.MailQuery; import com.biutag.lan.domain.vo.FavoriteVo; import com.biutag.lan.mapper.FavoriteMapper; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailApprovalService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailApprovalService.java index 2417015..5e2a9ef 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailApprovalService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailApprovalService.java @@ -2,7 +2,7 @@ package com.biutag.lan.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.MailApproval; import com.biutag.lan.mapper.MailApprovalMapper; import org.springframework.stereotype.Service; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailExtensionApprovalService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailExtensionApprovalService.java index 5bdf0e1..98e1967 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailExtensionApprovalService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailExtensionApprovalService.java @@ -2,7 +2,7 @@ package com.biutag.lan.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.MailExtensionApproval; import com.biutag.lan.mapper.MailExtensionApprovalMapper; import org.springframework.stereotype.Service; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java index d279e53..599176f 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.entity.system.Dept; 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.*; import com.biutag.lan.domain.bo.FlowAction; import com.biutag.lan.domain.bo.InvalidCompletion; @@ -105,6 +105,19 @@ public class MailService extends ServiceImpl { mailVo.setCountersigns(mailCountersignService.list(mailId)); if (!list.isEmpty()) { + // 线下 + if (CompleteMethod.offline.name().equals(mail.getCompleteMethod())) { + List approvalVos = Arrays.asList(FlowNodeEnum.SECOND_APPROVAL).stream().map(item -> { + MailApprovalVo vo = new MailApprovalVo(); + list.stream().filter(approval -> item.getKey().equals(approval.getFlowKey())).findFirst().ifPresent(approval -> { + BeanUtils.copyProperties(approval, vo); + vo.setApproved(true); + }); + return vo; + }).collect(Collectors.toList()); + flowDetail.setApprovals(approvalVos); + } + // 线上 if (CompleteMethod.online.name().equals(mail.getCompleteMethod())) { List approvalVos = Arrays.asList(FlowNodeEnum.THREE_LEADER_APPROVAL, FlowNodeEnum.SECOND_APPROVAL, FlowNodeEnum.SECOND_DEPUTY_APPROVAL, FlowNodeEnum.SECOND_LEADER_APPROVAL).stream().map(item -> { @@ -146,11 +159,7 @@ public class MailService extends ServiceImpl { if (ExtensionState.applying.name().equals(mail.getExtensionState())) { mailVo.setExtensionApprovals(mailExtensionApprovalService.list(mailId)); } - // 判断是否选择了次责单位 - if (FlowNodeEnum.SECOND_DISTRIBUTE.getKey().equals(mail.getFlowKey())) { - List works = workService.list(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), WorkType.processing.name()); - mailVo.setSecondaryResponsibleFlag(works.size() > 1); - } + if (Objects.nonNull(mail.getFlowKey()) && FlowNodeEnum.get(mail.getFlowKey()).getIndex() >= FlowNodeEnum.THREE_LEADER_APPROVAL.getIndex()) { // 主单位签收时长 long mainDeptSignTime = flows.stream().filter(item -> item.getFlowKey().contains("_sign") || item.getFlowKey().contains("_distribute")).mapToLong(MailFlow::getConsumingTime).sum(); @@ -283,8 +292,9 @@ public class MailService extends ServiceImpl { workService.updateById(work); if (!returnFlag) { Mail mail = getById(mailId); - // 驳回 - mail.setExtensionState(ExtensionState.completion.name()).setExtensionFlag(true); + mail.setExtensionState(ExtensionState.completion.name()).setExtensionFlag(true) + // 信件状态(已延期) + .setMailState(MailState.delayed.name()); return updateById(mail); } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java index dc858f7..a308aeb 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.core.AjaxResult; import com.biutag.enums.RoleEnum; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailLabel; import com.biutag.lan.domain.MailSource; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java index b4e96fd..90a0c4c 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Assert; import com.biutag.constants.AppConstants; import com.biutag.entity.setting.DictData; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.service.IDeptService; import com.biutag.lan.validate.system.DeptCreateValidate; import com.biutag.lan.validate.system.DeptSearchValidate; @@ -26,7 +26,6 @@ import org.springframework.stereotype.Service; import jakarta.annotation.Resource; import java.util.*; -import java.util.stream.Collectors; /** * 系统部门服务实现类 diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java index 4329c56..b7f2402 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java @@ -3,7 +3,7 @@ package com.biutag.lan.service.impl; import com.alibaba.fastjson2.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Assert; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.service.IMenuService; import com.biutag.lan.service.IPermService; import com.biutag.lan.validate.system.MenuCreateValidate; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java index 0f1ffc4..f1e6248 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.core.PageResult; import com.biutag.entity.system.*; import com.biutag.exception.OperateException; -import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.enums.PostEnums; import com.biutag.lan.service.IPermService; import com.biutag.lan.service.IPoliceUserService; diff --git a/mailbox-lan/src/main/resources/application-prod.yml b/mailbox-lan/src/main/resources/application-prod.yml index cfdb1c0..6203225 100644 --- a/mailbox-lan/src/main/resources/application-prod.yml +++ b/mailbox-lan/src/main/resources/application-prod.yml @@ -7,7 +7,7 @@ spring: oss: minio: enable: true - endpoint: http://65.47.60.182:9090 + endpoint: http://65.47.60.182:9001 accessKey: E2djtF6OKJtduYzzSKK4 secretKey: er5t3VxQP3KluD9Q1zgxuiyiS1PzQhAOThpwm9do - bucketName: mailbox \ No newline at end of file + bucketName: mailbox diff --git a/mailbox-lan/src/main/resources/mapper/FavoriteMapper.xml b/mailbox-lan/src/main/resources/mapper/FavoriteMapper.xml index 55aa2f3..3238229 100644 --- a/mailbox-lan/src/main/resources/mapper/FavoriteMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/FavoriteMapper.xml @@ -9,7 +9,7 @@ m.mail_state, m.mail_category, m.mail_level, m.three_dept_id, m.three_dept_name, m.flow_key, m.flow_before_name,m.mail_labels from favorite f left join mail m on f.mail_id = m.id - left join flow_node f on m.flow_key = f.key + left join flow_node n on m.flow_key = n.key ${ew.getCustomSqlSegment} diff --git a/mailbox-lan/src/test/java/com/biutag/lan/BeanUtilsTest.java b/mailbox-lan/src/test/java/com/biutag/lan/BeanUtilsTest.java new file mode 100644 index 0000000..7553be9 --- /dev/null +++ b/mailbox-lan/src/test/java/com/biutag/lan/BeanUtilsTest.java @@ -0,0 +1,17 @@ +package com.biutag.lan; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.biutag.lan.domain.Mail; +import org.junit.jupiter.api.Test; + +public class BeanUtilsTest { + + @Test + public void copyPropertiesTest() { + Mail source = new Mail().setId("1"); + Mail target = new Mail().setId("2").setContactName("testName"); + BeanUtil.copyProperties(source, target, CopyOptions.create().setIgnoreNullValue(true)); + System.out.println(target); + } +} diff --git a/mailbox-outer-admin/src/main/resources/application.yml b/mailbox-outer-admin/src/main/resources/application.yml index fee53c0..42eedf8 100644 --- a/mailbox-outer-admin/src/main/resources/application.yml +++ b/mailbox-outer-admin/src/main/resources/application.yml @@ -9,4 +9,4 @@ spring: driver-class-name: org.postgresql.Driver url: jdbc:postgresql://172.31.217.20:32378/mailbox?currentSchema=mailbox-outer username: vbadmin - password: Ip12341234 + password: Ip12341234 \ No newline at end of file diff --git a/truncate.sql b/truncate.sql index caa4e65..36e62ae 100644 --- a/truncate.sql +++ b/truncate.sql @@ -5,7 +5,13 @@ truncate table mail; truncate table mail_flow; truncate table mail_approval; truncate table mail_extension_approval; +truncate table mail_countersign; +truncate table mail_return; +truncate table mail_label; truncate table work; truncate table favorite; truncate table mail_mark; + +truncate table system_log_operate; +truncate table system_log_login;