Browse Source

和局长信箱对接

厅长信箱
wxc 4 months ago
parent
commit
df071a604a
  1. 5
      mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java
  2. 23
      mailbox-lan/src/main/java/com/biutag/lan/domain/DeptMapping.java
  3. 30
      mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java
  4. 6
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailApproval.java
  5. 2
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailFlow.java
  6. 26
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailDomain.java
  7. 13
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java
  8. 1
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ApprovalFlow.java
  9. 40
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/DistributeFlow.java
  10. 4
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  11. 114
      mailbox-lan/src/main/java/com/biutag/lan/job/MailboxJob.java
  12. 11
      mailbox-lan/src/main/java/com/biutag/lan/mapper/DeptMappingMapper.java
  13. 2
      mailbox-lan/src/main/resources/application-dev.yml
  14. 3
      mailbox-lan/src/main/resources/application-prod.yml
  15. 0
      mailbox-lan/src/main/resources/mapper/DeptMappingMapper.xml

5
mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java

@ -239,10 +239,9 @@ public class MailController {
// 核查办理
.setVerifyDetails(data.getString("verifyDetails"))
.setVerifyIsTrue(data.getString("verifyIsTrue"))
.setVerifyReportedPolices(data.getString("verifyReportedPolices"))
.setVerifyProblem(data.getString("verifyProblem"))
.setVerifyNeedAccountability(data.getBoolean("verifyNeedAccountability"))
.setVerifyPunish(data.getString("verifyPunish"))
.setVerifyIsResolved(data.getBoolean("verifyIsResolved"))
.setVerifyFeedback(data.getString("verifyFeedback"))
.setVerifyFollowupPolice(verifyFollowupPolice)

23
mailbox-lan/src/main/java/com/biutag/lan/domain/DeptMapping.java

@ -0,0 +1,23 @@
package com.biutag.lan.domain;
import lombok.Getter;
import lombok.Setter;
/**
* @author wxc
* @date 2025/7/31
*/
@Setter
@Getter
public class DeptMapping {
private String internalId;
private String internalName;
private String externalId;
private String externalName;
}

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

@ -47,15 +47,17 @@ public class Mail {
/**
* 创建时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 更新时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/**
* 来信时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime mailTime;
/**
@ -93,6 +95,7 @@ public class Mail {
/**
* 流程限时最后操作时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime flowLimitedLastHandlerTime;
/**
@ -158,6 +161,7 @@ public class Mail {
/**
* 联系群众时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime contactTime;
/**
@ -202,22 +206,24 @@ public class Mail {
* 核办-是否属实
*/
private String verifyIsTrue;
/**
* 核办-被举报对象json
*/
private String verifyReportedPolices;
/**
* 核办-查证属实问题json
* 核办-被举报对象json-废弃
*/
private String verifyProblem;
// private String verifyReportedPolices;
// /**
// * 核办-查证属实问题(json)-废弃
// */
// private String verifyProblem;
// /**
// * 核办-责任追究(json)-废弃
// */
// private String verifyPunish;
/**
* 核办-是否需要问责
*/
private Boolean verifyNeedAccountability;
/**
* 核办-责任追究json
*/
private String verifyPunish;
/**
* 核办-群众反映事项解决情况(是否已解决)
@ -388,6 +394,7 @@ public class Mail {
/**
* 市局专班下发时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime firstDistributeTime;
/**
@ -423,6 +430,7 @@ public class Mail {
/**
* 二级机构下发时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime secondDistributeTime;
// 派驻督察人员

6
mailbox-lan/src/main/java/com/biutag/lan/domain/MailApproval.java

@ -2,6 +2,7 @@ package com.biutag.lan.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@ -23,6 +24,7 @@ public class MailApproval {
* 审批意见
*/
private String comment;
/**
* 操作人员警号
*/
@ -38,9 +40,11 @@ public class MailApproval {
* 角色id
*/
private Integer roleId;
/**
*
* 创建时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 流程节点

2
mailbox-lan/src/main/java/com/biutag/lan/domain/MailFlow.java

@ -70,7 +70,7 @@ public class MailFlow {
/**
* 创建时间
*/
@JsonFormat(pattern = "MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**

26
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailDomain.java

@ -0,0 +1,26 @@
package com.biutag.lan.domain.vo;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailApproval;
import com.biutag.lan.domain.MailFlow;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
* @author wxc
* @date 2025/7/31
*/
@Setter
@Getter
public class MailDomain {
private Mail mail;
private List<MailFlow> flows = new ArrayList<>();
private List<MailApproval> approvals = new ArrayList<>();
}

13
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java

@ -448,18 +448,7 @@ public class MailVo {
if (StrUtil.isNotBlank(mail.getInterviewAttachments())) {
mailVo.setInterviewAttachments(JSON.parseArray(mail.getInterviewAttachments()));
}
// 核办-被举报对
if (StrUtil.isNotBlank(mail.getVerifyReportedPolices())) {
mailVo.setVerifyReportedPolices(JSON.parseArray(mail.getVerifyReportedPolices()));
}
// 核办-查证属实问题(json)
if (StrUtil.isNotBlank(mail.getVerifyProblem())) {
mailVo.setVerifyProblem(JSON.parseArray(mail.getVerifyProblem()));
}
// 核办-责任追究(json)
if (StrUtil.isNotBlank(mail.getVerifyPunish())) {
mailVo.setVerifyPunish(JSON.parseArray(mail.getVerifyPunish()));
}
// 回访人信息
if (StrUtil.isNotBlank(mail.getVerifyFollowupPolice())) {
mailVo.setVerifyFollowupPolice(JSON.parseObject(mail.getVerifyFollowupPolice()));

1
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ApprovalFlow.java

@ -83,7 +83,6 @@ public class ApprovalFlow extends Flow {
.setSatisfactionStatus(satisfactionStatus)
.setNotSatisfiedReason(data.getString("notSatisfiedReason"))
.setCompletionComment(data.getString("completionComment"))
.setVerifyProblem(data.getString("verifyProblem"))
.setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowName(FlowNodeEnum.COMPLETION.getFullName())
// 信件状态改为已办结

40
mailbox-lan/src/main/java/com/biutag/lan/flow/node/DistributeFlow.java

@ -1,6 +1,9 @@
package com.biutag.lan.flow.node;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
@ -20,11 +23,16 @@ import com.biutag.lan.service.WorkService;
import com.biutag.oss.StorageService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.Base64;
import java.util.Date;
/**
* 市局专班下发
@ -38,6 +46,14 @@ public class DistributeFlow extends Flow {
private final IDeptService deptService;
private final StorageService storageService;
private final String key = "mailbox";
@Value("mailbox.url:''")
private String mailboxUrl;
@Value("${spring.profiles.active}")
private String active;
@Transactional(rollbackFor = Exception.class)
@Override
public Flow next(String nextActionKey, String mailId, JSONObject data) {
@ -56,7 +72,9 @@ public class DistributeFlow extends Flow {
}
work.setUpdateTime(LocalDateTime.now()).setWorkState(Work.State.done.name()).setFlowName(FlowNameEnum.PENDING_DISTRIBUTE.getDoneName());
workService.updateById(work);
if (AppConstants.CHANGSHA_DEPT_ID.equals(mainDeptId)) {
Flow nextNode = next.get(nextActionKey);
if (AppConstants.CHANGSHA_DEPT_ID.equals(mainDeptId) && "prod".equals(active)) {
MailApiV1Req mailApiV1Req = new MailApiV1Req();
BeanUtils.copyProperties(mail, mailApiV1Req);
mailApiV1Req.setSource(MailSource.Source.TZXX.getValue());
@ -65,21 +83,31 @@ public class DistributeFlow extends Flow {
if (!jsonArray.isEmpty()) {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
jsonObject.put("fullPath", false);
String filepath = jsonObject.getString("filepath");
InputStream is = storageService.download(filepath);
ByteArrayOutputStream os = new ByteArrayOutputStream();
IoUtil.copy(is, os);
byte[] byteArray = os.toByteArray();
String base64 = Base64.getEncoder().encodeToString(byteArray);
jsonObject.put("base64", base64);
}
}
mail.setAttachments(jsonArray.toJSONString());
}
return null;
long timestamp = new Date().getTime();
// 上传
HttpUtil.createPost(mailboxUrl + "/v1/mail")
.header("timestamp", String.valueOf(timestamp))
.auth(MD5.create().digestHex(key + timestamp))
.body(JSON.toJSONString(mailApiV1Req)).execute();
return nextNode;
}
// 更新信件
DeptVo deptVo = deptService.detail(mainDeptId);
// 下发信件(主责单位)
workService.saveOrUpdate(mail, RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId(), mainDeptId, now, true, FlowNameEnum.PENDING_SIGN.getName());
Flow nextNode = next.get(nextActionKey);
mail.setUpdateTime(now)
.setFlowKey(nextNode.getFlowNode().getKey())
.setFlowName(nextNode.getFlowNode().getBeforeName())

4
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java

@ -191,10 +191,8 @@ public class ThreeVerifyFlow extends Flow {
// 核查办理
.setVerifyDetails(data.getString("verifyDetails"))
.setVerifyIsTrue(data.getString("verifyIsTrue"))
.setVerifyReportedPolices(data.getString("verifyReportedPolices"))
.setVerifyProblem(data.getString("verifyProblem"))
.setVerifyNeedAccountability(data.getBoolean("verifyNeedAccountability"))
.setVerifyPunish(data.getString("verifyPunish"))
.setVerifyIsResolved(data.getBoolean("verifyIsResolved"))
.setVerifyFeedback(data.getString("verifyFeedback"))
.setVerifyFollowupPolice(verifyFollowupPolice)

114
mailbox-lan/src/main/java/com/biutag/lan/job/MailboxJob.java

@ -1,18 +1,31 @@
package com.biutag.lan.job;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.constants.AppConstants;
import com.biutag.enums.MailState;
import com.biutag.lan.domain.DeptMapping;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailApproval;
import com.biutag.lan.domain.MailFlow;
import com.biutag.lan.domain.vo.MailDomain;
import com.biutag.lan.mapper.DeptMappingMapper;
import com.biutag.lan.service.MailApprovalService;
import com.biutag.lan.service.MailFlowService;
import com.biutag.lan.service.MailService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
/**
@ -27,6 +40,17 @@ public class MailboxJob {
private final MailService mailService;
private final MailFlowService mailFlowService;
private final MailApprovalService mailApprovalService;
private final DeptMappingMapper deptMappingMapper;
private final String key = "mailbox";
@Value("mailbox.url:''")
private String mailboxUrl;
/**
* 每30分钟执行一次
*/
@ -35,10 +59,92 @@ public class MailboxJob {
List<Mail> mails = mailService.list(new LambdaQueryWrapper<Mail>()
.eq(Mail::getFirstDeptId, AppConstants.CHANGSHA_DEPT_ID)
.in(Mail::getMailState, List.of(MailState.processing.getValue(), MailState.delayed.getValue())));
List<String> mailIds = mails.stream().map(Mail::getId).toList();
HttpResponse httpResponse = HttpUtil.createGet("")
.execute();
long timestamp = new Date().getTime();
for (Mail mail : mails) {
HttpResponse httpResponse = HttpUtil.createGet(mailboxUrl + "/v1/mail/detail?mailId=" + mail.getId())
.header("timestamp", String.valueOf(timestamp))
.auth(MD5.create().digestHex(key + timestamp))
.execute();
MailDomain mailDomain = JSON.parseObject(httpResponse.body(), MailDomain.class);
LambdaUpdateWrapper<Mail> updateWrapper = new LambdaUpdateWrapper<>();
Mail source = mailDomain.getMail();
updateWrapper.eq(Mail::getId, mail.getId())
.set(Mail::getUpdateTime, source.getUpdateTime())
.set(Mail::getSatisfactionSms, source.getSatisfactionSms())
.set(Mail::getMailState, source.getMailState())
.set(Mail::getFlowKey, source.getFlowKey())
.set(Mail::getFlowName, source.getFlowName())
.set(Mail::getFlowLimitedLastHandlerTime, source.getFlowLimitedLastHandlerTime())
.set(Mail::getMailCategory, source.getMailCategory())
.set(Mail::getMailFirstCategory, source.getMailFirstCategory())
.set(Mail::getMailSecondCategory, source.getMailSecondCategory())
.set(Mail::getMailThreeCategory, source.getMailThreeCategory())
.set(Mail::getMailLevel, source.getMailLevel())
.set(Mail::getContactPoliceName, source.getContactPoliceName())
.set(Mail::getContactPoliceEmpNo, source.getContactPoliceEmpNo())
.set(Mail::getContactTime, source.getContactTime())
.set(Mail::getContactDuration, source.getContactDuration())
.set(Mail::getContactFlag, source.getContactFlag())
.set(Mail::getInterviewType, source.getInterviewType())
.set(Mail::getInterviewIsLeader, source.getInterviewIsLeader())
.set(Mail::getInterviewPoliceEmpNo, source.getInterviewPoliceEmpNo())
.set(Mail::getInterviewPoliceName, source.getInterviewPoliceName())
.set(Mail::getInterviewDetails, source.getInterviewDetails())
.set(Mail::getInterviewAttachments, source.getInterviewAttachments())
.set(Mail::getVerifyDetails, source.getVerifyDetails())
.set(Mail::getVerifyIsTrue, source.getVerifyIsTrue())
.set(Mail::getVerifyNeedAccountability, source.getVerifyNeedAccountability())
.set(Mail::getVerifyIsResolved, source.getVerifyIsResolved())
.set(Mail::getVerifyFeedback, source.getVerifyFeedback())
.set(Mail::getVerifyFollowupPolice, source.getVerifyFollowupPolice())
.set(Mail::getVerifyAttachments, source.getVerifyAttachments())
.set(Mail::getCompleteMethod, source.getCompleteMethod())
.set(Mail::getQualifiedProcessingStatus, source.getQualifiedProcessingStatus())
.set(Mail::getProblemSolvingStatus, source.getProblemSolvingStatus())
.set(Mail::getSatisfactionStatus, source.getSatisfactionStatus())
.set(Mail::getCompletionComment, source.getCompletionComment())
.set(Mail::getSimpleFlowFlag, source.getSimpleFlowFlag())
.set(Mail::getCurrentOperator, source.getCurrentOperator())
.set(Mail::getExtensionFlag, source.getExtensionFlag())
.set(Mail::getExtensionDays, source.getExtensionDays())
.set(Mail::getExtensionReason, source.getExtensionReason())
.set(Mail::getExtensionState, source.getExtensionState())
.set(Mail::getMainDeptLevel, source.getMainDeptLevel())
.set(Mail::getNotSatisfiedReason, source.getNotSatisfiedReason());
if (StrUtil.isNotBlank(source.getSecondDeptId())) {
List<DeptMapping> deptMappings = deptMappingMapper.selectList(new LambdaQueryWrapper<DeptMapping>().eq(DeptMapping::getExternalId, source.getSecondDeptId()));
if (!deptMappings.isEmpty()) {
updateWrapper.set(Mail::getSecondDeptId, deptMappings.get(0).getInternalId())
.set(Mail::getSecondDeptName, deptMappings.get(0).getInternalName());
}
}
if (StrUtil.isNotBlank(source.getThreeDeptId())) {
List<DeptMapping> deptMappings = deptMappingMapper.selectList(new LambdaQueryWrapper<DeptMapping>().eq(DeptMapping::getExternalId, source.getThreeDeptId()));
if (!deptMappings.isEmpty()) {
updateWrapper.set(Mail::getThreeDeptId, deptMappings.get(0).getInternalId())
.set(Mail::getThreeDeptName, deptMappings.get(0).getInternalName());
}
}
mailService.update(updateWrapper);
if (!mailDomain.getFlows().isEmpty()) {
for (MailFlow flow : mailDomain.getFlows()) {
if (mailFlowService.exists(new LambdaQueryWrapper<MailFlow>().eq(MailFlow::getMailId, mail.getId()).eq(MailFlow::getCreateTime, flow.getCreateTime()))) {
continue;
}
flow.setId(null);
mailFlowService.save(flow);
}
}
if (!mailDomain.getApprovals().isEmpty()) {
for (MailApproval approval : mailDomain.getApprovals()) {
if (mailApprovalService.exists(new LambdaQueryWrapper<MailApproval>().eq(MailApproval::getMailId, mail.getId()).eq(MailApproval::getCreateTime, approval.getCreateTime()))) {
continue;
}
approval.setId(null);
mailApprovalService.save(approval);
}
}
}
}
}

11
mailbox-lan/src/main/java/com/biutag/lan/mapper/DeptMappingMapper.java

@ -0,0 +1,11 @@
package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.domain.DeptMapping;
/**
* @author wxc
* @date 2025/7/31
*/
public interface DeptMappingMapper extends BaseMapper<DeptMapping> {
}

2
mailbox-lan/src/main/resources/application-dev.yml

@ -44,4 +44,4 @@ ai:
url:
# 局长信箱
mailbox:
url: http://65.145/lan-api/
url: http://65.47.60.145/lan-api/

3
mailbox-lan/src/main/resources/application-prod.yml

@ -48,3 +48,6 @@ police-wechat:
ai:
url:
# 局长信箱
mailbox:
url: http://65.47.60.145/lan-api/

0
mailbox-lan/src/main/resources/mapper/WorkMapper.xml → mailbox-lan/src/main/resources/mapper/DeptMappingMapper.xml

Loading…
Cancel
Save