From 468bd93e64cd48e6879332b446d9dd96e84d5281 Mon Sep 17 00:00:00 2001 From: 21819 Date: Tue, 27 Feb 2024 16:20:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=A1=E4=BB=B6=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=9A=84=E4=BF=A1=E4=BB=B6=E5=88=86=E7=B1=BB=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/biutag/lan/domain/bo/MailQuery.java | 2 + .../com/biutag/lan/service/WorkService.java | 75 +++++++++++-------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailQuery.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailQuery.java index 0b7331b..16f95e5 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailQuery.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailQuery.java @@ -30,6 +30,8 @@ public class MailQuery { private String mailCategory; + private String mailState; + private String deptId; private String threeDeptName; 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 f1e77b8..467ffb2 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 @@ -11,10 +11,7 @@ import com.biutag.core.AjaxResult; import com.biutag.entity.system.Dept; import com.biutag.enums.RoleEnum; import com.biutag.lan.config.AdminThreadLocal; -import com.biutag.lan.domain.Mail; -import com.biutag.lan.domain.MailLabel; -import com.biutag.lan.domain.MailSource; -import com.biutag.lan.domain.Work; +import com.biutag.lan.domain.*; import com.biutag.lan.domain.bo.MailQuery; import com.biutag.lan.domain.vo.MailExcel; import com.biutag.lan.domain.vo.QueryMailVo; @@ -22,6 +19,7 @@ import com.biutag.lan.domain.vo.WorkVo; import com.biutag.lan.enums.WorkType; import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.flow.FlowNodeEnum; +import com.biutag.lan.mapper.MailCategoryMapper; import com.biutag.lan.mapper.MailLabelMapper; import com.biutag.lan.mapper.MailMapper; import com.biutag.lan.mapper.WorkMapper; @@ -49,6 +47,9 @@ public class WorkService extends ServiceImpl { @Resource private MailLabelMapper mailLabelMapper; + @Resource + private MailCategoryMapper mailCategoryMapper; + @Resource private WorkMapper workMapper; @@ -314,21 +315,10 @@ 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(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory()) + .eq(StrUtil.isNotBlank(mailQuery.getMailState()), "m.mail_state", mailQuery.getMailState()) .eq(StrUtil.isNotBlank(mailQuery.getFlowKey()), "m.flow_key", mailQuery.getFlowKey()); - if (StrUtil.isNotBlank(mailQuery.getDeptId())) { - Dept dept = deptMapper.selectById(mailQuery.getDeptId()); - switch (dept.getLevel()) { - case 1: - break; - case 2: - queryWrapper.eq("m.second_dept_id", dept.getId()); - break; - case 3: - queryWrapper.eq("m.three_dept_id", dept.getId()); - break; - } - } + mailCategorySearch(mailQuery, queryWrapper); + deptSearch(mailQuery, queryWrapper); if (StrUtil.isNotBlank(mailQuery.getMailLabels())) { List labelIds = mailQuery.handleMailLabels(); for (String labelId : labelIds) { @@ -371,6 +361,39 @@ public class WorkService extends ServiceImpl { return result; } + private void mailCategorySearch(MailQuery mailQuery, QueryWrapper queryWrapper) { + if(StrUtil.isNotBlank(mailQuery.getMailCategory())){ + MailCategory mailCategory = mailCategoryMapper.selectById(mailQuery.getMailCategory()); + switch (mailCategory.getLevel()){ + case 1: + queryWrapper.eq("m.mail_first_category", mailCategory.getName()); + break; + case 2: + queryWrapper.eq("m.mail_second_category", mailCategory.getName()); + break; + case 3: + queryWrapper.eq("m.mail_three_category", mailCategory.getName()); + break; + } + } + } + + private void deptSearch(MailQuery mailQuery, QueryWrapper queryWrapper) { + if (StrUtil.isNotBlank(mailQuery.getDeptId())) { + Dept dept = deptMapper.selectById(mailQuery.getDeptId()); + switch (dept.getLevel()) { + case 1: + break; + case 2: + queryWrapper.eq("m.second_dept_id", dept.getId()); + break; + case 3: + queryWrapper.eq("m.three_dept_id", dept.getId()); + break; + } + } + } + public void export(HttpServletResponse response, String ids) throws IOException { List data = JSON.parseArray(ids, String.class); @@ -389,24 +412,12 @@ 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(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory()) // .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState()) .eq("m.satisfaction_status", "不满意") .or() .eq("m.verify_feedback", "不满意"); - if (StrUtil.isNotBlank(mailQuery.getDeptId())) { - Dept dept = deptMapper.selectById(mailQuery.getDeptId()); - switch (dept.getLevel()) { - case 1: - break; - case 2: - queryWrapper.eq("m.second_dept_id", dept.getId()); - break; - case 3: - queryWrapper.eq("m.three_dept_id", dept.getId()); - break; - } - } + mailCategorySearch(mailQuery, queryWrapper); + deptSearch(mailQuery, queryWrapper); roleCheck(queryWrapper); if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) { switch (mailQuery.getContactField()) {