Selaa lähdekoodia

Merge branch 'qtz1' of SH-Arbitrate/Mediation-Backend into dev

qtz 2 vuotta sitten
vanhempi
commit
6ce906e04c

+ 20
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsSignSealController.java Näytä tiedosto

@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.wisdomarbitrate.mscase;
2 2
 
3 3
 import cn.hutool.core.collection.CollectionUtil;
4 4
 import cn.hutool.core.util.StrUtil;
5
+import cn.hutool.json.JSONUtil;
6
+import com.ruoyi.common.annotation.Anonymous;
5 7
 import com.ruoyi.common.core.controller.BaseController;
6 8
 import com.ruoyi.common.core.domain.AjaxResult;
7 9
 import com.ruoyi.common.exception.EsignDemoException;
@@ -10,6 +12,8 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
10 12
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
11 13
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
12 14
 import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
15
+import com.ruoyi.wisdomarbitrate.utils.SignVerifyUtils;
16
+import org.springframework.beans.BeanUtils;
13 17
 import org.springframework.beans.factory.annotation.Autowired;
14 18
 import org.springframework.validation.annotation.Validated;
15 19
 import org.springframework.web.bind.annotation.PostMapping;
@@ -57,6 +61,22 @@ public class MsSignSealController  extends BaseController {
57 61
         return success(sealUrlRecordselect);
58 62
     }
59 63
 
64
+    /**
65
+     * 签名用印回调
66
+     */
67
+    @Anonymous
68
+    @PostMapping("/signSeaalCaseApplicaCallback")
69
+    public AjaxResult signSeaalCaseApplicaCallback() throws Exception {
70
+        boolean checkResult= SignVerifyUtils.checkSignuter();
71
+        if(checkResult){
72
+            String reqbodystr =SignVerifyUtils.getRequestBody();
73
+            return msSignSealService.signSeaalCaseApplicaCallback(reqbodystr);
74
+        }else {
75
+            return AjaxResult.error("error");
76
+        }
77
+
78
+    }
79
+
60 80
     /**
61 81
      * 查询案件进度
62 82
      */

+ 3
- 0
ruoyi-admin/src/main/resources/application.yml Näytä tiedosto

@@ -191,6 +191,9 @@ organizeConfig:
191 191
 #  引入仲裁系统url配置
192 192
 arbitrateConfig:
193 193
   url: http://121.40.189.20:9001/callArbitrateCaseApplication/generateCaseApplication
194
+# 回调通知
195
+signSealCallbackConfig:
196
+  url: http://121.40.189.20:6001/mssignSeal/signSeaalCaseApplicaCallback
194 197
 #jodconverter:
195 198
 #  local:
196 199
 #    host: 121.40.189.20

+ 3
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java Näytä tiedosto

@@ -7,6 +7,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
7 7
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
8 8
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
9 9
 
10
+import java.io.IOException;
10 11
 import java.util.List;
11 12
 
12 13
 public interface MsSignSealService {
@@ -34,4 +35,6 @@ public interface MsSignSealService {
34 35
     AjaxResult msCaseSignUrlApplyAPP(MsSignSealDTO dto) throws EsignDemoException;
35 36
 
36 37
     AjaxResult msCaseSignUrlResAPP(MsSignSealDTO dto) throws EsignDemoException;
38
+
39
+    AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException;
37 40
 }

+ 287
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java Näytä tiedosto

@@ -60,6 +60,7 @@ import tk.mybatis.mapper.entity.Example;
60 60
 
61 61
 import javax.annotation.Resource;
62 62
 import java.io.File;
63
+import java.io.IOException;
63 64
 import java.time.LocalDate;
64 65
 import java.util.*;
65 66
 import java.util.stream.Collectors;
@@ -83,6 +84,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
83 84
     MsCaseFlowMapper caseFlowMapper;
84 85
     @Autowired
85 86
     private SysUserMapper userMapper;
87
+    @Autowired
88
+    private MsCaseAttachMapper caseAttachMapper;
86 89
 
87 90
     @Autowired
88 91
     private SysUserMapper sysUserMapper;
@@ -1008,6 +1011,290 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1008 1011
         return AjaxResult.success(sealSignRecordres);
1009 1012
     }
1010 1013
 
1014
+    @Override
1015
+    @Transactional(rollbackFor = Exception.class)
1016
+    public AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException {
1017
+
1018
+        System.out.println("请求参数reqbodystr:----------->>>>>>"+reqbodystr);
1019
+
1020
+        JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
1021
+        Gson gson = new Gson();
1022
+        if (jsonObjectCallback != null) {
1023
+            int signResult = jsonObjectCallback.getIntValue("signResult");
1024
+            String action = jsonObjectCallback.getString("action");
1025
+            String signFlowId = jsonObjectCallback.getString("signFlowId");
1026
+            Long operateTime = jsonObjectCallback.getLongValue("operateTime");
1027
+            JSONObject operator = jsonObjectCallback.getJSONObject("operator");
1028
+            JSONObject psnAccount = operator.getJSONObject("psnAccount");
1029
+            String accountMobile = psnAccount.getString("accountMobile");
1030
+
1031
+            System.out.println("请求参数signResult:----------->>>>>>"+signResult);
1032
+            System.out.println("请求参数action:---------->>>>>>"+action);
1033
+            System.out.println("请求参数signFlowId:---------->>>>>>"+signFlowId);
1034
+            System.out.println("请求参数accountMobile:---------->>>>>>"+accountMobile);
1035
+
1036
+            Example msSealSignRecordExample = new Example(MsSealSignRecord.class);
1037
+            msSealSignRecordExample.createCriteria().andEqualTo("signFlowId", signFlowId);
1038
+            MsSealSignRecord sealSignRecordsel = sealSignRecordMapper.selectOneByExample(msSealSignRecordExample);
1039
+
1040
+            String pensonAccountApply = sealSignRecordsel.getPensonAccount();
1041
+            String orgnNamePsnAcc = sealSignRecordsel.getOrgnNamePsnAcc();
1042
+            String pensonAccountRes = sealSignRecordsel.getPensonAccountRes();
1043
+            String pensonAccountMedi = sealSignRecordsel.getPensonAccountMedi();
1044
+
1045
+            Integer signStatusApply = sealSignRecordsel.getSignStatusApply();
1046
+            Integer signStatusResponse = sealSignRecordsel.getSignStatusResponse();
1047
+            Integer signStatusMediator = sealSignRecordsel.getSignStatusMediator();
1048
+            Integer sealStatus = sealSignRecordsel.getSealStatus();
1049
+
1050
+            Long caseAppliId = sealSignRecordsel.getCaseAppliId();
1051
+            MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseAppliId);
1052
+            Integer mediaResult = caseApplicationselect.getMediaResult();
1053
+
1054
+            if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){
1055
+                if(mediaResult.intValue()==1){
1056
+                    //调解
1057
+                    if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
1058
+                        //申请人签名
1059
+                        sealSignRecordsel.setSignStatusApply(1);
1060
+                        sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1061
+                        if(signStatusResponse!=null&&signStatusResponse.intValue()==1&&
1062
+                                signStatusMediator!=null&&signStatusMediator.intValue()==1){
1063
+                            // 根据流程id查找下一个流程节点
1064
+                            MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
1065
+                            MsCaseApplication application = new MsCaseApplication();
1066
+                            application.setId(caseApplicationselect.getId());
1067
+                            application.setCaseFlowId(nextFlow.getId());
1068
+                            application.setCaseStatusName(nextFlow.getCaseStatusName());
1069
+                            caseApplicationMapper.updateByPrimaryKeySelective(application);
1070
+
1071
+                            //修改"签署用印记录表"的状态为待用印
1072
+                            sealSignRecordsel.setSignFlowStatus(2);
1073
+                            sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1074
+                        }
1075
+                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
1076
+                        //被申请人签名
1077
+                        sealSignRecordsel.setSignStatusResponse(1);
1078
+                        sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1079
+                        if(signStatusApply!=null&&signStatusApply.intValue()==1&&
1080
+                                signStatusMediator!=null&&signStatusMediator.intValue()==1){
1081
+                            // 根据流程id查找下一个流程节点
1082
+                            MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
1083
+                            MsCaseApplication application = new MsCaseApplication();
1084
+                            application.setId(caseApplicationselect.getId());
1085
+                            application.setCaseFlowId(nextFlow.getId());
1086
+                            application.setCaseStatusName(nextFlow.getCaseStatusName());
1087
+                            caseApplicationMapper.updateByPrimaryKeySelective(application);
1088
+
1089
+                            //修改"签署用印记录表"的状态为待用印
1090
+                            sealSignRecordsel.setSignFlowStatus(2);
1091
+                            sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1092
+                        }
1093
+                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){
1094
+                        //调解员签名
1095
+                        sealSignRecordsel.setSignStatusMediator(1);
1096
+                        sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1097
+                        if(signStatusApply!=null&&signStatusApply.intValue()==1&&
1098
+                                signStatusResponse!=null&&signStatusResponse.intValue()==1){
1099
+                            // 根据流程id查找下一个流程节点
1100
+                            MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
1101
+                            MsCaseApplication application = new MsCaseApplication();
1102
+                            application.setId(caseApplicationselect.getId());
1103
+                            application.setCaseFlowId(nextFlow.getId());
1104
+                            application.setCaseStatusName(nextFlow.getCaseStatusName());
1105
+                            caseApplicationMapper.updateByPrimaryKeySelective(application);
1106
+
1107
+                            //修改"签署用印记录表"的状态为待用印
1108
+                            sealSignRecordsel.setSignFlowStatus(2);
1109
+                            sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1110
+                        }
1111
+                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc)){
1112
+                        sealSignRecordsel.setSealStatus(1);
1113
+                        sealSignRecordsel.setSignFlowStatus(3);
1114
+                        sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1115
+
1116
+                        // 根据流程id查找下一个流程节点
1117
+                        MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
1118
+                        MsCaseApplication application = new MsCaseApplication();
1119
+                        application.setId(caseApplicationselect.getId());
1120
+                        application.setCaseFlowId(nextFlow.getId());
1121
+                        application.setCaseStatusName(nextFlow.getCaseStatusName());
1122
+                        caseApplicationMapper.updateByPrimaryKeySelective(application);
1123
+
1124
+                        //下载审核完成的调解书
1125
+                        EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1126
+                        JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1127
+                        JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
1128
+                        JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
1129
+                        if (filesArray != null && filesArray.size() > 0) {
1130
+                            JsonObject fileObject = (JsonObject) filesArray.get(0);
1131
+                            String fileDownloadUrl = fileObject.get("downloadUrl").toString();
1132
+                            LocalDate now = LocalDate.now();
1133
+                            String year = Integer.toString(now.getYear());
1134
+                            String month = String.format("%02d", now.getMonthValue());
1135
+                            String day = String.format("%02d", now.getDayOfMonth());
1136
+                            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
1137
+                            String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
1138
+//                                String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1139
+//                                String savePath = "/home/ruoyi/uploadPath/upload/";
1140
+                            String saveName = fileName;
1141
+                            String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1142
+
1143
+                            // 创建日期目录
1144
+                            File saveFolder = new File(saveFolderPath);
1145
+                            if (!saveFolder.exists()) {
1146
+                                saveFolder.mkdirs();
1147
+                            }
1148
+                            String resultFilePath = saveFolderPath + "/" + fileName;
1149
+                            File resultFilePathFile = new File(resultFilePath);
1150
+                            if (!resultFilePathFile.exists()) {
1151
+                                resultFilePathFile.createNewFile();
1152
+                            }
1153
+
1154
+                            String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
1155
+                            boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
1156
+                            if (downLoadFile) {
1157
+                                MsCaseAttach caseAttach = new MsCaseAttach();
1158
+                                caseAttach.setCaseAppliId(caseAppliId);
1159
+                                caseAttach.setAnnexType(7);
1160
+                                caseAttach.setAnnexPath(savePath);
1161
+                                caseAttach.setAnnexName(saveName);
1162
+                                caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
1163
+                            }
1164
+
1165
+                        }
1166
+                    }
1167
+
1168
+                }else if(mediaResult.intValue()==5){
1169
+                    //和解
1170
+                    if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
1171
+                        //申请人签名
1172
+                        sealSignRecordsel.setSignStatusApply(1);
1173
+                        sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1174
+                        if(signStatusResponse!=null&&signStatusResponse.intValue()==1){
1175
+                            MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue());
1176
+                            MsCaseApplication application = new MsCaseApplication();
1177
+                            application.setId(caseApplicationselect.getId());
1178
+                            application.setCaseFlowId(nextFlow.getId());
1179
+                            application.setCaseStatusName(nextFlow.getCaseStatusName());
1180
+                            caseApplicationMapper.updateByPrimaryKeySelective(application);
1181
+
1182
+                            //修改"签署用印记录表"的状态为完成
1183
+                            sealSignRecordsel.setSignFlowStatus(3);
1184
+                            sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1185
+
1186
+                            //下载审核完成的调解书
1187
+                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1188
+                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1189
+                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
1190
+                            JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
1191
+                            if (filesArray != null && filesArray.size() > 0) {
1192
+                                JsonObject fileObject = (JsonObject) filesArray.get(0);
1193
+                                String fileDownloadUrl = fileObject.get("downloadUrl").toString();
1194
+                                LocalDate now = LocalDate.now();
1195
+                                String year = Integer.toString(now.getYear());
1196
+                                String month = String.format("%02d", now.getMonthValue());
1197
+                                String day = String.format("%02d", now.getDayOfMonth());
1198
+                                String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
1199
+                                String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
1200
+//                                String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1201
+//                                String savePath = "/home/ruoyi/uploadPath/upload/";
1202
+                                String saveName = fileName;
1203
+                                String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1204
+
1205
+                                // 创建日期目录
1206
+                                File saveFolder = new File(saveFolderPath);
1207
+                                if (!saveFolder.exists()) {
1208
+                                    saveFolder.mkdirs();
1209
+                                }
1210
+                                String resultFilePath = saveFolderPath + "/" + fileName;
1211
+                                File resultFilePathFile = new File(resultFilePath);
1212
+                                if (!resultFilePathFile.exists()) {
1213
+                                    resultFilePathFile.createNewFile();
1214
+                                }
1215
+
1216
+                                String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
1217
+                                boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
1218
+                                if (downLoadFile) {
1219
+                                    MsCaseAttach caseAttach = new MsCaseAttach();
1220
+                                    caseAttach.setCaseAppliId(caseAppliId);
1221
+                                    caseAttach.setAnnexType(7);
1222
+                                    caseAttach.setAnnexPath(savePath);
1223
+                                    caseAttach.setAnnexName(saveName);
1224
+                                    caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
1225
+                                }
1226
+
1227
+                            }
1228
+                        }
1229
+                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
1230
+                        //被申请人签名
1231
+                        sealSignRecordsel.setSignStatusResponse(1);
1232
+                        sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1233
+                        if(signStatusApply!=null&&signStatusApply.intValue()==1){
1234
+                            MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue());
1235
+                            MsCaseApplication application = new MsCaseApplication();
1236
+                            application.setId(caseApplicationselect.getId());
1237
+                            application.setCaseFlowId(nextFlow.getId());
1238
+                            application.setCaseStatusName(nextFlow.getCaseStatusName());
1239
+                            caseApplicationMapper.updateByPrimaryKeySelective(application);
1240
+
1241
+                            //修改"签署用印记录表"的状态为完成
1242
+                            sealSignRecordsel.setSignFlowStatus(3);
1243
+                            sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1244
+
1245
+                            //下载审核完成的调解书
1246
+                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1247
+                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1248
+                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
1249
+                            JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
1250
+                            if (filesArray != null && filesArray.size() > 0) {
1251
+                                JsonObject fileObject = (JsonObject) filesArray.get(0);
1252
+                                String fileDownloadUrl = fileObject.get("downloadUrl").toString();
1253
+                                LocalDate now = LocalDate.now();
1254
+                                String year = Integer.toString(now.getYear());
1255
+                                String month = String.format("%02d", now.getMonthValue());
1256
+                                String day = String.format("%02d", now.getDayOfMonth());
1257
+                                String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
1258
+                                String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
1259
+//                                String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1260
+//                                String savePath = "/home/ruoyi/uploadPath/upload/";
1261
+                                String saveName = fileName;
1262
+                                String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1263
+
1264
+                                // 创建日期目录
1265
+                                File saveFolder = new File(saveFolderPath);
1266
+                                if (!saveFolder.exists()) {
1267
+                                    saveFolder.mkdirs();
1268
+                                }
1269
+                                String resultFilePath = saveFolderPath + "/" + fileName;
1270
+                                File resultFilePathFile = new File(resultFilePath);
1271
+                                if (!resultFilePathFile.exists()) {
1272
+                                    resultFilePathFile.createNewFile();
1273
+                                }
1274
+
1275
+                                String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
1276
+                                boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
1277
+                                if (downLoadFile) {
1278
+                                    MsCaseAttach caseAttach = new MsCaseAttach();
1279
+                                    caseAttach.setCaseAppliId(caseAppliId);
1280
+                                    caseAttach.setAnnexType(7);
1281
+                                    caseAttach.setAnnexPath(savePath);
1282
+                                    caseAttach.setAnnexName(saveName);
1283
+                                    caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
1284
+                                }
1285
+
1286
+                            }
1287
+                        }
1288
+                    }
1289
+                }
1290
+            }
1291
+
1292
+        }else{
1293
+            return AjaxResult.error("error");
1294
+        }
1295
+        return AjaxResult.success("success");
1296
+    }
1297
+
1011 1298
     /**
1012 1299
      * 通过邮件发送裁决书文件
1013 1300
      *

+ 51
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/DigesdateUtils.java Näytä tiedosto

@@ -0,0 +1,51 @@
1
+package com.ruoyi.wisdomarbitrate.utils;
2
+
3
+import javax.crypto.Mac;
4
+import javax.crypto.spec.SecretKeySpec;
5
+import java.io.UnsupportedEncodingException;
6
+import java.security.InvalidKeyException;
7
+import java.security.NoSuchAlgorithmException;
8
+
9
+public class DigesdateUtils {
10
+
11
+    public static String getSignStr(String paramsStr, String accessSec ) {
12
+        Mac macDiges = null;
13
+        try {
14
+            macDiges = Mac.getInstance("HmacSHA256");
15
+            SecretKeySpec accessSecKey = new SecretKeySpec(accessSec.getBytes("UTF-8"), "HmacSHA256");
16
+            macDiges.init(accessSecKey);
17
+            macDiges.update(paramsStr.getBytes("UTF-8"));
18
+        } catch (NoSuchAlgorithmException e) {
19
+            e.printStackTrace();
20
+            return null;
21
+        } catch (UnsupportedEncodingException e) {
22
+            e.printStackTrace();
23
+            return null;
24
+        } catch (InvalidKeyException e) {
25
+            e.printStackTrace();
26
+            return null;
27
+        }
28
+        return byteTrasferhex(macDiges.doFinal());
29
+    }
30
+
31
+    public static String byteTrasferhex(byte[] byteArrayData) {
32
+        StringBuilder hashBuilder = new StringBuilder();
33
+        String stmpHex;
34
+        for (int n = 0; byteArrayData != null && n < byteArrayData.length; n++) {
35
+            stmpHex = Integer.toHexString(byteArrayData[n] & 0XFF);
36
+            if (stmpHex.length() == 1){
37
+                hashBuilder.append('0');
38
+            }else {
39
+                hashBuilder.append(stmpHex);
40
+            }
41
+        }
42
+        return hashBuilder.toString();
43
+    }
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+}

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Näytä tiedosto

@@ -243,7 +243,7 @@ public class FixSelectFlowDetailUtils {
243 243
     /*
244 244
     定时查询签署流程详情
245 245
      */
246
-    @Scheduled(cron = "0/10 * * * * ?")
246
+//    @Scheduled(cron = "0/10 * * * * ?")
247 247
     @Transactional
248 248
     public void fixExecuteSelectFlowDetailUtils() {
249 249
         Gson gson = new Gson();

+ 5
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java Näytä tiedosto

@@ -12,6 +12,7 @@ import com.ruoyi.common.utils.SealUtil;
12 12
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
13 13
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
14 14
 import com.ruoyi.wisdomarbitrate.domain.vo.base.StringIdsReq;
15
+import org.springframework.beans.factory.annotation.Value;
15 16
 
16 17
 import java.util.List;
17 18
 import java.util.Map;
@@ -22,6 +23,9 @@ public class SignAward {
22 23
     private static String eSignAppId = EsignApplicaConfig.EsignAppId;
23 24
     private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
24 25
 
26
+    @Value("${signSealCallbackConfig.url}")
27
+    private static String signSealCallbackUrl;
28
+
25 29
 
26 30
     public static void main(String[] args) throws EsignDemoException {
27 31
         Gson gson = new Gson();
@@ -351,7 +355,7 @@ public class SignAward {
351 355
                 "       \"signConfig\": {\n" +
352 356
                 "           \"availableSignClientTypes\":  \"1\"\n" +
353 357
                 "       },\n" +
354
-
358
+                "        \"notifyUrl\": \"" + signSealCallbackUrl + "\",\n" +
355 359
                 "        \"autoFinish\": true\n" +
356 360
                 "    },\n" +
357 361
 

+ 99
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignVerifyUtils.java Näytä tiedosto

@@ -0,0 +1,99 @@
1
+package com.ruoyi.wisdomarbitrate.utils;
2
+
3
+import com.ruoyi.common.utils.EsignApplicaConfig;
4
+import com.ruoyi.common.utils.StringUtils;
5
+import org.springframework.web.context.request.RequestContextHolder;
6
+import org.springframework.web.context.request.ServletRequestAttributes;
7
+
8
+import javax.servlet.http.HttpServletRequest;
9
+import java.io.IOException;
10
+import java.io.UnsupportedEncodingException;
11
+import java.util.ArrayList;
12
+import java.util.Collections;
13
+import java.util.Enumeration;
14
+import java.util.List;
15
+
16
+public class SignVerifyUtils {
17
+    private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
18
+
19
+
20
+    public static boolean checkSignuter() throws Exception {
21
+        HttpServletRequest httprequest = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
22
+        String orialsignature =  httprequest.getHeader("X-Tsign-Open-SIGNATURE");
23
+        String timestampreq = httprequest.getHeader("X-Tsign-Open-TIMESTAMP");
24
+        String reqQuerystr =getHttpreqQuery();
25
+        //获取请求参数
26
+        String reqbodystr =getRequestBody();
27
+        String signOriaData = timestampreq + reqQuerystr + reqbodystr;
28
+        String newDisgSignuter= DigesdateUtils.getSignStr(signOriaData, eSignAppSecret);
29
+
30
+        System.out.println("请求参数timestampreq:----------->>>>>>"+timestampreq);
31
+        System.out.println("请求参数reqQuerystr:---------->>>>>>"+reqQuerystr);
32
+        System.out.println("请求参数reqbodystr:---------->>>>>>"+reqbodystr);
33
+        System.out.println("加密出来的签名值:----------->>>>>>"+newDisgSignuter);
34
+        System.out.println("header里面的签名值:---------->>>>>>"+orialsignature);
35
+
36
+        if (StringUtils.equals(orialsignature, newDisgSignuter)) {
37
+            return true;
38
+        }else {
39
+            return false;
40
+        }
41
+    }
42
+
43
+    public static  String getHttpreqQuery() {
44
+        HttpServletRequest httprequest = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
45
+        List<String> reqNames= new ArrayList();
46
+        Enumeration<String> httpreqEle =httprequest.getParameterNames();
47
+        while (httpreqEle.hasMoreElements()){
48
+            reqNames.add(httpreqEle.nextElement());
49
+        }
50
+        Collections.sort(reqNames);
51
+        String httpreqQuery = "";
52
+        for (String reqName : reqNames) {
53
+            String reqvalue = httprequest.getParameter(reqName);
54
+            httpreqQuery += reqvalue == null ? "" : reqvalue;
55
+        }
56
+        System.out.println("获取请求字符串是:---"+httpreqQuery);
57
+        return  httpreqQuery;
58
+    }
59
+
60
+    public static String getRequestBody() {
61
+        HttpServletRequest httprequest = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
62
+        String requestBody = "";
63
+        int reqContentLen = httprequest.getContentLength();
64
+        if (reqContentLen < 0) {
65
+            return null;
66
+        }
67
+        byte bufByteArray[] = new byte[reqContentLen];
68
+        try {
69
+            for (int i = 0; i < reqContentLen;) {
70
+                int lengthReadInputStream = httprequest.getInputStream().read(bufByteArray, i, reqContentLen - i);
71
+                if (lengthReadInputStream == -1) {
72
+                    break;
73
+                }
74
+                i += lengthReadInputStream;
75
+            }
76
+        } catch (IOException e) {
77
+            e.printStackTrace();
78
+        }
79
+        try {
80
+            requestBody = new String(bufByteArray, "UTF-8");
81
+        } catch (UnsupportedEncodingException e) {
82
+            e.printStackTrace();
83
+        }
84
+        return requestBody;
85
+    }
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+}