Browse Source

fix: 局长信箱子信件用用主信件的信息

master
parent
commit
6c3d3505cf
  1. 13
      src/main/java/com/biutag/supervision/mapper/MailSourceMapper.java
  2. 116
      src/main/java/com/biutag/supervision/pojo/entity/mailbox/MailSource.java
  3. 67
      src/main/java/com/biutag/supervision/pojo/param/MailSourceQueryParam.java
  4. 87
      src/main/java/com/biutag/supervision/repository/mail/MailSourceResourceService.java
  5. 22
      src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java

13
src/main/java/com/biutag/supervision/mapper/MailSourceMapper.java

@ -0,0 +1,13 @@
package com.biutag.supervision.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.mailbox.MailSource;
/**
* @author
* @date
*/
@DS("mailbox")
public interface MailSourceMapper extends BaseMapper<MailSource> {
}

116
src/main/java/com/biutag/supervision/pojo/entity/mailbox/MailSource.java

@ -0,0 +1,116 @@
package com.biutag.supervision.pojo.entity.mailbox;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* @ClassName MailSource
* @Description 信件源数据
* @Author
* @Date
*/
@Accessors(chain = true)
@Getter
@Setter
@Schema(description = "信件源数据")
@TableName("mail_source")
public class MailSource {
@Schema(description = "主键ID")
@TableId
@TableField("id")
private String id;
@Schema(description = "联系人姓名")
@TableField("contact_name")
private String contactName;
@Schema(description = "联系人性别")
@TableField("contact_sex")
private String contactSex;
@Schema(description = "联系人身份证号")
@TableField("contact_id_card")
private String contactIdCard;
@Schema(description = "联系人手机号")
@TableField("contact_phone")
private String contactPhone;
@Schema(description = "案件编号")
@TableField("case_number")
private String caseNumber;
@Schema(description = "内容")
@TableField("content")
private String content;
@Schema(description = "附件")
@TableField("attachments")
private String attachments;
@Schema(description = "创建时间")
@TableField("create_time")
private LocalDateTime createTime;
@Schema(description = "更新时间")
@TableField("update_time")
private LocalDateTime updateTime;
@Schema(description = "来源")
@TableField("source")
private String source;
@Schema(description = "状态")
@TableField("state")
private String state;
@Schema(description = "信件ID")
@TableField("mail_id")
private String mailId;
@Schema(description = "来信时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("mail_time")
private LocalDateTime mailTime;
@Schema(description = "信件类别")
@TableField("mail_type")
private String mailType;
@Schema(description = "涉及单位ID")
@TableField("involved_dept_id")
private Integer involvedDeptId;
@Schema(description = "涉及单位名称")
@TableField("involved_dept_name")
private String involvedDeptName;
@Schema(description = "签收标识")
@TableField("sign_flag")
private Boolean signFlag;
@Schema(description = "AI判断状态")
@TableField("ai_determine_state")
private String aiDetermineState;
@Schema(description = "AI判断数量")
@TableField("ai_determine_total")
private Integer aiDetermineTotal;
@Schema(description = "是否复核")
@TableField("revisit")
private Boolean revisit;
@Schema(description = "数据来源平台")
@TableField("data_source_platform")
private String dataSourcePlatform;
}

67
src/main/java/com/biutag/supervision/pojo/param/MailSourceQueryParam.java

@ -0,0 +1,67 @@
package com.biutag.supervision.pojo.param;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* @ClassName MailSourceQueryParam
* @Description 信件源数据查询参数
* @Author
* @Date
*/
@Getter
@Setter
@Schema(description = "信件源数据查询参数")
public class MailSourceQueryParam extends BasePage {
@Schema(description = "主键")
private String id;
@Schema(description = "主键集合")
private Set<String> ids;
@Schema(description = "信件表ID")
private String mailId;
@Schema(description = "信件表ID集合")
private Set<String> mailIds;
@Schema(description = "联系人姓名")
private String contactName;
@Schema(description = "联系人手机号")
private String contactPhone;
@Schema(description = "案件编号")
private String caseNumber;
@Schema(description = "来源")
private String source;
@Schema(description = "状态")
private String state;
@Schema(description = "信件类别")
private String mailType;
@Schema(description = "涉及单位ID")
private Integer involvedDeptId;
@Schema(description = "AI判断状态")
private String aiDetermineState;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private List<Date> createTime = new ArrayList<>();
@Schema(description = "来信时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private List<Date> mailTime = new ArrayList<>();
}

87
src/main/java/com/biutag/supervision/repository/mail/MailSourceResourceService.java

@ -0,0 +1,87 @@
package com.biutag.supervision.repository.mail;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.mapper.MailSourceMapper;
import com.biutag.supervision.pojo.entity.mailbox.MailSource;
import com.biutag.supervision.pojo.param.MailSourceQueryParam;
import com.biutag.supervision.repository.base.BaseDAO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* @ClassName MailSourceResourceService
* @Description 信件源数据资源层
* @Author
* @Date
*/
@Service
public class MailSourceResourceService extends BaseDAO {
@Resource
private MailSourceMapper mailSourceMapper;
public List<MailSource> query(MailSourceQueryParam param) {
LambdaQueryWrapper<MailSource> queryWrapper = new LambdaQueryWrapper<>();
setBatchQuery(param.getMailId(), param.getMailIds(), queryWrapper, MailSource::getMailId);
queryWrapper.eq(StrUtil.isNotBlank(param.getId()), MailSource::getId, param.getId());
queryWrapper.in(CollectionUtil.isNotEmpty(param.getIds()), MailSource::getId, param.getIds());
queryWrapper.eq(StrUtil.isNotBlank(param.getContactPhone()), MailSource::getContactPhone, param.getContactPhone());
queryWrapper.eq(StrUtil.isNotBlank(param.getCaseNumber()), MailSource::getCaseNumber, param.getCaseNumber());
queryWrapper.eq(StrUtil.isNotBlank(param.getState()), MailSource::getState, param.getState());
queryWrapper.eq(StrUtil.isNotBlank(param.getSource()), MailSource::getSource, param.getSource());
queryWrapper.eq(StrUtil.isNotBlank(param.getMailType()), MailSource::getMailType, param.getMailType());
queryWrapper.eq(StrUtil.isNotBlank(param.getAiDetermineState()), MailSource::getAiDetermineState, param.getAiDetermineState());
queryWrapper.eq(Objects.nonNull(param.getInvolvedDeptId()), MailSource::getInvolvedDeptId, param.getInvolvedDeptId());
queryWrapper.eq(StrUtil.isNotBlank(param.getContactName()), MailSource::getContactName, param.getContactName());
if (!param.getMailTime().isEmpty() && param.getMailTime().size() >= 2) {
queryWrapper.between(MailSource::getMailTime, param.getMailTime().get(0), param.getMailTime().get(1));
}
if (!param.getCreateTime().isEmpty() && param.getCreateTime().size() >= 2) {
queryWrapper.between(MailSource::getCreateTime, param.getCreateTime().get(0), param.getCreateTime().get(1));
}
if (queryWrapper.getExpression() == null || queryWrapper.getExpression().getSqlSegment().isEmpty()) {
return Collections.emptyList();
}
return mailSourceMapper.selectList(queryWrapper);
}
public long count(MailSourceQueryParam param) {
LambdaQueryWrapper<MailSource> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(param.getId()), MailSource::getId, param.getId());
queryWrapper.in(CollectionUtil.isNotEmpty(param.getIds()), MailSource::getId, param.getIds());
queryWrapper.eq(StrUtil.isNotBlank(param.getContactPhone()), MailSource::getContactPhone, param.getContactPhone());
queryWrapper.eq(StrUtil.isNotBlank(param.getState()), MailSource::getState, param.getState());
queryWrapper.eq(StrUtil.isNotBlank(param.getMailType()), MailSource::getMailType, param.getMailType());
if (CollectionUtil.isNotEmpty(param.getCreateTime()) && param.getCreateTime().size() >= 2) {
queryWrapper.between(MailSource::getCreateTime, param.getCreateTime().get(0), param.getCreateTime().get(1));
}
if (CollectionUtil.isNotEmpty(param.getMailTime()) && param.getMailTime().size() >= 2) {
queryWrapper.between(MailSource::getMailTime, param.getMailTime().get(0), param.getMailTime().get(1));
}
return mailSourceMapper.selectCount(queryWrapper);
}
public Page<MailSource> page(MailSourceQueryParam param) {
LambdaQueryWrapper<MailSource> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(param.getId()), MailSource::getId, param.getId());
queryWrapper.in(CollectionUtil.isNotEmpty(param.getIds()), MailSource::getId, param.getIds());
queryWrapper.eq(StrUtil.isNotBlank(param.getContactPhone()), MailSource::getContactPhone, param.getContactPhone());
queryWrapper.eq(StrUtil.isNotBlank(param.getCaseNumber()), MailSource::getCaseNumber, param.getCaseNumber());
queryWrapper.eq(StrUtil.isNotBlank(param.getState()), MailSource::getState, param.getState());
queryWrapper.eq(StrUtil.isNotBlank(param.getSource()), MailSource::getSource, param.getSource());
queryWrapper.eq(StrUtil.isNotBlank(param.getMailType()), MailSource::getMailType, param.getMailType());
queryWrapper.eq(StrUtil.isNotBlank(param.getContactName()), MailSource::getContactName, param.getContactName());
if (!param.getMailTime().isEmpty() && param.getMailTime().size() >= 2) {
queryWrapper.between(MailSource::getMailTime, param.getMailTime().get(0), param.getMailTime().get(1));
}
queryWrapper.orderByDesc(MailSource::getCreateTime);
return mailSourceMapper.selectPage(new Page<>(param.getCurrent(), param.getSize()), queryWrapper);
}
}

22
src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java

@ -20,6 +20,7 @@ import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.entity.mailbox.Mail;
import com.biutag.supervision.pojo.entity.mailbox.MailBlame;
import com.biutag.supervision.pojo.entity.mailbox.MailExtension;
import com.biutag.supervision.pojo.entity.mailbox.MailSource;
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionInitialEnum;
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionPublicApprovalEnum;
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionSourceTableEnum;
@ -27,10 +28,12 @@ import com.biutag.supervision.pojo.enums.negative.NegativeSourceTypeEnum;
import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionQueryParam;
import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionUpdateParam;
import com.biutag.supervision.pojo.param.MailQueryParam;
import com.biutag.supervision.pojo.param.MailSourceQueryParam;
import com.biutag.supervision.pojo.param.SupDepartQueryParam;
import com.biutag.supervision.pojo.param.SupExternalDepartQueryParam;
import com.biutag.supervision.repository.complaintCollection.ComplaintCollectionResourceService;
import com.biutag.supervision.repository.mail.MailResourceService;
import com.biutag.supervision.repository.mail.MailSourceResourceService;
import com.biutag.supervision.repository.supExternalDepart.SupExternalDepartResourceService;
import com.biutag.supervision.repository.supdepart.SupDepartResourceService;
import com.biutag.supervision.service.complaintCollection.ComplaintCollectionService;
@ -82,6 +85,7 @@ public class MailBoxCaptureService {
private final ComplaintCollectionService complaintCollectionService;
private static final DateTimeFormatter INITIAL_REVIEW_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static final int CHECK_LIMIT_DAYS = 4;
private final MailSourceResourceService mailSourceResourceService ;
// ==================== 阶段1:抓取来信 ====================
@ -162,6 +166,15 @@ public class MailBoxCaptureService {
for (ComplaintCollection cc : completedList) {
try {
String originId = cc.getOriginId();
// 先去看看有没有主信件
MailSourceQueryParam mailSourceQueryParam = new MailSourceQueryParam();
mailSourceQueryParam.setId(originId);
mailSourceQueryParam.setState("merge");
List<MailSource> mailSourceList = mailSourceResourceService.query(mailSourceQueryParam);
if (CollectionUtil.isNotEmpty(mailSourceList)) {
log.info("这是合并子件:{}, 找到主件{}", originId, mailSourceList.get(0).getMailId());
originId = mailSourceList.get(0).getMailId();
}
// 查询信件
MailQueryParam param = new MailQueryParam();
param.setId(originId);
@ -778,6 +791,15 @@ public class MailBoxCaptureService {
for (ComplaintCollection cc : mailBoxList) {
try {
String originId = cc.getOriginId();
// 先看看有没有主信件(合并件场景)
MailSourceQueryParam mailSourceQueryParam = new MailSourceQueryParam();
mailSourceQueryParam.setId(originId);
mailSourceQueryParam.setState("merge");
List<MailSource> mailSourceList = mailSourceResourceService.query(mailSourceQueryParam);
if (CollectionUtil.isNotEmpty(mailSourceList)) {
log.info("【延期同步】合并子件:{}, 找到主件{}", originId, mailSourceList.get(0).getMailId());
originId = mailSourceList.get(0).getMailId();
}
// 查询延期信息(可扩展:后续可能来自多个来源)
MailExtension extension = fetchExtensionInfo(originId);
if (extension == null) {

Loading…
Cancel
Save