diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java index 7425522..6861950 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java @@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RequestMapping("api/appeal") @@ -26,8 +27,8 @@ public class MailAppealController { @NotPower @RequestMapping("getAppeal") - public AjaxResult getAppeal(String appealId) { - return mailAppealService.getAppeal(appealId); + public AjaxResult getAppeal(String id) { + return mailAppealService.getAppeal(id); } @@ -40,8 +41,8 @@ public class MailAppealController { @NotPower @RequestMapping("approved") - public AjaxResult approved(String userId) { - return mailAppealService.approved(userId); + public AjaxResult approved(String id) { + return mailAppealService.approved(id); } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java index 45cbc19..36df321 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java @@ -100,4 +100,12 @@ public class QueryMailVo { */ @ExcelProperty("信件标签") private String mailLabels; + /** + * 申诉状态 + */ + private String appealState; + /** + * 处理部门 + */ + private Integer handlingDept; } 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 1637f52..06484cc 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 @@ -19,6 +19,8 @@ public interface WorkMapper extends BaseMapper { Page selectQueryPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + Page selectDissatisfiedPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + Integer selectCountByFlowKey(Collection flowKeys, Integer deptId); @Select("select count(w.id) from work w left join mail m on w.mail_id = m.id where m.flow_key = #{flowKey} and w.sign_dept_id = #{deptId}") 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 e1a0d75..cb6a48d 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 @@ -124,8 +124,8 @@ public class DataScreenService extends ServiceImpl { Map mapResolved = baseMapper.getAllResolvedRate(null);//获取长沙市局 解决率 Map mapSatisfied = baseMapper.getAllSatisfiedRate(null);//获取长沙市局 满意率 // Integer allSum = baseMapper.getAllMailCount(null); - Long allSum = mailMapper.selectCount(new LambdaQueryWrapper().ne(Mail::getMailCategory, "无效类").ne(Mail::getMailCategory, "终止类") - .ne(Mail::getMailCategory, "感谢信")); + Long allSum = mailMapper.selectCount(new LambdaQueryWrapper().ne(Mail::getMailFirstCategory, "无效类").ne(Mail::getMailFirstCategory, "终止类") + .ne(Mail::getMailFirstCategory, "感谢信")); Integer toDayCount = baseMapper.getTodayMailCount(null); mapCompleted.putAll(mapResolved); @@ -139,8 +139,8 @@ public class DataScreenService extends ServiceImpl { Map mapResolved = baseMapper.getAllResolvedRate(deptId);//获取长沙市局 解决率 Map mapSatisfied = baseMapper.getAllSatisfiedRate(deptId);//获取长沙市局 满意率 // Integer allSum = baseMapper.getAllMailCount(deptId); - Long allSum = mailMapper.selectCount(new LambdaQueryWrapper().ne(Mail::getMailCategory, "无效类").ne(Mail::getMailCategory, "终止类") - .ne(Mail::getMailCategory, "感谢信")); + Long allSum = mailMapper.selectCount(new LambdaQueryWrapper().ne(Mail::getMailFirstCategory, "无效类").ne(Mail::getMailFirstCategory, "终止类") + .ne(Mail::getMailFirstCategory, "感谢信")); Integer toDayCount = baseMapper.getTodayMailCount(deptId); mapCompleted.putAll(mapResolved); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java index 57e2f9e..353ae03 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java @@ -1,15 +1,20 @@ package com.biutag.lan.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.biutag.core.AjaxResult; import com.biutag.entity.system.Dept; import com.biutag.lan.config.AdminThreadLocal; +import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailAppeal; import com.biutag.lan.mapper.MailAppealMapper; +import com.biutag.lan.mapper.MailMapper; import com.biutag.mapper.system.DeptMapper; +import com.biutag.util.StringUtils; import jakarta.annotation.Resource; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; @RequiredArgsConstructor @Service @@ -20,6 +25,9 @@ public class MailAppealService { @Resource private final DeptMapper deptMapper; + @Resource + private final MailMapper mailMapper; + /** * 发起申请 * @@ -28,9 +36,13 @@ public class MailAppealService { */ public AjaxResult launchAppeal(MailAppeal appeal) { long count = mailAppealMapper.selectCount(new LambdaQueryWrapper().eq(MailAppeal::getMailId, appeal.getMailId())); - if (count > 0) { + String appealState = mailAppealMapper.selectOne(new QueryWrapper().eq("mail_id", appeal.getMailId())).getAppealState(); + if (count > 0 && !("3".equals(appealState))) { return AjaxResult.failed("此邮件您已发起过申诉,请勿重复申诉"); } else { + if (StringUtils.isNotEmpty(appealState)) { + mailAppealMapper.delete(new QueryWrapper().eq("mail_id", appeal.getMailId())); + } appeal.setHandlingDept(AdminThreadLocal.getDeptId()) .setAppealState("1") .setThreeDept(AdminThreadLocal.getDeptId()); @@ -47,7 +59,7 @@ public class MailAppealService { * @return */ public AjaxResult getAppeal(String id) { - return AjaxResult.success(mailAppealMapper.selectById(id)); + return AjaxResult.success(mailAppealMapper.selectOne(new QueryWrapper().eq("mail_id", id))); } /** @@ -58,7 +70,7 @@ public class MailAppealService { * @return */ public AjaxResult overruleAppeal(String id, String overruleReason) { - MailAppeal appeal = mailAppealMapper.selectById(id); + MailAppeal appeal = mailAppealMapper.selectOne(new QueryWrapper().eq("mail_id", id)); Integer deptId = AdminThreadLocal.getDeptId(); Dept dept = deptMapper.selectById(deptId); switch (dept.getLevel()) { @@ -84,13 +96,16 @@ public class MailAppealService { * @return */ public AjaxResult approved(String id) { - MailAppeal appeal = mailAppealMapper.selectById(id); + MailAppeal appeal = mailAppealMapper.selectOne(new QueryWrapper().eq("mail_id", id)); + Mail mail = mailMapper.selectById(appeal.getMailId()); Integer deptId = AdminThreadLocal.getDeptId(); Dept dept = deptMapper.selectById(deptId); appeal.setHandlingDept(deptId); switch (dept.getLevel()) { case 1: appeal.setStep("3").setAppealState("2"); + mail.setVerifyFeedback("基本满意").setSatisfactionStatus("基本满意"); + mailMapper.updateById(mail); break; case 2: appeal.setSecondDept(deptId).setStep("2"); 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 262438b..02d767d 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 @@ -420,8 +420,9 @@ public class WorkService extends ServiceImpl { .le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()) .eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) .eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) -// .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState()) - .and(qw -> qw.eq("m.satisfaction_status", "不满意").or().eq("m.verify_feedback", "不满意")); + .nested(i -> i.eq("m.satisfaction_status", "不满意") + .or().eq("m.verify_feedback", "不满意")) + .or().apply("m.id = ma.mail_id"); mailCategorySearch(mailQuery, queryWrapper); deptSearch(mailQuery, queryWrapper); roleCheck(queryWrapper); @@ -441,7 +442,7 @@ public class WorkService extends ServiceImpl { } // 排序 queryWrapper.orderByDesc("m.mail_time"); - return baseMapper.selectQueryPage(page, queryWrapper); + return baseMapper.selectDissatisfiedPage(page, queryWrapper); } /** diff --git a/mailbox-lan/src/main/resources/mapper/WorkMapper.xml b/mailbox-lan/src/main/resources/mapper/WorkMapper.xml index 042da3f..d2d27c1 100644 --- a/mailbox-lan/src/main/resources/mapper/WorkMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/WorkMapper.xml @@ -54,4 +54,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${ew.getCustomSqlSegment} + +