Browse Source

修改信件查询的显示逻辑,修改excel下载,excel读取尚未完成

dev_ycq
21819 2 years ago
parent
commit
59cbd61905
  1. 5
      mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java
  2. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/system/MailLabelController.java
  3. 12
      mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java
  4. 76
      mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java
  5. 103
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java
  6. 4
      mailbox-lan/src/main/java/com/biutag/lan/mapper/WorkMapper.java
  7. 46
      mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java
  8. 139
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  9. 10
      mailbox-lan/src/main/resources/mapper/WorkMapper.xml

5
mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java

@ -20,7 +20,10 @@ public enum RoleEnum {
SECOND_DEPT_LEADER(4, "二级机构领导"), SECOND_DEPT_LEADER(4, "二级机构领导"),
// 三级机构领导 // 三级机构领导
THREE_DEPT_LEADER(5, "三级机构领导"); THREE_DEPT_LEADER(5, "三级机构领导"),
// 市局领导
MUNICIPAL_DEPT_LEADER(6, "市局领导");
private Integer roleId; private Integer roleId;

2
mailbox-lan/src/main/java/com/biutag/lan/controller/system/MailLabelController.java

@ -1,5 +1,6 @@
package com.biutag.lan.controller.system; package com.biutag.lan.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.biutag.aop.NotPower; import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult; import com.biutag.core.AjaxResult;
import com.biutag.lan.service.IMailLabelService; import com.biutag.lan.service.IMailLabelService;
@ -37,6 +38,7 @@ public class MailLabelController {
} }
@PostMapping("/insert") @PostMapping("/insert")
@SaCheckPermission("system:label:insert")
@ApiOperation(value="更新插入信件标签") @ApiOperation(value="更新插入信件标签")
public AjaxResult<Void> insertLabels(@Validated @RequestBody MailLabelInsertValidate createValidate) { public AjaxResult<Void> insertLabels(@Validated @RequestBody MailLabelInsertValidate createValidate) {
iMailLabelService.insertLabel(createValidate); iMailLabelService.insertLabel(createValidate);

12
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.aop.NotPower; import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult; import com.biutag.core.AjaxResult;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.Work; import com.biutag.lan.domain.Work;
import com.biutag.lan.domain.bo.MailQuery; 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.domain.vo.WorkVo;
import com.biutag.lan.service.MailSourceService; import com.biutag.lan.service.MailSourceService;
import com.biutag.lan.service.WorkService; import com.biutag.lan.service.WorkService;
@ -33,14 +35,14 @@ public class WorkController {
@NotPower @NotPower
@GetMapping("query") @GetMapping("query")
public AjaxResult<Page<WorkVo>> list(Page<Work> page, MailQuery todoQuery) { public AjaxResult<Page<QueryMailVo>> list(Page<Mail> page, MailQuery todoQuery) {
return AjaxResult.success(workService.queryPage(page, todoQuery)); return AjaxResult.success(workService.queryPage(page, todoQuery));
} }
@NotPower @NotPower
@PostMapping("export") @PostMapping("export")
public void detail(HttpServletResponse response, @RequestBody String dataWorkVo) throws IOException { public void detail(HttpServletResponse response, @RequestBody String data) throws IOException {
workService.export(response, dataWorkVo); workService.export(response, data);
} }
@NotPower @NotPower
@ -52,13 +54,13 @@ public class WorkController {
@NotPower @NotPower
@PostMapping("check") @PostMapping("check")
public AjaxResult<List<WorkVo>> check(MultipartFile file, MailQuery mailQuery) throws IOException { public AjaxResult<List<QueryMailVo>> check(MultipartFile file, MailQuery mailQuery) throws IOException {
return workService.checkExcel(file, mailQuery); return workService.checkExcel(file, mailQuery);
} }
@NotPower @NotPower
@GetMapping("dissatisfied") @GetMapping("dissatisfied")
public AjaxResult<Page<WorkVo>> dissatisfied(Page<Work> page, MailQuery todoQuery) { public AjaxResult<Page<QueryMailVo>> dissatisfied(Page<Mail> page, MailQuery todoQuery) {
return AjaxResult.success(workService.dissatisfied(page, todoQuery)); return AjaxResult.success(workService.dissatisfied(page, todoQuery));
} }
} }

76
mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java

@ -1,11 +1,11 @@
package com.biutag.lan.domain; package com.biutag.lan.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Accessors(chain = true) @Accessors(chain = true)
@ -14,56 +14,69 @@ import java.time.LocalDateTime;
public class Mail { public class Mail {
@TableId @TableId
@ExcelProperty("信件id")
private String id; private String id;
/** /**
* 联系人姓名 * 联系人姓名
*/ */
@ExcelProperty("联系人姓名")
private String contactName; private String contactName;
/** /**
* 联系人性别 M / F * 联系人性别 M / F
*/ */
@ExcelProperty("联系人性别")
private String contactSex; private String contactSex;
/** /**
* 联系人身份证号码 * 联系人身份证号码
*/ */
@ExcelProperty("联系人身份证号码")
private String contactIdCard; private String contactIdCard;
/** /**
* 联系人手机号 * 联系人手机号
*/ */
@ExcelProperty("联系人手机号")
private String contactPhone; private String contactPhone;
/** /**
* 案件编号 * 案件编号
*/ */
@ExcelProperty("案件编号")
private String caseNumber; private String caseNumber;
/** /**
* 内容 * 内容
*/ */
@ExcelProperty("内容")
private String content; private String content;
/** /**
* 附件 * 附件
*/ */
@ExcelProperty("附件")
private String attachments; private String attachments;
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@ExcelProperty("更新时间")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
* 来信时间 * 来信时间
*/ */
@ExcelProperty("来信时间")
private LocalDateTime mailTime; private LocalDateTime mailTime;
/** /**
* 来源 * 来源
*/ */
@ExcelProperty("来源")
private String source; private String source;
/** /**
* 满意读(群众) * 满意读(群众)
*/ */
@ExcelProperty("满意度(群众)")
private String satisfaction; private String satisfaction;
/*-------------------------------*/ /*-------------------------------*/
@ -71,282 +84,343 @@ public class Mail {
/** /**
* 信件状态 * 信件状态
*/ */
@ExcelProperty("信件状态")
private String mailState; private String mailState;
/** /**
* 信件当前流程 * 信件当前流程
*/ */
@ExcelProperty("信件当前流程")
private String flowKey; private String flowKey;
/** /**
* 信件当前流程节点 * 信件当前流程节点
*/ */
@ExcelProperty("信件当前流程节点")
private String flowBeforeName; private String flowBeforeName;
/** /**
* 流程限时最后操作时间 * 流程限时最后操作时间
*/ */
@ExcelProperty("流程限时最后操作时间")
private LocalDateTime flowLimitedLastHandlerTime; private LocalDateTime flowLimitedLastHandlerTime;
/** /**
* 信件源数据ID 多个 * 信件源数据ID 多个
*/ */
@ExcelProperty("信件源数据ID")
private String mailSourceId; private String mailSourceId;
/** /**
* 信件类名 * 信件类名
*/ */
@ExcelProperty("信件类名")
private String mailCategory; private String mailCategory;
/** /**
* 信件一级类目 * 信件一级类目
*/ */
@ExcelProperty("信件一级类目")
private String mailFirstCategory; private String mailFirstCategory;
/** /**
* 信件二级类目 * 信件二级类目
*/ */
@ExcelProperty("信件二级类目")
private String mailSecondCategory; private String mailSecondCategory;
/** /**
* 信件三级类目 * 信件三级类目
*/ */
@ExcelProperty("信件三级类目")
private String mailThreeCategory; private String mailThreeCategory;
/** /**
* 信件等级 * 信件等级
*/ */
@ExcelProperty("信件等级")
private String mailLevel; private String mailLevel;
/** /**
* 二级单位ID(主责) * 二级单位ID(主责)
*/ */
@ExcelProperty("二级单位ID(主责)")
private Integer secondDeptId; private Integer secondDeptId;
@ExcelProperty("二级单位名称(主责)")
private String secondDeptName; private String secondDeptName;
/** /**
* 三级单位ID(主责) * 三级单位ID(主责)
*/ */
@ExcelProperty("三级单位ID(主责)")
private Integer threeDeptId; private Integer threeDeptId;
@ExcelProperty("三级单位名称(主责)")
private String threeDeptName; private String threeDeptName;
/** /**
* 协办核查民警String * 协办核查民警String
*/ */
@ExcelProperty("协办核查民警")
private String coHandlingPolices; private String coHandlingPolices;
/** /**
* 联系民警名称 * 联系民警名称
*/ */
@ExcelProperty("联系民警姓名")
private String contactPoliceName; private String contactPoliceName;
/** /**
* 联系民警 * 联系民警
*/ */
@ExcelProperty("联系民警")
private String contactPoliceEmpNo; private String contactPoliceEmpNo;
/** /**
* 联系民警职位 * 联系民警职位
*/ */
@ExcelProperty("联系民警职位")
private String contactPolicePost; private String contactPolicePost;
/** /**
* 联系群众时间 * 联系群众时间
*/ */
@ExcelProperty("联系群众时间")
private LocalDateTime contactTime; private LocalDateTime contactTime;
/** /**
* 联系时长 * 联系时长
*/ */
@ExcelProperty("联系时长")
private Long contactDuration; private Long contactDuration;
/** /**
* 是否联系群众 * 是否联系群众
*/ */
@ExcelProperty("是否联系群众")
private Boolean contactFlag; private Boolean contactFlag;
/** /**
* 接访形式 * 接访形式
*/ */
@ExcelProperty("接访形式")
private String interviewType; private String interviewType;
/** /**
* 是否领导接访 * 是否领导接访
*/ */
@ExcelProperty("是否领导接访")
private Boolean interviewIsLeader; private Boolean interviewIsLeader;
/** /**
* 接访人员警号 * 接访人员警号
*/ */
@ExcelProperty("接访人员警号")
private String interviewPoliceEmpNo; private String interviewPoliceEmpNo;
/** /**
* 接访人员姓名 * 接访人员姓名
*/ */
@ExcelProperty("接访人员姓名")
private String interviewPoliceName; private String interviewPoliceName;
/** /**
* 接访情况 * 接访情况
*/ */
@ExcelProperty("接访情况")
private String interviewDetails; private String interviewDetails;
/** /**
* 接访附件佐证材料 * 接访附件佐证材料
*/ */
@ExcelProperty("接访附件")
private String interviewAttachments; private String interviewAttachments;
/** /**
* 核办情况 * 核办情况
*/ */
@ExcelProperty("核办情况")
private String verifyDetails; private String verifyDetails;
/** /**
* 核办-是否属实 * 核办-是否属实
*/ */
@ExcelProperty("核办-是否属实")
private String verifyIsTrue; private String verifyIsTrue;
/** /**
* 核办-被举报对象json * 核办-被举报对象json
*/ */
@ExcelProperty("核办-被举报对象")
private String verifyReportedPolices; private String verifyReportedPolices;
/** /**
* 核办-查证属实问题json * 核办-查证属实问题json
*/ */
@ExcelProperty("核办-查证属实问题")
private String verifyProblem; private String verifyProblem;
/** /**
* 核办-是否需要问责 * 核办-是否需要问责
*/ */
@ExcelProperty("核办-是否需要问责")
private Boolean verifyNeedAccountability; private Boolean verifyNeedAccountability;
/** /**
* 核办-责任追究json * 核办-责任追究json
*/ */
@ExcelProperty("核办-责任追究")
private String verifyPunish; private String verifyPunish;
/** /**
* 核办-群众反映事项解决情况(是否已解决) * 核办-群众反映事项解决情况(是否已解决)
*/ */
@ExcelProperty("核办-群众反映事项解决情况")
private Boolean verifyIsResolved; private Boolean verifyIsResolved;
/** /**
* 核办-办理反馈情况 * 核办-办理反馈情况
*/ */
@ExcelProperty("核办-办理反馈情况")
private String verifyFeedback; private String verifyFeedback;
/** /**
* 核办-回访人信息(String) * 核办-回访人信息(String)
*/ */
@ExcelProperty("核办-回访人信息")
private String verifyFollowupPolice; private String verifyFollowupPolice;
/** /**
* 核办-附件上传佐证 * 核办-附件上传佐证
*/ */
@ExcelProperty("核办-附件")
private String verifyAttachments; private String verifyAttachments;
/** /**
* 办结方式 * 办结方式
*/ */
@ExcelProperty("办结方式")
private String completeMethod; private String completeMethod;
/** /**
* 办理合格情况 * 办理合格情况
*/ */
@ExcelProperty("办理合格情况")
private String qualifiedProcessingStatus; private String qualifiedProcessingStatus;
/** /**
* 问题解决情况 * 问题解决情况
*/ */
@ExcelProperty("问题解决情况")
private Boolean problemSolvingStatus; private Boolean problemSolvingStatus;
/** /**
* 群众回复情况 * 群众回复情况
*/ */
@ExcelProperty("群众回复情况")
private String satisfactionStatus; private String satisfactionStatus;
/** /**
* 认定办结意见 * 认定办结意见
*/ */
@ExcelProperty("认定办结意见")
private String completionComment; private String completionComment;
/** /**
* 是否是简易流程 * 是否是简易流程
*/ */
@ExcelProperty("是否是简易流程")
private Boolean simpleFlowFlag; private Boolean simpleFlowFlag;
/** /**
* 涉及单位ID * 涉及单位ID
*/ */
@ExcelProperty("涉及单位ID")
private Integer involvedDeptId; private Integer involvedDeptId;
/** /**
* 涉及单位名称 * 涉及单位名称
*/ */
@ExcelProperty("涉及单位名称")
private String involvedDeptName; private String involvedDeptName;
/** /**
* 会签部门总数 * 会签部门总数
*/ */
@ExcelProperty("会签部门总数")
private Integer countersignTotal; private Integer countersignTotal;
/** /**
* 会签完成部门数量 * 会签完成部门数量
*/ */
@ExcelProperty("会签完成部门数量")
private Integer countersignCompleted; private Integer countersignCompleted;
/** /**
* 会签发起人 * 会签发起人
*/ */
@ExcelProperty("会签发起人")
private String countersignPromoterEmpNo; private String countersignPromoterEmpNo;
/** /**
* 会签发起姓名 * 会签发起姓名
*/ */
@ExcelProperty("会签发起姓名")
private String countersignPromoterName; private String countersignPromoterName;
/** /**
* 会签发起部门ID * 会签发起部门ID
*/ */
@ExcelProperty("会签发起部门ID")
private Integer countersignPromoterDeptId; private Integer countersignPromoterDeptId;
/** /**
* 会签发起部门名称 * 会签发起部门名称
*/ */
@ExcelProperty("会签发起部门名称")
private String countersignPromoterDeptName; private String countersignPromoterDeptName;
/** /**
* 会签具体要求 * 会签具体要求
*/ */
@ExcelProperty("会签具体要求")
private String countersignRequirement; private String countersignRequirement;
/** /**
* 信件标签 * 信件标签
*/ */
@ExcelProperty("信件标签")
private String mailLabels; private String mailLabels;
/** /**
* 当前操作人 * 当前操作人
*/ */
@ExcelProperty("当前操作人")
private String currentOperator; private String currentOperator;
/** /**
* 是否申请延期 * 是否申请延期
*/ */
@ExcelProperty("是否申请延期")
private Boolean extensionFlag; private Boolean extensionFlag;
/** /**
* 延期天数 * 延期天数
*/ */
@ExcelProperty("延期天数")
private Integer extensionDays; private Integer extensionDays;
/** /**
* 延期理由 * 延期理由
*/ */
@ExcelProperty("延期理由")
private String extensionReason; private String extensionReason;
/** /**
* 延期状态 * 延期状态
*/ */
@ExcelProperty("延期状态")
private String extensionState; private String extensionState;
/** /**
* 无效判定理由 * 无效判定理由
*/ */
@ExcelProperty("无效判定理由")
private String invalidationReason; private String invalidationReason;
/** /**
* 市局下发信息 * 市局下发信息
*/ */
@ExcelProperty("市局下发信息")
private String firstDistributeInfo; private String firstDistributeInfo;
/** /**
* 二级单位下发信息 * 二级单位下发信息
*/ */
@ExcelProperty("二级单位下发信息")
private String secondDistributeInfo; private String secondDistributeInfo;
} }

103
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;
}

4
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.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.Work;
import com.biutag.lan.domain.vo.QueryMailVo;
import com.biutag.lan.domain.vo.WorkVo; import com.biutag.lan.domain.vo.WorkVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -13,6 +15,8 @@ public interface WorkMapper extends BaseMapper<Work> {
Page<WorkVo> selectPageTodo(@Param("page") Page<Work> page, @Param(Constants.WRAPPER) QueryWrapper<Work> queryWrapper); Page<WorkVo> selectPageTodo(@Param("page") Page<Work> page, @Param(Constants.WRAPPER) QueryWrapper<Work> queryWrapper);
Page<QueryMailVo> selectQueryPage(@Param("page") Page<Mail> page, @Param(Constants.WRAPPER) QueryWrapper<Mail> 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}") @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); Integer selectCount(String flowKey, Integer deptId);

46
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.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener; import com.alibaba.excel.read.listener.ReadListener;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.bo.MailQuery;
import com.biutag.lan.domain.vo.WorkVo; import com.biutag.lan.domain.vo.QueryMailVo;
import com.biutag.lan.mapper.WorkMapper; import com.biutag.lan.mapper.MailMapper;
import lombok.Getter; import lombok.Getter;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Getter @Getter
public class ExcelService implements ReadListener<WorkVo> { public class ExcelService implements ReadListener<Mail> {
private List<Work> dbDatalist; private List<Mail> dbDatalist;
private List<WorkVo> excelDatalist = new ArrayList<>(); private List<Mail> excelDatalist = new ArrayList<>();
private List<WorkVo> result; private List<QueryMailVo> result;
private final MailMapper mailMapper;
private final WorkMapper workMapper;
private final MailQuery mailQuery; private final MailQuery mailQuery;
public ExcelService(WorkMapper workMapper, MailQuery mailQuery) { public ExcelService(MailMapper mailMapper, MailQuery mailQuery) {
this.workMapper = workMapper; this.mailMapper = mailMapper;
this.mailQuery = mailQuery; this.mailQuery = mailQuery;
} }
@Override @Override
public void invoke(WorkVo workVo, AnalysisContext analysisContext) { public void invoke(Mail mail, AnalysisContext analysisContext) {
excelDatalist.add(workVo); excelDatalist.add(mail);
} }
@Override @Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) { public void doAfterAllAnalysed(AnalysisContext analysisContext) {
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>() QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>()
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) .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()); .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++) { for (int i = 0; i < excelDatalist.size(); i++) {
WorkVo workVo = excelDatalist.get(i); Mail excelMail = excelDatalist.get(i);
for (Work work : dbDatalist) { for (Mail mail : dbDatalist) {
if (work.getMailId().equals(workVo.getMailId())) { if (excelMail.getId().equals(mail.getId())) {
excelDatalist.remove(workVo); excelDatalist.remove(excelMail);
i--; // 减去索引以补偿移除的元素 i--; // 减去索引以补偿移除的元素
break; // 一旦找到匹配并移除,跳出内循环 break; // 一旦找到匹配并移除,跳出内循环
} }
} }
} }
result = excelDatalist; result = excelDatalist.stream().map(mail -> {
QueryMailVo queryMailVo = new QueryMailVo();
BeanUtils.copyProperties(mail, queryMailVo);
return queryMailVo;
}).collect(Collectors.toList());
} }
} }

139
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.MailSource;
import com.biutag.lan.domain.Work; import com.biutag.lan.domain.Work;
import com.biutag.lan.domain.bo.MailQuery; 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.domain.vo.WorkVo;
import com.biutag.lan.enums.WorkType; import com.biutag.lan.enums.WorkType;
import com.biutag.lan.mapper.MailLabelMapper; import com.biutag.lan.mapper.MailLabelMapper;
import com.biutag.lan.mapper.MailMapper;
import com.biutag.lan.mapper.WorkMapper; import com.biutag.lan.mapper.WorkMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
@ -44,6 +46,9 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
@Resource @Resource
private WorkMapper workMapper; private WorkMapper workMapper;
@Resource
private MailMapper mailMapper;
public boolean saveBatch(List<MailSource> mailSources) { public boolean saveBatch(List<MailSource> mailSources) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
List<Work> list = mailSources.stream().map(mail -> { List<Work> list = mailSources.stream().map(mail -> {
@ -268,52 +273,40 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
return list(new LambdaQueryWrapper<Work>().eq(Work::getMailId, mailId).eq(Work::getSignRoleId, roleId).eq(Work::getWorkType, workType)); return list(new LambdaQueryWrapper<Work>().eq(Work::getMailId, mailId).eq(Work::getSignRoleId, roleId).eq(Work::getWorkType, workType));
} }
public Page<WorkVo> queryPage(Page<Work> page, MailQuery todoQuery) { public Page<QueryMailVo> queryPage(Page<Mail> page, MailQuery mailQuery) {
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>() QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>()
.ge(StrUtil.isNotBlank(todoQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStart()) .ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart())
.le(StrUtil.isNotBlank(todoQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStartEnd()) .le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd())
.eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource()) .eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource())
.eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel()) .eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel())
.eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory()) .eq(StrUtil.isNotBlank(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory())
.like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName()) .like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName())
.eq(StrUtil.isNotBlank(todoQuery.getFlowKey()), "m.flow_key", todoQuery.getFlowKey()); .eq(StrUtil.isNotBlank(mailQuery.getFlowKey()), "m.flow_key", mailQuery.getFlowKey());
if (StrUtil.isNotBlank(todoQuery.getMailLabels())) { if (StrUtil.isNotBlank(mailQuery.getMailLabels())) {
List<String> labelIds = todoQuery.handleMailLabels(); List<String> labelIds = mailQuery.handleMailLabels();
for (String labelId : labelIds) { for (String labelId : labelIds) {
queryWrapper.like("m.mail_labels", labelId); queryWrapper.like("m.mail_labels", labelId);
} }
} }
Integer roleId = AdminThreadLocal.getRoleId(); roleCheck(queryWrapper);
// 与角色相关的件 if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) {
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || switch (mailQuery.getContactField()) {
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()) {
case "name": case "name":
queryWrapper.like("w.contact_name", todoQuery.getContactFieldValue()); queryWrapper.like("w.contact_name", mailQuery.getContactFieldValue());
break; break;
case "idCard": case "idCard":
queryWrapper.like("w.contactIdCard", todoQuery.getContactFieldValue()); queryWrapper.like("w.contact_idCard", mailQuery.getContactFieldValue());
break; break;
case "phone": case "phone":
queryWrapper.like("w.contactPhone", todoQuery.getContactFieldValue()); queryWrapper.like("w.contactPhone", mailQuery.getContactFieldValue());
break; break;
} }
} }
// 排序 // 排序
queryWrapper.orderByDesc("w.update_time"); queryWrapper.orderByDesc("w.update_time");
Page<WorkVo> result = baseMapper.selectPageTodo(page, queryWrapper); Page<QueryMailVo> result = baseMapper.selectQueryPage(page, queryWrapper);
for (WorkVo workVo : result.getRecords()) { for (QueryMailVo workVo : result.getRecords()) {
List<MailLabel> labelNames = mailLabelMapper.selectList(null); List<MailLabel> labelNames = mailLabelMapper.selectList(null);
if (StrUtil.isNotBlank(workVo.getMailLabels())) { if (StrUtil.isNotBlank(workVo.getMailLabels())) {
String[] labelIds = workVo.getMailLabels().split(","); String[] labelIds = workVo.getMailLabels().split(",");
@ -331,28 +324,56 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
return result; return result;
} }
public void export(HttpServletResponse response, String dataWorkVo) throws IOException { public void export(HttpServletResponse response, String ids) throws IOException {
List<WorkVo> data = JSON.parseArray(dataWorkVo, WorkVo.class); List<String> data = JSON.parseArray(ids, String.class);
List<Mail> mailList = mailMapper.selectBatchIds(data);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
// 这里URLEncoder.encode可以防止中文乱码 // 这里URLEncoder.encode可以防止中文乱码
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); 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<WorkVo> dissatisfied(Page<Work> page, MailQuery todoQuery) { public Page<QueryMailVo> dissatisfied(Page<Mail> page, MailQuery mailQuery) {
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>() QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>()
.ge(StrUtil.isNotBlank(todoQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStart()) .ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart())
.le(StrUtil.isNotBlank(todoQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStartEnd()) .le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd())
.eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource()) .eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource())
.eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel()) .eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel())
.eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory()) .eq(StrUtil.isNotBlank(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory())
.like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName()) .like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName())
// .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState()) // .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState())
.eq("m.satisfaction_status", "不满意") .eq("m.satisfaction_status", "不满意")
.or() .or()
.eq("m.verify_feedback", "不满意"); .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<Mail> queryWrapper) {
Integer roleId = AdminThreadLocal.getRoleId(); Integer roleId = AdminThreadLocal.getRoleId();
// 与角色相关的件 // 与角色相关的件
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) ||
@ -362,32 +383,24 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
queryWrapper.eq("w.sign_role_id", roleId) queryWrapper.eq("w.sign_role_id", roleId)
// 如果不是市局专班,则需要查询签收部门ID // 如果不是市局专班,则需要查询签收部门ID
.eq(!RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId), "w.sign_dept_id", deptId); .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 { } else {
String empNo = AdminThreadLocal.getEmpNo(); String empNo = AdminThreadLocal.getEmpNo();
queryWrapper.eq("w.police_emp_no", empNo); 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<List<WorkVo>> checkExcel(MultipartFile file, MailQuery mailQuery) throws IOException { public AjaxResult<List<QueryMailVo>> checkExcel(MultipartFile file, MailQuery mailQuery) throws IOException {
ExcelService excelService = new ExcelService(workMapper, mailQuery); ExcelService excelService = new ExcelService(mailMapper, mailQuery);
EasyExcel.read(file.getInputStream(), WorkVo.class, excelService).sheet().doRead(); EasyExcel.read(file.getInputStream(), Mail.class, excelService).sheet().doRead();
return AjaxResult.success(excelService.getResult()); return AjaxResult.success(excelService.getResult());
} }
} }

10
mailbox-lan/src/main/resources/mapper/WorkMapper.xml

@ -15,4 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>
<select id="selectQueryPage" resultType="com.biutag.lan.domain.vo.QueryMailVo">
select m.contact_name,m.contact_phone,m.contact_id_card,m.contact_sex,m.content,m.source,m.mail_time,m.id,m.mail_state,
m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,
f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time
from mail m
left join work w on m.id = w.mail_id
left join flow_node f on m.flow_key = f.key
${ew.getCustomSqlSegment}
</select>
</mapper> </mapper>

Loading…
Cancel
Save