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 3e683d2..530dfa0 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 @@ -63,7 +63,7 @@ public class DataScreenController { @GetMapping("/peopleMail") @Operation(summary = "群众来信") public AjaxResult> peopleMail(String id) { - return AjaxResult.success(dataScreenService.selectRecentlyMailList(id)); + return AjaxResult.success(dataScreenService.listMailTop20(id)); } @NotLogin 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 7bbeef3..f07f5b0 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 @@ -7,9 +7,11 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; 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.biutag.constants.AppConstants; import com.biutag.entity.system.Duty; import com.biutag.enums.DeptTypeEnum; +import com.biutag.enums.MailState; import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailMark; @@ -45,6 +47,8 @@ public class DataScreenService { private final IDeptService deptService; + private final MailService mailService; + public List mapData() { return baseMapper.mapData(); } @@ -66,15 +70,21 @@ public class DataScreenService { } } - public List selectRecentlyMailList(String deptId) { - if (StrUtil.isBlank(deptId)) { - return baseMapper.selectRecentlyMailList(deptId); - } - DeptVo deptVo = deptService.detail(deptId); - if (deptVo.getLevel() == 1) { - return baseMapper.selectRecentlyMailListByFirst(deptId); + public List listMailTop20(String deptId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .ge(Mail::getMailTime, AppConstants.BEGIN_TIME) + .ne(Mail::getMailState, MailState.terminated.getValue()) + .orderByDesc(Mail::getMailTime); + if (StrUtil.isNotBlank(deptId)) { + DeptVo deptVo = deptService.detail(deptId); + if (deptVo.getLevel() == 1) { + queryWrapper.eq(Mail::getFirstDeptId, deptId); + } + if (deptVo.getLevel() == 2) { + queryWrapper.eq(Mail::getSecondDeptId, deptId); + } } - return baseMapper.selectRecentlyMailList(deptId); + return mailService.page(Page.of(1, 20), queryWrapper).getRecords(); } /** 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 d3f5a79..dd2e549 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 @@ -187,10 +187,10 @@ public class MailService extends ServiceImpl { int limitedTime = flowNode.getLimitedTime().intValue(); // 剩余时间 long flowRemainingTime = holidayService.getFlowRemainingTimeByNow(limitedTime, - FlowNodeEnum.lessInterviewWriter(mail.getFlowKey()) ? mail.getFlowLimitedLastHandlerTime(): mail.getCreateTime(), + Optional.ofNullable(mail.getFlowLimitedLastHandlerTime()).orElse(mail.getCreateTime()), mail.getExtensionDays()); if (Objects.nonNull(mail.getExtensionDays()) && mail.getExtensionDays() > 0) { - limitedTime += mail.getExtensionDays() * 86400; + limitedTime += (int) (mail.getExtensionDays() * AppConstants.ONE_DAY_SECONDS); } // 剩余时间百分比 int flowRemainingTimePercentage = flowRemainingTime <= 0 ? 0 : diff --git a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml index d8c3b09..48a285f 100644 --- a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml @@ -69,9 +69,9 @@ CASE WHEN SUM = 0 THEN 0 ELSE ROUND( SUM ( COALESCE (CAST(b.completed AS INTEGER), 0 ) ) * 100 / SUM, 0 ) - END rateNumber + END ratenumber , - CONCAT ( rateNumber, '%' ) rate + CONCAT ( ratenumber, '%' ) rate from dept a left join mail_mark b on @@ -83,13 +83,13 @@ where a.pid= #{deptId} GROUP BY a.short_name - order by rateNumber desc , sum desc + order by ratenumber desc , sum desc - select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rowNumber , + select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rownumber , mail_first_category category, - count(1) sumCount , + count(1) sumcount , (select count(1) from mail where 1=1 @@ -218,7 +218,7 @@ ) AS denominator, CONCAT(ROUND(CASE WHEN denominator = 0 THEN 0 ELSE sumCount * 100 / denominator END,0),'%') countRate FROM mail - where 1=1 + where mail_time > '2025-09-13'