From ed65d6bda908f4254926ca72997a224fdb61fa5a Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 7 Nov 2024 10:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E12345=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=9D=9E=E9=AB=98=E6=95=8F=E4=BF=A1=E4=BB=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/biutag/outer/domain/Mail12345Log.java | 40 ++ .../com/biutag/outer/domain/MailReceive.java | 408 ++++++++++++++++++ .../com/biutag/outer/domain/MailSend.java | 20 + .../biutag/outer/domain/MailSendParam.java | 128 ++++++ .../main/java/com/biutag/outer/job/Job.java | 80 +++- .../outer/mapper/Mail12345LogMapper.java | 9 + 6 files changed, 680 insertions(+), 5 deletions(-) create mode 100644 mailbox-outer/src/main/java/com/biutag/outer/domain/Mail12345Log.java create mode 100644 mailbox-outer/src/main/java/com/biutag/outer/domain/MailReceive.java create mode 100644 mailbox-outer/src/main/java/com/biutag/outer/domain/MailSend.java create mode 100644 mailbox-outer/src/main/java/com/biutag/outer/domain/MailSendParam.java create mode 100644 mailbox-outer/src/main/java/com/biutag/outer/mapper/Mail12345LogMapper.java diff --git a/mailbox-outer/src/main/java/com/biutag/outer/domain/Mail12345Log.java b/mailbox-outer/src/main/java/com/biutag/outer/domain/Mail12345Log.java new file mode 100644 index 0000000..00768ac --- /dev/null +++ b/mailbox-outer/src/main/java/com/biutag/outer/domain/Mail12345Log.java @@ -0,0 +1,40 @@ +package com.biutag.outer.domain; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.time.LocalDateTime; + +@TableName("mail_12345_log") +@AllArgsConstructor +@Data +public class Mail12345Log { + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 状态:0-失败,1-成功 + */ + private Integer status; + + /** + * 上传数量 + */ + private Integer num; + + /** + * 详情 + */ + private String details; + + /** + * 创建时间 + */ + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; +} diff --git a/mailbox-outer/src/main/java/com/biutag/outer/domain/MailReceive.java b/mailbox-outer/src/main/java/com/biutag/outer/domain/MailReceive.java new file mode 100644 index 0000000..f8f398d --- /dev/null +++ b/mailbox-outer/src/main/java/com/biutag/outer/domain/MailReceive.java @@ -0,0 +1,408 @@ +package com.biutag.outer.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +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 MailReceive { + + @TableId + private String id; + + /** + * 联系人姓名 + */ + private String contactName; + /** + * 联系人性别 M / F + */ + private String contactSex; + /** + * 联系人身份证号码 + */ + private String contactIdCard; + /** + * 联系人手机号 + */ + private String contactPhone; + /** + * 案件编号 + */ + private String caseNumber; + /** + * 内容 + */ + private String content; + /** + * 附件 + */ + private String attachments; + /** + * 创建时间 + */ + private LocalDateTime createTime; + /** + * 更新时间 + */ + private LocalDateTime updateTime; + /** + * 来信时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime mailTime; + + /** + * 来源 + */ + private String source; + + /** + * 满意读(网络) + */ + private String satisfaction; + + /** + * 满意读(短信) + */ + private String satisfactionSms; + + /*-------------------------------*/ + + /** + * 信件状态 + */ + private String mailState; + /** + * 信件当前流程 + */ + private String flowKey; + /** + * 信件当前流程节点 + */ + private String flowBeforeName; + + private String flowName; + + /** + * 流程限时最后操作时间 + */ + private LocalDateTime flowLimitedLastHandlerTime; + + /** + * 信件源数据ID (多个) + */ + private String mailSourceId; + + /** + * 信件类名 + */ + private String mailCategory; + /** + * 信件一级类目 + */ + private String mailFirstCategory; + /** + * 信件二级类目 + */ + private String mailSecondCategory; + /** + * 信件三级类目 + */ + private String mailThreeCategory; + /** + * 信件等级 + */ + private String mailLevel; + + /** + * 二级单位ID(主责) + */ + private Integer secondDeptId; + + private String secondDeptName; + + /** + * 三级单位ID(主责) + */ + private Integer threeDeptId; + + private String threeDeptName; + + /** + * 协办核查民警(String) + */ + private String coHandlingPolices; + /** + * 联系民警名称 + */ + private String contactPoliceName; + /** + * 联系民警 + */ + private String contactPoliceEmpNo; + + /** + * 联系民警职位 + */ + private String contactPolicePost; + + /** + * 联系群众时间 + */ + private LocalDateTime contactTime; + + /** + * 联系时长(秒) + */ + private Long contactDuration; + + /** + * 是否联系群众 + */ + private Boolean contactFlag; + + /** + * 接访形式 + */ + private String interviewType; + /** + * 是否接访一把手 + */ + private Boolean interviewIsLeader; + /** + * 接访人员警号 + */ + private String interviewPoliceEmpNo; + /** + * 接访人员姓名 + */ + private String interviewPoliceName; + /** + * 接访情况 + */ + private String interviewDetails; + /** + * 接访附件(佐证材料) + */ + private String interviewAttachments; + /** + * 核办情况 + */ + private String verifyDetails; + /** + * 核办-是否属实 + */ + private String verifyIsTrue; + /** + * 核办-被举报对象(json) + */ + private String verifyReportedPolices; + /** + * 核办-查证属实问题(json) + */ + private String verifyProblem; + /** + * 核办-是否需要问责 + */ + private Boolean verifyNeedAccountability; + /** + * 核办-责任追究(json) + */ + private String verifyPunish; + + /** + * 核办-群众反映事项解决情况(是否已解决) + */ + private Boolean verifyIsResolved; + + /** + * 核办-办理反馈情况 + */ + private String verifyFeedback; + + /** + * 核办-回访人信息(String) + */ + private String verifyFollowupPolice; + + /** + * 核办-附件(上传佐证) + */ + private String verifyAttachments; + + /** + * 办结方式 + */ + private String completeMethod; + + /** + * 办理合格情况 + */ + private String qualifiedProcessingStatus; + + /** + * 问题解决情况 + */ + private Boolean problemSolvingStatus; + + /** + * 群众回复情况 + */ + private String satisfactionStatus; + + + /** + * 认定办结意见 + */ + private String completionComment; + + /** + * 是否是简易流程 + */ + private Boolean simpleFlowFlag; + + /** + * 涉及单位ID + */ + private Integer involvedDeptId; + + /** + * 涉及单位名称 + */ + private String involvedDeptName; + + /** + * 会签部门总数 + */ + private Integer countersignTotal; + + /** + * 会签完成部门数量 + */ + private Integer countersignCompleted; + + /** + * 会签发起人 + */ + private String countersignPromoterEmpNo; + + /** + * 会签发起姓名 + */ + private String countersignPromoterName; + + /** + * 会签发起部门ID + */ + private Integer countersignPromoterDeptId; + + /** + * 会签发起部门名称 + */ + private String countersignPromoterDeptName; + + /** + * 会签具体要求 + */ + private String countersignRequirement; + + /** + * 信件标签 + */ + private String mailLabels; + + /** + * 当前操作对象 + */ + private String currentOperator; + + /** + * 申请延期ID + */ + private String extensionRequestId; + + /** + * 是否申请延期 + */ + private Boolean extensionFlag; + + /** + * 延期天数 + */ + private Integer extensionDays; + + /** + * 延期理由 + */ + private String extensionReason; + + /** + * 延期状态 + */ + private String extensionState; + + /** + * 无效判定理由 + */ + private String invalidationReason; + + /** + * 市局下发信息 + */ + private String firstDistributeInfo; + + /** + * 二级单位下发信息 + */ + private String secondDistributeInfo; + + /** + * 主办层级 + */ + private Integer mainDeptLevel; + + /** + * 信件后续审批流程 + */ + private String returnOperate; + + /** + * 不满意原因 + */ + private String notSatisfiedReason; + + /** + * 市局专班下发时间 + */ + private LocalDateTime firstDistributeTime; + + /** + * 市局下发意见 + */ + private String firstDistributeComment; + + /** + * 市局下发意见 + */ + private String firstDistributeFiles; + + /** + * 二级机构下发意见 + */ + private String secondDistributeComment; + + private String secondDistributeFiles; + + /** + * 二级机构下发时间 + */ + private LocalDateTime secondDistributeTime; + +} diff --git a/mailbox-outer/src/main/java/com/biutag/outer/domain/MailSend.java b/mailbox-outer/src/main/java/com/biutag/outer/domain/MailSend.java new file mode 100644 index 0000000..5a5bc7b --- /dev/null +++ b/mailbox-outer/src/main/java/com/biutag/outer/domain/MailSend.java @@ -0,0 +1,20 @@ +package com.biutag.outer.domain; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.util.List; + +@Accessors(chain = true) +@Setter +@Getter +public class MailSend { + private String system = "信箱服务"; + + private String token = "e77a2b8af95df699c2df3afebca80c15"; + + private String dataType = "2"; + + private List paramterList; +} diff --git a/mailbox-outer/src/main/java/com/biutag/outer/domain/MailSendParam.java b/mailbox-outer/src/main/java/com/biutag/outer/domain/MailSendParam.java new file mode 100644 index 0000000..2b35026 --- /dev/null +++ b/mailbox-outer/src/main/java/com/biutag/outer/domain/MailSendParam.java @@ -0,0 +1,128 @@ +package com.biutag.outer.domain; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.util.List; + +@Accessors(chain = true) +@Setter +@Getter +public class MailSendParam { + private String LOCATION = null; + + private int CASESOURCE = 3; + + private String SOURCEID = "189"; + + private String SOURCENAME = "市公安局"; + + private int AREPUBLIC = 1; + + private String ATTACHLIST = null; + + // 联系人电话 + private String PHONE; + + private int SEX = 1; + + private String CRIP = null; + + private int THUMBSTATUS = 0; + + // 发布时间 + private String PUBLICTIME; + + // 提交时间 + private String SUBMITTIME; + + // 处理部门名 + private String DEALDEPTNAME; + + private String EMAIL = null; + + private int ISMAGORMSG = 1; + + private int ISDEADLINE = 0; + + private int ISANONYMOUS = 0; + + private String HTMLCONTENT = null; + + private int OTHERTAG = 0; + + private int STATUS = 7; + + private String AREA = null; + + private int ISBACK = 0; + + private List REPLYS; + + private String RECOMMENDTAG = null; + + private int ISSUPERVISEFLAG = 1; + + // 姓名或者昵称 + private String USERNAME; + + // 信件内容 + private String CONTENT; + + // 信件分类类型 + private String GOVMSGBOXTYPE1; + + private int GOVMSGBOXFLAG = 0; + + private String ATTACHS = null; + + // 证件 + private String CARDID; + + private String STREET = null; + + // 主键id + private String METADATAID; + + private String REGION = null; + + private int GOVMSGBOXTYPE = 1; + + private String CITY = null; + + private String PARENTID = null; + + // 查询编号 + private String QUERYNUMBER; + + private int ISPUBLIC = 0; + + // 处理部门 + private String DEALDEPTID; + + private String PROVINCE = null; + + private String TITLE = null; + + private String UNIONDEPTREPLYS = null; + + private String CARDTYPE = "身份证"; + + private String EXTERNALID = null; + + @Getter + @Setter + private static class Reply{ + + private String REPLYHTMLCONTENT = null; + + private String REPLYUSER = null; + + private String REPLYDEPT = null; + + private String REPLYTIME = null; + + private String REPLYID = null; + } +} diff --git a/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java b/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java index 3589aad..21ff1a9 100644 --- a/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java +++ b/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java @@ -5,10 +5,7 @@ import cn.hutool.crypto.digest.MD5; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import cn.hutool.http.Method; -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.*; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.biutag.config.Minio; @@ -17,7 +14,6 @@ import com.biutag.outer.domain.*; import com.biutag.outer.mapper.*; import com.biutag.outer.service.SmsSendService; import com.biutag.outer.util.Random; -import com.biutag.outer.util.Sms; import com.biutag.outer.util.SmsUtil; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; @@ -28,7 +24,12 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.time.Instant; import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; @@ -48,6 +49,8 @@ public class Job { private final MailMapper mailMapper; + private final Mail12345LogMapper mail12345LogMapper; + private final HolidayMapper holidayMapper; private final SmsSendService smsSendService; @@ -305,4 +308,71 @@ public class Job { log.info("推送节假日数据返回结果:{}", httpResponse.body()); } + /** + * 推送12345信箱服务 30 s + */ + @Scheduled(cron = "0 0 2 * * *") + public void push12345() { + log.info("推送12345信箱服务-----------------------------"); + try { + log.info("获取12345信箱数据-----------------------------"); + String startTimeStr = LocalDateTime.now().minusDays(1).truncatedTo(ChronoUnit.DAYS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); + String endTimeStr = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); + long timestamp = new Date().getTime(); + HttpResponse httpResponse1 = HttpUtil.createRequest(Method.GET, mailboxUrl + "mail/12345") + .header("timestamp", String.valueOf(timestamp)) + .auth(MD5.create().digestHex(key + timestamp)) + .form("startTime", startTimeStr) + .form("endTime", endTimeStr) + .execute(); + if (!httpResponse1.isOk()) { + throw new RuntimeException(String.format("httpCode: %s", httpResponse1.getStatus())); + } + log.info("返回结果:{}", httpResponse1.body()); + String responseBody = httpResponse1.body(); + JSONObject jsonObject = JSON.parseObject(responseBody); + JSONArray dataArray = jsonObject.getJSONArray("data"); + List mailReceiveList = JSON.parseObject(dataArray.toJSONString(), new TypeReference>() {}); + if (mailReceiveList == null || mailReceiveList.isEmpty()) { + mail12345LogMapper.insert(new Mail12345Log(null, 0, 0, "无新数据", LocalDateTime.now())); + return; + } + List paramterList = new ArrayList<>(); + for (MailReceive mailReceive : mailReceiveList) { + MailSendParam mailSendParam = new MailSendParam(); + Instant instant = mailReceive.getMailTime().atZone(ZoneId.systemDefault()).toInstant(); + String mailTime = String.valueOf(instant.toEpochMilli()); + String DEALDEPTID = mailReceive.getThreeDeptId() == null ? null : String.valueOf(mailReceive.getThreeDeptId()); + mailSendParam.setPHONE(mailReceive.getContactPhone()) + .setPUBLICTIME(mailTime) + .setSUBMITTIME(mailTime) + .setDEALDEPTNAME(mailReceive.getThreeDeptName()) + .setUSERNAME(mailReceive.getContactName()) + .setCONTENT(mailReceive.getContent()) + .setGOVMSGBOXTYPE1(mailReceive.getMailCategory()) + .setCARDID(mailReceive.getContactIdCard()) + .setMETADATAID(mailReceive.getId()) + .setQUERYNUMBER(mailReceive.getId()) + .setDEALDEPTID(DEALDEPTID); + paramterList.add(mailSendParam); + } + MailSend mailSend = new MailSend(); + mailSend.setParamterList(paramterList); + log.info("推送12345信箱数据-----------------------------"); + String jsonString = JSON.toJSONString(mailSend, JSONWriter.Feature.WriteNulls); + HttpResponse httpResponse2 = HttpUtil.createRequest(Method.POST, "http://172.31.2.10:8014/cs12345/data/dataUp") + .body(jsonString) + .execute(); + log.info("推送12345信箱数据返回结果:{}", httpResponse2.body()); + JSONObject jsonObject2 = JSON.parseObject(httpResponse2.body()); + if (jsonObject2.getInteger("result") == 1) { + mail12345LogMapper.insert(new Mail12345Log(null, 1, mailReceiveList.size(), "推送成功", LocalDateTime.now())); + } else { + mail12345LogMapper.insert(new Mail12345Log(null, 0, 0, "推送失败", LocalDateTime.now())); + } + } catch (RuntimeException e) { + log.error("推送12345信箱服务异常: {}", e.getMessage(), e); + mail12345LogMapper.insert(new Mail12345Log(null, 0, 0, "推送出错", LocalDateTime.now())); + } + } } diff --git a/mailbox-outer/src/main/java/com/biutag/outer/mapper/Mail12345LogMapper.java b/mailbox-outer/src/main/java/com/biutag/outer/mapper/Mail12345LogMapper.java new file mode 100644 index 0000000..981aea8 --- /dev/null +++ b/mailbox-outer/src/main/java/com/biutag/outer/mapper/Mail12345LogMapper.java @@ -0,0 +1,9 @@ +package com.biutag.outer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.outer.domain.Mail12345Log; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface Mail12345LogMapper extends BaseMapper { +}