diff --git a/mailbox-common/src/main/java/com/biutag/config/Minio.java b/mailbox-common/src/main/java/com/biutag/config/Minio.java index ab6e46b..0252ec4 100644 --- a/mailbox-common/src/main/java/com/biutag/config/Minio.java +++ b/mailbox-common/src/main/java/com/biutag/config/Minio.java @@ -74,8 +74,6 @@ public class Minio { byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = response.read(buffer, 0, buffer.length)) != -1) { - // 处理读取的数据,例如写入到其他流或进行其他操作 - // 这里只是简单的打印数据 os.write(buffer, 0, bytesRead); } response.close(); diff --git a/mailbox-lan/pom.xml b/mailbox-lan/pom.xml index 89d05c8..ba21ac8 100644 --- a/mailbox-lan/pom.xml +++ b/mailbox-lan/pom.xml @@ -116,9 +116,6 @@ easyexcel 3.3.3 - - - @@ -145,6 +142,19 @@ + + + src/main/resources + false + + + src/main/resources + + application.yml + + true + + mailbox-lan diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java b/mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java index 26781c7..7a55ad8 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java @@ -57,6 +57,9 @@ public class AdminInterceptor implements HandlerInterceptor { // 请求方法类型 String reqUri = request.getRequestURI(); + if (reqUri.startsWith("/api/file/download/template/")) { + return true; + } if (!(handler instanceof HandlerMethod) || !reqUri.startsWith("/api")) { return HandlerInterceptor.super.preHandle(request, response, handler); } @@ -216,7 +219,6 @@ public class AdminInterceptor implements HandlerInterceptor { if (StringUtils.isNotNull(method) && method.isAnnotationPresent(NotPower.class)) { break; } - // 路由转权限 String prefix = "/api/"; String route = uri.replaceFirst(prefix, ""); 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 282be7a..359f58b 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 @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject; import com.biutag.aop.NotPower; import com.biutag.config.Minio; import com.biutag.core.AjaxResult; +import jakarta.servlet.ServletOutputStream; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; @@ -13,6 +14,9 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.Objects; @Slf4j @RequiredArgsConstructor @@ -43,7 +47,30 @@ public class FileController { @GetMapping("stream/**") public void download(HttpServletRequest request, HttpServletResponse response) throws IOException { String requestURI = request.getRequestURI(); + if (requestURI.toLowerCase().endsWith(".pdf")) { + response.setContentType("application/pdf"); + } minio.get(requestURI.substring("/api/file/stream/".length()), response.getOutputStream()); } + @NotPower + @GetMapping("download/template/{filename}") + public void download(@PathVariable String filename, HttpServletResponse response) throws IOException { + InputStream is = getClass().getResourceAsStream(String.format("/templates/%s", filename)); + if (Objects.isNull(is)) { + return; + } + // 下载 + response.setContentType("application/octet-stream"); + response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); + ServletOutputStream os = response.getOutputStream(); + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = is.read(buffer, 0, buffer.length)) != -1) { + os.write(buffer, 0, bytesRead); + } + is.close(); + os.close(); + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java index 9b753f4..19eed88 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java @@ -29,7 +29,6 @@ public class MailOuter { /** * 联系人性别 M / F */ - @NotBlank(message = "请选择联系人性别") private String contactSex; /** diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java index bf6a5c1..094aaad 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java @@ -3,33 +3,36 @@ package com.biutag.lan.flow; import lombok.AllArgsConstructor; import lombok.Getter; +@Getter @AllArgsConstructor public enum FlowNameEnum { - PENDING_SIGN("待签收"), - PENDING_SIGN_CO("待签收(协办)"), - PENDING_DISTRIBUTE("待下发"), + PENDING_SIGN("待签收", "已签收"), + PENDING_SIGN_CO("待签收(协办)","已签收(协办)"), + PENDING_DISTRIBUTE("待下发", "已下发"), - PENDING_DISTRIBUTE_CO("待下发(协办)"), + PENDING_DISTRIBUTE_CO("待下发(协办)", "已下发"), - CONTACT_WRITER("联系群众"), - INTERVIEW_WRITER("接访群众"), + CONTACT_WRITER("联系群众", "联系群众"), + INTERVIEW_WRITER("接访群众", "接访群众"), - VERIFY("核查办理"), + VERIFY("核查办理", "核查办理"), - PENDING_APPROVAL("待审批"), + PENDING_APPROVAL("待审批", "已审批"), - PENDING_REPORT("待呈报"), + PENDING_REPORT("待呈报", "已呈报"), - COUNTERSIGNING("会签中"), + COUNTERSIGNING("会签中", "会签完成"), - PENDING_COUNTERSIGN("待会签"), - MAIL_RETURN("信件退回"), - RETURN_RECTIFICATION("退回整改"), + PENDING_COUNTERSIGN("待会签", "已会签"), + MAIL_RETURN("信件退回", "信件退回"), + RETURN_RECTIFICATION("退回整改", "退回整改"), + + CO_HANDLING("协查办理", "协查办理"); - CO_HANDLING("协查办理"); - @Getter private String name; + private String doneName; + } 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 acbe392..d0c01e1 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 @@ -8,6 +8,7 @@ import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailMark; import com.biutag.lan.domain.MailReturn; +import com.biutag.lan.domain.Work; import com.biutag.lan.enums.MailState; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; @@ -61,7 +62,7 @@ public class FirstApprovalFlow extends Flow { public void confirmedCompletion(String mailId, JSONObject data) { LocalDateTime now = LocalDateTime.now(); // 将市局专班信件改为已办 - workService.updateDone(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), now); + workService.updateByMunicipal(mailId, Work.State.done.name(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); // 更新信件(信件已办结) Mail mail = mailService.getById(mailId); Boolean problemSolvingStatus = data.getBoolean("problemSolvingStatus"); @@ -96,6 +97,7 @@ public class FirstApprovalFlow extends Flow { Assert.hasText(returnOperate, "参数错误"); String reason = data.getString("reason"); Assert.hasText(reason, "参数错误"); + Mail mail = mailService.getById(mailId); MailReturn mailReturn = new MailReturn() .setMailId(mailId) .setReason(reason) @@ -106,11 +108,10 @@ public class FirstApprovalFlow extends Flow { .setCreateTime(now); mailReturnService.save(mailReturn); // 更新已办 - workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), now); + workService.updateByMunicipal(mailId, Work.State.done.name(), FlowNameEnum.MAIL_RETURN.getDoneName()); // 更新二级机构专班的待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.RETURN_RECTIFICATION.getName()); + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.RETURN_RECTIFICATION.getName()); // 更新信件 - Mail mail = mailService.getById(mailId); mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.SECOND_APPROVAL.getKey()) .setReturnOperate(returnOperate); 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 7aa3880..b52756b 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 @@ -3,6 +3,7 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; import com.biutag.lan.domain.Mail; +import com.biutag.lan.domain.Work; import com.biutag.lan.flow.Flow; import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.flow.FlowNodeEnum; @@ -41,7 +42,7 @@ public class FirstDistributeFlow extends Flow { LocalDateTime now = LocalDateTime.now(); Mail mail = mailService.getById(mailId); // 将我的工作待办改成已办 - workService.updateDone(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(),now); + workService.updateByMunicipal(mailId, Work.State.done.name(), FlowNameEnum.PENDING_DISTRIBUTE.getDoneName()); JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId)); // 下发信件(主责单位) 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 d2df2f9..653b9c7 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 @@ -103,7 +103,7 @@ public class FirstSignFlow extends Flow { .setUpdateTime(now); mailService.save(mail); // 更新为已办 - workService.updateDone(mailId, AdminThreadLocal.getRoleId(), now); + workService.updateByMunicipal(mailId, Work.State.done.name(), null); return null; } @@ -118,7 +118,7 @@ public class FirstSignFlow extends Flow { .setUpdateTime(now); mailService.save(mail); // 更新为已办 - workService.updateDone(mailId, AdminThreadLocal.getRoleId(), now); + workService.updateByMunicipal(mailId, Work.State.done.name(), null); return null; } 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 4657c3f..165bb75 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 @@ -6,6 +6,7 @@ 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.domain.Work; import com.biutag.lan.enums.CompleteMethod; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; @@ -59,6 +60,7 @@ public class SecondApprovalFlow extends Flow { LocalDateTime now = LocalDateTime.now(); String reason = data.getString("reason"); Assert.hasText(reason, "参数错误"); + Mail mail = mailService.getById(mailId); MailReturn mailReturn = new MailReturn() .setMailId(mailId) .setReason(reason) @@ -69,11 +71,10 @@ public class SecondApprovalFlow extends Flow { .setCreateTime(now); mailReturnService.save(mailReturn); // 更新已办 - workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), now); + workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.MAIL_RETURN.getDoneName()); // 更新三级机构专班的待办 - workService.updateTodo(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.RETURN_RECTIFICATION.getName()); + workService.updateTodo(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.RETURN_RECTIFICATION.getName()); // 更新信件 - Mail mail = mailService.getById(mailId); mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.VERIFY.getKey()) .setFlowBeforeName("信件退回"); @@ -88,9 +89,9 @@ public class SecondApprovalFlow extends Flow { // 审批意见 mailApprovalService.saveOrUpdate(mail.getId(), mail.getFlowKey(), data.getString("approvalComment"), null, now); // 将二级专班角色的信件改为已办 - workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); + workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); // 将市局专班信件改为待办 - workService.updateTodo(mail.getId(), RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + workService.updateByMunicipal(mail.getId(), Work.State.todo.name(), FlowNameEnum.PENDING_APPROVAL.getName()); // 更新信件 mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.FIRST_APPROVAL.getKey()) @@ -108,7 +109,7 @@ public class SecondApprovalFlow extends Flow { // 审批意见 mailApprovalService.saveOrUpdate(mail.getId(), mail.getFlowKey(), data.getString("approvalComment"), leaderEmpNo, now); // 将二级专班角色的信件改为已办 - workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); + workService.updateDone(mail.getId(), RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); // 将二级副职领导新增信件 workService.save(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName()); Flow nextNode = next.get(nextActionKey); 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 75bc85b..8278de9 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 @@ -51,7 +51,7 @@ public class SecondDeputyApprovalFlow extends Flow { // 审批意见 mailApprovalService.saveOrUpdate(mailId, mail.getFlowKey(), data.getString("approvalComment"), leaderEmpNo, now); // 将我的信件改为已办 - workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), now); + workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); // 给二级机构正职领导新增待办 workService.save(mail, leaderEmpNo, now, FlowNameEnum.PENDING_APPROVAL.getName()); Flow nextNode = next.get(nextActionKey); @@ -68,9 +68,9 @@ public class SecondDeputyApprovalFlow extends Flow { Mail mail = mailService.getById(mailId); mailApprovalService.saveOrUpdate(mailId, mail.getFlowKey(), data.getString("reason"), null, true, now); // 将我的信件改为已办 - workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), now); + workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.MAIL_RETURN.getDoneName()); // 更新二级机构专班的待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.PENDING_APPROVAL.getName()); // 更新信件 mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.SECOND_APPROVAL.getKey()) 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 3b6ebf2..9b51ca7 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 @@ -42,9 +42,9 @@ public class SecondLeaderApprovalFlow extends Flow { // 审批意见 mailApprovalService.saveOrUpdate(mailId, mail.getFlowKey(), data.getString("approvalComment"), null, now); // 将我的信件改为已办 - workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), now); + workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.PENDING_APPROVAL.getDoneName()); // 转给二级专班 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.PENDING_REPORT.getName()); + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.PENDING_REPORT.getName()); Flow nextNode = next.get(nextActionKey); // 更新信件 mail.setUpdateTime(now) diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondReportingFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondReportingFlow.java index bab4e88..d6f87d4 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondReportingFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondReportingFlow.java @@ -2,7 +2,9 @@ package com.biutag.lan.flow.node; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; +import com.biutag.lan.domain.Work; import com.biutag.lan.flow.Flow; import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.service.MailService; @@ -25,9 +27,9 @@ public class SecondReportingFlow extends Flow { LocalDateTime now = LocalDateTime.now(); Mail mail = mailService.getById(mailId); // 将二级专班信件改为已办 - workService.updateDone(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now); + workService.updateDone(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId(), FlowNameEnum.PENDING_REPORT.getDoneName()); // 将市局专班信件改为待办 - workService.updateTodo(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + workService.updateByMunicipal(mailId, Work.State.todo.name(), FlowNameEnum.PENDING_APPROVAL.getName()); Flow nextNode = next.get(nextActionKey); // 更新信件 mail.setUpdateTime(now) 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 cab1a46..f3d4cc1 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 @@ -67,7 +67,7 @@ public class SecondSignFlow extends Flow { work.setUpdateTime(now).setWorkState(Work.State.done.name()); workService.updateById(work); // 更新市局专班的待办 - workService.updateTodo(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.MAIL_RETURN.getName()); + workService.updateByMunicipal(mailId, Work.State.todo.name(), FlowNameEnum.MAIL_RETURN.getName()); Mail mail = mailService.getById(mailId); // 主责单位 if (work.getMainDeptFlag()) { 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 d86715f..6e3bfec 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 @@ -71,13 +71,18 @@ public class ThreeContactWriterFlow extends Flow { mail.setFlowKey(FlowNodeEnum.VERIFY.getKey()) .setFlowBeforeName(FlowNodeEnum.VERIFY.getFullName()); } - mailService.updateById(mail); + // 更新我的工作 Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId()); work.setFlowName(FlowNameEnum.INTERVIEW_WRITER.getName()).setUpdateTime(now); 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); return nextNode; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java index a0fe21b..0f1b999 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeInterviewWriterFlow.java @@ -1,5 +1,6 @@ package com.biutag.lan.flow.node; +import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; import com.biutag.lan.config.AdminThreadLocal; @@ -14,6 +15,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import java.time.LocalDateTime; +import java.util.Objects; /** * 接访群众 @@ -50,9 +52,13 @@ public class ThreeInterviewWriterFlow extends Flow { .setInterviewAttachments(data.getString("interviewAttachments")) .setFlowKey(nextNode.getFlowNode().getKey()) .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); - mailService.updateById(mail); // 处理协办民警 threeSignFlow.saveCoHandling(mail, data); + JSONArray coHandingPolices = data.getJSONArray("coHandingPolices"); + if (Objects.nonNull(coHandingPolices) && !coHandingPolices.isEmpty()) { + mail.setCoHandlingPolices(coHandingPolices.toJSONString()); + } + 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 558f757..ae59439 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 @@ -42,9 +42,10 @@ public class ThreeLeaderApprovalFlow extends Flow { // 审批意见 mailApprovalService.saveOrUpdate(mailId, mail.getFlowKey(), data.getString("approvalComment"), null, now); // 将我的信件改为已办 - workService.updateDone(mailId, empNo, now); + workService.updateDone(mailId, empNo, FlowNameEnum.PENDING_APPROVAL.getDoneName()); // 将二级专班的信件改为待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.PENDING_APPROVAL.getName()); + Flow nextNode = next.get(nextActionKey); // 更新信件 mail.setUpdateTime(now) @@ -58,6 +59,8 @@ public class ThreeLeaderApprovalFlow extends Flow { LocalDateTime now = LocalDateTime.now(); String reason = data.getString("reason"); Assert.hasText(reason, "参数错误"); + Mail mail = mailService.getById(mailId); + MailReturn mailReturn = new MailReturn() .setMailId(mailId) .setReason(reason) @@ -68,11 +71,10 @@ public class ThreeLeaderApprovalFlow extends Flow { .setCreateTime(now); mailReturnService.save(mailReturn); // 更新已办 - workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), now); + workService.updateDone(mailId, AdminThreadLocal.getEmpNo(), FlowNameEnum.MAIL_RETURN.getDoneName()); // 更新三级机构专班的待办 - workService.updateTodo(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.RETURN_RECTIFICATION.getName()); + workService.updateTodo(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mail.getThreeDeptId(), FlowNameEnum.RETURN_RECTIFICATION.getName()); // 更新信件 - Mail mail = mailService.getById(mailId); mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.VERIFY.getKey()) .setFlowBeforeName("信件退回"); 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 5fd7dd5..462775f 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 @@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; @@ -57,6 +58,8 @@ public class ThreeSignFlow extends Flow { } String reason = data.getString("reason"); Assert.hasText(reason, "参数错误"); + Mail mail = mailService.getById(mailId); + MailReturn mailReturn = new MailReturn() .setMailId(mailId) .setReason(reason) @@ -66,12 +69,11 @@ public class ThreeSignFlow extends Flow { .setCreateTime(now); mailReturnService.save(mailReturn); // 更新已办 - work.setUpdateTime(now).setWorkState(Work.State.done.name()); + work.setUpdateTime(now).setWorkState(Work.State.done.name()).setFlowName(FlowNameEnum.MAIL_RETURN.getDoneName()); workService.updateById(work); // 更新二级机构专班的待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.MAIL_RETURN.getName()); + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.MAIL_RETURN.getName()); // 更新信件 - Mail mail = mailService.getById(mailId); mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey()) .setFlowBeforeName("信件退回"); @@ -109,7 +111,7 @@ public class ThreeSignFlow extends Flow { JSONArray coHandingPolices = data.getJSONArray("coHandingPolices"); if (Objects.nonNull(coHandingPolices) && coHandingPolices.size() > 0) { for (Object coHandingPolice : coHandingPolices) { - Map obj = (JSONObject) coHandingPolice; + Map obj = (LinkedHashMap) coHandingPolice; String empNo = obj.get("empNo").toString(); Work coWork = workService.getOne(mail.getId(), empNo); if (Objects.nonNull(coWork)) { 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 e6c0db5..39f4b7f 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 @@ -4,11 +4,13 @@ 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.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.biutag.enums.RoleEnum; import com.biutag.exception.BusinessException; import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; +import com.biutag.lan.domain.Work; import com.biutag.lan.enums.ExtensionState; import com.biutag.lan.enums.WorkType; import com.biutag.lan.flow.ActionEnum; @@ -21,6 +23,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.Objects; import java.util.Optional; @RequiredArgsConstructor @@ -56,12 +59,14 @@ public class ThreeVerifyFlow extends Flow { Assert.notNull(extensionDays, "延期时长不能为空"); String reason = data.getString("extensionReason"); Assert.hasText(reason, "延期理由不能为空"); + Mail mail = mailService.getById(mailId); LocalDateTime now = LocalDateTime.now(); // 给二级机构增加待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), WorkType.extension_approval.name(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + Work work = workService.getOne(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId()); + work.setWorkType(WorkType.extension_approval.name()).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName()).setUpdateTime(now); + workService.updateById(work); - Mail mail = mailService.getById(mailId); mail.setUpdateTime(now) .setExtensionDays(extensionDays) .setExtensionReason(reason) @@ -157,11 +162,17 @@ public class ThreeVerifyFlow extends Flow { .setCompleteMethod(data.getString("completeMethod")) .setFlowKey(nextNode.getFlowNode().getKey()) .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); - mailService.updateById(mail); + // 将本人下的件改为已办 - workService.updateDone(mail.getId(), AdminThreadLocal.getRoleId(), now); + workService.updateDone(mail.getId(), AdminThreadLocal.getRoleId(), AdminThreadLocal.getDeptId(), FlowNameEnum.VERIFY.getDoneName()); // 处理协办民警 threeSignFlow.saveCoHandling(mail, data); + JSONArray coHandingPolices = data.getJSONArray("coHandingPolices"); + if (Objects.nonNull(coHandingPolices) && !coHandingPolices.isEmpty()) { + mail.setCoHandlingPolices(coHandingPolices.toJSONString()); + } + // 更新信件 + mailService.updateById(mail); } public Flow offline(String nextActionKey, String mailId, JSONObject data) { @@ -170,7 +181,7 @@ public class ThreeVerifyFlow extends Flow { Mail mail = mailService.getById(mailId); applicationCompleted(nextActionKey, mail, data, now); // 给二级机构专班增加待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.PENDING_APPROVAL.getName()); return null; } 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 19d2524..17a2903 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 @@ -87,7 +87,7 @@ public class MailService extends ServiceImpl { } MailVo mailVo = MailVo.of(mail); - List list = mailApprovalService.list(mailId); + List flows = mailFlowService.list(mailId) // 时间倒叙 @@ -99,6 +99,8 @@ public class MailService extends ServiceImpl { // 部门会签 mailVo.setCountersigns(mailCountersignService.list(mailId)); + // 审批 + List list = mailApprovalService.list(mailId); if (!list.isEmpty()) { // 线下 if (CompleteMethod.offline.name().equals(mail.getCompleteMethod())) { @@ -210,12 +212,12 @@ public class MailService extends ServiceImpl { public boolean invalidCompletion(InvalidCompletion completion) { LocalDateTime now = LocalDateTime.now(); // 将我的工作更新为已办 - workService.updateDone(completion.getMailId(), AdminThreadLocal.getRoleId(), now); + workService.updateByMunicipal(completion.getMailId(), Work.State.done.name(), null); MailSource mailSource = mailSourceService.getById(completion.getMailId()); Mail mail = mailSource.toMail() // 办理中 - .setMailState(MailState.processing.getValue()) + .setMailState(MailState.completion.getValue()) .setMailFirstCategory(completion.getMailFirstCategory()) .setMailCategory(completion.getMailCategory()) .setMailLevel(completion.getMailLevel()) @@ -299,7 +301,9 @@ public class MailService extends ServiceImpl { workService.updateById(work); if (!returnFlag) { // 给市局机构增加待办 - return workService.updateTodo(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), WorkType.extension_approval.name(), now, FlowNameEnum.PENDING_APPROVAL.getName()); + Work municipalWork = workService.getByMunicipal(mailId); + municipalWork.setWorkType(WorkType.extension_approval.name()).setUpdateTime(now).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName()); + return workService.updateById(municipalWork); } } else { // 市局 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 bddad01..94c48b5 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 @@ -154,45 +154,36 @@ public class WorkService extends ServiceImpl { return saveBatch(collect); } - /** - * 更新角色的已办 - * - * @param mailId - * @param roleId - * @param time - * @return - */ - public boolean updateDone(String mailId, Integer roleId, LocalDateTime time) { - Work work = getByRoleId(mailId, roleId); - work.setUpdateTime(time).setWorkState(Work.State.done.name()); + public boolean updateDone(String mailId, Integer roleId, Integer deptId, String flowName) { + Work work = getOne(mailId, roleId, deptId); + work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.done.name()).setFlowName(flowName); return updateById(work); } - /** - * 更新个人的角色已办 - * - * @param mailId - * @param empNo - * @param time - * @return - */ - public boolean updateDone(String mailId, String empNo, LocalDateTime time) { + public boolean updateDone(String mailId, String empNo, String flowName) { Work work = getOne(mailId, empNo); - work.setUpdateTime(time).setWorkState(Work.State.done.name()); + work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.done.name()).setFlowName(flowName); return updateById(work); } + public boolean updateTodo(String mailId, String empNo, String flowName) { + Work work = getOne(mailId, empNo); + work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.todo.name()).setFlowName(flowName); + return updateById(work); + } - public boolean updateTodo(String mailId, Integer roleId, LocalDateTime time, String flowName) { - Work work = getByRoleId(mailId, roleId); - work.setUpdateTime(time).setWorkState(Work.State.todo.name()).setPoliceEmpNo(null).setFlowName(flowName); + public boolean updateTodo(String mailId, Integer roleId, Integer deptId, String flowName) { + Work work = getOne(mailId, roleId, deptId); + work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.todo.name()).setFlowName(flowName); return updateById(work); } - public boolean updateTodo(String mailId, Integer roleId, String workType, LocalDateTime time, String flowName) { - Work work = getByRoleId(mailId, roleId); - work.setUpdateTime(time).setWorkState(Work.State.todo.name()).setPoliceEmpNo(null).setWorkType(workType).setFlowName(flowName); + public boolean updateByMunicipal(String mailId, String workState, String flowName) { + Work work = getByMunicipal(mailId); + work.setUpdateTime(LocalDateTime.now()) + .setWorkState(workState) + .setFlowName(flowName); return updateById(work); } @@ -254,15 +245,6 @@ public class WorkService extends ServiceImpl { return getOne(queryWrapper); } - public Work getByRoleId(String mailId, Integer roleId) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(Work::getMailId, mailId) - .eq(Work::getSignRoleId, roleId) - .eq(Work::getWorkType, WorkType.processing.name()) - .eq(Work::getMainDeptFlag, true); - return getOne(queryWrapper); - } - public Work getOne(String mailId, Integer roleId, Integer deptId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() .eq(Work::getMailId, mailId) diff --git a/mailbox-lan/src/main/resources/application.yml b/mailbox-lan/src/main/resources/application.yml index c723dde..913a229 100644 --- a/mailbox-lan/src/main/resources/application.yml +++ b/mailbox-lan/src/main/resources/application.yml @@ -23,6 +23,10 @@ spring: max-file-size: 100MB max-request-size: 100MB +mybatis-plus: + # 对应的 XML 文件位置 + mapper-locations: classpath*:mapper/*Mapper.xml + # Sa-token配置 sa-token: token-name: admin # token的名称 @@ -33,11 +37,9 @@ sa-token: token-style: random-64 # token生成的风格 is-print: false # 打印版本字符画 is-log: false # 是否输出操作日志 + + logging: level: root: INFO - com.biutag: debug - -mybatis-plus: - # 对应的 XML 文件位置 - mapper-locations: classpath*:mapper/*Mapper.xml \ No newline at end of file + com.biutag: debug \ No newline at end of file diff --git a/mailbox-lan/src/main/resources/templates/《处理反馈表》.doc b/mailbox-lan/src/main/resources/templates/《处理反馈表》.doc new file mode 100644 index 0000000..d60ff15 Binary files /dev/null and b/mailbox-lan/src/main/resources/templates/《处理反馈表》.doc differ diff --git a/mailbox-lan/src/main/resources/templates/《核查办理报告》.doc b/mailbox-lan/src/main/resources/templates/《核查办理报告》.doc new file mode 100644 index 0000000..0b83fe8 Binary files /dev/null and b/mailbox-lan/src/main/resources/templates/《核查办理报告》.doc differ diff --git a/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java b/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java index af94d86..45d48e2 100644 --- a/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java +++ b/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java @@ -16,5 +16,6 @@ public class JsonTest { JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map)); JSONArray jsonArray = jsonObject.getJSONArray("a"); System.out.println(); + } } diff --git a/mailbox-lan/src/test/java/com/biutag/lan/TestResource.java b/mailbox-lan/src/test/java/com/biutag/lan/TestResource.java new file mode 100644 index 0000000..ed7cbae --- /dev/null +++ b/mailbox-lan/src/test/java/com/biutag/lan/TestResource.java @@ -0,0 +1,32 @@ +package com.biutag.lan; + +import org.junit.jupiter.api.Test; + +import java.io.*; + +public class TestResource { + + @Test + public void testClassResource() throws IOException { +// InputStream is = getClass().getResourceAsStream("/templates/《处理反馈表》.doc"); + File file = new File("D:\\deploy\\文档.doc"); + FileInputStream is = new FileInputStream(file); + + InputStreamReader reader = new InputStreamReader(is, "UTF-8"); + + // 创建UTF-8编码的输出流 + FileOutputStream os = new FileOutputStream("D:\\deploy\\文档1.doc"); + + // 创建UTF-8编码的写入器 + OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8"); + + int c; + while ((c = reader.read()) != -1) { + // 将每个字节从ISO-8859-1转换为UTF-8并写入输出流 + writer.write((char) c); + } + // 关闭流 + reader.close(); + writer.close(); + } +} diff --git a/pom.xml b/pom.xml index 0968f3c..6ae3f6a 100644 --- a/pom.xml +++ b/pom.xml @@ -121,13 +121,6 @@ - - - src/main/resources - true - - - diff --git a/sql/240227.sql b/sql/240227.sql new file mode 100644 index 0000000..52ea8da --- /dev/null +++ b/sql/240227.sql @@ -0,0 +1 @@ +ALTER TABLE mailbox.mail ALTER COLUMN verify_attachments TYPE text USING verify_attachments::text; \ No newline at end of file