From bb80ff63d6ac5d684615acb9667b011d8d8e77e5 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Thu, 28 Mar 2024 16:32:39 +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/work/WorkController.java | 7 +++++++ .../java/com/biutag/lan/service/FavoriteService.java | 11 +++++++++-- .../main/java/com/biutag/lan/service/MailService.java | 9 +++++++-- .../src/main/resources/mapper/DataScreenMapper.xml | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java index 5f6cead..774fe95 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java @@ -1,5 +1,6 @@ package com.biutag.lan.controller.work; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.aop.NotLogin; @@ -81,6 +82,12 @@ public class WorkController { return AjaxResult.success(mailService.getMailFlowDetailByWork(mailId, workId)); } + /** + * 转为待办 + * @param mailId + * @return + */ + @SaCheckPermission("mail:change") @GetMapping("change") public AjaxResult change(@RequestParam String mailId) { return mailService.change(mailId) ? AjaxResult.success() : AjaxResult.failed("操作失败"); 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 3f64d4d..e6f417a 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 @@ -23,8 +23,15 @@ public class FavoriteService extends ServiceImpl { private final MailSourceService mailSourceService; - public Favorite get(String mailId, String policeEmpNo) { - return getOne(new LambdaQueryWrapper().eq(Favorite::getMailId, mailId).eq(Favorite::getPoliceEmpNo, policeEmpNo)); + public Favorite getByCurrentUser(String mailId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(Favorite::getMailId, mailId); + Integer roleId = AdminThreadLocal.getRoleId(); + if (RoleEnum.isClasses(roleId)) { + queryWrapper.eq(Favorite::getRoleId, roleId).eq(Favorite::getDeptId, AdminThreadLocal.getDeptId()); + } else { + queryWrapper.eq(Favorite::getPoliceEmpNo, AdminThreadLocal.getEmpNo()); + } + return getOne(queryWrapper); } public Page page(Page page, MailQuery mailQuery) { 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 3576509..d35f99e 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 @@ -105,7 +105,7 @@ public class MailService extends ServiceImpl { .stream().sorted(Comparator.comparing(MailFlow::getCreateTime).reversed()).collect(Collectors.toList()); flowDetail.setMail(mailVo) - .setIsFav(Objects.nonNull(favoriteService.get(mailId, AdminThreadLocal.getEmpNo()))) + .setIsFav(Objects.nonNull(favoriteService.getByCurrentUser(mailId))) .setFlows(flows); // 部门会签 mailVo.setCountersigns(mailCountersignService.list(mailId)); @@ -398,9 +398,14 @@ public class MailService extends ServiceImpl { .setMailState(MailState.processing.getValue()) .setFlowName(FlowNodeEnum.FIRST_SIGN.getFullName()) .setMailCategory(null).setMailFirstCategory(null); - Work work = workMapper.selectOne(new LambdaQueryWrapper().eq(Work::getMailId, mailId)); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(Work::getMailId, mailId) + .eq(Work::getSignRoleId, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()); + Work work = workMapper.selectOne(queryWrapper); work.setWorkState(Work.State.todo.name()); workMapper.updateById(work); + MailSource mailSource = mailSourceService.getById(mailId); + mailSource.setSignFlag(false); + mailSourceService.updateById(mailSource); LocalDateTime now = LocalDateTime.now(); MailFlow mailFlow = new MailFlow() .setMailId(mailId) diff --git a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml index d5ece12..82ab301 100644 --- a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml @@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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 + SUM(COALESCE(b.completed, 0)) completed,count(b.mail_id) sum -- 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 from dept a left join mail_mark b on a.id = b.second_dept_id