diff --git a/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java b/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java index 3e971d2..099ab47 100644 --- a/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java +++ b/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java @@ -20,7 +20,10 @@ public enum RoleEnum { SECOND_DEPT_LEADER(4, "二级机构领导"), // 三级机构领导 - THREE_DEPT_LEADER(5, "三级机构领导"); + THREE_DEPT_LEADER(5, "三级机构领导"), + + // 市局领导 + MUNICIPAL_DEPT_LEADER(6, "市局领导"); private Integer roleId; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MailLabelController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MailLabelController.java index 78e4f33..b40cf03 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MailLabelController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MailLabelController.java @@ -1,5 +1,6 @@ package com.biutag.lan.controller.system; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; import com.biutag.lan.service.IMailLabelService; @@ -37,6 +38,7 @@ public class MailLabelController { } @PostMapping("/insert") + @SaCheckPermission("system:label:insert") @ApiOperation(value="更新插入信件标签") public AjaxResult insertLabels(@Validated @RequestBody MailLabelInsertValidate createValidate) { iMailLabelService.insertLabel(createValidate); 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 71111e2..752f383 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 @@ -4,8 +4,10 @@ import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; +import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.Work; import com.biutag.lan.domain.bo.MailQuery; +import com.biutag.lan.domain.vo.QueryMailVo; import com.biutag.lan.domain.vo.WorkVo; import com.biutag.lan.service.MailSourceService; import com.biutag.lan.service.WorkService; @@ -33,14 +35,14 @@ public class WorkController { @NotPower @GetMapping("query") - public AjaxResult> list(Page page, MailQuery todoQuery) { + public AjaxResult> list(Page page, MailQuery todoQuery) { return AjaxResult.success(workService.queryPage(page, todoQuery)); } @NotPower @PostMapping("export") - public void detail(HttpServletResponse response, @RequestBody String dataWorkVo) throws IOException { - workService.export(response, dataWorkVo); + public void detail(HttpServletResponse response, @RequestBody String data) throws IOException { + workService.export(response, data); } @NotPower @@ -52,13 +54,13 @@ public class WorkController { @NotPower @PostMapping("check") - public AjaxResult> check(MultipartFile file, MailQuery mailQuery) throws IOException { + public AjaxResult> check(MultipartFile file, MailQuery mailQuery) throws IOException { return workService.checkExcel(file, mailQuery); } @NotPower @GetMapping("dissatisfied") - public AjaxResult> dissatisfied(Page page, MailQuery todoQuery) { + public AjaxResult> dissatisfied(Page page, MailQuery todoQuery) { return AjaxResult.success(workService.dissatisfied(page, todoQuery)); } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java index d23a402..5fa13e8 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java @@ -1,11 +1,11 @@ package com.biutag.lan.domain; +import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.TableId; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import java.time.LocalDate; import java.time.LocalDateTime; @Accessors(chain = true) @@ -14,56 +14,69 @@ import java.time.LocalDateTime; public class Mail { @TableId + @ExcelProperty("信件id") private String id; /** * 联系人姓名 */ + @ExcelProperty("联系人姓名") private String contactName; /** * 联系人性别 M / F */ + @ExcelProperty("联系人性别") private String contactSex; /** * 联系人身份证号码 */ + @ExcelProperty("联系人身份证号码") private String contactIdCard; /** * 联系人手机号 */ + @ExcelProperty("联系人手机号") private String contactPhone; /** * 案件编号 */ + @ExcelProperty("案件编号") private String caseNumber; /** * 内容 */ + @ExcelProperty("内容") private String content; /** * 附件 */ + @ExcelProperty("附件") private String attachments; /** * 创建时间 */ + @ExcelProperty("创建时间") private LocalDateTime createTime; /** * 更新时间 */ + @ExcelProperty("更新时间") private LocalDateTime updateTime; /** * 来信时间 */ + @ExcelProperty("来信时间") private LocalDateTime mailTime; /** * 来源 */ + @ExcelProperty("来源") private String source; /** * 满意读(群众) */ + @ExcelProperty("满意度(群众)") private String satisfaction; /*-------------------------------*/ @@ -71,282 +84,343 @@ public class Mail { /** * 信件状态 */ + @ExcelProperty("信件状态") private String mailState; /** * 信件当前流程 */ + @ExcelProperty("信件当前流程") private String flowKey; /** * 信件当前流程节点 */ + @ExcelProperty("信件当前流程节点") private String flowBeforeName; /** * 流程限时最后操作时间 */ + @ExcelProperty("流程限时最后操作时间") private LocalDateTime flowLimitedLastHandlerTime; /** * 信件源数据ID (多个) */ + @ExcelProperty("信件源数据ID") private String mailSourceId; /** * 信件类名 */ + @ExcelProperty("信件类名") private String mailCategory; /** * 信件一级类目 */ + @ExcelProperty("信件一级类目") private String mailFirstCategory; /** * 信件二级类目 */ + @ExcelProperty("信件二级类目") private String mailSecondCategory; /** * 信件三级类目 */ + @ExcelProperty("信件三级类目") private String mailThreeCategory; /** * 信件等级 */ + @ExcelProperty("信件等级") private String mailLevel; /** * 二级单位ID(主责) */ + @ExcelProperty("二级单位ID(主责)") private Integer secondDeptId; + @ExcelProperty("二级单位名称(主责)") private String secondDeptName; /** * 三级单位ID(主责) */ + @ExcelProperty("三级单位ID(主责)") private Integer threeDeptId; + @ExcelProperty("三级单位名称(主责)") private String threeDeptName; /** * 协办核查民警(String) */ + @ExcelProperty("协办核查民警") private String coHandlingPolices; /** * 联系民警名称 */ + @ExcelProperty("联系民警姓名") private String contactPoliceName; /** * 联系民警 */ + @ExcelProperty("联系民警") private String contactPoliceEmpNo; /** * 联系民警职位 */ + @ExcelProperty("联系民警职位") private String contactPolicePost; /** * 联系群众时间 */ + @ExcelProperty("联系群众时间") private LocalDateTime contactTime; /** * 联系时长(秒) */ + @ExcelProperty("联系时长") private Long contactDuration; /** * 是否联系群众 */ + @ExcelProperty("是否联系群众") private Boolean contactFlag; /** * 接访形式 */ + @ExcelProperty("接访形式") private String interviewType; /** * 是否领导接访 */ + @ExcelProperty("是否领导接访") private Boolean interviewIsLeader; /** * 接访人员警号 */ + @ExcelProperty("接访人员警号") private String interviewPoliceEmpNo; /** * 接访人员姓名 */ + @ExcelProperty("接访人员姓名") private String interviewPoliceName; /** * 接访情况 */ + @ExcelProperty("接访情况") private String interviewDetails; /** * 接访附件(佐证材料) */ + @ExcelProperty("接访附件") private String interviewAttachments; /** * 核办情况 */ + @ExcelProperty("核办情况") private String verifyDetails; /** * 核办-是否属实 */ + @ExcelProperty("核办-是否属实") private String verifyIsTrue; /** * 核办-被举报对象(json) */ + @ExcelProperty("核办-被举报对象") private String verifyReportedPolices; /** * 核办-查证属实问题(json) */ + @ExcelProperty("核办-查证属实问题") private String verifyProblem; /** * 核办-是否需要问责 */ + @ExcelProperty("核办-是否需要问责") private Boolean verifyNeedAccountability; /** * 核办-责任追究(json) */ + @ExcelProperty("核办-责任追究") private String verifyPunish; /** * 核办-群众反映事项解决情况(是否已解决) */ + @ExcelProperty("核办-群众反映事项解决情况") private Boolean verifyIsResolved; /** * 核办-办理反馈情况 */ + @ExcelProperty("核办-办理反馈情况") private String verifyFeedback; /** * 核办-回访人信息(String) */ + @ExcelProperty("核办-回访人信息") private String verifyFollowupPolice; /** * 核办-附件(上传佐证) */ + @ExcelProperty("核办-附件") private String verifyAttachments; /** * 办结方式 */ + @ExcelProperty("办结方式") private String completeMethod; /** * 办理合格情况 */ + @ExcelProperty("办理合格情况") private String qualifiedProcessingStatus; /** * 问题解决情况 */ + @ExcelProperty("问题解决情况") private Boolean problemSolvingStatus; /** * 群众回复情况 */ + @ExcelProperty("群众回复情况") private String satisfactionStatus; /** * 认定办结意见 */ + @ExcelProperty("认定办结意见") private String completionComment; /** * 是否是简易流程 */ + @ExcelProperty("是否是简易流程") private Boolean simpleFlowFlag; /** * 涉及单位ID */ + @ExcelProperty("涉及单位ID") private Integer involvedDeptId; /** * 涉及单位名称 */ + @ExcelProperty("涉及单位名称") private String involvedDeptName; /** * 会签部门总数 */ + @ExcelProperty("会签部门总数") private Integer countersignTotal; /** * 会签完成部门数量 */ + @ExcelProperty("会签完成部门数量") private Integer countersignCompleted; /** * 会签发起人 */ + @ExcelProperty("会签发起人") private String countersignPromoterEmpNo; /** * 会签发起姓名 */ + @ExcelProperty("会签发起姓名") private String countersignPromoterName; /** * 会签发起部门ID */ + @ExcelProperty("会签发起部门ID") private Integer countersignPromoterDeptId; /** * 会签发起部门名称 */ + @ExcelProperty("会签发起部门名称") private String countersignPromoterDeptName; /** * 会签具体要求 */ + @ExcelProperty("会签具体要求") private String countersignRequirement; /** * 信件标签 */ + @ExcelProperty("信件标签") private String mailLabels; /** * 当前操作人 */ + @ExcelProperty("当前操作人") private String currentOperator; /** * 是否申请延期 */ + @ExcelProperty("是否申请延期") private Boolean extensionFlag; /** * 延期天数 */ + @ExcelProperty("延期天数") private Integer extensionDays; /** * 延期理由 */ + @ExcelProperty("延期理由") private String extensionReason; /** * 延期状态 */ + @ExcelProperty("延期状态") private String extensionState; /** * 无效判定理由 */ + @ExcelProperty("无效判定理由") private String invalidationReason; /** * 市局下发信息 */ + @ExcelProperty("市局下发信息") private String firstDistributeInfo; /** * 二级单位下发信息 */ + @ExcelProperty("二级单位下发信息") private String secondDistributeInfo; } 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 new file mode 100644 index 0000000..cc12abd --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java @@ -0,0 +1,103 @@ +package com.biutag.lan.domain.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +@Accessors(chain = true) +@Setter +@Getter +public class QueryMailVo { + @ExcelProperty("信件ID") + private String id; + + /** + * 联系人姓名 + */ + @ExcelProperty("姓名") + private String contactName; + + /** + * 联系人手机号 + */ + @ExcelProperty("联系电话") + private String contactPhone; + + @ExcelProperty("联系人身份证号") + private String contactIdCard; + + /** + * 内容 + */ + @ExcelProperty("信件内容") + private String content; + + /** + * 信件来源 + */ + @ExcelProperty("信件来源") + private String source; + + /** + * 信件时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ExcelProperty("来信时间") + private LocalDateTime mailTime; + + + /** + * 信件等级 + */ + @ExcelProperty("信件等级") + private String mailLevel; + + /** + * 信件一级类目 + */ + @ExcelProperty("信件分类") + private String mailCategory = "未分类"; + + /** + * 信件状态 + */ + @ExcelProperty("信件状态") + private String mailState; + + /** + * 信件流程节点 + */ + @ExcelProperty("流程节点ID") + private String flowKey; + + /** + * 信件当前流程节点 + */ + @ExcelProperty("流程节点") + private String flowBeforeName; + + /** + * 当前流程剩余多少时间(秒) + */ + @ExcelProperty("流程限时") + private Long flowLimitedRemainingTime; + + /** + * 办理单位ID(三级单位) + */ + @ExcelProperty("办理单位ID-三级") + private Integer threeDeptId; + + @ExcelProperty("办理单位") + private String threeDeptName; + + /** + * 信件标签 + */ + @ExcelProperty("信件标签") + private String mailLabels; +} 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 6192540..f841a2b 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 @@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.Work; +import com.biutag.lan.domain.vo.QueryMailVo; import com.biutag.lan.domain.vo.WorkVo; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -13,6 +15,8 @@ public interface WorkMapper extends BaseMapper { Page selectPageTodo(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + Page selectQueryPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + @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}") Integer selectCount(String flowKey, Integer deptId); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java index 78d2e53..4257234 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java @@ -4,51 +4,59 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.biutag.lan.domain.Work; +import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.bo.MailQuery; -import com.biutag.lan.domain.vo.WorkVo; -import com.biutag.lan.mapper.WorkMapper; +import com.biutag.lan.domain.vo.QueryMailVo; +import com.biutag.lan.mapper.MailMapper; import lombok.Getter; +import org.springframework.beans.BeanUtils; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @Getter -public class ExcelService implements ReadListener { - private List dbDatalist; - private List excelDatalist = new ArrayList<>(); +public class ExcelService implements ReadListener { + private List dbDatalist; + private List excelDatalist = new ArrayList<>(); - private List result; + private List result; + + private final MailMapper mailMapper; - private final WorkMapper workMapper; private final MailQuery mailQuery; - public ExcelService(WorkMapper workMapper, MailQuery mailQuery) { - this.workMapper = workMapper; + public ExcelService(MailMapper mailMapper, MailQuery mailQuery) { + this.mailMapper = mailMapper; this.mailQuery = mailQuery; } + @Override - public void invoke(WorkVo workVo, AnalysisContext analysisContext) { - excelDatalist.add(workVo); + public void invoke(Mail mail, AnalysisContext analysisContext) { + excelDatalist.add(mail); } @Override public void doAfterAllAnalysed(AnalysisContext analysisContext) { - QueryWrapper queryWrapper = new QueryWrapper() + QueryWrapper queryWrapper = new QueryWrapper() .ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) .le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()); - dbDatalist = workMapper.selectList(queryWrapper); + dbDatalist = mailMapper.selectList(queryWrapper); for (int i = 0; i < excelDatalist.size(); i++) { - WorkVo workVo = excelDatalist.get(i); - for (Work work : dbDatalist) { - if (work.getMailId().equals(workVo.getMailId())) { - excelDatalist.remove(workVo); + Mail excelMail = excelDatalist.get(i); + for (Mail mail : dbDatalist) { + if (excelMail.getId().equals(mail.getId())) { + excelDatalist.remove(excelMail); i--; // 减去索引以补偿移除的元素 break; // 一旦找到匹配并移除,跳出内循环 } } } - result = excelDatalist; + result = excelDatalist.stream().map(mail -> { + QueryMailVo queryMailVo = new QueryMailVo(); + BeanUtils.copyProperties(mail, queryMailVo); + return queryMailVo; + }).collect(Collectors.toList()); } } 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 a308aeb..36111d4 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 @@ -15,9 +15,11 @@ import com.biutag.lan.domain.MailLabel; import com.biutag.lan.domain.MailSource; import com.biutag.lan.domain.Work; import com.biutag.lan.domain.bo.MailQuery; +import com.biutag.lan.domain.vo.QueryMailVo; import com.biutag.lan.domain.vo.WorkVo; import com.biutag.lan.enums.WorkType; import com.biutag.lan.mapper.MailLabelMapper; +import com.biutag.lan.mapper.MailMapper; import com.biutag.lan.mapper.WorkMapper; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; @@ -44,6 +46,9 @@ public class WorkService extends ServiceImpl { @Resource private WorkMapper workMapper; + @Resource + private MailMapper mailMapper; + public boolean saveBatch(List mailSources) { LocalDateTime now = LocalDateTime.now(); List list = mailSources.stream().map(mail -> { @@ -268,52 +273,40 @@ public class WorkService extends ServiceImpl { return list(new LambdaQueryWrapper().eq(Work::getMailId, mailId).eq(Work::getSignRoleId, roleId).eq(Work::getWorkType, workType)); } - public Page queryPage(Page page, MailQuery todoQuery) { - QueryWrapper queryWrapper = new QueryWrapper() - .ge(StrUtil.isNotBlank(todoQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStart()) - .le(StrUtil.isNotBlank(todoQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStartEnd()) - .eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource()) - .eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel()) - .eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory()) - .like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName()) - .eq(StrUtil.isNotBlank(todoQuery.getFlowKey()), "m.flow_key", todoQuery.getFlowKey()); - if (StrUtil.isNotBlank(todoQuery.getMailLabels())) { - List labelIds = todoQuery.handleMailLabels(); + public Page queryPage(Page page, MailQuery mailQuery) { + QueryWrapper queryWrapper = new QueryWrapper() + .ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) + .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()) + .like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName()) + .eq(StrUtil.isNotBlank(mailQuery.getFlowKey()), "m.flow_key", mailQuery.getFlowKey()); + if (StrUtil.isNotBlank(mailQuery.getMailLabels())) { + List labelIds = mailQuery.handleMailLabels(); for (String labelId : labelIds) { queryWrapper.like("m.mail_labels", labelId); } } - Integer roleId = AdminThreadLocal.getRoleId(); - // 与角色相关的件 - if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || - roleId.equals(RoleEnum.SECOND_DEPT_CLASSES.getRoleId()) || - roleId.equals(RoleEnum.THREE_DEPT_CLASSES.getRoleId())) { - Integer deptId = AdminThreadLocal.getDeptId(); - queryWrapper.eq("w.sign_role_id", roleId) - // 如果不是市局专班,则需要查询签收部门ID - .eq(!RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId), "w.sign_dept_id", deptId); - } else { - String empNo = AdminThreadLocal.getEmpNo(); - queryWrapper.eq("w.police_emp_no", empNo); - } - if (StrUtil.isNotBlank(todoQuery.getContactField()) && StrUtil.isNotBlank(todoQuery.getContactFieldValue())) { - switch (todoQuery.getContactField()) { + roleCheck(queryWrapper); + if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) { + switch (mailQuery.getContactField()) { case "name": - queryWrapper.like("w.contact_name", todoQuery.getContactFieldValue()); + queryWrapper.like("w.contact_name", mailQuery.getContactFieldValue()); break; case "idCard": - queryWrapper.like("w.contactIdCard", todoQuery.getContactFieldValue()); + queryWrapper.like("w.contact_idCard", mailQuery.getContactFieldValue()); break; case "phone": - queryWrapper.like("w.contactPhone", todoQuery.getContactFieldValue()); + queryWrapper.like("w.contactPhone", mailQuery.getContactFieldValue()); break; } } // 排序 queryWrapper.orderByDesc("w.update_time"); - Page result = baseMapper.selectPageTodo(page, queryWrapper); - for (WorkVo workVo : result.getRecords()) { + Page result = baseMapper.selectQueryPage(page, queryWrapper); + for (QueryMailVo workVo : result.getRecords()) { List labelNames = mailLabelMapper.selectList(null); if (StrUtil.isNotBlank(workVo.getMailLabels())) { String[] labelIds = workVo.getMailLabels().split(","); @@ -331,28 +324,56 @@ public class WorkService extends ServiceImpl { return result; } - public void export(HttpServletResponse response, String dataWorkVo) throws IOException { - List data = JSON.parseArray(dataWorkVo, WorkVo.class); + public void export(HttpServletResponse response, String ids) throws IOException { + List data = JSON.parseArray(ids, String.class); + + List mailList = mailMapper.selectBatchIds(data); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setCharacterEncoding("utf-8"); // 这里URLEncoder.encode可以防止中文乱码 String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), WorkVo.class).sheet("模板").doWrite(data); + EasyExcel.write(response.getOutputStream(), Mail.class).sheet("模板").doWrite(mailList); } - public Page dissatisfied(Page page, MailQuery todoQuery) { - QueryWrapper queryWrapper = new QueryWrapper() - .ge(StrUtil.isNotBlank(todoQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStart()) - .le(StrUtil.isNotBlank(todoQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStartEnd()) - .eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource()) - .eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel()) - .eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory()) - .like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName()) + public Page dissatisfied(Page page, MailQuery mailQuery) { + QueryWrapper queryWrapper = new QueryWrapper() + .ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) + .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()) + .like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName()) // .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState()) .eq("m.satisfaction_status", "不满意") .or() .eq("m.verify_feedback", "不满意"); + roleCheck(queryWrapper); + if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) { + switch (mailQuery.getContactField()) { + case "name": + queryWrapper.like("w.contact_name", mailQuery.getContactFieldValue()); + break; + case "idCard": + queryWrapper.like("w.contactIdCard", mailQuery.getContactFieldValue()); + break; + case "phone": + queryWrapper.like("w.contactPhone", mailQuery.getContactFieldValue()); + break; + } + + } + // 排序 + queryWrapper.orderByDesc("w.update_time"); + return baseMapper.selectQueryPage(page, queryWrapper); + } + + /** + * 信件查询检查权限并显示 + * + * @param queryWrapper + */ + private void roleCheck(QueryWrapper queryWrapper) { Integer roleId = AdminThreadLocal.getRoleId(); // 与角色相关的件 if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || @@ -362,32 +383,24 @@ public class WorkService extends ServiceImpl { queryWrapper.eq("w.sign_role_id", roleId) // 如果不是市局专班,则需要查询签收部门ID .eq(!RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId), "w.sign_dept_id", deptId); + } else if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_LEADER.getRoleId())) { + //空操作 + } else if (roleId.equals(RoleEnum.SECOND_DEPT_LEADER.getRoleId())) { + //数据,领导只能看到自己管辖的部门 + Integer deptId = AdminThreadLocal.getDeptId(); + queryWrapper.eq("m.second_dept_id", deptId); + } else if (roleId.equals(RoleEnum.THREE_DEPT_LEADER.getRoleId())) { + Integer deptId = AdminThreadLocal.getDeptId(); + queryWrapper.eq("m.three_dept_id", deptId); } else { String empNo = AdminThreadLocal.getEmpNo(); queryWrapper.eq("w.police_emp_no", empNo); } - if (StrUtil.isNotBlank(todoQuery.getContactField()) && StrUtil.isNotBlank(todoQuery.getContactFieldValue())) { - switch (todoQuery.getContactField()) { - case "name": - queryWrapper.like("w.contact_name", todoQuery.getContactFieldValue()); - break; - case "idCard": - queryWrapper.like("w.contactIdCard", todoQuery.getContactFieldValue()); - break; - case "phone": - queryWrapper.like("w.contactPhone", todoQuery.getContactFieldValue()); - break; - } - - } - // 排序 - queryWrapper.orderByDesc("w.update_time"); - return baseMapper.selectPageTodo(page, queryWrapper); } - public AjaxResult> checkExcel(MultipartFile file, MailQuery mailQuery) throws IOException { - ExcelService excelService = new ExcelService(workMapper, mailQuery); - EasyExcel.read(file.getInputStream(), WorkVo.class, excelService).sheet().doRead(); + public AjaxResult> checkExcel(MultipartFile file, MailQuery mailQuery) throws IOException { + ExcelService excelService = new ExcelService(mailMapper, mailQuery); + EasyExcel.read(file.getInputStream(), Mail.class, excelService).sheet().doRead(); return AjaxResult.success(excelService.getResult()); } -} +} \ No newline at end of file diff --git a/mailbox-lan/src/main/resources/mapper/WorkMapper.xml b/mailbox-lan/src/main/resources/mapper/WorkMapper.xml index 08418b6..590c7e3 100644 --- a/mailbox-lan/src/main/resources/mapper/WorkMapper.xml +++ b/mailbox-lan/src/main/resources/mapper/WorkMapper.xml @@ -15,4 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${ew.getCustomSqlSegment} + +