|
|
|
|
@ -3,10 +3,13 @@ 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.HttpResponse; |
|
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
|
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.RoleEnum; |
|
|
|
|
import com.biutag.exception.BusinessException; |
|
|
|
|
@ -48,7 +51,7 @@ public class DistributeFlow extends Flow {
|
|
|
|
|
|
|
|
|
|
private final String key = "mailbox"; |
|
|
|
|
|
|
|
|
|
@Value("mailbox.url:''") |
|
|
|
|
@Value("${mailbox.url:''}") |
|
|
|
|
private String mailboxUrl; |
|
|
|
|
|
|
|
|
|
@Value("${spring.profiles.active}") |
|
|
|
|
@ -75,6 +78,13 @@ public class DistributeFlow extends Flow {
|
|
|
|
|
|
|
|
|
|
Flow nextNode = next.get(nextActionKey); |
|
|
|
|
if (AppConstants.CHANGSHA_DEPT_ID.equals(mainDeptId) && "prod".equals(active)) { |
|
|
|
|
mailService.update(new LambdaUpdateWrapper<Mail>().eq(Mail::getId, mailId) |
|
|
|
|
.set(Mail::getCurrentOperator, "长沙市公安局专班") |
|
|
|
|
.set(Mail::getFlowKey, nextNode.getFlowNode().getKey()) |
|
|
|
|
.set(Mail::getFlowName, nextNode.getFlowNode().getBeforeName()) |
|
|
|
|
.set(Mail::getFlowLimitedLastHandlerTime, now) |
|
|
|
|
.set(Mail::getFirstDeptId, AppConstants.CHANGSHA_DEPT_ID)); |
|
|
|
|
|
|
|
|
|
MailApiV1Req mailApiV1Req = new MailApiV1Req(); |
|
|
|
|
BeanUtils.copyProperties(mail, mailApiV1Req); |
|
|
|
|
mailApiV1Req.setInvolvedDeptId(null); |
|
|
|
|
@ -95,14 +105,22 @@ public class DistributeFlow extends Flow {
|
|
|
|
|
jsonObject.put("base64", base64); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
mail.setAttachments(jsonArray.toJSONString()); |
|
|
|
|
mailApiV1Req.setAttachments(jsonArray.toJSONString()); |
|
|
|
|
} |
|
|
|
|
long timestamp = new Date().getTime(); |
|
|
|
|
// 上传
|
|
|
|
|
HttpUtil.createPost(mailboxUrl + "/v1/mail") |
|
|
|
|
HttpResponse httpResponse = HttpUtil.createPost(mailboxUrl + "/v1/mail") |
|
|
|
|
.header("timestamp", String.valueOf(timestamp)) |
|
|
|
|
.auth(MD5.create().digestHex(key + timestamp)) |
|
|
|
|
.body(JSON.toJSONString(mailApiV1Req)).execute(); |
|
|
|
|
.body(JSON.toJSONString(mailApiV1Req)) |
|
|
|
|
.execute(); |
|
|
|
|
if (!httpResponse.isOk()) { |
|
|
|
|
throw new RuntimeException("推送数据(长沙局长信箱)异常,状态码:" + httpResponse.getStatus() + "。请联系管理员"); |
|
|
|
|
} |
|
|
|
|
JSONObject result = JSON.parseObject(httpResponse.body()); |
|
|
|
|
if (result.getInteger("code") != 200) { |
|
|
|
|
throw new RuntimeException("推送数据(长沙局长信箱)异常,msg:" + result.getString("msg") + "。请联系管理员"); |
|
|
|
|
} |
|
|
|
|
return nextNode; |
|
|
|
|
} |
|
|
|
|
// 更新信件
|
|
|
|
|
|