Browse Source

1. 外网信件、信件评价、假日数据推送到内网

2. 微信配置调整
3. websocket 依赖
master
wxc 2 years ago
parent
commit
fee17cce9c
  1. 3
      flow.json
  2. 13
      mailbox-lan/pom.xml
  3. 24
      mailbox-lan/src/main/java/com/biutag/lan/config/WebSocketConfig.java
  4. 46
      mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java
  5. 6
      mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java
  6. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java
  7. 5
      mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java
  8. 3
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailExtensionApproval.java
  9. 31
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/HolidayV1Req.java
  10. 3
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailApiV1Req.java
  11. 23
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailEvaluateApiV1Req.java
  12. 20
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailExtensionApprovalVo.java
  13. 2
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailVo.java
  14. 5
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java
  15. 10
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  16. 3
      mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java
  17. 10
      mailbox-lan/src/main/java/com/biutag/lan/service/MailExtensionApprovalService.java
  18. 3
      mailbox-lan/src/main/java/com/biutag/lan/service/MailReturnService.java
  19. 26
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  20. 18
      mailbox-lan/src/main/java/com/biutag/lan/ws/WsController.java
  21. 0
      mailbox-lan/src/main/resources/mapper/MailEvaluateEtlMapper.xml
  22. 12
      mailbox-outer/src/main/java/com/biutag/outer/controller/SmsController.java
  23. 10
      mailbox-outer/src/main/java/com/biutag/outer/domain/Mail.java
  24. 27
      mailbox-outer/src/main/java/com/biutag/outer/domain/MailEvaluateEtl.java
  25. 145
      mailbox-outer/src/main/java/com/biutag/outer/job/Job.java
  26. 82
      mailbox-outer/src/main/java/com/biutag/outer/job/MailJob.java
  27. 13
      mailbox-outer/src/main/java/com/biutag/outer/mapper/HolidayMapper.java
  28. 10
      mailbox-outer/src/main/java/com/biutag/outer/mapper/MailEvaluateEtlMapper.java
  29. 3
      mailbox-outer/src/main/java/com/biutag/outer/mapper/MailMapper.java
  30. 8
      mailbox-outer/src/main/java/com/biutag/outer/util/Weixin.java
  31. 9
      mailbox-outer/src/main/java/com/biutag/outer/util/Weixin2.java
  32. 9
      mailbox-outer/src/main/resources/application-prod.yml
  33. 35
      mailbox-outer/src/test/java/SmsTest.java
  34. 29
      mailbox-outer/src/test/java/com/biutag/outer/Base64Test.java
  35. 9
      sql/0307.sql

3
flow.json

@ -0,0 +1,3 @@
{
"base64": "data:image/jpg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB2qADAAQAAAABAAAAMgAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/8AAEQgAMgHaAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAA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sQBwOgwKAIF/5Crf9ch/OtGs4WMwuzdee2SMbdoxj0rRoBkNxEs0DxMA2R0IyM9uDXLsbOMOY4ogXKgx+XvAIXJHBGDnPeuqliSdPLkGVPUetVLiz3pHHbhVCkk/TaR/WgaMOzkkDRoPNjYkA4SIKMjPHBPSukueLd8+lUIrKeO5ViVMfB9wQuK1HRZEKOMg8GiQluUkvLFYl/fRZCj+IelP08g2cbKchgW49zmpxbwKAoReOOgqUAKMKMCm2IpSTXi3scUcQaAqS755B7CrtVXtne6S4EzqqjBjH3T7mrVIZVvYGurWSBTgsOKxb6W5eK2haIxsJYwScckH+HB6fWuikQSIyEkbhjI61RgsPLMZmlaXyvubgOO2eOtCAWSGWS4cw3Hl/KoIUAkdcZznj8Kz0e5uRBfhd7ws8bqOM84yM/StF7JvOee3kMTSY34AOcdOtMbTlEEcMMjRmJtwYc5POc565zQhlCOVpNTnkmXYiwjcp6456+9QN9ritEMvz2bEEj+NVzxz0I/WtyK0SNX8w72l++x79qhNg7L5LzM0XTZgdPTPWmFzRGMcUUUUiT//R7GiiiszMKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/0uxooorMzCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k="
}

13
mailbox-lan/pom.xml

@ -39,6 +39,19 @@
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>2.2.0-M1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
<version>2.2.0-M1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.tongweb.springboot</groupId>
<artifactId>tongweb-spring-boot-starter-3.x</artifactId>

24
mailbox-lan/src/main/java/com/biutag/lan/config/WebSocketConfig.java

@ -0,0 +1,24 @@
package com.biutag.lan.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
@EnableWebSocketMessageBroker
@Configuration
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/app");
registry.enableSimpleBroker("/topic","/queue");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/port").setAllowedOriginPatterns("*").withSockJS();
}
}

46
mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java

@ -2,22 +2,28 @@ package com.biutag.lan.controller;
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.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biutag.config.Minio;
import com.biutag.core.AjaxResult;
import com.biutag.entity.system.Holiday;
import com.biutag.exception.AuthException;
import com.biutag.exception.BusinessException;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailSource;
import com.biutag.lan.domain.bo.HolidayV1Req;
import com.biutag.lan.domain.bo.MailApiV1Req;
import com.biutag.lan.domain.bo.MailEvaluateApiV1Req;
import com.biutag.lan.service.HolidayService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.MailSourceService;
import com.biutag.util.IOUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.simpleframework.xml.core.Validate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
@ -32,10 +38,17 @@ public class ApiV1Controller {
private final MailSourceService mailSourceService;
private final MailService mailService;
private final HolidayService holidayService;
private final Minio minio;
private final String key = "mailbox";
@Value("${spring.profiles.active}")
private String active;
@PostMapping("mail")
public AjaxResult<Void> addMail(@RequestBody @Valid MailApiV1Req mail, HttpServletRequest request) {
validAuth(request);
@ -45,7 +58,10 @@ public class ApiV1Controller {
if (StrUtil.isNotBlank(mail.getAttachments())) {
List<JSONObject> attachments = JSON.parseArray(mail.getAttachments()).toList(JSONObject.class);
for (JSONObject attachment : attachments) {
//minio.upload(IOUtil.base64ToStream(attachment.getString("base64")), attachment.getString("filepath"), true);
if (active.equals("dev")) {
continue;
}
minio.upload(IOUtil.base64ToStream(attachment.getString("base64")), attachment.getString("filepath"), true);
attachment.remove("base64");
}
mail.setAttachments(JSON.toJSONString(attachments));
@ -54,6 +70,30 @@ public class ApiV1Controller {
return AjaxResult.success();
}
@PutMapping("mail/evaluate")
public AjaxResult<Void> updateMail(@RequestBody @Valid MailEvaluateApiV1Req req, HttpServletRequest request) {
validAuth(request);
Mail mail = mailService.getById(req.getId());
if (Objects.isNull(mail)) {
throw new BusinessException("信件不存在或信件还未签收");
}
mail.setSatisfaction(mail.getSatisfaction());
mailService.updateById(mail);
return AjaxResult.success();
}
@PostMapping("holiday")
public AjaxResult<Void> addHoliday(@RequestBody @Valid List<HolidayV1Req> holidays, HttpServletRequest request) {
validAuth(request);
for (HolidayV1Req holiday : holidays) {
if (holidayService.exists(new LambdaQueryWrapper<Holiday>().eq(Holiday::getDate, holiday.getDate()))) {
continue;
}
holidayService.save(holiday.toEntity());
}
return AjaxResult.success();
}
private void validAuth(HttpServletRequest request) {
String authorization = request.getHeader("Authorization");
String timestamp = request.getHeader("timestamp");

6
mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java

@ -39,7 +39,11 @@ public class FileController {
@PostMapping("upload/base64")
public AjaxResult<JSONObject> upload(@RequestBody JSONObject file) {
log.info("文件上传 base64: {}", file.toJSONString());
String filepath = minio.upload(file.getString("base64"));
String base64 = file.getString("base64");
if (base64.startsWith("data:image")) {
base64 = base64.substring(base64.indexOf(",") + 1);
}
String filepath = minio.upload(base64);
return AjaxResult.success(JSONObject.of("filepath", filepath));
}

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

@ -100,7 +100,7 @@ public class HomeController {
// 今日办结
long completedToday = mailMarkService.countByCompleted(today);
// 累计来信
long mailTotal = mailSourceService.count();
long mailTotal = mailMarkService.count();
// 累计办结
long completedTotal = mailMarkService.countByCompleted();
// 累计办结

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

@ -315,6 +315,11 @@ public class Mail {
*/
private String currentOperator;
/**
* 申请延期ID
*/
private String extensionRequestId;
/**
* 是否申请延期
*/

3
mailbox-lan/src/main/java/com/biutag/lan/domain/MailExtensionApproval.java

@ -15,6 +15,9 @@ public class MailExtensionApproval {
@TableId(type = IdType.AUTO)
private Integer id;
private String requestId;
/**
*
*/

31
mailbox-lan/src/main/java/com/biutag/lan/domain/bo/HolidayV1Req.java

@ -0,0 +1,31 @@
package com.biutag.lan.domain.bo;
import com.biutag.entity.system.Holiday;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;
@Setter
@Getter
public class HolidayV1Req {
@NotBlank
private String date;
@NotBlank
private String holidayFlag;
@NotNull
private String detail;
@NotNull
private Integer year;
public Holiday toEntity() {
Holiday holiday = new Holiday();
BeanUtils.copyProperties(this, holiday);
return holiday;
}
}

3
mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailApiV1Req.java

@ -3,6 +3,7 @@ package com.biutag.lan.domain.bo;
import com.biutag.lan.domain.MailSource;
import com.biutag.validator.annotation.IdCard;
import com.biutag.validator.annotation.Phone;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
@ -67,7 +68,7 @@ public class MailApiV1Req {
* 创建时间
*/
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**

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

@ -0,0 +1,23 @@
package com.biutag.lan.domain.bo;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class MailEvaluateApiV1Req {
/**
*
*/
@NotBlank
private String id;
/**
* 满意读
*/
@NotBlank
private String satisfaction;
}

20
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/MailExtensionApprovalVo.java

@ -0,0 +1,20 @@
package com.biutag.lan.domain.vo;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@Setter
@Getter
public class MailExtensionApprovalVo {
private String name;
private Boolean active;
private Boolean returnFlag;
private String comment;
}

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

@ -358,7 +358,7 @@ public class MailVo {
*/
private List<MailCountersign> countersigns = new ArrayList<>();
private List<MailExtensionApproval> extensionApprovals = new ArrayList<>();
private List<MailExtensionApprovalVo> extensionApprovals = new ArrayList<>();
public static MailVo of(Mail mail) {
MailVo mailVo = new MailVo();

5
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java

@ -81,6 +81,9 @@ public class FirstApprovalFlow extends Flow {
mailService.updateById(mail);
// 认定办结
MailMark mailMark = mailMarkService.getById(mailId);
if (Objects.isNull(mailMark)) {
mailMark = new MailMark().setMailId(mailId);
}
mailMark.setSecondDeptId(mail.getSecondDeptId())
.setSecondDeptName(mail.getSecondDeptName())
.setThreeDeptId(mail.getThreeDeptId())
@ -89,7 +92,7 @@ public class FirstApprovalFlow extends Flow {
.setCompletionTime(now)
.setResolved(problemSolvingStatus ? AppConstants.TRUE : AppConstants.FALSE)
.setSatisfied("非常满意".equals(satisfactionStatus) || "基本满意".equals(satisfactionStatus) ? AppConstants.TRUE : AppConstants.FALSE);
mailMarkService.updateById(mailMark);
mailMarkService.saveOrUpdate(mailMark);
}
public Flow mailReturn(String mailId, JSONObject data) {

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

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.entity.system.PoliceUser;
@ -57,6 +58,7 @@ public class ThreeVerifyFlow extends Flow {
}
throw new BusinessException();
}
public Flow applyExtensionSubmit(String mailId, JSONObject data) {
Integer extensionDays = data.getInteger("extensionDays");
Assert.notNull(extensionDays, "延期时长不能为空");
@ -65,6 +67,9 @@ public class ThreeVerifyFlow extends Flow {
Mail mail = mailService.getById(mailId);
LocalDateTime now = LocalDateTime.now();
Work myWork = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId());
myWork.setFlowName("申请延期中");
workService.updateById(myWork);
// 给二级机构增加待办
Work work = workService.getOne(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId());
work.setWorkState(Work.State.todo.name()).setWorkType(WorkType.extension_approval.name()).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName()).setUpdateTime(now);
@ -73,7 +78,8 @@ public class ThreeVerifyFlow extends Flow {
mail.setUpdateTime(now)
.setExtensionDays(extensionDays)
.setExtensionReason(reason)
.setExtensionState(ExtensionState.applying.name());
.setExtensionState(ExtensionState.applying.name())
.setExtensionRequestId(IdUtil.nanoId(16));
mailService.updateById(mail);
return null;
}
@ -84,7 +90,7 @@ public class ThreeVerifyFlow extends Flow {
String verifyFollowupPolice = JSONObject
.of("name", verifyFollowupPoliceObj.getString("name"),
"empNo", verifyFollowupPoliceObj.getString("empNo"),
"phone", verifyFollowupPoliceObj.getString("phone")).toJSONString();
"mobile", verifyFollowupPoliceObj.getString("mobile")).toJSONString();
JSONObject contactPolice = data.getJSONObject("contactPolice");
Mail mail = mailService.getById(mailId);
Mail source = new Mail()

3
mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java

@ -18,9 +18,6 @@ import java.util.Map;
public interface DataScreenMapper extends BaseMapper<Mail> {
List<Map<String,Object>> mapData(String deptId);
List<Map<String,Object>> mapCountyData(String deptId);

10
mailbox-lan/src/main/java/com/biutag/lan/service/MailExtensionApprovalService.java

@ -14,11 +14,11 @@ import java.util.List;
@Service
public class MailExtensionApprovalService extends ServiceImpl<MailExtensionApprovalMapper, MailExtensionApproval> {
public List<MailExtensionApproval> list(String mailId) {
return list(new LambdaQueryWrapper<MailExtensionApproval>().eq(MailExtensionApproval::getMailId, mailId));
public List<MailExtensionApproval> list(String mailId, String requestId) {
return list(new LambdaQueryWrapper<MailExtensionApproval>().eq(MailExtensionApproval::getMailId, mailId).eq(MailExtensionApproval::getRequestId, requestId));
}
public boolean save(String mailId, String comment, Boolean returnFlag) {
public boolean save(String mailId, String comment, Boolean returnFlag, String requestId) {
LocalDateTime now = LocalDateTime.now();
MailExtensionApproval mailExtensionApproval = new MailExtensionApproval()
.setMailId(mailId)
@ -28,11 +28,13 @@ public class MailExtensionApprovalService extends ServiceImpl<MailExtensionAppro
.setRoleId(AdminThreadLocal.getRoleId())
.setHandlerEmpNo(AdminThreadLocal.getEmpNo())
.setHandlerDeptId(AdminThreadLocal.getDeptId())
.setHandlerDeptName(AdminThreadLocal.getDeptName());
.setHandlerDeptName(AdminThreadLocal.getDeptName())
.setRequestId(requestId);
return save(mailExtensionApproval);
}
public boolean remove(String mailId) {
return remove(new LambdaQueryWrapper<MailExtensionApproval>().eq(MailExtensionApproval::getMailId, mailId));
}
}

3
mailbox-lan/src/main/java/com/biutag/lan/service/MailReturnService.java

@ -12,7 +12,8 @@ import java.util.List;
public class MailReturnService extends ServiceImpl<MailReturnMapper, MailReturn> {
public List<MailReturn> list(String mailId) {
LambdaQueryWrapper<MailReturn> queryWrapper = new LambdaQueryWrapper<MailReturn>().eq(MailReturn::getMailId, mailId).orderByDesc(MailReturn::getCreateTime);
LambdaQueryWrapper<MailReturn> queryWrapper = new LambdaQueryWrapper<MailReturn>().eq(MailReturn::getMailId, mailId)
.orderByDesc(MailReturn::getCreateTime);
return list(queryWrapper);
}
}

26
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -1,6 +1,5 @@
package com.biutag.lan.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
@ -8,9 +7,7 @@ import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.constants.AppConstants;
import com.biutag.entity.system.Dept;
import com.biutag.entity.system.Holiday;
import com.biutag.enums.RoleEnum;
import com.biutag.exception.BusinessException;
import com.biutag.lan.config.AdminThreadLocal;
@ -19,6 +16,7 @@ import com.biutag.lan.domain.bo.FlowAction;
import com.biutag.lan.domain.bo.InvalidCompletion;
import com.biutag.lan.domain.bo.MailOuter;
import com.biutag.lan.domain.vo.MailApprovalVo;
import com.biutag.lan.domain.vo.MailExtensionApprovalVo;
import com.biutag.lan.domain.vo.MailFlowDetail;
import com.biutag.lan.domain.vo.MailVo;
import com.biutag.lan.enums.CompleteMethod;
@ -36,7 +34,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
@ -156,7 +153,18 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
}
// 申请延期
if (StrUtil.isNotBlank(mail.getExtensionState())) {
mailVo.setExtensionApprovals(mailExtensionApprovalService.list(mailId));
List<MailExtensionApproval> approvals = mailExtensionApprovalService.list(mailId, mail.getExtensionRequestId());
List<MailExtensionApprovalVo> vos = Arrays.asList(RoleEnum.SECOND_DEPT_CLASSES, RoleEnum.MUNICIPAL_DEPT_CLASSES).stream().map(item -> {
MailExtensionApprovalVo vo = new MailExtensionApprovalVo().setName(item.getName() + "审批");
MailExtensionApproval approval = approvals.stream().filter(approvalItem -> item.getRoleId().equals(approvalItem.getRoleId())).findFirst().orElse(null);
if (Objects.nonNull(approval)) {
vo.setReturnFlag(approval.getReturnFlag()).setActive(true).setComment(approval.getComment());
} else {
vo.setReturnFlag(false).setActive(false);
}
return vo;
}).collect(Collectors.toList());
mailVo.setExtensionApprovals(vos);
}
if (Objects.nonNull(mail.getFlowKey()) && FlowNodeEnum.get(mail.getFlowKey()).getIndex() >= FlowNodeEnum.THREE_LEADER_APPROVAL.getIndex()) {
// 主单位签收时长
@ -295,14 +303,17 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
Boolean returnFlag = data.getBoolean("returnFlag");
Assert.notNull(returnFlag, "参数错误");
String comment = data.getString("comment");
Mail mail = getById(mailId);
if (returnFlag) {
Assert.hasText(comment, "延期审批驳回理由不能为空");
Mail mail = getById(mailId);
// 驳回
mail.setExtensionState(ExtensionState.reject.name());
updateById(mail);
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mail.getThreeDeptId());
work.setFlowName("申请延期驳回");
workService.updateById(work);
}
mailExtensionApprovalService.save(mailId, comment, returnFlag);
mailExtensionApprovalService.save(mailId, comment, returnFlag, mail.getExtensionRequestId());
Integer roleId = AdminThreadLocal.getRoleId();
LocalDateTime now = LocalDateTime.now();
// 二级机构
@ -322,7 +333,6 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
work.setUpdateTime(now).setWorkState(Work.State.done.name()).setWorkType(WorkType.processing.name()).setFlowName(FlowNameEnum.PENDING_APPROVAL.getName());
workService.updateById(work);
if (!returnFlag) {
Mail mail = getById(mailId);
mail.setExtensionState(ExtensionState.completion.name()).setExtensionFlag(true)
// 信件状态(已延期)
.setMailState(MailState.delayed.name());

18
mailbox-lan/src/main/java/com/biutag/lan/ws/WsController.java

@ -0,0 +1,18 @@
package com.biutag.lan.ws;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.core.AjaxResult;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
@Controller
public class WsController {
@MessageMapping("/hello")
@SendTo("/topic/greetings")
public AjaxResult<Void> greeting(JSONObject message) throws Exception {
return AjaxResult.success();
}
}

0
mailbox-lan/src/main/resources/mapper/PoliceUserMapper.xml → mailbox-lan/src/main/resources/mapper/MailEvaluateEtlMapper.xml

12
mailbox-outer/src/main/java/com/biutag/outer/controller/SmsController.java

@ -6,6 +6,7 @@ import com.biutag.outer.util.CodeUtil;
import com.biutag.outer.util.Sms;
import com.biutag.outer.util.SmsSend;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -18,13 +19,20 @@ import java.util.Random;
@RestController
public class SmsController {
@Value("${spring.profiles.active}")
private String active;
private static final Random random = new Random();
@PostMapping("send")
public AjaxResult<JSONObject> sendCode(@RequestParam String phone) {
String code = String.valueOf(1000 + random.nextInt(9000));
// 发送短信
// Sms.send(phone, code);
if (active.equals("prod")) {
SmsSend.sendSms(phone,code);
} else {
}
// 设置缓存
return AjaxResult.success(JSONObject.of("requestId", CodeUtil.set(code)));
}

10
mailbox-outer/src/main/java/com/biutag/outer/domain/Mail.java

@ -61,11 +61,6 @@ public class Mail {
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 满意读
*/
private String satisfaction;
/**
* 涉及单位ID
*/
@ -76,4 +71,9 @@ public class Mail {
*/
private String involvedDeptName;
/**
* 满意读
*/
private String satisfaction;
}

27
mailbox-outer/src/main/java/com/biutag/outer/domain/MailEvaluateEtl.java

@ -0,0 +1,27 @@
package com.biutag.outer.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Accessors(chain = true)
@Setter
@Getter
public class MailEvaluateEtl {
@TableId(type = IdType.AUTO)
private Integer id;
private String mailId;
private Boolean success;
private LocalDateTime createTime;
private String errMsg;
}

145
mailbox-outer/src/main/java/com/biutag/outer/job/Job.java

@ -0,0 +1,145 @@
package com.biutag.outer.job;
import cn.hutool.core.util.StrUtil;
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.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biutag.config.Minio;
import com.biutag.entity.system.Holiday;
import com.biutag.outer.domain.Mail;
import com.biutag.outer.domain.MailEtl;
import com.biutag.outer.domain.MailEvaluateEtl;
import com.biutag.outer.mapper.HolidayMapper;
import com.biutag.outer.mapper.MailEtlMapper;
import com.biutag.outer.mapper.MailEvaluateEtlMapper;
import com.biutag.outer.mapper.MailMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Slf4j
@RequiredArgsConstructor
@Component
public class Job {
private final MailEtlMapper mailEtlMapper;
private final MailEvaluateEtlMapper mailEvaluateEtlMapper;
private final MailMapper mailMapper;
private final HolidayMapper holidayMapper;
private final Minio minio;
@Value("${mailbox.url}")
private String mailboxUrl;
private final String key = "mailbox";
// 30s
@Scheduled(fixedRate = 30000)
public void pushMailData() {
System.out.println(LocalDateTime.now());
List<Mail> mails = mailMapper.listByMailEtl();
for (Mail mail : mails) {
try {
if (StrUtil.isNotBlank(mail.getAttachments())) {
List<JSONObject> attachments = JSON.parseArray(mail.getAttachments()).toList(JSONObject.class);
for (JSONObject attachment : attachments) {
attachment.put("base64", minio.getBase64(attachment.getString("filepath")));
}
mail.setAttachments(JSON.toJSONString(attachments));
}
long timestamp = new Date().getTime();
HttpResponse httpResponse = HttpUtil.createPost(mailboxUrl + "mail")
.header("timestamp", String.valueOf(timestamp))
.auth(MD5.create().digestHex(key + timestamp))
.body(JSON.toJSONString(mail))
.execute();
if (!httpResponse.isOk()) {
throw new RuntimeException(String.format("httpCode: %s", httpResponse.getStatus()));
}
log.info("推送信件内容返回结果:{}", httpResponse.body());
JSONObject response = JSONObject.parseObject(httpResponse.body());
if (response.getInteger("code") != 200) {
throw new RuntimeException(response.getString("msg"));
}
MailEtl mailEtl = new MailEtl().setMailId(mail.getId()).setSuccess(true).setCreateTime(LocalDateTime.now());
mailEtlMapper.insert(mailEtl);
} catch (RuntimeException e) {
log.error("推送信件[{}]异常: {}", mail.getId(), e.getMessage(), e);
MailEtl mailEtl = new MailEtl().setMailId(mail.getId()).setSuccess(false).setCreateTime(LocalDateTime.now()).setErrMsg(e.getMessage());
mailEtlMapper.insert(mailEtl);
}
}
}
/**
* 推送信件评价 10分钟
*/
@Scheduled(fixedRate = 600000)
public void pushMailEvaluate() {
System.out.println(LocalDateTime.now());
List<Mail> mails = mailMapper.listByMailEvaluateEtl();
for (Mail mail : mails) {
try {
long timestamp = new Date().getTime();
HttpResponse httpResponse = HttpUtil.createRequest(Method.PUT, mailboxUrl + "mail/evaluate")
.header("timestamp", String.valueOf(timestamp))
.auth(MD5.create().digestHex(key + timestamp))
.body(JSONObject.of("id", mail.getId(), "satisfaction", mail.getSatisfaction()).toJSONString())
.execute();
if (!httpResponse.isOk()) {
throw new RuntimeException(String.format("httpCode: %s", httpResponse.getStatus()));
}
log.info("推送信件评价返回结果:{}", httpResponse.body());
JSONObject response = JSONObject.parseObject(httpResponse.body());
if (response.getInteger("code") != 200) {
throw new RuntimeException(response.getString("msg"));
}
MailEvaluateEtl mailEtl = new MailEvaluateEtl().setMailId(mail.getId()).setSuccess(true).setCreateTime(LocalDateTime.now());
mailEvaluateEtlMapper.insert(mailEtl);
} catch (RuntimeException e) {
log.error("推送信件评价[{}]异常: {}", mail.getId(), e.getMessage(), e);
MailEvaluateEtl mailEtl = new MailEvaluateEtl().setMailId(mail.getId()).setSuccess(false).setCreateTime(LocalDateTime.now()).setErrMsg(e.getMessage());
mailEvaluateEtlMapper.insert(mailEtl);
}
}
}
/**
* 每年12月1日 零点执行
*/
//@Scheduled(cron = "0 0 0 1 12 ? 2024-2099")
public void pushHoliday() {
log.info("开始推送节假日数---------------------------------------");
int year = LocalDateTime.now().getYear() + 1;
List<Holiday> holidays = holidayMapper.selectList(new LambdaQueryWrapper<Holiday>().eq(Holiday::getYear, year));
if (holidays.isEmpty()) {
return;
}
long timestamp = new Date().getTime();
HttpResponse httpResponse = HttpUtil.createPost(mailboxUrl + "holiday")
.header("timestamp", String.valueOf(timestamp))
.auth(MD5.create().digestHex(key + timestamp))
.body(JSON.toJSONString(holidays))
.execute();
if (!httpResponse.isOk()) {
log.info("推送节假日数据异常,http code:{}", httpResponse.getStatus());
return;
}
log.info("推送节假日数据返回结果:{}", httpResponse.body());
}
}

82
mailbox-outer/src/main/java/com/biutag/outer/job/MailJob.java

@ -1,82 +0,0 @@
package com.biutag.outer.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.alibaba.fastjson2.JSONObject;
import com.biutag.config.Minio;
import com.biutag.outer.domain.Mail;
import com.biutag.outer.domain.MailEtl;
import com.biutag.outer.mapper.MailEtlMapper;
import com.biutag.outer.mapper.MailMapper;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Slf4j
@RequiredArgsConstructor
@Component
public class MailJob {
private final MailEtlMapper mailEtlMapper;
private final MailMapper mailMapper;
private final Minio minio;
@Value("${mailbox.url}")
private String mailboxUrl;
private final String key = "mailbox";
// 1分钟
@Scheduled(fixedRate = 60000)
@Transactional(rollbackFor = Exception.class)
public void pushMailData() {
System.out.println(LocalDateTime.now());
List<Mail> mails = mailMapper.listByMailEtl();
for (Mail mail : mails) {
try {
if (StrUtil.isNotBlank(mail.getAttachments())) {
List<JSONObject> attachments = JSON.parseArray(mail.getAttachments()).toList(JSONObject.class);
for (JSONObject attachment : attachments) {
attachment.put("base64", minio.getBase64(attachment.getString("filepath")));
}
mail.setAttachments(JSON.toJSONString(attachments));
}
long timestamp = new Date().getTime();
HttpResponse httpResponse = HttpUtil.createPost(mailboxUrl + "mail")
.header("timestamp", String.valueOf(timestamp))
.auth(MD5.create().digestHex(key + timestamp))
.body(JSON.toJSONString(mail))
.execute();
if (!httpResponse.isOk()) {
throw new RuntimeException(String.format("httpCode: %s", httpResponse.getStatus()));
}
log.info(httpResponse.body());
JSONObject response = JSONObject.parseObject(httpResponse.body());
if (response.getInteger("code") != 200) {
throw new RuntimeException(response.getString("msg"));
}
MailEtl mailEtl = new MailEtl().setMailId(mail.getId()).setSuccess(true).setCreateTime(LocalDateTime.now());
mailEtlMapper.insert(mailEtl);
} catch (RuntimeException e) {
log.error("推送信件[{}]异常: {}", mail.getId(), e.getMessage(), e);
MailEtl mailEtl = new MailEtl().setMailId(mail.getId()).setSuccess(false).setCreateTime(LocalDateTime.now()).setErrMsg(e.getMessage());
mailEtlMapper.insert(mailEtl);
}
}
}
}

13
mailbox-outer/src/main/java/com/biutag/outer/mapper/HolidayMapper.java

@ -0,0 +1,13 @@
package com.biutag.outer.mapper;
import com.biutag.core.basics.IBaseMapper;
import com.biutag.entity.system.Holiday;
import org.apache.ibatis.annotations.Mapper;
/**
* 节假日Mapper
* @author oumyye
*/
@Mapper
public interface HolidayMapper extends IBaseMapper<Holiday> {
}

10
mailbox-outer/src/main/java/com/biutag/outer/mapper/MailEvaluateEtlMapper.java

@ -0,0 +1,10 @@
package com.biutag.outer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.outer.domain.MailEtl;
import com.biutag.outer.domain.MailEvaluateEtl;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MailEvaluateEtlMapper extends BaseMapper<MailEvaluateEtl> {
}

3
mailbox-outer/src/main/java/com/biutag/outer/mapper/MailMapper.java

@ -16,4 +16,7 @@ public interface MailMapper extends BaseMapper<Mail> {
@Select("select m.* from mail m left join mail_etl etl on m.id = etl.mail_id and etl.success = 1 where etl.id is null")
List<Mail> listByMailEtl();
@Select("select m.* from mail m left join mail_evaluate_etl etl on m.id = etl.mail_id and etl.success = 1 where m.satisfaction is not null and etl.id is null")
List<Mail> listByMailEvaluateEtl();
}

8
mailbox-outer/src/main/java/com/biutag/outer/util/Weixin.java

@ -19,8 +19,8 @@ public class Weixin {
public static final String SECRET = "7596544a77776be53d10fd78a7b4a441";
public static JSONObject getAccessToken(String code) {
// https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=SECRET&code=%s&grant_type=authorization_code
String url = String.format("https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code",
// http://172.24.138.108:6060/sns/oauth2/access_token?appid=%s&secret=SECRET&code=%s&grant_type=authorization_code
String url = String.format("http://172.24.138.108:6060/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code",
APP_ID,
SECRET,
code);
@ -35,7 +35,7 @@ public class Weixin {
}
public static JSONObject getAccessToken() {
String url = String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s",
String url = String.format("http://172.24.138.108:6060/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s",
APP_ID,
SECRET);
HttpResponse httpResponse = HttpUtil.createGet(url)
@ -50,7 +50,7 @@ public class Weixin {
public static String getTicket() {
JSONObject result = getAccessToken();
String url = String.format("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi",
String url = String.format("http://172.24.138.108:6060/cgi-bin/ticket/getticket?access_token=%s&type=jsapi",
result.getString("access_token"));
HttpResponse httpResponse = HttpUtil.createGet(url)
.execute();

9
mailbox-outer/src/main/java/com/biutag/outer/util/Weixin2.java

@ -23,8 +23,8 @@ public class Weixin2 {
public static final String SECRET = "4d6bc9ab9821f642d185b353893b44ea";
public static JSONObject getAccessToken(String code) {
// https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=SECRET&code=%s&grant_type=authorization_code
String url = String.format("https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code",
// http://172.24.138.108:6060/sns/oauth2/access_token?appid=%s&secret=SECRET&code=%s&grant_type=authorization_code
String url = String.format("http://172.24.138.108:6060/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code",
APP_ID,
SECRET,
code);
@ -39,7 +39,8 @@ public class Weixin2 {
}
public static JSONObject getAccessToken() {
String url = String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s",
// http://172.24.138.108:6060/cgi-bin/token
String url = String.format("http://172.24.138.108:6060/cgi-bin/stable_token?grant_type=client_credential&appid=%s&secret=%s",
APP_ID,
SECRET);
HttpResponse httpResponse = HttpUtil.createGet(url)
@ -54,7 +55,7 @@ public class Weixin2 {
public static String getTicket() {
JSONObject result = getAccessToken();
String url = String.format("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi",
String url = String.format("http://172.24.138.108:6060/cgi-bin/ticket/getticket?access_token=%s&type=jsapi",
result.getString("access_token"));
HttpResponse httpResponse = HttpUtil.createGet(url)
.execute();

9
mailbox-outer/src/main/resources/application-prod.yml

@ -6,8 +6,11 @@ spring:
oss:
minio:
enable: false
enable: true
endpoint: http://172.24.12.90:9001
accessKey: n8yPVAJk4yw879zi
secretKey: eElQ7gCwuNxaFhKEbtRRq0lsovoOTgI1
accessKey: qKidAvy2yuwFcwVrAnec
secretKey: PohCwD6AYXfbQx3YwpCknLMeXDFUDlPWRdgtVgAd
bucketName: mailbox
mailbox:
url: http://59.231.150.85:7979/v1/

35
mailbox-outer/src/test/java/SmsTest.java

@ -3,7 +3,6 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.outer.util.Md5Util;
import com.biutag.outer.util.ReqImsApi;
import java.util.Collections;
@ -12,23 +11,23 @@ import java.util.Date;
public class SmsTest {
public static void main(String[] args) {
String phoneNumber = "15608487213";
String code = "1234";
String url = "http://172.31.253.178:5050/ims/sms/sendSms";
String userName = "cxxjjjbxt";
String password = "rfrlnK@98";
String signTime = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_FORMAT);
String signStr = Md5Util.strToMD5(userName+Md5Util.strToMD5(password)+signTime);
ReqImsApi reqImsApi = new ReqImsApi();
reqImsApi.setUserName(userName);
reqImsApi.setSignStr(signStr);
reqImsApi.setSignTime(signTime);
reqImsApi.setSmsStr(String.format("您的验证码为:%s,请勿泄露于他人!", code));
reqImsApi.setMobileList(Collections.singletonList(JSONObject.of("mobile", phoneNumber)));
String json = JsonUtil.toJson(reqImsApi);
HttpResponse response = HttpUtil.createPost(url).body(json).execute();
System.out.println("手机号: " + phoneNumber + "发送短信结果:" + response.body());
// String phoneNumber = "15608487213";
// String code = "1234";
// String url = "http://172.31.253.178:5050/ims/sms/sendSms";
// String userName = "cxxjjjbxt";
// String password = "rfrlnK@98";
// String signTime = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_FORMAT);
// String signStr = Md5Util.strToMD5(userName+Md5Util.strToMD5(password)+signTime);
//
// ReqImsApi reqImsApi = new ReqImsApi();
// reqImsApi.setUserName(userName);
// reqImsApi.setSignStr(signStr);
// reqImsApi.setSignTime(signTime);
// reqImsApi.setSmsStr(String.format("您的验证码为:%s,请勿泄露于他人!", code));
// reqImsApi.setMobileList(Collections.singletonList(JSONObject.of("mobile", phoneNumber)));
// String json = JsonUtil.toJson(reqImsApi);
// HttpResponse response = HttpUtil.createPost(url).body(json).execute();
// System.out.println("手机号: " + phoneNumber + "发送短信结果:" + response.body());
}
}

29
mailbox-outer/src/test/java/com/biutag/outer/Base64Test.java

@ -0,0 +1,29 @@
package com.biutag.outer;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.biutag.util.IOUtil;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.InputStream;
public class Base64Test {
@Test
public void test() {
String s = FileUtil.readString("D:\\Workspace\\创客\\公安项目\\局长信箱\\mailbox-boot\\flow.json", "UTF-8");
JSONObject jsonObject = JSON.parseObject(s);
String base64 = jsonObject.getString("base64");
if (base64.startsWith("data:image/jpg;base64,")) {
int length = "data:image/jpg;base64,".length();
System.out.println(length);
System.out.println(base64.indexOf(","));
base64 = base64.substring(base64.indexOf(",") + 1);
System.out.println(base64);
}
InputStream is = IOUtil.base64ToStream(base64);
System.out.println(is);
}
}

9
sql/0307.sql

@ -0,0 +1,9 @@
ALTER TABLE "mailbox"."mail"
ADD COLUMN "extension_request_id" varchar(20);
COMMENT ON COLUMN "mailbox"."mail"."extension_request_id" IS '申请延期ID';
ALTER TABLE "mailbox"."mail_extension_approval"
ADD COLUMN "request_id" varchar(20);
COMMENT ON COLUMN "mailbox"."mail_extension_approval"."request_id" IS '申请延期ID';
Loading…
Cancel
Save