From 3efdf0d2637665949ce86c6ed6192b604649cb4e Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Tue, 27 Feb 2024 09:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E4=BB=B6=E4=B8=BB=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/biutag/lan/domain/vo/WorkVo.java | 6 ++++ .../lan/flow/node/FirstApprovalFlow.java | 2 ++ .../lan/flow/node/FirstDistributeFlow.java | 4 +-- .../biutag/lan/flow/node/FirstSignFlow.java | 13 +++++---- .../lan/flow/node/SecondDistributeFlow.java | 9 ++---- .../lan/flow/node/ThreeContactWriterFlow.java | 6 ++++ .../flow/node/ThreeInterviewWriterFlow.java | 2 ++ .../biutag/lan/flow/node/ThreeSignFlow.java | 29 +++++++++++++++++++ .../biutag/lan/flow/node/ThreeVerifyFlow.java | 5 ++++ .../com/biutag/lan/mapper/WorkMapper.java | 2 +- .../com/biutag/lan/service/MailService.java | 3 +- .../com/biutag/lan/service/WorkService.java | 11 +++---- .../resources/mapper/DataScreenMapper.xml | 2 +- .../src/main/resources/mapper/WorkMapper.xml | 9 +++--- .../test/java/com/biutag/lan/JsonTest.java | 20 +++++++++++++ 15 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/WorkVo.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/WorkVo.java index 7d44700..c485af5 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/WorkVo.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/WorkVo.java @@ -116,4 +116,10 @@ public class WorkVo { * 会签完成部门数量 */ private Integer countersignCompleted; + + /** + * 当前操作人 + */ + private String currentOperator; + } 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 caa0368..acbe392 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 @@ -22,6 +22,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.Optional; @RequiredArgsConstructor @Component @@ -70,6 +71,7 @@ public class FirstApprovalFlow extends Flow { .setProblemSolvingStatus(problemSolvingStatus) .setSatisfactionStatus(satisfactionStatus) .setCompletionComment(data.getString("completionComment")) + .setMailLabels(Optional.ofNullable(data.getJSONArray("mailLabels")).map(item -> item.toJSONString()).orElse(null)) .setFlowKey(FlowNodeEnum.COMPLETION.getKey()) .setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName()) // 信件状态改为已办结 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 852c1a2..7aa3880 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 @@ -43,9 +43,7 @@ public class FirstDistributeFlow extends Flow { // 将我的工作待办改成已办 workService.updateDone(mailId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(),now); - List secondDept = new ArrayList<>(); - JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId), - "secondDept", secondDept); + JSONObject firstDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId)); // 下发信件(主责单位) workService.saveOrUpdate(mail, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); Integer secondDeptId1 = data.getInteger("secondDeptId1"); 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 45981af..d2df2f9 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 @@ -95,13 +95,13 @@ public class FirstSignFlow extends Flow { Assert.notNull(secondDeptId, "二级办理单位不能为空"); Assert.notNull(threeDeptId, "三级办理单位不能为空"); LocalDateTime now = LocalDateTime.now(); - Mail mail = mailService.getById(mailId); - mail.setSecondDeptId(secondDeptId) + MailSource mailSource = mailSourceService.getById(mailId); + Mail mail = mailSource.toMail().setSecondDeptId(secondDeptId) .setThreeDeptId(threeDeptId) .setFlowKey(FlowNodeEnum.COMPLETION.getKey()) .setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName()) .setUpdateTime(now); - mailService.updateById(mail); + mailService.save(mail); // 更新为已办 workService.updateDone(mailId, AdminThreadLocal.getRoleId(), now); return null; @@ -111,11 +111,12 @@ public class FirstSignFlow extends Flow { String invalidationReason = data.getString("invalidationReason"); Assert.hasText(invalidationReason, "判定理由不能为空"); LocalDateTime now = LocalDateTime.now(); - Mail mail = mailService.getById(mailId); - mail.setFlowKey(FlowNodeEnum.COMPLETION.getKey()) + MailSource mailSource = mailSourceService.getById(mailId); + Mail mail = mailSource.toMail() + .setFlowKey(FlowNodeEnum.COMPLETION.getKey()) .setFlowBeforeName(FlowNodeEnum.COMPLETION.getFullName()) .setUpdateTime(now); - mailService.updateById(mail); + mailService.save(mail); // 更新为已办 workService.updateDone(mailId, AdminThreadLocal.getRoleId(), now); return null; 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 f17c0fa..5f4a2ae 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 @@ -55,9 +55,7 @@ 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); + JSONObject secondDistributeInfo = JSONObject.of("mainDept", JSONObject.of("id", mainDeptId)); if (myWork.getMainDeptFlag()) { // 下发信件(主责单位) workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName()); @@ -66,7 +64,6 @@ public class SecondDistributeFlow extends Flow { workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, false, FlowNameEnum.CO_HANDLING.getName(), FlowNodeEnum.CO_HANDLING.getKey()); - secondDept.add(JSONObject.of("id", mainDeptId)); } Integer secondDeptId1 = data.getInteger("secondDeptId1"); if (Objects.nonNull(secondDeptId1)) { @@ -74,7 +71,7 @@ public class SecondDistributeFlow extends Flow { workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, FlowNameEnum.PENDING_SIGN_CO.getName(), FlowNodeEnum.CO_HANDLING.getKey()); - secondDept.add(JSONObject.of("id", secondDeptId1)); + secondDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1)); } Integer secondDeptId2 = data.getInteger("secondDeptId2"); if (Objects.nonNull(secondDeptId2)) { @@ -82,7 +79,7 @@ public class SecondDistributeFlow extends Flow { workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, FlowNameEnum.PENDING_SIGN_CO.getName(), FlowNodeEnum.CO_HANDLING.getKey()); - secondDept.add(JSONObject.of("id", secondDeptId1)); + secondDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2)); } Flow nextNode = next.get(nextActionKey); if (myWork.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 e654eb0..d86715f 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 @@ -2,6 +2,7 @@ package com.biutag.lan.flow.node; 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.lan.config.AdminThreadLocal; @@ -14,11 +15,13 @@ import com.biutag.lan.flow.FlowNodeEnum; import com.biutag.lan.service.MailService; import com.biutag.lan.service.WorkService; import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.Objects; /** * 三级机构联系群众 @@ -47,6 +50,7 @@ public class ThreeContactWriterFlow extends Flow { Assert.notNull(contactPolice, "联系民警不能为空"); String contactTime = data.getString("contactTime"); Assert.notNull(contactTime, "联系时间不能为空"); + LocalDateTime now = LocalDateTime.now(); // 更新信件 Mail mail = mailService.getById(mailId); @@ -72,6 +76,8 @@ public class ThreeContactWriterFlow extends Flow { 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); 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 a709d90..a0fe21b 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 @@ -51,6 +51,8 @@ public class ThreeInterviewWriterFlow extends Flow { .setFlowKey(nextNode.getFlowNode().getKey()) .setFlowBeforeName(nextNode.getFlowNode().getBeforeName()); mailService.updateById(mail); + // 处理协办民警 + threeSignFlow.saveCoHandling(mail, data); return nextNode; } 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 db4b383..5fd7dd5 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 @@ -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.exception.BusinessException; @@ -15,11 +16,14 @@ import com.biutag.lan.service.MailReturnService; import com.biutag.lan.service.MailService; import com.biutag.lan.service.WorkService; import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.time.LocalDateTime; +import java.util.Map; +import java.util.Objects; /** * 三级机构签收 @@ -99,4 +103,29 @@ public class ThreeSignFlow extends Flow { return nextNode; } + public void saveCoHandling(Mail mail, JSONObject data) { + LocalDateTime now = LocalDateTime.now(); + // 处理协办民警 + JSONArray coHandingPolices = data.getJSONArray("coHandingPolices"); + if (Objects.nonNull(coHandingPolices) && coHandingPolices.size() > 0) { + for (Object coHandingPolice : coHandingPolices) { + Map obj = (JSONObject) coHandingPolice; + String empNo = obj.get("empNo").toString(); + Work coWork = workService.getOne(mail.getId(), empNo); + if (Objects.nonNull(coWork)) { + continue; + } + Work work = new Work(); + BeanUtils.copyProperties(mail, work); + work.setMailId(mail.getId()) + .setPoliceEmpNo(empNo) + .setCreateTime(now) + .setWorkState(Work.State.todo.name()) + .setFlowName(FlowNameEnum.CO_HANDLING.getName()) + .setFlowKey(FlowNodeEnum.CO_HANDLING.getKey()).setUpdateTime(now); + workService.save(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 90fff0f..e6c0db5 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 @@ -29,6 +29,7 @@ public class ThreeVerifyFlow extends Flow { private final MailService mailService; private final WorkService workService; + private final ThreeSignFlow threeSignFlow; @Override public Flow next(String nextActionKey, String mailId, JSONObject data) { @@ -107,6 +108,8 @@ public class ThreeVerifyFlow extends Flow { .setVerifyAttachments(data.getString("verifyAttachments")); BeanUtil.copyProperties(source, mail, CopyOptions.create().setIgnoreNullValue(true)); mailService.updateById(mail); + // 处理协办民警 + threeSignFlow.saveCoHandling(mail, data); return null; } @@ -157,6 +160,8 @@ public class ThreeVerifyFlow extends Flow { mailService.updateById(mail); // 将本人下的件改为已办 workService.updateDone(mail.getId(), AdminThreadLocal.getRoleId(), now); + // 处理协办民警 + threeSignFlow.saveCoHandling(mail, data); } public Flow offline(String nextActionKey, String mailId, JSONObject data) { diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java index 06a2573..2cff7a5 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java @@ -15,7 +15,7 @@ import java.util.Collection; public interface WorkMapper extends BaseMapper { - Page selectPageTodo(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + Page selectPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); Page selectQueryPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); 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 1d5de10..fab7829 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 @@ -2,6 +2,7 @@ package com.biutag.lan.service; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -160,7 +161,7 @@ public class MailService extends ServiceImpl { flowDetail.setMailReturns(mailReturnService.list(mailId)); } // 申请延期 - if (ExtensionState.applying.name().equals(mail.getExtensionState())) { + if (StrUtil.isNotBlank(mail.getExtensionState())) { mailVo.setExtensionApprovals(mailExtensionApprovalService.list(mailId)); } if (Objects.nonNull(mail.getFlowKey()) && FlowNodeEnum.get(mail.getFlowKey()).getIndex() >= FlowNodeEnum.THREE_LEADER_APPROVAL.getIndex()) { 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 1263be0..4bd3c61 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 @@ -106,11 +106,12 @@ public class WorkService extends ServiceImpl { work.setMailId(mail.getId()) .setSignRoleId(roleId) .setSignDeptId(deptId) - .setCreateTime(time) - .setFlowName(flowName) - .setFlowKey(flowKey); + .setCreateTime(time); } - work.setWorkState(Work.State.todo.name()).setUpdateTime(time).setMainDeptFlag(mainDeptFlag).setFlowName(flowName).setFlowKey(flowKey); + work.setWorkState(Work.State.todo.name()) + .setUpdateTime(time) + .setMainDeptFlag(mainDeptFlag) + .setFlowName(flowName).setFlowKey(flowKey); return saveOrUpdate(work); } @@ -230,7 +231,7 @@ public class WorkService extends ServiceImpl { } // 排序 queryWrapper.orderByDesc("w.update_time"); - Page workVoPage = baseMapper.selectPageTodo(page, queryWrapper); + Page workVoPage = baseMapper.selectPage(page, queryWrapper); workVoPage.getRecords().forEach(item -> { // 会签中 if (FlowNameEnum.COUNTERSIGNING.getName().equals(item.getFlowName())) { diff --git a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml index ae3f808..e8b8d33 100644 --- a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml @@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select a.name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate, ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber, SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum - from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY a.name order by rateNumber desc limit 10 + from dept a left join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY a.name order by rateNumber desc limit 10 diff --git a/mailbox-lan/src/main/resources/mapper/WorkMapper.xml b/mailbox-lan/src/main/resources/mapper/WorkMapper.xml index 8584357..783fe56 100644 --- a/mailbox-lan/src/main/resources/mapper/WorkMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/WorkMapper.xml @@ -4,10 +4,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + select w.id, w.contact_name, w.contact_phone, w.contact_id_card, w.content, w.source, w.mail_time, w.mail_id, w.work_type,w.flow_name, + m.mail_state, m.mail_category, m.mail_level, m.three_dept_id, m.three_dept_name, m.flow_key, m.mail_labels, m.countersign_total, m.countersign_completed, + + f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time from work w left join mail m on w.mail_id = m.id diff --git a/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java b/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java new file mode 100644 index 0000000..af94d86 --- /dev/null +++ b/mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java @@ -0,0 +1,20 @@ +package com.biutag.lan; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.Map; + +public class JsonTest { + + @Test + public void testJson() { + Map map = new HashMap<>(); + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map)); + JSONArray jsonArray = jsonObject.getJSONArray("a"); + System.out.println(); + } +}