Browse Source

优化完善,BUG修复

厅长信箱
wxc 2 months ago
parent
commit
ad1b5d1f40
  1. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java
  2. 22
      mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java
  3. 4
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  4. 24
      mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

2
mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java

@ -63,7 +63,7 @@ public class DataScreenController {
@GetMapping("/peopleMail") @GetMapping("/peopleMail")
@Operation(summary = "群众来信") @Operation(summary = "群众来信")
public AjaxResult<List<Mail>> peopleMail(String id) { public AjaxResult<List<Mail>> peopleMail(String id) {
return AjaxResult.success(dataScreenService.selectRecentlyMailList(id)); return AjaxResult.success(dataScreenService.listMailTop20(id));
} }
@NotLogin @NotLogin

22
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.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.constants.AppConstants; import com.biutag.constants.AppConstants;
import com.biutag.entity.system.Duty; import com.biutag.entity.system.Duty;
import com.biutag.enums.DeptTypeEnum; import com.biutag.enums.DeptTypeEnum;
import com.biutag.enums.MailState;
import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailMark; import com.biutag.lan.domain.MailMark;
@ -45,6 +47,8 @@ public class DataScreenService {
private final IDeptService deptService; private final IDeptService deptService;
private final MailService mailService;
public List<MapData> mapData() { public List<MapData> mapData() {
return baseMapper.mapData(); return baseMapper.mapData();
} }
@ -66,15 +70,21 @@ public class DataScreenService {
} }
} }
public List<Mail> selectRecentlyMailList(String deptId) { public List<Mail> listMailTop20(String deptId) {
if (StrUtil.isBlank(deptId)) { LambdaQueryWrapper<Mail> queryWrapper = new LambdaQueryWrapper<Mail>()
return baseMapper.selectRecentlyMailList(deptId); .ge(Mail::getMailTime, AppConstants.BEGIN_TIME)
} .ne(Mail::getMailState, MailState.terminated.getValue())
.orderByDesc(Mail::getMailTime);
if (StrUtil.isNotBlank(deptId)) {
DeptVo deptVo = deptService.detail(deptId); DeptVo deptVo = deptService.detail(deptId);
if (deptVo.getLevel() == 1) { if (deptVo.getLevel() == 1) {
return baseMapper.selectRecentlyMailListByFirst(deptId); 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();
} }
/** /**

4
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -187,10 +187,10 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
int limitedTime = flowNode.getLimitedTime().intValue(); int limitedTime = flowNode.getLimitedTime().intValue();
// 剩余时间 // 剩余时间
long flowRemainingTime = holidayService.getFlowRemainingTimeByNow(limitedTime, long flowRemainingTime = holidayService.getFlowRemainingTimeByNow(limitedTime,
FlowNodeEnum.lessInterviewWriter(mail.getFlowKey()) ? mail.getFlowLimitedLastHandlerTime(): mail.getCreateTime(), Optional.ofNullable(mail.getFlowLimitedLastHandlerTime()).orElse(mail.getCreateTime()),
mail.getExtensionDays()); mail.getExtensionDays());
if (Objects.nonNull(mail.getExtensionDays()) && mail.getExtensionDays() > 0) { 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 : int flowRemainingTimePercentage = flowRemainingTime <= 0 ? 0 :

24
mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

@ -69,9 +69,9 @@
CASE CASE
WHEN SUM = 0 THEN WHEN SUM = 0 THEN
0 ELSE ROUND( SUM ( COALESCE (CAST(b.completed AS INTEGER), 0 ) ) * 100 / SUM, 0 ) 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 from dept a left join mail_mark b on
<choose> <choose>
<when test="level == 1"> <when test="level == 1">
@ -83,13 +83,13 @@
</choose> </choose>
where a.pid= #{deptId} where a.pid= #{deptId}
GROUP BY a.short_name GROUP BY a.short_name
order by rateNumber desc , sum desc order by ratenumber desc , sum desc
</select> </select>
<select id="getStationResolvedRateByDept" resultType="java.util.Map"> <select id="getStationResolvedRateByDept" resultType="java.util.Map">
select a.short_name, select a.short_name,
ROUND(sum(COALESCE(CAST(b.resolved AS INTEGER), 0)) * 100 / count(1), 0) rateNumber, ROUND(sum(COALESCE(CAST(b.resolved AS INTEGER), 0)) * 100 / count(1), 0) ratenumber,
CONCAT(rateNumber, '%') rate, CONCAT(ratenumber, '%') rate,
SUM(COALESCE(CAST(b.resolved AS INTEGER), 0)) resolved, SUM(COALESCE(CAST(b.resolved AS INTEGER), 0)) resolved,
count(b.mail_id) sum count(b.mail_id) sum
from dept a left join mail_mark b on from dept a left join mail_mark b on
@ -103,15 +103,15 @@
</choose> </choose>
where a.pid=#{deptId} where a.pid=#{deptId}
GROUP BY a.short_name GROUP BY a.short_name
order by rateNumber desc, sum desc order by ratenumber desc, sum desc
</select> </select>
<select id="getStationSatisfiedRateByDept" resultType="java.util.Map"> <select id="getStationSatisfiedRateByDept" resultType="java.util.Map">
select a.short_name, select a.short_name,
SUM(COALESCE(CAST(b.satisfied AS INTEGER), 0)) satisfied, SUM(COALESCE(CAST(b.satisfied AS INTEGER), 0)) satisfied,
count(b.mail_id) sum, count(b.mail_id) sum,
ROUND(sum(COALESCE(CAST(b.satisfied AS INTEGER), 0))*100/count(1),0) rateNumber, ROUND(sum(COALESCE(CAST(b.satisfied AS INTEGER), 0))*100/count(1),0) ratenumber,
CONCAT(rateNumber,'%') rate CONCAT(ratenumber,'%') rate
from dept a from dept a
left join mail_mark b on left join mail_mark b on
<choose> <choose>
@ -123,7 +123,7 @@
</otherwise> </otherwise>
</choose> </choose>
where a.pid=#{deptId} where a.pid=#{deptId}
GROUP BY a.short_name order by rateNumber desc ,sum desc GROUP BY a.short_name order by ratenumber desc ,sum desc
</select> </select>
<select id="getTodayMailCount" resultType="int"> <select id="getTodayMailCount" resultType="int">
@ -202,9 +202,9 @@
<select id="mailTypeRank" resultType="java.util.Map"> <select id="mailTypeRank" resultType="java.util.Map">
select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rowNumber , select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rownumber ,
mail_first_category category, mail_first_category category,
count(1) sumCount , count(1) sumcount ,
(select count(1) from mail where 1=1 (select count(1) from mail where 1=1
<if test="id != null and id != ''"> <if test="id != null and id != ''">
<choose> <choose>
@ -218,7 +218,7 @@
</if>) AS denominator, </if>) AS denominator,
CONCAT(ROUND(CASE WHEN denominator = 0 THEN 0 ELSE sumCount * 100 / denominator END,0),'%') countRate CONCAT(ROUND(CASE WHEN denominator = 0 THEN 0 ELSE sumCount * 100 / denominator END,0),'%') countRate
FROM mail FROM mail
where 1=1 where mail_time > '2025-09-13'
<if test="id != null and id != ''"> <if test="id != null and id != ''">
<choose> <choose>
<when test="level == 1"> <when test="level == 1">

Loading…
Cancel
Save