From 08f4aca27c9ac6d80d6b877ac12eeca9d0657e41 Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Thu, 28 Mar 2024 18:54:08 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=9A1.=E8=8E=B7=E5=8F=96token2.=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=A1=88=E4=BB=B6=E7=8A=B6=E6=80=813.=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=96=87=E4=BB=B64.=E6=8E=A8=E9=80=81=E6=A1=88?= =?UTF-8?q?=E4=BB=B6=E9=99=84=E4=BB=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/tool/TestApiController.java | 69 ++++ .../src/main/resources/application.yml | 25 +- .../common/config/RestTemplateConfig.java | 25 ++ .../enums/AttachmentOperateTypeEnum.java | 15 + .../common/enums/PushCaseStatusEnum.java | 13 + .../com/ruoyi/common/utils/EncryptUtils.java | 121 +++++++ .../system/service/BeiMingInterface.java | 77 +++++ .../service/impl/BeiMingInterfaceService.java | 316 ++++++++++++++++++ .../domain/vo/mscase/MsCaseFileInfo.java | 54 +++ .../domain/vo/mscase/MsCaseStatusInfo.java | 35 ++ .../utils/CommonInputStreamResource.java | 42 +++ 11 files changed, 781 insertions(+), 11 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/config/RestTemplateConfig.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/AttachmentOperateTypeEnum.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/PushCaseStatusEnum.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseFileInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseStatusInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CommonInputStreamResource.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java new file mode 100644 index 0000000..7454856 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java @@ -0,0 +1,69 @@ +package com.ruoyi.web.controller.tool; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.PushCaseStatusEnum; +import com.ruoyi.system.service.impl.BeiMingInterfaceService; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.File; + +import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt; +import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; + +@RestController +@RequestMapping("/beiming/api") +public class TestApiController { + @Autowired + BeiMingInterfaceService beiMingInterfaceService; + @Value("${beimingprivatekey}") + public String privateKey; + + @GetMapping("/test") + @Anonymous + public AjaxResult selectCaseFlow() { + String token = beiMingInterfaceService.getApiToken("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", System.currentTimeMillis()); +// token = "f910e1441fc56e49d3f31396e8d9aa04228045815ee986a9587d7a5cb7312f9d11c7f80041745f38ec686ea1f819c8b8227f9c03196c6dd004f89215c4805c24355be4b57abeddb7b9d2cbda45fae74c49f4a83fb6496d84302ca8c07245786d682ecb68aed966fcbda3188b9c4d4376089471bb5aee371a62073b0ce15d72dccd6fbc8fd13957e2fb7aa018cb5937938bfc9773e570ac06ac633617cea8405759cf609c832074aaa03f972c0a6a93cde531da0d91d07770c037fdea1368ee5772941ba2a55ef155979d1ed8222faad92ed342530ef04f3746aa96499dee6ea4869ce46bd0dcfe7a69e7db49eb2aec388c47824c201b49825f24ffe82dde41b5"; + System.out.println("toke:" + token); + //解密 + if (token != null && !token.isEmpty()) { + JSONObject jsonObject = JSON.parseObject(token); + String tokenString = jsonObject.getString("data"); + System.out.println("data信息:" + tokenString); + String tokenstr = sm4Decrypt(tokenString, privateKey); + System.out.println("解密后的字符串:" + tokenstr); + if (tokenstr != null && !tokenstr.isEmpty()) { + JSONObject tokenObject = JSON.parseObject(tokenstr); + String resultToken = tokenObject.getString("token"); + MsCaseStatusInfo info = MsCaseStatusInfo.builder().caseNo("zc2024032700012").statusCode(PushCaseStatusEnum.MEDIATE.getCode()).caseClosureExplanation(PushCaseStatusEnum.MEDIATE.getName()).build(); + JSONObject result = beiMingInterfaceService.submitCaseStatusInfo(resultToken, "zc2024032700012", "BWT_MEDIATION", info); + System.out.println("jieguo:" + result.toString()); + if (result != null) { + String data = result.getString("data"); + String datastr = sm4Decrypt(data, privateKey); + System.out.println("最终解密后的字符串:" + datastr); + } + } + } + return AjaxResult.success(); + } + + @GetMapping("/testfile") + @Anonymous + public AjaxResult testfile() { +// File file = new File("D:/WorkDoc/TJ/File/证据1.png"); + File file = new File("D:/WorkDoc/TJ/File/证据3.png"); + JSONObject jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "123abc", "BWT_MEDIATION", "zc2024032700012"); + System.out.println("fanhui:" + jsonObject1.toString()); + return AjaxResult.success(); + } +} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 2dc7d5f..7e5b51b 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -90,7 +90,7 @@ spring: max-wait: -1ms web: resources: - static-locations: file:/home/ruoyi/ + static-locations: file:/home/ruoyi/ mail: host: smtp.163.com port: 25 @@ -196,17 +196,20 @@ signSealCallbackConfig: url: http://121.40.189.20:7001/mssignSeal/signSeaalCaseApplicaCallback # onlyOffice系统url配置 onlyOfficeConfig: -# url: http://172.16.0.254:9090/files/upload + # url: http://172.16.0.254:9090/files/upload url: http://121.40.189.20:9090/files/upload -#jodconverter: -# local: -# host: 121.40.189.20 + #jodconverter: + # local: + # host: 121.40.189.20 #暂时关闭预览,启动时会有点慢 -# enabled: true + # enabled: true #设置libreoffice主目录 linux地址如:/usr/lib64/libreoffice -# office-home: /usr/lib64/libreoffice/ -# office-home: D:\app\libreOffice\ - #开启多个libreoffice进程,每个端口对应一个进程 -# port-numbers: 8100 - #libreoffice进程重启前的最大进程数 + # office-home: /usr/lib64/libreoffice/ + # office-home: D:\app\libreOffice\ + #开启多个libreoffice进程,每个端口对应一个进程 + # port-numbers: 8100 + #libreoffice进程重启前的最大进程数 # max-tasks-per-process: 100 +beimingapihost: https://zj.odrcloud.cn +beimingapiprefix: /onestop/sync +beimingprivatekey: d7724e72c4be93196a35203e8379ded5 \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RestTemplateConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RestTemplateConfig.java new file mode 100644 index 0000000..22f8a7b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RestTemplateConfig.java @@ -0,0 +1,25 @@ +package com.ruoyi.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory){ + return new RestTemplate(factory); + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(5000);//单位为ms + factory.setConnectTimeout(5000);//单位为ms + return factory; + } +} + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AttachmentOperateTypeEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AttachmentOperateTypeEnum.java new file mode 100644 index 0000000..2e18edb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AttachmentOperateTypeEnum.java @@ -0,0 +1,15 @@ +package com.ruoyi.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 案件附件操作类型 + */ +@AllArgsConstructor +@Getter +public enum AttachmentOperateTypeEnum { + ADD("ADD", "新增"), DEL("DEL", "删除"), UPD("UPD", "修改"); + private String code; + private String name; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/PushCaseStatusEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/PushCaseStatusEnum.java new file mode 100644 index 0000000..0686ded --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/PushCaseStatusEnum.java @@ -0,0 +1,13 @@ +package com.ruoyi.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum PushCaseStatusEnum { + MEDIATE("MEDIATE", "调解中", 1), SUCCESS("SUCCESS", "调解成功", 2), FAIL("FAIL", "调解失败", 3); + private String code; + private String name; + private Integer value; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java new file mode 100644 index 0000000..579e6be --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java @@ -0,0 +1,121 @@ +package com.ruoyi.common.utils; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.Security; +import java.util.UUID; +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.Mac; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.pqc.math.linearalgebra.ByteUtils; + +@Slf4j +public class EncryptUtils { + static { + Security.addProvider(new BouncyCastleProvider()); + } + + /** + * sm4加密 + * @explain 加密模式:ECB 密文长度不固定,会随着被加密字符串长度的变化而变化 + * @param paramStr 待加密字符串 + * @return 返回16进制的加密字符串 + * @throws Exception + */ + public static String sm4Encrypt(String paramStr, String secretKey) { + if (StringUtils.isBlank(paramStr)) { + return null; + } + try { + // 16进制字符串-->byte[] + byte[] keyData = ByteUtils.fromHexString(secretKey); + // String-->byte[] + byte[] srcData = paramStr.getBytes(StandardCharsets.UTF_8); + // 加密后的数组 + Cipher cipher = Cipher.getInstance("SM4/ECB/PKCS5Padding", BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(keyData, "SM4"); + cipher.init(Cipher.ENCRYPT_MODE, sm4Key); + byte[] cipherArray = cipher.doFinal(srcData); + // byte[]-->hexString + return ByteUtils.toHexString(cipherArray); + } catch (Exception e) { + log.error("sm4加密失败:{}", paramStr, e); + } + return null; + + } + + /** + * sm4解密 + * @explain 解密模式:采用ECB + * @param cipherText 16进制的加密字符串(忽略大小写) + * @return 解密后的字符串 + * @throws Exception + */ + public static String sm4Decrypt(String cipherText, String secretKey) { + if (StringUtils.isBlank(cipherText)) { + return null; + } + try { + // hexString-->byte[] + byte[] keyData = ByteUtils.fromHexString(secretKey); + // hexString-->byte[] + byte[] cipherData = ByteUtils.fromHexString(cipherText); + // 解密 + Cipher cipher = Cipher.getInstance("SM4/ECB/PKCS5Padding", BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(keyData, "SM4"); + cipher.init(Cipher.DECRYPT_MODE, sm4Key); + byte[] cipherArray = cipher.doFinal(cipherData); + // byte[]-->String + return new String(cipherArray, StandardCharsets.UTF_8); + } catch (Exception e) { + log.error("sm4解密失败:{}", cipherText, e); + } + return null; + } + + /** + * @description: 初始化 HmacMD5 密钥 + */ + public static String initHmacMD5Key() throws NoSuchAlgorithmException { + //Init KeyGenerator. + KeyGenerator generator = KeyGenerator.getInstance("HmacSHA224"); + //Generate key. + SecretKey secretKey = generator.generateKey(); + return ByteUtils.toHexString(secretKey.getEncoded()); + } + + /** + * @description: HmacMD5 消息摘要 + */ + public static String encodeHmacMD5(String data, String key) throws NoSuchAlgorithmException, InvalidKeyException { + //Restore key. + SecretKey secretKey = new SecretKeySpec(ByteUtils.fromHexString(key), "HmacSHA224"); + //Instantiate Mac. + Mac mac = Mac.getInstance(secretKey.getAlgorithm()); + //Init Mac. + mac.init(secretKey); + //Execute. + return ByteUtils.toHexString(mac.doFinal(ByteUtils.fromHexString(data))); + } + + public static void main(String[] args) { + String privateKey = "936df5fd9aba3b86adc3c1a1c52dcde1"; + ObjectNode param = new ObjectMapper().createObjectNode(); + param.put("name", "姓名"); + String encryptString = sm4Encrypt(param.toString(), privateKey); + System.out.println("加密后的字符串:" + encryptString); + System.out.println("解密后的字符串:" + sm4Decrypt(encryptString, privateKey)); + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java new file mode 100644 index 0000000..6ed7801 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java @@ -0,0 +1,77 @@ +package com.ruoyi.system.service; + +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.wisdomarbitrate.domain.entity.casestatus.MsCaseStatus; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; +import org.apache.ibatis.annotations.Case; +import org.apache.poi.hmef.Attachment; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; + +public interface BeiMingInterface { + /** + * 1.获取北明接口令牌token + * + * @param userName + * @param password + * @param times + * @return + */ + String getApiToken(String userName, String password, Long times); + + + /** + * 2.提交案件状态信息 + * + * @param token 令牌 + * @param abutmentId 第三方平台案件唯一标识 + * @param msCaseStatusInfo 案件状态信息 + * @return + */ + JSONObject submitCaseStatusInfo(String token, String abutmentId, String syncSource, MsCaseStatusInfo msCaseStatusInfo); + + /** + * 3.上传附件 + * + * @param file + * @return + */ + JSONObject uploadFile(File file, String token, String syncSource); + + /** + * 4.同步附件信息 + * + * @param action + * @param caseNo + * @param msCaseFileInfo + * @return + */ + JSONObject syncAttachmentInfo(String token, String syncSource, String action, String caseNo, MsCaseFileInfo msCaseFileInfo); + + /** + * 推送案件状态信息(调解系统推送案件状态时调用) + * + * @param username 用户名 + * @param password 密码 + * @param caseNo 案件编号 + * @param statusCode 案件状态编码 + * @param caseClosureExplanation 案件状态描述(或结案信息) + * @return + */ + JSONObject pushCaseStatusInfo(String username, String password, String caseNo, String statusCode, String caseClosureExplanation); + + /** + * 推送案件附件信息(调解系统推送案件附件信息时调用) + * + * @param username 用户名 + * @param password 密码 + * @param file 文件 + * @param abutmentId 调解系统文件Id + * @param syncSource 用户名 + * @param caseNo 案件编号 + * @return + */ + JSONObject pushAttachmentInfo(String username, String password, File file, String abutmentId, String syncSource, String caseNo); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java new file mode 100644 index 0000000..50ad1c8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java @@ -0,0 +1,316 @@ +package com.ruoyi.system.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.system.service.BeiMingInterface; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; +import com.ruoyi.wisdomarbitrate.utils.CommonInputStreamResource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import java.io.File; +import java.io.FileInputStream; + +import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt; +import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; + +/** + * @author ym + */ +@Slf4j +@Service +public class BeiMingInterfaceService implements BeiMingInterface { + @Autowired + RestTemplate restTemplate; + /** + * 接口地址 + */ + @Value("${beimingapihost}") + public String apihost; + /** + * 接口路径前缀 + */ + @Value("${beimingapiprefix}") + public String apiprefix; + @Value("${beimingprivatekey}") + public String privateKey; + + /** + * 1.获取北明接口令牌token + * + * @param userName + * @param password + * @param times + */ + @Override + public String getApiToken(String userName, String password, Long times) { + JSONObject result = new JSONObject(); + try { + //设置请求头 + HttpHeaders httpHeaders = new HttpHeaders(); + //传递请求体时必须设置传递参数的格式,为Content-Type : application/json + httpHeaders.add("Content-Type", "application/json;charset=UTF-8"); + httpHeaders.add("syncSource", userName); + // 2.请求头 & 请求体 + HttpEntity fromEntity = new HttpEntity(httpHeaders); + JSONObject body = new JSONObject(); +// body.put("account", userName); +// body.put("password", password); +// body.put("timestamp", times); + //对整体请求进行加密 + ObjectNode param = new ObjectMapper().createObjectNode(); + param.put("account", userName); + param.put("password", password); + param.put("timestamp", times); + String encryptString = sm4Encrypt(param.toString(), privateKey); + body.put("encryptString", encryptString); + System.out.println("encryptString:" + encryptString); + fromEntity = new HttpEntity(body, httpHeaders); + String url = apihost + apiprefix + "/getToken"; + result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + } catch (RestClientException e) { + e.printStackTrace(); + } + return result.toString(); + } + + /** + * 解析加密后端token + * + * @param token + * @return + */ + public String analysisResultToken(String token) { + String resultToken = null; + if (token != null && !token.isEmpty()) { + JSONObject jsonObject = JSON.parseObject(token); + String tokenString = jsonObject.getString("data"); + System.out.println("data信息:" + tokenString); + String tokenstr = sm4Decrypt(tokenString, privateKey); + System.out.println("解密后的字符串:" + tokenstr); + if (tokenstr != null && !tokenstr.isEmpty()) { + JSONObject tokenObject = JSON.parseObject(tokenstr); + resultToken = tokenObject.getString("token"); + } + } + return resultToken; + } + + /** + * 2.推送案件状态信息 + * + * @param token 令牌 + * @param abutmentId 第三方平台案件唯一标识 + * @param msCaseStatusInfo 案件状态信息 + * @param syncSource 同步来源(账户名) + * @return + */ + @Override + public JSONObject submitCaseStatusInfo(String token, String abutmentId, String syncSource, MsCaseStatusInfo msCaseStatusInfo) { + JSONObject result = new JSONObject(); + try { + //设置请求头 + HttpHeaders httpHeaders = new HttpHeaders(); + //传递请求体时必须设置传递参数的格式,为Content-Type : application/json + httpHeaders.add("Content-Type", "application/json;charset=UTF-8"); + httpHeaders.add("token", token); + httpHeaders.add("syncSource", syncSource); + //对整体请求进行加密 + ObjectNode param = new ObjectMapper().createObjectNode(); + param.put("abutmentId", abutmentId); + param.put("caseNo", msCaseStatusInfo.getCaseNo()); + param.put("statusCode", msCaseStatusInfo.getStatusCode()); + param.put("caseClosureExplanation", msCaseStatusInfo.getCaseClosureExplanation()); + String encryptString = sm4Encrypt(param.toString(), privateKey); + // 2.请求头 & 请求体 + HttpEntity fromEntity = new HttpEntity(httpHeaders); + JSONObject body = new JSONObject(); +// body.put("abutmentId", Encrypt("abutmentId",abutmentId)); +// body.put("caseNo", Encrypt("caseNo", msCaseStatusInfo.getCaseNo())); +// body.put("statusCode", Encrypt("statusCode",msCaseStatusInfo.getStatusCode())); +// body.put("caseClosureExplanation", Encrypt("caseClosureExplanation", msCaseStatusInfo.getCaseClosureExplanation())); + //对整体请求进行加密 + body.put("encryptString", encryptString); + fromEntity = new HttpEntity(body, httpHeaders); + + String url = apihost + apiprefix + "/caseMediation/status"; + result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + } catch (RestClientException e) { + e.printStackTrace(); + } + return result; + + } + + /** + * 3.上传附件 + * + * @param file + * @return + */ + @Override + public JSONObject uploadFile(File file, String token, String syncSource) { + System.out.println("文件:" + file.getName()); + System.out.println("文件:" + file.toString()); + JSONObject result = new JSONObject(); + try { + //设置请求头 + HttpHeaders httpHeaders = new HttpHeaders(); + //传递请求体时必须设置传递参数的格式,为Content-Type : application/json + httpHeaders.add("Content-Type", "multipart/form-data"); + httpHeaders.add("token", token); + httpHeaders.add("syncSource", syncSource); + // 构建请求体 + MultiValueMap requestBody = new LinkedMultiValueMap<>(); + CommonInputStreamResource commonInputStreamResource = null; + try { + FileInputStream fileInputStream = new FileInputStream(file); + commonInputStreamResource = new CommonInputStreamResource(fileInputStream, file.length(), file.getName()); + } catch (Exception e) { + log.error("文件输入流转换错误", e); + } + requestBody.add("file", commonInputStreamResource); + HttpEntity fromEntity = new HttpEntity(requestBody, httpHeaders); + String url = apihost + apiprefix + "/uploadFile"; + result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + } catch (RestClientException e) { + e.printStackTrace(); + } + return result; + } + + /** + * 4.同步附件信息 + * + * @param token + * @param syncSource 用户名 + * @param action 附件操作类型 + * @param caseNo 案件编号 + * @param msCaseFileInfo 案件附件信息 + * @return + */ + @Override + public JSONObject syncAttachmentInfo(String token, String syncSource, String action, String caseNo, MsCaseFileInfo msCaseFileInfo) { + JSONObject result = new JSONObject(); + try { + //设置请求头 + HttpHeaders httpHeaders = new HttpHeaders(); + //传递请求体时必须设置传递参数的格式,为Content-Type : application/json + httpHeaders.add("Content-Type", "application/json;charset=UTF-8"); + httpHeaders.add("token", token); + httpHeaders.add("syncSource", syncSource); + //对整体请求进行加密 + ObjectNode param = new ObjectMapper().createObjectNode(); + param.put("caseNo", caseNo); + param.put("action", action); + param.put("abutmentId", msCaseFileInfo.getAbutmentId()); + param.put("abutmentCaseId", msCaseFileInfo.getAbutmentCaseId()); + param.put("documentSubject", msCaseFileInfo.getDocumentSubject()); + param.put("documentType", msCaseFileInfo.getDocumentType()); + param.put("fileName", msCaseFileInfo.getFileName()); + param.put("fileId", msCaseFileInfo.getFileId()); + if (msCaseFileInfo.getOwnerType() != null) { + param.put("ownerType", msCaseFileInfo.getOwnerType()); + } + if (msCaseFileInfo.getOwnerId() != null) { + param.put("ownerId", msCaseFileInfo.getOwnerId()); + } + if (msCaseFileInfo.getOwnerName() != null) { + param.put("ownerName", msCaseFileInfo.getOwnerName()); + } + String encryptString = sm4Encrypt(param.toString(), privateKey); + // 2.请求体 + HttpEntity fromEntity = new HttpEntity(httpHeaders); + JSONObject body = new JSONObject(); + //对整体请求进行加密 + body.put("encryptString", encryptString); + fromEntity = new HttpEntity(body, httpHeaders); + String url = apihost + apiprefix + "/caseMediation/attachment/accept"; + result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + } catch (RestClientException e) { + e.printStackTrace(); + } + return result; + } + + /** + * 推送案件状态信息 + */ + @Override + public JSONObject pushCaseStatusInfo(String username, String password, String caseNo, String statusCode, String caseClosureExplanation) { + JSONObject result = new JSONObject(); + String token = getApiToken(username, password, System.currentTimeMillis()); + token = analysisResultToken(token); + if (token != null && !token.isEmpty()) { + MsCaseStatusInfo info = MsCaseStatusInfo.builder().caseNo(caseNo).statusCode(statusCode).caseClosureExplanation(caseClosureExplanation).build(); + result = submitCaseStatusInfo(token, caseNo, username, info); + System.out.println("jieguo:" + result.toString()); + if (result != null) { + String data = result.getString("data"); + String datastr = sm4Decrypt(data, privateKey); + System.out.println("最终解密后的字符串:" + datastr); + } + } + return result; + } + + /** + * 推送案件附件信息 + */ + @Override + public JSONObject pushAttachmentInfo(String username, String password, File file, String abutmentId, String syncSource, String caseNo) { + JSONObject result = new JSONObject(); + //1.获取token + String token = getApiToken(username, password, System.currentTimeMillis()); + token = analysisResultToken(token); + if (token != null && !token.isEmpty()) { + //2.上传文件 + JSONObject fileResult = uploadFile(file, token, syncSource); + if (fileResult != null) { + String data = fileResult.getString("data"); + String datastr = sm4Decrypt(data, privateKey); + System.out.println("最终解密后的字符串:" + datastr); + if (datastr != null) { + JSONObject parse = JSON.parseObject(datastr); + if (parse != null) { + String fileId = parse.getString("fileId"); + System.out.println("fileId====:" + fileId); + if (fileId != null) { + //3.同步附件更新信息 + MsCaseFileInfo fileInfo = MsCaseFileInfo.builder().fileId(fileId).fileName(file.getName()).abutmentId(abutmentId).abutmentCaseId(caseNo).documentSubject("EVEDENT").documentType("EVEDENT_METERIAL").build(); + result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.ADD.getCode(), caseNo, fileInfo); + result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.UPD.getCode(), caseNo, fileInfo); + result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.DEL.getCode(), caseNo, fileInfo); + } + } + } + } + } + return result; + } + + /** + * 对字段值进行加密 + * + * @return + */ + private String Encrypt(String filed, String filedValue) { + ObjectNode param = new ObjectMapper().createObjectNode(); + param.put(filed, filedValue); + String encryptString = sm4Encrypt(param.toString(), privateKey); + return encryptString; + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseFileInfo.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseFileInfo.java new file mode 100644 index 0000000..621b4ff --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseFileInfo.java @@ -0,0 +1,54 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.mscase; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 北明接口案件附件信息入参 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class MsCaseFileInfo { + + /** + * 第三方文件唯一标识 + */ + private String abutmentId; + /** + * 第三方平台案件唯一标识 + */ + private String abutmentCaseId; + /** + * 第一级文件类型 + */ + private String documentSubject; + /** + * 第二级文件类型 + */ + private String documentType; + /** + * 所属人类型(可不传) + */ + private String ownerType; + /** + * 文件所属人第三方平台对应的人员唯一标识(可不传) + */ + private String ownerId; + /** + * 文件所属人名称(可不传) + */ + private String ownerName; + /** + * 文件名称 + */ + private String fileName; + /** + * 一站式平台返回的文件ID + */ + private String fileId; + +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseStatusInfo.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseStatusInfo.java new file mode 100644 index 0000000..c7870e6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseStatusInfo.java @@ -0,0 +1,35 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.mscase; + +import lombok.*; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * 北明接口案件状态入参 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class MsCaseStatusInfo { + /** + * 案号 + * 案件状态编码 + * 结案说明 + */ + private String caseNo; + + /** + * 案件状态编码 + */ + private String statusCode; + + /** + * 结案说明 + */ + private String caseClosureExplanation; + +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CommonInputStreamResource.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CommonInputStreamResource.java new file mode 100644 index 0000000..7dccb6f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CommonInputStreamResource.java @@ -0,0 +1,42 @@ +package com.ruoyi.wisdomarbitrate.utils; + +import org.springframework.core.io.InputStreamResource; +import java.io.InputStream; +public class CommonInputStreamResource extends InputStreamResource { + private long length; + private String fileName; + public CommonInputStreamResource(InputStream inputStream, long length, String fileName) { + super(inputStream); + this.length = length; + this.fileName = fileName; + } + + /** + * 覆写父类方法 + * 如果不重写这个方法,并且文件有一定大小,那么服务端会出现异常 + * {@code The multi-part request contained parameter data (excluding uploaded files) that exceeded} + */ + @Override + public String getFilename() { + return fileName; + } + + /** + * 覆写父类 contentLength 方法 + * 因为 {@link org.springframework.core.io.AbstractResource#contentLength()}方法会重新读取一遍文件, + * 而上传文件时,restTemplate 会通过这个方法获取大小。然后当真正需要读取内容的时候,发现已经读完,会报如下错误。 + */ + @Override + public long contentLength() { + long estimate = length; + return estimate == 0 ? 1 : estimate; + } + + public void setLength(long length) { + this.length = length; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } +} -- 2.54.0 From 72026ee6f4957d649e0053bb55b2cf3ac20558dc Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 2 Apr 2024 15:56:40 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E8=B0=83=E8=A7=A3=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/RuoYiApplication.java | 21 + .../controller/system/SysLoginController.java | 11 + .../controller/tool/TestApiController.java | 8 +- .../mscase/MsCaseApplicationController.java | 14 +- .../mscase/MsSignSealController.java | 64 +- .../mscase/MsVideoConferenceController.java | 4 +- .../ruoyi/common/constant/CacheConstants.java | 17 + .../com/ruoyi/common/constant/Constants.java | 3 + .../common/core/domain/entity/SMSNotice.java | 26 + .../core/domain/entity/SMSNoticeDO.java | 34 + .../common/core/domain/entity/SysDept.java | 36 +- .../common/core/domain/entity/SysUser.java | 44 + .../ruoyi/common/enums/DocumentTypeEnum.java | 18 + .../com/ruoyi/common/utils/EmailOutUtil.java | 36 +- .../web/service/SysLoginService.java | 28 +- .../framework/web/service/TokenService.java | 5 +- .../domain/entity/log/MsRequestLog.java | 55 + .../ruoyi/system/mapper/SysUserMapper.java | 12 +- .../system/mapper/SysUserRoleMapper.java | 7 + .../system/mapper/log/MsRequestLogMapper.java | 7 + .../system/service/BeiMingInterface.java | 17 +- .../system/service/MsRequestLogService.java | 14 + .../service/impl/BeiMingInterfaceService.java | 102 +- .../service/impl/MsRequestLogServiceImpl.java | 24 + .../service/impl/SysDeptServiceImpl.java | 28 +- .../service/impl/SysRoleServiceImpl.java | 34 +- .../domain/entity/mscase/MsCaseAffiliate.java | 206 +- .../entity/mscase/MsCaseApplication.java | 20 +- .../domain/entity/mscase/MsCaseAttach.java | 5 + .../domain/vo/mscase/MsCaseAffiliateBase.java | 32 + .../vo/mscase/MsCaseAffiliateParent.java | 11 + .../domain/vo/mscase/MsCaseAffiliateVO.java | 32 + .../vo/mscase/MsCaseApplicationReq.java | 13 + .../domain/vo/mscase/MsCaseApplicationVO.java | 15 +- .../mapper/mscase/MsCaseAffiliateMapper.java | 23 + .../mscase/MsCaseApplicationMapper.java | 160 +- .../mscase/MsCaseApplicationService.java | 97 +- .../service/mscase/MsCasePaymentService.java | 7 + .../service/mscase/MsSignSealService.java | 9 +- .../mscase/VideoConferenceService.java | 2 +- .../impl/MsCaseApplicationServiceImpl.java | 3945 ++++++++--------- .../mscase/impl/MsCasePaymentServiceImpl.java | 149 +- .../mscase/impl/MsSignSealServiceImpl.java | 633 +-- .../impl/VideoConferenceServiceImpl.java | 51 +- .../system/mapper/log/MsRequestLogMapper.xml | 15 + .../resources/mapper/system/SysDeptMapper.xml | 12 + .../resources/mapper/system/SysUserMapper.xml | 27 +- .../mapper/system/SysUserRoleMapper.xml | 6 +- .../mscase/MsCaseAffiliateMapper.xml | 92 +- .../mscase/MsCaseApplicationMapper.xml | 109 + .../mscase/MsCaseAttachMapper.xml | 4 + 51 files changed, 3102 insertions(+), 3242 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNotice.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNoticeDO.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/DocumentTypeEnum.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/log/MsRequestLogMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/MsRequestLogService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateBase.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateParent.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateVO.java create mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 61b4e13..8e2591f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -2,9 +2,13 @@ package com.ruoyi; import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.mapper.SysDeptMapper; +import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -45,6 +49,23 @@ public class RuoYiApplication if(CollectionUtil.isNotEmpty(sysUsers)){ for (SysUser sysUser : sysUsers) { redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); + redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY+sysUser.getEmail(),sysUser); + } + } + // 初始化角色redis + SysRoleMapper roleMapper = SpringUtils.getBean(SysRoleMapper.class); + List roles = roleMapper.selectRoleList(new SysRole()); + if(CollectionUtil.isNotEmpty(roles)){ + for (SysRole role : roles) { + redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId()); + } + } + // 初始化部门redis + SysDeptMapper deptMapper = SpringUtils.getBean(SysDeptMapper.class); + List depts = deptMapper.selectDeptList(new SysDept()); + if(CollectionUtil.isNotEmpty(depts)){ + for (SysDept dept : depts) { + redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId()); } } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index e42104d..acfe355 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -116,6 +116,17 @@ public class SysLoginController { } return loginService.loginSSO(loginBody); + } + /**对接BM,根据用户名查询token*/ + @GetMapping("selectTokenByUserName") + public AjaxResult selectTokenByUserName( LoginBody loginBody){ + if(StrUtil.isEmpty(loginBody.getUsername()) || StrUtil.isEmpty(loginBody.getTicket()) + ){ + return AjaxResult.error("参数错误"); + } + + return loginService.selectTokenByUserName(loginBody); + } public static void main(String[] args) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java index 7454856..2c66e62 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java @@ -2,12 +2,12 @@ package com.ruoyi.web.controller.tool; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.AttachmentOperateTypeEnum; import com.ruoyi.common.enums.PushCaseStatusEnum; import com.ruoyi.system.service.impl.BeiMingInterfaceService; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController; import java.io.File; import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt; -import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; @RestController @RequestMapping("/beiming/api") @@ -57,12 +56,13 @@ public class TestApiController { return AjaxResult.success(); } + @GetMapping("/testfile") @Anonymous public AjaxResult testfile() { // File file = new File("D:/WorkDoc/TJ/File/证据1.png"); File file = new File("D:/WorkDoc/TJ/File/证据3.png"); - JSONObject jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "123abc", "BWT_MEDIATION", "zc2024032700012"); + MsCaseFileInfo jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "BWT_MEDIATION", "zc2024032700012", AttachmentOperateTypeEnum.ADD); System.out.println("fanhui:" + jsonObject1.toString()); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java index 23462d6..4af3ce4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java @@ -77,7 +77,7 @@ public class MsCaseApplicationController extends BaseController { @PostMapping("/insert") public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication ) { - if(caseApplication.getAffiliate()==null||caseApplication.getAffiliate().getOrganizeFlag()==null){ + if( caseApplication.getAffiliate()==null|| caseApplication.getOrganizeFlag()==null){ error("参数校验失败"); } AjaxResult ajaxResult = AjaxResult.success(); @@ -344,19 +344,7 @@ public class MsCaseApplicationController extends BaseController { return caseApplicationService.updateTrialPen(attach); } - /** - * 确认调解书 - * @param - * @return - */ - @PostMapping("/confirmMediation") - public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach) throws EsignDemoException, InterruptedException { - if (attach.getCaseFlowId()==null || attach.getCaseAppliId()==null ) { - return error("参数校验失败"); - } - return caseApplicationService.confirmMediation(attach); - } /** * 获取userSign * @param userId diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsSignSealController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsSignSealController.java index adee87e..17f835a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsSignSealController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsSignSealController.java @@ -2,18 +2,15 @@ package com.ruoyi.web.controller.wisdomarbitrate.mscase; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord; -import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO; import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService; import com.ruoyi.wisdomarbitrate.utils.SignVerifyUtils; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; @@ -29,16 +26,7 @@ public class MsSignSealController extends BaseController { @Autowired private MsSignSealService msSignSealService; - /** - * 调解书签名 - */ - @PostMapping("/sureMediationSeal") - public AjaxResult sureMediationSeal(@RequestBody MsCaseApplicationVO caseApplication ) throws EsignDemoException, InterruptedException { - if(caseApplication.getId()==null){ - error("id不能为空"); - } - return msSignSealService.sureMediationSeal(caseApplication); - } + /** * 用印申请 @@ -151,55 +139,5 @@ public class MsSignSealController extends BaseController { return msSignSealService.msCaseSignUrlApplyPC(dto); } - /** - * PC端被申请人签名 - * @param dto - * @return - */ - @PostMapping("/msCaseSignUrlResPC") - public AjaxResult msCaseSignUrlResPC(@RequestBody MsSignSealDTO dto) throws EsignDemoException { - if (dto.getCaseId() == null) { - return error("参数校验失败"); - } - return msSignSealService.msCaseSignUrlResPC(dto); - } - - - /** - * 小程序端申请人签名 - * @param dto - * @return - */ - @PostMapping("/msCaseSignUrlApplyAPP") - public AjaxResult msCaseSignUrlApplyAPP(@RequestBody MsSignSealDTO dto) throws EsignDemoException { - if (dto.getCaseId() == null) { - return error("参数校验失败"); - } - return msSignSealService.msCaseSignUrlApplyAPP(dto); - } - - /** - * 小程序端被申请人签名 - * @param dto - * @return - */ - @PostMapping("/msCaseSignUrlResAPP") - public AjaxResult msCaseSignUrlResAPP(@RequestBody MsSignSealDTO dto) throws EsignDemoException { - if (dto.getCaseId() == null) { - return error("参数校验失败"); - } - return msSignSealService.msCaseSignUrlResAPP(dto); - } - - - - - - - - - - - } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 03d6e87..5b83233 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -106,9 +106,9 @@ public class MsVideoConferenceController extends BaseController { */ @Anonymous @GetMapping("secretaryRoleByUserId") - public AjaxResult secretaryRoleByUserId( @RequestParam(value = "userId",required = true) Long userId) { + public AjaxResult secretaryRoleByUserId( @RequestParam(value = "userId",required = true) Long userId,@RequestParam(value = "caseId",required = true) Long caseId) { - return videoService.secretaryRoleByUserId(userId); + return videoService.secretaryRoleByUserId(userId,caseId); } /** * 根据html字符串转pdf并和案件关联 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index dab65a0..d3cf20f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -11,6 +11,11 @@ public class CacheConstants * 登录用户 redis key */ public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + /** + * 登录用户名 redis key + */ + + public static final String LOGIN_USERNAME_TOKEN_KEY = "login_username_tokens:"; /** * 验证码 redis key @@ -50,4 +55,16 @@ public class CacheConstants * 所有用户 redis key */ public static final String USER_KEY = "user_key:"; + /** + * 用户邮箱 redis key + */ + public static final String USER_EMAIL_KEY = "user_email_key:"; + /** + * 角色 redis key + */ + public static final String ROLE_KEY = "role_key:"; + /** + * 部门 redis key + */ + public static final String DEPT_KEY = "dept_key:"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 4e8981f..b1b5c79 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -141,7 +141,10 @@ public class Constants */ public static final String LOOKUP_LDAPS = "ldaps:"; public static final String DEFAULT_PASSWORD = "123456"; + // 英文逗号分隔符 public static final String SPLIT_COMMA =","; + // 中文逗号分隔符 + public static final String CN_SPLIT_COMMA =","; /** * 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNotice.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNotice.java new file mode 100644 index 0000000..f08c5a9 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNotice.java @@ -0,0 +1,26 @@ +package com.ruoyi.common.core.domain.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname SMSNotice + * @Description 消息通知 + * @Version 1.0.0 + * @Date 2024/3/26 11:13 + * @Created wangqiong + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class SMSNotice { + /** + * 申请人通知 + */ + private SMSNoticeDO applicantNotice; + /** + * 被申通知 + */ + private SMSNoticeDO resNotice; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNoticeDO.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNoticeDO.java new file mode 100644 index 0000000..2eaec15 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SMSNoticeDO.java @@ -0,0 +1,34 @@ +package com.ruoyi.common.core.domain.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname SMSNoticeDO + * @Description 消息通知实体 + * @Version 1.0.0 + * @Date 2024/3/26 11:10 + * @Created wangqiong + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class SMSNoticeDO { + /** + * 主题 + */ + private String subject; + /** + * 发送内容 + */ + private String content; + /** + * 模板id + */ + private String templateId; + /** + * 模板参数 + */ + private String[] templateParamSet; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index f98291a..31c8054 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -1,14 +1,15 @@ package com.ruoyi.common.core.domain.entity; -import java.util.ArrayList; -import java.util.List; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.core.domain.BaseEntity; +import java.util.ArrayList; +import java.util.List; /** * 部门表 sys_dept @@ -54,6 +55,31 @@ public class SysDept extends BaseEntity /** 父部门名称 */ private String parentName; + /** + * 代码(统一社会信用代码或者身份证号) + */ + private String code; + + /** + * 法定代表人 + */ + private String compLegalPerson; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCompLegalPerson() { + return compLegalPerson; + } + + public void setCompLegalPerson(String compLegalPerson) { + this.compLegalPerson = compLegalPerson; + } public Integer getDeptType() { return deptType; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index eb193fc..73e6e16 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -69,6 +69,18 @@ public class SysUser extends BaseEntity /** 国籍,0-国内,1-国外,默认0 */ private Integer nationality; + /** + * 生日 + */ + private Date birth; + /** + * 住所 + */ + private String home; + /** + * 联系地址 + */ + private String address; /** 用户邮箱 */ @Excel(name = "用户邮箱") @@ -140,6 +152,38 @@ public class SysUser extends BaseEntity this.userId = userId; } + public Date getBirth() { + return birth; + } + + public void setBirth(Date birth) { + this.birth = birth; + } + + public String getHome() { + return home; + } + + public void setHome(String home) { + this.home = home; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public List getDepts() { + return depts; + } + + public void setDepts(List depts) { + this.depts = depts; + } + public Integer getIdType() { return idType; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DocumentTypeEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DocumentTypeEnum.java new file mode 100644 index 0000000..0d462ff --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DocumentTypeEnum.java @@ -0,0 +1,18 @@ +package com.ruoyi.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum DocumentTypeEnum { + EVEDENT_METERIAL("EVEDENT_METERIAL", "证据材料", 1), + EVEDENT_APPLY_BOOK("EVEDENT_APPLY_BOOK", "调解申请书", 2), + EVEDENT_MEDIATION_VIDEO("EVEDENT_MEDIATION_VIDEO", "调解视频", 3), + EVEDENT_MEDIATION_RECORD("EVEDENT_MEDIATION_RECORD", "调解笔录", 4), + EVEDENT_AGREEMENT("EVEDENT_AGREEMENT", "调解书或和解协议", 5), + ; + private String code; + private String name; + private Integer value; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java index f4d7539..1769609 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EmailOutUtil.java @@ -1,10 +1,12 @@ package com.ruoyi.common.utils; +import cn.hutool.core.util.StrUtil; import com.ruoyi.common.utils.uuid.UUID; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; +import org.springframework.mail.MailException; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; @@ -72,17 +74,29 @@ public class EmailOutUtil { * @param subject 邮件主题 * @param content 邮件内容(发送内容) */ - public void sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) { - // 创建一个邮件对象 - SimpleMailMessage msg = new SimpleMailMessage(); - msg.setFrom(from); - msg.setTo(to); - // 设置邮件主题 - msg.setSubject(subject); - // 设置邮件内容 - msg.setText(content); - // 发送邮件 - mailSender.send(msg); + public Boolean sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) { + try { + if(mailSender==null){ + rebuildMailSender(); + } + // 创建一个邮件对象 + SimpleMailMessage msg = new SimpleMailMessage(); + if(StrUtil.isEmpty(from)){ + msg.setFrom(usernameOut); + }else { + msg.setFrom(from); + } + msg.setTo(to); + // 设置邮件主题 + msg.setSubject(subject); + // 设置邮件内容 + msg.setText(content); + // 发送邮件 + mailSender.send(msg); + } catch (MailException e) { + return false; + } + return true; ////System.out.println("发送成功:" + from + ":to:" + to); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 9cb1ac1..326e1ce 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -1,5 +1,6 @@ package com.ruoyi.framework.web.service; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.crypto.digest.MD5; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.Constants; @@ -237,9 +238,8 @@ public class SysLoginService user.setUserName(username); user.setPassword(SecurityUtils.encryptPassword("abc123456")); user.setNickName(username); - // 代理人角色相当于申请人角色 - if(loginBody.getRoleName().contains("代理人")){ - loginBody.setRoleName("申请人"); + if(username.contains("@")){ + user.setEmail(username); } // 根据角色名查询角色id Long roleIdByName = roleMapper.selectRoleIdByName(loginBody.getRoleName()); @@ -258,4 +258,26 @@ public class SysLoginService ajax.put(Constants.TOKEN, token); return ajax; } + + /** + * 对接BM,根据用户名查询token + * @param loginBody + * @return + */ + public AjaxResult selectTokenByUserName(LoginBody loginBody) { + String username = loginBody.getUsername(); + String currentTicket = MD5.create().digestHex("BM" + username); + if(!currentTicket.equals(loginBody.getTicket())){ + return AjaxResult.error("ticket校验失败"); + } + + Object cacheObject = redisCache.getCacheObject(CacheConstants.LOGIN_USERNAME_TOKEN_KEY + username); + if(ObjectUtil.isEmpty(cacheObject)){ + return AjaxResult.error("登录时间过长,请重新登录"); + } + + AjaxResult result = AjaxResult.success(); + result.put("token",(String) cacheObject); + return result; + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java index 5d4e6ff..9bab643 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java @@ -123,7 +123,9 @@ public class TokenService claims.put("userName",loginUser.getUsername()); claims.put("userId",loginUser.getUserId()); claims.put(Constants.LOGIN_USER_KEY, token); - return createToken(claims); + String createToken = createToken(claims); + redisCache.setCacheObject(CacheConstants.LOGIN_USERNAME_TOKEN_KEY+loginUser.getUsername(),createToken, expireTime, TimeUnit.MINUTES); + return createToken; } /** @@ -154,6 +156,7 @@ public class TokenService // 根据uuid将loginUser缓存 String userKey = getTokenKey(loginUser.getToken()); redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java new file mode 100644 index 0000000..dfc47dc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/log/MsRequestLog.java @@ -0,0 +1,55 @@ +package com.ruoyi.system.domain.entity.log; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +@Getter +@Setter +@ToString +@Table(name = "ms_request_log") +public class MsRequestLog { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * 状态,0-成功,1-失败 + */ + private Integer status; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; + + /** + * 请求url + */ + @Column(name = "request_url") + private String requestUrl; + + /** + * 请求内容 + */ + @Column(name = "content") + private String content; + + /** + * 失败原因 + */ + @Column(name = "reason") + private String reason; + /** + * 返回内容 + */ + @Column(name = "return_content") + private String returnContent; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index 39f6f2a..1f86de0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -1,9 +1,9 @@ package com.ruoyi.system.mapper; -import java.util.List; - -import org.apache.ibatis.annotations.Param; import com.ruoyi.common.core.domain.entity.SysUser; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 用户表 数据层 @@ -144,11 +144,11 @@ public interface SysUserMapper */ SysUser selectUserByIdCard(@Param("idCard")String identityNo); /** - * 根据手机号查询用户信息 - * @param phone + * 根据邮箱查询用户信息 + * @param email * @return */ - SysUser selectUserByPhone(@Param("phone")String phone); + SysUser selectUserByEmail(@Param("email")String email); /** * 根据部门和角色查询用户 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java index 8ea3d50..95439b9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -67,4 +67,11 @@ public interface SysUserRoleMapper * @param roleId */ void insertUserRole(@Param("userId")Long userId, @Param("roleId")Long roleId); + + /** + * 根据用户id查询关联的角色id + * @param userId + * @return + */ + public List selectRoleIdsByUserId(@Param("userId") Long userId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/log/MsRequestLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/log/MsRequestLogMapper.java new file mode 100644 index 0000000..9274729 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/log/MsRequestLogMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.log; + +import com.ruoyi.system.domain.entity.log.MsRequestLog; +import tk.mybatis.mapper.common.Mapper; + +public interface MsRequestLogMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java index 6ed7801..e134bc6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java @@ -1,18 +1,15 @@ package com.ruoyi.system.service; import com.alibaba.fastjson.JSONObject; -import com.ruoyi.wisdomarbitrate.domain.entity.casestatus.MsCaseStatus; +import com.ruoyi.common.enums.AttachmentOperateTypeEnum; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; -import org.apache.ibatis.annotations.Case; -import org.apache.poi.hmef.Attachment; -import org.springframework.web.multipart.MultipartFile; import java.io.File; public interface BeiMingInterface { /** - * 1.获取北明接口令牌token + * 1.获取北明接口令牌token对象 * * @param userName * @param password @@ -73,5 +70,13 @@ public interface BeiMingInterface { * @param caseNo 案件编号 * @return */ - JSONObject pushAttachmentInfo(String username, String password, File file, String abutmentId, String syncSource, String caseNo); + MsCaseFileInfo pushAttachmentInfo(String username, String password, File file, String syncSource, String caseNo, AttachmentOperateTypeEnum operateTypeEnum); + + /** + * 删除附件 + * @param file + * @param caseNo + * @return + */ + public JSONObject deleteAttachmentInfo( String caseNo,String fileId,String fileName); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/MsRequestLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/MsRequestLogService.java new file mode 100644 index 0000000..350f3f5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/MsRequestLogService.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.entity.log.MsRequestLog; + +/** + * @Classname MsRequestLogService + * @Description TODO + * @Version 1.0.0 + * @Date 2024/4/2 14:18 + * @Created wangqiong + */ +public interface MsRequestLogService { + void insert(MsRequestLog requestLog); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java index 50ad1c8..e0ad538 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java @@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.system.domain.entity.log.MsRequestLog; import com.ruoyi.system.service.BeiMingInterface; +import com.ruoyi.system.service.MsRequestLogService; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; import com.ruoyi.wisdomarbitrate.utils.CommonInputStreamResource; @@ -15,6 +18,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestClientException; @@ -22,6 +26,8 @@ import org.springframework.web.client.RestTemplate; import java.io.File; import java.io.FileInputStream; +import java.util.Date; +import java.util.Objects; import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt; import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; @@ -34,6 +40,10 @@ import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; public class BeiMingInterfaceService implements BeiMingInterface { @Autowired RestTemplate restTemplate; + @Autowired + MsRequestLogService requestLogService; + @Autowired + BeiMingInterfaceService beiMingInterfaceService; /** * 接口地址 */ @@ -46,6 +56,13 @@ public class BeiMingInterfaceService implements BeiMingInterface { public String apiprefix; @Value("${beimingprivatekey}") public String privateKey; + // 北明配置 + @Value("${BMConfig.userName}") + private String BMUserName; + @Value("${BMConfig.password}") + private String BMPassword; + @Value("${BMConfig.syncSource}") + private String BMSyncSource; /** * 1.获取北明接口令牌token @@ -54,9 +71,11 @@ public class BeiMingInterfaceService implements BeiMingInterface { * @param password * @param times */ + @Transactional @Override public String getApiToken(String userName, String password, Long times) { JSONObject result = new JSONObject(); + MsRequestLog requestLog = new MsRequestLog(); try { //设置请求头 HttpHeaders httpHeaders = new HttpHeaders(); @@ -79,13 +98,25 @@ public class BeiMingInterfaceService implements BeiMingInterface { System.out.println("encryptString:" + encryptString); fromEntity = new HttpEntity(body, httpHeaders); String url = apihost + apiprefix + "/getToken"; + + requestLog.setRequestUrl(url); + requestLog.setContent(param.toString()); + requestLog.setCreateTime((new Date())); + requestLog.setStatus(0); result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + requestLog.setReturnContent(result!=null?result.toString():null); } catch (RestClientException e) { e.printStackTrace(); + requestLog.setReason(e.getMessage()); + requestLog.setStatus(1); + requestLogService.insert(requestLog); + throw new ServiceException("推送失败"); } - return result.toString(); + requestLogService.insert(requestLog); + return analysisResultToken(Objects.requireNonNull(result).toString()); } + /** * 解析加密后端token * @@ -97,9 +128,7 @@ public class BeiMingInterfaceService implements BeiMingInterface { if (token != null && !token.isEmpty()) { JSONObject jsonObject = JSON.parseObject(token); String tokenString = jsonObject.getString("data"); - System.out.println("data信息:" + tokenString); String tokenstr = sm4Decrypt(tokenString, privateKey); - System.out.println("解密后的字符串:" + tokenstr); if (tokenstr != null && !tokenstr.isEmpty()) { JSONObject tokenObject = JSON.parseObject(tokenstr); resultToken = tokenObject.getString("token"); @@ -117,9 +146,11 @@ public class BeiMingInterfaceService implements BeiMingInterface { * @param syncSource 同步来源(账户名) * @return */ + @Transactional @Override public JSONObject submitCaseStatusInfo(String token, String abutmentId, String syncSource, MsCaseStatusInfo msCaseStatusInfo) { JSONObject result = new JSONObject(); + MsRequestLog requestLog = new MsRequestLog(); try { //设置请求头 HttpHeaders httpHeaders = new HttpHeaders(); @@ -146,10 +177,20 @@ public class BeiMingInterfaceService implements BeiMingInterface { fromEntity = new HttpEntity(body, httpHeaders); String url = apihost + apiprefix + "/caseMediation/status"; + requestLog.setRequestUrl(url); + requestLog.setContent(param.toString()); + requestLog.setCreateTime((new Date())); + requestLog.setStatus(0); result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + requestLog.setReturnContent(result!=null?result.toString():null); } catch (RestClientException e) { e.printStackTrace(); + requestLog.setReason(e.getMessage()); + requestLog.setStatus(1); + requestLogService.insert(requestLog); + throw new ServiceException("推送失败"); } + requestLogService.insert(requestLog); return result; } @@ -160,11 +201,13 @@ public class BeiMingInterfaceService implements BeiMingInterface { * @param file * @return */ + @Transactional @Override public JSONObject uploadFile(File file, String token, String syncSource) { System.out.println("文件:" + file.getName()); System.out.println("文件:" + file.toString()); JSONObject result = new JSONObject(); + MsRequestLog requestLog = new MsRequestLog(); try { //设置请求头 HttpHeaders httpHeaders = new HttpHeaders(); @@ -184,10 +227,20 @@ public class BeiMingInterfaceService implements BeiMingInterface { requestBody.add("file", commonInputStreamResource); HttpEntity fromEntity = new HttpEntity(requestBody, httpHeaders); String url = apihost + apiprefix + "/uploadFile"; + requestLog.setRequestUrl(url); + requestLog.setContent(fromEntity.toString()); + requestLog.setCreateTime((new Date())); + requestLog.setStatus(0); result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + requestLog.setReturnContent(result!=null?result.toString():null); } catch (RestClientException e) { e.printStackTrace(); + requestLog.setReason(e.getMessage()); + requestLog.setStatus(1); + requestLogService.insert(requestLog); + throw new ServiceException("推送失败"); } + requestLogService.insert(requestLog); return result; } @@ -201,9 +254,11 @@ public class BeiMingInterfaceService implements BeiMingInterface { * @param msCaseFileInfo 案件附件信息 * @return */ + @Transactional @Override public JSONObject syncAttachmentInfo(String token, String syncSource, String action, String caseNo, MsCaseFileInfo msCaseFileInfo) { JSONObject result = new JSONObject(); + MsRequestLog requestLog = new MsRequestLog(); try { //设置请求头 HttpHeaders httpHeaders = new HttpHeaders(); @@ -238,21 +293,31 @@ public class BeiMingInterfaceService implements BeiMingInterface { body.put("encryptString", encryptString); fromEntity = new HttpEntity(body, httpHeaders); String url = apihost + apiprefix + "/caseMediation/attachment/accept"; + requestLog.setRequestUrl(url); + requestLog.setContent(param.toString()); + requestLog.setCreateTime((new Date())); + requestLog.setStatus(0); result = restTemplate.postForObject(url, fromEntity, JSONObject.class); + requestLog.setReturnContent(result!=null?result.toString():null); } catch (RestClientException e) { e.printStackTrace(); + requestLog.setReason(e.getMessage()); + requestLog.setStatus(1); + requestLogService.insert(requestLog); + throw new ServiceException("推送失败"); } + requestLogService.insert(requestLog); return result; } /** * 推送案件状态信息 */ + @Transactional @Override public JSONObject pushCaseStatusInfo(String username, String password, String caseNo, String statusCode, String caseClosureExplanation) { JSONObject result = new JSONObject(); - String token = getApiToken(username, password, System.currentTimeMillis()); - token = analysisResultToken(token); + String token = beiMingInterfaceService.getApiToken(username, password, System.currentTimeMillis()); if (token != null && !token.isEmpty()) { MsCaseStatusInfo info = MsCaseStatusInfo.builder().caseNo(caseNo).statusCode(statusCode).caseClosureExplanation(caseClosureExplanation).build(); result = submitCaseStatusInfo(token, caseNo, username, info); @@ -265,16 +330,16 @@ public class BeiMingInterfaceService implements BeiMingInterface { } return result; } - /** * 推送案件附件信息 */ + @Transactional @Override - public JSONObject pushAttachmentInfo(String username, String password, File file, String abutmentId, String syncSource, String caseNo) { + public MsCaseFileInfo pushAttachmentInfo(String username, String password, File file, String syncSource, String caseNo,AttachmentOperateTypeEnum operateTypeEnum) { JSONObject result = new JSONObject(); + MsCaseFileInfo fileInfo=null; //1.获取token - String token = getApiToken(username, password, System.currentTimeMillis()); - token = analysisResultToken(token); + String token = beiMingInterfaceService.getApiToken(username, password, System.currentTimeMillis()); if (token != null && !token.isEmpty()) { //2.上传文件 JSONObject fileResult = uploadFile(file, token, syncSource); @@ -289,16 +354,25 @@ public class BeiMingInterfaceService implements BeiMingInterface { System.out.println("fileId====:" + fileId); if (fileId != null) { //3.同步附件更新信息 - MsCaseFileInfo fileInfo = MsCaseFileInfo.builder().fileId(fileId).fileName(file.getName()).abutmentId(abutmentId).abutmentCaseId(caseNo).documentSubject("EVEDENT").documentType("EVEDENT_METERIAL").build(); - result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.ADD.getCode(), caseNo, fileInfo); - result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.UPD.getCode(), caseNo, fileInfo); - result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.DEL.getCode(), caseNo, fileInfo); + fileInfo = MsCaseFileInfo.builder().fileId(fileId).fileName(file.getName()).abutmentId(fileId).abutmentCaseId(caseNo).documentSubject("EVEDENT").documentType("EVEDENT_METERIAL").build(); + result = syncAttachmentInfo(token, username, operateTypeEnum.getCode(), caseNo, fileInfo); + // 更新到附件表将fileId +// result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.UPD.getCode(), caseNo, fileInfo); +// result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.DEL.getCode(), caseNo, fileInfo); } } } } } - return result; + return fileInfo; + } + + @Override + public JSONObject deleteAttachmentInfo( String caseNo,String fileId,String fileName) { + String token = beiMingInterfaceService.getApiToken(BMUserName, BMPassword, System.currentTimeMillis()); + MsCaseFileInfo fileInfo = MsCaseFileInfo.builder().fileId(fileId).fileName(fileName).abutmentId(fileId).abutmentCaseId(caseNo).documentSubject("EVEDENT").documentType("EVEDENT_METERIAL").build(); + + return syncAttachmentInfo(token, BMUserName, AttachmentOperateTypeEnum.DEL.getCode(), caseNo, fileInfo); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java new file mode 100644 index 0000000..2e3e871 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java @@ -0,0 +1,24 @@ +package com.ruoyi.system.service.impl; + +import com.ruoyi.system.domain.entity.log.MsRequestLog; +import com.ruoyi.system.mapper.log.MsRequestLogMapper; +import com.ruoyi.system.service.MsRequestLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Classname MsRequestLogServiceImpl + * @Description TODO + * @Version 1.0.0 + * @Date 2024/4/2 14:19 + * @Created wangqiong + */ +@Service +public class MsRequestLogServiceImpl implements MsRequestLogService { + @Autowired + private MsRequestLogMapper logMapper; + @Override + public void insert(MsRequestLog requestLog) { + logMapper.insert(requestLog); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index e5c8307..ccc6b16 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -1,17 +1,13 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.stream.Collectors; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; @@ -20,6 +16,13 @@ import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.service.ISysDeptService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; /** * 部门管理 服务实现 @@ -34,6 +37,8 @@ public class SysDeptServiceImpl implements ISysDeptService @Autowired private SysRoleMapper roleMapper; + @Autowired + private RedisCache redisCache; /** * 查询部门管理数据 @@ -221,7 +226,9 @@ public class SysDeptServiceImpl implements ISysDeptService } dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); } - return deptMapper.insertDept(dept); + int i = deptMapper.insertDept(dept); + redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId()); + return i; } /** @@ -249,6 +256,8 @@ public class SysDeptServiceImpl implements ISysDeptService // 如果该部门是启用状态,则启用该部门的所有上级部门 updateParentDeptStatusNormal(dept); } + // 修改缓存 + redisCache.setCacheObject(CacheConstants.DEPT_KEY+dept.getDeptName(),dept.getDeptId()); return result; } @@ -293,6 +302,11 @@ public class SysDeptServiceImpl implements ISysDeptService @Override public int deleteDeptById(Long deptId) { + SysDept sysDept = deptMapper.selectDeptById(deptId); + if(sysDept!=null) { + // 删除缓存 + redisCache.deleteObject(CacheConstants.DEPT_KEY + sysDept.getDeptName()); + } return deptMapper.deleteDeptById(deptId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index d6cee80..c56b093 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -1,17 +1,12 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; +import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; @@ -24,6 +19,12 @@ import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysRoleMenuMapper; import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.service.ISysRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; /** * 角色 业务层处理 @@ -44,6 +45,8 @@ public class SysRoleServiceImpl implements ISysRoleService @Autowired private SysRoleDeptMapper roleDeptMapper; + @Autowired + private RedisCache redisCache; /** * 根据条件分页查询角色数据 @@ -233,6 +236,7 @@ public class SysRoleServiceImpl implements ISysRoleService { // 新增角色信息 roleMapper.insertRole(role); + redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId()); return insertRoleMenu(role); } @@ -250,6 +254,7 @@ public class SysRoleServiceImpl implements ISysRoleService roleMapper.updateRole(role); // 删除角色与菜单关联 roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); + redisCache.setCacheObject(CacheConstants.ROLE_KEY+role.getRoleName(),role.getRoleId()); return insertRoleMenu(role); } @@ -341,10 +346,15 @@ public class SysRoleServiceImpl implements ISysRoleService @Transactional public int deleteRoleById(Long roleId) { + // 根据角色id查询角色名 + SysRole role = roleMapper.selectRoleById(roleId); // 删除角色与菜单关联 roleMenuMapper.deleteRoleMenuByRoleId(roleId); // 删除角色与部门关联 roleDeptMapper.deleteRoleDeptByRoleId(roleId); + if(role!=null) { + redisCache.deleteObject(CacheConstants.ROLE_KEY + role.getRoleName()); + } return roleMapper.deleteRoleById(roleId); } @@ -358,6 +368,11 @@ public class SysRoleServiceImpl implements ISysRoleService @Transactional public int deleteRoleByIds(Long[] roleIds) { + List roles = roleMapper.selectRoleList(new SysRole()); + if(CollectionUtil.isEmpty(roles)){ + return 0; + } + Map roleMap = roles.stream().collect(Collectors.toMap(SysRole::getRoleId, SysRole::getRoleName, (n1, n2) -> n2)); for (Long roleId : roleIds) { checkRoleAllowed(new SysRole(roleId)); @@ -367,6 +382,9 @@ public class SysRoleServiceImpl implements ISysRoleService { throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); } + if(roleMap.containsKey(roleId)) { + redisCache.deleteObject(CacheConstants.ROLE_KEY + roleMap.get(roleId)); + } } // 删除角色与菜单关联 roleMenuMapper.deleteRoleMenu(roleIds); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java index 437a075..efdce9e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java @@ -1,5 +1,6 @@ package com.ruoyi.wisdomarbitrate.domain.entity.mscase; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -7,161 +8,128 @@ import lombok.ToString; import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.Table; +import javax.persistence.Transient; import java.util.Date; @Getter @Setter @ToString @Table(name = "ms_case_affiliate") -public class MsCaseAffiliate { +public class MsCaseAffiliate{ + /** + * id + */ + @Id + @Column(name = "id") + private Long id; /** * 案件主表id,案件申请表主键 */ - @Id @Column(name = "case_appli_id") private Long caseAppliId; /** - * 是否机构申请,0-自然人,1-申请机构,默认0 + * 用户id,用户表user_id关联 */ - @Column(name = "organize_flag") - private Integer organizeFlag; - - + @Column(name = "user_id") + private Long userId; /** - * 申请人id + * 申请机构id,和部门表id关联 */ - @Column(name = "application_id") - private String applicationId; - - /** - * 申请人名称 - */ - @Column(name = "application_name") - private String applicationName; + @Column(name = "applicant_dept_id") + private Long applicantDeptId; /** * 代码(统一社会信用代码或者身份证号) */ - @Column(name = "code") + @Transient private String code; - /** - * 申请人联系电话 - */ - @Column(name = "application_phone") - private String applicationPhone; - /** - * 申请人邮箱 - */ - @Column(name = "application_email") - private String applicationEmail; /** * 法定代表人 */ - @Column(name = "comp_legal_person") + @Transient private String compLegalPerson; + /** + * 角色类别,1-申请操作人/申请人,2-申请人代理人,3-被申请人操作人/被申请人,4-被申请人代理人 + */ + @Column(name = "role_type") + private Integer roleType=1; + /** + * 组别 + */ + @Column(name = "group_order") + private Integer groupOrder; + /** + * 是否操作人,0-否,1-是 + */ + @Column(name = "operator_flag") + private Integer operatorFlag=1; + /** + * 电话 + */ + @Transient + private String phone; + /** + * 邮箱 + */ + @Transient + private String email; + /** + * 姓名 + */ + @Transient + private String name; + /** + * 住所 + */ + @Transient + private String home; + /** + * 联系地址 + */ + @Transient + private String address; + /** + * 身份证号 + */ + @Transient + private String idCard; /** - * 申请人住所 + * '身份类别,0-身份证,1-护照,默认0' */ - @Column(name = "applicant_home") - private String applicantHome; - + @Transient + private Integer idType; /** - * 申请人联系地址 + * 国籍,0-境内,1-境外,默认0 */ - @Column(name = "applicant_address") - private String applicantAddress; - + @Transient + private Integer nationality; /** - * 委托代理人姓名 + * 生日 */ - @Column(name = "name_agent") - private String nameAgent; - + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai") + @Transient + private Date birth; /** - * 代理人联系电话 + * 性别,0-男,1-女 */ - @Column(name = "contact_telphone_agent") - private String contactTelphoneAgent; - - /** - * 代理人邮箱 - */ - @Column(name = "agent_email") - private String agentEmail; - - /** - * 申请人快递单号 - */ - @Column(name = "applicant_track_num") - private String applicantTrackNum; - + @Transient + private String sex; /** * 被申请人姓名 */ - @Column(name = "respondent_name") - private String respondentName; + @Transient + private String resName; + /** + * 角色名称 + */ + @Transient + private String roleName; + /** + * 申请机构名称 + */ + @Transient + private String applicantOrgName; - /** - * 被申请人身份证号 - */ - @Column(name = "respondent_identity_num") - private String respondentIdentityNum; - /** - * 被申请人联系电话 - */ - @Column(name = "respondent_phone") - private String respondentPhone; - - /** - * 被申请人性别(0=男,女=1) - */ - @Column(name = "respondent_sex") - private String respondentSex; - - /** - * 被申请人出生年月日 - */ - @Column(name = "respondent_birth") - private Date respondentBirth; - - /** - * 被申请人申请人住所 - */ - @Column(name = "respondent_home") - private String respondentHome; - - /** - * 被申请人邮箱 - */ - @Column(name = "respondent_email") - private String respondentEmail; - - /** - * 被申请人快递单号 - */ - @Column(name = "respondent_track_num") - private String respondentTrackNum; - - /** - * 申请人是否签收 - */ - @Column(name = "is_sign_apply") - private Integer isSignApply; - /** - * 被申请人是否签收 - */ - @Column(name = "is_sign_respon") - private Integer isSignRespon; - /** - * 身份类别,0-身份证,1-护照,默认0 - */ - @Column(name = "id_type") - private Integer idType; - /** - * 国籍,0-国内,1-国外,默认0 - */ - @Column(name = "nationality") - private Integer nationality; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java index 62ba0da..16c08cb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java @@ -6,10 +6,7 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; @@ -208,5 +205,20 @@ public class MsCaseApplication { */ @Column(name = "is_reconci") private Integer isReconci; + /** + * 是否机构申请,0-自然人,1-申请机构,默认0 + */ + @Column(name = "organize_flag") + private Integer organizeFlag; + /** + * 案件来源,YC-乙巢,空字符串-北明 + */ + @Column(name = "case_source") + private String caseSource; + /** + * 拒绝原因 + */ + @Transient + private String rejectReason; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAttach.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAttach.java index b0c4c49..287db7b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAttach.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAttach.java @@ -77,4 +77,9 @@ public class MsCaseAttach { */ @Column(name = "only_office_file_id") private String onlyOfficeFileId; + /** + * 对接其它系统返回的附件id + */ + @Column(name = "other_sys_file_id") + private String otherSysFileId; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateBase.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateBase.java new file mode 100644 index 0000000..e5c5e02 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateBase.java @@ -0,0 +1,32 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.mscase; + +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; +import lombok.Data; + +/** + * @Classname MsCaseAffiliateList + * @Description TODO + * @Version 1.0.0 + * @Date 2024/3/27 16:08 + * @Created wangqiong + */ +@Data +public class MsCaseAffiliateBase { + /** + * 申请人/操作人 + */ + private MsCaseAffiliate applicant; + /** + * 申请人代理人 + */ + private MsCaseAffiliate applicantAgent; + /** + * 被申请人/操作人 + */ + private MsCaseAffiliate res; + /** + * 被申请人代理人 + */ + private MsCaseAffiliate resAgent; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateParent.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateParent.java new file mode 100644 index 0000000..0c9943c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateParent.java @@ -0,0 +1,11 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.mscase; + +/** + * @Classname MsCaseAffiliateParent + * @Description TODO + * @Version 1.0.0 + * @Date 2024/3/27 16:05 + * @Created wangqiong + */ +public class MsCaseAffiliateParent extends MsCaseAffiliateVO { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateVO.java new file mode 100644 index 0000000..1627382 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseAffiliateVO.java @@ -0,0 +1,32 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.mscase; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +/** + * @Classname MsCaseAffiliateVO + * @Description TODO + * @Version 1.0.0 + * @Date 2024/3/22 11:46 + * @Created wangqiong + */ +@Getter +@Setter +@ToString +@Data +public class MsCaseAffiliateVO { + /** + * 申请人/操作人 + */ + private List applicant; + + /** + * 被申请人/操作人 + */ + private List res; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index 7e98510..1628f50 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -107,5 +107,18 @@ public class MsCaseApplicationReq { * 代理人电话 */ private String contactTelphoneAgent; + /** + * 邮箱 + */ + private String resEmail; + /** + * 申请人邮箱 + */ + private String email; + /** + * 角色类别 + */ + private Integer roleType; + private Long userId; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java index e814d11..107ca6a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java @@ -1,7 +1,6 @@ package com.ruoyi.wisdomarbitrate.domain.vo.mscase; import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import lombok.AllArgsConstructor; @@ -34,7 +33,7 @@ public class MsCaseApplicationVO extends MsCaseApplication { /** * 案件相关人员 */ - private MsCaseAffiliate affiliate; + private MsCaseAffiliateVO affiliate; /** * 是否压缩包导入,默认false */ @@ -84,5 +83,17 @@ public class MsCaseApplicationVO extends MsCaseApplication { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") private Date endTime; + /** + * 是否申请操作人,0-否,1-是 + */ + private Integer appOperatorFlag; + /** + * 是否被申请操作人,0-否,1-是 + */ + private Integer resOperatorFlag; + /** + * 是否财务,部门长,秘书,0-否,1-是 + */ + private Integer otherFlag; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAffiliateMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAffiliateMapper.java index c05d979..d721fb6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAffiliateMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseAffiliateMapper.java @@ -1,7 +1,30 @@ package com.ruoyi.wisdomarbitrate.mapper.mscase; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; +import org.apache.ibatis.annotations.Param; import tk.mybatis.mapper.common.Mapper; +import java.util.List; + public interface MsCaseAffiliateMapper extends Mapper { + /** + * 查询申请人被申请人 + * @param caseIds + * @return + */ + List listGroupConcat(@Param("caseIds") List caseIds); + + /** + * 根据案件id查询案件人员 + * @param id + * @return + */ + List selectByCaseId(@Param("id") Long id); + + /** + * 根据案件id查询相关人员及角色 + * @param id + * @return + */ + List selectUserRoleByCaseIds(@Param("caseIds") List caseIds); } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java index 61ef9d7..6780ee2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java @@ -29,125 +29,14 @@ public interface MsCaseApplicationMapper extends Mapper { " ") Integer selectCaseNumLike(@Param("caseNum") String caseNum, @Param("length") int length); - /** + /** * 案件列表查询 * @param req - * @param caseStatusNames + * @param caseFlowIds * @return */ - @Select("") - List list(@Param("req")MsCaseApplicationReq req, @Param("caseStatusNames") List caseStatusNames); + List list(@Param("req")MsCaseApplicationReq req, @Param("caseFlowIds") List caseFlowIds , @Param("roleIds") List roleIds ); /** * 查询调解员列表 @@ -162,46 +51,5 @@ public interface MsCaseApplicationMapper extends Mapper { @Select("select max(room_id) maxRoomId from ms_reserved_conference") Long selectMaxRoomId(); - /** - * 待办数量 - * @param o - * @return - */ - @Select(" " - ) - List todoCount(@Param("req")MsCaseApplicationReq req, @Param("caseStatusNames") List caseStatusNames); + List todoCount(@Param("req")MsCaseApplicationReq req, @Param("caseFlowIds") List caseFlowIds, @Param("roleIds") List roleIds); } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index c3c8d03..e34709e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -1,9 +1,13 @@ package com.ruoyi.wisdomarbitrate.service.mscase; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SMSNotice; +import com.ruoyi.common.core.domain.entity.SMSNoticeDO; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.enums.PushCaseStatusEnum; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; @@ -49,6 +53,20 @@ public interface MsCaseApplicationService { * @return */ String insert(MsCaseApplicationVO caseApplication); + /** + * 设置案件相关信息 + * @param caseApplication + * @param affiliate + * @param groupOrder 组别 + */ + public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder); + /** + * 新增案件相关人员信息 + * @param affiliate 相关人员信息 + * @param roleId 角色id + + */ + public void insertAfficateUser(MsCaseAffiliate affiliate, List roleIdList); /** * 新增案件 @@ -62,13 +80,7 @@ public interface MsCaseApplicationService { * @return */ AjaxResult batchInsert(MsCaseBatchInsertVO vo); - /** - * 新增用户 - * @param affiliate - * @param agentFlag 是否代理人,0-否,1-是 - * @param roleId - */ - void insertApplicantUser( MsCaseAffiliate affiliate,boolean agentFlag, Long roleId); + /** * 新增申请机构代理人 * @param affiliate @@ -150,6 +162,13 @@ public interface MsCaseApplicationService { * @return */ AjaxResult submit(MsCaseApplication req); + /** + * 北明推送案件状态 + * @param caseApplication 案件 + * @param pushCaseStatusEnum 案件状态 + * @return + */ + public JSONObject pushStatusToBM(MsCaseApplication caseApplication, PushCaseStatusEnum pushCaseStatusEnum); /** * 删除案件 * @param req @@ -204,22 +223,16 @@ public interface MsCaseApplicationService { AjaxResult updateTrialPen(MsCaseAttach attach); - /** - * 确认调解书 - * @param attach - * @return - */ - AjaxResult confirmMediation(MsCaseAttachVO attach) throws EsignDemoException, InterruptedException ; /** * 生成调解申请书 * @param application 案件基本信息 - * @param affiliate 案件相关人员 + * @param affiliates 案件相关人员 * @param templatePath 模板路径 * @param bookmarkList 标签 * @param dictDataList 内置字段 */ - void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; + void createMediateApplication(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; /** * 调解书上传到onlyoffice服务器 * @param annexPath @@ -231,8 +244,15 @@ public interface MsCaseApplicationService { * @param req * @param affiliateMap */ - void accept(MsCaseApplication application, MsCaseApplicationVO req, Map affiliateMap) ; + void accept(MsCaseApplication application, MsCaseApplicationVO req, Map> affiliateMap) ; /** + * 受理分配通知 + * @param application 案件基本信息 + * @param affiliates 案件人员 + * @param applicantFlag 是否申请人 + */ + public void isAcceptNotice(MsCaseApplication application, List affiliates, Boolean applicantFlag); + /** * 判断申请人/被申请人是否预约 * @param vo * @param userIds 选择的调解员ids @@ -268,4 +288,49 @@ public interface MsCaseApplicationService { */ AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach); + /** + * 发送短信 + * @param smsFlag 短信是否发送成功 + * @param application 案件基本信息 + * @param affiliate 案件人员 + * @param sendContent 发送内容 + */ + public void sendSMS(Boolean smsFlag ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent); + /** + * 发送邮件 + * @param application 案件基本信息 + * @param affiliate 案件人员 + * @param subject 主题 + * @param sendContent 内容 + */ + public void sendEmail(MsCaseApplication application, MsCaseAffiliate affiliate, String subject, String sendContent); + /** + * 发送开庭日期短信 + * @param application + * @param affiliates + */ + public void sendHearDateSms(MsCaseApplication application, List affiliates); + /** + * 发送短信 + * @param application + * @param affiliate + * @param notice + */ + public void sendNotice(MsCaseApplication application, MsCaseAffiliate affiliate, + SMSNoticeDO notice); + /** + * 申请操作人/被申操作人发送通知 + * @param application + * @param affiliates + * @param applicantFlag + * @param notice + */ + public void sendNotice(MsCaseApplication application, List affiliates, Boolean applicantFlag, + SMSNotice notice); + /** + * 根据案件id查询案件相关人员 + * @param id + * @return + */ + public List selectAffliatesByCaseId(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java index f51d36f..faf1ca3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java @@ -64,4 +64,11 @@ public interface MsCasePaymentService { */ public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto); + + /** + * 发送受理短信 + * @param dto + * @param caseAppllication + */ + public void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java index e364b3c..5fe23f2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java @@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord; -import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO; import java.io.IOException; @@ -13,7 +12,7 @@ import java.util.List; public interface MsSignSealService { - AjaxResult sureMediationSeal(MsCaseApplicationVO caseApplication) throws EsignDemoException, InterruptedException; + AjaxResult sealApply(MsSignSealDTO dto); @@ -30,12 +29,6 @@ public interface MsSignSealService { AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException; - AjaxResult msCaseSignUrlResPC(MsSignSealDTO dto) throws EsignDemoException; - - AjaxResult msCaseSignUrlApplyAPP(MsSignSealDTO dto) throws EsignDemoException; - - AjaxResult msCaseSignUrlResAPP(MsSignSealDTO dto) throws EsignDemoException; - AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException; AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java index b29be4c..7355d46 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java @@ -44,7 +44,7 @@ public interface VideoConferenceService { * @param userId * @return */ - AjaxResult secretaryRoleByUserId(Long userId); + AjaxResult secretaryRoleByUserId(Long userId, Long caseId); /** * 根据html字符串转pdf并和案件关联 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 9dc3503..5fe3ec4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -2,6 +2,8 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; @@ -12,14 +14,13 @@ import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.*; import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.enums.AnnexTypeEnum; -import com.ruoyi.common.enums.MediatorTypeEnum; -import com.ruoyi.common.enums.TemplateTypeEnum; -import com.ruoyi.common.enums.YesOrNoEnum; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.*; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.*; @@ -30,9 +31,11 @@ import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; +import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule; import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage; @@ -43,6 +46,7 @@ import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.*; +import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper; import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper; @@ -94,6 +98,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { private String arbitrateUrl; @Value("${onlyOfficeConfig.url}") private String onlyOfficeUrl; + // 北明配置 + @Value("${BMConfig.userName}") + private String BMUserName; + @Value("${BMConfig.password}") + private String BMPassword; + @Value("${BMConfig.syncSource}") + private String BMSyncSource; @Autowired MsCaseApplicationService caseApplicationService; @Autowired @@ -148,6 +159,16 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { private MsSealSignRecordMapper sealSignRecordMapper; @Autowired private MsCaseAuditMapper auditMapper; + @Autowired + private RedisCache redisCache; + @Autowired + private EmailOutUtil emailOutUtil; + @Autowired + private SendMailRecordMapper sendMailRecordMapper; + @Autowired + BeiMingInterfaceService beiMingInterfaceService; + @Value("${beimingprivatekey}") + public String privateKey; // 案件基本字段 public static final List CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule"); public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd"); @@ -160,23 +181,25 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Override public List list(MsCaseApplicationReq req) { - + // 是否调解员 + boolean isMediatorRole=false; // 根据用户查询角色 LoginUser loginUser = SecurityUtils.getLoginUser(); // 根据id查询用户 SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId()); - List roles = loginUser.getUser().getRoles(); - if (StrUtil.equals(SecurityUtils.getUsername(), "admin")||CollectionUtil.isEmpty(roles)) { - // 如果角色为空,按admin处理,查所有案件 + List roles = sysUser.getRoles(); + req.setUserName(sysUser.getUserName()); + if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { startPage(); - List list = msCaseApplicationMapper.list(req, null); - for (MsCaseApplicationVO vo : list) { - vo.setSignButtonFlag(0); - } + List list = msCaseApplicationMapper.list(req, null,null); + // 设置申请人被申请人及签名按钮限 + setAfflicate(isMediatorRole,list,loginUser.getUserId(),roles); return list; } - req.setUserName(SecurityUtils.getUsername()); - req.setContactTelphoneAgent(sysUser.getPhonenumber()); + if(CollectionUtil.isEmpty(roles) ){ + throw new RuntimeException("用户未分配角色,请联系管理员"); + } + List roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); // 根据角色查询关联的案件状态 Example example = new Example(MsCaseFlowRoleRelated.class); example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); @@ -191,64 +214,134 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (CollectionUtil.isEmpty(caseFlows)) { throw new ServiceException("该角色为绑定案件流程"); } - // Map flowMap = caseFlows.stream().collect(Collectors.toMap(MsCaseFlow::getButtonAuthFlag, Function.identity())); - List caseStatusNames = caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()); - // 是否调解员 - boolean isMediatorRole=false; - // 如果是申请人,可以看见申请人为自己(即自然人)或者委托代理人为自己的案件(即机构) + List caseFlowIds = caseFlows.stream().map(MsCaseFlow::getId).collect(Collectors.toList()); + // 是否查询所有 + boolean isSelectAll = false; + for (SysRole role : roles) { if(StrUtil.isNotEmpty(role.getRoleName())){ - if(StrUtil.equals(role.getRoleName(),"申请人")) { - List applicationOrganIds=new ArrayList<>(); - applicationOrganIds.add(sysUser.getUserId()); - caseStatusNames.add("待调解"); - req.setApplicantFlag(1); - // 根据用户查询部门ids - List deptList = sysDeptMapper.selectDeptByUserId(loginUser.getUserId()); - if(CollectionUtil.isNotEmpty(deptList)) { - List deptIds = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()); - applicationOrganIds.addAll(deptIds); - - } - req.setApplicationOrganIds(applicationOrganIds); - break; - } - if(StrUtil.equals(role.getRoleName(),"被申请人")){ - caseStatusNames.add("待调解"); - req.setRespondentIdentityNum(sysUser.getIdCard()); - break; + if(StrUtil.contains(role.getRoleName(),"财务") + ||StrUtil.contains(role.getRoleName(),"法律顾问") + ||StrUtil.contains(role.getRoleName(),"部门长") + ){ + isSelectAll=true; + roleIds=null; } if(StrUtil.equals(role.getRoleName(),"调解员")) { isMediatorRole=true; req.setMediatorId(String.valueOf(sysUser.getUserId())); - break; } } } + if(!isSelectAll){ + req.setUserId(loginUser.getUserId()); + } if(req.getMediationMethod()!=null){ // 查询视频审理 req.setCaseFlowId(9); } startPage(); + // 查询案件列表 - List list = msCaseApplicationMapper.list(req, caseStatusNames); - if (CollectionUtil.isNotEmpty(list)) { - // 判断调解员签名按钮权限,0-显示,1-不显示 - for (MsCaseApplicationVO vo : list) { - // 如果是调解员并且是和解协议并且是代签名状态,不显示 - if (isMediatorRole && vo.getMediaResult()!=null && vo.getMediaResult()==5 && vo.getCaseStatusName().equals("待签名")) { - // 是调解员并且是和解协议,不显示 - vo.setSignButtonFlag(1); - - }else { - vo.setSignButtonFlag(0); - } - } - - } + List list = msCaseApplicationMapper.list(req, caseFlowIds,roleIds); + // 设置申请人被申请人及签名按钮限 + setAfflicate(isMediatorRole,list,loginUser.getUserId(),roles); return list; } + /** + * 设置申请人被申请人及签名按钮限 + * @param isMediatorRole 是否调解员 + * @param list + * @param loginUserId 当前登录用户id + */ + private void setAfflicate(boolean isMediatorRole,List list,Long loginUserId, List roles ) { + if(CollectionUtil.isEmpty(list)){ + return; + } + // 查询申请人和被申请人 + List caseIds = list.stream().map(MsCaseApplicationVO::getId).collect(Collectors.toList()); + + + List affiliateList = msCaseAffiliateMapper.selectUserRoleByCaseIds(caseIds); + // 根据案件id分组 + Map> affiliateMap=null; + if(CollectionUtil.isNotEmpty(affiliateList)){ + affiliateMap = affiliateList.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getCaseAppliId)); + } + + for (MsCaseApplicationVO vo : list) { + // 设置申请人和被申请人 + if(affiliateMap!=null && affiliateMap.containsKey(vo.getId())){ + List affiliates = affiliateMap.get(vo.getId()); + StringBuilder applicantName = new StringBuilder(); + StringBuilder respondentName = new StringBuilder(); + for (MsCaseAffiliate affiliate : affiliates) { + // 当前用户是操作人 + if(affiliate.getUserId()!=null && affiliate.getUserId().equals(loginUserId) + && affiliate.getRoleType()!=null && affiliate.getOperatorFlag()!=null && affiliate.getOperatorFlag()==1) { + if (vo.getAppOperatorFlag() == null && (affiliate.getRoleType()==1 || affiliate.getRoleType()==2)) { + // 设置申请操作人标记 + vo.setAppOperatorFlag(1); + + } + if (vo.getResOperatorFlag() == null && (affiliate.getRoleType()==3 || affiliate.getRoleType()==4)) { + // 设置被申请操作人标记 + vo.setResOperatorFlag(1); + + } + } + if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") + && affiliate.getRoleType()!=null && affiliate.getRoleType()==1){ + applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") + && affiliate.getRoleType()!=null && affiliate.getRoleType()==3){ + respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + + } + vo.setApplicationName(removeLastComma(applicantName.toString(),Constants.CN_SPLIT_COMMA)); + vo.setRespondentName(removeLastComma(respondentName.toString(),Constants.CN_SPLIT_COMMA)); + } + // 判断调解员签名按钮权限,0-显示,1-不显示,如果是调解员并且是和解协议并且是代签名状态,不显示 + if (isMediatorRole && vo.getMediaResult()!=null && vo.getMediaResult()==5 && vo.getCaseStatusName().equals("待签名")) { + // 是调解员并且是和解协议,不显示 + vo.setSignButtonFlag(1); + + }else { + vo.setSignButtonFlag(0); + } + for (SysRole role : roles) { + if(StrUtil.isNotEmpty(role.getRoleName())){ + if(StrUtil.contains(role.getRoleName(),"财务") + ||StrUtil.contains(role.getRoleName(),"法律顾问") + ||StrUtil.contains(role.getRoleName(),"部门长") + ||StrUtil.contains(role.getRoleName(),"调解员") + ){ + vo.setOtherFlag(1); + } + + } + } + } + } + + /** + * 去除字符串末尾特殊字符 + * @param input 字符串 + * @param str 去除字符串末尾的特殊字符 + * @return + */ + public String removeLastComma(String input,String str) { + if(StrUtil.isEmpty(input)){ + return input; + } + if (input.endsWith(str)) { + return input.substring(0, input.length() - 1); + } + return input; // 如果没有末尾逗号,则直接返回原字符串 + } /** * 首页代办数量 * @return @@ -256,96 +349,93 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override public CaseToDoCountVO todoCount() { CaseToDoCountVO vo = new CaseToDoCountVO(); - List selectTodoList=null; + List selectTodoList = null; // 根据用户查询角色 LoginUser loginUser = SecurityUtils.getLoginUser(); // 根据id查询用户 SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId()); - List roles = loginUser.getUser().getRoles(); - - // 根据角色查询关联的案件状态 - Example example = new Example(MsCaseFlowRoleRelated.class); - - // 如果是admin,查询所有案件流程 - if (CollectionUtil.isNotEmpty(roles)) { - example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); - } - - List caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example); - if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) { - throw new ServiceException("该角色为绑定案件流程"); - } + List roles =sysUser.getRoles(); + // 查询所有流程 Example flowExample = new Example(MsCaseFlow.class); flowExample.setOrderByClause("sort asc"); - flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList())); - List caseFlows = caseFlowMapper.selectByExample(flowExample); - if (CollectionUtil.isEmpty(caseFlows)) { - throw new ServiceException("该角色为绑定案件流程"); + List allCaseFlows = caseFlowMapper.selectByExample(flowExample); + if (CollectionUtil.isEmpty(allCaseFlows)) { + throw new ServiceException("未配置案件流程"); } - MsCaseApplicationReq req=new MsCaseApplicationReq(); + List caseFlows = allCaseFlows; + MsCaseApplicationReq req = new MsCaseApplicationReq(); if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) { - selectTodoList= msCaseApplicationMapper.todoCount( req,null); - }else { + selectTodoList = msCaseApplicationMapper.todoCount(req, null, null); + } else { + if (CollectionUtil.isEmpty(roles)) { + throw new RuntimeException("用户未分配角色,请联系管理员"); + } + List roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); + // 根据角色查询关联的案件状态 + Example example = new Example(MsCaseFlowRoleRelated.class); + example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList())); + List caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example); + if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) { + throw new ServiceException("该角色未配置案件流程,请联系管理员"); + } + flowExample = new Example(MsCaseFlow.class); + flowExample.setOrderByClause("sort asc"); + flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList())); + caseFlows = caseFlowMapper.selectByExample(flowExample); + if (CollectionUtil.isEmpty(caseFlows)) { + throw new ServiceException("该角色未配置案件流程,请联系管理员"); + } + List caseFlowIds = caseFlows.stream().map(MsCaseFlow::getId).collect(Collectors.toList()); + // 是否查询所有案件 + boolean isSelectAll = false; + // 查询案件列表 - req.setUserName(SecurityUtils.getUsername()); - req.setContactTelphoneAgent(sysUser.getPhonenumber()); - - List caseStatusNames = caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()); - // 如果是申请人,可以看见申请人为自己(即自然人)或者委托代理人为自己的案件(即机构) for (SysRole role : roles) { - if (StrUtil.isNotEmpty(role.getRoleName())) { - if (StrUtil.equals(role.getRoleName(), "申请人")) { - List applicationOrganIds = new ArrayList<>(); - applicationOrganIds.add(sysUser.getUserId()); - caseStatusNames.add("待调解"); - req.setApplicantFlag(1); - // 根据用户查询部门ids - List deptList = sysDeptMapper.selectDeptByUserId(loginUser.getUserId()); - if (CollectionUtil.isNotEmpty(deptList)) { - List deptIds = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()); - applicationOrganIds.addAll(deptIds); + if(StrUtil.contains(role.getRoleName(),"财务") + ||StrUtil.contains(role.getRoleName(),"法律顾问") + ||StrUtil.contains(role.getRoleName(),"部门长") + ){ + isSelectAll = true; + roleIds=null; - } - req.setApplicationOrganIds(applicationOrganIds); - break; - } - if (StrUtil.equals(role.getRoleName(), "被申请人")) { - caseStatusNames.add("待调解"); - req.setRespondentIdentityNum(sysUser.getIdCard()); - break; - } + } + if (StrUtil.isNotEmpty(role.getRoleName())) { if (StrUtil.equals(role.getRoleName(), "调解员")) { req.setMediatorId(String.valueOf(sysUser.getUserId())); - break; + } } } + // 如果多个角色中有财务,顾问,部门长,则调解员查询所有 + if(!isSelectAll){ + req.setUserId(loginUser.getUserId()); + } if (req.getMediationMethod() != null) { // 查询视频审理 req.setCaseFlowId(9); } - // 查询案件列表 - selectTodoList = msCaseApplicationMapper.todoCount(req, caseStatusNames); + + selectTodoList = msCaseApplicationMapper.todoCount(req, caseFlowIds, roleIds); } // 设置每个案件节点的数量 List toDoCountList = new ArrayList<>(); - Map todoMap =null; - if(CollectionUtil.isNotEmpty(selectTodoList)){ - todoMap = selectTodoList.stream().collect(Collectors.toMap(CaseToDoCount::getCaseFlowId, CaseToDoCount::getCaseCount, (n1, n2) -> n2)); + Map todoMap = null; + if (CollectionUtil.isNotEmpty(selectTodoList)) { + todoMap = selectTodoList.stream().collect(Collectors.toMap(CaseToDoCount::getCaseFlowId, CaseToDoCount::getCaseCount, (n1, n2) -> n2)); } for (MsCaseFlow caseFlow : caseFlows) { - if(StrUtil.isEmpty(caseFlow.getCaseStatusName())||StrUtil.equals(caseFlow.getCaseStatusName(),"结束")){ + if (StrUtil.isEmpty(caseFlow.getCaseStatusName()) || StrUtil.equals(caseFlow.getCaseStatusName(), "结束")) { continue; } CaseToDoCount caseToDoCount = new CaseToDoCount(); caseToDoCount.setCaseFlowId(caseFlow.getId()); caseToDoCount.setCaseStatusName(caseFlow.getCaseStatusName()); caseToDoCount.setFileName(caseFlow.getFileName()); - if(null==todoMap){ + if (null == todoMap) { caseToDoCount.setCaseCount(0L); - }else { + } else { caseToDoCount.setCaseCount(todoMap.getOrDefault(caseFlow.getId(), 0L)); } toDoCountList.add(caseToDoCount); @@ -373,14 +463,70 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { Example example = new Example(MsCaseApplication.class); example.createCriteria().andEqualTo("caseNum", caseNum); caseApplication = msCaseApplicationMapper.selectOneByExample(example); + id=caseApplication.getId(); } if(caseApplication==null){ return vo; } BeanUtil.copyProperties(caseApplication, vo); - // 查询案件相关人员 - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); - vo.setAffiliate(caseAffiliate); + // 根据案件id查询案件相关人员 + List msCaseAffiliates = selectAffliatesByCaseId(id); + MsCaseAffiliateVO affiliateVO = new MsCaseAffiliateVO(); + if(CollectionUtil.isNotEmpty(msCaseAffiliates)) { + Map> affliateMap = msCaseAffiliates.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getGroupOrder, Collectors.toList())); + + List applicantList = new ArrayList<>(); + List resList = new ArrayList<>(); + affiliateVO.setApplicant(applicantList); + affiliateVO.setRes(resList); + affliateMap.forEach((k,v)->{ + MsCaseAffiliateBase affiliateBase = null; + + MsCaseAffiliateBase resBase = null; + + for (MsCaseAffiliate affiliate : v) { + + switch (affiliate.getRoleType()){ + case 1: + if(affiliateBase==null){ + affiliateBase = new MsCaseAffiliateBase(); + } + affiliateBase.setApplicant(affiliate); + break; + case 2: + if(affiliateBase==null){ + affiliateBase = new MsCaseAffiliateBase(); + } + affiliateBase.setApplicantAgent(affiliate); + break; + case 3: + if(resBase==null){ + resBase = new MsCaseAffiliateBase(); + } + resBase.setRes(affiliate); + break; + case 4: + if(resBase==null){ + resBase = new MsCaseAffiliateBase(); + } + resBase.setResAgent(affiliate); + break; + default: + + break; + } + + } + if(affiliateBase!=null){ + applicantList.add(affiliateBase); + } + if(resBase!=null){ + resList.add(resBase); + } + }); + } + // todo + vo.setAffiliate(affiliateVO); // 查询附件 List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); vo.setCaseAttachList(caseAttachList); @@ -394,6 +540,16 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return vo; } + /** + * 根据案件id查询案件相关人员 + * @param id + * @return + */ + public List selectAffliatesByCaseId(Long id) { + + return msCaseAffiliateMapper.selectByCaseId(id); + } + /** * 新增案件 * @@ -404,13 +560,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override public String insert(MsCaseApplicationVO caseApplication) { - - // todo 第三方调用该接口,未绑定角色,暂时不根据角色查询流程,根据角色获取案件流程 - /** List caseFlows= selectCaseFlows(); - if (CollectionUtil.isEmpty(caseFlows)) { - throw new ServiceException("该角色未绑定案件流程"); - } - */ // 设置模板id,根据机构代码查询模板 Long templateId = getTemplate(); caseApplication.setTemplateId(templateId); @@ -429,6 +578,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Transactional @Override public String insert(MsCaseApplicationVO caseApplication, MsCaseFlow caseFlow) { + MsCaseAffiliateVO msCaseAffiliateVO = caseApplication.getAffiliate(); + if (null==msCaseAffiliateVO) { + throw new ServiceException("案件相关人员未填写"); + } if (caseApplication.getId() == null) { caseApplication.setId(IdWorkerUtil.getId()); } @@ -447,37 +600,32 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplication.setCreateBy(SecurityUtils.getUsername()); caseApplication.setUpdateBy(SecurityUtils.getUsername()); caseApplication.setVersion(1); - MsCaseAffiliate affiliate = caseApplication.getAffiliate(); - affiliate.setCaseAppliId(caseApplication.getId()); + + // 保存案件基本信息 if (msCaseApplicationMapper.insertSelective(caseApplication) > 0) { List caseAttachList = caseApplication.getCaseAttachList(); // 保存案件相关人员 - // 设置申请机构 - if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) { - // 组装申请机构 - // insertDept(affiliate); - // 新增申请机构和代理人 - caseApplicationService.insertAgentUser(affiliate); - }else if(StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==0){ - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - caseApplicationService.insertApplicantUser(affiliate,false,roleId); - caseApplicationService.insertApplicantUser(affiliate,true,roleId); + List applicant = msCaseAffiliateVO.getApplicant(); + List res = msCaseAffiliateVO.getRes(); + if(CollectionUtil.isNotEmpty(applicant)){ + for (int i = 0; i < applicant.size(); i++) { + // 申请人 + setCaseAfflicate(caseApplication, applicant.get(i).getApplicant(),i); + // 申请人代理人 + setCaseAfflicate(caseApplication, applicant.get(i).getApplicantAgent(),i); + } + } + if(CollectionUtil.isNotEmpty(res)){ + for (int i = 0; i < res.size(); i++) { + // 申请人 + setCaseAfflicate(caseApplication, res.get(i).getRes(),i); + // 申请人代理人 + setCaseAfflicate(caseApplication, res.get(i).getResAgent(),i); + } + } - } - // 压缩包导入,则根据身份证号获取性别和出生日期 - if (caseApplication.isImportFlag() && StrUtil.isNotEmpty(affiliate.getRespondentIdentityNum())) { - setBirthByIdentityNum(affiliate); - } - if (StrUtil.isNotEmpty(affiliate.getAgentEmail())) { - affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", "")); - } - if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) { - affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", "")); - } - msCaseAffiliateMapper.insert(affiliate); // 批量生成调解申请书 MsCaseApplicationReq req = new MsCaseApplicationReq(); req.setCaseFlowId(caseFlow.getId()); @@ -488,7 +636,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { req.setBatchNumber(caseApplication.getBatchNumber()); } // 生成调解申请书 - if(affiliate.getOrganizeFlag()==0){ + if(caseApplication.getOrganizeFlag()==0){ // 自然人 req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); }else { @@ -525,6 +673,178 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return ""; } + /** + * 设置案件相关信息 + * @param caseApplication + * @param affiliate + */ + @Transactional + public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder) { + if(affiliate==null || StrUtil.isEmpty(affiliate.getEmail()) || StrUtil.isEmpty(affiliate.getName())){ + return; + } + affiliate.setGroupOrder(groupOrder); + // 获取角色缓存 + Object commonCacheObj = redisCache.getCacheObject(CacheConstants.ROLE_KEY + "申请人操作人"); + Object RespondentCacheObj = redisCache.getCacheObject(CacheConstants.ROLE_KEY + "被申请人操作人"); + Object applicantObj = redisCache.getCacheObject(CacheConstants.ROLE_KEY + "申请人"); + Object respondentCacheObj = redisCache.getCacheObject(CacheConstants.ROLE_KEY + "被申请人"); + Object agentCacheObj = redisCache.getCacheObject(CacheConstants.ROLE_KEY + "委托代理人"); + + if(commonCacheObj==null || applicantObj==null || RespondentCacheObj==null || respondentCacheObj==null){ + throw new ServiceException("角色不全,请联系管理员新增角色"); + } + affiliate.setCaseAppliId(caseApplication.getId()); + List roleIdList = new ArrayList<>(); + // Long roleId = null; + + switch (affiliate.getRoleType()) { + case 1: + roleIdList.add((Long) applicantObj); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add( (Long) commonCacheObj); + } + break; + case 2: + // 申请代理人 + roleIdList.add((Long) agentCacheObj); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add( (Long) commonCacheObj); + } + break; + case 3: + roleIdList.add((Long) respondentCacheObj); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add( (Long) RespondentCacheObj); + } + + break; + case 4: + roleIdList.add((Long) agentCacheObj); + if (affiliate.getOperatorFlag() == 1) { + // 是操作人 + roleIdList.add( (Long) RespondentCacheObj); + } + break; + default: + + break; + } + // 如果是申请人,则和用户表关联 + if (caseApplication.getOrganizeFlag() == 0) { + caseApplicationService.insertAfficateUser(affiliate, roleIdList); + } else { + // 申请机构 + if (affiliate.getRoleType() == 1) { + // 申请人,从缓存中判断部门是否存在 + Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()); + if (ObjectUtil.isEmpty(deptCache)) { + // 不存在该部门,新增 + SysDept dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(affiliate.getName()); + dept.setAncestors("0"); + dept.setOrderNum(1); + dept.setStatus("0"); + dept.setDelFlag("0"); + dept.setCode(affiliate.getCode()); + dept.setCompLegalPerson(affiliate.getCompLegalPerson()); + dept.setCreateBy(getUsername()); + dept.setUpdateBy(getUsername()); + sysDeptMapper.insertDept(dept); + // 更新缓存 + redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId()); + } + affiliate.setApplicantDeptId(redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName())); + } else { + caseApplicationService.insertAfficateUser(affiliate, roleIdList); + } + } + // 保存人员 + msCaseAffiliateMapper.insert(affiliate); + } + + /** + * 新增案件相关人员信息 + * @param affiliate 相关人员信息 + * @param roleIdList 角色id + + */ + @Transactional + public void insertAfficateUser(MsCaseAffiliate affiliate, List roleIdList) { + + if(StrUtil.isEmpty(affiliate.getEmail())){ + return; + } + Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail()); + SysUser user=null; + if(ObjectUtil.isEmpty(userEmailCache)){ + user = sysUserMapper.selectUserByUserName(affiliate.getEmail()); + }else { + user=(SysUser)userEmailCache; + } + + + // 判断该用户是否存在 + if(user==null){ + // 不存在,则新增 + user = new SysUser(); + user.setPassword(SecurityUtils.encryptPassword("abc123456")); + user.setUserName(affiliate.getEmail()); + user.setNickName(affiliate.getName()); + user.setEmail(affiliate.getEmail()); + user.setHome(affiliate.getHome()); + user.setSex(affiliate.getSex()); + user.setIdCard(affiliate.getIdCard()); + user.setBirth(affiliate.getBirth()); + user.setPhonenumber(affiliate.getPhone()); + user.setAddress(affiliate.getAddress()); + user.setIdType(affiliate.getIdType()); + user.setNationality(affiliate.getNationality()); + userMapper.insertUser(user); + affiliate.setUserId(user.getUserId()); + // 更新缓存 + redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); + // 查询该角色是否存在申请人角色 + List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); + for (Long roleId : roleIdList) { + if(CollectionUtil.isEmpty(roleIds) && !roleIds.contains(roleId) ){ + userRoleMapper.insertUserRole(user.getUserId(),roleId); + } + } + + // todo 发短信,有电话给电话发,没有电话给邮箱发 + + }else { + // 存在的话将案件人员信息同步到用户表,更新用户表 + user.setHome(affiliate.getHome()); + user.setNickName(affiliate.getName()); + user.setSex(affiliate.getSex()); + user.setIdCard(affiliate.getIdCard()); + user.setBirth(affiliate.getBirth()); + user.setPhonenumber(affiliate.getPhone()); + user.setAddress(affiliate.getAddress()); + user.setIdType(affiliate.getIdType()); + user.setNationality(affiliate.getNationality()); + user.setEmail(affiliate.getEmail()); + userMapper.updateUser(user); + affiliate.setUserId(user.getUserId()); + // 更新缓存 + redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); + // 查询该角色是否存在申请人角色 + List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); + for (Long roleId : roleIdList) { + if (CollectionUtil.isEmpty(roleIds) || !roleIds.contains(roleId)) { + userRoleMapper.insertUserRole(user.getUserId(), roleId); + } + } + + } + } + /** * 获取第一个流程节点 * @return @@ -576,66 +896,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return success; } - /** - * 新增用户 - * @param affiliate - * @param agentFlag 是否代理人,0-否,1-是 - * @param roleId - */ - @Transactional - public void insertApplicantUser( MsCaseAffiliate affiliate,boolean agentFlag, Long roleId) { - String phone=""; - String name=""; - if(agentFlag){ - // 代理人 - phone=affiliate.getContactTelphoneAgent(); - name=affiliate.getNameAgent(); - }else { - // 申请人 - phone=affiliate.getApplicationPhone(); - name=affiliate.getApplicationName(); - } - if(StrUtil.isNotEmpty(phone) && StrUtil.isNotEmpty(name)){ - // 查询用户是否存在 - SysUser sysUser = sysUserMapper.selectUserByPhone(phone); - if(sysUser==null){ - // 新增用户 - sysUser = new SysUser(); - sysUser.setUserName(phone); - sysUser.setNickName(name); - sysUser.setPhonenumber(phone); - sysUser.setPassword(SecurityUtils.encryptPassword("abc123456")); - sysUser.setIdType(affiliate.getIdType()); - sysUser.setNationality(affiliate.getNationality()); - sysUser.setCreateBy(SecurityUtils.getUsername()); - userMapper.insertUser(sysUser); - userRoleMapper.insertUserRole(sysUser.getUserId(), roleId); - // 发送短信 2064355 调解系统自动创建用户短信通知 尊敬的用户,您的案件已经创建,请使用账号为{1},密码为{2}登录调解系统,请知晓,如非本人操作,请忽略本短信。 - Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2064355", phone, new String[]{phone, "abc123456"}); - - }else { - // 用户不为空,查询角色是否为申请人 - if (CollectionUtil.isNotEmpty(sysUser.getRoles())) { - List longList = sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()); - if (!longList.contains(roleId)) { - userRoleMapper.insertUserRole(sysUser.getUserId(), roleId); - } - } else { - userRoleMapper.insertUserRole(sysUser.getUserId(), roleId); - } - - } - if(!agentFlag){ - // 自然人,将用户id设为申请人id - affiliate.setApplicationId(String.valueOf(sysUser.getUserId())); - affiliate.setApplicationName(sysUser.getNickName()); - - } - - - } - } /** * 查询案件流程 @@ -686,6 +947,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Transactional @Override public AjaxResult update(MsCaseApplicationVO caseApplication) { + MsCaseAffiliateVO msCaseAffiliateVO = caseApplication.getAffiliate(); + if (msCaseAffiliateVO==null) { + return AjaxResult.error("案件相关人员未填写"); + } // 计算仲裁费用 caseApplication.setCaseSubjectAmount(new BigDecimal("30000")); setFeePayableMethod(caseApplication); @@ -693,28 +958,32 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplication.setUpdateTime(new Date()); // 为null则不更新 msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication); - MsCaseAffiliate affiliate = caseApplication.getAffiliate(); - if (affiliate == null) { - return AjaxResult.error("案件相关人员未填写"); - } - affiliate.setCaseAppliId(caseApplication.getId()); - // 设置申请人 - if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) { - // 组装申请机构 - // insertDept(affiliate); - // 新增申请机构代理人 - caseApplicationService.insertAgentUser(affiliate); - }else if(StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==0){ - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - caseApplicationService.insertApplicantUser(affiliate,false,roleId); - caseApplicationService.insertApplicantUser(affiliate,true,roleId); + // 保存案件相关人员 + // 删除已存在的人员 + Example affliateExample = new Example(MsCaseAffiliate.class); + affliateExample.createCriteria().andEqualTo("caseAppliId", caseApplication.getId()); + msCaseAffiliateMapper.deleteByExample(affliateExample); + + + List applicant = msCaseAffiliateVO.getApplicant(); + List res = msCaseAffiliateVO.getRes(); + if(CollectionUtil.isNotEmpty(applicant)){ + for (int i = 0; i < applicant.size(); i++) { + // 申请人 + setCaseAfflicate(caseApplication, applicant.get(i).getApplicant(),i); + // 申请人代理人 + setCaseAfflicate(caseApplication, applicant.get(i).getApplicantAgent(),i); + } } - if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) { - affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", "")); + if(CollectionUtil.isNotEmpty(res)){ + for (int i = 0; i < res.size(); i++) { + // 申请人 + setCaseAfflicate(caseApplication, res.get(i).getRes(),i); + // 申请人代理人 + setCaseAfflicate(caseApplication, res.get(i).getResAgent(),i); + } } - msCaseAffiliateMapper.updateByPrimaryKeySelective(affiliate); if (CollectionUtil.isNotEmpty(caseApplication.getCaseAttachList())) { for (MsCaseAttach caseAttach : caseApplication.getCaseAttachList()) { @@ -737,7 +1006,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { MsCaseApplicationReq req = new MsCaseApplicationReq(); req.setCaseFlowId(caseFlow.getId()); req.setId(caseApplication.getId()); - if(affiliate.getOrganizeFlag()==0){ + if(caseApplication.getOrganizeFlag()==0){ // 自然人 req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); }else { @@ -870,7 +1139,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { BeanUtil.copyProperties(caseApplication, caseApplicationVO); // 组装附件 buildAttach(fileMap, caseApplicationVO, attachList); - caseApplicationVO.setAffiliate(affiliate); + ArrayList msCaseAffiliates = new ArrayList<>(); + msCaseAffiliates.add(affiliate); + // todo 结构发生变化,需要改相关人员设置 +// caseApplicationVO.setAffiliate(msCaseAffiliates); caseApplicationVO.setCaseAttachList(attachList); caseApplicationVO.setColumnValueList(columnValueList); caseApplicationVO.setImportFlag(true); @@ -966,408 +1238,39 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { fileMap.put(inFile.getName(), inFile.getAbsolutePath()); } if (!fileMap.isEmpty()) { - + List applicantList = new ArrayList<>(); + List resList = new ArrayList<>(); + MsCaseAffiliateBase applicantBase = new MsCaseAffiliateBase(); + MsCaseAffiliateBase resBase = new MsCaseAffiliateBase(); + applicantList.add(applicantBase); + resList.add(resBase); // 根据抓取规则设置字段值 for (Map.Entry> entry : fatchRuleMap.entrySet()) { getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue()); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } if (fatchMap.size() > 0) { - MsCaseAffiliate affiliate = new MsCaseAffiliate(); + List affiliateVOS = new ArrayList(); + MsCaseAffiliateVO affiliateVO = new MsCaseAffiliateVO(); + // 申请机构 + MsCaseAffiliate applicant = new MsCaseAffiliate(); + applicant.setRoleType(1); + applicant.setGroupOrder(1); + applicant.setOperatorFlag(null); + applicantBase.setApplicant(applicant); + // 申请人代理人 + MsCaseAffiliate applicantAgent = new MsCaseAffiliate(); + applicantAgent.setRoleType(2); + applicantAgent.setGroupOrder(1); + applicantBase.setApplicantAgent(applicantAgent); + // 被申请人 + MsCaseAffiliate res = new MsCaseAffiliate(); + res.setRoleType(3); + res.setGroupOrder(1); + resBase.setRes(res); + // 被申代理人 + MsCaseAffiliate resAgent = new MsCaseAffiliate(); + resBase.setResAgent(resAgent); + resAgent.setRoleType(4); // 组装案件内置字段 for (SysDictData dictData : dictDataList) { // 主表字段 @@ -1375,18 +1278,41 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); } else { // 相关人员字段 - ObjectFieldUtils.setValue(affiliate, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + // 申请机构字段 + if(dictData.getDictLabel().contains("被申请人")){ + ObjectFieldUtils.setValue(res, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + }else if(dictData.getDictLabel().contains("被申请人委托代理人")){ + ObjectFieldUtils.setValue(resAgent, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + }else if(dictData.getDictLabel().contains("申请人") + || dictData.getDictLabel().equals("统一社会信用代码") + || dictData.getDictLabel().equals("法定代表人") + ){ + ObjectFieldUtils.setValue(applicant, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + }else if(dictData.getDictLabel().contains("委托代理人")){ + ObjectFieldUtils.setValue(applicantAgent, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel())); + } + } } - // 识别身份证回显性别和出生年月日 - setBirthByIdentityNum(affiliate); + + affiliateVO.setApplicant(applicantList); + + // 如果身份证不为空,设置生日和性别 + if(StrUtil.isNotEmpty(res.getIdCard())){ + setBirthByIdentityNum(res); + } + affiliateVO.setRes(resList); BeanUtil.copyProperties(caseApplication, caseApplicationVO); - caseApplicationVO.setAffiliate(affiliate); + affiliateVOS.add(affiliateVO); + //todo + caseApplicationVO.setAffiliate(affiliateVO); + caseApplicationVO.setOrganizeFlag(1); } } } return AjaxResult.success(caseApplicationVO); + } /** @@ -1394,7 +1320,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { * @param affiliate */ private void setBirthByIdentityNum(MsCaseAffiliate affiliate) { - String identityNum = affiliate.getRespondentIdentityNum(); + String identityNum = affiliate.getIdCard(); if(StrUtil.isNotEmpty(identityNum)){ // 识别身份证回显性别和出生年月日 identityNum = identityNum.replace("\n", ""); @@ -1408,10 +1334,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } catch (Exception e) { e.printStackTrace(); } - affiliate.setRespondentBirth(birthdayDate); + affiliate.setBirth(birthdayDate); } //从身份证抓取性别 - affiliate.setRespondentSex(identityNumMap.get("sexCode")); + affiliate.setSex(identityNumMap.get("sexCode")); } } } @@ -1471,12 +1397,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 循环生成调解申请书 for (MsCaseApplication application : caseApplicationList) { - // 案件相关人员 - MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); - if(affiliate==null){ - continue; - } - caseApplicationService.createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType()); + // todo 批量的未改案件相关人员,结构已发生变化 +// MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); +// if(affiliate==null){ +// continue; +// } + // caseApplicationService.createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType()); } }else { @@ -1484,12 +1410,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 根据案件id查询案件信息 MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); // 查询案件关联人员 - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); - if (application == null || caseAffiliate == null) { + List msCaseAffiliates = selectAffliatesByCaseId(req.getId()); + if (application == null || msCaseAffiliates == null) { throw new ServiceException("该案件不存在"); } - caseApplicationService.createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType()); + caseApplicationService.createMediateApplication(application, msCaseAffiliates, templatePath, bookmarkList,dictDataList,req.getTemplateType()); } @@ -1567,6 +1493,28 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { e.printStackTrace(); return AjaxResult.error("上传失败"); } + // todo 对接北明,调用上传附件接口 + MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); + if(caseApplication==null){ + return AjaxResult.error("案件不存在"); + } + if(StrUtil.isEmpty(caseApplication.getCaseSource()) && CollectionUtil.isNotEmpty(successList)) { + // todo + + for (MsCaseAttach caseAttach : successList) { + if(StrUtil.isEmpty(caseAttach.getAnnexPath())){ + continue; + } + String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(),AttachmentOperateTypeEnum.ADD); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttach(caseAttach); + } + } + } return AjaxResult.success("上传成功", successList); } @@ -1579,31 +1527,31 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override public AjaxResult accept(MsCaseApplicationVO req) { if (StrUtil.isNotEmpty(req.getBatchNumber())) { - // 根据批号查询未锁定的案件 - List applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); - if (CollectionUtil.isEmpty(applicationList)) { - return AjaxResult.error("该批次号下未找到案件"); - } - // 查询案件关联人员 - Example example = new Example(MsCaseAffiliate.class); - example.createCriteria().andIn("caseAppliId", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList())); - List affiliateList = msCaseAffiliateMapper.selectByExample(example); - if (CollectionUtil.isEmpty(affiliateList)) { - return AjaxResult.error("该批次号下未找到案件"); - } - Map affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); - for (MsCaseApplication application : applicationList) { - // 不受理 - if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){ - if(StrUtil.isEmpty(req.getRejectReason())){ - throw new ServiceException("请填写拒绝原因"); - } - caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason()); - }else { - caseApplicationService.accept(application,req,affiliateMap); - } - - } + // todo,结构发生变化,暂时不改批量操作,根据批号查询未锁定的案件 +// List applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); +// if (CollectionUtil.isEmpty(applicationList)) { +// return AjaxResult.error("该批次号下未找到案件"); +// } +// // 查询案件关联人员 +// Example example = new Example(MsCaseAffiliate.class); +// example.createCriteria().andIn("caseAppliId", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList())); +// List affiliateList = msCaseAffiliateMapper.selectByExample(example); +// if (CollectionUtil.isEmpty(affiliateList)) { +// return AjaxResult.error("该批次号下未找到案件"); +// } +// Map affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); +// for (MsCaseApplication application : applicationList) { +// // 不受理 +// if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){ +// if(StrUtil.isEmpty(req.getRejectReason())){ +// throw new ServiceException("请填写拒绝原因"); +// } +// caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason()); +// }else { +// caseApplicationService.accept(application,req,affiliateMap); +// } +// +// } } else { // 不受理 @@ -1616,14 +1564,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 查询案件信息 MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); // 根据案件id查询案件相关人 - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); - if (application==null||caseAffiliate == null) { + List msCaseAffiliates = selectAffliatesByCaseId(req.getId()); + if (application==null||CollectionUtil.isEmpty(msCaseAffiliates)) { return AjaxResult.error("该案件不存在"); } // 锁定该案件 application.setLockStatus(YesOrNoEnum.YES.getCode()); - Map affiliateMap=new HashMap<>(); - affiliateMap.put(req.getId(),caseAffiliate); + Map> affiliateMap=new HashMap<>(); + affiliateMap.put(req.getId(),msCaseAffiliates); caseApplicationService.accept(application,req,affiliateMap); } @@ -1638,44 +1586,139 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { * @param affiliateMap */ @Transactional - public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map affiliateMap) { + public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map> affiliateMap) { application.setPaperFlag(req.getPaperFlag()); application.setArbitrateConfirm(req.getArbitrateConfirm()); application.setMediationMethod(req.getMediationMethod()); application.setUpdateBy(SecurityUtils.getUsername()); application.setUpdateTime(new Date()); application.setBatchNumber(null); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus()); // 给被申请人发送短信 if (affiliateMap.containsKey(application.getId())) { - MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); - // 被申请人发送短信 - if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) { - String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; - // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()}); - // CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent); - if (smsFlag) { - // 发送成功 - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + List affiliates = affiliateMap.get(application.getId()); + // todo 被申请人发送短信 + // 被申受理分配通知 + SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知", + "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。", + "2074247", + new String[]{application.getCaseNum()} + ); + SMSNotice notice = new SMSNotice(null,resNotice); + caseApplicationService.sendNotice(application,affiliates,false,notice); + } + msCaseApplicationMapper.updateByPrimaryKeySelective(application); + caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus()); + } + + /** + * 受理分配通知 + * @param application 案件基本信息 + * @param affiliates 案件人员 + * @param applicantFlag 是否申请人 + */ + @Override + @Transactional + public void isAcceptNotice(MsCaseApplication application, List affiliates, Boolean applicantFlag) { + + for (MsCaseAffiliate affiliate : affiliates) { + if(applicantFlag==null || applicantFlag) { + if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { + String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; + String subject = "待缴费通知"; + // 电话号不为空,发送短信,否则发邮箱 + if (StrUtil.isNotEmpty(affiliate.getPhone())) { + // 发送短信 + // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 + Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getPhone(), new String[]{application.getCaseNum()}); + sendSMS(smsFlag,application, affiliate, sendContent); + + } else { + // 发送邮件 + sendEmail(application, affiliate, subject, sendContent); + + } + } + } + if(applicantFlag==null || !applicantFlag) { + if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { + // 拒绝原因 + String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason(); + String subject = "案件不受理通知"; + String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+rejectReason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。"; + // 电话号不为空,发送短信,否则发邮箱 + if (StrUtil.isNotEmpty(affiliate.getPhone())) { + Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2065809", affiliate.getPhone(), + new String[]{application.getCaseNum(), rejectReason}); + // 发送短信 + sendSMS(smsFlag,application, affiliate, sendContent); + + } else { + // 发送邮件 + sendEmail(application, affiliate, subject, sendContent); + + } } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); } } } + + /** + * 发送邮件 + * @param application 案件基本信息 + * @param affiliate 案件人员 + * @param subject 主题 + * @param sendContent 内容 + */ + @Override + @Transactional + public void sendEmail(MsCaseApplication application, MsCaseAffiliate affiliate, String subject, String sendContent) { + boolean emailFlag = emailOutUtil.sendMessage(affiliate.getEmail(), subject, sendContent, null, null); + + SendMailRecord sendMailRecord = new SendMailRecord(); + sendMailRecord.setCaseId(application.getId()); + sendMailRecord.setMailAddress(affiliate.getEmail()); + sendMailRecord.setMailContent(sendContent); + sendMailRecord.setMailName(subject); + sendMailRecord.setSendTime(new Date()); + sendMailRecord.setCreateBy(SecurityUtils.getUsername()); + if (emailFlag) { + sendMailRecord.setSendStatus(1); + } else { + sendMailRecord.setSendStatus(0); + } + sendMailRecordMapper.saveSendMailRecord(sendMailRecord); + } + + /** + * 发送短信 + * @param smsFlag 短信是否发送成功 + * @param application 案件基本信息 + * @param affiliate 案件人员 + * @param sendContent 发送内容 + */ + @Override + @Transactional + public void sendSMS(Boolean smsFlag ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent) { + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getPhone(), new Date(), sendContent); + if (smsFlag) { + // 发送成功 + smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + } + /** * 案件提交 * @param req * @return */ @Override + @Transactional public AjaxResult submit(MsCaseApplication req) { if(StrUtil.isNotEmpty(req.getBatchNumber())){ - // 批量提交 + // todo 暂时不改,批量提交 List list = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId()); if(CollectionUtil.isEmpty(list)){ return AjaxResult.error("该批次号下未找到案件"); @@ -1684,11 +1727,51 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode()); } }else { + MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); + if(caseApplication==null){ + return AjaxResult.error("未找到案件"); + } + // 查询案件人员 + List affiliates = selectAffliatesByCaseId(req.getId()); + if(CollectionUtil.isEmpty(affiliates)){ + return AjaxResult.error("未找到案件人员"); + } + List operatorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag().equals(1)).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(operatorList)){ + return AjaxResult.error("未找到案件操作人员"); + } + long applicantCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count(); + long resCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count(); + if(applicantCount==0 && resCount==0){ + return AjaxResult.error("申请人操作人、被申请人操作人手机号不存在,请修改案件信息"); + }else if(applicantCount==0 ){ + return AjaxResult.error("申请人操作人手机号不存在,请修改案件信息"); + }else if( resCount==0){ + return AjaxResult.error("被申请人操作人手机号不存在,请修改案件信息"); + } MsCaseFlow caseFlow = caseApplicationService.nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode()); - + // TODO 案件来源如果是空,则为北明案件,提交完向北明推送案件状态 + caseApplicationService.pushStatusToBM(caseApplication, PushCaseStatusEnum.MEDIATE); } return AjaxResult.success("提交成功"); } + + /** + * 北明推送案件状态 + * @param caseApplication 案件 + * @param pushCaseStatusEnum 案件状态 + * @return + */ + @Transactional + public JSONObject pushStatusToBM(MsCaseApplication caseApplication, PushCaseStatusEnum pushCaseStatusEnum){ + // 案件来源如果是空,则为北明案件,提交完向北明推送案件状态 + if(StrUtil.isEmpty(caseApplication.getCaseSource())) { + String BMToken = beiMingInterfaceService.getApiToken(BMUserName, BMPassword, System.currentTimeMillis()); + MsCaseStatusInfo info = MsCaseStatusInfo.builder().caseNo(caseApplication.getCaseNum()).statusCode(pushCaseStatusEnum.getCode()).caseClosureExplanation(pushCaseStatusEnum.getName()).build(); + return beiMingInterfaceService.submitCaseStatusInfo(BMToken, caseApplication.getCaseNum(), BMSyncSource, info); + } + return null; + } @Transactional @Override public AjaxResult delete(MsCaseApplication req) { @@ -1771,25 +1854,77 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList())); } if(caseAppliId!=null) { + // 查询该用户是否是操作人,是申请操作人还是被申请操作人 + List affiliates = msCaseAffiliateMapper.selectByCaseId(caseAppliId); + if(CollectionUtil.isEmpty(affiliates)){ + return AjaxResult.error("未找到案件相关人员"); + } // 根据案件id和用户id查询已选择的调解员进行回显 Example example = new Example(MsCaseMediator.class); Example.Criteria criteria = example.createCriteria(); LoginUser loginUser = SecurityUtils.getLoginUser(); - if (loginUser != null && loginUser.getUser() != null && CollectionUtil.isNotEmpty(loginUser.getUser().getRoles())) { - for (SysRole role : loginUser.getUser().getRoles()) { - if (role.getRoleName().equals("被申请人")) { - criteria.andEqualTo("type", YesOrNoEnum.YES.getCode()); - } else if (role.getRoleName().equals("申请人")) { + +// if (loginUser.getUser() != null ) { +// // 查询角色 +// List roles = roleMapper.selectRolesByUserName(loginUser.getUser().getUserName()); +// if (CollectionUtil.isNotEmpty(roles)) { +// for (SysRole role : roles) { +// if (role.getRoleName().contains("被申请人")) { +// criteria.andEqualTo("type", YesOrNoEnum.YES.getCode()); +// break; +// } else if (role.getRoleName().contains("申请人")) { +// criteria.andEqualTo("type", YesOrNoEnum.NO.getCode()); +// break; +// } else if (role.getRoleName().contains("委托代理人")) { +// +// List operatorList = affiliates.stream().filter(affiliate -> +// affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1 && affiliate.getRoleType() != null).collect(Collectors.toList()); +// if (CollectionUtil.isNotEmpty(operatorList)) { +// Map> map = operatorList.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getUserId)); +// if (map.containsKey(loginUser.getUserId())) { +// List msCaseAffiliates = map.get(loginUser.getUserId()); +// for (MsCaseAffiliate affiliate : msCaseAffiliates) { +// // 申请人 +// if (affiliate.getRoleType() == 1 || affiliate.getRoleType() == 2) { +// criteria.andEqualTo("type", YesOrNoEnum.NO.getCode()); +// break; +// } else if (affiliate.getRoleType() == 3 || affiliate.getRoleType() == 4) { +// criteria.andEqualTo("type", YesOrNoEnum.YES.getCode()); +// break; +// } +// } +// } +// } +// } +// } +// } +// +// criteria.andEqualTo("caseAppliId", caseAppliId); +// // 已选择的调解员 +// List selectedMediators = msCaseMediatorMapper.selectByExample(example); +// selectedMediatorIds = selectedMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList()); +// } + for (MsCaseAffiliate affiliate : affiliates) { + if(affiliate.getUserId().equals(loginUser.getUser().getUserId())){ + if( affiliate.getRoleType()==null){ + continue; + } + if(affiliate.getRoleType()==1|| affiliate.getRoleType()==2){ + // 申请人 criteria.andEqualTo("type", YesOrNoEnum.NO.getCode()); } + if(affiliate.getRoleType()==3|| affiliate.getRoleType()==4){ + // 申请人 + criteria.andEqualTo("type", YesOrNoEnum.YES.getCode()); + } } } - criteria.andEqualTo("caseAppliId", caseAppliId); // 已选择的调解员 List selectedMediators = msCaseMediatorMapper.selectByExample(example); selectedMediatorIds = selectedMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList()); } + for (SysUser user : users) { MediatorVO mediatorVO = new MediatorVO(); mediatorVO.setMediatorId(user.getUserId()); @@ -1821,27 +1956,67 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public AjaxResult updateBooking(BookingVO vo) { - // 查询案件相关人员 - MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId()); - if (msCaseAffiliate == null) { - return AjaxResult.error("该案件不存在"); - } // 查询当前节点 MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId()); if (currentFlow == null) { return AjaxResult.error("当前流程不存在"); } - // Integer miniProgressFlag = vo.getMiniProgressFlag() == null ? MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag(); // 预约,申请人预约为Null,否则为被申请人预约 Integer miniProgressFlag=YesOrNoEnum.NO.getCode(); - List roles = SecurityUtils.getLoginUser().getUser().getRoles(); - if(CollectionUtil.isNotEmpty(roles)){ - for (SysRole role : roles) { - if(role.getRoleName().equals("被申请人")){ - miniProgressFlag=YesOrNoEnum.YES.getCode(); + SysUser user = SecurityUtils.getLoginUser().getUser(); + List roles = roleMapper.selectRolesByUserName(user.getUserName()); + // 查询该用户是否是操作人,是申请操作人还是被申请操作人 + List affiliates = msCaseAffiliateMapper.selectByCaseId(vo.getId()); + if(CollectionUtil.isEmpty(affiliates)){ + return AjaxResult.error("未找到案件相关人员"); + } + for (MsCaseAffiliate affiliate : affiliates) { + if(affiliate.getUserId().equals(user.getUserId())){ + if( affiliate.getRoleType()==null){ + continue; + } + if(affiliate.getRoleType()==1|| affiliate.getRoleType()==2){ + // 申请人 + miniProgressFlag= YesOrNoEnum.NO.getCode(); + } + if(affiliate.getRoleType()==3|| affiliate.getRoleType()==4){ + // 申请人 + miniProgressFlag= YesOrNoEnum.YES.getCode(); } } } + +// if(CollectionUtil.isNotEmpty(roles)){ +// for (SysRole role : roles) { +// if(role.getRoleName().contains("被申请人")){ +// miniProgressFlag=YesOrNoEnum.YES.getCode(); +// } else if (role.getRoleName().contains("申请人")) { +// miniProgressFlag= YesOrNoEnum.NO.getCode(); +// break; +// }else if(role.getRoleName().contains("委托代理人")){ +// +// List operatorList = affiliates.stream().filter(affiliate -> +// affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1 && affiliate.getRoleType() != null ).collect(Collectors.toList()); +// if(CollectionUtil.isNotEmpty(operatorList)){ +// Map> map = operatorList.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getUserId)); +// if(map.containsKey(user.getUserId())){ +// List msCaseAffiliates = map.get(user.getUserId()); +// for (MsCaseAffiliate affiliate : msCaseAffiliates) { +// // 申请人 +// if(affiliate.getRoleType()==1||affiliate.getRoleType()==2){ +// miniProgressFlag= YesOrNoEnum.NO.getCode(); +// break; +// } +// else if(affiliate.getRoleType()==3||affiliate.getRoleType()==4){ +// miniProgressFlag= YesOrNoEnum.YES.getCode(); +// break; +// } +// } +// } +// } +// } +// } +// } vo.setMiniProgressFlag(miniProgressFlag); // 先删除已选择的调解员,在新增 Example mediatorExample = new Example(MsCaseMediator.class); @@ -1867,10 +2042,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (vo.getMiniProgressFlag() == null || vo.getMiniProgressFlag().equals( YesOrNoEnum.NO.getCode())) { // 新增日志 CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null); - - if (StrUtil.isEmpty(msCaseAffiliate.getRespondentIdentityNum())) { - return AjaxResult.error("被申请人身份证为空"); - } // 判断被申请人信息查询案件预约表 caseApplicationService. isReservation( vo,userIds); @@ -1908,7 +2079,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { criteria.andEqualTo("type", MediatorTypeEnum.PC.getCode()); } criteria.andEqualTo("caseAppliId", vo.getId()); - // criteria.andEqualTo("mediatorId", user.getUserId()); List msCaseMediators = msCaseMediatorMapper.selectByExample(example); if (CollectionUtil.isNotEmpty(msCaseMediators)) { MsCaseApplication application = new MsCaseApplication(); @@ -2002,6 +2172,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (nextFlow == null) { throw new ServiceException("未找到下一个流程节点"); } + if(vo.getMediatorId()!=null) { // setMediatorAndDate(application,vo); application.setMediatorId(vo.getMediatorId()); @@ -2017,34 +2188,39 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); // 发送开庭短信 if(CollectionUtil.isNotEmpty(vo.getHerDates())) { - - MsCaseAffiliate affiliate = msCaseAffiliateMapper.selectByPrimaryKey(application.getId()); - if (caseApplication == null || affiliate == null) { - throw new ServiceException("未找到该案件"); - } - // 申请人电话 - String phone = ""; - if (affiliate.getOrganizeFlag().equals(0)) { - // 自然人 - if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { - phone = affiliate.getContactTelphoneAgent(); - } else { - phone = affiliate.getApplicationPhone(); - } - - } else { - phone = affiliate.getContactTelphoneAgent(); - } + List affiliates = selectAffliatesByCaseId(application.getId()); + // todo 申请人电话 caseApplication.setHearDate(application.getHearDate()); // 申请人发送开庭日期短信 - sendHearDateSms(caseApplication, phone); - // 被申发送开庭日期短信 - sendHearDateSms(caseApplication, affiliate.getRespondentPhone()); - // 调解员发送短信 - // 根据调解员id查询用户 + sendHearDateSms(caseApplication, affiliates); + + // 调解员发送短信,根据调解员id查询用户 if (caseApplication.getMediatorId() != null) { SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId()); - sendHearDateSms(caseApplication, sysUser.getPhonenumber()); + String content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线上调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; + String templateId = "2075447"; + String subject="开庭日期通知"; + MsCaseAffiliate meditorAffliate = new MsCaseAffiliate(); + meditorAffliate.setPhone(sysUser.getPhonenumber()); + meditorAffliate.setEmail(sysUser.getEmail()); + // 线下调解 + if(StrUtil.isEmpty(application.getMediationMethod()) || !application.getMediationMethod().equals("1")){ + // 申请人/被申通知, 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; + templateId="2077966"; + } + // 电话号不为空,发送短信,否则发邮箱 + if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { + Boolean smsFlag = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), + new String[]{caseApplication.getCaseNum(),application.getHearDate()}); + // 发送短信 + caseApplicationService.sendSMS(smsFlag, application, meditorAffliate, content); + + } else { + // 发送邮件 + caseApplicationService.sendEmail(application, meditorAffliate, subject, content); + + } } } // 新增日志 @@ -2052,38 +2228,96 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); } - /** * 发送开庭日期短信 * @param application - * @param phone + * @param affiliates */ - private void sendHearDateSms(MsCaseApplication application, String phone) { - if(StrUtil.isEmpty(phone)){ - return; - } - Boolean smsFlag =true; - String sendContent=""; + @Override + @Transactional + public void sendHearDateSms(MsCaseApplication application, List affiliates) { + if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){ + // 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + SMSNoticeDO noticeDO = new SMSNoticeDO("开庭日期通知", + "尊敬的用户,您的" + application.getCaseNum() + "的案件,线上调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。", + "2075447", + new String[]{application.getCaseNum(),application.getHearDate()} + ); - // 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - smsFlag = SmsUtils.sendSms(application.getId(), "2075447", phone, new String[]{application.getCaseNum(),application.getHearDate()}); - sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件,线上调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; + SMSNotice notice = new SMSNotice(noticeDO,noticeDO); + caseApplicationService.sendNotice(application,affiliates,null,notice); }else { - // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - smsFlag = SmsUtils.sendSms(application.getId(), "2077966", phone, new String[]{application.getCaseNum(),application.getHearDate()}); - sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; - + // 申请人/被申通知, 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + SMSNoticeDO noticeDO = new SMSNoticeDO("开庭日期通知", + "尊敬的用户,您的" + application.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。", + "2077966", + new String[]{application.getCaseNum(),application.getHearDate()} + ); + SMSNotice notice = new SMSNotice(noticeDO,noticeDO); + caseApplicationService.sendNotice(application,affiliates,null,notice); } - // 新增短信记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), phone, new Date(), sendContent); - if(smsFlag){ - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - }else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); } + /** + * 申请操作人/被申操作人发送通知 + * @param application + * @param affiliates + * @param applicantFlag + * @param notice + */ + @Override + @Transactional + public void sendNotice(MsCaseApplication application, List affiliates, Boolean applicantFlag, + SMSNotice notice) { + + for (MsCaseAffiliate affiliate : affiliates) { + if (applicantFlag == null || applicantFlag) { + // 申请人 + if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { + SMSNoticeDO applicantNotice = notice.getApplicantNotice(); + caseApplicationService.sendNotice(application, affiliate, applicantNotice); + continue; + } + } + if (applicantFlag == null || !applicantFlag) { + // 被申请人 + if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { + SMSNoticeDO resNotice = notice.getResNotice(); + caseApplicationService.sendNotice(application, affiliate, resNotice); + } + + } + } + } + + /** + * 发送短信 + * @param application + * @param affiliate + * @param notice + */ + @Override + @Transactional + public void sendNotice(MsCaseApplication application, MsCaseAffiliate affiliate, + SMSNoticeDO notice) { + + if (notice != null) { + // 电话号不为空,发送短信,否则发邮箱 + if (StrUtil.isNotEmpty(affiliate.getPhone())) { + Boolean smsFlag = SmsUtils.sendSms(application.getId(), notice.getTemplateId(), affiliate.getPhone(), + notice.getTemplateParamSet()); + // 发送短信 + caseApplicationService.sendSMS(smsFlag, application, affiliate, notice.getContent()); + + } else { + // 发送邮件 + caseApplicationService.sendEmail(application, affiliate, notice.getSubject(), notice.getContent()); + + } + } + } + + /** * 案件不予受理 @@ -2098,39 +2332,24 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { Long id = Long.valueOf(caseId); // 根据案件id查询案件 MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id); - MsCaseAffiliate affiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); - if(application==null || affiliate==null){ + // 查询案件人员 + List affiliates = selectAffliatesByCaseId(id); + if(application==null || CollectionUtil.isEmpty(affiliates)){ return; } + application.setRejectReason(reason); if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){ - // 超过五日还没有受理,给申请人发送不受理通知 - String phone=""; - if(affiliate.getOrganizeFlag().equals(0)){ - // 自然人 - if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){ - phone=affiliate.getContactTelphoneAgent(); - }else { - phone=affiliate.getApplicationPhone(); - } + // todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱 + // 申请人不受理分配通知 + String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason(); + SMSNoticeDO applicantNotice = new SMSNoticeDO("案件不受理通知", + "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于" + rejectReason + "所以不予受理,请知晓,如非本人操作,请忽略本短信。", + "2065809", + new String[]{application.getCaseNum(), rejectReason} + ); - }else { - phone=affiliate.getContactTelphoneAgent(); - } - if(StrUtil.isNotEmpty(phone)) { - // 发送短信 2065809 案件不予受理通知 尊敬的用户,您编号为{1}的案件由于{2}所以不予受理,请知晓,如非本人操作,请忽略本短信。 - Boolean smsFlag = SmsUtils.sendSms(id, "2065809", phone, new String[]{application.getCaseNum(),reason}); - String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+reason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。"; - // CaseLogUtils.insertCaseLog(application.getId(), application.getCaseFlowId(), application.getCaseStatusName(), sendContent); - - // 新增短信记录 - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), phone, new Date(), sendContent); - if(smsFlag){ - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - }else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } + SMSNotice notice = new SMSNotice(applicantNotice,null); + caseApplicationService.sendNotice(application,affiliates,true,notice); // 修改案件状态为17,结束 MsCaseApplication caseApplication = new MsCaseApplication(); caseApplication.setId(id); @@ -2138,7 +2357,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplication.setCaseStatusName("结束"); msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication); CaseLogUtils.insertCaseLog(application.getId(), 4, "受理分配", null); - + // todo 为结束时,记录结束节点 + CaseLogUtils.insertCaseLog(application.getId(), 17, "结束", null); + // todo 结束对接北明,为调解失败状态 + if(StrUtil.isEmpty(application.getCaseSource())) { + caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); + } } } @@ -2226,12 +2450,24 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (currentFlow == null) { throw new ServiceException("未找到当前流程节点"); } + // 查询案件人员 + List affiliates = selectAffliatesByCaseId(application.getId()); + if (CollectionUtil.isEmpty(affiliates)) { + throw new ServiceException("未找到案件人员"); + } + // 申请操作人 + Optional applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { + throw new ServiceException("未找到案件操作人员"); + } + // 调解结果 Integer mediaResult = req.getMediaResult(); - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId()); if (application.getMediationMethod().equals("1")) { // 线上调解 List attachList = req.getAttachList(); - if(CollectionUtil.isNotEmpty(attachList)) { + if (CollectionUtil.isNotEmpty(attachList)) { // 先删除已经存在的调解书 msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); for (MsCaseAttach attach : attachList) { @@ -2239,541 +2475,169 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseAttachMapper.updateCaseAttach(attach); } } - if(mediaResult ==1){ - //达成调解 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); - // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - String path = annexPath; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); + if (mediaResult == 1) { + //达成调解 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (MsCaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { + // String prefix = "/profile"; + // int startIndex = prefix.length(); + String annexPath = caseAttach.getAnnexPath(); + // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + String path = annexPath; + //获取文件上传地址 + EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + String fileId = jsonObject.getJSONObject("data").getString("fileId"); + String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); + //上传文件流 + EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + if (jsonObject1.getIntValue("errCode") == 0) { + //查看文件上传状态 + Thread.sleep(1000); + EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + JSONObject data = jsonObject2.getJSONObject("data"); + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { + String fileName = data.getString("fileName"); + //上传成功,获取文件签名印章位置 + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setFileid(fileId); + EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); + Gson gson = new Gson(); + JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); + JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); + String keywordPositions = positionsData.get("keywordPositions").toString(); + //发起签署 + sealSignRecord.setFilename(fileName); - Long arbitratorId = application.getMediatorId(); - if (arbitratorId!=null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - - Integer organizeFlag = caseAffiliate.getOrganizeFlag(); - if(organizeFlag!=null){ - if(organizeFlag.intValue()==1){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - String nameAgent = caseAffiliate.getNameAgent(); - if(StringUtils.isNotBlank(nameAgent)){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone()); - sealSignRecord.setPensonName(caseAffiliate.getApplicationName()); - } - } - } - - sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone()); - sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName()); - - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIsUse(1); - DeptIdentify deptIdentifyselect = new DeptIdentify(); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - deptIdentifyselect = deptIdentifysnew.get(0); - sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); - sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); - sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); - } else { - return AjaxResult.error("没有用印时的机构名称及经办人信息"); - } - - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - }else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } - }else if (keyword.equals("调解员(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnMedi(positionX + 120); - sealSignRecord.setPositionYpsnMedi(positionY + 10); - } - }else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX + 90); - sealSignRecord.setPositionYorg(positionY); - } - } - } - - String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 - String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 - String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 - //查询机构信息 - DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setIdentifyName(orgnizeName); - deptIdentify1.setOperName(orgnizeNamepsnName); - deptIdentify1.setOperPhone(orgnizeNamePsnAccount); - List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - Long iddeptIdent = deptIdentifies.get(0).getId(); - SealManage sealManage = new SealManage(); - sealManage.setIdentifyId(iddeptIdent); - List sealIdList = new ArrayList<>(); - List selectSealList = sealManageMapper.selectSealList(sealManage); - if (selectSealList != null && selectSealList.size() > 0) { - for (SealManage manage : selectSealList) { - Integer sealStatus = manage.getSealStatus(); - Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse ==1) { - sealIdList.add(manage.getSealId()); - } - } - EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(application.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); - msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - String nameAgent = caseAffiliate.getNameAgent(); - if(StringUtils.isNotBlank(nameAgent)){ - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - }else { - sealSignRecordapply.setPensonAccount(caseAffiliate.getApplicationPhone()); - } - - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - - if(StringUtils.isNotBlank(nameAgent)){ - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum(),urlapplynew}); - }else { - request.setPhone(caseAffiliate.getApplicationPhone()); - request.setTemplateParamSet(new String[]{caseAffiliate.getApplicationName(), application.getCaseNum(),urlapplynew}); - } - Boolean aBoolean = SmsUtils.sendSms(request); - - if(StringUtils.isNotBlank(nameAgent)){ - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), caseAffiliate.getContactTelphoneAgent(), new Date(), "尊敬的" + caseAffiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - }else { - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), caseAffiliate.getApplicationPhone(), new Date(), "尊敬的" + caseAffiliate.getApplicationName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), caseAffiliate.getRespondentPhone(), new Date(), "尊敬的" + caseAffiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean1) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - - SealSignRecord sealSignRecordMedi = new SealSignRecord(); - sealSignRecordMedi.setSignFlowid(signFlowId); - sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); - EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); - JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); - JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); - String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); - String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2047719"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(),urlResponnewMedi}); - Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); - - SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBooleanMedi) { - smsSendRecord1.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord1.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord1); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); - } - } - } else { - return AjaxResult.error(); - } - - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if(caseFlow != null){ - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - }else{ + Long arbitratorId = application.getMediatorId(); + if (arbitratorId != null) { + SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); + if (sysUser == null) { return AjaxResult.error(); } - }else{ - return AjaxResult.error(); + sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); + sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + } + // todo + // 设置申请人签名账户 + sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); + // 设置被申请人签名账户 + sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); + // 设置用印账号 + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setIsUse(1); + DeptIdentify deptIdentifyselect = new DeptIdentify(); + List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); + if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { + deptIdentifyselect = deptIdentifysnew.get(0); + sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); + sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); + sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); + } else { + return AjaxResult.error("没有用印时的机构名称及经办人信息"); } - } - break; - } - } - } - - return AjaxResult.success(); - }else if(mediaResult.intValue()==2){ - //未达成调解 - //发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2066725"); - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum()}); - Boolean aBoolean = SmsUtils.sendSms(request); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2066725"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum()}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if(caseFlow != null){ - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - return AjaxResult.success(); - }else if(mediaResult.intValue()==3){ - //未达成调解但不再争议 - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if(caseFlow != null){ - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); - - } - return AjaxResult.success(); - }else if(mediaResult.intValue()==4){ - //未达成调解但同意引入仲裁 - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application,applicationVO); - - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO,caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if(importFlag==true){ - caseApplicationVO.setImportFlag(1); - }else { - caseApplicationVO.setImportFlag(0); - } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if(caseFlow != null){ - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - - return AjaxResult.success(); - }else if(mediaResult.intValue()==5){ - // 达成和解 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - String path = annexPath; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); - - Long arbitratorId = application.getMediatorId(); - if (arbitratorId!=null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + //解析文件签名印章位置 + JSONArray jsonArray = JSONArray.parseArray(keywordPositions); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject3 = jsonArray.getJSONObject(i); + String keyword = jsonObject3.getString("keyword"); + if (keyword.equals("甲方(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsn(positionX + 120); + sealSignRecord.setPositionYpsn(positionY); } + } else if (keyword.equals("乙方(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnRes(positionX + 120); + sealSignRecord.setPositionYpsnRes(positionY + 10); + } + } else if (keyword.equals("调解员(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnMedi(positionX + 120); + sealSignRecord.setPositionYpsnMedi(positionY + 10); + } + } else { + //用印 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXorg(positionX + 90); + sealSignRecord.setPositionYorg(positionY); + } + } + } - Integer organizeFlag = caseAffiliate.getOrganizeFlag(); - if(organizeFlag!=null){ - if(organizeFlag.intValue()==1){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - String nameAgent = caseAffiliate.getNameAgent(); - if(StringUtils.isNotBlank(nameAgent)){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone()); - sealSignRecord.setPensonName(caseAffiliate.getApplicationName()); - } + String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 + String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 + String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 + //查询机构信息 + DeptIdentify deptIdentify1 = new DeptIdentify(); + deptIdentify1.setIdentifyName(orgnizeName); + deptIdentify1.setOperName(orgnizeNamepsnName); + deptIdentify1.setOperPhone(orgnizeNamePsnAccount); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + Long iddeptIdent = deptIdentifies.get(0).getId(); + SealManage sealManage = new SealManage(); + sealManage.setIdentifyId(iddeptIdent); + List sealIdList = new ArrayList<>(); + List selectSealList = sealManageMapper.selectSealList(sealManage); + if (selectSealList != null && selectSealList.size() > 0) { + for (SealManage manage : selectSealList) { + Integer sealStatus = manage.getSealStatus(); + Integer isUse = manage.getIsUse(); + if (sealStatus == 1 && isUse == 1) { + sealIdList.add(manage.getSealId()); } } - - sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone()); - sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName()); - -// DeptIdentify deptIdentify = new DeptIdentify(); -// deptIdentify.setIsUse(1); -// DeptIdentify deptIdentifyselect = new DeptIdentify(); -// List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); -// if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { -// deptIdentifyselect = deptIdentifysnew.get(0); -// sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); -// sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); -// sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); -// } else { -// return AjaxResult.error("没有用印时的机构名称及经办人信息"); -// } - - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - }else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } - } - } - - EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); + EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); if (jsonObject3 != null) { @@ -2790,149 +2654,485 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msSealSignRecord.setFileId(sealSignRecord.getFileid()); msSealSignRecord.setFileName(sealSignRecord.getFilename()); msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); + msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); sealSignRecordMapper.insert(msSealSignRecord); SealSignRecord sealSignRecordapply = new SealSignRecord(); sealSignRecordapply.setSignFlowid(signFlowId); - - String nameAgent = caseAffiliate.getNameAgent(); - if(StringUtils.isNotBlank(nameAgent)){ - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - }else { - sealSignRecordapply.setPensonAccount(caseAffiliate.getApplicationPhone()); - } - + // todo + // 设置申请人账户 + sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); + String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - if(StringUtils.isNotBlank(nameAgent)){ - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum(),urlapplynew}); - }else { - request.setPhone(caseAffiliate.getApplicationPhone()); - request.setTemplateParamSet(new String[]{caseAffiliate.getApplicationName(), application.getCaseNum(),urlapplynew}); - } + request.setTemplateId("2115975"); + // todo + // 申请人发送短信 + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); Boolean aBoolean = SmsUtils.sendSms(request); - - if(StringUtils.isNotBlank(nameAgent)){ - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), caseAffiliate.getContactTelphoneAgent(), new Date(), "尊敬的" + caseAffiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - }else { - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), caseAffiliate.getApplicationPhone(), new Date(), "尊敬的" + caseAffiliate.getApplicationName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - } - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), caseAffiliate.getRespondentPhone(), new Date(), "尊敬的" + caseAffiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), + applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); // 新增短信记录 - if (aBoolean1) { + if (aBoolean) { smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); } else { smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); + SealSignRecord sealSignRecordRespon = new SealSignRecord(); + sealSignRecordRespon.setSignFlowid(signFlowId); + // 被申请人账户 + sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); + JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); + JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); + String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); + String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2115975"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); + Boolean aBoolean1 = SmsUtils.sendSms(request1); + + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); + // 新增短信记录 + if (aBoolean1) { + resSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + resSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 调解员账户 + SealSignRecord sealSignRecordMedi = new SealSignRecord(); + sealSignRecordMedi.setSignFlowid(signFlowId); + sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); + EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); + JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); + JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); + String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); + String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); + requestMedi.setTemplateId("2115975"); + requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); + requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); + Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); + + SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信"); + // 新增短信记录 + if (aBooleanMedi) { + smsSendRecord1.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + smsSendRecord1.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord1); + } else { throw new ServiceException(jsonObject3.getString("message")); } } else { return AjaxResult.error(); } - - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if(caseFlow != null){ - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - return AjaxResult.success(); - }else{ - return AjaxResult.error(); } - }else{ + } else { return AjaxResult.error(); } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } + + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); + } else { + return AjaxResult.error(); } - break; + } else { + return AjaxResult.error(); } } + break; + } + } } + return AjaxResult.success(); + } else if (mediaResult.intValue() == 2) { + //未达成调解 + //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2066725"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); + Boolean aBoolean = SmsUtils.sendSms(request); + // 新增短信记录 + SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信"); + if (aBoolean) { + appSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + appSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); + // 被申请人短信 + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2066725"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); + Boolean aBoolean1 = SmsUtils.sendSms(request1); + // 新增短信记录 + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信"); + if (aBoolean1) { + resSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + resSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + } + return AjaxResult.success(); + } else if (mediaResult.intValue() == 3) { + //未达成调解但不再争议 + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + } + return AjaxResult.success(); + } else if (mediaResult.intValue() == 4) { + //未达成调解但同意引入仲裁 + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); + + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag == true) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + } + + return AjaxResult.success(); + } else if (mediaResult.intValue() == 5) { + // 达成和解 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (MsCaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { + // String prefix = "/profile"; + // int startIndex = prefix.length(); + String annexPath = caseAttach.getAnnexPath(); +// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + String path = annexPath; + //获取文件上传地址 + EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + String fileId = jsonObject.getJSONObject("data").getString("fileId"); + String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); + //上传文件流 + EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + if (jsonObject1.getIntValue("errCode") == 0) { + //查看文件上传状态 + Thread.sleep(1000); + EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + JSONObject data = jsonObject2.getJSONObject("data"); + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { + String fileName = data.getString("fileName"); + //上传成功,获取文件签名印章位置 + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setFileid(fileId); + EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); + Gson gson = new Gson(); + JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); + JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); + String keywordPositions = positionsData.get("keywordPositions").toString(); + //发起签署 + sealSignRecord.setFilename(fileName); + + Long arbitratorId = application.getMediatorId(); + if (arbitratorId != null) { + SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); + if (sysUser == null) { + return AjaxResult.error(); + } + sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); + sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + } + // todo 申请人账户 + sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); + // 被申账户 + sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); + //解析文件签名印章位置 + JSONArray jsonArray = JSONArray.parseArray(keywordPositions); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject3 = jsonArray.getJSONObject(i); + String keyword = jsonObject3.getString("keyword"); + if (keyword.equals("甲方(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsn(positionX + 120); + sealSignRecord.setPositionYpsn(positionY); + } + } else if (keyword.equals("乙方(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnRes(positionX + 120); + sealSignRecord.setPositionYpsnRes(positionY + 10); + } + } + } + + EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); + + JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); + if (jsonObject3 != null) { + if (jsonObject3.getIntValue("code") == 0) { + //获取签署流程ID + JSONObject data1 = jsonObject3.getJSONObject("data"); + String signFlowId = data1.getString("signFlowId"); + //保存案件id,文件id,文件名称.流程id到签署用印记录表里 + sealSignRecord.setCaseAppliId(application.getId()); + sealSignRecord.setSignFlowid(signFlowId); + sealSignRecord.setSignFlowStatus(1);//待签名 + MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); + BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); + msSealSignRecord.setFileId(sealSignRecord.getFileid()); + msSealSignRecord.setFileName(sealSignRecord.getFilename()); + msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + sealSignRecordMapper.insert(msSealSignRecord); + // 申请人签名记录 + SealSignRecord sealSignRecordapply = new SealSignRecord(); + sealSignRecordapply.setSignFlowid(signFlowId); + sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); + + //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2047719"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); + Boolean aBoolean = SmsUtils.sendSms(request); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); + // 新增短信记录 + if (aBoolean) { + smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + // 被申签名记录 + SealSignRecord sealSignRecordRespon = new SealSignRecord(); + sealSignRecordRespon.setSignFlowid(signFlowId); + sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); + JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); + JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); + String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); + String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2047719"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); + Boolean aBoolean1 = SmsUtils.sendSms(request1); + + SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); + // 新增短信记录 + if (aBoolean1) { + resSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + resSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSendRecord); + + } else { + throw new ServiceException(jsonObject3.getString("message")); + } + } else { + return AjaxResult.error(); + } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } + + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } else { + return AjaxResult.error(); + } + } + break; + } + } + } + } + } else { // 线下调解 List attachList = req.getAttachList(); - if(CollectionUtil.isEmpty(attachList)){ + if (CollectionUtil.isEmpty(attachList)) { return AjaxResult.error("请上传调解资料"); } // 先删除已经存在的调解书 - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(),AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(StrUtil.isEmpty(application.getCaseSource())){ + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); for (MsCaseAttach attach : attachList) { attach.setCaseAppliId(req.getId()); msCaseAttachMapper.updateCaseAttach(attach); } + // todo 对接北明,调用上传附件接口 + List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { + for (MsCaseAttach msCaseAttach : msCaseAttaches) { + String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttach(msCaseAttach); + } + } + } // 修改案件状态为待送达 Example flowExample = new Example(MsCaseFlow.class); - if(mediaResult ==1 || mediaResult == 5){ + if (mediaResult == 1 || mediaResult == 5) { // 达成调解,达成和解,案件状态改为待送达 flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); - } else if(mediaResult == 2 || mediaResult == 3){ + } else if (mediaResult == 2 || mediaResult == 3) { // 未达成调解,未达成调解但不在争议改为结束状态 flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - } - else if(mediaResult == 4){ + } else if (mediaResult == 4) { // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); String accessSec = "mCFMA6ffe938v79m"; MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application,applicationVO); + BeanUtils.copyProperties(application, applicationVO); CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO,caseApplicationVO); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); boolean importFlag = applicationVO.isImportFlag(); - if(importFlag==true){ + if (importFlag == true) { caseApplicationVO.setImportFlag(1); - }else { + } else { caseApplicationVO.setImportFlag(0); } String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); @@ -2946,13 +3146,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { .execute(); } MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if(caseFlow != null){ + if (caseFlow != null) { application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setMediaResult(mediaResult); msCaseApplicationMapper.updateByPrimaryKey(application); // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + // todo 结束对接北明,为调解失败状态 + caseApplicationService. pushStatusToBM(application, PushCaseStatusEnum.FAIL); + } } return AjaxResult.success(); } @@ -3012,689 +3217,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.success(); } - /** - * 确认调解书 - * @param attach - * @return - */ - @Transactional(rollbackFor = Exception.class) - @Override - public AjaxResult confirmMediation(MsCaseAttachVO attach) throws EsignDemoException, InterruptedException { - if(attach.getAnnexId()!=null){ - // 删除之前的调解书 - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode()); - msCaseAttachMapper.updateCaseAttach(attach); - } - // todo 发送短信 - // 更新流程节点 - caseApplicationService.nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode()); - - Long id = attach.getCaseAppliId(); - MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); - caseApplication.setIsReconci(attach.getIsReconci()); - msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication); - - // 查询案件相关人员 - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); - Integer isReconci = attach.getIsReconci(); - - if(attach.getAnnexId()!=null){ - MsCaseAttach caseAttach = msCaseAttachMapper.queryAnnexById(attach.getAnnexId()); - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - String prefix = "/profile"; - int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); - String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); - - Long arbitratorId = caseApplication.getMediatorId(); - if (null!=arbitratorId) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone()); - sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName()); - - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIsUse(1); - DeptIdentify deptIdentifyselect = new DeptIdentify(); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - deptIdentifyselect = deptIdentifysnew.get(0); - sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); - sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); - sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); - } else { - return AjaxResult.error("没有用印时的机构名称及经办人信息"); - } - - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - }else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } - }else if (keyword.equals("调解员(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnMedi(positionX + 120); - sealSignRecord.setPositionYpsnMedi(positionY + 10); - } - }else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX + 90); - sealSignRecord.setPositionYorg(positionY); - } - } - } - - if(isReconci.intValue()==1){ - EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(caseApplication.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); - } - - }else { - /*DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setSealStatus(1); // 印章状态为启用 - //根据机构名称查询部门id - SysDept sysDept = new SysDept(); - sysDept.setDeptName(sealSignRecord.getOrgnizeName()); - List sysDepts = deptMapper.selectDeptList(sysDept); - if (sysDepts != null && sysDepts.size() > 0) { - Long deptId = sysDepts.get(0).getDeptId(); - deptIdentify1.setDeptId(deptId); - } - List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1); - List sealIds = new ArrayList<>(); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - for (DeptIdentify identify : deptIdentifies) { - String sealId = identify.getSealId(); - sealIds.add(sealId); - } - }*/ - String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 - String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 - String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 - //查询机构信息 - DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setIdentifyName(orgnizeName); - deptIdentify1.setOperName(orgnizeNamepsnName); - deptIdentify1.setOperPhone(orgnizeNamePsnAccount); - List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - Long iddeptIdent = deptIdentifies.get(0).getId(); - SealManage sealManage = new SealManage(); - sealManage.setIdentifyId(iddeptIdent); - List sealIdList = new ArrayList<>(); - List selectSealList = sealManageMapper.selectSealList(sealManage); - if (selectSealList != null && selectSealList.size() > 0) { - for (SealManage manage : selectSealList) { - Integer sealStatus = manage.getSealStatus(); - Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse ==1) { - sealIdList.add(manage.getSealId()); - } - } - EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(caseApplication.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); - msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SealSignRecord sealSignRecordMedi = new SealSignRecord(); - sealSignRecordMedi.setSignFlowid(signFlowId); - sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); - EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); - JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); - JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); - String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); - String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2047719"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi}); - Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); - } - } - } else { - return AjaxResult.error(); - } - } - - - }else { - return AjaxResult.error(); - } - }else { - return AjaxResult.error(); - } - }else { - return AjaxResult.error(); - } - } - }else { - // 查询附件 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - String prefix = "/profile"; - int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); - String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); - - Long arbitratorId = caseApplication.getMediatorId(); - if (arbitratorId!=null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone()); - sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName()); - - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIsUse(1); - DeptIdentify deptIdentifyselect = new DeptIdentify(); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - deptIdentifyselect = deptIdentifysnew.get(0); - sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); - sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); - sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); - } else { - return AjaxResult.error("没有用印时的机构名称及经办人信息"); - } - - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - }else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } - }else if (keyword.equals("调解员(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnMedi(positionX + 120); - sealSignRecord.setPositionYpsnMedi(positionY + 10); - } - }else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX + 90); - sealSignRecord.setPositionYorg(positionY); - } - } - } - - if(isReconci.intValue()==1){ - EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(caseApplication.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); - } - - }else { - /*DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setSealStatus(1); // 印章状态为启用 - //根据机构名称查询部门id - SysDept sysDept = new SysDept(); - sysDept.setDeptName(sealSignRecord.getOrgnizeName()); - List sysDepts = deptMapper.selectDeptList(sysDept); - if (sysDepts != null && sysDepts.size() > 0) { - Long deptId = sysDepts.get(0).getDeptId(); - deptIdentify1.setDeptId(deptId); - } - List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1); - List sealIds = new ArrayList<>(); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - for (DeptIdentify identify : deptIdentifies) { - String sealId = identify.getSealId(); - sealIds.add(sealId); - } - }*/ - String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 - String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 - String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 - //查询机构信息 - DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setIdentifyName(orgnizeName); - deptIdentify1.setOperName(orgnizeNamepsnName); - deptIdentify1.setOperPhone(orgnizeNamePsnAccount); - List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - Long iddeptIdent = deptIdentifies.get(0).getId(); - SealManage sealManage = new SealManage(); - sealManage.setIdentifyId(iddeptIdent); - List sealIdList = new ArrayList<>(); - List selectSealList = sealManageMapper.selectSealList(sealManage); - if (selectSealList != null && selectSealList.size() > 0) { - for (SealManage manage : selectSealList) { - Integer sealStatus = manage.getSealStatus(); - Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse ==1) { - sealIdList.add(manage.getSealId()); - } - } - EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(caseApplication.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); - msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SealSignRecord sealSignRecordMedi = new SealSignRecord(); - sealSignRecordMedi.setSignFlowid(signFlowId); - sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); - EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); - JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); - JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); - String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); - String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2047719"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi}); - Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); - } - - } - - - } else { - return AjaxResult.error(); - } - } - }else{ - return AjaxResult.error(); - } - }else{ - return AjaxResult.error(); - } - } - break; - } - - } - - } - } - return AjaxResult.success(); - } - /** @@ -3732,21 +3254,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { /** * 生成调解申请书 * @param application 案件基本信息 - * @param affiliate 案件相关人员 + * @param affiliates 案件相关人员 * @param templatePath 模板路径 * @param bookmarkList 标签 * @param dictDataList 内置字段 */ @Transactional - public void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List bookmarkList, List dictDataList,Integer templateType) { + public void createMediateApplication(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList,Integer templateType) { // 申请书需要的字段和内容,valueMap<占位符,替换的值> Map valueMap = new HashMap<>(); + // 操作人信息 + Map> operatorMap = affiliates.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getOperatorFlag, Collectors.toList())); + // 按角色分类 + Map roleTypeMap = affiliates.stream().collect(Collectors.toMap(MsCaseAffiliate::getRoleType, Function.identity(), (k1, k2) -> k1)); +// Map> roleTypeMap = affiliates.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getRoleType, Collectors.toList())); + for (SysDictData dictData : dictDataList) { if (CASE_BASE_COLUMN.contains(dictData.getDictValue())) { valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(application, dictData.getDictValue())); } else { - // 相关人员字段 - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(affiliate, dictData.getDictValue())); + // todo 相关人员字段,如果有多个申请人,被申请人,模板需要变化,待讨论,暂做成取第一个操作人 + List msCaseAffiliates = operatorMap.get(1); + if(CollectionUtil.isNotEmpty(msCaseAffiliates)) { + Map roleTypeOperatorMap = msCaseAffiliates.stream().collect(Collectors.toMap(MsCaseAffiliate::getRoleType, Function.identity(), (k1, k2) -> k1)); + if(dictData.getDictLabel().contains("被申请人")){ + if(roleTypeOperatorMap.get(3)!=null ) { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(3), dictData.getDictValue())); + }else { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(3), dictData.getDictValue())); + } + }else if(dictData.getDictLabel().contains("被申请人委托代理人")){ + if(roleTypeOperatorMap.get(4)!=null ) { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(4), dictData.getDictValue())); + }else { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(4), dictData.getDictValue())); + } + }else if(dictData.getDictLabel().contains("申请人") + || dictData.getDictLabel().equals("统一社会信用代码") + || dictData.getDictLabel().equals("法定代表人") + ){ + if(roleTypeOperatorMap.get(1)!=null ) { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(1), dictData.getDictValue())); + }else { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(1), dictData.getDictValue())); + } + }else if(dictData.getDictLabel().contains("委托代理人")){ + if(roleTypeOperatorMap.get(2)!=null ) { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(2), dictData.getDictValue())); + }else { + valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(2), dictData.getDictValue())); + } + } + } } } @@ -4074,130 +3633,102 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public void insertAgentUser(MsCaseAffiliate affiliate) { - // 查询申请人角色id - Long roleId = roleMapper.selectRoleIdByName("申请人"); - // 根据代理人手机号去用户表查询,有修改,么有新增 - SysUser agentUser = userMapper.selectUserByPhone(affiliate.getContactTelphoneAgent()); - // 代理人为空,新增代理人 - if (agentUser == null) { - agentUser = new SysUser(); - agentUser.setUserName(affiliate.getContactTelphoneAgent()); - agentUser.setNickName(affiliate.getNameAgent()); - agentUser.setPhonenumber(affiliate.getContactTelphoneAgent()); - agentUser.setPassword(SecurityUtils.encryptPassword("abc123456")); - agentUser.setNationality(affiliate.getNationality()); - agentUser.setIdType(affiliate.getIdType()); - // agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId())); - userMapper.insertUser(agentUser); - userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); - // 新增部门用户关联表 - SysUserDept sysUserDept = new SysUserDept(); - sysUserDept.setUserId(agentUser.getUserId()); - sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId())); - userDeptMapper.insert(sysUserDept); - // 发送短信 2064355 调解系统自动创建用户短信通知 尊敬的用户,您的案件已经创建,请使用账号为{1},密码为{2}登录调解系统,请知晓,如非本人操作,请忽略本短信。 - Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2064355", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getContactTelphoneAgent(), "abc123456"}); - } else { - // 查询所有部门 - List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); - Map> deptMap=new HashMap<>(); - if(CollectionUtil.isNotEmpty(sysDepts)){ - deptMap = sysDepts.stream().collect(Collectors.groupingBy(SysDept::getDeptName)); - } - - if(!deptMap.containsKey(affiliate.getApplicationName())){ - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(affiliate.getApplicationName()); - dept.setAncestors("0"); - dept.setOrderNum(1); - dept.setStatus("0"); - dept.setDelFlag("0"); - dept.setCreateBy(getUsername()); - dept.setUpdateBy(getUsername()); - sysDeptMapper.insertDept(dept); - List depts = new ArrayList<>(); - depts.add(dept); - deptMap.put(dept.getDeptName(), depts); - affiliate.setApplicationId(String.valueOf(dept.getDeptId())); - affiliate.setApplicationName(affiliate.getApplicationName()); - }else { - // 将组织机构id设为申请人名称 - affiliate.setApplicationId(deptMap.get(affiliate.getApplicationName()).get(0).getDeptId().toString()); - affiliate.setApplicationName(affiliate.getApplicationName()); - } - // 根据userId查询部门 - List userDeptList = userDeptMapper.selectUserDeptById(agentUser.getUserId()); - if(CollectionUtil.isEmpty(userDeptList)){ - // 未关联部门,关联部门,新增部门用户关联表 - SysUserDept sysUserDept = new SysUserDept(); - sysUserDept.setUserId(agentUser.getUserId()); - sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId())); - userDeptMapper.insert(sysUserDept); - }else { - List deptIdList = userDeptList.stream().map(SysUserDept::getDeptId).collect(Collectors.toList()); - if(!deptIdList.contains(Long.valueOf(affiliate.getApplicationId()))){ - // 未关联该部门,关联部门,新增部门用户关联表 - SysUserDept sysUserDept = new SysUserDept(); - sysUserDept.setUserId(agentUser.getUserId()); - sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId())); - userDeptMapper.insert(sysUserDept); - // 同步用户表和案件关联人表的手机号和名称 - affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent()); - affiliate.setNameAgent(agentUser.getNickName()); - affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail()) ? agentUser.getEmail() : affiliate.getAgentEmail()); - List longList = new ArrayList<>(); - // 新增角色为申请人 - if (CollectionUtil.isNotEmpty(agentUser.getRoles())) { - longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()); - if (!longList.contains(roleId)) { - // 删除之前关联的角色 - userRoleMapper.deleteUserRoleByUserId(agentUser.getUserId()); - userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); - } - } else { - userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); - } - - } - } - } +// // 查询申请人角色id +// Long roleId = roleMapper.selectRoleIdByName("申请人"); +// // 根据代理人邮箱去用户表查询,有修改,么有新增 +// SysUser agentUser = userMapper.selectUserByEmail(affiliate.getEmail()); +// // 代理人为空,新增代理人 +// if (agentUser == null) { +// agentUser = new SysUser(); +// agentUser.setUserName(affiliate.getEmail()); +// agentUser.setNickName(affiliate.getName()); +// agentUser.setPhonenumber(affiliate.getPhone()); +// agentUser.setPassword(SecurityUtils.encryptPassword("abc123456")); +// agentUser.setNationality(affiliate.getNationality()); +// agentUser.setIdType(affiliate.getIdType()); +// agentUser.setIdCard(affiliate.getIdCard()); +// agentUser.setSex(affiliate.getSex()); +// agentUser.setHome(affiliate.getHome()); +// agentUser.setAddress(affiliate.getAddress()); +// // agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId())); +// userMapper.insertUser(agentUser); +// userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); +// // 新增部门用户关联表 +// SysUserDept sysUserDept = new SysUserDept(); +// sysUserDept.setUserId(agentUser.getUserId()); +// sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicantDeptId())); +// userDeptMapper.insert(sysUserDept); +// // todo 发送短信 2064355 调解系统自动创建用户短信通知 尊敬的用户,您的案件已经创建,请使用账号为{1},密码为{2}登录调解系统,请知晓,如非本人操作,请忽略本短信。 +// // Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2064355", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getContactTelphoneAgent(), "abc123456"}); +// } else { +// // 查询所有部门 +// List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); +// Map> deptMap=new HashMap<>(); +// if(CollectionUtil.isNotEmpty(sysDepts)){ +// deptMap = sysDepts.stream().collect(Collectors.groupingBy(SysDept::getDeptName)); +// } +// +// if(!deptMap.containsKey(affiliate.getName())){ +// // 如果不存在则新增 +// SysDept dept = new SysDept(); +// dept.setParentId(0L); +// dept.setDeptName(affiliate.getName()); +// dept.setAncestors("0"); +// dept.setOrderNum(1); +// dept.setStatus("0"); +// dept.setDelFlag("0"); +// dept.setCreateBy(getUsername()); +// dept.setUpdateBy(getUsername()); +// sysDeptMapper.insertDept(dept); +// List depts = new ArrayList<>(); +// depts.add(dept); +// deptMap.put(dept.getDeptName(), depts); +// affiliate.setApplicantDeptId(dept.getDeptId()); +// }else { +// // 将组织机构id设为申请人名称 +// affiliate.setApplicantDeptId(deptMap.get(affiliate.getName()).get(0).getDeptId()); +// +// } +// // 根据userId查询部门 +// List userDeptList = userDeptMapper.selectUserDeptById(agentUser.getUserId()); +// if(CollectionUtil.isEmpty(userDeptList)){ +// // 未关联部门,关联部门,新增部门用户关联表 +// SysUserDept sysUserDept = new SysUserDept(); +// sysUserDept.setUserId(agentUser.getUserId()); +// sysUserDept.setDeptId(affiliate.getApplicantDeptId()); +// userDeptMapper.insert(sysUserDept); +// }else { +// List deptIdList = userDeptList.stream().map(SysUserDept::getDeptId).collect(Collectors.toList()); +// if(!deptIdList.contains(affiliate.getApplicantDeptId())){ +// // 未关联该部门,关联部门,新增部门用户关联表 +// SysUserDept sysUserDept = new SysUserDept(); +// sysUserDept.setUserId(agentUser.getUserId()); +// sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId())); +// userDeptMapper.insert(sysUserDept); +// // 同步用户表和案件关联人表的手机号和名称 +// affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent()); +// affiliate.setNameAgent(agentUser.getNickName()); +// affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail()) ? agentUser.getEmail() : affiliate.getAgentEmail()); +// List longList = new ArrayList<>(); +// // 新增角色为申请人 +// if (CollectionUtil.isNotEmpty(agentUser.getRoles())) { +// longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()); +// if (!longList.contains(roleId)) { +// // 删除之前关联的角色 +// userRoleMapper.deleteUserRoleByUserId(agentUser.getUserId()); +// userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); +// } +// } else { +// userRoleMapper.insertUserRole(agentUser.getUserId(), roleId); +// } +// +// } +// } +// } } /** - * 新增部门 - * - * @param affiliate - */ - @Transactional - public void insertDept(MsCaseAffiliate affiliate) { - // 查询所有的组织机构,组装成map - List deptList = sysDeptMapper.selectDeptList(new SysDept()); - if (CollectionUtil.isEmpty(deptList)) { - deptList = new ArrayList<>(); - } - Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV)); - // 将组织机构id设为申请人名称 - if (deptMap.containsKey(affiliate.getApplicationName())) { - affiliate.setApplicationId(String.valueOf(deptMap.get(affiliate.getApplicationName()))); - } else { - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(affiliate.getApplicationName()); - dept.setAncestors("0"); - dept.setOrderNum(1); - dept.setStatus("0"); - dept.setDelFlag("0"); - dept.setCreateBy(getUsername()); - dept.setUpdateBy(getUsername()); - sysDeptMapper.insertDept(dept); - deptMap.put(dept.getDeptName(), dept.getDeptId()); - affiliate.setApplicationId(String.valueOf(dept.getDeptId())); - } - } /** * 获取案件编码 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java index 262359a..b90b50a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.PaymentStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.spring.SpringUtils; @@ -40,6 +41,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; @Service public class MsCasePaymentServiceImpl implements MsCasePaymentService { @@ -226,7 +228,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } JSONObject jsonObject = new JSONObject(); jsonObject.set("totalFee", totalFee); - jsonObject.set("applicationOrganName", affiliate.getApplicationName()); + // jsonObject.set("applicationOrganName", affiliate.getApplicationName()); return AjaxResult.success(jsonObject); } @@ -248,10 +250,6 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { result.setCaseSubjectAmount(application.getCaseSubjectAmount()); result.setFeePayable(application.getFeePayable()); result.setCaseStatusName(application.getCaseStatusName()); - MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId()); - if(affiliate != null) { - result.setApplicationOrganName(affiliate.getApplicationName()); - } // 查询缴费单 result.setCaseAttachList(caseAttachMapper.listCaseAttachByCaseIdAndType(id, AnnexTypeEnum.PAYMENT_RECEIPT.getCode())); result.setResCaseAttachList(caseAttachMapper.listCaseAttachByCaseIdAndType(id, AnnexTypeEnum.RES_PAYMENT_RECEIPT.getCode())); @@ -369,12 +367,78 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } auditMapper.insert(audit); } - // 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信 - MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId()); - // 发送缴费通知 - sendPaymentSms(dto,caseAppllication, affiliate,flow); - + // 查询案件人员 + List affiliates = applicationService.selectAffliatesByCaseId(application.getId()); + if(CollectionUtil.isEmpty(affiliates)){ + throw new ServiceException("未找到案件相关人员"); + } + List operatorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag().equals(1) && StrUtil.isNotEmpty(affiliate.getPhone())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(operatorList)){ + throw new ServiceException("未找到案件操作人员"); + } + if(dto.getApplicantConfirm()) { + // 申请人确认缴费 + for (MsCaseAffiliate affiliate : operatorList) { + // 发送缴费通知 + if (affiliate.getRoleType() == null) { + continue; + } + if (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2)) { + Boolean smsFlag = true; + SmsSendRecord smsSendRecord = null; + if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 缴费通过 + smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。"); + } else { + smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); + // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + } + // 新增短信记录 + if (smsFlag) { + smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + } + } + }else { + // 被申请人确认缴费 + for (MsCaseAffiliate affiliate : operatorList) { + // 发送缴费通知 + if (affiliate.getRoleType() == null) { + continue; + } + if (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) { + Boolean smsFlag = true; + SmsSendRecord smsSendRecord = null; + if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 缴费通过 + smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。"); + } else { + smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); + // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + } + // 新增短信记录 + if (smsFlag) { + smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + } else { + smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + } + // 被申请人确认缴费,发送受理通知 + if( dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // 申请人发送受理短信 + casePaymentService.sendAcceptSms(dto, caseAppllication, affiliate.getName(), affiliate.getPhone()); + } + } + } } @@ -395,76 +459,15 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } - /** - * 发送缴费短信 - * @param dto - * @param caseAppllication - * @param affiliate - */ - private void sendPaymentSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication, MsCaseAffiliate affiliate,MsCaseFlow flow) { - if (affiliate != null) { - // 受理通知 - String phone = ""; - String userName = ""; - // 缴费通知 - String payPhone = ""; - String payUserName = ""; - if (affiliate.getOrganizeFlag().equals(0)) { - // 自然人 - if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { - phone = affiliate.getContactTelphoneAgent(); - userName = affiliate.getNameAgent(); - } else { - phone = affiliate.getApplicationPhone(); - userName = affiliate.getApplicationName(); - } - } else { - phone = affiliate.getContactTelphoneAgent(); - userName = affiliate.getNameAgent(); - } - if (StrUtil.isNotEmpty(phone)) { - payPhone=phone; - payUserName=userName; - if(!dto.getApplicantConfirm()) { - // 被申请人发送通知 - payPhone=affiliate.getRespondentPhone(); - payUserName=affiliate.getRespondentName(); - } - Boolean smsFlag =true; - SmsSendRecord smsSendRecord=null; - // 申请人被申请人发送缴费成功短信 2051914 调解缴费成功通知 尊敬的{1},您的调解申请费用已缴费成功。 - if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", payPhone, new String[]{payUserName}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), payPhone, new Date(), "尊敬的" + payUserName + ",您的调解申请费用已缴费成功。"); - } else { - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", payPhone, new String[]{payUserName, caseAppllication.getCaseNum(), dto.getReason()}); - // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), payPhone, new Date(), "尊敬的" + payUserName + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); - } - // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - if(!dto.getApplicantConfirm()&& dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { - // 申请人发送受理短信 - sendAcceptSms(dto, caseAppllication, userName, phone); - // 被申请人发送受理短信 - sendAcceptSms(dto, caseAppllication, affiliate.getRespondentName(), affiliate.getRespondentPhone()); - } - } - } - } /** * 发送受理短信 * @param dto * @param caseAppllication */ - private void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) { + @Transactional + public void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) { // 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。 Boolean smsFlag = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。"); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 6b50870..515950e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -4,8 +4,8 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -16,18 +16,20 @@ import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.AnnexTypeEnum; +import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.common.enums.PushCaseStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; +import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord; @@ -40,6 +42,7 @@ import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO; import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper; @@ -54,6 +57,7 @@ import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.SignAward; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.entity.Example; @@ -106,286 +110,19 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Autowired private SendMailRecordMapper sendMailRecordMapper; + // 北明配置 + @Value("${BMConfig.userName}") + private String BMUserName; + @Value("${BMConfig.password}") + private String BMPassword; + @Value("${BMConfig.syncSource}") + private String BMSyncSource; + @Autowired + BeiMingInterfaceService beiMingInterfaceService; - @Override - @Transactional - public AjaxResult sureMediationSeal(MsCaseApplicationVO caseApplicationVO) throws EsignDemoException, InterruptedException { - Long id = caseApplicationVO.getId(); - MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id); - // 查询案件相关人员 - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); - // 查询附件 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { -// String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi" + annexPath; - String prefix = "/profile"; - int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - String path = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\12\\f8551b0e003e4af89acae7b500dacb77调解书.docx"; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); - - Long arbitratorId = caseApplication.getMediatorId(); - if (arbitratorId!=null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone()); - sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName()); - - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIsUse(1); - DeptIdentify deptIdentifyselect = new DeptIdentify(); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - deptIdentifyselect = deptIdentifysnew.get(0); - sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); - sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); - sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); - } else { - return AjaxResult.error("没有用印时的机构名称及经办人信息"); - } - - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 90); - sealSignRecord.setPositionYpsn(positionY + 30); - } - }else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 90); - sealSignRecord.setPositionYpsnRes(positionY); - } - }else if (keyword.equals("调解员(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnMedi(positionX + 90); - sealSignRecord.setPositionYpsnMedi(positionY); - } - }else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX + 90); - sealSignRecord.setPositionYorg(positionY); - } - } - } - /*DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setSealStatus(1); // 印章状态为启用 - //根据机构名称查询部门id - SysDept sysDept = new SysDept(); - sysDept.setDeptName(sealSignRecord.getOrgnizeName()); - List sysDepts = deptMapper.selectDeptList(sysDept); - if (sysDepts != null && sysDepts.size() > 0) { - Long deptId = sysDepts.get(0).getDeptId(); - deptIdentify1.setDeptId(deptId); - } - List deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1); - List sealIds = new ArrayList<>(); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - for (DeptIdentify identify : deptIdentifies) { - String sealId = identify.getSealId(); - sealIds.add(sealId); - } - }*/ - String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 - String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 - String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 - //查询机构信息 - DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setIdentifyName(orgnizeName); - deptIdentify1.setOperName(orgnizeNamepsnName); - deptIdentify1.setOperPhone(orgnizeNamePsnAccount); - List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - Long iddeptIdent = deptIdentifies.get(0).getId(); - SealManage sealManage = new SealManage(); - sealManage.setIdentifyId(iddeptIdent); - List sealIdList = new ArrayList<>(); - List selectSealList = sealManageMapper.selectSealList(sealManage); - if (selectSealList != null && selectSealList.size() > 0) { - for (SealManage manage : selectSealList) { - Integer sealStatus = manage.getSealStatus(); - Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse ==1) { - sealIdList.add(manage.getSealId()); - } - } - EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(caseApplication.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); - msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(caseAffiliate.getContactTelphoneAgent()); - request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(caseAffiliate.getRespondentPhone()); - request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SealSignRecord sealSignRecordMedi = new SealSignRecord(); - sealSignRecordMedi.setSignFlowid(signFlowId); - sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); - EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); - JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); - JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); - String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); - String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2047719"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi}); - Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); - } - - } - - - } else { - return AjaxResult.error(); - } - } - } - } - break; - } - - } - - } - return AjaxResult.success(); - } @Override @Transactional @@ -457,8 +194,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { public AjaxResult selectCaseProgress(MsSignSealDTO dto) { Map datas = new HashMap<>(); Long id = dto.getCaseId(); -// MsCaseLogRecord caseLogRecord = new MsCaseLogRecord(); -// caseLogRecord.setCaseAppliId(id); List records = caseLogRecordMapper.selectCaseLogRecordListCaseProgress(dto.getCaseId()); MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(id); @@ -468,7 +203,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { List recordsNew = new ArrayList<>(); if (records != null && records.size() > 0) { for (MsCaseLogRecordVO msCaseLogRecordVO : records) { -// String content = msCaseLogRecordVO.getContent(); String content = msCaseLogRecordVO.getCaseStatusName(); if(StringUtils.isNotEmpty(content)){ if(content.equals("结束")){ @@ -594,6 +328,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult msCaseFile(List ids){ + // todo try { for (Long id : ids) { MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id); @@ -606,10 +341,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { -// String annexName = caseAttach.getAnnexName(); -// String prefix = "/profile/upload/"; -// int startIndex = prefix.length(); -// String path = caseAttach.getAnnexPath() + annexName.substring(startIndex); String prefix = "/profile"; int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); @@ -638,9 +369,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { String day = String.format("%02d", now.getDayOfMonth()); String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; - -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String savePath = "/home/ruoyi/uploadPath/upload/"; String saveName = fileName; String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; @@ -687,61 +415,48 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName()); caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1); - String appEmail = ""; - String resEmail = ""; - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id); + // 获取案件相关人员 + List affiliates = applicationService.selectAffliatesByCaseId(id); + if(CollectionUtil.isEmpty(affiliates)){ + return AjaxResult.error("未找到案件相关人员"); + } + List oprratorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null + && affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail())) + .collect(Collectors.toList()); + if(CollectionUtil.isEmpty(oprratorList)){ + return AjaxResult.error("未找到案件操作人员"); + } - Integer organizeFlag = caseAffiliate.getOrganizeFlag(); - if(organizeFlag!=null){ - if(organizeFlag.intValue()==1){ - appEmail = caseAffiliate.getAgentEmail(); - }else { - appEmail = caseAffiliate.getApplicationEmail(); + for (MsCaseAffiliate affiliate : oprratorList) { + if(affiliate.getRoleType()==null){ + continue; } - } - resEmail = caseAffiliate.getRespondentEmail(); - boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList); + boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList); - SendMailRecord sendMailRecord = new SendMailRecord(); - sendMailRecord.setCaseId(id); - sendMailRecord.setMailAddress(appEmail); - sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅"); -// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); - sendMailRecord.setMailName("签署后的调解书"); - sendMailRecord.setSendTime(new Date()); - sendMailRecord.setCreateBy(SecurityUtils.getUsername()); - if (appEmailFlag) { - sendMailRecord.setSendStatus(1); - } else { - sendMailRecord.setSendStatus(0); + SendMailRecord sendMailRecord = new SendMailRecord(); + sendMailRecord.setCaseId(id); + sendMailRecord.setMailAddress(affiliate.getEmail()); + sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅"); + sendMailRecord.setMailName("签署后的调解书"); + sendMailRecord.setSendTime(new Date()); + sendMailRecord.setCreateBy(SecurityUtils.getUsername()); + if (appEmailFlag) { + sendMailRecord.setSendStatus(1); + } else { + sendMailRecord.setSendStatus(0); + } + sendMailRecordMapper.saveSendMailRecord(sendMailRecord); } - sendMailRecordMapper.saveSendMailRecord(sendMailRecord); - boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList); - - SendMailRecord sendMailRecord1 = new SendMailRecord(); - sendMailRecord1.setCaseId(id); - sendMailRecord1.setMailAddress(resEmail); -// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅"); - sendMailRecord1.setMailContent("您好,审核后的调解书在附件中请查阅"); - sendMailRecord1.setMailName("签署后的调解书"); - sendMailRecord1.setSendTime(new Date()); - sendMailRecord1.setCreateBy(SecurityUtils.getUsername()); - if (resEmailFlag) { - sendMailRecord1.setSendStatus(1); - }else { - sendMailRecord1.setSendStatus(0); - } - sendMailRecordMapper.saveSendMailRecord(sendMailRecord1); - if(!appEmailFlag&&!resEmailFlag){ - throw new ServiceException("调解书发送失败"); - } - if(!appEmailFlag){ - throw new ServiceException("申请人调解书发送失败"); - } - if(!resEmailFlag){ - throw new ServiceException("被申请人调解书发送失败"); - } +// if(!appEmailFlag&&!resEmailFlag){ +// throw new ServiceException("调解书发送失败"); +// } +// if(!appEmailFlag){ +// throw new ServiceException("申请人调解书发送失败"); +// } +// if(!resEmailFlag){ +// throw new ServiceException("被申请人调解书发送失败"); +// } CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); @@ -778,8 +493,10 @@ public class MsSignSealServiceImpl implements MsSignSealService { // } // } if (dto.getIsSignApply() != null && dto.getIsSignApply().intValue() == 1) { - caseAffiliate.setIsSignApply(1); - msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); + // todo 签收不要该字段 + // caseAffiliate.setIsSignApply(1); + // todo 签收不要该字段 + // msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); @@ -802,8 +519,10 @@ public class MsSignSealServiceImpl implements MsSignSealService { // } if (dto.getIsSignRespon() != null && dto.getIsSignRespon().intValue() == 1) { - caseAffiliate.setIsSignRespon(1); - msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); + // todo 签收不要该字段 +// caseAffiliate.setIsSignRespon(1); + // todo 签收不要该字段 +// msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate); // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); @@ -811,6 +530,11 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); + CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null); + // todo 被申请人签收结束对接北明,为调解成功状态 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { + applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); + } } return AjaxResult.success("签收成功"); @@ -819,12 +543,29 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Override public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException { + // todo Long caseId = dto.getCaseId(); - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); - Integer organizeFlag = caseAffiliate.getOrganizeFlag(); + //MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); + List affiliates = applicationService.selectAffliatesByCaseId(caseId); + if(CollectionUtil.isEmpty(affiliates)){ + return AjaxResult.error("未找到案件相关人员"); + } + List operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null + && msCaseAffiliate.getOperatorFlag() == 1 + && StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList()); + Optional appOpt =null; + Optional resOpt =null; + if(CollectionUtil.isNotEmpty(operatorList)){ + appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null + && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2)) + .findFirst(); + resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null + && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4)) + .findFirst(); + } MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId); - + Integer organizeFlag = caseApplication.getOrganizeFlag(); SysUser user = new SysUser(); Long userId = SecurityUtils.getUserId(); user.setUserId(userId); @@ -836,6 +577,9 @@ public class MsSignSealServiceImpl implements MsSignSealService { } List roleNames = allSysRole.stream().map(SysRole::getRoleName).collect(Collectors.toList()); if(roleNames.contains("申请人")){ + if(appOpt==null || !appOpt.isPresent()){ + return AjaxResult.error("未找到案件申请操作人"); + } SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -844,19 +588,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { String signFlowid = sealSignRecords.get(0).getSignFlowId(); if(organizeFlag!=null){ SealSignRecord sealSignRecord = new SealSignRecord(); - if(organizeFlag.intValue()==1){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - String nameAgent = caseAffiliate.getNameAgent(); - if(StringUtils.isNotBlank(nameAgent)){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone()); - sealSignRecord.setPensonName(caseAffiliate.getApplicationName()); - } - } + sealSignRecord.setPensonAccount(appOpt.get().getPhone()); + sealSignRecord.setPensonName(appOpt.get().getName()); sealSignRecord.setSignFlowid(signFlowid); Gson gson = new Gson(); @@ -873,6 +606,9 @@ public class MsSignSealServiceImpl implements MsSignSealService { }else if(roleNames.contains("被申请人")){ + if(resOpt==null || !resOpt.isPresent()){ + return AjaxResult.error("未找到案件申请操作人"); + } SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -880,7 +616,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { if (sealSignRecords != null && sealSignRecords.size() > 0) { String signFlowid = sealSignRecords.get(0).getSignFlowId(); SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setPensonAccount(caseAffiliate.getRespondentPhone()); + sealSignRecord.setPensonAccount(resOpt.get().getPhone()); + sealSignRecord.setPensonName(resOpt.get().getName()); sealSignRecord.setSignFlowid(signFlowid); Gson gson = new Gson(); @@ -927,95 +664,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { return AjaxResult.success(); } - @Override - public AjaxResult msCaseSignUrlResPC(MsSignSealDTO dto) throws EsignDemoException { - Long caseId = dto.getCaseId(); - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); - SealSignRecord sealSignRecordres = new SealSignRecord(); - MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); - mssealSignRecord.setCaseAppliId(caseId); - List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord); - if (sealSignRecords != null && sealSignRecords.size() > 0) { - String signFlowid = sealSignRecords.get(0).getSignFlowId(); - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setPensonAccount(caseAffiliate.getRespondentPhone()); - sealSignRecord.setSignFlowid(signFlowid); - - Gson gson = new Gson(); - EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - sealSignRecordres.setSealUrl(urlapply); - } - - return AjaxResult.success(sealSignRecordres); - } - - @Override - public AjaxResult msCaseSignUrlApplyAPP(MsSignSealDTO dto) throws EsignDemoException { - Long caseId = dto.getCaseId(); - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); - Integer organizeFlag = caseAffiliate.getOrganizeFlag(); - SealSignRecord sealSignRecordres = new SealSignRecord(); - MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); - mssealSignRecord.setCaseAppliId(caseId); - List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord); - if (sealSignRecords != null && sealSignRecords.size() > 0) { - String signFlowid = sealSignRecords.get(0).getSignFlowId(); - if(organizeFlag!=null){ - SealSignRecord sealSignRecord = new SealSignRecord(); - if(organizeFlag.intValue()==1){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - String nameAgent = caseAffiliate.getNameAgent(); - if(StringUtils.isNotBlank(nameAgent)){ - sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent()); - sealSignRecord.setPensonName(caseAffiliate.getNameAgent()); - }else { - sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone()); - sealSignRecord.setPensonName(caseAffiliate.getApplicationName()); - } - } - sealSignRecord.setSignFlowid(signFlowid); - - Gson gson = new Gson(); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecord); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - sealSignRecordres.setSealUrl(urlapply); - } - } - return AjaxResult.success(sealSignRecordres); - - } - - @Override - public AjaxResult msCaseSignUrlResAPP(MsSignSealDTO dto) throws EsignDemoException { - Long caseId = dto.getCaseId(); - MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); - SealSignRecord sealSignRecordres = new SealSignRecord(); - MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); - mssealSignRecord.setCaseAppliId(caseId); - List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord); - if (sealSignRecords != null && sealSignRecords.size() > 0) { - String signFlowid = sealSignRecords.get(0).getSignFlowId(); - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setPensonAccount(caseAffiliate.getRespondentPhone()); - sealSignRecord.setSignFlowid(signFlowid); - - Gson gson = new Gson(); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecord); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - sealSignRecordres.setSealUrl(urlapply); - } - - return AjaxResult.success(sealSignRecordres); - } @Override @Transactional(rollbackFor = Exception.class) @@ -1187,12 +835,38 @@ public class MsSignSealServiceImpl implements MsSignSealService { String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { + // 先删除已经存在的调解书 + if(StrUtil.isEmpty(application.getCaseSource())){ + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); MsCaseAttach caseAttach = new MsCaseAttach(); caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(7); + caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - caseAttachMapper.updateCaseAttachBycaseid(caseAttach); + caseAttachMapper.save(caseAttach); + // todo 对接北明,调用上传附件接口 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + savePath; + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } + + } } } @@ -1256,12 +930,38 @@ public class MsSignSealServiceImpl implements MsSignSealService { String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { + // 先删除已经存在的调解书 + if(StrUtil.isEmpty(application.getCaseSource())){ + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); MsCaseAttach caseAttach = new MsCaseAttach(); caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(7); + caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - caseAttachMapper.updateCaseAttachBycaseid(caseAttach); + caseAttachMapper.save(caseAttach); + // todo 对接北明,调用上传附件接口 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + savePath; + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } + + } } } @@ -1322,12 +1022,39 @@ public class MsSignSealServiceImpl implements MsSignSealService { String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { + // 先删除已经存在的调解书 + if(StrUtil.isEmpty(application.getCaseSource())){ + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); MsCaseAttach caseAttach = new MsCaseAttach(); caseAttach.setCaseAppliId(caseAppliId); caseAttach.setAnnexType(7); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - caseAttachMapper.updateCaseAttachBycaseid(caseAttach); + caseAttachMapper.save(caseAttach); + // todo 对接北明,调用上传附件接口 + + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + savePath; + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD); + + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } + } } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java index d38cf8f..6be5493 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java @@ -31,9 +31,6 @@ import com.tencentcloudapi.trtc.v20190722.TrtcClient; import com.tencentcloudapi.trtc.v20190722.models.*; import com.tencentyun.TLSSigAPIv2; import lombok.extern.slf4j.Slf4j; -import org.apache.poi.xwpf.usermodel.XWPFDocument; -import org.apache.poi.xwpf.usermodel.XWPFParagraph; -import org.apache.poi.xwpf.usermodel.XWPFRun; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -42,18 +39,14 @@ import tk.mybatis.mapper.entity.Example; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Paths; -import java.util.Base64; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import static com.ruoyi.common.core.domain.AjaxResult.success; -import static com.ruoyi.common.utils.file.FileUploadUtils.*; +import static com.ruoyi.common.utils.file.FileUploadUtils.getAbsoluteFile; +import static com.ruoyi.common.utils.file.FileUploadUtils.getPathFileName; /** * @author wangqiong @@ -373,18 +366,27 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { * @return */ @Override - public AjaxResult secretaryRoleByUserId(Long userId) { - List roles = roleMapper.selectRolePermissionByUserId(userId); + public AjaxResult secretaryRoleByUserId(Long userId, Long caseId) { + // 根据案件id查询案件 + MsCaseApplication caseApplication = caseApplicationMapper.selectByPrimaryKey(caseId); + if(caseApplication==null){ + return AjaxResult.error("案件不存在"); + } JSONObject jsonObject = new JSONObject(); boolean isSecretaryRole=false; - if(CollectionUtil.isNotEmpty(roles)){ - for (SysRole role : roles) { - if("调解员".equals(role.getRoleName())){ - isSecretaryRole=true; - break; + if(caseApplication.getMediatorId()!=null&& Objects.equals(userId, caseApplication.getMediatorId())){ + // 是调解员 + List roles = roleMapper.selectRolePermissionByUserId(userId); + if(CollectionUtil.isNotEmpty(roles)){ + for (SysRole role : roles) { + if("调解员".equals(role.getRoleName())){ + isSecretaryRole=true; + break; + } } } } + jsonObject.put("isSecretaryRole",isSecretaryRole); return success(jsonObject); } @@ -424,21 +426,6 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { } } - public static void main(String[] args) throws Exception{ - String htmlContent = "

wangwu

喂喂喂

zhangsan

hello

zhangsan

我能听到你说话

wangwu

欧克

wangwu

关于XXX我有几点想说的,balalalalalal

zhangsan

看到回复的时刻双方都是华德福额外补充你下次u饿哦是那些二的河南省而很为难啊看的法国队哈哈哈哈哈哈哈哈哈

"; // HTML字符串 - String outputFileName="D://output.docx"; - XWPFDocument document = new XWPFDocument(); - XWPFParagraph paragraph = document.createParagraph(); - XWPFRun run = paragraph.createRun(); - run.setText(htmlContent); - FileOutputStream out = new FileOutputStream(new File(outputFileName)); - document.write(out); - out.close(); - System.out.printf("生成调解笔录成功"); - - - - } /** * 将视频下载到本地 diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml new file mode 100644 index 0000000..fe390de --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/log/MsRequestLogMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index b5f7ba0..d7d1f9c 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -21,6 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -111,6 +113,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" email, status, create_by, + code, + comp_legal_person, create_time )values( #{deptId}, @@ -124,6 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{email}, #{status}, #{createBy}, + #{code}, + #{compLegalPerson}, sysdate() ); @@ -140,6 +146,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" email, status, create_by, + code, + comp_legal_person, create_time )values @@ -155,6 +163,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item.email}, #{item.status}, #{item.createBy}, + #{item.code}, + #{item.compLegalPerson}, sysdate() ) ; @@ -174,6 +184,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" email = #{email}, status = #{status}, update_by = #{updateBy}, + code = #{code}, + comp_legal_person = #{compLegalPerson}, update_time = sysdate() where dept_id = #{deptId} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index b303ede..3f1441b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -125,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.*,ur.role_id from ms_sys_user u left join ms_sys_user_role ur on u.user_id = ur.user_id left join ms_sys_role r on r.role_id = ur.role_id - where u.phonenumber = #{phone} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 + where u.eamil = #{eamil} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 select count(1) from ms_sys_user_role where role_id=#{roleId} - + + + delete from ms_sys_user_role where user_id in diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml index 1d4e350..9ad7859 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml @@ -1,27 +1,73 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml index 38465a2..1a306fd 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml @@ -34,7 +34,56 @@ + + FROM + ms_case_application c + JOIN ms_case_affiliate a ON c.id = a.case_appli_id + LEFT JOIN ms_sys_user u ON u.user_id = a.user_id + LEFT JOIN ms_sys_user u1 ON u1.user_id = c.mediator_id + LEFT JOIN ms_sys_user_role ur ON u.user_id = ur.user_id or u1.user_id = ur.user_id + LEFT JOIN ms_sys_role r ON r.role_id = ur.role_id or r.role_id = ur.role_id + LEFT JOIN ms_sys_dept d ON d.dept_id = a.applicant_dept_id + + + + AND (c.mediator_id = #{req.mediatorId} or a.user_id=#{req.userId}) + + + + AND (a.user_id=#{req.userId} ) + + + + and r.role_id in + + #{roleId} + + + + + and c.case_flow_id in + + #{flowId} + + + + + AND c.case_flow_id = #{req.caseFlowId} + + + + AND c.case_num = #{req.caseNum} + + + + and c.create_time >= #{req.startTime} + + + and c.create_time <= #{req.endTime} + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAttachMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAttachMapper.xml index 23a8c3f..9779bc3 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAttachMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAttachMapper.xml @@ -14,6 +14,7 @@ + INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,only_office_file_id) @@ -109,7 +110,9 @@ update ms_case_attach set + other_sys_file_id=#{otherSysFileId}, case_appli_id= #{caseAppliId} + where annex_id = #{annexId} @@ -125,6 +128,7 @@ update ms_case_attach annex_name = #{annexName}, + other_sys_file_id=#{otherSysFileId}, annex_path = #{annexPath} -- 2.54.0 From 666090fbe33cf375ccfaad74bbb8c853713df50b Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Sun, 7 Apr 2024 11:10:35 +0800 Subject: [PATCH 03/30] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysLoginController.java | 17 ++- .../controller/tool/TestApiController.java | 3 +- .../src/main/resources/application-druid.yml | 4 +- .../src/main/resources/application.yml | 11 +- ruoyi-common/pom.xml | 2 +- .../common/core/domain/entity/SysDept.java | 37 ++++++ .../java/com/ruoyi/common/utils/PdfUtils.java | 8 +- .../web/service/SysPermissionService.java | 23 ++-- ruoyi-system/pom.xml | 32 +++--- .../system/service/BeiMingInterface.java | 3 +- .../ruoyi/system/service/ISysRoleService.java | 6 +- .../service/impl/BeiMingInterfaceService.java | 5 +- .../service/impl/MsRequestLogServiceImpl.java | 3 + .../service/impl/SysRoleServiceImpl.java | 13 +-- .../impl/WeChatUserServiceImpl.java | 1 + .../impl/MsCaseApplicationServiceImpl.java | 105 ++++++++++++++---- .../mscase/impl/MsSignSealServiceImpl.java | 62 +++++------ .../impl/VideoConferenceServiceImpl.java | 57 ++++++++++ .../resources/mapper/system/SysDeptMapper.xml | 15 +++ .../mscase/MsCaseAffiliateMapper.xml | 18 ++- .../mscase/MsCaseApplicationMapper.xml | 4 +- 21 files changed, 311 insertions(+), 118 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index acfe355..d0bc8c7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -5,9 +5,11 @@ import cn.hutool.crypto.digest.MD5; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.TokenService; @@ -22,6 +24,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -83,11 +87,20 @@ public class SysLoginController { public AjaxResult getInfo() { SysUser user = SecurityUtils.getLoginUser().getUser(); // 角色集合 - Set roles = permissionService.getRolePermission(user); + List roles = permissionService.getRolePermission(user); + Set permsSet = new HashSet<>(); + for (SysRole perm : roles) + { + if (StringUtils.isNotNull(perm)) + { + permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); + } + } + user.setRoles(roles); // 权限集合 Set permissions = permissionService.getMenuPermission(user); //查询用户角色关联的案件状态 - Set caseStatus = caseFlowService.getCaseStatusIdByRoleKey(roles); + Set caseStatus = caseFlowService.getCaseStatusIdByRoleKey(permsSet); AjaxResult ajax = AjaxResult.success(); ajax.put("user", user); ajax.put("roles", roles); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java index 2c66e62..d6e93dc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestApiController.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.common.enums.DocumentTypeEnum; import com.ruoyi.common.enums.PushCaseStatusEnum; import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; @@ -62,7 +63,7 @@ public class TestApiController { public AjaxResult testfile() { // File file = new File("D:/WorkDoc/TJ/File/证据1.png"); File file = new File("D:/WorkDoc/TJ/File/证据3.png"); - MsCaseFileInfo jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "BWT_MEDIATION", "zc2024032700012", AttachmentOperateTypeEnum.ADD); + MsCaseFileInfo jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "BWT_MEDIATION", "zc2024032700012", AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); System.out.println("fanhui:" + jsonObject1.toString()); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 4d5b672..4fc7270 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,8 +6,8 @@ spring: druid: # 主库数据源 master: -# url: jdbc:mysql://121.40.189.20:3306/mediation_system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false - url: jdbc:mysql://121.40.189.20:3306/mediation_system_prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://121.40.189.20:3306/mediation_system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false +# url: jdbc:mysql://121.40.189.20:3306/mediation_system_prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false username: root password: YMzc157# # 从库数据源 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 7e5b51b..c0a1dad 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -18,7 +18,7 @@ ruoyi: # 开发环境配置 server: # 测试环境6001,开发环境7001 - port: 7001 + port: 6001 servlet: # 应用的访问路径 context-path: / @@ -72,8 +72,8 @@ spring: host: 121.40.189.20 # 端口,默认为6379 port: 6389 - # 数据库索引 - database: 0 + # 数据库索引,测试环境1,正式环境0 + database: 1 # 密码 password: # 连接超时时间 @@ -198,6 +198,11 @@ signSealCallbackConfig: onlyOfficeConfig: # url: http://172.16.0.254:9090/files/upload url: http://121.40.189.20:9090/files/upload +# 北明 +BMConfig: + userName: BWT_MEDIATION + password: 86251b190e3a40f3942v215d1762c663 + syncSource: BWT_MEDIATION #jodconverter: # local: # host: 121.40.189.20 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index a84dbae..789e72b 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -200,7 +200,7 @@ com.tencentcloudapi tencentcloud-sdk-java - 3.1.876 + 3.1.962 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 31c8054..f042fa6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -64,6 +64,43 @@ public class SysDept extends BaseEntity * 法定代表人 */ private String compLegalPerson; + /** + * 住所 + */ + private String home; + /** + * 联系地址 + */ + private String address; + /** + * + * 国籍,0-国内,1-国外 + */ + private Integer nationality; + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getNationality() { + return nationality; + } + + public String getHome() { + return home; + } + + public void setHome(String home) { + this.home = home; + } + + public void setNationality(Integer nationality) { + this.nationality = nationality; + } public String getCode() { return code; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java index 05afb65..be9e4ae 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PdfUtils.java @@ -4,22 +4,16 @@ import com.documents4j.api.DocumentType; import com.documents4j.api.IConverter; import com.documents4j.job.LocalConverter; import com.itextpdf.text.Document; -import com.itextpdf.text.Font; import com.itextpdf.text.PageSize; -import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.tool.xml.XMLWorkerFontProvider; import com.itextpdf.tool.xml.XMLWorkerHelper; -import com.ruoyi.common.config.RuoYiConfig; -import com.tencentcloudapi.teo.v20220901.models.CC; import lombok.extern.slf4j.Slf4j; import java.io.*; import java.nio.charset.Charset; import java.nio.file.Files; -import static cn.hutool.core.util.ClassLoaderUtil.getClassLoader; - /** * @author wangqiong * @description pdf转换工具类 @@ -44,7 +38,7 @@ public class PdfUtils { document.setMarginMirroring(false); document.open(); // 解决PDF中文不显示 - String fontPath = "/D:/simsun.ttf"; //字体文件路径 + String fontPath = "/home/ruoyi/uploadPath/songfont/simsun.ttf"; //字体文件路径 XMLWorkerFontProvider provider = new XMLWorkerFontProvider(XMLWorkerFontProvider.DONTLOOKFORFONTS); provider.register(fontPath);//注册字体 log.error("注册字体"); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java index d1fb4ed..15ad8d9 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java @@ -1,15 +1,17 @@ package com.ruoyi.framework.web.service; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; /** * 用户权限处理 @@ -31,13 +33,16 @@ public class SysPermissionService * @param user 用户信息 * @return 角色权限信息 */ - public Set getRolePermission(SysUser user) + public List getRolePermission(SysUser user) { - Set roles = new HashSet(); + List roles = new ArrayList<>(); // 管理员拥有所有权限 if (user.isAdmin()) { - roles.add("admin"); + SysRole sysRole = new SysRole(); + sysRole.setRoleId(1L); + sysRole.setRoleKey("admin"); + roles.add(sysRole); } else { diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 9832e14..0ff3108 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -45,20 +45,20 @@ 2.1.5 - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java index e134bc6..ac61224 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/BeiMingInterface.java @@ -2,6 +2,7 @@ package com.ruoyi.system.service; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.common.enums.DocumentTypeEnum; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo; @@ -70,7 +71,7 @@ public interface BeiMingInterface { * @param caseNo 案件编号 * @return */ - MsCaseFileInfo pushAttachmentInfo(String username, String password, File file, String syncSource, String caseNo, AttachmentOperateTypeEnum operateTypeEnum); + MsCaseFileInfo pushAttachmentInfo(String username, String password, File file, String syncSource, String caseNo, AttachmentOperateTypeEnum operateTypeEnum, DocumentTypeEnum documentTypeEnum); /** * 删除附件 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index 6c29f09..1a396e2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -1,10 +1,10 @@ package com.ruoyi.system.service; -import java.util.List; -import java.util.Set; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.system.domain.SysUserRole; +import java.util.List; + /** * 角色业务层 * @@ -34,7 +34,7 @@ public interface ISysRoleService * @param userId 用户ID * @return 权限列表 */ - public Set selectRolePermissionByUserId(Long userId); + public List selectRolePermissionByUserId(Long userId); /** * 查询所有角色 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java index e0ad538..84c1abc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BeiMingInterfaceService.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.common.enums.DocumentTypeEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.domain.entity.log.MsRequestLog; import com.ruoyi.system.service.BeiMingInterface; @@ -335,7 +336,7 @@ public class BeiMingInterfaceService implements BeiMingInterface { */ @Transactional @Override - public MsCaseFileInfo pushAttachmentInfo(String username, String password, File file, String syncSource, String caseNo,AttachmentOperateTypeEnum operateTypeEnum) { + public MsCaseFileInfo pushAttachmentInfo(String username, String password, File file, String syncSource, String caseNo, AttachmentOperateTypeEnum operateTypeEnum, DocumentTypeEnum documentTypeEnum) { JSONObject result = new JSONObject(); MsCaseFileInfo fileInfo=null; //1.获取token @@ -354,7 +355,7 @@ public class BeiMingInterfaceService implements BeiMingInterface { System.out.println("fileId====:" + fileId); if (fileId != null) { //3.同步附件更新信息 - fileInfo = MsCaseFileInfo.builder().fileId(fileId).fileName(file.getName()).abutmentId(fileId).abutmentCaseId(caseNo).documentSubject("EVEDENT").documentType("EVEDENT_METERIAL").build(); + fileInfo = MsCaseFileInfo.builder().fileId(fileId).fileName(file.getName()).abutmentId(fileId).abutmentCaseId(caseNo).documentSubject("EVEDENT").documentType(documentTypeEnum.getCode()).build(); result = syncAttachmentInfo(token, username, operateTypeEnum.getCode(), caseNo, fileInfo); // 更新到附件表将fileId // result = syncAttachmentInfo(token, username, AttachmentOperateTypeEnum.UPD.getCode(), caseNo, fileInfo); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java index 2e3e871..f18e5b4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MsRequestLogServiceImpl.java @@ -5,6 +5,8 @@ import com.ruoyi.system.mapper.log.MsRequestLogMapper; import com.ruoyi.system.service.MsRequestLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; /** * @Classname MsRequestLogServiceImpl @@ -17,6 +19,7 @@ import org.springframework.stereotype.Service; public class MsRequestLogServiceImpl implements MsRequestLogService { @Autowired private MsRequestLogMapper logMapper; + @Transactional(propagation = Propagation.REQUIRES_NEW) @Override public void insert(MsRequestLog requestLog) { logMapper.insert(requestLog); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index c56b093..91df2ad 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -93,18 +93,11 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 权限列表 */ @Override - public Set selectRolePermissionByUserId(Long userId) + public List selectRolePermissionByUserId(Long userId) { List perms = roleMapper.selectRolePermissionByUserId(userId); - Set permsSet = new HashSet<>(); - for (SysRole perm : perms) - { - if (StringUtils.isNotNull(perm)) - { - permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); - } - } - return permsSet; + + return perms; } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java index 20f9ec5..6a82ca9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java @@ -107,6 +107,7 @@ public class WeChatUserServiceImpl implements WeChatUserService { }else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){ return AjaxResult.warn("验证码校验失败"); } + // 根据用户名或者邮箱或者手机号查询系统用户表中是否存在该用户 SysUser sysUserName=sysUserMapper.checkUserNameUnique(ientityAuthentication.getUserName()); if(sysUserName!=null){ return AjaxResult.warn("账号已存在"); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 5fe3ec4..c8f017b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -259,6 +259,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if(CollectionUtil.isEmpty(list)){ return; } + isMediatorRole=false; // 查询申请人和被申请人 List caseIds = list.stream().map(MsCaseApplicationVO::getId).collect(Collectors.toList()); @@ -271,6 +272,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } for (MsCaseApplicationVO vo : list) { + if(vo.getMediatorId()!=null&&vo.getMediatorId()==loginUserId){ + isMediatorRole=true; + } // 设置申请人和被申请人 if(affiliateMap!=null && affiliateMap.containsKey(vo.getId())){ List affiliates = affiliateMap.get(vo.getId()); @@ -291,12 +295,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } - if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") - && affiliate.getRoleType()!=null && affiliate.getRoleType()==1){ - applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { + if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") + && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName())) { + applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + }else { + // 组织机构 + if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())) { + applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); + } } if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") - && affiliate.getRoleType()!=null && affiliate.getRoleType()==3){ + && affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){ respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); } @@ -585,6 +596,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseApplication.getId() == null) { caseApplication.setId(IdWorkerUtil.getId()); } + if(caseApplication.getOrganizeFlag()==null){ + caseApplication.setOrganizeFlag(0); + } caseApplication.setCaseStatusName(caseFlow.getCaseStatusName()); caseApplication.setCaseFlowId(caseFlow.getId()); caseApplication.setCreateTime(new Date()); @@ -680,7 +694,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder) { - if(affiliate==null || StrUtil.isEmpty(affiliate.getEmail()) || StrUtil.isEmpty(affiliate.getName())){ + boolean b = caseApplication.getOrganizeFlag() != 1 && affiliate.getRoleType() == 1 && StrUtil.isEmpty(affiliate.getEmail()); + if(affiliate==null ||b|| StrUtil.isEmpty(affiliate.getName())){ return; } affiliate.setGroupOrder(groupOrder); @@ -739,6 +754,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } else { // 申请机构 if (affiliate.getRoleType() == 1) { + affiliate.setOperatorFlag(0); // 申请人,从缓存中判断部门是否存在 Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()); if (ObjectUtil.isEmpty(deptCache)) { @@ -751,12 +767,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { dept.setStatus("0"); dept.setDelFlag("0"); dept.setCode(affiliate.getCode()); + dept.setHome(affiliate.getHome()); + dept.setAddress(affiliate.getAddress()); dept.setCompLegalPerson(affiliate.getCompLegalPerson()); dept.setCreateBy(getUsername()); - dept.setUpdateBy(getUsername()); + dept.setCreateTime(new Date()); + dept.setNationality(affiliate.getNationality()); sysDeptMapper.insertDept(dept); // 更新缓存 redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId()); + }else { + // 更新部门 + SysDept dept = new SysDept(); + dept.setDeptId((Long) deptCache); + dept.setCode(affiliate.getCode()); + dept.setCompLegalPerson(affiliate.getCompLegalPerson()); + dept.setUpdateBy(getUsername()); + dept.setUpdateTime(new Date()); + dept.setNationality(affiliate.getNationality()); + dept.setHome(affiliate.getHome()); + dept.setAddress(affiliate.getAddress()); + sysDeptMapper.updateDept(dept); } affiliate.setApplicantDeptId(redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName())); } else { @@ -779,13 +810,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if(StrUtil.isEmpty(affiliate.getEmail())){ return; } - Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail()); + // Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail()); SysUser user=null; - if(ObjectUtil.isEmpty(userEmailCache)){ + // if(ObjectUtil.isEmpty(userEmailCache)){ user = sysUserMapper.selectUserByUserName(affiliate.getEmail()); - }else { - user=(SysUser)userEmailCache; - } + // }else { + // user=(SysUser)userEmailCache; + // } // 判断该用户是否存在 @@ -951,6 +982,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (msCaseAffiliateVO==null) { return AjaxResult.error("案件相关人员未填写"); } + if(caseApplication.getOrganizeFlag()==null){ + caseApplication.setOrganizeFlag(0); + } // 计算仲裁费用 caseApplication.setCaseSubjectAmount(new BigDecimal("30000")); setFeePayableMethod(caseApplication); @@ -1507,7 +1541,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(),AttachmentOperateTypeEnum.ADD); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(),AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_METERIAL); // 更新附件表 if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); @@ -1905,7 +1939,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // selectedMediatorIds = selectedMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList()); // } for (MsCaseAffiliate affiliate : affiliates) { - if(affiliate.getUserId().equals(loginUser.getUser().getUserId())){ + if(affiliate.getUserId()!=null && affiliate.getUserId().equals(loginUser.getUser().getUserId())){ if( affiliate.getRoleType()==null){ continue; } @@ -1971,7 +2005,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.error("未找到案件相关人员"); } for (MsCaseAffiliate affiliate : affiliates) { - if(affiliate.getUserId().equals(user.getUserId())){ + if((affiliate.getUserId()!=null && affiliate.getUserId().equals(user.getUserId()))){ if( affiliate.getRoleType()==null){ continue; } @@ -2370,8 +2404,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { public SysUser getUserInfo() { SysUser sysUser =new SysUser(); - if(StrUtil.isNotEmpty(SecurityUtils.getUsername())){ - sysUser = sysUserMapper.selectUserByUserName(getUsername()); + if(SecurityUtils.getUserId()!=null){ + sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); } return sysUser; @@ -2671,7 +2705,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2115975"); + request.setTemplateId("2116857"); // todo // 申请人发送短信 request.setPhone(applicantAffiliateOpt.get().getPhone()); @@ -2698,7 +2732,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2115975"); + request1.setTemplateId("2116857"); request1.setPhone(resAffiliateOpt.get().getPhone()); request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); Boolean aBoolean1 = SmsUtils.sendSms(request1); @@ -2722,7 +2756,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2115975"); + requestMedi.setTemplateId("2116857"); requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); @@ -3104,7 +3138,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (MsCaseAttach msCaseAttach : msCaseAttaches) { String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表 if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); @@ -3363,6 +3397,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { .build(); } + //保存到附件表里,先删除之前的在保存 + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); + msCaseAttachMapper.save(caseAttach); } }else { @@ -3372,12 +3409,32 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX)) .annexType(annexType) .build(); - } - //保存到附件表里,先删除之前的在保存 - if(caseAttach != null) { - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); + // 查找已经存在的附件 + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(application.getId(), annexType); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); + if(StrUtil.isEmpty(application.getCaseSource())) { + // 北明推送 + String path = "/home/ruoyi" + caseAttach.getAnnexPath(); + File file = new File(path.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); + + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + } + } msCaseAttachMapper.save(caseAttach); } + } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 515950e..73f0135 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -15,10 +15,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.enums.AnnexTypeEnum; -import com.ruoyi.common.enums.AttachmentOperateTypeEnum; -import com.ruoyi.common.enums.PushCaseStatusEnum; -import com.ruoyi.common.enums.YesOrNoEnum; +import com.ruoyi.common.enums.*; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.EmailOutUtil; @@ -27,6 +24,7 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO; +import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.service.impl.BeiMingInterfaceService; @@ -110,6 +108,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { @Autowired private SendMailRecordMapper sendMailRecordMapper; + @Autowired + private SysRoleMapper roleMapper; // 北明配置 @Value("${BMConfig.userName}") private String BMUserName; @@ -550,36 +550,37 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(CollectionUtil.isEmpty(affiliates)){ return AjaxResult.error("未找到案件相关人员"); } + SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId()); + List roles = user.getRoles(); + if(CollectionUtil.isEmpty(roles)){ + return AjaxResult.error("该用户未绑定角色"); + } + long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count(); List operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null && msCaseAffiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList()); Optional appOpt =null; Optional resOpt =null; if(CollectionUtil.isNotEmpty(operatorList)){ - appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null + appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId()!=null && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2)) .findFirst(); - resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null + resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null&& msCaseAffiliate.getUserId()!=null && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4)) .findFirst(); } - + if(appOpt==null || !appOpt.isPresent()){ + return AjaxResult.error("未找到案件申请操作人"); + } + if(resOpt==null || !resOpt.isPresent()){ + return AjaxResult.error("未找到案件被申请操作人"); + } MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId); Integer organizeFlag = caseApplication.getOrganizeFlag(); - SysUser user = new SysUser(); Long userId = SecurityUtils.getUserId(); - user.setUserId(userId); - List listSysUser = userMapper.selectUserList(user); - List allSysRole = new ArrayList<>(); - for(SysUser sysUser :listSysUser){ - List roles = sysUser.getRoles(); - allSysRole.addAll(roles); - } - List roleNames = allSysRole.stream().map(SysRole::getRoleName).collect(Collectors.toList()); - if(roleNames.contains("申请人")){ - if(appOpt==null || !appOpt.isPresent()){ - return AjaxResult.error("未找到案件申请操作人"); - } + + if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){ + // 申请人链接 SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -605,10 +606,9 @@ public class MsSignSealServiceImpl implements MsSignSealService { } - }else if(roleNames.contains("被申请人")){ - if(resOpt==null || !resOpt.isPresent()){ - return AjaxResult.error("未找到案件申请操作人"); - } + } + if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){ + SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -630,7 +630,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { }else { return AjaxResult.error(); } - }else if(roleNames.contains("调解员")){ + } + if(mediatorCount>0){ SealSignRecord sealSignRecordres = new SealSignRecord(); MsSealSignRecord mssealSignRecord = new MsSealSignRecord(); mssealSignRecord.setCaseAppliId(caseId); @@ -859,7 +860,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { String templatePath = "/home/ruoyi" + savePath; File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表 if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); @@ -954,7 +955,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { String templatePath = "/home/ruoyi" + savePath; File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表 if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); @@ -1041,20 +1042,19 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseAttach.setAnnexType(7); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); - caseAttachMapper.save(caseAttach); + // todo 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { String templatePath = "/home/ruoyi" + savePath; File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD); - + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表 if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); } } + caseAttachMapper.save(caseAttach); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java index 6be5493..841af1f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -9,15 +11,19 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.AnnexTypeEnum; +import com.ruoyi.common.enums.AttachmentOperateTypeEnum; +import com.ruoyi.common.enums.DocumentTypeEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.PdfUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.ReservedConference; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; +import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; @@ -39,6 +45,7 @@ import tk.mybatis.mapper.entity.Example; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.util.*; @@ -78,6 +85,15 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { private ReservedConferenceMapper reservedConferenceMapper; @Autowired private SysUserMapper sysUserMapper; + // 北明配置 + @Value("${BMConfig.userName}") + private String BMUserName; + @Value("${BMConfig.password}") + private String BMPassword; + @Value("${BMConfig.syncSource}") + private String BMSyncSource; + @Autowired + BeiMingInterfaceService beiMingInterfaceService; /** 视频回调 @@ -399,6 +415,11 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { @Transactional @Override public AjaxResult htmlToPDF(MsReservedConferenceVO reservedConferenceVO) { + // 查询案件 + MsCaseApplication caseApplication = caseApplicationMapper.selectByPrimaryKey(reservedConferenceVO.getCaseId()); + if(caseApplication==null){ + return AjaxResult.error("案件不存在"); + } String currentFileName = System.currentTimeMillis() + ".pdf"; String fileName = null; try { @@ -413,12 +434,35 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { // 绑定案件 if(convertFlag){ // 删除之前的庭审笔录 + if(StrUtil.isEmpty(caseApplication.getCaseSource())){ + List existAttach = caseAttachMapper.listCaseAttachByCaseIdAndType(reservedConferenceVO.getCaseId(), AnnexTypeEnum.MEDIATE.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(caseApplication.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } caseAttachMapper.deleteCaseAttachByCasedIdAndType(reservedConferenceVO.getCaseId(),AnnexTypeEnum.MEDIATE.getCode()); MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId()) .annexName(currentFileName) .annexPath(fileName) .annexType(AnnexTypeEnum.MEDIATE.getCode()) .build(); + // todo 对接北明,调用上传附件接口 + + if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_MEDIATION_RECORD); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + } + } caseAttachMapper.save(caseAttach); return AjaxResult.success(); }else { @@ -460,7 +504,20 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { .annexPath(annexName) .annexType(AnnexTypeEnum.MEETING_VIDEO.getCode()) .build(); + // todo 对接北明,调用上传附件接口 + + if(StrUtil.isEmpty(caseApplication.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + caseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplication.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_MEDIATION_VIDEO); + + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + } + } caseAttachMapper.save(caseAttach); + return annexName; } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index d7d1f9c..ee6beed 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -115,6 +115,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by, code, comp_legal_person, + home, + address, + nationality, create_time )values( #{deptId}, @@ -130,6 +133,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createBy}, #{code}, #{compLegalPerson}, + #{home}, + #{address}, + #{nationality}, sysdate() ); @@ -148,6 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by, code, comp_legal_person, + nationality, + home, + address, create_time )values @@ -165,6 +174,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item.createBy}, #{item.code}, #{item.compLegalPerson}, + #{item.nationality}, + #{item.home}, + #{item.address}, sysdate() ) ; @@ -186,6 +198,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, code = #{code}, comp_legal_person = #{compLegalPerson}, + home = #{home}, + address = #{address}, + nationality = #{nationality}, update_time = sysdate() where dept_id = #{deptId} diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml index 9ad7859..7846280 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAffiliateMapper.xml @@ -39,8 +39,13 @@ group by a.case_appli_id select t.* from( SELECT - c.id,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus, + c.id,c.organize_flag organizeFlag,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus, c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime, c.mediation_method mediationMethod, @@ -120,7 +120,7 @@ c.id union SELECT - c.id,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus, + c.id,c.organize_flag organizeFlag,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus, c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime, c.mediation_method mediationMethod, -- 2.54.0 From 17c9b2659ebb2acd6c92e51084a1ad9b847f2c57 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Mon, 8 Apr 2024 14:05:20 +0800 Subject: [PATCH 04/30] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/RuoYiApplication.java | 1 - .../mscase/MsVideoConferenceController.java | 110 ++ .../ruoyi/common/constant/CacheConstants.java | 2 +- .../com/ruoyi/common/enums/AnnexTypeEnum.java | 1 + .../com/ruoyi/common/enums/SMSStatusEnum.java | 64 + .../java/com/ruoyi/common/utils/SmsUtils.java | 33 +- .../ruoyi/system/mapper/SysDeptMapper.java | 7 + .../service/impl/SysUserServiceImpl.java | 44 +- .../domain/dto/sendrecord/SmsSendRecord.java | 11 +- .../entity/mscase/MsCaseApplication.java | 5 + .../vo/mscase/MsCaseApplicationReq.java | 6 +- .../mapper/sendrecord/SmsRecordMapper.java | 2 + .../impl/WeChatUserServiceImpl.java | 12 +- .../mscase/MsCaseApplicationService.java | 2 +- .../mscase/VideoConferenceService.java | 10 + .../impl/MsCaseApplicationServiceImpl.java | 1107 +++++++++-------- .../mscase/impl/MsCasePaymentServiceImpl.java | 51 +- .../mscase/impl/MsSignSealServiceImpl.java | 201 +-- .../impl/VideoConferenceServiceImpl.java | 102 +- .../wisdomarbitrate/utils/SignAward.java | 164 ++- .../resources/mapper/system/SysDeptMapper.xml | 6 +- .../resources/mapper/system/SysUserMapper.xml | 2 +- .../mscase/MsCaseAffiliateMapper.xml | 2 +- .../sendrecord/SmsRecordMapper.xml | 21 +- 24 files changed, 1306 insertions(+), 660 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 8e2591f..570f715 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -49,7 +49,6 @@ public class RuoYiApplication if(CollectionUtil.isNotEmpty(sysUsers)){ for (SysUser sysUser : sysUsers) { redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); - redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY+sysUser.getEmail(),sysUser); } } // 初始化角色redis diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 5b83233..c285136 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -1,16 +1,28 @@ package com.ruoyi.web.controller.wisdomarbitrate.mscase; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.ServerConfig; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.VideoCallBackVO; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; +import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.VideoConferenceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; /** @@ -24,6 +36,12 @@ import javax.validation.Valid; public class MsVideoConferenceController extends BaseController { @Autowired private VideoConferenceService videoService; + @Autowired + private ServerConfig serverConfig; + @Autowired + private MsCaseAttachMapper msCaseAttachMapper; + @Autowired + private MsCaseApplicationService caseApplicationService; /** * 根据案件ID查询视频 * @param caseId 案件id @@ -34,8 +52,82 @@ public class MsVideoConferenceController extends BaseController { return videoService.videoList(caseId); } + /** + * 通用上传请求(单个) + * param officeFlag: 是否上传到onlyoffice,0-否,1-是 + */ + @PostMapping("/upload") + public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType, @RequestParam(value = "officeFlag", required = false) Integer officeFlag,@RequestParam(value = "caseId") Long caseId) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + if(officeFlag != null && officeFlag == 1){ + // officeFlag,fileName为annexPath + JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileName,caseId); + if(jsonArray!=null && jsonArray.size() > 0) { + MsCaseAttach caseAttach=null; + for (Object obj : jsonArray) { + JSONObject jsonObject = (JSONObject) obj; + caseAttach = MsCaseAttach.builder() + .caseAppliId(caseId) + .annexName(jsonObject.getString("fileName")) + .annexPath(jsonObject.getString("filePath")) + .annexType(annexType) + .onlyOfficeFileId(jsonObject.getString("fileId")) + .build(); + msCaseAttachMapper.save(caseAttach); + } + if(caseAttach==null){ + return AjaxResult.error("上传失败"); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("annexId", caseAttach.getAnnexId()); + ajax.put("annexType", annexType); + // ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + }else { + return AjaxResult.error("上传失败"); + } + }else { + Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename(), caseId); + // 是否上传到onlyoffice + AjaxResult ajax = AjaxResult.success(); + ajax.put("annexId", annexId); + ajax.put("annexType", annexType); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + private Long saveCaseAttach(Integer annexType, String path, String originalFilename,Long caseId) { + MsCaseAttach caseAttach = MsCaseAttach.builder() + .annexName(originalFilename) + .caseAppliId(caseId) + .annexPath(path) + .annexType(annexType) + .useId(SecurityUtils.getUserId()) + .useAccount(SecurityUtils.getUsername()) + .build(); + msCaseAttachMapper.save(caseAttach); + return caseAttach.getAnnexId(); + } /** * 从腾讯云下载文件到本地 * @param @@ -49,6 +141,13 @@ public class MsVideoConferenceController extends BaseController { } return success(); } + @Anonymous + @PostMapping("/smsRollBack") + public AjaxResult smsRollBack( @RequestBody String body, HttpServletRequest request) { + logger.info("短信回调======"+body); + videoService.smsRollBack(body,request); + return success(); + } /** * 根据房间号绑定案件ID * @param @@ -110,6 +209,17 @@ public class MsVideoConferenceController extends BaseController { return videoService.secretaryRoleByUserId(userId,caseId); } + /** + * 根据案件id查询申请人/被申请人会议上传附件按钮权限 + * @param caseId + * @return + */ + @Anonymous + @GetMapping("selectRoleMenuByCaseId") + public AjaxResult selectRoleMenuByCaseId( @RequestParam(value = "caseId",required = true) Long caseId) { + + return videoService.selectRoleMenuByCaseId(caseId); + } /** * 根据html字符串转pdf并和案件关联 * @param reservedConferenceVO diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index d3cf20f..46a496e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -58,7 +58,7 @@ public class CacheConstants /** * 用户邮箱 redis key */ - public static final String USER_EMAIL_KEY = "user_email_key:"; +// public static final String USER_EMAIL_KEY = "user_email_key:"; /** * 角色 redis key */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java index 5f861d0..6b69e9a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java @@ -21,6 +21,7 @@ public enum AnnexTypeEnum implements EnumsInterface { RES_PAYMENT_RECEIPT(9, "被申请人缴费单"), SEAL_PICTURE(10, "印章图片"), FLOW_SVG(11, "流程节点SVG"), + MEETING_FILE(12, "被申请人证据"), ; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java new file mode 100644 index 0000000..b4ec810 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java @@ -0,0 +1,64 @@ +package com.ruoyi.common.enums; + +import com.ruoyi.common.interfaces.EnumsInterface; + +/** + * @author wangqiong + * @description 短信状态枚举 + * @date 2023-11-17 14:05 + */ +public enum SMSStatusEnum implements EnumsInterface +{ + SUCCESS(1, "成功"), + SENDING(2, "发送中"), + FAIL(3, "失败"), + + ; + + private final Integer code; + private final String text; + + SMSStatusEnum(Integer code, String text) + { + this.code = code; + this.text = text; + } + + public Integer getCode() + { + return code; + } + + public String getText() + { + return text; + } + + /** + * 根据code获取text + * @param codeNo + * @return + */ + public static String getTextByCode(Integer codeNo){ + for (SMSStatusEnum value : SMSStatusEnum.values()) { + if (value.getCode().equals(codeNo)){ + return value.getText(); + } + } + return codeNo.toString(); + } + + /** + * 根据text获取code + * @param textStr + * @return + */ + public static String getCodeByText(String textStr){ + for (SMSStatusEnum value : SMSStatusEnum.values()) { + if (value.getText().equals(textStr)){ + return value.getText(); + } + } + return textStr; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java index 1a2e2b7..18f3771 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java @@ -1,5 +1,7 @@ package com.ruoyi.common.utils; +import cn.hutool.json.JSONObject; +import com.ruoyi.common.enums.SMSStatusEnum; import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.sms.v20210111.SmsClient; @@ -24,7 +26,8 @@ public class SmsUtils { //签名内容 private static final String SIGN_NAME = "乙巢智慧仲裁网"; - public static Boolean sendSms(SendSmsRequest request) { + public static JSONObject sendSms(SendSmsRequest request) { + JSONObject jsonObject = new JSONObject(); Credential cred = new Credential(SECRET_ID, SECRET_KEY ); SmsClient client = new SmsClient(cred, "ap-guangzhou"); @@ -40,18 +43,23 @@ public class SmsUtils { res = client.SendSms(req); } catch (TencentCloudSDKException e) { log.error("发送短信出错:", e); - return Boolean.FALSE; + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); + return jsonObject; } SendStatus sendStatus = res.getSendStatusSet()[0]; log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){ - return Boolean.TRUE; + jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); + }else { + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); } - return Boolean.FALSE; + jsonObject.set("sid", sendStatus.getSerialNo()); + return jsonObject; } - public static Boolean sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) { - SendSmsRequest request = new SendSmsRequest(phone,templateId,templateParamSet,caseId); + public static JSONObject sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) { + JSONObject jsonObject = new JSONObject(); + SmsUtils1.SendSmsRequest request = new SmsUtils1.SendSmsRequest(phone,templateId,templateParamSet,caseId); Credential cred = new Credential(SECRET_ID, SECRET_KEY ); SmsClient client = new SmsClient(cred, "ap-guangzhou"); @@ -66,16 +74,19 @@ public class SmsUtils { try { res = client.SendSms(req); } catch (TencentCloudSDKException e) { - log.error("发送短信出错:", e); - return Boolean.FALSE; + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); + return jsonObject; } SendStatus sendStatus = res.getSendStatusSet()[0]; log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); - + // todo 短信发送时,需要将SerialNo存到数据库,在短信回调时去更新短信发送状态,以及失败原因写到数据库,发送时状态统一为发送中 if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){ - return Boolean.TRUE; + jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); + }else { + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); } - return Boolean.FALSE; + jsonObject.set("sid", sendStatus.getSerialNo()); + return jsonObject; } /** * 参数对象 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 7325df0..94fbd00 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -78,6 +78,13 @@ public interface SysDeptMapper */ public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); + /** + * 根据部门名称查询部门信息 + * @param deptName + * @return + */ + public SysDept selectDeptByName(@Param("deptName") String deptName); + /** * 新增部门信息 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index cbf225b..c222a1a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -2,11 +2,13 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUserDept; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; @@ -66,6 +68,8 @@ public class SysUserServiceImpl implements ISysUserService { @Autowired protected Validator validator; + @Autowired + private RedisCache redisCache; /** * 根据条件分页查询用户列表 @@ -245,6 +249,8 @@ public class SysUserServiceImpl implements ISysUserService { user.setCreateBy("admin"); user.setCreateTime(DateUtils.getNowDate()); int rows = userMapper.insertUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); // 新增用户部门关联 if(CollectionUtil.isNotEmpty(user.getDeptIds())) { // 先删除用户与部门关联 @@ -273,7 +279,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public boolean registerUser(SysUser user) { - return userMapper.insertUser(user) > 0; + int i = userMapper.insertUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i > 0; } /** @@ -308,6 +317,8 @@ public class SysUserServiceImpl implements ISysUserService { // 新增用户与岗位管理 insertUserPost(user); userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); return AjaxResult.success("更新用户成功"); } @@ -332,7 +343,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public int updateUserStatus(SysUser user) { - return userMapper.updateUser(user); + int i = userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i; } /** @@ -343,7 +357,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public int updateUserProfile(SysUser user) { - return userMapper.updateUser(user); + int i = userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i; } /** @@ -366,7 +383,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public int resetPwd(SysUser user) { - return userMapper.updateUser(user); + int i = userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i; } /** @@ -443,7 +463,10 @@ public class SysUserServiceImpl implements ISysUserService { userRoleMapper.deleteUserRoleByUserId(userId); // 删除用户与岗位表 userPostMapper.deleteUserPostByUserId(userId); - return userMapper.deleteUserById(userId); + int i = userMapper.deleteUserById(userId); + // 删除缓存 + redisCache.deleteObject(CacheConstants.USER_KEY+userId); + return i; } /** @@ -465,7 +488,12 @@ public class SysUserServiceImpl implements ISysUserService { userPostMapper.deleteUserPost(userIds); // 删除用户部门关联 userDeptMapper.deleteUserByIds(userIds); - return userMapper.deleteUserByIds(userIds); + int i = userMapper.deleteUserByIds(userIds); + for (Long userId : userIds) { + // 删除缓存 + redisCache.deleteObject(CacheConstants.USER_KEY+userId); + } + return i; } /** @@ -495,6 +523,8 @@ public class SysUserServiceImpl implements ISysUserService { user.setPassword(SecurityUtils.encryptPassword(password)); user.setCreateBy(operName); userMapper.insertUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); successNum++; successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 导入成功"); } else if (isUpdateSupport) { @@ -504,6 +534,8 @@ public class SysUserServiceImpl implements ISysUserService { user.setUserId(u.getUserId()); user.setUpdateBy(operName); userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); successNum++; successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 更新成功"); } else { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java index 4e17d80..779f0fb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java @@ -42,12 +42,21 @@ public class SmsSendRecord extends BaseEntity { * 发送状态 */ private Integer sendStatus; + /** + * 短信sid,发送的唯一标识 + */ + private String sid; + /** + * 失败原因 + */ + private String reason; - public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent) { + public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent,String sid) { this.caseId = caseId; this.caseNum = caseNum; this.phone = phone; this.sendTime = sendTime; this.sendContent = sendContent; + this.sid = sid; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java index 16c08cb..853ba65 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java @@ -215,6 +215,11 @@ public class MsCaseApplication { */ @Column(name = "case_source") private String caseSource; + /** + * 是否需要用印,1-需要 + */ + @Column(name = "seal_flag") + private Integer sealFlag; /** * 拒绝原因 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index 1628f50..8129d65 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -120,5 +120,9 @@ public class MsCaseApplicationReq { */ private Integer roleType; private Long userId; - + /** + * 是否需要用印,0-不需要,1-需要 + */ + // todo 等会放开 + private Integer sealFlag=0; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java index 1c9f18d..f4483d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java @@ -19,4 +19,6 @@ public interface SmsRecordMapper { * @return */ int batchSaveSmsSendRecord(@Param("list") List smsSendRecordList); + SmsSendRecord selectBySId(@Param("sid") String sid); + void updateStatus (SmsSendRecord smsSendRecord); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java index 6a82ca9..0c26f91 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java @@ -2,11 +2,13 @@ package com.ruoyi.wisdomarbitrate.service.miniprogress.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.StringUtils; @@ -43,6 +45,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { private SysUserRoleMapper userRoleMapper; @Autowired private IdentityAuthenticationMapper identityAuthenticationMapper; + @Autowired + private RedisCache redisCache; @Override public AjaxResult sendCode(WeChatUserVO userVO) { @@ -58,8 +62,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { // 1954926 普通短信 短信验证码 验证码:,为了保证您的账户安全,请勿想他人泄露验证码信息。如非本人操作,请忽略本短信。 request.setPhone(userVO.getPhone()); request.setTemplateParamSet(new String[]{ code}); - Boolean flag = SmsUtils.sendSms(request); - if(flag){ + JSONObject resultObj = SmsUtils.sendSms(request); + if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){ setCodeCache(userVO.getPhone(),code); return AjaxResult.success("短信发送成功"); }else { @@ -136,6 +140,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { sysUser.setEmail(ientityAuthentication.getEmail()); sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord())); sysUserMapper.updateUser(sysUser); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); ientityAuthentication.setUserId(sysUser.getUserId()); int count=0; if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){ @@ -169,6 +175,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { if(row<1) { return AjaxResult.warn("注册失败"); } + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); if(roleIdByName!=null) { // 用户关联被申请人角色 userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index e34709e..338faf2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -295,7 +295,7 @@ public interface MsCaseApplicationService { * @param affiliate 案件人员 * @param sendContent 发送内容 */ - public void sendSMS(Boolean smsFlag ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent); + public void sendSMS(cn.hutool.json.JSONObject jsonObject ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent); /** * 发送邮件 * @param application 案件基本信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java index 7355d46..4a99039 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.ReservedConference; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -80,4 +81,13 @@ public interface VideoConferenceService { * @throws Exception */ AjaxResult reservedConference( MsReservedConferenceVO reservedConferenceVO) throws Exception; + + /** + * 短信回调 + * @param body + * @param request + */ + void smsRollBack(String body, HttpServletRequest request); + + AjaxResult selectRoleMenuByCaseId(Long caseId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index c8f017b..92f4ebd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -3,7 +3,6 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; @@ -297,19 +296,34 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") - && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName())) { + && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName()) + && !applicantName.toString().contains(affiliate.getName())) { applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); } }else { // 组织机构 - if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())) { + if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) + && !applicantName.toString().contains(affiliate.getApplicantOrgName())) { applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); } } - if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") - && affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){ - respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { + if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") + && affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getName()) + && !respondentName.toString().contains(affiliate.getName())) { + + respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + }else { + // 组织机构 + if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())&& !respondentName.toString().contains(affiliate.getApplicantOrgName())) { + respondentName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); + } } +// if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") +// && affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){ +// respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); +// } } vo.setApplicationName(removeLastComma(applicantName.toString(),Constants.CN_SPLIT_COMMA)); @@ -694,7 +708,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder) { - boolean b = caseApplication.getOrganizeFlag() != 1 && affiliate.getRoleType() == 1 && StrUtil.isEmpty(affiliate.getEmail()); + boolean b = caseApplication.getOrganizeFlag() != 1 && (affiliate.getRoleType() == 1||affiliate.getRoleType() == 3) && StrUtil.isEmpty(affiliate.getEmail()); if(affiliate==null ||b|| StrUtil.isEmpty(affiliate.getName())){ return; } @@ -753,13 +767,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplicationService.insertAfficateUser(affiliate, roleIdList); } else { // 申请机构 - if (affiliate.getRoleType() == 1) { + if (affiliate.getRoleType() == 1 || affiliate.getRoleType()==3) { affiliate.setOperatorFlag(0); // 申请人,从缓存中判断部门是否存在 - Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()); - if (ObjectUtil.isEmpty(deptCache)) { +// Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()); + SysDept dept = sysDeptMapper.selectDeptByName(affiliate.getName()); + if (dept==null) { // 不存在该部门,新增 - SysDept dept = new SysDept(); + dept = new SysDept(); dept.setParentId(0L); dept.setDeptName(affiliate.getName()); dept.setAncestors("0"); @@ -775,11 +790,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { dept.setNationality(affiliate.getNationality()); sysDeptMapper.insertDept(dept); // 更新缓存 - redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId()); + // redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId()); }else { // 更新部门 - SysDept dept = new SysDept(); - dept.setDeptId((Long) deptCache); dept.setCode(affiliate.getCode()); dept.setCompLegalPerson(affiliate.getCompLegalPerson()); dept.setUpdateBy(getUsername()); @@ -789,7 +802,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { dept.setAddress(affiliate.getAddress()); sysDeptMapper.updateDept(dept); } - affiliate.setApplicantDeptId(redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName())); + affiliate.setApplicantDeptId(dept.getDeptId()); } else { caseApplicationService.insertAfficateUser(affiliate, roleIdList); } @@ -813,7 +826,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail()); SysUser user=null; // if(ObjectUtil.isEmpty(userEmailCache)){ - user = sysUserMapper.selectUserByUserName(affiliate.getEmail()); + user = sysUserMapper.selectUserByEmail(affiliate.getEmail()); // }else { // user=(SysUser)userEmailCache; // } @@ -838,7 +851,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { userMapper.insertUser(user); affiliate.setUserId(user.getUserId()); // 更新缓存 - redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + // redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); // 查询该角色是否存在申请人角色 List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); for (Long roleId : roleIdList) { @@ -863,8 +878,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { user.setEmail(affiliate.getEmail()); userMapper.updateUser(user); affiliate.setUserId(user.getUserId()); - // 更新缓存 - redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + // redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); // 查询该角色是否存在申请人角色 List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); for (Long roleId : roleIdList) { @@ -1663,8 +1679,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (StrUtil.isNotEmpty(affiliate.getPhone())) { // 发送短信 // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getPhone(), new String[]{application.getCaseNum()}); - sendSMS(smsFlag,application, affiliate, sendContent); + // todo 短信 + // cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getPhone(), new String[]{application.getCaseNum()}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); + sendSMS(jsonObject,application, affiliate, sendContent); } else { // 发送邮件 @@ -1681,10 +1699,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+rejectReason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。"; // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(affiliate.getPhone())) { - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2065809", affiliate.getPhone(), - new String[]{application.getCaseNum(), rejectReason}); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), "2065809", affiliate.getPhone(), +// new String[]{application.getCaseNum(), rejectReason}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); // 发送短信 - sendSMS(smsFlag,application, affiliate, sendContent); + sendSMS(jsonObject,application, affiliate, sendContent); } else { // 发送邮件 @@ -1732,13 +1752,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Override @Transactional - public void sendSMS(Boolean smsFlag ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent) { - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getPhone(), new Date(), sendContent); - if (smsFlag) { + public void sendSMS(cn.hutool.json.JSONObject jsonObject ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent) { + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getPhone(), new Date(), sendContent,jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); + if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { // 发送成功 - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } @@ -2245,14 +2265,16 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { - Boolean smsFlag = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(),application.getHearDate()}); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), +// new String[]{caseApplication.getCaseNum(), application.getHearDate()}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); // 发送短信 - caseApplicationService.sendSMS(smsFlag, application, meditorAffliate, content); + caseApplicationService.sendSMS(jsonObject, caseApplication, meditorAffliate, content); } else { // 发送邮件 - caseApplicationService.sendEmail(application, meditorAffliate, subject, content); + caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content); } } @@ -2338,10 +2360,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (notice != null) { // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(affiliate.getPhone())) { - Boolean smsFlag = SmsUtils.sendSms(application.getId(), notice.getTemplateId(), affiliate.getPhone(), - notice.getTemplateParamSet()); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), notice.getTemplateId(), affiliate.getPhone(), +// notice.getTemplateParamSet()); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); // 发送短信 - caseApplicationService.sendSMS(smsFlag, application, affiliate, notice.getContent()); + caseApplicationService.sendSMS(jsonObject, application, affiliate, notice.getContent()); } else { // 发送邮件 @@ -2519,6 +2543,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + if (annexPath.contains("/profile/upload")) { + annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + } String path = annexPath; //获取文件上传地址 EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); @@ -2567,17 +2594,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); // 设置用印账号 - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIsUse(1); - DeptIdentify deptIdentifyselect = new DeptIdentify(); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - deptIdentifyselect = deptIdentifysnew.get(0); - sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); - sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); - sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); - } else { - return AjaxResult.error("没有用印时的机构名称及经办人信息"); + if (req.getSealFlag().equals(1)) { + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setIsUse(1); + DeptIdentify deptIdentifyselect = new DeptIdentify(); + List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); + if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { + deptIdentifyselect = deptIdentifysnew.get(0); + sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); + sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); + sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); + } else { + return AjaxResult.error("没有用印时的机构名称及经办人信息"); + } } //解析文件签名印章位置 @@ -2585,7 +2614,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject3 = jsonArray.getJSONObject(i); String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { + if (keyword.equals("申请人(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -2598,9 +2627,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); + sealSignRecord.setPositionYpsn(positionY+40); } - } else if (keyword.equals("乙方(签字):")) { + } else if (keyword.equals("被申请人(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -2613,7 +2642,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); + sealSignRecord.setPositionYpsnRes(positionY+10 ); } } else if (keyword.equals("调解员(签字):")) { //签名 @@ -2628,385 +2657,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsnMedi(positionX + 120); - sealSignRecord.setPositionYpsnMedi(positionY + 10); + sealSignRecord.setPositionYpsnMedi(positionY+10 ); } } else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX + 90); - sealSignRecord.setPositionYorg(positionY); + // 设置用印位置 + if (req.getSealFlag().equals(1)) { + //用印 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXorg(positionX + 90); + sealSignRecord.setPositionYorg(positionY); + } } } } - - String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 - String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 - String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 - //查询机构信息 - DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setIdentifyName(orgnizeName); - deptIdentify1.setOperName(orgnizeNamepsnName); - deptIdentify1.setOperPhone(orgnizeNamePsnAccount); - List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - Long iddeptIdent = deptIdentifies.get(0).getId(); - SealManage sealManage = new SealManage(); - sealManage.setIdentifyId(iddeptIdent); - List sealIdList = new ArrayList<>(); - List selectSealList = sealManageMapper.selectSealList(sealManage); - if (selectSealList != null && selectSealList.size() > 0) { - for (SealManage manage : selectSealList) { - Integer sealStatus = manage.getSealStatus(); - Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse == 1) { - sealIdList.add(manage.getSealId()); + EsignHttpResponse response3 = new EsignHttpResponse(); + // 设置用印位置 + if (req.getSealFlag().equals(1)) { + String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 + String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 + String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 + //查询机构信息 + DeptIdentify deptIdentify1 = new DeptIdentify(); + deptIdentify1.setIdentifyName(orgnizeName); + deptIdentify1.setOperName(orgnizeNamepsnName); + deptIdentify1.setOperPhone(orgnizeNamePsnAccount); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + Long iddeptIdent = deptIdentifies.get(0).getId(); + SealManage sealManage = new SealManage(); + sealManage.setIdentifyId(iddeptIdent); + List sealIdList = new ArrayList<>(); + List selectSealList = sealManageMapper.selectSealList(sealManage); + if (selectSealList != null && selectSealList.size() > 0) { + for (SealManage manage : selectSealList) { + Integer sealStatus = manage.getSealStatus(); + Integer isUse = manage.getIsUse(); + if (sealStatus == 1 && isUse == 1) { + sealIdList.add(manage.getSealId()); + } } - } - EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); + response3 = SignAward.createByFileSeal(sealSignRecord, sealIdList); - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(application.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); - msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - // todo - // 设置申请人账户 - sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2116857"); - // todo - // 申请人发送短信 - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), - applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - // 被申请人账户 - sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2116857"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean1) { - resSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - resSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); - // 调解员账户 - SealSignRecord sealSignRecordMedi = new SealSignRecord(); - sealSignRecordMedi.setSignFlowid(signFlowId); - sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); - EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); - JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); - JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); - String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); - String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2116857"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); - Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); - - SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBooleanMedi) { - smsSendRecord1.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord1.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord1); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); } } } else { - return AjaxResult.error(); + // 不带用印 + response3 = SignAward.createByFileMediation(sealSignRecord); } - - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - } else { - return AjaxResult.error(); - } - } else { - return AjaxResult.error(); - } - } - break; - - } - } - } - - return AjaxResult.success(); - } else if (mediaResult.intValue() == 2) { - //未达成调解 - //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 - // 申请人短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2066725"); - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); - Boolean aBoolean = SmsUtils.sendSms(request); - // 新增短信记录 - SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信"); - if (aBoolean) { - appSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - appSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); - // 被申请人短信 - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2066725"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - // 新增短信记录 - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信"); - if (aBoolean1) { - resSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - resSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 3) { - //未达成调解但不再争议 - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 4) { - //未达成调解但同意引入仲裁 - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application, applicationVO); - - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO, caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if (importFlag == true) { - caseApplicationVO.setImportFlag(1); - } else { - caseApplicationVO.setImportFlag(0); - } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - - return AjaxResult.success(); - } else if (mediaResult.intValue() == 5) { - // 达成和解 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - String path = annexPath; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); - - Long arbitratorId = application.getMediatorId(); - if (arbitratorId != null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - // todo 申请人账户 - sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); - sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); - // 被申账户 - sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); - sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - } else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } - } - } - - EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); if (jsonObject3 != null) { if (jsonObject3.getIntValue("code") == 0) { @@ -3022,10 +2728,15 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msSealSignRecord.setFileId(sealSignRecord.getFileid()); msSealSignRecord.setFileName(sealSignRecord.getFilename()); msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); + msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); sealSignRecordMapper.insert(msSealSignRecord); - // 申请人签名记录 + + SealSignRecord sealSignRecordapply = new SealSignRecord(); sealSignRecordapply.setSignFlowid(signFlowId); + // todo + // 设置申请人账户 sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); @@ -3034,23 +2745,29 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - // 申请人短信 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); + request.setTemplateId("2116857"); + + // 申请人发送短信 request.setPhone(applicantAffiliateOpt.get().getPhone()); request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); + // todo 发送短信先注释掉 +// cn.hutool.json.JSONObject resultObj = SmsUtils.sendSms(request); + // todo + cn.hutool.json.JSONObject resultObj = new cn.hutool.json.JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), + applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", resultObj.get("sid") != null ? resultObj.get("sid").toString() : null); // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); - // 被申签名记录 + SealSignRecord sealSignRecordRespon = new SealSignRecord(); sealSignRecordRespon.setSignFlowid(signFlowId); + // 被申请人账户 sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); @@ -3059,19 +2776,47 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); + request1.setTemplateId("2116857"); request1.setPhone(resAffiliateOpt.get().getPhone()); request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); + // todo 短信记录 + // cn.hutool.json.JSONObject resultObjRes = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resultObjRes = new cn.hutool.json.JSONObject(); - SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resultObjRes.get("sid") != null ? resultObjRes.get("sid").toString() : null); // 新增短信记录 - if (aBoolean1) { - resSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (resultObjRes.get("status") != null && !resultObjRes.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - resSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } - smsRecordMapper.saveSmsSendRecord(resSendRecord); + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 调解员账户 + SealSignRecord sealSignRecordMedi = new SealSignRecord(); + sealSignRecordMedi.setSignFlowid(signFlowId); + sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); + EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); + JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); + JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); + String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); + String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); + requestMedi.setTemplateId("2116857"); + requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); + requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); + // todo 短信注释 +// cn.hutool.json.JSONObject mediaResultObj = SmsUtils.sendSms(requestMedi); + cn.hutool.json.JSONObject mediaResultObj = new cn.hutool.json.JSONObject(); + + SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信", mediaResultObj.get("sid") != null ? mediaResultObj.get("sid").toString() : null); + // 新增短信记录 + if (mediaResultObj.get("status") != null && !mediaResultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord1.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + smsSendRecord1.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord1); } else { throw new ServiceException(jsonObject3.getString("message")); @@ -3080,105 +2825,94 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.error(); } - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - return AjaxResult.success(); } else { return AjaxResult.error(); } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } + + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); } else { return AjaxResult.error(); } + } else { + return AjaxResult.error(); } break; } + + } } } - - } else { - // 线下调解 - List attachList = req.getAttachList(); - if (CollectionUtil.isEmpty(attachList)) { - return AjaxResult.error("请上传调解资料"); + return AjaxResult.success(); + } else if (mediaResult.intValue() == 2) { + //未达成调解 + //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2066725"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); + // 新增短信记录 + SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null); + if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } + smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); + // 被申请人短信 + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2066725"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); +// todo 短信注释 +// cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject(); + // 新增短信记录 + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null); + if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - for (MsCaseAttach attach : attachList) { - attach.setCaseAppliId(req.getId()); - msCaseAttachMapper.updateCaseAttach(attach); - } - // todo 对接北明,调用上传附件接口 - List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { - for (MsCaseAttach msCaseAttach : msCaseAttaches) { - String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttach(msCaseAttach); - } - } - } - // 修改案件状态为待送达 + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 修改案件状态为结束 Example flowExample = new Example(MsCaseFlow.class); - if (mediaResult == 1 || mediaResult == 5) { - // 达成调解,达成和解,案件状态改为待送达 - flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); - } else if (mediaResult == 2 || mediaResult == 3) { - // 未达成调解,未达成调解但不在争议改为结束状态 - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - } else if (mediaResult == 4) { - // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application, applicationVO); - - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO, caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if (importFlag == true) { - caseApplicationVO.setImportFlag(1); - } else { - caseApplicationVO.setImportFlag(0); - } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); } + return AjaxResult.success(); + } else if (mediaResult.intValue() == 3) { + //未达成调解但不再争议 + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); if (caseFlow != null) { application.setCaseFlowId(caseFlow.getId()); @@ -3187,18 +2921,345 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKey(application); // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - // todo 结束对接北明,为调解失败状态 - caseApplicationService. pushStatusToBM(application, PushCaseStatusEnum.FAIL); - } + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); } return AjaxResult.success(); + } else if (mediaResult.intValue() == 4) { + //未达成调解但同意引入仲裁 + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); + + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag == true) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + } + + return AjaxResult.success(); + } else if (mediaResult.intValue() == 5) { + // 达成和解 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (MsCaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { + // String prefix = "/profile"; + // int startIndex = prefix.length(); + String annexPath = caseAttach.getAnnexPath(); +// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + if (annexPath.contains("/profile/upload")) { + annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + } + String path = annexPath; + //获取文件上传地址 + EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + String fileId = jsonObject.getJSONObject("data").getString("fileId"); + String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); + //上传文件流 + EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + if (jsonObject1.getIntValue("errCode") == 0) { + //查看文件上传状态 + Thread.sleep(1000); + EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + JSONObject data = jsonObject2.getJSONObject("data"); + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { + String fileName = data.getString("fileName"); + //上传成功,获取文件签名印章位置 + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setFileid(fileId); + EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); + Gson gson = new Gson(); + JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); + JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); + String keywordPositions = positionsData.get("keywordPositions").toString(); + //发起签署 + sealSignRecord.setFilename(fileName); + + Long arbitratorId = application.getMediatorId(); + if (arbitratorId != null) { + SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); + if (sysUser == null) { + return AjaxResult.error(); + } + sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); + sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + } + // todo 申请人账户 + sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); + // 被申账户 + sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); + //解析文件签名印章位置 + JSONArray jsonArray = JSONArray.parseArray(keywordPositions); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject3 = jsonArray.getJSONObject(i); + String keyword = jsonObject3.getString("keyword"); + if (keyword.equals("申请人(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsn(positionX + 120); + sealSignRecord.setPositionYpsn(positionY); + } + } else if (keyword.equals("被申请人(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnRes(positionX + 120); + sealSignRecord.setPositionYpsnRes(positionY + 10); + } + } + } + + EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); + + JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); + if (jsonObject3 != null) { + if (jsonObject3.getIntValue("code") == 0) { + //获取签署流程ID + JSONObject data1 = jsonObject3.getJSONObject("data"); + String signFlowId = data1.getString("signFlowId"); + //保存案件id,文件id,文件名称.流程id到签署用印记录表里 + sealSignRecord.setCaseAppliId(application.getId()); + sealSignRecord.setSignFlowid(signFlowId); + sealSignRecord.setSignFlowStatus(1);//待签名 + MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); + BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); + msSealSignRecord.setFileId(sealSignRecord.getFileid()); + msSealSignRecord.setFileName(sealSignRecord.getFilename()); + msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + sealSignRecordMapper.insert(msSealSignRecord); + // 申请人签名记录 + SealSignRecord sealSignRecordapply = new SealSignRecord(); + sealSignRecordapply.setSignFlowid(signFlowId); + sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); + + //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2047719"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); + // todo 短信 +// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request); + cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null); + // 新增短信记录 + if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + // 被申签名记录 + SealSignRecord sealSignRecordRespon = new SealSignRecord(); + sealSignRecordRespon.setSignFlowid(signFlowId); + sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); + JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); + JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); + String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); + String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2047719"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); + // todo 短信 +// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject(); + + SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null); + // 新增短信记录 + if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSendRecord); + + } else { + throw new ServiceException(jsonObject3.getString("message")); + } + } else { + return AjaxResult.error(); + } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } + + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } else { + return AjaxResult.error(); + } + } + break; + } + } + } } + else + + { + // 线下调解 + List attachList = req.getAttachList(); + if (CollectionUtil.isEmpty(attachList)) { + return AjaxResult.error("请上传调解资料"); + } + // 先删除已经存在的调解书 + if (StrUtil.isEmpty(application.getCaseSource())) { + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if (CollectionUtil.isNotEmpty(existAttach)) { + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + for (MsCaseAttach attach : attachList) { + attach.setCaseAppliId(req.getId()); + msCaseAttachMapper.updateCaseAttach(attach); + } + // todo 对接北明,调用上传附件接口 + List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { + for (MsCaseAttach msCaseAttach : msCaseAttaches) { + String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttach(msCaseAttach); + } + } + } + // 修改案件状态为待送达 + Example flowExample = new Example(MsCaseFlow.class); + if (mediaResult == 1 || mediaResult == 5) { + // 达成调解,达成和解,案件状态改为待送达 + flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); + } else if (mediaResult == 2 || mediaResult == 3) { + // 未达成调解,未达成调解但不在争议改为结束状态 + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + } else if (mediaResult == 4) { + // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); + + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag == true) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); + } + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + // todo 结束对接北明,为调解失败状态 + caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); + } + } + return AjaxResult.success(); + } + return AjaxResult.success(); - } +} /** * 确定会议结果 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java index b90b50a..018dac9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java @@ -11,10 +11,10 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.PaymentStatusEnum; +import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; @@ -384,22 +384,24 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { continue; } if (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2)) { - Boolean smsFlag = true; + JSONObject jsonObject = new JSONObject(); SmsSendRecord smsSendRecord = null; if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { // 缴费通过 - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。"); + // todo 短信 +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } else { - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); + // todo 短信 +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (jsonObject.get("ststus")!=null && !jsonObject.get("ststus").equals(SMSStatusEnum.FAIL)) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } @@ -412,22 +414,24 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { continue; } if (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) { - Boolean smsFlag = true; + JSONObject jsonObject = new JSONObject(); SmsSendRecord smsSendRecord = null; if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // todo 短信 // 缴费通过 - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。"); +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } else { - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); + // todo 短信 +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL)) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } @@ -469,13 +473,16 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { @Transactional public void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) { // 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。 - Boolean smsFlag = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); - SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。"); + // todo 短信 + +// JSONObject jsonObject = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); + JSONObject jsonObject = new JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL)) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 73f0135..93f19d8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -596,9 +596,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { Gson gson = new Gson(); EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - sealSignRecordres.setSealUrl(urlapply); + if(signUrlJsonObject.get("data")==null||signUrlJsonObject.get("data").isJsonNull()){ + throw new ServiceException("该用户和流程无关,不能查看当前流程"); + }else { + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + sealSignRecordres.setSealUrl(urlapply); + } } return AjaxResult.success(sealSignRecordres); }else { @@ -722,7 +726,14 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(signStatusResponse!=null&&signStatusResponse.intValue()==1&& signStatusMediator!=null&&signStatusMediator.intValue()==1){ // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + MsCaseFlow nextFlow=null; + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + // 需要用印 + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + }else { + // 不需要用印 + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); @@ -730,8 +741,17 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //修改"签署用印记录表"的状态为待用印 - sealSignRecordsel.setSignFlowStatus(2); - sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + sealSignRecordsel.setSignFlowStatus(2); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + }else { + // 否则为已完成 + sealSignRecordsel.setSignFlowStatus(3); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + // 下载调解书 + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); + } + } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){ //被申请人签名 @@ -755,8 +775,17 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //修改"签署用印记录表"的状态为待用印 - sealSignRecordsel.setSignFlowStatus(2); - sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + sealSignRecordsel.setSignFlowStatus(2); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + }else { + // 否则为已完成 + sealSignRecordsel.setSignFlowStatus(3); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + // 下载调解书 + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); + } + } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){ //调解员签名 @@ -780,10 +809,16 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //修改"签署用印记录表"的状态为待用印 - sealSignRecordsel.setSignFlowStatus(2); + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + sealSignRecordsel.setSignFlowStatus(2); + }else { + // 否则为已完成 + sealSignRecordsel.setSignFlowStatus(3); + } sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); } - }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc)){ + }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){ + //需要用印 sealSignRecordsel.setSealStatus(1); sealSignRecordsel.setSignFlowStatus(3); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); @@ -804,73 +839,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //下载审核完成的调解书 - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); - JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); - JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); - if (filesArray != null && filesArray.size() > 0) { - JsonObject fileObject = (JsonObject) filesArray.get(0); - String fileDownloadUrl = fileObject.get("downloadUrl").toString(); - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String savePath = "/home/ruoyi/uploadPath/upload/"; - String saveName = fileName; - String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - String resultFilePath = saveFolderPath + "/" + fileName; - File resultFilePathFile = new File(resultFilePath); - if (!resultFilePathFile.exists()) { - resultFilePathFile.createNewFile(); - } - - String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - MsCaseAttach caseAttach = new MsCaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - caseAttachMapper.save(caseAttach); - // todo 对接北明,调用上传附件接口 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { - String templatePath = "/home/ruoyi" + savePath; - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } - - } - } - - } } }else if(mediaResult.intValue()==5){ @@ -932,7 +902,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ // todo 对接北明,同步案件状态,删除 @@ -940,7 +910,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); } } } @@ -1024,7 +994,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ // todo 对接北明,同步案件状态,删除 @@ -1032,7 +1002,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); } } } @@ -1069,6 +1039,77 @@ public class MsSignSealServiceImpl implements MsSignSealService { return AjaxResult.success("success"); } + private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException { + EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); + JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); + JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); + JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); + if (filesArray != null && filesArray.size() > 0) { + JsonObject fileObject = (JsonObject) filesArray.get(0); + String fileDownloadUrl = fileObject.get("downloadUrl").toString(); + LocalDate now = LocalDate.now(); + String year = Integer.toString(now.getYear()); + String month = String.format("%02d", now.getMonthValue()); + String day = String.format("%02d", now.getDayOfMonth()); + String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; + String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; +// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// String savePath = "/home/ruoyi/uploadPath/upload/"; + String saveName = fileName; + String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + + // 创建日期目录 + File saveFolder = new File(saveFolderPath); + if (!saveFolder.exists()) { + saveFolder.mkdirs(); + } + String resultFilePath = saveFolderPath + "/" + fileName; + File resultFilePathFile = new File(resultFilePath); + if (!resultFilePathFile.exists()) { + resultFilePathFile.createNewFile(); + } + + String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); + boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + if (downLoadFile) { + // 先删除已经存在的调解书 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + MsCaseAttach caseAttach = new MsCaseAttach(); + caseAttach.setCaseAppliId(caseAppliId); + caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + caseAttachMapper.save(caseAttach); + // todo 对接北明,调用上传附件接口 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + savePath; + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } + + } + } + + } + } + + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java index 841af1f..ab44919 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java @@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.config.RuoYiConfig; @@ -13,6 +15,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.AttachmentOperateTypeEnum; import com.ruoyi.common.enums.DocumentTypeEnum; +import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.PdfUtils; import com.ruoyi.common.utils.SecurityUtils; @@ -20,14 +23,18 @@ import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.ReservedConference; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.ReservedConferenceMapper; +import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.mscase.VideoConferenceService; import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.exception.TencentCloudSDKException; @@ -45,12 +52,14 @@ import tk.mybatis.mapper.entity.Example; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import javax.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; +import static com.ruoyi.common.core.domain.AjaxResult.error; import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.utils.file.FileUploadUtils.getAbsoluteFile; import static com.ruoyi.common.utils.file.FileUploadUtils.getPathFileName; @@ -80,6 +89,8 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { @Autowired private MsCaseAttachMapper caseAttachMapper; @Autowired + private MsCaseAffiliateMapper caseAffiliateMapper; + @Autowired private SysRoleMapper roleMapper; @Autowired private ReservedConferenceMapper reservedConferenceMapper; @@ -94,6 +105,8 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { private String BMSyncSource; @Autowired BeiMingInterfaceService beiMingInterfaceService; + @Autowired + private SmsRecordMapper smsRecordMapper; /** 视频回调 @@ -139,6 +152,83 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { return success("预约会议成功"); } + @Override + public void smsRollBack(String body, HttpServletRequest request) { + // 解析body + JSONArray jsonArray = JSONUtil.parseArray(body); + if (jsonArray != null && jsonArray.size() > 0) { + for (Object o : jsonArray) { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(o); + if (jsonObject.get("sid") != null) { + Object description = jsonObject.get("description"); + System.out.println(description); + // 查询sid对应的短信,更新短信状态 + SmsSendRecord smsSendRecord = smsRecordMapper.selectBySId(jsonObject.getStr("sid")); + if (smsSendRecord != null) { + if (jsonObject.get("report_status") != null && jsonObject.getStr("report_status").equals("SUCCESS")) { + smsSendRecord.setSendStatus(SMSStatusEnum.SUCCESS.getCode()); + } else { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + smsSendRecord.setReason(description != null ? description.toString() : null); + } + smsRecordMapper.updateStatus(smsSendRecord); + } + } + } + } + } + + @Override + public AjaxResult selectRoleMenuByCaseId(Long caseId) { + AjaxResult result = success(); + // 根据案件id查询相关人员 + List msCaseAffiliates = caseAffiliateMapper.selectByCaseId(caseId); + if(CollectionUtil.isEmpty(msCaseAffiliates)){ + return error("未找到案件相关人员"); + } + Long userId = SecurityUtils.getUserId(); + if(userId==null){ + return error("未找到当前登录用户"); + } + for (MsCaseAffiliate affiliate : msCaseAffiliates) { + if(affiliate.getOperatorFlag()!=null && affiliate.getOperatorFlag()==1 && affiliate.getUserId()!=null&&affiliate.getUserId().equals(userId)&&affiliate.getRoleType()!=null){ + if(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2)){ + // 申请人操作人 + result.put("appFlag","1"); + } + if(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4)){ + // 被申请人操作人 + result.put("resFlag","1"); + } + } + } + return result; + } + + public static void main(String[] args) { + String body="[{\"mobile\":\"18792927508\",\"report_status\":\"FAIL\",\"description\":\"\\u8FD0\\u8425\\u5546\\u5173\\u952E\\u5B57\\u62E6\\u622A\",\"errmsg\":\"GB:0010\",\"user_receive_time\":\"2024-04-07 14:28:57\",\"sid\":\"9318:147045628317124713319032750\",\"nationcode\":\"86\"}]"; + JSONArray jsonArray = JSONUtil.parseArray(body); + if(jsonArray!=null && jsonArray.size()>0){ + for (Object o : jsonArray) { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(o); + if(jsonObject.get("sid")!=null){ + String reportStatus = jsonObject.getStr("report_status"); + String description = jsonObject.getStr("description"); + System.out.println(description); + // 查询sid对应的短信,更新短信状态 + // SmsSendRecord smsSendRecord= smsRecordMapper.selectBySId(jsonObject.getStr("sid")); + // if(smsSendRecord!=null){ + // if(jsonObject.get("report_status")!=null && jsonObject.getStr("report_status").equals("SUCCESS")){ + // smsSendRecord.setSendStatus(SMSStatusEnum.SUCCESS.getCode()); + // }else { + // smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + // } + // } + } + } + } + } + /** * 根据案件id查询已预约的会议 * @@ -388,11 +478,11 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { if(caseApplication==null){ return AjaxResult.error("案件不存在"); } + List roles = roleMapper.selectRolePermissionByUserId(userId); JSONObject jsonObject = new JSONObject(); boolean isSecretaryRole=false; if(caseApplication.getMediatorId()!=null&& Objects.equals(userId, caseApplication.getMediatorId())){ // 是调解员 - List roles = roleMapper.selectRolePermissionByUserId(userId); if(CollectionUtil.isNotEmpty(roles)){ for (SysRole role : roles) { if("调解员".equals(role.getRoleName())){ @@ -401,6 +491,16 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { } } } + }else { + // 是调解员 + if(CollectionUtil.isNotEmpty(roles)){ + for (SysRole role : roles) { + if("法律顾问".equals(role.getRoleName())){ + isSecretaryRole=true; + break; + } + } + } } jsonObject.put("isSecretaryRole",isSecretaryRole); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java index 76bbf20..3db8b3c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java @@ -288,12 +288,12 @@ public class SignAward { } /** - * 发起签署 + * 发起带有用印签署 * * @return * @throws EsignDemoException */ - public static EsignHttpResponse createByFileMediation(SealSignRecord sealSignRecord ,List sealIdList) throws EsignDemoException { + public static EsignHttpResponse createByFileSeal(SealSignRecord sealSignRecord ,List sealIdList) throws EsignDemoException { String apiaddr = "/v3/sign-flow/create-by-file"; String fileId = sealSignRecord.getFileid(); @@ -488,6 +488,162 @@ public class SignAward { //发起接口请求 return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } + /** + * 发起不带用印签署 + * + * @return + * @throws EsignDemoException + */ + public static EsignHttpResponse createByFileMediation(SealSignRecord sealSignRecord) throws EsignDemoException { + String apiaddr = "/v3/sign-flow/create-by-file"; + + String fileId = sealSignRecord.getFileid(); + String fileName = sealSignRecord.getFilename(); + + String psnAccount = sealSignRecord.getPensonAccount(); + String psnName = sealSignRecord.getPensonName(); + + String psnAccountRes = sealSignRecord.getPensonAccountRes(); + String psnNameRes = sealSignRecord.getPensonNameRes(); + + String psnAccountMedi = sealSignRecord.getPensonAccountMedi(); + String psnNameMedi = sealSignRecord.getPensonNameMedi(); + + + String positionPagepsn = sealSignRecord.getPositionPagepsn(); + double positionXpsn = sealSignRecord.getPositionXpsn(); + double positionYpsn = sealSignRecord.getPositionYpsn(); + + String positionPagepsnRes = sealSignRecord.getPositionPagepsnRes(); + double positionXpsnRes = sealSignRecord.getPositionXpsnRes(); + double positionYpsnRes = sealSignRecord.getPositionYpsnRes(); + + String positionPagepsnMedi = sealSignRecord.getPositionPagepsnMedi(); + double positionXpsnMedi = sealSignRecord.getPositionXpsnMedi(); + double positionYpsnMedi = sealSignRecord.getPositionYpsnMedi(); + + + String jsonParm = "{\n" + + " \"docs\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"fileName\": \"" + fileName + "\"\n" + + " }\n" + + " ],\n" + + " \"signFlowConfig\": {\n" + + " \"signFlowTitle\": \"测试合同\",\n" + + " \"autoStart\": true,\n" + + " \"authConfig\": {\n" + + " \"willingnessAuthModes\": [\n" + + " \"CODE_SMS\"\n" + + " ],\n" + + " \"psnAvailableAuthModes\": [\n" + + " \"PSN_MOBILE3\"\n" + + " ],\n" + + " \"orgAvailableAuthModes\": [\n" + + " \"ORG_LEGALREP\"\n" + + " ]\n" + + " },\n" + + + " \"signConfig\": {\n" + + " \"availableSignClientTypes\": \"1\"\n" + + " },\n" + +// " \"notifyUrl\": \"" + signSealCallbackUrl + "\",\n" + + " \"autoFinish\": true\n" + + " },\n" + + + " \"signers\": [\n" + + " {\n" + + " \"psnSignerInfo\": {\n" + + " \"psnAccount\": \"" + psnAccount + "\",\n" + + " \"psnInfo\": {\n" + + " \"psnName\": \"" + psnName + "\"\n" + + " }\n" + + " },\n" + + " \"signFields\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"normalSignFieldConfig\": {\n" + + " \"autoSign\": false,\n" + + " \"freeMode\": false,\n" + + " \"movableSignField\": false,\n" + + " \"signFieldPosition\": {\n" + + " \"positionPage\": \"" + positionPagepsn + "\",\n" + + " \"positionX\": " + positionXpsn + ",\n" + + " \"positionY\": " + positionYpsn + "\n" + + " },\n" + + " \"signFieldStyle\": 1\n" + + " },\n" + + " \"signFieldType\": 0\n" + + " }\n" + + " ],\n" + + " \"signerType\": 0\n" + + " },\n" + + + " {\n" + + " \"psnSignerInfo\": {\n" + + " \"psnAccount\": \"" + psnAccountRes + "\",\n" + + " \"psnInfo\": {\n" + + " \"psnName\": \"" + psnNameRes + "\"\n" + + " }\n" + + " },\n" + + " \"signFields\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"normalSignFieldConfig\": {\n" + + " \"autoSign\": false,\n" + + " \"freeMode\": false,\n" + + " \"movableSignField\": false,\n" + + " \"signFieldPosition\": {\n" + + " \"positionPage\": \"" + positionPagepsnRes + "\",\n" + + " \"positionX\": " + positionXpsnRes + ",\n" + + " \"positionY\": " + positionYpsnRes + "\n" + + " },\n" + + " \"signFieldStyle\": 1\n" + + " },\n" + + " \"signFieldType\": 0\n" + + " }\n" + + " ],\n" + + " \"signerType\": 0\n" + + " },\n" + + + + " {\n" + + " \"psnSignerInfo\": {\n" + + " \"psnAccount\": \"" + psnAccountMedi + "\",\n" + + " \"psnInfo\": {\n" + + " \"psnName\": \"" + psnNameMedi + "\"\n" + + " }\n" + + " },\n" + + " \"signFields\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"normalSignFieldConfig\": {\n" + + " \"autoSign\": false,\n" + + " \"freeMode\": false,\n" + + " \"movableSignField\": false,\n" + + " \"signFieldPosition\": {\n" + + " \"positionPage\": \"" + positionPagepsnMedi + "\",\n" + + " \"positionX\": " + positionXpsnMedi + ",\n" + + " \"positionY\": " + positionYpsnMedi + "\n" + + " },\n" + + " \"signFieldStyle\": 1\n" + + " },\n" + + " \"signFieldType\": 0\n" + + " }\n" + + " ],\n" + + " \"signerType\": 0\n" + + " }\n" + + " ]\n" + + "}"; + + //请求方法 + EsignRequestType requestType = EsignRequestType.POST; + //生成请求签名鉴权方式的Header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); + } /** * 发起签署 @@ -850,8 +1006,8 @@ public class SignAward { String apiaddr = "/v3/files/" + fileId + "/keyword-positions"; String jsonParm = "{\n" + " \"keywords\": [\n" + - " \"甲方(签字):\",\n" + - " \"乙方(签字):\",\n" + + " \"申请人(签字):\",\n" + + " \"被申请人(签字):\",\n" + " \"调解员(签字):\",\n" + " \"调解机构(盖章):\"\n" + " ]\n" + diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index ee6beed..5aa6050 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -230,4 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update ms_sys_dept set del_flag = '2' where dept_id = #{deptId}
- \ No newline at end of file + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 3f1441b..1e24c66 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -182,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from ms_sys_user u left join ms_sys_user_role ur on u.user_id = ur.user_id left join ms_sys_role r on r.role_id = ur.role_id - where u.eamil = #{eamil} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 + where u.email = #{email} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 - select id ,case_appli_id ,case_num ,phone ,send_time ,send_content,send_status + select * from ms_sms_send_record @@ -76,5 +82,14 @@ order by send_time desc + + + + + update ms_sms_send_record + set send_status= #{sendStatus} ,reason=#{reason} where sid=#{sid} + -- 2.54.0 From 6314a583b9dc5f1c324311374d1be2b17444e32e Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Mon, 8 Apr 2024 15:46:26 +0800 Subject: [PATCH 05/30] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/utils/SmsUtils.java | 2 +- .../vo/mscase/MsCaseApplicationReq.java | 2 +- .../impl/MsCaseApplicationServiceImpl.java | 50 ++++++++++++------- .../mscase/impl/MsSignSealServiceImpl.java | 20 +++++++- 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java index 18f3771..c89b03b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java @@ -59,7 +59,7 @@ public class SmsUtils { } public static JSONObject sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) { JSONObject jsonObject = new JSONObject(); - SmsUtils1.SendSmsRequest request = new SmsUtils1.SendSmsRequest(phone,templateId,templateParamSet,caseId); + SendSmsRequest request = new SendSmsRequest(phone,templateId,templateParamSet,caseId); Credential cred = new Credential(SECRET_ID, SECRET_KEY ); SmsClient client = new SmsClient(cred, "ap-guangzhou"); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index 8129d65..db8600d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -124,5 +124,5 @@ public class MsCaseApplicationReq { * 是否需要用印,0-不需要,1-需要 */ // todo 等会放开 - private Integer sealFlag=0; + private Integer sealFlag=1; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 92f4ebd..097882e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -280,50 +280,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { StringBuilder applicantName = new StringBuilder(); StringBuilder respondentName = new StringBuilder(); for (MsCaseAffiliate affiliate : affiliates) { - // 当前用户是操作人 - if(affiliate.getUserId()!=null && affiliate.getUserId().equals(loginUserId) - && affiliate.getRoleType()!=null && affiliate.getOperatorFlag()!=null && affiliate.getOperatorFlag()==1) { - if (vo.getAppOperatorFlag() == null && (affiliate.getRoleType()==1 || affiliate.getRoleType()==2)) { - // 设置申请操作人标记 - vo.setAppOperatorFlag(1); - } - if (vo.getResOperatorFlag() == null && (affiliate.getRoleType()==3 || affiliate.getRoleType()==4)) { - // 设置被申请操作人标记 - vo.setResOperatorFlag(1); + // 当前用户是操作人 + if (affiliate.getUserId()!=null && affiliate.getRoleType() != null && affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1) { + if (vo.getAppOperatorFlag() == null && (affiliate.getRoleType() == 1 || affiliate.getRoleType() == 2)) { + // 申请人操作人 + if(affiliate.getUserId().equals(loginUserId) &&!vo.getCaseStatusName().equals("待签名")){ + vo.setAppOperatorFlag(1); + }else if(vo.getCaseStatusName().equals("待签名")) { + if(affiliate.getUserId().equals(loginUserId)){ + vo.setAppOperatorFlag(1); + }else { + vo.setAppOperatorFlag(0); + } + } + } + if (vo.getResOperatorFlag() == null && (affiliate.getRoleType() == 3 || affiliate.getRoleType() == 4)) { + // 申请人操作人 + if(Objects.equals(affiliate.getUserId(), loginUserId) &&!vo.getCaseStatusName().equals("待签名")){ + vo.setResOperatorFlag(1); + }else if(vo.getCaseStatusName().equals("待签名")) { + if(Objects.equals(affiliate.getUserId(), loginUserId)){ + vo.setResOperatorFlag(1); + }else { + vo.setResOperatorFlag(0); + } + } + + } } - } if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName()) - && !applicantName.toString().contains(affiliate.getName())) { + && !applicantName.toString().contains(affiliate.getName()+Constants.CN_SPLIT_COMMA)) { applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); } }else { // 组织机构 if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) - && !applicantName.toString().contains(affiliate.getApplicantOrgName())) { + && !applicantName.toString().contains(affiliate.getApplicantOrgName()+Constants.CN_SPLIT_COMMA)) { applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); } } if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") && affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getName()) - && !respondentName.toString().contains(affiliate.getName())) { + && !respondentName.toString().contains(affiliate.getName()+Constants.CN_SPLIT_COMMA)) { respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); } }else { // 组织机构 - if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())&& !respondentName.toString().contains(affiliate.getApplicantOrgName())) { + if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())&& !respondentName.toString().contains(affiliate.getApplicantOrgName()+Constants.CN_SPLIT_COMMA)) { respondentName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); } } -// if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") -// && affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){ -// respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); -// } } vo.setApplicationName(removeLastComma(applicantName.toString(),Constants.CN_SPLIT_COMMA)); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 93f19d8..ef9eb6a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -767,7 +767,15 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(signStatusApply!=null&&signStatusApply.intValue()==1&& signStatusMediator!=null&&signStatusMediator.intValue()==1){ // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + // 根据流程id查找下一个流程节点 + MsCaseFlow nextFlow=null; + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + // 需要用印 + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + }else { + // 不需要用印 + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); @@ -801,7 +809,15 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(signStatusApply!=null&&signStatusApply.intValue()==1&& signStatusResponse!=null&&signStatusResponse.intValue()==1){ // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + // 根据流程id查找下一个流程节点 + MsCaseFlow nextFlow=null; + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + // 需要用印 + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + }else { + // 不需要用印 + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); -- 2.54.0 From dfddc6a9f4672e8b5afceea7c1004fa43eec3ccf Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Mon, 8 Apr 2024 17:05:06 +0800 Subject: [PATCH 06/30] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=92=8C=E9=87=8D=E6=96=B0=E5=8F=91=E9=80=81?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/ShortMessageController.java | 49 ++++++++++ .../shortmessage/MsSmsSendHistoryRecord.java | 92 +++++++++++++++++++ .../MsSmsSendHistoryRecordMapper.java | 7 ++ .../mapper/sendrecord/SmsRecordMapper.java | 11 +++ .../sendrecord/ShortMessageService.java | 19 ++++ .../impl/ShortMessageServiceImpl.java | 54 +++++++++++ .../MsSmsSendHistoryRecordMapper.xml | 23 +++++ .../sendrecord/SmsRecordMapper.xml | 8 ++ .../resources/generator/config.properties | 6 +- 9 files changed, 266 insertions(+), 3 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java new file mode 100644 index 0000000..9ebd03b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java @@ -0,0 +1,49 @@ +package com.ruoyi.web.controller.wisdomarbitrate.sendrecord; + +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; +import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; + +@RestController +@RequestMapping("/shortMessage") +public class ShortMessageController { + @Autowired + private SmsRecordMapper smsRecordMapper; + @Autowired + private ShortMessageService shortMessageService; + + @Anonymous + @PostMapping("/updateSendContent") + public AjaxResult update(@RequestBody SmsSendRecord smsSendRecord) { + if (smsSendRecord != null && smsSendRecord.getId() != null) { + SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId()); + smsSendRecord.setUpdateTime(new Date()); + smsRecordMapper.updateSendContent(smsSendRecord); + shortMessageService.insertShortMessageHistoryRecord(oldSendRecord); + return AjaxResult.success(); + } + return AjaxResult.error("更新失败"); + } + + /** + * 重新发送短信 + */ + @Anonymous + @PostMapping("/reSendShortMessage") + public AjaxResult reSendShortMessage(@RequestBody SmsSendRecord smsSendRecord) { + if (smsSendRecord != null) { + AjaxResult result = shortMessageService.reSendShortMessage(smsSendRecord); + return result; + } + return AjaxResult.error("发送失败"); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java new file mode 100644 index 0000000..b6ad8af --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSmsSendHistoryRecord.java @@ -0,0 +1,92 @@ +package com.ruoyi.system.domain.entity.shortmessage; + +import java.util.Date; +import javax.persistence.*; + +import lombok.*; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Table(name = "ms_sms_send_history_record") +public class MsSmsSendHistoryRecord { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * 案件id + */ + @Column(name = "case_appli_id") + private Long caseAppliId; + + /** + * 案件编号 + */ + @Column(name = "case_num") + private String caseNum; + + /** + * 手机号 + */ + private String phone; + + /** + * 发送时间 + */ + @Column(name = "send_time") + private Date sendTime; + + /** + * 发送状态,0-失败,1-成功 + */ + @Column(name = "send_status") + private Long sendStatus; + + /** + * 发送内容 + */ + @Column(name = "send_content") + private String sendContent; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; + + /** + * 更新时间 + */ + @Column(name = "update_time") + private Date updateTime; + + /** + * 创建人 + */ + @Column(name = "create_by") + private String createBy; + + /** + * 更新者 + */ + @Column(name = "update_by") + private String updateBy; + + /** + * 发送短信唯一标识 + */ + private String sid; + + /** + * 父类短信id + */ + @Column(name = "parent_id") + private Long parentId; + + /** + * 失败原因 + */ + private String reason; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.java new file mode 100644 index 0000000..d4152fc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.shortmessage; + +import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; +import tk.mybatis.mapper.common.Mapper; + +public interface MsSmsSendHistoryRecordMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java index f4483d0..4ad6fe3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java @@ -21,4 +21,15 @@ public interface SmsRecordMapper { int batchSaveSmsSendRecord(@Param("list") List smsSendRecordList); SmsSendRecord selectBySId(@Param("sid") String sid); void updateStatus (SmsSendRecord smsSendRecord); + + /** + * 更新短信发送内容 + * @param smsSendRecord + * @return + */ + int updateSendContent(SmsSendRecord smsSendRecord); + /** + * 通过id查询短信发送记录 + */ + SmsSendRecord selectById(@Param("id") Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java new file mode 100644 index 0000000..bd9f290 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java @@ -0,0 +1,19 @@ +package com.ruoyi.wisdomarbitrate.service.sendrecord; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; +import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; + +public interface ShortMessageService { + /** + * 新增发送历史记录 + */ + void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord); + + /** + * 重新发送短信 + * @param smsSendRecord + */ + AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java new file mode 100644 index 0000000..16290df --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java @@ -0,0 +1,54 @@ +package com.ruoyi.wisdomarbitrate.service.sendrecord.impl; + +import cn.hutool.json.JSONObject; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.SMSStatusEnum; +import com.ruoyi.common.utils.SmsUtils; +import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; +import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ShortMessageServiceImpl implements ShortMessageService { + @Autowired + MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper; + /** + * 新增发送历史记录 + * + * @param smsSendRecord + */ + @Override + public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) { + if(smsSendRecord!=null){ + MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord(); + BeanUtils.copyProperties(smsSendRecord,historyRecord); + historyRecord.setId(null); + historyRecord.setParentId(smsSendRecord.getId()); + msSmsSendHistoryRecordMapper.insert(historyRecord); + } + } + + /** + * 重新发送短信 + * + * @param smsSendRecord + */ + @Override + public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) { + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + //TODO 模版id待替换 + request.setTemplateId("1955047"); + request.setPhone(smsSendRecord.getPhone()); + request.setTemplateParamSet(new String[]{ smsSendRecord.getSendContent()}); + JSONObject resultObj = SmsUtils.sendSms(request); + if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){ + return AjaxResult.success("短信发送成功"); + }else { + return AjaxResult.warn("短信发送失败"); + } + } +} diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.xml new file mode 100644 index 0000000..03b13cb --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSmsSendHistoryRecordMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml index ba9d379..e823cdd 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml @@ -91,5 +91,13 @@ update ms_sms_send_record set send_status= #{sendStatus} ,reason=#{reason} where sid=#{sid} + + update ms_sms_send_record + set send_content= #{sendContent} ,update_time=#{updateTime} where id=#{id} + + + diff --git a/tkgenerator/src/main/resources/generator/config.properties b/tkgenerator/src/main/resources/generator/config.properties index c0281fb..4fbfe55 100644 --- a/tkgenerator/src/main/resources/generator/config.properties +++ b/tkgenerator/src/main/resources/generator/config.properties @@ -3,10 +3,10 @@ jdbc.url=jdbc:mysql://121.40.189.20:3306/mediation_system?serverTimezone=Asia/Sh jdbc.user=root jdbc.password=YMzc157# #目标模块项目路径 -targetprojectpath=E:/WorkCode/SH/Mediation-Backend/ruoyi-system +targetprojectpath=D:/WorkCode/TJ/Mediation-Backend/ruoyi-system #模块名称 -moduleName=flow +moduleName=shortmessage #表名 -tableName=ms_case_flow +tableName=ms_sms_send_history_record #主键 premaryId=id -- 2.54.0 From 02ba0782387da380cd45ee1f10cbd7f45076373a Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 9 Apr 2024 16:22:08 +0800 Subject: [PATCH 07/30] =?UTF-8?q?admin=E6=9D=83=E9=99=90=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=B3=A8=E5=86=8C=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/SysLoginService.java | 10 +- .../web/service/SysPermissionService.java | 4 +- .../ruoyi/system/service/ISysMenuService.java | 12 +- .../service/impl/SysMenuServiceImpl.java | 40 +- .../service/impl/SysUserServiceImpl.java | 6 +- .../impl/WeChatUserServiceImpl.java | 12 +- .../impl/MsCaseApplicationServiceImpl.java | 754 +++++++++--------- 7 files changed, 434 insertions(+), 404 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 326e1ce..370e267 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -21,6 +21,7 @@ import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -56,6 +57,8 @@ public class SysLoginService private ISysConfigService configService; @Autowired private SysRoleMapper roleMapper; + @Autowired + private SysUserMapper userMapper; /** * 登录验证 @@ -231,7 +234,12 @@ public class SysLoginService AjaxResult ajax = AjaxResult.success(); String username = loginBody.getUsername(); // 根据用户名获取用户信息,如果用户不存在则新增用户 - SysUser user = userService.selectUserByUserName(username); + SysUser user =null; + if(username.contains("@")) { + user= userMapper.selectUserByEmail(username); + }else { + user= userService.selectUserByUserName(username); + } if(user==null){ // 新增用户 user = new SysUser(); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java index 15ad8d9..a3f7a30 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java @@ -63,7 +63,9 @@ public class SysPermissionService // 管理员拥有所有权限 if (user.isAdmin()) { - perms.add("*:*:*"); + // 查询所有数据权限,排除案件管理下的权限即可 + perms.addAll(menuService.selectAdminMenu()); + // perms.add("*:*:*"); } else { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 7d60696..59f268a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -1,11 +1,12 @@ package com.ruoyi.system.service; -import java.util.List; -import java.util.Set; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.system.domain.vo.RouterVo; +import java.util.List; +import java.util.Set; + /** * 菜单 业务层 * @@ -141,4 +142,11 @@ public interface ISysMenuService * @return 结果 */ public boolean checkMenuNameUnique(SysMenu menu); + + /** + * 查询管理员权限 + * @return + */ + + Set selectAdminMenu(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 225c280..b359cb6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -1,15 +1,6 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; +import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.TreeSelect; @@ -24,6 +15,11 @@ import com.ruoyi.system.mapper.SysMenuMapper; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysRoleMenuMapper; import com.ruoyi.system.service.ISysMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; /** * 菜单 业务层处理 @@ -120,6 +116,28 @@ public class SysMenuServiceImpl implements ISysMenuService } return permsSet; } + /** + * 查询管理员权限 + * @return + */ + @Override + public Set selectAdminMenu() { + Set permsSet = new HashSet<>(); + List sysMenus = menuMapper.selectMenuList(new SysMenu()); + Long caseMenuId =null; + if(CollectionUtil.isNotEmpty(sysMenus)){ + Optional optional = sysMenus.stream().filter(sysMenu -> sysMenu.getMenuName().equals("案件列表")).findFirst(); + if(optional.isPresent()){ + caseMenuId= optional.get().getMenuId(); + } + for (SysMenu sysMenu : sysMenus) { + if(!sysMenu.getParentId().equals(caseMenuId)&&StringUtils.isNotEmpty(sysMenu.getPerms())){ + permsSet.addAll(Arrays.asList(sysMenu.getPerms().trim().split(","))); + } + } + } + return permsSet; + } /** * 根据用户ID查询菜单 @@ -346,6 +364,8 @@ public class SysMenuServiceImpl implements ISysMenuService return UserConstants.UNIQUE; } + + /** * 获取路由名称 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index c222a1a..cb14f99 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -483,11 +483,11 @@ public class SysUserServiceImpl implements ISysUserService { checkUserDataScope(userId); } // 删除用户与角色关联 - userRoleMapper.deleteUserRole(userIds); + // userRoleMapper.deleteUserRole(userIds); // 删除用户与岗位关联 - userPostMapper.deleteUserPost(userIds); + // userPostMapper.deleteUserPost(userIds); // 删除用户部门关联 - userDeptMapper.deleteUserByIds(userIds); + // userDeptMapper.deleteUserByIds(userIds); int i = userMapper.deleteUserByIds(userIds); for (Long userId : userIds) { // 删除缓存 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java index 0c26f91..908444a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java @@ -120,18 +120,11 @@ public class WeChatUserServiceImpl implements WeChatUserService { if(checkPhoneUnique!=null){ return AjaxResult.warn("手机号已存在"); } - SysUser checkEmailUnique = sysUserMapper.checkEmailUnique(ientityAuthentication.getEmail()); - if(checkEmailUnique!=null){ - return AjaxResult.warn("邮箱已存在"); - } - // 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增 - SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo()); + // 根据邮箱查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增 + SysUser sysUser=sysUserMapper.selectUserByEmail(ientityAuthentication.getEmail()); // 查询角色 Long roleIdByName =ientityAuthentication.getRoleId(); -// if(roleIdByName==null){ -// return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色"); -// } if(sysUser!=null){ sysUser.setIdCard(ientityAuthentication.getIdentityNo()); sysUser.setNickName(ientityAuthentication.getName()); @@ -145,7 +138,6 @@ public class WeChatUserServiceImpl implements WeChatUserService { ientityAuthentication.setUserId(sysUser.getUserId()); int count=0; if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){ - for (SysRole role : sysUser.getRoles()) { if(Objects.equals(role.getRoleId(), roleIdByName)){ count++; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 097882e..27db354 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -1806,8 +1806,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if(CollectionUtil.isEmpty(operatorList)){ return AjaxResult.error("未找到案件操作人员"); } - long applicantCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count(); - long resCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count(); + long applicantCount = operatorList.stream().filter(affiliate ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count(); + long resCount = operatorList.stream().filter(affiliate ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count(); if(applicantCount==0 && resCount==0){ return AjaxResult.error("申请人操作人、被申请人操作人手机号不存在,请修改案件信息"); }else if(applicantCount==0 ){ @@ -2534,6 +2534,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 调解结果 Integer mediaResult = req.getMediaResult(); + if (mediaResult == null) { + return AjaxResult.error("请选择调解结果"); + } if (application.getMediationMethod().equals("1")) { // 线上调解 List attachList = req.getAttachList(); @@ -2639,7 +2642,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY+40); + sealSignRecord.setPositionYpsn(positionY + 40); } } else if (keyword.equals("被申请人(签字):")) { //签名 @@ -2654,7 +2657,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY+10 ); + sealSignRecord.setPositionYpsnRes(positionY + 10); } } else if (keyword.equals("调解员(签字):")) { //签名 @@ -2669,7 +2672,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsnMedi(positionX + 120); - sealSignRecord.setPositionYpsnMedi(positionY+10 ); + sealSignRecord.setPositionYpsnMedi(positionY + 10); } } else { // 设置用印位置 @@ -2854,6 +2857,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } application.setMediaResult(mediaResult); + application.setSealFlag(req.getSealFlag()); msCaseApplicationMapper.updateByPrimaryKeySelective(application); } else { return AjaxResult.error(); @@ -2867,412 +2871,408 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } - } + return AjaxResult.success(); - return AjaxResult.success(); - } else if (mediaResult.intValue() == 2) { - //未达成调解 - //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 - // 申请人短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2066725"); - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); - // todo 短信 + } else if (mediaResult == 2) { + //未达成调解 + //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2066725"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); + // todo 短信 // cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request); - cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); - // 新增短信记录 - SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null); - if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); - // 被申请人短信 - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2066725"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); + // 新增短信记录 + SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null); + if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); + // 被申请人短信 + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2066725"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); // todo 短信注释 // cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1); - cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject(); - // 新增短信记录 - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null); - if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 3) { - //未达成调解但不再争议 - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 4) { - //未达成调解但同意引入仲裁 - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application, applicationVO); + cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject(); + // 新增短信记录 + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null); + if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + } + return AjaxResult.success(); + } else if (mediaResult == 3) { + //未达成调解但不再争议 + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + } + return AjaxResult.success(); + } else if (mediaResult == 4) { + //未达成调解但同意引入仲裁 + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO, caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if (importFlag == true) { - caseApplicationVO.setImportFlag(1); - } else { - caseApplicationVO.setImportFlag(0); - } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 5) { - // 达成和解 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); + return AjaxResult.success(); + } else if (mediaResult == 5) { + // 达成和解 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (MsCaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { + // String prefix = "/profile"; + // int startIndex = prefix.length(); + String annexPath = caseAttach.getAnnexPath(); // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - if (annexPath.contains("/profile/upload")) { - annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); - } - String path = annexPath; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); + if (annexPath.contains("/profile/upload")) { + annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + } + String path = annexPath; + //获取文件上传地址 + EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + String fileId = jsonObject.getJSONObject("data").getString("fileId"); + String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); + //上传文件流 + EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + if (jsonObject1.getIntValue("errCode") == 0) { + //查看文件上传状态 + Thread.sleep(1000); + EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + JSONObject data = jsonObject2.getJSONObject("data"); + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { + String fileName = data.getString("fileName"); + //上传成功,获取文件签名印章位置 + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setFileid(fileId); + EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); + Gson gson = new Gson(); + JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); + JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); + String keywordPositions = positionsData.get("keywordPositions").toString(); + //发起签署 + sealSignRecord.setFilename(fileName); - Long arbitratorId = application.getMediatorId(); - if (arbitratorId != null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { + Long arbitratorId = application.getMediatorId(); + if (arbitratorId != null) { + SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); + if (sysUser == null) { + return AjaxResult.error(); + } + sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); + sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + } + // todo 申请人账户 + sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); + // 被申账户 + sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); + //解析文件签名印章位置 + JSONArray jsonArray = JSONArray.parseArray(keywordPositions); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject3 = jsonArray.getJSONObject(i); + String keyword = jsonObject3.getString("keyword"); + if (keyword.equals("申请人(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsn(positionX + 120); + sealSignRecord.setPositionYpsn(positionY); + } + } else if (keyword.equals("被申请人(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnRes(positionX + 120); + sealSignRecord.setPositionYpsnRes(positionY + 10); + } + } + } + + EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); + + JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); + if (jsonObject3 != null) { + if (jsonObject3.getIntValue("code") == 0) { + //获取签署流程ID + JSONObject data1 = jsonObject3.getJSONObject("data"); + String signFlowId = data1.getString("signFlowId"); + //保存案件id,文件id,文件名称.流程id到签署用印记录表里 + sealSignRecord.setCaseAppliId(application.getId()); + sealSignRecord.setSignFlowid(signFlowId); + sealSignRecord.setSignFlowStatus(1);//待签名 + MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); + BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); + msSealSignRecord.setFileId(sealSignRecord.getFileid()); + msSealSignRecord.setFileName(sealSignRecord.getFilename()); + msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + sealSignRecordMapper.insert(msSealSignRecord); + // 申请人签名记录 + SealSignRecord sealSignRecordapply = new SealSignRecord(); + sealSignRecordapply.setSignFlowid(signFlowId); + sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); + + //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2047719"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); + // todo 短信 +// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request); + cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null); + // 新增短信记录 + if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + // 被申签名记录 + SealSignRecord sealSignRecordRespon = new SealSignRecord(); + sealSignRecordRespon.setSignFlowid(signFlowId); + sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); + JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); + JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); + String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); + String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2047719"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); + // todo 短信 +// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject(); + + SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null); + // 新增短信记录 + if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSendRecord); + + } else { + throw new ServiceException(jsonObject3.getString("message")); + } + } else { return AjaxResult.error(); } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - // todo 申请人账户 - sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); - sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); - // 被申账户 - sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); - sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("申请人(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - } else if (keyword.equals("被申请人(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); } - } - EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); - - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(application.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - sealSignRecordMapper.insert(msSealSignRecord); - // 申请人签名记录 - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - // 申请人短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - // todo 短信 -// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request); - cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject(); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null); - // 新增短信记录 - if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - // 被申签名记录 - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - // todo 短信 -// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1); - cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject(); - - SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null); - // 新增短信记录 - if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - } else { - resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSendRecord); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); + return AjaxResult.success(); } else { return AjaxResult.error(); } - - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - return AjaxResult.success(); } else { return AjaxResult.error(); } - } else { - return AjaxResult.error(); } + break; } - break; } } } - } - - else - - { - // 线下调解 - List attachList = req.getAttachList(); - if (CollectionUtil.isEmpty(attachList)) { - return AjaxResult.error("请上传调解资料"); - } - // 先删除已经存在的调解书 - if (StrUtil.isEmpty(application.getCaseSource())) { - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if (CollectionUtil.isNotEmpty(existAttach)) { - // todo 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { - continue; + } else { + // 线下调解 + List attachList = req.getAttachList(); + if (CollectionUtil.isEmpty(attachList)) { + return AjaxResult.error("请上传调解资料"); + } + // 先删除已经存在的调解书 + if (StrUtil.isEmpty(application.getCaseSource())) { + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if (CollectionUtil.isNotEmpty(existAttach)) { + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); } } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - for (MsCaseAttach attach : attachList) { - attach.setCaseAppliId(req.getId()); - msCaseAttachMapper.updateCaseAttach(attach); - } - // todo 对接北明,调用上传附件接口 - List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { - for (MsCaseAttach msCaseAttach : msCaseAttaches) { - String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { - msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttach(msCaseAttach); + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + for (MsCaseAttach attach : attachList) { + attach.setCaseAppliId(req.getId()); + msCaseAttachMapper.updateCaseAttach(attach); + } + // todo 对接北明,调用上传附件接口 + List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { + for (MsCaseAttach msCaseAttach : msCaseAttaches) { + String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttach(msCaseAttach); + } } } - } - // 修改案件状态为待送达 - Example flowExample = new Example(MsCaseFlow.class); - if (mediaResult == 1 || mediaResult == 5) { - // 达成调解,达成和解,案件状态改为待送达 - flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); - } else if (mediaResult == 2 || mediaResult == 3) { - // 未达成调解,未达成调解但不在争议改为结束状态 - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - } else if (mediaResult == 4) { - // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application, applicationVO); + // 修改案件状态为待送达 + Example flowExample = new Example(MsCaseFlow.class); + if (mediaResult == 1 || mediaResult == 5) { + // 达成调解,达成和解,案件状态改为待送达 + flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); + } else if (mediaResult == 2 || mediaResult == 3) { + // 未达成调解,未达成调解但不在争议改为结束状态 + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + } else if (mediaResult == 4) { + // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO, caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if (importFlag == true) { - caseApplicationVO.setImportFlag(1); - } else { - caseApplicationVO.setImportFlag(0); + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag == true) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); - } - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - // todo 结束对接北明,为调解失败状态 - caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + // todo 结束对接北明,为调解失败状态 + caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); + } } + return AjaxResult.success(); } - return AjaxResult.success(); + + + return AjaxResult.error(); } - - return AjaxResult.success(); -} - /** * 确定会议结果 * @param req -- 2.54.0 From b56288cc8c4e63fbff501beb15bc220b4044ab0a Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Fri, 12 Apr 2024 17:42:14 +0800 Subject: [PATCH 08/30] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E5=90=8E=E7=9A=84=E6=98=8E=E6=96=87=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E8=A7=86=E9=A2=91=E4=BC=9A=E8=AE=AE=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/ShortMessageController.java | 20 +++- .../src/main/resources/application.yml | 3 +- .../com/ruoyi/common/utils/EncryptUtils.java | 9 +- .../entity/shortmessage/EncryptendInfo.java | 31 +++++ .../shortmessage/EncryptendInfoMapper.java | 7 ++ .../domain/vo/secret/SecretInfo.java | 21 ++++ .../impl/ShortMessageServiceImpl.java | 54 --------- .../ShortMessageService.java | 14 ++- .../impl/ShortMessageServiceImpl.java | 109 ++++++++++++++++++ .../shortmessage/EncryptendInfoMapper.xml | 12 ++ 10 files changed, 218 insertions(+), 62 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java delete mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java rename ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/{sendrecord => shortmessage}/ShortMessageService.java (58%) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java index 9ebd03b..9eba364 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java @@ -4,12 +4,9 @@ import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; -import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService; +import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.Date; @@ -46,4 +43,17 @@ public class ShortMessageController { } return AjaxResult.error("发送失败"); } + + /** + * 查询UID好的密钥 + */ + @Anonymous + @GetMapping("/getEncryptInfoByid") + public Object getEncryptInfoByUid(@RequestParam(name = "id",required = true) String id) { + if (id != null) { + Object result = shortMessageService.getEncryptInfoByUid(id); + return result; + } + return AjaxResult.error("查询失败"); + } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index c0a1dad..169b903 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -217,4 +217,5 @@ BMConfig: # max-tasks-per-process: 100 beimingapihost: https://zj.odrcloud.cn beimingapiprefix: /onestop/sync -beimingprivatekey: d7724e72c4be93196a35203e8379ded5 \ No newline at end of file +beimingprivatekey: d7724e72c4be93196a35203e8379ded5 +shortMessageKey: 936df5fd9aba3b86adc3c1a1c52dcde1 \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java index 579e6be..455ec3f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EncryptUtils.java @@ -112,10 +112,17 @@ public class EncryptUtils { public static void main(String[] args) { String privateKey = "936df5fd9aba3b86adc3c1a1c52dcde1"; ObjectNode param = new ObjectMapper().createObjectNode(); - param.put("name", "姓名"); + param.put("userName", "张三"); + param.put("caseNo", "ZC1234125"); + param.put("userId", "124124"); + param.put("roomId", "124125"); + param.put("systemType", "tiaojiexitong"); String encryptString = sm4Encrypt(param.toString(), privateKey); System.out.println("加密后的字符串:" + encryptString); + String uid = UUID.randomUUID().toString().replace("-", ""); + System.out.println("uid:" + uid); System.out.println("解密后的字符串:" + sm4Decrypt(encryptString, privateKey)); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java new file mode 100644 index 0000000..89fc581 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java @@ -0,0 +1,31 @@ +package com.ruoyi.system.domain.entity.shortmessage; + +import java.util.Date; +import javax.persistence.*; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@Table(name = "encryptend_info") +public class EncryptendInfo { + /** + * 主键 + */ + @Id + private String uid; + + /** + * 加密后的内容 + */ + @Column(name = "encrypted_content") + private String encryptedContent; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java new file mode 100644 index 0000000..13c656e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.shortmessage; + +import com.ruoyi.system.domain.entity.shortmessage.EncryptendInfo; +import tk.mybatis.mapper.common.Mapper; + +public interface EncryptendInfoMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java new file mode 100644 index 0000000..ecf3dd2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java @@ -0,0 +1,21 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.secret; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SecretInfo { + /** + * 用户登录名、案件编号、用户id、房间号、跳转系统类型(tiaojie、zhongcai) + */ + private String userName; + private String caseNo; + private String userId; + private Integer roomId; + private String systemType; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java deleted file mode 100644 index 16290df..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/ShortMessageServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ruoyi.wisdomarbitrate.service.sendrecord.impl; - -import cn.hutool.json.JSONObject; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.SMSStatusEnum; -import com.ruoyi.common.utils.SmsUtils; -import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; -import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; -import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; -import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ShortMessageServiceImpl implements ShortMessageService { - @Autowired - MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper; - /** - * 新增发送历史记录 - * - * @param smsSendRecord - */ - @Override - public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) { - if(smsSendRecord!=null){ - MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord(); - BeanUtils.copyProperties(smsSendRecord,historyRecord); - historyRecord.setId(null); - historyRecord.setParentId(smsSendRecord.getId()); - msSmsSendHistoryRecordMapper.insert(historyRecord); - } - } - - /** - * 重新发送短信 - * - * @param smsSendRecord - */ - @Override - public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) { - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - //TODO 模版id待替换 - request.setTemplateId("1955047"); - request.setPhone(smsSendRecord.getPhone()); - request.setTemplateParamSet(new String[]{ smsSendRecord.getSendContent()}); - JSONObject resultObj = SmsUtils.sendSms(request); - if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){ - return AjaxResult.success("短信发送成功"); - }else { - return AjaxResult.warn("短信发送失败"); - } - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java similarity index 58% rename from ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java rename to ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java index bd9f290..adfbd1c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ShortMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java @@ -1,9 +1,10 @@ -package com.ruoyi.wisdomarbitrate.service.sendrecord; +package com.ruoyi.wisdomarbitrate.service.shortmessage; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.vo.secret.SecretInfo; public interface ShortMessageService { /** @@ -16,4 +17,15 @@ public interface ShortMessageService { * @param smsSendRecord */ AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord); + + /** + * 根据信息生成加密信息记录 + * @param secretInfo + * @return + */ + String buildEncryptInfoRecord(SecretInfo secretInfo); + /** + * 通过UID查询加密信息并解密成明文对象 + */ + Object getEncryptInfoByUid(String uid); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java new file mode 100644 index 0000000..12b9ae0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java @@ -0,0 +1,109 @@ +package com.ruoyi.wisdomarbitrate.service.shortmessage.impl; + +import cn.hutool.json.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.SMSStatusEnum; +import com.ruoyi.common.utils.SmsUtils; +import com.ruoyi.system.domain.entity.shortmessage.EncryptendInfo; +import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; +import com.ruoyi.system.mapper.shortmessage.EncryptendInfoMapper; +import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.vo.secret.SecretInfo; +import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.UUID; + +import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt; +import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; + +@Service +public class ShortMessageServiceImpl implements ShortMessageService { + @Value("${shortMessageKey}") + private String shortMessageKey; + @Autowired + MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper; + @Autowired + EncryptendInfoMapper encryptendInfoMapper; + + /** + * 新增发送历史记录 + * + * @param smsSendRecord + */ + @Override + public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) { + if (smsSendRecord != null) { + MsSmsSendHistoryRecord historyRecord = new MsSmsSendHistoryRecord(); + BeanUtils.copyProperties(smsSendRecord, historyRecord); + historyRecord.setId(null); + historyRecord.setParentId(smsSendRecord.getId()); + msSmsSendHistoryRecordMapper.insert(historyRecord); + } + } + + /** + * 重新发送短信 + * + * @param smsSendRecord + */ + @Override + public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) { + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + //TODO 模版id待替换 + request.setTemplateId("1955047"); + request.setPhone(smsSendRecord.getPhone()); + request.setTemplateParamSet(new String[]{smsSendRecord.getSendContent()}); + JSONObject resultObj = SmsUtils.sendSms(request); + if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + return AjaxResult.success("短信发送成功"); + } else { + return AjaxResult.warn("短信发送失败"); + } + } + + /** + * 根据信息生成加密信息记录 + * + * @param secretInfo + * @return + */ + @Override + public String buildEncryptInfoRecord(SecretInfo secretInfo) { + String privateKey = shortMessageKey; + ObjectNode param = new ObjectMapper().createObjectNode(); + param.put("userName", secretInfo.getUserName()); + param.put("caseNo", secretInfo.getCaseNo()); + param.put("userId", secretInfo.getUserId()); + param.put("roomId", secretInfo.getRoomId()); + param.put("systemType", secretInfo.getSystemType()); + String encryptString = sm4Encrypt(param.toString(), privateKey); + String uid = UUID.randomUUID().toString().replace("-", ""); + EncryptendInfo encryptendInfo = new EncryptendInfo(); + encryptendInfo.setUid(uid); + encryptendInfo.setEncryptedContent(encryptString); + encryptendInfoMapper.insertSelective(encryptendInfo); + System.out.println("加密后的字符串:" + encryptString); + return uid; + } + + /** + * 通过UID查询加密信息并解密成明文对象 + * + * @param uid + */ + @Override + public Object getEncryptInfoByUid(String uid) { + EncryptendInfo encryptendInfo = encryptendInfoMapper.selectByPrimaryKey(uid); + if (encryptendInfo != null) { + return sm4Decrypt(encryptendInfo.getEncryptedContent(), shortMessageKey); + } + return null; + } +} diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml new file mode 100644 index 0000000..e7d32a8 --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file -- 2.54.0 From a24635c429c6cb3946c50f275a3a1e5e2a19246b Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Fri, 12 Apr 2024 18:30:26 +0800 Subject: [PATCH 09/30] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=85=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E4=BA=8B=E9=A1=B9=EF=BC=9A=E7=BA=BF=E4=B8=8A=E8=B0=83?= =?UTF-8?q?=E8=A7=A3=E6=97=B6=E5=8F=91=E9=80=81=E8=A7=86=E9=A2=91=E4=BC=9A?= =?UTF-8?q?=E8=AE=AE=E9=93=BE=E6=8E=A5=E7=9F=AD=E4=BF=A1=E7=BB=99=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/mscase/impl/MsCaseApplicationServiceImpl.java | 3 +++ tkgenerator/src/main/resources/generator/config.properties | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 27db354..8af6a6e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -2277,6 +2277,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { + //TODO 发送调解时视频会议链接地址,模板id为2125909 + //短信模板:尊敬的{1}用户,您的{2}会议链接https://txroom.xayunmei.com/#/home?{3},请点击链接参加会议,如非本人操作,请忽略本短信 + // todo 短信 // cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), // new String[]{caseApplication.getCaseNum(), application.getHearDate()}); diff --git a/tkgenerator/src/main/resources/generator/config.properties b/tkgenerator/src/main/resources/generator/config.properties index 4fbfe55..66e8621 100644 --- a/tkgenerator/src/main/resources/generator/config.properties +++ b/tkgenerator/src/main/resources/generator/config.properties @@ -7,6 +7,6 @@ targetprojectpath=D:/WorkCode/TJ/Mediation-Backend/ruoyi-system #模块名称 moduleName=shortmessage #表名 -tableName=ms_sms_send_history_record +tableName=encryptend_info #主键 premaryId=id -- 2.54.0 From a6195fc2559e4bd7f734a9b747e617a4de337c65 Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Mon, 15 Apr 2024 17:35:14 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/ShortMessageController.java | 8 +-- .../src/main/resources/application.yml | 1 - .../com/ruoyi/common/constant/Constants.java | 22 +++--- .../entity/shortmessage/EncryptendInfo.java | 31 --------- .../entity/shortmessage/MeetingInfo.java | 60 ++++++++++++++++ .../shortmessage/EncryptendInfoMapper.java | 7 -- .../shortmessage/MeetingInfoMapper.java | 7 ++ .../domain/vo/secret/SecretInfo.java | 21 ------ .../domain/vo/shortmessage/MeetingInfoVO.java | 41 +++++++++++ .../shortmessage/ShortMessageService.java | 13 ++-- .../impl/ShortMessageServiceImpl.java | 68 +++++++++++-------- .../shortmessage/EncryptendInfoMapper.xml | 12 ---- .../mapper/shortmessage/MeetingInfoMapper.xml | 16 +++++ 13 files changed, 185 insertions(+), 122 deletions(-) delete mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MeetingInfo.java delete mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.java delete mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/MeetingInfoVO.java delete mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml create mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java index 9eba364..905dbc6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java @@ -48,10 +48,10 @@ public class ShortMessageController { * 查询UID好的密钥 */ @Anonymous - @GetMapping("/getEncryptInfoByid") - public Object getEncryptInfoByUid(@RequestParam(name = "id",required = true) String id) { - if (id != null) { - Object result = shortMessageService.getEncryptInfoByUid(id); + @GetMapping("/getMeetingInfo") + public Object getEncryptInfoByUid(@RequestParam(name = "authId", required = true) String authId) { + if (authId != null) { + Object result = shortMessageService.getMeetingInfo(authId); return result; } return AjaxResult.error("查询失败"); diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 169b903..fa7d84e 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -218,4 +218,3 @@ BMConfig: beimingapihost: https://zj.odrcloud.cn beimingapiprefix: /onestop/sync beimingprivatekey: d7724e72c4be93196a35203e8379ded5 -shortMessageKey: 936df5fd9aba3b86adc3c1a1c52dcde1 \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index b1b5c79..a185090 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -4,11 +4,10 @@ import io.jsonwebtoken.Claims; /** * 通用常量信息 - * + * * @author ruoyi */ -public class Constants -{ +public class Constants { /** * UTF-8 字符集 */ @@ -71,7 +70,7 @@ public class Constants * 登录失败 */ public static final String LOGIN_FAIL = "Error"; - + /** * 验证码有效期(分钟) */ @@ -95,6 +94,10 @@ public class Constants * 令牌前缀 */ public static final String LOGIN_USER_KEY = "login_user_key"; + /** + * 会议主键Id + */ + public static final String MEETING_KEY = "meeting_key"; /** * 用户ID @@ -142,23 +145,22 @@ public class Constants public static final String LOOKUP_LDAPS = "ldaps:"; public static final String DEFAULT_PASSWORD = "123456"; // 英文逗号分隔符 - public static final String SPLIT_COMMA =","; + public static final String SPLIT_COMMA = ","; // 中文逗号分隔符 - public static final String CN_SPLIT_COMMA =","; + public static final String CN_SPLIT_COMMA = ","; /** * 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全) */ - public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" }; + public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.ruoyi"}; /** * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) */ - public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; + public static final String[] JOB_WHITELIST_STR = {"com.ruoyi"}; /** * 定时任务违规的字符 */ - public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", - "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" }; + public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config"}; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java deleted file mode 100644 index 89fc581..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/EncryptendInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.ruoyi.system.domain.entity.shortmessage; - -import java.util.Date; -import javax.persistence.*; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@Table(name = "encryptend_info") -public class EncryptendInfo { - /** - * 主键 - */ - @Id - private String uid; - - /** - * 加密后的内容 - */ - @Column(name = "encrypted_content") - private String encryptedContent; - - /** - * 创建时间 - */ - @Column(name = "create_time") - private Date createTime; -} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MeetingInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MeetingInfo.java new file mode 100644 index 0000000..3a3c1df --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MeetingInfo.java @@ -0,0 +1,60 @@ +package com.ruoyi.system.domain.entity.shortmessage; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "meeting_info") +public class MeetingInfo { + /** + * 主键Id + */ + @Id + private String uid; + + /** + * 案件Id + */ + @Column(name = "case_id") + private Long caseId; + + /** + * 用户Id + */ + @Column(name = "user_id") + private Long userId; + + /** + * 用户名称 + */ + @Column(name = "user_name") + private String userName; + + /** + * 房间Id + */ + @Column(name = "room_id") + private String roomId; + + /** + * 系统类型 + */ + @Column(name = "system_type") + private String systemType; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java deleted file mode 100644 index 13c656e..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.ruoyi.system.mapper.shortmessage; - -import com.ruoyi.system.domain.entity.shortmessage.EncryptendInfo; -import tk.mybatis.mapper.common.Mapper; - -public interface EncryptendInfoMapper extends Mapper { -} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.java new file mode 100644 index 0000000..19a4a9c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.shortmessage; + +import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo; +import tk.mybatis.mapper.common.Mapper; + +public interface MeetingInfoMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java deleted file mode 100644 index ecf3dd2..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/secret/SecretInfo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ruoyi.wisdomarbitrate.domain.vo.secret; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class SecretInfo { - /** - * 用户登录名、案件编号、用户id、房间号、跳转系统类型(tiaojie、zhongcai) - */ - private String userName; - private String caseNo; - private String userId; - private Integer roomId; - private String systemType; -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/MeetingInfoVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/MeetingInfoVO.java new file mode 100644 index 0000000..0f30ac8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/MeetingInfoVO.java @@ -0,0 +1,41 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.shortmessage; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MeetingInfoVO { + /** + * 案件Id + */ + private Long caseId; + + /** + * 用户Id + */ + private Long userId; + + /** + * 用户名称 + */ + private String userName; + + /** + * 房间Id + */ + private String roomId; + + /** + * 系统类型 + */ + private String systemType; + /** + * 登录认证令牌 + */ + private String token; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java index adfbd1c..ba91508 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java @@ -1,10 +1,8 @@ package com.ruoyi.wisdomarbitrate.service.shortmessage; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; -import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; -import com.ruoyi.wisdomarbitrate.domain.vo.secret.SecretInfo; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; public interface ShortMessageService { /** @@ -14,18 +12,21 @@ public interface ShortMessageService { /** * 重新发送短信 + * * @param smsSendRecord */ AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord); /** * 根据信息生成加密信息记录 - * @param secretInfo + * + * @param meetingInfoVO * @return */ - String buildEncryptInfoRecord(SecretInfo secretInfo); + String buildMeetingInfoRecord(MeetingInfoVO meetingInfoVO); + /** * 通过UID查询加密信息并解密成明文对象 */ - Object getEncryptInfoByUid(String uid); + Object getMeetingInfo(String uid); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java index 12b9ae0..05b891b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java @@ -1,36 +1,35 @@ package com.ruoyi.wisdomarbitrate.service.shortmessage.impl; import cn.hutool.json.JSONObject; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.utils.SmsUtils; -import com.ruoyi.system.domain.entity.shortmessage.EncryptendInfo; +import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo; import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; -import com.ruoyi.system.mapper.shortmessage.EncryptendInfoMapper; +import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper; import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; -import com.ruoyi.wisdomarbitrate.domain.vo.secret.SecretInfo; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; -import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt; -import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt; - @Service public class ShortMessageServiceImpl implements ShortMessageService { - @Value("${shortMessageKey}") - private String shortMessageKey; @Autowired MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper; @Autowired - EncryptendInfoMapper encryptendInfoMapper; + MeetingInfoMapper meetingInfoMapper; /** * 新增发送历史记录 @@ -71,25 +70,15 @@ public class ShortMessageServiceImpl implements ShortMessageService { /** * 根据信息生成加密信息记录 * - * @param secretInfo + * @param meetingInfoVO * @return */ @Override - public String buildEncryptInfoRecord(SecretInfo secretInfo) { - String privateKey = shortMessageKey; - ObjectNode param = new ObjectMapper().createObjectNode(); - param.put("userName", secretInfo.getUserName()); - param.put("caseNo", secretInfo.getCaseNo()); - param.put("userId", secretInfo.getUserId()); - param.put("roomId", secretInfo.getRoomId()); - param.put("systemType", secretInfo.getSystemType()); - String encryptString = sm4Encrypt(param.toString(), privateKey); + public String buildMeetingInfoRecord(MeetingInfoVO meetingInfoVO) { String uid = UUID.randomUUID().toString().replace("-", ""); - EncryptendInfo encryptendInfo = new EncryptendInfo(); - encryptendInfo.setUid(uid); - encryptendInfo.setEncryptedContent(encryptString); - encryptendInfoMapper.insertSelective(encryptendInfo); - System.out.println("加密后的字符串:" + encryptString); + MeetingInfo meetingInfo = MeetingInfo.builder().userId(meetingInfoVO.getUserId()).userName(meetingInfoVO.getUserName()).caseId(meetingInfoVO.getCaseId()).roomId(meetingInfoVO.getRoomId()).systemType(meetingInfoVO.getSystemType()).createTime(new Date()).uid(uid).build(); + meetingInfo.setUid(uid); + meetingInfoMapper.insertSelective(meetingInfo); return uid; } @@ -99,11 +88,30 @@ public class ShortMessageServiceImpl implements ShortMessageService { * @param uid */ @Override - public Object getEncryptInfoByUid(String uid) { - EncryptendInfo encryptendInfo = encryptendInfoMapper.selectByPrimaryKey(uid); - if (encryptendInfo != null) { - return sm4Decrypt(encryptendInfo.getEncryptedContent(), shortMessageKey); + public Object getMeetingInfo(String uid) { + MeetingInfoVO result = new MeetingInfoVO(); + MeetingInfo meetingInfo = meetingInfoMapper.selectByPrimaryKey(uid); + if (meetingInfo != null) { + BeanUtils.copyProperties(meetingInfo, result); + if (result != null) { + Map claims = new HashMap<>(); + claims.put("userName", meetingInfo.getUserName()); + claims.put("userId", meetingInfo.getUserId()); + claims.put(Constants.MEETING_KEY, uid); + String createToken = createToken(claims); + result.setToken(createToken); + } + return result; } return null; } + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + private String createToken(Map claims) { + String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact(); + return token; + } } diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml deleted file mode 100644 index e7d32a8..0000000 --- a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/EncryptendInfoMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.xml new file mode 100644 index 0000000..d3bdf9e --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MeetingInfoMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file -- 2.54.0 From 333c162ab00f30df406c504a669f2087078d547d Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Tue, 16 Apr 2024 10:03:15 +0800 Subject: [PATCH 11/30] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=9F=AD=E4=BF=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/ShortMessageController.java | 9 +++--- .../vo/shortmessage/ReSendMessageVO.java | 28 +++++++++++++++++ .../shortmessage/ShortMessageService.java | 5 ++-- .../impl/ShortMessageServiceImpl.java | 30 ++++++++++++------- 4 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java index 905dbc6..517fc0a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java @@ -3,6 +3,7 @@ package com.ruoyi.web.controller.wisdomarbitrate.sendrecord; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import org.springframework.beans.factory.annotation.Autowired; @@ -36,12 +37,12 @@ public class ShortMessageController { */ @Anonymous @PostMapping("/reSendShortMessage") - public AjaxResult reSendShortMessage(@RequestBody SmsSendRecord smsSendRecord) { - if (smsSendRecord != null) { - AjaxResult result = shortMessageService.reSendShortMessage(smsSendRecord); + public AjaxResult reSendShortMessage(@RequestBody ReSendMessageVO reSendMessageVO) { + if (reSendMessageVO != null) { + AjaxResult result = shortMessageService.reSendShortMessage(reSendMessageVO); return result; } - return AjaxResult.error("发送失败"); + return AjaxResult.error("参数缺失"); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java new file mode 100644 index 0000000..faec975 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/shortmessage/ReSendMessageVO.java @@ -0,0 +1,28 @@ +package com.ruoyi.wisdomarbitrate.domain.vo.shortmessage; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ReSendMessageVO { + /** + * 短信模版Id + */ + private String templateId; + /** + * 手机号 + */ + private String phone; + /** + * 短信模版参数值 + */ + private List paramValues; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java index ba91508..1daf865 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/ShortMessageService.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service.shortmessage; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; public interface ShortMessageService { /** @@ -13,9 +14,9 @@ public interface ShortMessageService { /** * 重新发送短信 * - * @param smsSendRecord + * @param reSendMessageVO */ - AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord); + AjaxResult reSendShortMessage(ReSendMessageVO reSendMessageVO); /** * 根据信息生成加密信息记录 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java index 05b891b..5da6425 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper; import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; @@ -50,20 +51,27 @@ public class ShortMessageServiceImpl implements ShortMessageService { /** * 重新发送短信 * - * @param smsSendRecord + * @param reSendMessageVO */ @Override - public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) { - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - //TODO 模版id待替换 - request.setTemplateId("1955047"); - request.setPhone(smsSendRecord.getPhone()); - request.setTemplateParamSet(new String[]{smsSendRecord.getSendContent()}); - JSONObject resultObj = SmsUtils.sendSms(request); - if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { - return AjaxResult.success("短信发送成功"); + public AjaxResult reSendShortMessage(ReSendMessageVO reSendMessageVO) { + if (reSendMessageVO != null && reSendMessageVO.getTemplateId() != null && reSendMessageVO.getPhone() != null && reSendMessageVO.getParamValues() != null && reSendMessageVO.getParamValues().size() > 0) { + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId(reSendMessageVO.getTemplateId()); + request.setPhone(reSendMessageVO.getPhone()); + String[] messageContent = reSendMessageVO.getParamValues().toArray(new String[0]); + System.out.println(reSendMessageVO.getTemplateId()); + System.out.println(reSendMessageVO.getPhone()); + System.out.println(messageContent); + request.setTemplateParamSet(messageContent); + JSONObject resultObj = SmsUtils.sendSms(request); + if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + return AjaxResult.success("重新发送成功"); + } else { + return AjaxResult.warn("重新发送失败"); + } } else { - return AjaxResult.warn("短信发送失败"); + return AjaxResult.warn("参数缺失"); } } -- 2.54.0 From b0aa7d09c4ebc6bc03df7266fd9783edd23f79a4 Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Tue, 16 Apr 2024 13:43:30 +0800 Subject: [PATCH 12/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=92=8C=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E3=80=81=E4=BC=98=E5=8C=96=E6=B5=81=E7=A8=8B=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/flow/MsCaseFlowRoleSmsRelated.java | 44 +++++ .../vo/flow/MsCaseFlowRoleSmsRelatedVO.java | 39 ++++ .../system/domain/vo/flow/MsCaseFlowVO.java | 14 +- .../flow/MsCaseFlowRoleSmsRelatedMapper.java | 7 + .../system/service/flow/CaseFlowService.java | 13 +- .../service/flow/CaseFlowServiceImpl.java | 169 ++++++++++++++---- .../flow/MsCaseFlowRoleSmsRelatedMapper.xml | 14 ++ 7 files changed, 266 insertions(+), 34 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/flow/MsCaseFlowRoleSmsRelated.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowRoleSmsRelatedVO.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.java create mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.xml diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/flow/MsCaseFlowRoleSmsRelated.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/flow/MsCaseFlowRoleSmsRelated.java new file mode 100644 index 0000000..e3b09c4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/flow/MsCaseFlowRoleSmsRelated.java @@ -0,0 +1,44 @@ +package com.ruoyi.system.domain.entity.flow; + +import java.util.Date; +import javax.persistence.*; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@Table(name = "ms_case_flow_role_sms_related") +public class MsCaseFlowRoleSmsRelated { + /** + * id + */ + @Id + @GeneratedValue(generator = "JDBC") + private Integer id; + + /** + * 案件流程id + */ + @Column(name = "flow_id") + private Integer flowId; + + /** + * 用户角色id + */ + @Column(name = "receive_role_id") + private Long receiveRoleId; + + /** + * 短信模版id + */ + @Column(name = "sms_template_id") + private Long smsTemplateId; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowRoleSmsRelatedVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowRoleSmsRelatedVO.java new file mode 100644 index 0000000..891a17a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowRoleSmsRelatedVO.java @@ -0,0 +1,39 @@ +package com.ruoyi.system.domain.vo.flow; + +import com.alibaba.fastjson2.JSONObject; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Data +public class MsCaseFlowRoleSmsRelatedVO { + /** + * 主键id + */ + private Integer id; + + /** + * 流程节点id + */ + private Integer flowId; + + + /** + * 短信模版id + */ + private Long smsTemplateId; + /** + * 发送短信的角色id + */ + private List receiveRoleIds; + /** + * 接收短信角色名称 + */ + public List receiveRoleNames; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowVO.java index 5ff8a51..7b1060c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowVO.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain.vo.flow; +import com.alibaba.fastjson2.JSONObject; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -64,5 +65,16 @@ public class MsCaseFlowVO { * svg图片路径 */ private String fileName; - + /** + * 短信模版id + */ + private Long smsTemplateId; + /** + * 发送短信的角色id + */ + private List receiveRoleIds; + /** + * 接收短信角色名称 + */ + public List receiveRoleNames; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.java new file mode 100644 index 0000000..1eb82cc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.flow; + +import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleSmsRelated; +import tk.mybatis.mapper.common.Mapper; + +public interface MsCaseFlowRoleSmsRelatedMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java index 27c8b38..012901b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java @@ -1,6 +1,7 @@ package com.ruoyi.system.service.flow; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.domain.vo.flow.MsCaseFlowRoleSmsRelatedVO; import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO; import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO; @@ -9,18 +10,22 @@ import java.util.Set; public interface CaseFlowService { /** * 查询案件流程节点信息 + * * @param caseFlowSearchVO * @return */ Object queryCaseFlowInfo(MsCaseFlowSearchVO caseFlowSearchVO); + /** * 查询案件流程信息 + * * @return */ AjaxResult selectCaseFlow(); /** * 新增或编辑案件流程节点信息 + * * @param caseFlowVO * @return */ @@ -28,6 +33,7 @@ public interface CaseFlowService { /** * 删除案件流程节点信息 + * * @param caseFlowVO * @return */ @@ -35,6 +41,7 @@ public interface CaseFlowService { /** * 排序案件流程节点 + * * @param caseFlowSearchVO * @return */ @@ -42,10 +49,14 @@ public interface CaseFlowService { /** * 查询用户角色关联的案件状态 + * * @param roles * @return */ Set getCaseStatusIdByRoleKey(Set roles); - + /** + * 查询流程节点接收信息配置记录 + */ + MsCaseFlowRoleSmsRelatedVO queryFlowReceiveRoleSmsRelated(Integer flowId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java index ff8ffbb..08dc602 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.system.service.flow; +import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ruoyi.common.core.domain.AjaxResult; @@ -7,12 +8,15 @@ import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; +import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleSmsRelated; import com.ruoyi.system.domain.vo.flow.MsBaseCaseFlow; +import com.ruoyi.system.domain.vo.flow.MsCaseFlowRoleSmsRelatedVO; import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO; import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; +import com.ruoyi.system.mapper.flow.MsCaseFlowRoleSmsRelatedMapper; import com.ruoyi.system.util.NewStringUtil; import com.ruoyi.system.util.TableDataUtil; import org.springframework.beans.BeanUtils; @@ -90,6 +94,30 @@ public class CaseFlowServiceImpl implements CaseFlowService { MsCaseFlow msCaseFlow1 = msCaseFlowMapper.selectByPrimaryKey(msCaseFlow.getBackFlowId()); temp.setBackFlowName(msCaseFlow1 != null ? msCaseFlow1.getNodeName() : ""); } + //短信接收角色 + if (msCaseFlow.getId() != null) { + Example example1 = new Example(MsCaseFlowRoleSmsRelated.class); + Example.Criteria criteria1 = example1.createCriteria(); + criteria1.andEqualTo("flowId", msCaseFlow.getId()); + List msCaseFlowRoleSmsRelateds = msCaseFlowRoleSmsRelatedMapper.selectByExample(example1); + List receiveRoleNames = new ArrayList<>(); + List receiveRoleIds = new ArrayList<>(); + for (int k = 0; k < msCaseFlowRoleSmsRelateds.size(); k++) { + MsCaseFlowRoleSmsRelated msCaseFlowRoleSmsRelated = msCaseFlowRoleSmsRelateds.get(k); + if (msCaseFlowRoleSmsRelated.getReceiveRoleId() != null) { + SysRole sysRole = sysRoleMapper.selectRoleById(msCaseFlowRoleSmsRelated.getReceiveRoleId()); + if (sysRole != null) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("roleId", sysRole.getRoleId()); + jsonObject.put("roleName", sysRole.getRoleName()); + receiveRoleNames.add(jsonObject); + receiveRoleIds.add(sysRole.getRoleId()); + } + } + } + temp.setReceiveRoleIds(receiveRoleIds); + temp.setReceiveRoleNames(receiveRoleNames); + } list.add(temp); } TableDataInfo tableDataInfo = TableDataUtil.rebuildTableDataInfo(list, total); @@ -134,15 +162,16 @@ public class CaseFlowServiceImpl implements CaseFlowService { /** * 本地图片装64 + * * @param imgPath * @return * @throws Exception */ - public static String convertToBase64( String imgPath) { + public static String convertToBase64(String imgPath) { byte[] data = null; // 读取图片字节数组 try { - imgPath=imgPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload/"); + imgPath = imgPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload/"); InputStream in = Files.newInputStream(Paths.get(imgPath)); data = new byte[in.available()]; in.read(data); @@ -153,6 +182,7 @@ public class CaseFlowServiceImpl implements CaseFlowService { // 返回Base64编码过的字节数组字符串 return Base64.getEncoder().encodeToString(Objects.requireNonNull(data)); } + /** * 新增或编辑案件流程节点信息 * @@ -161,40 +191,78 @@ public class CaseFlowServiceImpl implements CaseFlowService { */ @Override public Boolean saveCaseFlow(MsCaseFlowVO caseFlowVO) { - - if (caseFlowVO.getId() != null) { - //更新案件流程信息 - MsCaseFlow msCaseFlow = new MsCaseFlow(); - BeanUtils.copyProperties(caseFlowVO, msCaseFlow); - int i = msCaseFlowMapper.updateByPrimaryKey(msCaseFlow); - if (i > 0) { - //更新流程节点和角色之间的关系 - updateFlowRoleByFlowId(msCaseFlow.getId(), caseFlowVO.getRoleIds()); - return true; - } - } else { - int sort = 1; - Example example = new Example(MsCaseFlow.class); - example.setOrderByClause("sort DESC limit 1"); - Example.Criteria criteria = example.createCriteria(); - List msCaseFlows = msCaseFlowMapper.selectByExample(example); - if (msCaseFlows != null && msCaseFlows.size() > 0) { - sort = msCaseFlows.get(0).getSort() + 1; - } - //新增案件流程信息 - MsCaseFlow msCaseFlow = new MsCaseFlow(); - BeanUtils.copyProperties(caseFlowVO, msCaseFlow); - msCaseFlow.setSort(sort); - int insert = msCaseFlowMapper.insert(msCaseFlow); - if (insert > 0) { - //更新流程节点和角色之间的关系 - updateFlowRoleByFlowId(msCaseFlow.getId(), caseFlowVO.getRoleIds()); - return true; + try { + if (caseFlowVO.getId() != null) { + //更新案件流程信息 + MsCaseFlow msCaseFlow = new MsCaseFlow(); + BeanUtils.copyProperties(caseFlowVO, msCaseFlow); + int i = msCaseFlowMapper.updateByPrimaryKey(msCaseFlow); + if (i > 0) { + //更新流程节点和角色之间的关系 + updateFlowRoleByFlowId(msCaseFlow.getId(), caseFlowVO.getRoleIds()); + //更新流程节点和短信模板之间的关系 + updateFlowMessageRoleByFlowId(msCaseFlow.getId(), caseFlowVO.getReceiveRoleIds(), caseFlowVO.getSmsTemplateId()); + return true; + } else { + return false; + } + } else { + int sort = 1; + Example example = new Example(MsCaseFlow.class); + example.setOrderByClause("sort DESC limit 1"); + Example.Criteria criteria = example.createCriteria(); + List msCaseFlows = msCaseFlowMapper.selectByExample(example); + if (msCaseFlows != null && msCaseFlows.size() > 0) { + sort = msCaseFlows.get(0).getSort() + 1; + } + //新增案件流程信息 + MsCaseFlow msCaseFlow = new MsCaseFlow(); + BeanUtils.copyProperties(caseFlowVO, msCaseFlow); + msCaseFlow.setSort(sort); + int insert = msCaseFlowMapper.insert(msCaseFlow); + if (insert > 0) { + //更新流程节点和角色之间的关系 + updateFlowRoleByFlowId(msCaseFlow.getId(), caseFlowVO.getRoleIds()); + //更新流程节点和短信模板之间的关系 + updateFlowMessageRoleByFlowId(msCaseFlow.getId(), caseFlowVO.getReceiveRoleIds(), caseFlowVO.getSmsTemplateId()); + return true; + } } + } catch (Exception e) { + e.printStackTrace(); } return false; } + @Autowired + MsCaseFlowRoleSmsRelatedMapper msCaseFlowRoleSmsRelatedMapper; + + /** + * 更新流程节点和短信模板之间的关系 + * + * @param flowId + * @param receiveRoleIds + * @param smsTemplateId + */ + private void updateFlowMessageRoleByFlowId(Integer flowId, List receiveRoleIds, Long smsTemplateId) { + if (receiveRoleIds != null && receiveRoleIds.size() > 0) { + //删除历史流程与短信发送设置记录 + Example example = new Example(MsCaseFlowRoleSmsRelated.class); + example.createCriteria().andEqualTo("flowId", flowId); + int count = msCaseFlowRoleSmsRelatedMapper.deleteByExample(example); + //新增流程节点与短信发送设置记录 + for (int i = 0; i < receiveRoleIds.size(); i++) { + MsCaseFlowRoleSmsRelated msCaseFlowRoleSmsRelated = new MsCaseFlowRoleSmsRelated(); + msCaseFlowRoleSmsRelated.setFlowId(flowId); + msCaseFlowRoleSmsRelated.setReceiveRoleId(receiveRoleIds.get(i)); + msCaseFlowRoleSmsRelated.setSmsTemplateId(smsTemplateId); + msCaseFlowRoleSmsRelated.setCreateTime(new Date()); + msCaseFlowRoleSmsRelatedMapper.insertSelective(msCaseFlowRoleSmsRelated); + } + } + + } + /** * 更新流程节点和角色之间的关系 * @@ -258,7 +326,6 @@ public class CaseFlowServiceImpl implements CaseFlowService { } - /** * 排序案件流程节点 * @@ -352,6 +419,44 @@ public class CaseFlowServiceImpl implements CaseFlowService { return caseStatusIds; } + /** + * 查询流程节点接收信息配置记录 + * + * @param flowId + */ + @Override + public MsCaseFlowRoleSmsRelatedVO queryFlowReceiveRoleSmsRelated(Integer flowId) { + MsCaseFlowRoleSmsRelatedVO result = new MsCaseFlowRoleSmsRelatedVO(); + //短信接收角色 + if (flowId != null) { + Example example1 = new Example(MsCaseFlowRoleSmsRelated.class); + Example.Criteria criteria1 = example1.createCriteria(); + criteria1.andEqualTo("flowId", flowId); + List msCaseFlowRoleSmsRelateds = msCaseFlowRoleSmsRelatedMapper.selectByExample(example1); + List receiveRoleNames = new ArrayList<>(); + List receiveRoleIds = new ArrayList<>(); + for (int k = 0; k < msCaseFlowRoleSmsRelateds.size(); k++) { + MsCaseFlowRoleSmsRelated msCaseFlowRoleSmsRelated = msCaseFlowRoleSmsRelateds.get(k); + if (k == 0) { + BeanUtils.copyProperties(msCaseFlowRoleSmsRelated, result); + } + if (msCaseFlowRoleSmsRelated.getReceiveRoleId() != null) { + SysRole sysRole = sysRoleMapper.selectRoleById(msCaseFlowRoleSmsRelated.getReceiveRoleId()); + if (sysRole != null) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("roleId", sysRole.getRoleId()); + jsonObject.put("roleName", sysRole.getRoleName()); + receiveRoleNames.add(jsonObject); + receiveRoleIds.add(sysRole.getRoleId()); + } + } + } + result.setReceiveRoleIds(receiveRoleIds); + result.setReceiveRoleNames(receiveRoleNames); + } + return result; + } + /** * 查询角色的案件状态id * diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.xml new file mode 100644 index 0000000..d365a87 --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/flow/MsCaseFlowRoleSmsRelatedMapper.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file -- 2.54.0 From 75da02d7950fe9b3860f76523320ba7edbba4430 Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Wed, 17 Apr 2024 15:24:38 +0800 Subject: [PATCH 13/30] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=E8=AE=B0=E5=BD=95=E7=BC=96=E8=BE=91=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E9=82=AE=E4=BB=B6=E8=AE=B0=E5=BD=95=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=8F=91=E9=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/SendMailRecordController.java | 30 +++-- .../shortmessage/MsSendMailHistoryRecord.java | 107 ++++++++++++++++++ .../MsSendMailHistoryRecordMapper.java | 7 ++ .../domain/dto/sendrecord/SendMailRecord.java | 12 +- .../sendrecord/SendMailRecordMapper.java | 28 ++++- .../sendrecord/ISendMailRecordService.java | 23 +++- .../impl/SendMailRecordServiceImpl.java | 79 +++++++++++++ .../MsSendMailHistoryRecordMapper.xml | 25 ++++ .../sendrecord/SendMailRecordMapper.xml | 53 +++++---- .../sendrecord/SmsRecordMapper.xml | 80 +++++++------ 10 files changed, 376 insertions(+), 68 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSendMailHistoryRecord.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.java create mode 100644 ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/SendMailRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/SendMailRecordController.java index 3d7e397..ab3edd8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/SendMailRecordController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/SendMailRecordController.java @@ -1,19 +1,18 @@ package com.ruoyi.web.controller.wisdomarbitrate.sendrecord; import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord; import com.ruoyi.wisdomarbitrate.service.sendrecord.ISendMailRecordService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/sendMailRecord") -public class SendMailRecordController extends BaseController { +public class SendMailRecordController extends BaseController { @Autowired private ISendMailRecordService sendMailRecordService; @@ -21,13 +20,30 @@ public class SendMailRecordController extends BaseController { * 查询发送邮件记录列表 */ @GetMapping("/list") - public TableDataInfo list(SendMailRecord sendMailRecord) - { + public TableDataInfo list(SendMailRecord sendMailRecord) { startPage(); List list = sendMailRecordService.selectSendMailRecordList(sendMailRecord); return getDataTable(list); } + /** + * 编辑邮件记录 + */ + @PostMapping("/update") + public AjaxResult update(@RequestBody SendMailRecord sendMailRecord) { + return sendMailRecordService.updateSendMailRecord(sendMailRecord); + } - + /** + * 重新发送邮件记录 + */ + @PostMapping("/reSendMailRecord") + public AjaxResult reSendMailRecord(@RequestBody SendMailRecord sendMailRecord) { + Boolean aBoolean = sendMailRecordService.reSendMailRecord(sendMailRecord); + if (aBoolean) { + return AjaxResult.success("发送成功"); + } else { + return AjaxResult.error("发送失败"); + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSendMailHistoryRecord.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSendMailHistoryRecord.java new file mode 100644 index 0000000..f951ee5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/entity/shortmessage/MsSendMailHistoryRecord.java @@ -0,0 +1,107 @@ +package com.ruoyi.system.domain.entity.shortmessage; + +import java.util.Date; +import javax.persistence.*; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@Table(name = "ms_send_mail_history_record") +public class MsSendMailHistoryRecord { + @Id + @GeneratedValue(generator = "JDBC") + private Long id; + + /** + * 邮件名称 + */ + @Column(name = "mail_name") + private String mailName; + + /** + * 邮件接收地址 + */ + @Column(name = "mail_address") + private String mailAddress; + + /** + * 发送时间 + */ + @Column(name = "send_time") + private Date sendTime; + + /** + * 案件编号 + */ + @Column(name = "case_num") + private String caseNum; + + /** + * 发送状态 + */ + @Column(name = "send_status") + private Long sendStatus; + + /** + * 立案申请id + */ + @Column(name = "case_id") + private Long caseId; + + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; + + /** + * 创建者 + */ + @Column(name = "create_by") + private String createBy; + + /** + * 更新者 + */ + @Column(name = "update_by") + private String updateBy; + + /** + * 更新时间 + */ + @Column(name = "update_time") + private Date updateTime; + + /** + * 附件id用英文逗号隔开 + */ + @Column(name = "file_ids") + private String fileIds; + + /** + * 邮件主题 + */ + @Column(name = "mail_subject") + private String mailSubject; + + /** + * 邮件发送地址 + */ + @Column(name = "mail_from_address") + private String mailFromAddress; + + /** + * 邮件父类id + */ + @Column(name = "parent_id") + private Long parentId; + + /** + * 邮件内容 + */ + @Column(name = "mail_content") + private String mailContent; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.java new file mode 100644 index 0000000..5b62272 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.mapper.shortmessage; + +import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord; +import tk.mybatis.mapper.common.Mapper; + +public interface MsSendMailHistoryRecordMapper extends Mapper { +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SendMailRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SendMailRecord.java index 5c7e08c..3b3c9aa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SendMailRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SendMailRecord.java @@ -3,9 +3,10 @@ package com.ruoyi.wisdomarbitrate.domain.dto.sendrecord; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; import java.util.Date; - +@Data public class SendMailRecord extends BaseEntity { private static final long serialVersionUID = 1L; @@ -40,6 +41,15 @@ public class SendMailRecord extends BaseEntity { private Integer sendStatus; + /** 附件id */ + private String fileIds; + + /** 邮件主题 */ + private String mailSubject; + + /** 邮件发件人地址 */ + private String mailFromAddress; + public Integer getSendStatus() { return sendStatus; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SendMailRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SendMailRecordMapper.java index 57fd469..379a771 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SendMailRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SendMailRecordMapper.java @@ -5,10 +5,32 @@ import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord; import java.util.List; public interface SendMailRecordMapper { + /** + * 新增发送邮件记录 + * + * @param sendMailRecord 发送邮件记录 + * @return 结果 + */ + int saveSendMailRecord(SendMailRecord sendMailRecord); - +/** + * 查询发送邮件记录 + * + * @param sendMailRecord 发送邮件记录 + * @return 结果 + */ List selectSendMailRecord(SendMailRecord sendMailRecord); +/** + * 修改发送邮件记录 + * + * @param sendMailRecord 发送邮件记录 + * @return 结果 + */ + int updateSendMailRecord(SendMailRecord sendMailRecord); - - + /** + * 根据id查询发送邮件记录 + * @param id + */ + SendMailRecord querySendMailRecordById(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ISendMailRecordService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ISendMailRecordService.java index 063dddc..f5a237e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ISendMailRecordService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/ISendMailRecordService.java @@ -1,15 +1,32 @@ package com.ruoyi.wisdomarbitrate.service.sendrecord; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord; import java.util.List; public interface ISendMailRecordService { - + /** + * 查询邮件发送记录 + * + * @param sendMailRecord + * @return + */ List selectSendMailRecordList(SendMailRecord sendMailRecord); + /** + * 编辑邮件记录 + * + * @param sendMailRecord + */ + AjaxResult updateSendMailRecord(SendMailRecord sendMailRecord); - - + /** + * 重新发送邮件 + * + * @param sendMailRecord + * @return + */ + Boolean reSendMailRecord(SendMailRecord sendMailRecord); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java index 76207f3..78ec7cb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java @@ -1,11 +1,19 @@ package com.ruoyi.wisdomarbitrate.service.sendrecord.impl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.EmailOutUtil; +import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord; +import com.ruoyi.system.mapper.shortmessage.MsSendMailHistoryRecordMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper; import com.ruoyi.wisdomarbitrate.service.sendrecord.ISendMailRecordService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.io.File; import java.util.List; @Service @@ -20,6 +28,77 @@ public class SendMailRecordServiceImpl implements ISendMailRecordService { return records; } + @Autowired + MsSendMailHistoryRecordMapper msSendMailHistoryRecordMapper; + /** + * 编辑邮件记录 + * + * @param sendMailRecord + */ + @Override + public AjaxResult updateSendMailRecord(SendMailRecord sendMailRecord) { + try { + if (sendMailRecord != null && sendMailRecord.getId() != null) { + SendMailRecord old = sendMailRecordMapper.querySendMailRecordById(sendMailRecord.getId()); + MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord(); + BeanUtils.copyProperties(old, msSendMailHistoryRecord); + msSendMailHistoryRecord.setParentId(old.getId()); + msSendMailHistoryRecord.setId(null); + msSendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); + sendMailRecordMapper.updateSendMailRecord(sendMailRecord); + return AjaxResult.success("编辑成功"); + } else { + return AjaxResult.error("编辑失败"); + } + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error("编辑失败"); + } + } + @Autowired + private EmailOutUtil emailOutUtil; + @Autowired + MsCaseAttachMapper msCaseAttachMapper; + + /** + * 重新发送邮件 + * + * @param sendMailRecord + * @return + */ + @Override + public Boolean reSendMailRecord(SendMailRecord sendMailRecord) { + List fileList = null; + if (sendMailRecord.getFileIds() != null && sendMailRecord.getFileIds() != "") { + String[] fileIds = sendMailRecord.getFileIds().split(","); + for (int i = 0; i < fileIds.length; i++) { + String fileId = fileIds[i]; + try { + Long id = Long.parseLong(fileId); + MsCaseAttach msCaseAttach = msCaseAttachMapper.queryAnnexById(id); + String annexPath = msCaseAttach.getAnnexPath(); + if (annexPath != null && annexPath != "") { + String prefix = "/profile"; + int startIndex = prefix.length(); + String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex + 1); + File file = new File(path); + fileList.add(file); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + Boolean flag = emailOutUtil.sendEmil(sendMailRecord.getMailAddress(), sendMailRecord.getMailContent(), sendMailRecord.getMailSubject(), fileList, null); + //发送成功后更细邮件记录的发送时间和发送状态 + if (flag) { + sendMailRecord.setSendStatus(1); + sendMailRecord.setSendTime(new java.util.Date()); + sendMailRecord.setUpdateTime(new java.util.Date()); + sendMailRecordMapper.updateSendMailRecord(sendMailRecord); + } + return flag; + } } diff --git a/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.xml b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.xml new file mode 100644 index 0000000..f6d79c1 --- /dev/null +++ b/ruoyi-system/src/main/resources/com/ruoyi/system/mapper/shortmessage/MsSendMailHistoryRecordMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml index 0b38049..418f62e 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml @@ -5,22 +5,26 @@ - - - - - - - - + + + + + + + + + + + - SELECT s.id ,s.mail_name ,s.mail_content ,s.mail_address ,s.send_time ,s.case_id ,s.create_time ,s.create_by , - s.update_by ,s.update_time , s.send_status ,c.case_num + s.update_by ,s.update_time , s.send_status ,s.file_ids ,s.mail_subject ,s.mail_from_address ,c.case_num from ms_send_mail_record s left join ms_case_application c - on s.case_id = c.id + on s.case_id = c.id AND c.case_num = #{caseNum} @@ -38,6 +42,9 @@ case_id, send_status, create_by, + file_ids, + mail_subject, + mail_from_address, create_time )values( #{mailName}, @@ -47,15 +54,23 @@ #{caseId}, #{sendStatus}, #{createBy}, + #{fileIds}, + #{mailSubject}, + #{mailFromAddress}, sysdate() ) - - - - - - - - + + update ms_send_mail_record + set mail_content= #{mailContent}, + update_time=#{updateTime}, + send_time=#{sendTime}, + send_status=#{sendStatus} + where id = #{id} + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml index e823cdd..a7a3c0e 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml @@ -5,20 +5,21 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + insert into ms_sms_send_record( case_appli_id, @@ -47,31 +48,32 @@ insert into ms_sms_send_record( - case_appli_id, - case_num, - phone, - send_time, - send_content, - create_by, - send_status, + case_appli_id, + case_num, + phone, + send_time, + send_content, + create_by, + send_status, create_time, sid,reason )values - ( - #{item.caseId}, - #{item.caseNum}, - #{item.phone}, - #{item.sendTime}, - #{item.sendContent}, - #{item.createBy}, - #{item.sendStatus}, - sysdate(),#{sid},#{reason} - ) + ( + #{item.caseId}, + #{item.caseNum}, + #{item.phone}, + #{item.sendTime}, + #{item.sendContent}, + #{item.createBy}, + #{item.sendStatus}, + sysdate(),#{sid},#{reason} + ) - select * from ms_sms_send_record @@ -84,20 +86,28 @@ update ms_sms_send_record - set send_status= #{sendStatus} ,reason=#{reason} where sid=#{sid} + set send_status= #{sendStatus}, + reason=#{reason} + where sid = #{sid} update ms_sms_send_record - set send_content= #{sendContent} ,update_time=#{updateTime} where id=#{id} + set send_content= #{sendContent}, + update_time=#{updateTime} + where id = #{id} -- 2.54.0 From f94be91bb39f41863f7ef61a42c24480d1c9e7f9 Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Wed, 17 Apr 2024 17:44:40 +0800 Subject: [PATCH 14/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=E8=AE=B0=E5=BD=95=E7=BC=96=E8=BE=91=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/impl/SendMailRecordServiceImpl.java | 2 ++ .../wisdomarbitrate/sendrecord/SendMailRecordMapper.xml | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java index 78ec7cb..03f3ea4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/sendrecord/impl/SendMailRecordServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; +import java.util.Date; import java.util.List; @Service @@ -46,6 +47,7 @@ public class SendMailRecordServiceImpl implements ISendMailRecordService { msSendMailHistoryRecord.setParentId(old.getId()); msSendMailHistoryRecord.setId(null); msSendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); + sendMailRecord.setUpdateTime(new Date()); sendMailRecordMapper.updateSendMailRecord(sendMailRecord); return AjaxResult.success("编辑成功"); } else { diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml index 418f62e..db15513 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SendMailRecordMapper.xml @@ -62,10 +62,11 @@ update ms_send_mail_record - set mail_content= #{mailContent}, - update_time=#{updateTime}, - send_time=#{sendTime}, - send_status=#{sendStatus} + set + mail_content= #{mailContent} + ,update_time=#{updateTime} + ,send_time=#{sendTime} + ,send_status=#{sendStatus} where id = #{id} select t.* from( SELECT - c.id,c.organize_flag organizeFlag,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus, + c.id,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus, c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime, c.mediation_method mediationMethod, @@ -120,7 +120,7 @@ c.id union SELECT - c.id,c.organize_flag organizeFlag,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus, + c.id,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus, c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum, u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime, c.mediation_method mediationMethod, @@ -159,4 +159,28 @@ ) t ORDER BY t.createTime desc,t.caseNum desc + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml index a7a3c0e..ec7c6c7 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/sendrecord/SmsRecordMapper.xml @@ -5,28 +5,27 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + insert into ms_sms_send_record( case_appli_id, case_num, phone, send_time, - send_content, + ms_sms_template_id, create_by, send_status, sid, @@ -37,7 +36,7 @@ #{caseNum}, #{phone}, #{sendTime}, - #{sendContent}, + #{msSmsTemplateId}, #{createBy}, #{sendStatus}, #{sid}, @@ -48,27 +47,27 @@ insert into ms_sms_send_record( - case_appli_id, - case_num, - phone, - send_time, - send_content, - create_by, - send_status, + case_appli_id, + case_num, + phone, + send_time, + ms_sms_template_id, + create_by, + send_status, create_time, sid,reason )values - ( - #{item.caseId}, - #{item.caseNum}, - #{item.phone}, - #{item.sendTime}, - #{item.sendContent}, - #{item.createBy}, - #{item.sendStatus}, - sysdate(),#{sid},#{reason} - ) + ( + #{item.caseId}, + #{item.caseNum}, + #{item.phone}, + #{item.sendTime}, + #{item.msSmsTemplateId}, + #{item.createBy}, + #{item.sendStatus}, + sysdate(),#{sid},#{reason} + ) @@ -97,10 +96,20 @@ reason=#{reason} where sid = #{sid} - + update ms_sms_send_record - set send_content= #{sendContent}, - update_time=#{updateTime} + + case_appli_id = #{caseId}, + case_num = #{caseNum}, + phone = #{phone}, + + send_time = #{sendTime}, + ms_sms_template_id = #{msSmsTemplateId}, + + send_status = #{sendStatus}, + sid = #{sid}, + reason = #{reason} + where id = #{id} -- 2.54.0 From 58a5f083fe571245eef14f98422a0cbffeb5ee6a Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Thu, 18 Apr 2024 09:36:21 +0800 Subject: [PATCH 16/30] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/MsCaseApplicationService.java | 10 +- .../impl/MsCaseApplicationServiceImpl.java | 238 +----------------- 2 files changed, 6 insertions(+), 242 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index 051e931..e20ac23 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -103,18 +103,13 @@ public interface MsCaseApplicationService { */ AjaxResult userIdentify(MultipartFile file); + /** * 生成调解申请书 * @param req * @return */ AjaxResult generateApplication(MsCaseApplicationReq req); - /** - * 生成调解申请书 - * @param req - * @return - */ - AjaxResult generateApplication1(MsCaseApplicationReq req); /** * 根据批次号和流程id查找未锁定的案件 @@ -232,8 +227,7 @@ public interface MsCaseApplicationService { * @param bookmarkList 标签 * @param dictDataList 内置字段 */ - void createMediateApplication(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; - void createMediateApplication1(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; + void createMediateApplication(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList, Integer templateType) ; /** * 调解书上传到onlyoffice服务器 * @param annexPath diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index ff0647b..391c22d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -683,7 +683,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 生成调解申请书 req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); req.setTemplateId(String.valueOf(caseApplication.getTemplateId())); - caseApplicationService.generateApplication1(req); + caseApplicationService.generateApplication(req); // 保存案件附件 if (CollectionUtil.isNotEmpty(caseAttachList)) { for (MsCaseAttach caseAttach : caseAttachList) { @@ -1057,7 +1057,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 自然人 req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()); req.setTemplateId(String.valueOf(selectByPrimaryKey.getTemplateId())); - caseApplicationService.generateApplication1(req); + caseApplicationService.generateApplication(req); // 新增日志 CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "修改案件",null); @@ -1443,85 +1443,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); // if(affiliate==null){ // continue; -// } - // caseApplicationService.createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType()); - - } - }else { - // 单独生成调解申请书 - // 根据案件id查询案件信息 - MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); - // 查询案件关联人员 - List msCaseAffiliates = selectAffliatesByCaseId(req.getId()); - if (application == null || msCaseAffiliates == null) { - throw new ServiceException("该案件不存在"); - } - - caseApplicationService.createMediateApplication(application, msCaseAffiliates, templatePath, bookmarkList,dictDataList,req.getTemplateType()); - } - - - return AjaxResult.success(); - } - /** - * 生成调解申请书 - * @param req - * @return - */ - @Transactional - @Override - public AjaxResult generateApplication1(MsCaseApplicationReq req) { - // 根据模板id查询申请书 - if(req.getTemplateId()==null || req.getTemplateType()==null){ - return AjaxResult.error("模板id不能为空"); - } - TemplateManage templateManage=templateManageMapper.selectByIdAndType(Long.valueOf(req.getTemplateId()),req.getTemplateType()); - if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){ - throw new ServiceException("未找到模板"); - } - String templatePath = "/home/ruoyi" + templateManage.getTemOrigPath(); - templatePath=templatePath.replace("/profile","/uploadPath"); - try { - File file = new File(templatePath); - } catch (Exception e) { - throw new ServiceException("未找到模板"); - } -// // 获取模板中的占位符key - List bookmarkList = getBookmarkByDocx(templatePath); - if (CollectionUtil.isEmpty(bookmarkList)) { - throw new ServiceException("请检查模板是否配置正确,未获取到占位符"); - } - // 在系统表中查询案件内置字段 - SysDictData sysDictData = new SysDictData(); - sysDictData.setDictType("case_built_type"); - List dictDataList = dictDataMapper.selectDictDataList(sysDictData); - if(CollectionUtil.isEmpty(dictDataList)){ - throw new ServiceException("未找到系统内置字段"); - } - // 如果批号不为空,则为批量操作,根据批号查询未锁定的案件 - if(StrUtil.isNotEmpty(req.getBatchNumber())){ - List caseApplicationList=listByBatchNumber(req.getBatchNumber(),req.getCaseFlowId()); - if(CollectionUtil.isEmpty(caseApplicationList)){ - throw new ServiceException("该批次号下未找到案件"); - } - // 案件ids - List caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()); - // 根据ids查询案件关联人员 - Example afflicateExample = new Example(MsCaseAffiliate.class); - afflicateExample.createCriteria().andIn("caseAppliId", caseIds); - List affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample); - if(CollectionUtil.isEmpty(affiliateList)){ - throw new ServiceException("该批次号下未找到案件关联人员"); - } - - Map affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity())); - - // 循环生成调解申请书 - for (MsCaseApplication application : caseApplicationList) { - // todo 批量的未改案件相关人员,结构已发生变化 -// MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); -// if(affiliate==null){ -// continue; // } // caseApplicationService.createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType()); @@ -1536,7 +1457,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { throw new ServiceException("该案件不存在"); } - caseApplicationService.createMediateApplication1(application, msCaseAffiliates, templatePath, bookmarkList,dictDataList,req.getTemplateType()); + caseApplicationService.createMediateApplication(application, msCaseAffiliates, templatePath, bookmarkList,dictDataList,req.getTemplateType()); } @@ -3175,7 +3096,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { req.setTemplateType(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()); } - AjaxResult result = caseApplicationService.generateApplication1(req); + AjaxResult result = caseApplicationService.generateApplication(req); // 修改案件结果 application.setMediaResult(req.getMediaResult()); msCaseApplicationMapper.updateByPrimaryKeySelective(application); @@ -3231,159 +3152,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return nextFlow; } - /** - * 生成调解申请书 - * @param application 案件基本信息 - * @param affiliates 案件相关人员 - * @param templatePath 模板路径 - * @param bookmarkList 标签 - * @param dictDataList 内置字段 - */ @Transactional public void createMediateApplication(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList,Integer templateType) { - // 申请书需要的字段和内容,valueMap<占位符,替换的值> - Map valueMap = new HashMap<>(); - // 操作人信息 - Map> operatorMap = affiliates.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getOperatorFlag, Collectors.toList())); - // 按角色分类 - Map roleTypeMap = affiliates.stream().collect(Collectors.toMap(MsCaseAffiliate::getRoleType, Function.identity(), (k1, k2) -> k1)); -// Map> roleTypeMap = affiliates.stream().collect(Collectors.groupingBy(MsCaseAffiliate::getRoleType, Collectors.toList())); - - for (SysDictData dictData : dictDataList) { - if (CASE_BASE_COLUMN.contains(dictData.getDictValue())) { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(application, dictData.getDictValue())); - } else { - // todo 相关人员字段,如果有多个申请人,被申请人,模板需要变化,待讨论,暂做成取第一个操作人 - List msCaseAffiliates = operatorMap.get(1); - if(CollectionUtil.isNotEmpty(msCaseAffiliates)) { - Map roleTypeOperatorMap = msCaseAffiliates.stream().collect(Collectors.toMap(MsCaseAffiliate::getRoleType, Function.identity(), (k1, k2) -> k1)); - if(dictData.getDictLabel().contains("被申请人")){ - if(roleTypeOperatorMap.get(3)!=null ) { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(3), dictData.getDictValue())); - }else { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(3), dictData.getDictValue())); - } - }else if(dictData.getDictLabel().contains("被申请人委托代理人")){ - if(roleTypeOperatorMap.get(4)!=null ) { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(4), dictData.getDictValue())); - }else { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(4), dictData.getDictValue())); - } - }else if(dictData.getDictLabel().contains("申请人") - || dictData.getDictLabel().equals("统一社会信用代码") - || dictData.getDictLabel().equals("法定代表人") - ){ - if(roleTypeOperatorMap.get(1)!=null ) { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(1), dictData.getDictValue())); - }else { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(1), dictData.getDictValue())); - } - }else if(dictData.getDictLabel().contains("委托代理人")){ - if(roleTypeOperatorMap.get(2)!=null ) { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeOperatorMap.get(2), dictData.getDictValue())); - }else { - valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(roleTypeMap.get(2), dictData.getDictValue())); - } - } - } - } - - } - // 书签对应值 - Map bookmarkValueMap = new HashMap<>(); - // 读取调节申请书,找到占位符,替换值 - // 遍历书签,给书签赋值 - replaceBookmark(bookmarkList, bookmarkValueMap, valueMap); - // 申请书生成时间 - LocalDate now = LocalDate.now(); - int year = now.getYear(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); - // 格式化当前日期 - String formattedDate = now.format(formatter); - bookmarkValueMap.put("日期", formattedDate); - - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day; - Integer annexType = null; - if(templateType==null - || templateType.equals(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()) - || templateType.equals(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()) ){ - // 调解申请书 - annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode(); - }else if(templateType.equals(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()) - || templateType.equals(TemplateTypeEnum.MEDIATE_BOOK.getCode()) ){ - // 调解书和解协议 - annexType = AnnexTypeEnum.MEDIATE_BOOK.getCode(); - } - - String orgFileName = "调解申请书"; - if (annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())) { - orgFileName = "调解书"; - } - String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx"; - String resultFilePath = saveFolderPath + "/" + fileName; - // 将word中的标签替换掉,生成新的word - wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath); - - MsCaseAttach caseAttach = null; - String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX); - // 如果是调解书或者调解协议上传到onlyoffice服务器 - if(annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){ - JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath,application.getId()); - if(jsonArray!=null && jsonArray.size() > 0){ - for (Object obj : jsonArray) { - JSONObject jsonObject = (JSONObject) obj; - caseAttach= MsCaseAttach.builder() - .caseAppliId(application.getId()) - .annexName(jsonObject.getString("fileName")) - .annexPath(jsonObject.getString("filePath")) - .annexType(annexType) - .onlyOfficeFileId(jsonObject.getString("fileId")) - .build(); - - } - //保存到附件表里,先删除之前的在保存 - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); - msCaseAttachMapper.save(caseAttach); - } - - }else { - caseAttach = MsCaseAttach.builder() - .caseAppliId(application.getId()) - .annexName(orgFileName+".docx") - .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX)) - .annexType(annexType) - .build(); - // 查找已经存在的附件 - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(application.getId(), annexType); - if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); - if(StrUtil.isEmpty(application.getCaseSource())) { - // 北明推送 - String path = "/home/ruoyi" + caseAttach.getAnnexPath(); - File file = new File(path.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); - - // 更新附件表 - if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - } - } - msCaseAttachMapper.save(caseAttach); - } - - } - @Transactional - public void createMediateApplication1(MsCaseApplication application, List affiliates, String templatePath, List bookmarkList, List dictDataList,Integer templateType) { // 申请书需要的字段和内容,valueMap<占位符,替换的值> Map valueMap = new HashMap<>(); for (SysDictData dictData : dictDataList) { -- 2.54.0 From 7c3044811ebbb254151d897e9ec6eee1c66a3ed6 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Thu, 18 Apr 2024 11:18:13 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=87=8D=E5=8F=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/impl/MsCaseApplicationServiceImpl.java | 11 ++++++----- .../service/mscase/impl/MsSignSealServiceImpl.java | 6 ++---- .../shortmessage/impl/ShortMessageServiceImpl.java | 11 +++++++++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 391c22d..b465408 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -2419,6 +2419,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Transactional(rollbackFor = Exception.class) @Override public AjaxResult mediation(MsCaseApplicationReq req) throws EsignDemoException, InterruptedException { + req.setSealFlag(null); // 查询案件是否存在 MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId()); if (application == null) { @@ -2709,7 +2710,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (caseFlow != null) { application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); - msCaseApplicationMapper.updateByPrimaryKey(application); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); } @@ -2748,7 +2749,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); } return AjaxResult.success(); } else if (mediaResult == 3) { @@ -2760,7 +2761,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); // 新增结束日志 @@ -2802,7 +2803,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); } return AjaxResult.success(); @@ -3051,7 +3052,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setCaseFlowId(caseFlow.getId()); application.setCaseStatusName(caseFlow.getCaseStatusName()); application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 68e55aa..261a5ae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -522,7 +522,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { return AjaxResult.error("未找到案件被申请操作人"); } MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId); - Integer organizeFlag = caseApplication.getOrganizeFlag(); + Long userId = SecurityUtils.getUserId(); if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){ @@ -533,7 +533,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { List sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord); if (sealSignRecords != null && sealSignRecords.size() > 0) { String signFlowid = sealSignRecords.get(0).getSignFlowId(); - if(organizeFlag!=null){ SealSignRecord sealSignRecord = new SealSignRecord(); sealSignRecord.setPensonAccount(appOpt.get().getPhone()); sealSignRecord.setPensonName(appOpt.get().getName()); @@ -549,7 +548,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { String urlapply = signUrlData.get("shortUrl").getAsString(); sealSignRecordres.setSealUrl(urlapply); } - } return AjaxResult.success(sealSignRecordres); }else { return AjaxResult.error(); @@ -674,7 +672,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { signStatusMediator!=null&&signStatusMediator.equals(1)){ // 根据流程id查找下一个流程节点 MsCaseFlow nextFlow=null; - if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag().equals(1)) { // 需要用印 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); }else { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java index b1414b8..d95eb72 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java @@ -121,11 +121,18 @@ public class ShortMessageServiceImpl implements ShortMessageService { List recordParamList = recordParamContentMap.get(record.getId()); if(recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())){ List templateParamList = templateParamMap.get(record.getMsSmsTemplateId()); + ArrayList copyParamList = new ArrayList<>(); for (int i = 0; i < templateParamList.size(); i++) { MsSmsTemplateParam templateParam = templateParamList.get(i); - templateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i)); + MsSmsTemplateParam msSmsTemplateParam =new MsSmsTemplateParam(); + msSmsTemplateParam.setParam(templateParam.getParam()); + msSmsTemplateParam.setSmsTemplateId(templateParam.getSmsTemplateId()); + msSmsTemplateParam.setParamName(templateParam.getParamName()); + msSmsTemplateParam.setId(templateParam.getId()); + msSmsTemplateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i)); + copyParamList.add(msSmsTemplateParam); } - record.setTemplateParams(templateParamList); + record.setTemplateParams(copyParamList); } // 按顺序替换占位符 -- 2.54.0 From f76a2e985005c29849e46232bb77f0af29f47b01 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Thu, 18 Apr 2024 13:56:30 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8F=91=E9=80=81?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MsCaseApplicationServiceImpl.java | 126 ++++++++++-------- .../mscase/impl/MsCasePaymentServiceImpl.java | 11 +- 2 files changed, 79 insertions(+), 58 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index b465408..f86a633 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -74,6 +74,8 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; import java.util.function.Function; import java.util.stream.Collectors; @@ -1609,20 +1611,23 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setUpdateBy(SecurityUtils.getUsername()); application.setUpdateTime(new Date()); application.setBatchNumber(null); - // 给被申请人发送短信 - if (affiliateMap.containsKey(application.getId())) { - List affiliates = affiliateMap.get(application.getId()); - // 被申受理分配通知 - SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知", - "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。", - "2074247", - new String[]{application.getCaseNum()} - ); - SMSNotice notice = new SMSNotice(null,resNotice); - caseApplicationService.sendNotice(application,affiliates,false,notice); - } + msCaseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus()); + ExecutorService executor = ThreadUtil.createThreadPool(); + CompletableFuture.runAsync(() -> { + // 给被申请人发送短信 + if (affiliateMap.containsKey(application.getId())) { + List affiliates = affiliateMap.get(application.getId()); + // 被申受理分配通知 + SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知", + "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。", + "2074247", + new String[]{application.getCaseNum()} + ); + SMSNotice notice = new SMSNotice(null,resNotice); + caseApplicationService.sendNotice(application,affiliates,false,notice); + }}, executor); } /** @@ -1639,6 +1644,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if(selectApplication==null){ return; } + ExecutorService executor = ThreadUtil.createThreadPool(); + CompletableFuture.runAsync(() -> { List appPhones=new ArrayList<>(); List resPhones=new ArrayList<>(); List appEmails=new ArrayList<>(); @@ -1682,7 +1689,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } } } - } + }}, executor); } /** @@ -2125,54 +2132,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 根据案件id查询案件 MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); - // 发送开庭短信 - if(CollectionUtil.isNotEmpty(vo.getHerDates())) { - List affiliates = selectAffliatesByCaseId(application.getId()); - caseApplication.setHearDate(application.getHearDate()); - // 申请人发送开庭日期短信 - sendHearDateSms(caseApplication, affiliates); + long l = System.currentTimeMillis(); + ExecutorService executor = ThreadUtil.createThreadPool(); + CompletableFuture.runAsync(() -> { + // 发送开庭短信 + if (CollectionUtil.isNotEmpty(vo.getHerDates())) { + List affiliates = selectAffliatesByCaseId(application.getId()); + caseApplication.setHearDate(application.getHearDate()); + // 申请人发送开庭日期短信 + sendHearDateSms(caseApplication, affiliates); - // 调解员发送短信,根据调解员id查询用户 - if (caseApplication.getMediatorId() != null) { - // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId()); - String content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。"; - String templateId="2077966"; - String subject="开庭日期通知"; - MsCaseAffiliate meditorAffliate = new MsCaseAffiliate(); - meditorAffliate.setPhone(sysUser.getPhonenumber()); - meditorAffliate.setEmail(sysUser.getEmail()); - String roomUuid=null; - // 线上调解 - if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){ - // 获取短信链接uuid - MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); - roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); - // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. - content="尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; - templateId = "2130103"; - } - // 电话号不为空,发送短信,否则发邮箱 - if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { - if(roomUuid==null) { - SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate()}); - }else { - SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate(),roomUuid}); } + }, executor); + // 调解员发送短信,根据调解员id查询用户 + CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) { + // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 + SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId()); + String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。"; + String templateId = "2077966"; + String subject = "开庭日期通知"; + MsCaseAffiliate meditorAffliate = new MsCaseAffiliate(); + meditorAffliate.setPhone(sysUser.getPhonenumber()); + meditorAffliate.setEmail(sysUser.getEmail()); + String roomUuid = null; + // 线上调解 + if (StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")) { + // 获取短信链接uuid + MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. - - } else { - // 发送邮件 - caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content); - - } + content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" + roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; + templateId = "2130103"; } - } - // 新增日志 + // 电话号不为空,发送短信,否则发邮箱 + if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { + if (roomUuid == null) { + SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), + new String[]{caseApplication.getCaseNum(), application.getHearDate()}); + } else { + SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), + new String[]{caseApplication.getCaseNum(), application.getHearDate(), roomUuid}); + } + + } else { + // 发送邮件 + caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content); + + } + } }, executor); + // 新增日志 CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); } @@ -2327,7 +2338,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { application.setRejectReason(reason); if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){ // todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱 - // 申请人不受理分配通知 + // 申请人不受理分配通知 // todo 短信异步 + ExecutorService executor = ThreadUtil.createThreadPool(); + CompletableFuture.runAsync(() -> { String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason(); SMSNoticeDO applicantNotice = new SMSNoticeDO("案件不受理通知", "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于" + rejectReason + "所以不予受理,请知晓,如非本人操作,请忽略本短信。", @@ -2337,6 +2350,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { SMSNotice notice = new SMSNotice(applicantNotice,null); caseApplicationService.sendNotice(application,affiliates,true,notice); + }, executor); // 修改案件状态为17,结束 MsCaseApplication caseApplication = new MsCaseApplication(); caseApplication.setId(id); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java index 4574587..73f650b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java @@ -14,6 +14,7 @@ import com.ruoyi.common.enums.PaymentStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ThreadUtil; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; @@ -41,6 +42,8 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -339,7 +342,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } casePaymentRecord.setCaseId(application.getId()); Example example = new Example(MsCasePaymentRecord.class); - example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example); + example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId()); + casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example); // 更改案件流程id和案件状态 application.setCaseFlowId(flow.getId()); application.setCaseStatusName(flow.getCaseStatusName()); @@ -379,6 +383,9 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { if(CollectionUtil.isEmpty(operatorList)){ throw new ServiceException("未找到案件操作人员"); } + // 异步发送短信 + ExecutorService executor = ThreadUtil.createThreadPool(); + CompletableFuture.runAsync(() -> { if(dto.getApplicantConfirm()) { List appPhones=new ArrayList<>(); @@ -427,7 +434,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { } } - } + }}, executor); } -- 2.54.0 From 918c1a8badbc836b4f6b497aec6eae62ae10259a Mon Sep 17 00:00:00 2001 From: wangqiong <1322446236@qq.com> Date: Thu, 18 Apr 2024 18:36:45 +0800 Subject: [PATCH 19/30] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=9A=E8=BF=87uid?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=A7=86=E9=A2=91=E4=BC=9A=E8=AE=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendrecord/ShortMessageController.java | 52 +++++++++++++---- .../framework/web/service/TokenService.java | 15 ++++- .../impl/ShortMessageServiceImpl.java | 58 ++++++++++--------- 3 files changed, 85 insertions(+), 40 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java index 0a27e25..2d95125 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/sendrecord/ShortMessageController.java @@ -4,15 +4,23 @@ import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo; import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper; import com.ruoyi.system.mapper.sms.MsSmsSendHistoryRecordParamMapper; import com.ruoyi.system.mapper.sms.MsSmsSendRecordParamMapper; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.ReSendMessageVO; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import tk.mybatis.mapper.entity.Example; @@ -32,13 +40,15 @@ public class ShortMessageController extends BaseController { MsSmsSendRecordParamMapper recordParamMapper; @Autowired MsSmsSendHistoryRecordParamMapper historyRecordParamMapper; + /** * 查询短信发送记录 + * * @param smsSendRecord * @return */ @GetMapping("/recordList") - public TableDataInfo smsSendRecordList( SmsSendRecord smsSendRecord){ + public TableDataInfo smsSendRecordList(SmsSendRecord smsSendRecord) { startPage(); List list = shortMessageService.smsSendRecordList(smsSendRecord); return getDataTable(list); @@ -47,17 +57,17 @@ public class ShortMessageController extends BaseController { @Anonymous @PostMapping("/updateSendContent") public AjaxResult update(@RequestBody SmsSendRecord smsSendRecord) { - if(smsSendRecord == null|| smsSendRecord.getId() == null || CollectionUtil.isEmpty(smsSendRecord.getTemplateParams())){ + if (smsSendRecord == null || smsSendRecord.getId() == null || CollectionUtil.isEmpty(smsSendRecord.getTemplateParams())) { return AjaxResult.error("参数校验失败"); } - // 查询当前版本记录 + // 查询当前版本记录 SmsSendRecord oldSendRecord = smsRecordMapper.selectById(smsSendRecord.getId()); smsSendRecord.setUpdateTime(new Date()); - // 更新短信内容,先删除短信记录参数表 - Example recordParamExam = new Example(MsSmsSendRecordParam.class); - recordParamExam.createCriteria().andEqualTo("smsRecordId", smsSendRecord.getId()); - recordParamMapper.deleteByExample(recordParamExam); - // 新增短信记录参数表 + // 更新短信内容,先删除短信记录参数表 + Example recordParamExam = new Example(MsSmsSendRecordParam.class); + recordParamExam.createCriteria().andEqualTo("smsRecordId", smsSendRecord.getId()); + recordParamMapper.deleteByExample(recordParamExam); + // 新增短信记录参数表 List recordParams = new ArrayList<>(); for (MsSmsTemplateParam templateParam : smsSendRecord.getTemplateParams()) { MsSmsSendRecordParam recordParam = new MsSmsSendRecordParam(); @@ -65,9 +75,9 @@ public class ShortMessageController extends BaseController { recordParam.setParamValue(templateParam.getParamValue()); recordParams.add(recordParam); } - recordParamMapper.batchInsert(recordParams); - shortMessageService.insertShortMessageHistoryRecord(oldSendRecord,recordParams); - return AjaxResult.success(); + recordParamMapper.batchInsert(recordParams); + shortMessageService.insertShortMessageHistoryRecord(oldSendRecord, recordParams); + return AjaxResult.success(); } @@ -84,14 +94,32 @@ public class ShortMessageController extends BaseController { return AjaxResult.error("参数缺失"); } + @Autowired + MeetingInfoMapper meetingInfoMapper; + @Autowired + SysUserMapper sysUserMapper; + @Autowired + private TokenService tokenService; + /** * 查询UID好的密钥 */ @Anonymous @GetMapping("/getMeetingInfo") public Object getEncryptInfoByUid(@RequestParam(name = "authId", required = true) String authId) { + MeetingInfoVO result = new MeetingInfoVO(); if (authId != null) { - Object result = shortMessageService.getMeetingInfo(authId); + MeetingInfo meetingInfo = meetingInfoMapper.selectByPrimaryKey(authId); + if (meetingInfo != null && meetingInfo.getUserId() != null) { + BeanUtils.copyProperties(meetingInfo, result); + SysUser sysUser = sysUserMapper.selectUserById(meetingInfo.getUserId()); + LoginUser loginUser = new LoginUser(); + loginUser.setUserId(sysUser.getUserId()); + loginUser.setUser(sysUser); + String token = tokenService.createVideoToken(loginUser, 120); +// String createToken = createToken(claims); + result.setToken(token); + } return result; } return AjaxResult.error("查询失败"); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java index 9bab643..2ef790d 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java @@ -127,7 +127,20 @@ public class TokenService redisCache.setCacheObject(CacheConstants.LOGIN_USERNAME_TOKEN_KEY+loginUser.getUsername(),createToken, expireTime, TimeUnit.MINUTES); return createToken; } - + public String createVideoToken(LoginUser loginUser,int expireTime) + { + String token = IdUtils.fastUUID(); + loginUser.setToken(token); + setUserAgent(loginUser); + refreshToken(loginUser); + Map claims = new HashMap<>(); + claims.put("userName",loginUser.getUsername()); + claims.put("userId",loginUser.getUserId()); + claims.put(Constants.LOGIN_USER_KEY, token); + String createToken = createToken(claims); + redisCache.setCacheObject(CacheConstants.LOGIN_USERNAME_TOKEN_KEY+loginUser.getUsername(),createToken, expireTime, TimeUnit.MINUTES); + return createToken; + } /** * 验证令牌有效期,相差不足20分钟,自动刷新缓存 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java index d95eb72..c9bfaf3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java @@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.json.JSONObject; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.system.domain.entity.shortmessage.MeetingInfo; import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord; @@ -11,6 +13,7 @@ import com.ruoyi.system.domain.entity.sms.MsSmsSendHistoryRecordParam; import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; import com.ruoyi.system.domain.entity.sms.MsSmsTemplateParam; +import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.shortmessage.MeetingInfoMapper; import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper; import com.ruoyi.system.mapper.sms.MsSmsSendHistoryRecordParamMapper; @@ -56,11 +59,11 @@ public class ShortMessageServiceImpl implements ShortMessageService { @Override public List smsSendRecordList(SmsSendRecord smsSendRecord) { List records = smsRecordMapper.getSmsSendRecord(smsSendRecord); - if(CollectionUtil.isEmpty(records)){ + if (CollectionUtil.isEmpty(records)) { return null; } List templateIds = records.stream().map(SmsSendRecord::getMsSmsTemplateId).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(templateIds)){ + if (CollectionUtil.isEmpty(templateIds)) { return records; } List ids = records.stream().map(SmsSendRecord::getId).collect(Collectors.toList()); @@ -68,14 +71,14 @@ public class ShortMessageServiceImpl implements ShortMessageService { Example recordParamExam = new Example(MsSmsSendRecordParam.class); recordParamExam.createCriteria().andIn("smsRecordId", ids); List recordParams = recordParamMapper.selectByExample(recordParamExam); - if(CollectionUtil.isEmpty(recordParams)){ + if (CollectionUtil.isEmpty(recordParams)) { return records; } // 根据模板id查询模板参数 Example templateParamExam = new Example(MsSmsTemplateParam.class); templateParamExam.createCriteria().andIn("smsTemplateId", templateIds); List templateParams = templateParamMapper.selectByExample(templateParamExam); - if(CollectionUtil.isEmpty(templateParams)){ + if (CollectionUtil.isEmpty(templateParams)) { return records; } // 根据模板id对模板参数分组 @@ -85,17 +88,17 @@ public class ShortMessageServiceImpl implements ShortMessageService { Map> recordParamContentMap = new HashMap<>(); for (MsSmsSendRecordParam recordParam : recordParams) { List list = recordParamContentMap.get(recordParam.getSmsRecordId()); - if(CollectionUtil.isEmpty(list)){ - list=new ArrayList<>(); + if (CollectionUtil.isEmpty(list)) { + list = new ArrayList<>(); } list.add(recordParam.getParamValue()); - recordParamContentMap.put(recordParam.getSmsRecordId(),list); + recordParamContentMap.put(recordParam.getSmsRecordId(), list); } // 根据模板id查询模板 Example templateExam = new Example(MsSmsTemplate.class); templateExam.createCriteria().andIn("id", templateIds); List templates = templateMapper.selectByExample(templateExam); - if(CollectionUtil.isEmpty(templates)){ + if (CollectionUtil.isEmpty(templates)) { return records; } // 根据主键id获取模板内容 @@ -103,28 +106,28 @@ public class ShortMessageServiceImpl implements ShortMessageService { Map templateIdMap = templates.stream().collect(Collectors.toMap(MsSmsTemplate::getId, MsSmsTemplate::getTemplateId, (k1, k2) -> k2)); // 组装模板内容 for (SmsSendRecord record : records) { - if(record.getMsSmsTemplateId()==null){ + if (record.getMsSmsTemplateId() == null) { continue; } - if(!templateMap.containsKey(record.getMsSmsTemplateId())){ + if (!templateMap.containsKey(record.getMsSmsTemplateId())) { continue; } - if(!recordParamContentMap.containsKey(record.getId())){ + if (!recordParamContentMap.containsKey(record.getId())) { continue; } - if(templateIdMap.containsKey(record.getMsSmsTemplateId())){ - record.setTemplateId(templateIdMap.get(record.getMsSmsTemplateId())); + if (templateIdMap.containsKey(record.getMsSmsTemplateId())) { + record.setTemplateId(templateIdMap.get(record.getMsSmsTemplateId())); } String templateContent = templateMap.get(record.getMsSmsTemplateId()); record.setTemplateContent(templateContent); List recordParamList = recordParamContentMap.get(record.getId()); - if(recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())){ + if (recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())) { List templateParamList = templateParamMap.get(record.getMsSmsTemplateId()); ArrayList copyParamList = new ArrayList<>(); for (int i = 0; i < templateParamList.size(); i++) { MsSmsTemplateParam templateParam = templateParamList.get(i); - MsSmsTemplateParam msSmsTemplateParam =new MsSmsTemplateParam(); + MsSmsTemplateParam msSmsTemplateParam = new MsSmsTemplateParam(); msSmsTemplateParam.setParam(templateParam.getParam()); msSmsTemplateParam.setSmsTemplateId(templateParam.getSmsTemplateId()); msSmsTemplateParam.setParamName(templateParam.getParamName()); @@ -136,8 +139,8 @@ public class ShortMessageServiceImpl implements ShortMessageService { } // 按顺序替换占位符 - if(CollectionUtil.isNotEmpty(recordParamList)){ - recordParamList.add(0,"0"); + if (CollectionUtil.isNotEmpty(recordParamList)) { + recordParamList.add(0, "0"); // 将List转换为String[]数组 String[] paramArray = recordParamList.toArray(new String[recordParamList.size()]); @@ -150,6 +153,7 @@ public class ShortMessageServiceImpl implements ShortMessageService { return records; } + /** * 新增发送历史记录 * @@ -157,19 +161,19 @@ public class ShortMessageServiceImpl implements ShortMessageService { */ @Transactional @Override - public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord,List recordParams) { - if(smsSendRecord!=null){ - MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord(); - BeanUtils.copyProperties(smsSendRecord,historyRecord); + public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord, List recordParams) { + if (smsSendRecord != null) { + MsSmsSendHistoryRecord historyRecord = new MsSmsSendHistoryRecord(); + BeanUtils.copyProperties(smsSendRecord, historyRecord); historyRecord.setId(null); historyRecord.setParentId(smsSendRecord.getId()); int i = msSmsSendHistoryRecordMapper.insert(historyRecord); - if(i>0 && CollectionUtil.isNotEmpty(recordParams)){ + if (i > 0 && CollectionUtil.isNotEmpty(recordParams)) { // 新增参数表 List historyRecordParams = new ArrayList<>(); for (MsSmsSendRecordParam templateParam : recordParams) { MsSmsSendHistoryRecordParam recordParam = new MsSmsSendHistoryRecordParam(); - BeanUtils.copyProperties(templateParam,recordParam); + BeanUtils.copyProperties(templateParam, recordParam); recordParam.setId(null); recordParam.setSmsRecordHistoryId(historyRecord.getId()); historyRecordParams.add(recordParam); @@ -189,7 +193,7 @@ public class ShortMessageServiceImpl implements ShortMessageService { if (reSendMessageVO != null && reSendMessageVO.getTemplateId() != null && reSendMessageVO.getPhone() != null && reSendMessageVO.getTemplateParams() != null && reSendMessageVO.getTemplateParams().size() > 0 && reSendMessageVO.getId() != null) { // 根据id查询短信记录 SmsSendRecord smsSendRecord = smsRecordMapper.selectById(reSendMessageVO.getId()); - if(smsSendRecord == null){ + if (smsSendRecord == null) { return AjaxResult.warn("短信记录不存在"); } @@ -204,16 +208,16 @@ public class ShortMessageServiceImpl implements ShortMessageService { // 修改sid和状态 if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); - smsSendRecord.setSid(resultObj.get("sid")==null?null:resultObj.get("sid").toString()); + smsSendRecord.setSid(resultObj.get("sid") == null ? null : resultObj.get("sid").toString()); smsSendRecord.setReason(null); // 修改 smsRecordMapper.update(smsSendRecord); return AjaxResult.success("重新发送成功"); } else { - smsSendRecord.setSid(resultObj.get("sid")==null?null:resultObj.get("sid").toString()); + smsSendRecord.setSid(resultObj.get("sid") == null ? null : resultObj.get("sid").toString()); smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); - smsSendRecord.setSid(resultObj.get("reason")==null?null:resultObj.get("reason").toString()); + smsSendRecord.setSid(resultObj.get("reason") == null ? null : resultObj.get("reason").toString()); // 修改 smsRecordMapper.update(smsSendRecord); return AjaxResult.warn("重新发送失败"); -- 2.54.0 From e646b0033376f56e00443c06c89b831d85f47f17 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Fri, 19 Apr 2024 09:16:32 +0800 Subject: [PATCH 20/30] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BC=9A=E8=AE=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/MsVideoConferenceController.java | 10 ++++++++-- .../domain/vo/mscase/MsCaseApplicationReq.java | 4 ++++ .../mscase/impl/MsCaseApplicationServiceImpl.java | 15 +++++++++------ .../mscase/impl/MsSignSealServiceImpl.java | 2 +- .../com/ruoyi/wisdomarbitrate/utils/SmsUtils.java | 5 +++-- .../mscase/MsCaseApplicationMapper.xml | 6 ++++++ 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 7d47ad6..02b28f9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; @@ -24,6 +25,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import java.util.Objects; /** * 视频会议控制层 @@ -31,6 +33,7 @@ import javax.validation.Valid; * @Date 2024/01/8 * @Version V1.0 */ +@CrossOrigin(origins = "*") @RestController @RequestMapping("/video") public class MsVideoConferenceController extends BaseController { @@ -71,6 +74,10 @@ public class MsVideoConferenceController extends BaseController { // officeFlag,fileName为annexPath JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileName,caseId); if(jsonArray!=null && jsonArray.size() > 0) { + // 先删除之前的附件 + if(Objects.equals(annexType, AnnexTypeEnum.MEDIATE_BOOK.getCode())) { + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId, annexType); + } MsCaseAttach caseAttach=null; for (Object obj : jsonArray) { JSONObject jsonObject = (JSONObject) obj; @@ -125,8 +132,7 @@ public class MsVideoConferenceController extends BaseController { .useId(SecurityUtils.getUserId()) .useAccount(SecurityUtils.getUsername()) .build(); - // 先删除之前的附件 - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId,annexType); + msCaseAttachMapper.save(caseAttach); return caseAttach.getAnnexId(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index db8600d..07df6e6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -120,6 +120,10 @@ public class MsCaseApplicationReq { */ private Integer roleType; private Long userId; + /** + * 案件id + */ + private Long caseId; /** * 是否需要用印,0-不需要,1-需要 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index f86a633..ccc5de2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -1710,7 +1710,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { sendMailRecord.setMailContent(sendContent); sendMailRecord.setMailName(subject); sendMailRecord.setSendTime(new Date()); - sendMailRecord.setCreateBy(SecurityUtils.getUsername()); +// sendMailRecord.setCreateBy(SecurityUtils.getUsername()); sendMailRecord.setCreateTime(new Date()); sendMailRecord.setMailSubject(subject); sendMailRecord.setMailFromAddress(emailFrom); @@ -2132,13 +2132,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 根据案件id查询案件 MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); + caseApplication.setHearDate(application.getHearDate()); long l = System.currentTimeMillis(); ExecutorService executor = ThreadUtil.createThreadPool(); CompletableFuture.runAsync(() -> { // 发送开庭短信 if (CollectionUtil.isNotEmpty(vo.getHerDates())) { - List affiliates = selectAffliatesByCaseId(application.getId()); - caseApplication.setHearDate(application.getHearDate()); + List affiliates = selectAffliatesByCaseId(caseApplication.getId()); + // 申请人发送开庭日期短信 sendHearDateSms(caseApplication, affiliates); @@ -2157,9 +2158,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { meditorAffliate.setEmail(sysUser.getEmail()); String roomUuid = null; // 线上调解 - if (StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")) { + if (StrUtil.isNotEmpty(caseApplication.getMediationMethod()) && caseApplication.getMediationMethod().equals("1")) { // 获取短信链接uuid - MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication.getId()).roomId(caseApplication.getRoomId()).build(); roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. @@ -3196,7 +3197,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { affiliateBase = new MsCaseAffiliateBase(); } affiliateBase.setApplicant(affiliate); - applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + if(!applicantName.toString().contains(affiliate.getName()+Constants.CN_SPLIT_COMMA)) { + applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } break; case 2: if(affiliateBase==null){ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 261a5ae..60f6c4b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -1176,7 +1176,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { sendMailRecord.setSendTime(new Date()); sendMailRecord.setMailSubject("签署后的调解书"); sendMailRecord.setFileIds(fileId!=null?fileId.toString():null); - sendMailRecord.setCreateBy(SecurityUtils.getUsername()); +// sendMailRecord.setCreateBy(SecurityUtils.getUsername()); sendMailRecord.setCreateTime(new Date()); sendMailRecord.setMailFromAddress(emailFrom); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java index 97dfd51..90bbcc1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SmsUtils.java @@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import cn.hutool.json.JSONObject; import com.ruoyi.common.enums.SMSStatusEnum; -import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ThreadUtil; import com.ruoyi.system.domain.entity.sms.MsSmsSendRecordParam; import com.ruoyi.system.domain.entity.sms.MsSmsTemplate; @@ -122,7 +121,7 @@ public class SmsUtils { smsSendRecord.setSendTime(new Date()); smsSendRecord.setPhone(phone); smsSendRecord.setCreateTime(new Date()); - smsSendRecord.setCreateBy(SecurityUtils.getUsername()); +// smsSendRecord.setCreateBy(SecurityUtils.getUsername()); // SendSmsRequest request = new SendSmsRequest(phone, template.getTemplateId(), templateParamSet, application.getId()); req.setPhoneNumberSet(new String[]{"+86" + phone}); req.setTemplateId(template.getTemplateId()); @@ -151,6 +150,8 @@ public class SmsUtils { recordParam.setParamValue(paramValue); recordParams.add(recordParam); } +// recordParamMapper.batchInsert(recordParams); +// shortMessageService.insertShortMessageHistoryRecord(smsSendRecord,recordParams); ExecutorService executor = ThreadUtil.createThreadPool(); CompletableFuture.runAsync(() -> { recordParamMapper.batchInsert(recordParams); diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml index 5117d4d..ff0f35a 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml @@ -70,6 +70,9 @@ AND c.case_flow_id = #{req.caseFlowId} + + AND c.id = #{req.caseId} + AND c.case_num = #{req.caseNum} @@ -141,6 +144,9 @@ AND c.case_flow_id = #{req.caseFlowId} + + AND c.id = #{req.caseId} + AND c.case_num = #{req.caseNum} -- 2.54.0 From b03cf6428b73054b3111762e7f6ceecea3f79a9b Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Fri, 19 Apr 2024 11:30:54 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=EF=BC=8C=E7=AD=BE=E6=94=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 4 +- .../impl/MsCaseApplicationServiceImpl.java | 20 +-- .../mscase/impl/MsSignSealServiceImpl.java | 145 ++++++++++++++---- 3 files changed, 123 insertions(+), 46 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index fa7d84e..d067800 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -120,8 +120,8 @@ token: header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz - # 令牌有效期(默认30分钟) - expireTime: 30 + # 令牌有效期(默认120分钟) + expireTime: 120 # MyBatis配置 mybatis: diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index ccc5de2..c424b0f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -2133,7 +2133,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 根据案件id查询案件 MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); caseApplication.setHearDate(application.getHearDate()); - long l = System.currentTimeMillis(); ExecutorService executor = ThreadUtil.createThreadPool(); CompletableFuture.runAsync(() -> { // 发送开庭短信 @@ -2160,11 +2159,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 线上调解 if (StrUtil.isNotEmpty(caseApplication.getMediationMethod()) && caseApplication.getMediationMethod().equals("1")) { // 获取短信链接uuid - MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication.getId()).roomId(caseApplication.getRoomId()).build(); + MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication.getId()).roomId(caseApplication.getRoomId()).systemType("TJ").build(); roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. - content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" + roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; + content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; templateId = "2130103"; } // 电话号不为空,发送短信,否则发邮箱 @@ -2174,7 +2173,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { new String[]{caseApplication.getCaseNum(), application.getHearDate()}); } else { SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate(), roomUuid}); + new String[]{caseApplication.getCaseNum(), application.getHearDate(), "authId="+roomUuid}); } @@ -2209,14 +2208,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 申请人 if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) { // 获取短信链接uuid - MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).systemType("TJ").build(); String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); // 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; + String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+"authId="+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; if (StrUtil.isNotEmpty(affiliate.getPhone())&&!appPhones.contains(affiliate.getPhone())) { appPhones.add(affiliate.getPhone()); SmsUtils.sendSms(application,"2130103", affiliate.getPhone(), - new String[]{application.getCaseNum(),application.getHearDate(),roomUuid}); + new String[]{application.getCaseNum(),application.getHearDate(),"authId="+roomUuid}); } else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!appEmails.contains(affiliate.getEmail())) { appEmails.add(affiliate.getEmail()); @@ -2229,14 +2228,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 被申请人 if (affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) { // 获取短信链接uuid - MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build(); + MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(affiliate.getUserId()).userName(affiliate.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).systemType("TJ").build(); String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); // 申请人/被申通知, 线上调解 2075447 尊敬的用户,您的{1}案件,线上调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 - String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; + String content="尊敬的用户,您的" + application.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+"authId="+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信."; if (StrUtil.isNotEmpty(affiliate.getPhone())&& !resPhones.contains(affiliate.getPhone())) { resPhones.add(affiliate.getPhone()); SmsUtils.sendSms(application,"2130103", affiliate.getPhone(), - new String[]{application.getCaseNum(),application.getHearDate(),roomUuid}); + new String[]{application.getCaseNum(),application.getHearDate(),"authId="+roomUuid}); } else if(StrUtil.isNotEmpty(affiliate.getEmail())&&!resEmails.contains(affiliate.getEmail())){ resEmails.add(affiliate.getEmail()); @@ -2440,6 +2439,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (application == null) { return AjaxResult.error("未找到案件"); } + req.setSealFlag(application.getSealFlag()); if (StrUtil.isEmpty(application.getMediationMethod())) { return AjaxResult.error("未选择调解方式"); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 60f6c4b..17723a6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -21,6 +21,7 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ThreadUtil; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord; @@ -43,6 +44,7 @@ import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO; +import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO; import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper; @@ -53,8 +55,10 @@ import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService; +import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.SignAward; +import com.ruoyi.wisdomarbitrate.utils.SmsUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -67,6 +71,8 @@ import java.io.File; import java.io.IOException; import java.time.LocalDate; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; import static com.ruoyi.common.core.domain.AjaxResult.success; @@ -123,7 +129,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { BeiMingInterfaceService beiMingInterfaceService; @Autowired private MsSendMailHistoryRecordMapper sendMailHistoryRecordMapper; - + @Autowired + ShortMessageService shortMessageService; @@ -423,21 +430,48 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(CollectionUtil.isEmpty(affiliates)){ return AjaxResult.error("未找到案件相关人员"); } - List oprratorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null - && affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail())) - .collect(Collectors.toList()); - if(CollectionUtil.isEmpty(oprratorList)){ - return AjaxResult.error("未找到案件操作人员"); + // 申请操作人 + Optional applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + // 被申请操作人 + Optional resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { + throw new ServiceException("未找到案件操作人员"); } - - for (MsCaseAffiliate affiliate : oprratorList) { - if(affiliate.getRoleType()==null){ - continue; - } - boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList); - - + ExecutorService executor = ThreadUtil.createThreadPool(); + // 发送邮件 + CompletableFuture.runAsync(() -> { + if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) { + boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList); } + if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) { + boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList); + } }, executor); + // 发送签收短信,2126313 尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信 + CompletableFuture.runAsync(() -> { + SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId()); + // 获取短信链接uuid + MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build(); + String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + if (!StrUtil.isEmpty(sysUser.getPhonenumber())) { + SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid}); + }else if(StrUtil.isNotEmpty(sysUser.getEmail())){ + String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信"; + sendEmail(caseApplication1, sysUser, "调解系统文件签收", content); + } + }, executor); + CompletableFuture.runAsync(() -> { + SysUser sysUser = sysUserMapper.selectUserById(resAffiliateOpt.get().getUserId()); + MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build(); + String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { + SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid}); + }else if(StrUtil.isNotEmpty(sysUser.getEmail())){ + String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信"; + emailOutUtil.sendMessage(sysUser.getEmail(), "调解系统文件签收", content, null, null); + sendEmail(caseApplication1, sysUser, "调解系统文件签收", content); + } + }, executor); + CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); @@ -449,42 +483,85 @@ public class MsSignSealServiceImpl implements MsSignSealService { return AjaxResult.success(""); } + public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) { + boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null); + SendMailRecord sendMailRecord = new SendMailRecord(); + sendMailRecord.setCaseId(application.getId()); + sendMailRecord.setMailAddress(user.getEmail()); + sendMailRecord.setMailContent(sendContent); + sendMailRecord.setMailName(subject); + sendMailRecord.setSendTime(new Date()); +// sendMailRecord.setCreateBy(SecurityUtils.getUsername()); + sendMailRecord.setCreateTime(new Date()); + sendMailRecord.setMailSubject(subject); + sendMailRecord.setMailFromAddress(emailFrom); + if (emailFlag) { + sendMailRecord.setSendStatus(1); + } else { + sendMailRecord.setSendStatus(0); + } + sendMailRecordMapper.saveSendMailRecord(sendMailRecord); + // 新增历史记录 + MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord(); + BeanUtils.copyProperties(sendMailRecord, msSendMailHistoryRecord); + msSendMailHistoryRecord.setParentId(sendMailRecord.getId()); + msSendMailHistoryRecord.setId(null); + sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord); + } @Override @Transactional public AjaxResult msCaseSign(MsSignSealDTO dto) { Long caseId = dto.getCaseId(); - // MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId); MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId); + if(caseApplicationselect==null){ + return AjaxResult.error("当前案件不存在"); + } // 查询当前节点 MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId()); if (currentFlow == null) { return AjaxResult.error("当前流程不存在"); } - if (dto.getIsSignApply() != null && dto.getIsSignApply().equals(1) ) { - // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); - caseApplicationselect.setCaseFlowId(nextFlow.getId()); - caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); - caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); - CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); + Long loginUserId = SecurityUtils.getUserId(); + Example example = new Example(MsCaseAffiliate.class); + example.createCriteria().andEqualTo("caseAppliId", caseId); + List msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example); + if(CollectionUtil.isEmpty(msCaseAffiliates)){ + return AjaxResult.error("未找到案件相关人员"); } - if (dto.getIsSignRespon() != null && dto.getIsSignRespon().equals(1)) { + for (MsCaseAffiliate affiliate : msCaseAffiliates) { + // 申请人签收,根据流程id查找下一个流程节点 + if(affiliate.getUserId()!=null + && loginUserId.equals(affiliate.getUserId()) + &&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2))) { + MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); + caseApplicationselect.setCaseFlowId(nextFlow.getId()); + caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); + caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); + CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null); + } - // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); - caseApplicationselect.setCaseFlowId(nextFlow.getId()); - caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); - caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); - CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); - CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null); - // 被申请人签收结束对接北明,为调解成功状态 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { - applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); + // 被申请人签收 + if(affiliate.getUserId()!=null + && loginUserId.equals(affiliate.getUserId()) + &&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4))) { + + // 根据流程id查找下一个流程节点 + MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId()); + caseApplicationselect.setCaseFlowId(nextFlow.getId()); + caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); + caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); + CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null); + CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null); + // 被申请人签收结束对接北明,为调解成功状态 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { + applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); + } } } + return AjaxResult.success("签收成功"); } @@ -1156,7 +1233,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { Long fileId = null; if (caseAttachList != null && caseAttachList.size() > 0) { for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { + if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK.getCode())) { String prefix = "/profile"; int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); -- 2.54.0 From 8718bece102c3f8da291e680c09a2e8af2c4abe8 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Fri, 19 Apr 2024 14:19:41 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E7=AD=BE=E6=94=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/impl/MsSignSealServiceImpl.java | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 17723a6..41a432a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -431,9 +431,9 @@ public class MsSignSealServiceImpl implements MsSignSealService { return AjaxResult.error("未找到案件相关人员"); } // 申请操作人 - Optional applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); + Optional applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst(); // 被申请操作人 - Optional resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + Optional resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) { throw new ServiceException("未找到案件操作人员"); } @@ -459,20 +459,6 @@ public class MsSignSealServiceImpl implements MsSignSealService { sendEmail(caseApplication1, sysUser, "调解系统文件签收", content); } }, executor); - CompletableFuture.runAsync(() -> { - SysUser sysUser = sysUserMapper.selectUserById(resAffiliateOpt.get().getUserId()); - MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build(); - String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); - if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { - SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid}); - }else if(StrUtil.isNotEmpty(sysUser.getEmail())){ - String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信"; - emailOutUtil.sendMessage(sysUser.getEmail(), "调解系统文件签收", content, null, null); - sendEmail(caseApplication1, sysUser, "调解系统文件签收", content); - } - }, executor); - - CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),""); } @@ -496,6 +482,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { sendMailRecord.setCreateTime(new Date()); sendMailRecord.setMailSubject(subject); sendMailRecord.setMailFromAddress(emailFrom); + sendMailRecord.setCaseNum(application.getCaseNum()); if (emailFlag) { sendMailRecord.setSendStatus(1); } else { @@ -529,7 +516,12 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(CollectionUtil.isEmpty(msCaseAffiliates)){ return AjaxResult.error("未找到案件相关人员"); } - + // 被申请操作人 + Optional resAffiliateOpt = msCaseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst(); + ExecutorService executor = ThreadUtil.createThreadPool(); + if(!resAffiliateOpt.isPresent()){ + return AjaxResult.error("案件相关人员不完整"); + } for (MsCaseAffiliate affiliate : msCaseAffiliates) { // 申请人签收,根据流程id查找下一个流程节点 if(affiliate.getUserId()!=null @@ -540,6 +532,21 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName()); caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect); CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null); + // 发送被申请人签收短信 + CompletableFuture.runAsync(() -> { + MsCaseAffiliate caseAffiliate = resAffiliateOpt.get(); + SysUser sysUser = sysUserMapper.selectUserById(caseAffiliate.getUserId()); + MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplicationselect.getId()).systemType("TJ").build(); + String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); + if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { + SmsUtils.sendSms(caseApplicationselect, "2126313", sysUser.getPhonenumber(), new String[]{sysUser.getNickName(), caseApplicationselect.getCaseNum(), "authId=" + roomUuid}); + } else if (StrUtil.isNotEmpty(sysUser.getEmail())) { + String content = "尊敬的" + sysUser.getNickName() + "用户,您的" + caseApplicationselect.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId=" + roomUuid + ",如非本人操作,请忽略本短信"; + emailOutUtil.sendMessage(sysUser.getEmail(), "调解系统文件签收", content, null, null); + sendEmail(caseApplicationselect, sysUser, "调解系统文件签收", content); + } + }, executor); + break; } // 被申请人签收 @@ -558,6 +565,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) { applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS); } + break; } } @@ -1247,11 +1255,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { } SendMailRecord sendMailRecord = new SendMailRecord(); sendMailRecord.setCaseId(caseApplication.getId()); + sendMailRecord.setCaseNum(caseApplication.getCaseNum()); sendMailRecord.setMailAddress(email); sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅"); sendMailRecord.setMailName("签署后的调解书"); sendMailRecord.setSendTime(new Date()); sendMailRecord.setMailSubject("签署后的调解书"); + sendMailRecord.setMailFromAddress(emailFrom); sendMailRecord.setFileIds(fileId!=null?fileId.toString():null); // sendMailRecord.setCreateBy(SecurityUtils.getUsername()); sendMailRecord.setCreateTime(new Date()); -- 2.54.0 From 29d7cd37bf8868c003d819497e60e2dbbc9c2d1f Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Mon, 22 Apr 2024 09:20:45 +0800 Subject: [PATCH 23/30] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mscase/MsVideoConferenceController.java | 7 +- .../src/main/resources/application.yml | 2 +- ruoyi-common/pom.xml | 5 + .../common/utils/file/SaaSAPIFileUtils.java | 61 ++-- .../dept/impl/DeptIdentifyServiceImpl.java | 20 +- .../impl/MsCaseApplicationServiceImpl.java | 91 ++++-- .../mscase/impl/MsSignSealServiceImpl.java | 278 +++++++++--------- .../mscase/MsCaseApplicationMapper.xml | 4 +- 8 files changed, 257 insertions(+), 211 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 02b28f9..fdce1cb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -84,10 +84,15 @@ public class MsVideoConferenceController extends BaseController { caseAttach = MsCaseAttach.builder() .caseAppliId(caseId) .annexName(jsonObject.getString("fileName")) - .annexPath(jsonObject.getString("filePath")) .annexType(annexType) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); + if(jsonObject.get("filePath")!=null){ + String officePath = jsonObject.getString("filePath"); + String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); + caseAttach.setAnnexPath(replace); + + } msCaseAttachMapper.save(caseAttach); } if(caseAttach==null){ diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index d067800..466e02e 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -120,7 +120,7 @@ token: header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz - # 令牌有效期(默认120分钟) + # 令牌有效期(默认30分钟) expireTime: 120 # MyBatis配置 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 789e72b..e5d63d1 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -283,6 +283,11 @@ org.apache.httpcomponents httpclient + + org.thymeleaf + thymeleaf + 3.0.12.RELEASE + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java index 167abfd..b7e869a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java @@ -1,20 +1,13 @@ package com.ruoyi.common.utils.file; -import cn.hutool.json.JSONObject; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.ruoyi.common.config.EsignDemoConfig; import com.ruoyi.common.constant.EsignHeaderConstant; -import com.ruoyi.common.constant.FileTransformation; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.enums.EsignRequestType; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.EsignHttpHelper; import com.ruoyi.common.utils.bean.EsignFileBean; -import com.ruoyi.common.utils.uuid.IdUtils; -import java.time.LocalDate; import java.util.Map; public class SaaSAPIFileUtils { @@ -88,43 +81,27 @@ public class SaaSAPIFileUtils { public static void main(String[] args) throws EsignDemoException { - String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx"; - - EsignHttpResponse uploadUrl = getUploadUrl(filePath); - String body = uploadUrl.getBody(); - JSONObject jsonObject = new JSONObject(body); - JSONObject dataObj = jsonObject.getJSONObject("data"); - String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); - System.out.println("这是fileUploadUrl:"+fileUploadUrl); - String fileId = dataObj.get("fileId").toString(); - System.out.println("这是fileId:"+fileId); - //String fileUploadUrl = "https://esignoss.esign.cn/1111564182/ccf6db5a-92da-4523-89ba-385a30423596/23893bfd3f2249ffa5c82850c11c482e.docx?Expires=1697021257&OSSAccessKeyId=STS.NTmgvSC8n5Zg1y7EciQftF23N&Signature=CxVZmpwFksWmLYkxPjVz9K4mVyA%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDAyODhjOTg3LWNlNzgtNDM1OC04NWYwLTdlNmUyM2NjOTJmNiQzNDk1NzQ3MjE5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fYLMznrudPgpiMM1%2BGoWM8XelYqfeYrDz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEofT7katr4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAaxcPCSY0Du8wgErfR1llD8t2zeFG%2B1mktU4Rsl7AgxsSFxrwILBUk2x7imVsFVA0kkS8rNBMDKGIsIZTCl5M7S2L%2BD8364htwcZgIZYHK2fCN6gCuy%2Bfk9C%2FfQaTc00IWBMw8OubuJ%2Fq2mdMh32yoi7dLuJyhwt1z%2F%2BWf5vIFHdIAA%3D"; - EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); - System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); - EsignHttpResponse fileStatus = getFileStatus(fileId); - System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); -// getFileStatus("a808f1f39a744357a2f018e4ab34c55d"); -// fileDownloadUrl(""); + fileDownloadUrl("8425b244bf4b417dbb22fd39a1c2d65f"); -// Gson gson = new Gson(); -// EsignHttpResponse fileDownload = fileDownloadUrl(signFlowId); -// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(),JsonObject.class); -// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); -// JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); -// if(filesArray!=null&&filesArray.size()>0){ -// JsonObject fileObject = (JsonObject)filesArray.get(0); -// String fileDownloadUrl = fileObject.get("downloadUrl").toString(); -// String fileName = java.util.UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String savePath = "/home/ruoyi/uploadPath/upload"; -// LocalDate now = LocalDate.now(); -// String year = Integer.toString(now.getYear()); -// String month = String.format("%02d", now.getMonthValue()); -// String day = String.format("%02d", now.getDayOfMonth()); -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1); -// FileTransformation.downLoadFileByUrl(fileDownloadUrlnew,dir); -// } + + +// String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx"; +// +// EsignHttpResponse uploadUrl = getUploadUrl(filePath); +// String body = uploadUrl.getBody(); +// JSONObject jsonObject = new JSONObject(body); +// JSONObject dataObj = jsonObject.getJSONObject("data"); +// String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); +// System.out.println("这是fileUploadUrl:"+fileUploadUrl); +// String fileId = dataObj.get("fileId").toString(); +// System.out.println("这是fileId:"+fileId); +// //String fileUploadUrl = "https://esignoss.esign.cn/1111564182/ccf6db5a-92da-4523-89ba-385a30423596/23893bfd3f2249ffa5c82850c11c482e.docx?Expires=1697021257&OSSAccessKeyId=STS.NTmgvSC8n5Zg1y7EciQftF23N&Signature=CxVZmpwFksWmLYkxPjVz9K4mVyA%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDAyODhjOTg3LWNlNzgtNDM1OC04NWYwLTdlNmUyM2NjOTJmNiQzNDk1NzQ3MjE5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fYLMznrudPgpiMM1%2BGoWM8XelYqfeYrDz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEofT7katr4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAaxcPCSY0Du8wgErfR1llD8t2zeFG%2B1mktU4Rsl7AgxsSFxrwILBUk2x7imVsFVA0kkS8rNBMDKGIsIZTCl5M7S2L%2BD8364htwcZgIZYHK2fCN6gCuy%2Bfk9C%2FfQaTc00IWBMw8OubuJ%2Fq2mdMh32yoi7dLuJyhwt1z%2F%2BWf5vIFHdIAA%3D"; +// EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); +// System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); +// EsignHttpResponse fileStatus = getFileStatus(fileId); +// System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); + diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java index a1a44fb..296faae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java @@ -324,6 +324,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { if (identifyName == null) { AjaxResult.error("请检查参数是否完整"); } + // 查询是否存在机构 + SysDept sysDept = sysDeptMapper.selectDeptByName(identifyName); Integer identifyType = deptIdentify.getIdentifyType(); if (identifyType == null) { deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构 @@ -331,11 +333,19 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证 deptIdentify.setIsUse(0); //设置机构默认为未启用 //将机构名称保存到部门表里 - SysDept sysDept = new SysDept(); - sysDept.setDeptName(identifyName); - sysDept.setParentId(0L); - sysDept.setDeptType(1); - int i1 = sysDeptMapper.insertDept(sysDept); + int i1=0; + if(sysDept == null) { + sysDept = new SysDept(); + sysDept.setParentId(0L); + sysDept.setDeptName(identifyName); + sysDept.setDeptType(1); + i1 = sysDeptMapper.insertDept(sysDept); + } + else { + sysDept.setDeptType(1); + sysDeptMapper.updateDept(sysDept); + } + if (i1 > 0) { /* //将经办人信息存入到用户表里 Long deptId = sysDept.getDeptId(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index c424b0f..bbe159a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -2132,6 +2132,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKeySelective(application); // 根据案件id查询案件 MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId()); + if (caseApplication == null) { + throw new ServiceException("未找到案件"); + } caseApplication.setHearDate(application.getHearDate()); ExecutorService executor = ThreadUtil.createThreadPool(); CompletableFuture.runAsync(() -> { @@ -2141,15 +2144,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // 申请人发送开庭日期短信 sendHearDateSms(caseApplication, affiliates); + // 调解员发送开庭短信 + sendMeditorHearDateSms(caseApplication,vo); - - } + } }, executor); - // 调解员发送短信,根据调解员id查询用户 - CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) { + + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + + } + + /** + * 调解员发送开庭短信 + * @param caseApplication + * @param vo + */ + private void sendMeditorHearDateSms(MsCaseApplication caseApplication, BookingVO vo) { + if (caseApplication.getMediatorId() != null && CollectionUtil.isNotEmpty(vo.getHerDates()) && StrUtil.isNotEmpty(caseApplication.getHearDate())) { // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。 SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId()); - String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。"; + String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + caseApplication.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。"; String templateId = "2077966"; String subject = "开庭日期通知"; MsCaseAffiliate meditorAffliate = new MsCaseAffiliate(); @@ -2163,17 +2178,17 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO); // 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信. - content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; + content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + caseApplication.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信."; templateId = "2130103"; } // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { if (roomUuid == null) { SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate()}); + new String[]{caseApplication.getCaseNum(), caseApplication.getHearDate()}); } else { SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(), application.getHearDate(), "authId="+roomUuid}); + new String[]{caseApplication.getCaseNum(), caseApplication.getHearDate(), "authId="+roomUuid}); } @@ -2182,11 +2197,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content); } - } }, executor); - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } } + /** * 发送开庭日期短信 * @param application @@ -2386,6 +2400,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { public AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach) { if(StrUtil.isEmpty(caseAttach.getAnnexName())) { caseAttach.setAnnexName("调解书"); + } + if(StrUtil.isNotEmpty(caseAttach.getAnnexPath())) { + String replace = caseAttach.getAnnexPath().replace("/home/ruoyi/uploadPath", "/profile"); + caseAttach.setAnnexPath(replace); } caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); caseAttach.setUseId(getUserInfo().getUserId()); @@ -2483,8 +2501,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { String annexPath = caseAttach.getAnnexPath(); - if (annexPath.contains("/profile/upload")) { - annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + if (annexPath.contains("/profile")) { + annexPath = annexPath.replace("/profile", "/home/ruoyi/uploadPath"); } String path = annexPath; //获取文件上传地址 @@ -2829,8 +2847,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (MsCaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { String annexPath = caseAttach.getAnnexPath(); - if (annexPath.contains("/profile/upload")) { - annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + if (annexPath.contains("/profile")) { + annexPath = annexPath.replace("/profile", "/home/ruoyi/uploadPath"); } String path = annexPath; //获取文件上传地址 @@ -2959,7 +2977,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { SmsUtils.sendSms(application, "2047719",resAffiliateOpt.get().getPhone(), new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); } else { - throw new ServiceException(jsonObject3.getString("message")); + return AjaxResult.error(jsonObject3.getString("message")); } } else { return AjaxResult.error(); @@ -3019,14 +3037,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { for (MsCaseAttach msCaseAttach : msCaseAttaches) { - String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); - File file = new File(templatePath.replace("/profile", "/uploadPath")); + if (StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { + continue; + } + + String replacePath = msCaseAttach.getAnnexPath().replace("/profile/", "/home/ruoyi/uploadPath/"); + File file = new File(replacePath); MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); // 更新附件表 if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); msCaseAttachMapper.updateCaseAttach(msCaseAttach); } + + } } // 修改案件状态为待送达 @@ -3398,12 +3422,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseAttach= MsCaseAttach.builder() .caseAppliId(application.getId()) .annexName(jsonObject.getString("fileName")) - .annexPath(jsonObject.getString("filePath")) .annexType(annexType) .onlyOfficeFileId(jsonObject.getString("fileId")) .build(); + if(jsonObject.get("filePath")!=null){ + String officePath = jsonObject.getString("filePath"); + String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/"); + caseAttach.setAnnexPath(replace); + + } + } + //保存到附件表里,先删除之前的在保存 msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); msCaseAttachMapper.save(caseAttach); @@ -3430,16 +3461,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType); if(StrUtil.isEmpty(application.getCaseSource())) { // 北明推送 - String path = "/home/ruoyi" + caseAttach.getAnnexPath(); - File file = new File(path.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); + if (StrUtil.isNotEmpty(caseAttach.getAnnexPath())) { + String replacePath = caseAttach.getAnnexPath().replace("/profile/", "/home/ruoyi/uploadPath/"); + File file = new File(replacePath); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK); - // 更新附件表 - if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + } } - } - msCaseAttachMapper.save(caseAttach); + msCaseAttachMapper.save(caseAttach); + } + + } } @@ -3451,7 +3486,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { @Override @Transactional public JSONArray uploadOnlyOffice(String annexPath,Long caseId) { - annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath"); + annexPath=annexPath.replace("/profile/","/home/ruoyi/uploadPath/"); File file = new File(annexPath); if (file.exists()) { // 调用onlyoffice diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 41a432a..549f36b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -59,6 +59,7 @@ import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.wisdomarbitrate.utils.SignAward; import com.ruoyi.wisdomarbitrate.utils.SmsUtils; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -76,7 +77,7 @@ import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; import static com.ruoyi.common.core.domain.AjaxResult.success; - +@Slf4j @Service public class MsSignSealServiceImpl implements MsSignSealService { @@ -706,6 +707,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr); Gson gson = new Gson(); if (jsonObjectCallback != null) { + log.info("签名回调======"+jsonObjectCallback); int signResult = jsonObjectCallback.getIntValue("signResult"); String action = jsonObjectCallback.getString("action"); String signFlowId = jsonObjectCallback.getString("signFlowId"); @@ -857,11 +859,15 @@ public class MsSignSealServiceImpl implements MsSignSealService { //修改"签署用印记录表"的状态为待用印 if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { sealSignRecordsel.setSignFlowStatus(2); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); }else { // 否则为已完成 sealSignRecordsel.setSignFlowStatus(3); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + // 下载调解书 + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); } - sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){ //需要用印 @@ -915,71 +921,72 @@ public class MsSignSealServiceImpl implements MsSignSealService { sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); //下载审核完成的调解书 - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); - JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); - JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); - if (filesArray != null && filesArray.size() > 0) { - JsonObject fileObject = (JsonObject) filesArray.get(0); - String fileDownloadUrl = fileObject.get("downloadUrl").toString(); - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; - String saveName = fileName; - String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - String resultFilePath = saveFolderPath + "/" + fileName; - File resultFilePathFile = new File(resultFilePath); - if (!resultFilePathFile.exists()) { - resultFilePathFile.createNewFile(); - } - - String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - MsCaseAttach caseAttach = new MsCaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - caseAttachMapper.save(caseAttach); - // 对接北明,调用上传附件接口 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { - String templatePath = "/home/ruoyi" + savePath; - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } - - } - } - - } + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); +// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); +// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); +// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); +// JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); +// if (filesArray != null && filesArray.size() > 0) { +// JsonObject fileObject = (JsonObject) filesArray.get(0); +// String fileDownloadUrl = fileObject.get("downloadUrl").toString(); +// LocalDate now = LocalDate.now(); +// String year = Integer.toString(now.getYear()); +// String month = String.format("%02d", now.getMonthValue()); +// String day = String.format("%02d", now.getDayOfMonth()); +// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; +// String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; +// String saveName = fileName; +// String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// +// // 创建日期目录 +// File saveFolder = new File(saveFolderPath); +// if (!saveFolder.exists()) { +// saveFolder.mkdirs(); +// } +// String resultFilePath = saveFolderPath + "/" + fileName; +// File resultFilePathFile = new File(resultFilePath); +// if (!resultFilePathFile.exists()) { +// resultFilePathFile.createNewFile(); +// } +// +// String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); +// boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); +// if (downLoadFile) { +// // 先删除已经存在的调解书 +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ +// List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// if(CollectionUtil.isNotEmpty(existAttach)){ +// // 对接北明,同步案件状态,删除 +// for (MsCaseAttach msCaseAttach : existAttach) { +// if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ +// continue; +// } +// beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); +// } +// } +// } +// msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// MsCaseAttach caseAttach = new MsCaseAttach(); +// caseAttach.setCaseAppliId(caseAppliId); +// caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// caseAttach.setAnnexPath(savePath); +// caseAttach.setAnnexName(saveName); +// caseAttachMapper.save(caseAttach); +// // 对接北明,调用上传附件接口 +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { +// String templatePath = "/home/ruoyi" + savePath; +// File file = new File(templatePath.replace("/profile", "/uploadPath")); +// MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); +// // 更新附件表 +// if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ +// caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); +// msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); +// } +// +// } +// } +// +// } } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){ //被申请人签名 @@ -1005,71 +1012,72 @@ public class MsSignSealServiceImpl implements MsSignSealService { sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); //下载审核完成的调解书 - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); - JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); - JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); - if (filesArray != null && filesArray.size() > 0) { - JsonObject fileObject = (JsonObject) filesArray.get(0); - String fileDownloadUrl = fileObject.get("downloadUrl").toString(); - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; - String saveName = fileName; - String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - String resultFilePath = saveFolderPath + "/" + fileName; - File resultFilePathFile = new File(resultFilePath); - if (!resultFilePathFile.exists()) { - resultFilePathFile.createNewFile(); - } - - String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - MsCaseAttach caseAttach = new MsCaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(7); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - - // 对接北明,调用上传附件接口 - - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { - String templatePath = "/home/ruoyi" + savePath; - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - } - } - caseAttachMapper.save(caseAttach); - } - - } + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); +// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); +// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); +// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); +// JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); +// if (filesArray != null && filesArray.size() > 0) { +// JsonObject fileObject = (JsonObject) filesArray.get(0); +// String fileDownloadUrl = fileObject.get("downloadUrl").toString(); +// LocalDate now = LocalDate.now(); +// String year = Integer.toString(now.getYear()); +// String month = String.format("%02d", now.getMonthValue()); +// String day = String.format("%02d", now.getDayOfMonth()); +// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; +// String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; +// String saveName = fileName; +// String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// +// // 创建日期目录 +// File saveFolder = new File(saveFolderPath); +// if (!saveFolder.exists()) { +// saveFolder.mkdirs(); +// } +// String resultFilePath = saveFolderPath + "/" + fileName; +// File resultFilePathFile = new File(resultFilePath); +// if (!resultFilePathFile.exists()) { +// resultFilePathFile.createNewFile(); +// } +// +// String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); +// boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); +// if (downLoadFile) { +// // 先删除已经存在的调解书 +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ +// List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// if(CollectionUtil.isNotEmpty(existAttach)){ +// // 对接北明,同步案件状态,删除 +// for (MsCaseAttach msCaseAttach : existAttach) { +// if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ +// continue; +// } +// beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); +// } +// } +// } +// msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); +// MsCaseAttach caseAttach = new MsCaseAttach(); +// caseAttach.setCaseAppliId(caseAppliId); +// caseAttach.setAnnexType(7); +// caseAttach.setAnnexPath(savePath); +// caseAttach.setAnnexName(saveName); +// +// // 对接北明,调用上传附件接口 +// +// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { +// String templatePath = "/home/ruoyi" + savePath; +// File file = new File(templatePath.replace("/profile", "/uploadPath")); +// MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); +// // 更新附件表 +// if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ +// caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); +// } +// } +// caseAttachMapper.save(caseAttach); +// } +// +// } } } } @@ -1082,10 +1090,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { } private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException { + log.info("signFlowId===="+signFlowId); EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); + log.info("下载成功===="+fileDownload); JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); + log.info("下载调解书pdf===="+filesArray); if (filesArray != null && filesArray.size() > 0) { JsonObject fileObject = (JsonObject) filesArray.get(0); String fileDownloadUrl = fileObject.get("downloadUrl").toString(); @@ -1111,6 +1122,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + log.info("是否下载成功======="+downLoadFile); if (downLoadFile) { // 先删除已经存在的调解书 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ @@ -1126,11 +1138,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { } } msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + MsCaseAttach caseAttach = new MsCaseAttach(); caseAttach.setCaseAppliId(caseAppliId); caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); caseAttach.setAnnexPath(savePath); caseAttach.setAnnexName(saveName); + log.info("调解书保存======="+downLoadFile); caseAttachMapper.save(caseAttach); // 对接北明,调用上传附件接口 if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml index ff0f35a..fad5ed2 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml @@ -113,7 +113,7 @@ + delete from ms_case_attach -- 2.54.0 From 3ec845fc46815137e05e8ec2b62a4a8379d63d45 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 30 Apr 2024 17:32:57 +0800 Subject: [PATCH 29/30] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=B0=83=E8=A7=A3?= =?UTF-8?q?=E4=B9=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wisdomarbitrate/mscase/MsVideoConferenceController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 259a640..fb42a37 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -120,13 +120,15 @@ public class MsVideoConferenceController extends BaseController { } }else { // 如果是调解书并且是pdf,则删除之前的在新增 - if(isMediaBook != null && isMediaBook == 1 && caseId!=null){ + if(isMediaBook != null && isMediaBook == 1 ){ if(StrUtil.isNotEmpty(suffix)&&!suffix.equals("pdf")){ return AjaxResult.error("请上传pdf格式文件"); } annexType=AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode(); // 先删除之前的附件 - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId, annexType); + if(caseId!=null) { + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseId, annexType); + } } Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename(), caseId); // 是否上传到onlyoffice -- 2.54.0 From 44b50777fbe6040ceb978001e1fbbc159953203c Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Mon, 6 May 2024 15:52:40 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MsCaseApplicationServiceImpl.java | 32 ++++++++++++------- .../mscase/MsCaseApplicationMapper.xml | 4 +-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index 14b1599..6414647 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -283,8 +283,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { boolean isMediatorRole=false; // 查询申请人和被申请人 List caseIds = list.stream().map(MsCaseApplicationVO::getId).collect(Collectors.toList()); - Integer mediatorSort = flowNameMap.get("待调解"); + Integer signSort = flowNameMap.get("待签名"); Integer sendSort = flowNameMap.get("待送达"); + Integer mediatorSort = flowNameMap.get("待调解"); List affiliateList = msCaseAffiliateMapper.selectUserRoleByCaseIds(caseIds); // 根据案件id分组 Map> affiliateMap=null; @@ -378,11 +379,22 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { }else { vo.setSignButtonFlag(0); } - // 调解员,并且在待调节后,送达前,显示 - if(mediatorSort!=null && sendSort!=null && isMediatorRole - && null!=flowNameMap.get(vo.getCaseStatusName()) - && flowNameMap.get(vo.getCaseStatusName())>mediatorSort - && flowNameMap.get(vo.getCaseStatusName())<=sendSort){ + // 1需要用印 + boolean sealFlag = vo.getSealFlag() == null || !vo.getSealFlag().equals(1); + // 调解书按钮,线下调解(待调解后,送达前)或者线上调解(调解员,法律顾问在不用印,签名后,送达前,)显示 + + boolean sendFlag=sendSort != null && null != flowNameMap.get(vo.getCaseStatusName()) && flowNameMap.get(vo.getCaseStatusName()) <= sendSort; + // 是否线上调解 + boolean offlineMediatorFlag=vo.getMediationMethod()!=null && vo.getMediationMethod().equals("1"); + // 线上调解调解书按钮 + boolean onlineMediatorFileFlag = offlineMediatorFlag && sealFlag && signSort != null + && flowNameMap.get(vo.getCaseStatusName()) > signSort + && sendFlag; + // 线下调解调解书按钮 + boolean offlineMediatorFileFlag=!offlineMediatorFlag && mediatorSort!=null && flowNameMap.get(vo.getCaseStatusName()) > mediatorSort + && sendFlag; + // 调解员调解书按钮 + if ( isMediatorRole && (onlineMediatorFileFlag || offlineMediatorFileFlag)) { vo.setMediationFileFlag(1); } for (SysRole role : roles) { @@ -394,10 +406,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { ){ vo.setOtherFlag(1); } - if(role.getRoleName().equals("法律顾问") && mediatorSort!=null && sendSort!=null - && null!=flowNameMap.get(vo.getCaseStatusName()) - && flowNameMap.get(vo.getCaseStatusName())>mediatorSort - && flowNameMap.get(vo.getCaseStatusName())<=sendSort){ + + if(role.getRoleName().equals("法律顾问") && (onlineMediatorFileFlag || offlineMediatorFileFlag) ){ // 顾问可以上传下载调解书 vo.setMediationFileFlag(1); } @@ -2613,7 +2623,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 线上调解 if (application.getMediationMethod().equals("1")) { - Integer mediaResult = application.getMediaResult(); + Integer mediaResult = application.getMediaResult()==null ? req.getMediaResult():application.getMediaResult(); if (mediaResult == null) { return AjaxResult.error("请选择调解结果"); } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml index fad5ed2..1d5192b 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml @@ -113,7 +113,7 @@