From eeaceb4eaa65e673907aed29db75304881625c35 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Thu, 21 Mar 2024 18:13:03 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biutag/lan/controller/HomeController.java | 10 +++-- .../lan/flow/node/FirstApprovalFlow.java | 11 +++-- .../lan/flow/node/SecondDistributeFlow.java | 3 +- .../biutag/lan/flow/node/SecondSignFlow.java | 3 +- .../biutag/lan/flow/node/ThreeSignFlow.java | 29 ++++++++----- .../biutag/lan/service/DataScreenService.java | 43 ++++++++++++++----- .../resources/mapper/DataScreenMapper.xml | 20 ++++----- .../java/com/biutag/lan/NumberUtilTest.java | 12 ++++++ 8 files changed, 90 insertions(+), 41 deletions(-) create mode 100644 mailbox-lan/src/test/java/com/biutag/lan/NumberUtilTest.java 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 fa86ed4..ba8e3b3 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 @@ -8,8 +8,10 @@ import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; 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.domain.bo.MailTotal; +import com.biutag.lan.enums.MailState; import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.flow.FlowNodeEnum; import com.biutag.lan.service.MailMarkService; @@ -74,9 +76,11 @@ public class HomeController { Integer contactWriterTotal = workService.count(FlowNodeEnum.CONTACT_WRITER.getKey(), deptId); Integer interviewWriterTotal = workService.count(FlowNodeEnum.INTERVIEW_WRITER.getKey(), deptId); Integer verifyTotal = workService.count(FlowNodeEnum.VERIFY.getKey(), deptId); - // 已申请延期 - Integer extensionTotal = workService.count(true, deptId); - Integer approvalTotal = workService.count(Arrays.asList(FlowNodeEnum.THREE_LEADER_APPROVAL.getKey(), + // 申请延期中 + int extensionTotal = Long.valueOf(mailService.count(new LambdaQueryWrapper().eq(Mail::getMailState, MailState.delayed.getName()))).intValue(); + Integer approvalTotal = workService.count(Arrays.asList( + FlowNodeEnum.THREE_LEADER_APPROVAL.getKey(), + FlowNodeEnum.SECOND_APPROVAL.getKey(), FlowNodeEnum.SECOND_DEPUTY_APPROVAL.getKey(), FlowNodeEnum.SECOND_LEADER_APPROVAL.getKey(), FlowNodeEnum.SECOND_REPORTING.getKey(), 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 b480424..697a6ef 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 @@ -6,21 +6,24 @@ import com.biutag.constants.AppConstants; import com.biutag.enums.RoleEnum; import com.biutag.exception.BusinessException; import com.biutag.lan.config.AdminThreadLocal; -import com.biutag.lan.domain.*; -import com.biutag.lan.enums.MailCategory; +import com.biutag.lan.domain.Mail; +import com.biutag.lan.domain.MailMark; +import com.biutag.lan.domain.MailReturn; import com.biutag.lan.enums.MailState; import com.biutag.lan.flow.ActionEnum; import com.biutag.lan.flow.Flow; import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.flow.FlowNodeEnum; -import com.biutag.lan.service.*; +import com.biutag.lan.service.MailMarkService; +import com.biutag.lan.service.MailReturnService; +import com.biutag.lan.service.MailService; +import com.biutag.lan.service.WorkService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.time.LocalDateTime; import java.util.Objects; -import java.util.Optional; import java.util.stream.Collectors; @RequiredArgsConstructor 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 ee14061..506faac 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 @@ -48,9 +48,8 @@ public class SecondDistributeFlow extends Flow { LocalDateTime now = LocalDateTime.now(); Mail mail = mailService.getById(mailId); - // 将我的工作待办改成已办 - Work myWork = workService.getOne(mailId, AdminThreadLocal.getEmpNo()); + Work myWork = workService.getOne(mailId, AdminThreadLocal.getRoleId(), AdminThreadLocal.getDeptId()); myWork.setWorkState(Work.State.done.name()).setUpdateTime(now); workService.updateById(myWork); DeptVo deptVo = deptService.detail(mainDeptId); 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 a741714..aea77ba 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 @@ -79,7 +79,8 @@ public class SecondSignFlow extends Flow { if (work.getMainDeptFlag()) { mail.setUpdateTime(now) .setFlowKey(FlowNodeEnum.FIRST_SIGN.getKey()) - .setFlowName(FlowNameEnum.MAIL_RETURN.getName()); + .setFlowName(FlowNameEnum.MAIL_RETURN.getName()) + .setFlowLimitedLastHandlerTime(now); // 将信件源表的签收设置为未签收 MailSource mailSource = mailSourceService.getById(mailId).setSignFlag(false); mailSourceService.updateById(mailSource); 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 edd636f..366ae8c 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 @@ -51,7 +51,7 @@ public class ThreeSignFlow extends Flow { Assert.hasText(reason, "参数错误"); LocalDateTime now = LocalDateTime.now(); Integer deptId = AdminThreadLocal.getDeptId(); - Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(),deptId); + Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), deptId); if (work.getWorkState().equals(Work.State.done.name())) { throw new BusinessException("该信件已被其他专班处理"); } @@ -69,15 +69,24 @@ public class ThreeSignFlow extends Flow { // 更新已办 work.setUpdateTime(now).setWorkState(Work.State.done.name()).setFlowName(FlowNameEnum.MAIL_RETURN.getDoneName()); workService.updateById(work); - // 将所有协办的待办更新为已办 - workService.updateDoneByCoHandling(mailId); - // 更新二级机构专班的待办 - workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.MAIL_RETURN.getName()); - // 更新信件 - mail.setUpdateTime(now) - .setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey()) - .setFlowName(FlowNameEnum.MAIL_RETURN.getName()); - mailService.updateById(mail); + // 主责单位 + if (work.getMainDeptFlag()) { + // 将所有协办的待办更新为已办 + workService.updateDoneByCoHandling(mailId); + // 更新二级机构专班的待办 + workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.MAIL_RETURN.getName()); + // 更新信件 + mail.setUpdateTime(now) + .setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey()) + .setFlowName(FlowNameEnum.MAIL_RETURN.getName()) + // 更新操作时间 + .setFlowLimitedLastHandlerTime(now); + mailService.updateById(mail); + } + // 非主责 + else { + + } // 通知 noticeService.sendNoticeDoneByRole(); return null; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java index c32158a..f246613 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java @@ -1,10 +1,14 @@ package com.biutag.lan.service; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.constants.AppConstants; import com.biutag.entity.system.Duty; import com.biutag.enums.DeptTypeEnum; import com.biutag.lan.domain.Mail; @@ -29,6 +33,8 @@ public class DataScreenService extends ServiceImpl { private final MailMarkService mailMarkService; + private final MailSourceService mailSourceService; + public List> mapData(String deptId) { return baseMapper.mapData(deptId); } @@ -117,25 +123,40 @@ public class DataScreenService extends ServiceImpl { Map mapSatisfied = baseMapper.getAllSatisfiedRate(null);//获取长沙市局 满意率 Long allSum = mailMarkService.count(); - Integer toDayCount = baseMapper.getTodayMailCount(null); mapCompleted.putAll(mapResolved); mapCompleted.putAll(mapSatisfied); - mapCompleted.put("todaySum", toDayCount); + String today = DateUtil.format(new Date(), DatePattern.NORM_DATE_FORMAT); + mapCompleted.put("todaySum", mailSourceService.count(today)); mapCompleted.put("allSum", allSum); return mapCompleted; } else { String deptId = params.get("id").toString(); - Map mapCompleted = baseMapper.getAllCompletedRate(deptId);//获取长沙市局 办结率 - Map mapResolved = baseMapper.getAllResolvedRate(deptId);//获取长沙市局 解决率 - Map mapSatisfied = baseMapper.getAllSatisfiedRate(deptId);//获取长沙市局 满意率 - Long allSum = mailMarkService.count(new LambdaQueryWrapper().eq(MailMark::getSecondDeptId, deptId)); + HashMap map = new HashMap<>(); + long completedsum = mailMarkService.count(new LambdaQueryWrapper().eq(MailMark::getSecondDeptId, deptId)); + long completed = mailMarkService.count(new LambdaQueryWrapper().eq(MailMark::getCompleted, AppConstants.TRUE).eq(MailMark::getSecondDeptId, deptId)); + long resolved = mailMarkService.count(new LambdaQueryWrapper().eq(MailMark::getResolved, AppConstants.TRUE).eq(MailMark::getSecondDeptId, deptId)); + long satisfied = mailMarkService.count(new LambdaQueryWrapper().eq(MailMark::getSatisfied, AppConstants.TRUE).eq(MailMark::getSecondDeptId, deptId)); + + map.put("completedsum", completedsum); + map.put("completed", completed); + // 办结率=已办结数/信件总数 + map.put("completedrate", completedsum == 0 ? "0%" : Double.valueOf(NumberUtil.div(completed, completedsum, 2) * 100).intValue() + "%"); + + map.put("resolvedsum", completed); + map.put("resolved", resolved); + // 解决率=解决数/已办结数 + map.put("resolvedrate", completed == 0 ? "0%" : Double.valueOf(NumberUtil.div(resolved, completed, 2) * 100).intValue() + "%"); + + map.put("satisfiedSum", completed); + map.put("satisfied", satisfied); + // 满意率=满意数/已办结数 + map.put("satisfiedrate", completed == 0 ? "0%" : Double.valueOf(NumberUtil.div(satisfied, completed, 2) * 100).intValue() + "%"); + Long allSum = mailMarkService.count(new LambdaQueryWrapper().eq(MailMark::getSecondDeptId, deptId)); Integer toDayCount = baseMapper.getTodayMailCount(deptId); - mapCompleted.putAll(mapResolved); - mapCompleted.putAll(mapSatisfied); - mapCompleted.put("todaySum", toDayCount); - mapCompleted.put("allSum", allSum); - return mapCompleted; + map.put("todaySum", toDayCount); + map.put("allSum", allSum); + return map; } } diff --git a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml index 391351c..75976a5 100644 --- a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml @@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select b.three_dept_name name, + select a.name, ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber, CONCAT(rateNumber,'%') rate, SUM(COALESCE(b.completed, 0)) completed,count(1) sum - from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId} - GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10 + from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId} + GROUP BY a.name order by rateNumber desc ,sum desc