|
|
|
@ -3,12 +3,12 @@ package com.biutag.lan.controller; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.crypto.digest.MD5; |
|
|
|
import cn.hutool.crypto.digest.MD5; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.biutag.config.Minio; |
|
|
|
import com.biutag.config.Minio; |
|
|
|
import com.biutag.constants.AppConstants; |
|
|
|
|
|
|
|
import com.biutag.core.AjaxResult; |
|
|
|
import com.biutag.core.AjaxResult; |
|
|
|
import com.biutag.entity.system.Holiday; |
|
|
|
import com.biutag.entity.system.Holiday; |
|
|
|
import com.biutag.enums.ErrorEnum; |
|
|
|
import com.biutag.enums.ErrorEnum; |
|
|
|
@ -19,6 +19,7 @@ import com.biutag.lan.domain.bo.HolidayV1Req; |
|
|
|
import com.biutag.lan.domain.bo.HotApiV1Req; |
|
|
|
import com.biutag.lan.domain.bo.HotApiV1Req; |
|
|
|
import com.biutag.lan.domain.bo.MailApiV1Req; |
|
|
|
import com.biutag.lan.domain.bo.MailApiV1Req; |
|
|
|
import com.biutag.lan.domain.bo.MailEvaluateApiV1Req; |
|
|
|
import com.biutag.lan.domain.bo.MailEvaluateApiV1Req; |
|
|
|
|
|
|
|
import com.biutag.lan.domain.vo.MailDomain; |
|
|
|
import com.biutag.lan.enums.MailCategoryEnums; |
|
|
|
import com.biutag.lan.enums.MailCategoryEnums; |
|
|
|
import com.biutag.lan.mapper.BlackUserMapper; |
|
|
|
import com.biutag.lan.mapper.BlackUserMapper; |
|
|
|
import com.biutag.lan.service.*; |
|
|
|
import com.biutag.lan.service.*; |
|
|
|
@ -53,8 +54,6 @@ public class ApiV1Controller { |
|
|
|
|
|
|
|
|
|
|
|
private final MailService mailService; |
|
|
|
private final MailService mailService; |
|
|
|
|
|
|
|
|
|
|
|
private final MailMarkService mailMarkService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final HolidayMapper holidayMapper; |
|
|
|
private final HolidayMapper holidayMapper; |
|
|
|
|
|
|
|
|
|
|
|
private final Minio minio; |
|
|
|
private final Minio minio; |
|
|
|
@ -65,6 +64,10 @@ public class ApiV1Controller { |
|
|
|
|
|
|
|
|
|
|
|
private final NoticeService noticeService; |
|
|
|
private final NoticeService noticeService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final MailFlowService flowService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final MailApprovalService mailApprovalService; |
|
|
|
|
|
|
|
|
|
|
|
private final String key = "mailbox"; |
|
|
|
private final String key = "mailbox"; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${spring.profiles.active}") |
|
|
|
@Value("${spring.profiles.active}") |
|
|
|
@ -82,7 +85,12 @@ public class ApiV1Controller { |
|
|
|
if (active.equals("dev")) { |
|
|
|
if (active.equals("dev")) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
minio.upload(IOUtil.base64ToStream(attachment.getString("base64")), attachment.getString("filepath"), true); |
|
|
|
Boolean fullPath = attachment.getBoolean("fullPath"); |
|
|
|
|
|
|
|
if (Objects.isNull(fullPath)) { |
|
|
|
|
|
|
|
fullPath = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String filepath = minio.upload(IOUtil.base64ToStream(attachment.getString("base64")), attachment.getString("filepath"), fullPath); |
|
|
|
|
|
|
|
attachment.put("filepath", filepath); |
|
|
|
attachment.remove("base64"); |
|
|
|
attachment.remove("base64"); |
|
|
|
} |
|
|
|
} |
|
|
|
mail.setAttachments(JSON.toJSONString(attachments)); |
|
|
|
mail.setAttachments(JSON.toJSONString(attachments)); |
|
|
|
@ -196,10 +204,36 @@ public class ApiV1Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 对接厅长信箱 |
|
|
|
|
|
|
|
* @param request |
|
|
|
|
|
|
|
* @param mailId |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@GetMapping("mail/detail") |
|
|
|
|
|
|
|
public AjaxResult<MailDomain> mailDetail(HttpServletRequest request, |
|
|
|
|
|
|
|
@RequestParam String mailId) { |
|
|
|
|
|
|
|
validAuth(request); |
|
|
|
|
|
|
|
MailDomain mailDomain = new MailDomain(); |
|
|
|
|
|
|
|
Mail mail = mailService.getById(mailId); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(mail.getVerifyAttachments())) { |
|
|
|
|
|
|
|
JSONArray array = JSON.parseArray(mail.getVerifyAttachments()); |
|
|
|
|
|
|
|
for (int i = 0; i < array.size(); i++) { |
|
|
|
|
|
|
|
JSONObject jsonObject = array.getJSONObject(i); |
|
|
|
|
|
|
|
jsonObject.put("filepath", "http://65.47.60.145/lan-api/api/file/stream/" + jsonObject.getString("filepath")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mail.setVerifyAttachments(array.toJSONString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mailDomain.setMail(mail); |
|
|
|
|
|
|
|
mailDomain.setFlows(flowService.list(mailId)); |
|
|
|
|
|
|
|
mailDomain.setApprovals(mailApprovalService.list(mailId)); |
|
|
|
|
|
|
|
return AjaxResult.success(mailDomain); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("mail/12345") |
|
|
|
@GetMapping("mail/12345") |
|
|
|
public AjaxResult<List<Mail>> mailList(HttpServletRequest request, |
|
|
|
public AjaxResult<List<Mail>> mailList(HttpServletRequest request, |
|
|
|
@RequestParam(value = "startTime", required = false) String startTimeStr, |
|
|
|
@RequestParam(value = "startTime", required = false) String startTimeStr, |
|
|
|
@RequestParam(value = "endTime", required = false) String endTimeStr) { |
|
|
|
@RequestParam(value = "endTime", required = false) String endTimeStr) { |
|
|
|
validAuth(request); |
|
|
|
validAuth(request); |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); |
|
|
|
LocalDateTime startTime = null; |
|
|
|
LocalDateTime startTime = null; |
|
|
|
@ -213,4 +247,5 @@ public class ApiV1Controller { |
|
|
|
List<Mail> mail = mailService.listFor12345(startTime, endTime); |
|
|
|
List<Mail> mail = mailService.listFor12345(startTime, endTime); |
|
|
|
return AjaxResult.success(mail); |
|
|
|
return AjaxResult.success(mail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|