Просмотр исходного кода

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

qtz 2 лет назад
Родитель
Сommit
4ad79ff910

+ 2
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java Просмотреть файл

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
6 6
 import com.ruoyi.common.core.controller.BaseController;
7 7
 import com.ruoyi.common.core.domain.AjaxResult;
8 8
 import com.ruoyi.common.core.page.TableDataInfo;
9
+import com.ruoyi.common.exception.EsignDemoException;
9 10
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
10 11
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
11 12
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO;
@@ -235,7 +236,7 @@ public class MsCaseApplicationController extends BaseController {
235 236
      * @return
236 237
      */
237 238
     @PostMapping("/confirmMediation")
238
-    public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach)   {
239
+    public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach) throws EsignDemoException, InterruptedException {
239 240
         if (attach.getCaseFlowId()==null || attach.getCaseAppliId()==null ) {
240 241
             return error("参数校验失败");
241 242
         }

+ 2
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java Просмотреть файл

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.mscase;
2 2
 
3 3
 import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.common.exception.EsignDemoException;
4 5
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
5 6
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
6 7
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
@@ -163,5 +164,5 @@ public interface MsCaseApplicationService {
163 164
      * @return
164 165
      */
165 166
 
166
-    AjaxResult confirmMediation(MsCaseAttachVO attach);
167
+    AjaxResult confirmMediation(MsCaseAttachVO attach) throws EsignDemoException, InterruptedException;
167 168
 }

+ 296
- 5
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Просмотреть файл

@@ -3,32 +3,42 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl;
3 3
 import cn.hutool.core.bean.BeanUtil;
4 4
 import cn.hutool.core.collection.CollectionUtil;
5 5
 import cn.hutool.core.util.StrUtil;
6
+import com.alibaba.fastjson.JSONArray;
7
+import com.alibaba.fastjson.JSONObject;
8
+import com.google.gson.Gson;
9
+import com.google.gson.JsonObject;
6 10
 import com.ruoyi.common.config.RuoYiConfig;
7 11
 import com.ruoyi.common.constant.Constants;
8 12
 import com.ruoyi.common.core.domain.AjaxResult;
9
-import com.ruoyi.common.core.domain.entity.SysDept;
10
-import com.ruoyi.common.core.domain.entity.SysDictData;
11
-import com.ruoyi.common.core.domain.entity.SysRole;
12
-import com.ruoyi.common.core.domain.entity.SysUser;
13
+import com.ruoyi.common.core.domain.entity.*;
13 14
 import com.ruoyi.common.core.domain.model.LoginUser;
14 15
 import com.ruoyi.common.enums.AnnexTypeEnum;
15 16
 import com.ruoyi.common.enums.YesOrNoEnum;
17
+import com.ruoyi.common.exception.EsignDemoException;
16 18
 import com.ruoyi.common.exception.ServiceException;
17 19
 import com.ruoyi.common.utils.*;
18 20
 import com.ruoyi.common.utils.file.FileUploadUtils;
21
+import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
19 22
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
20 23
 import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
21 24
 import com.ruoyi.system.mapper.*;
22 25
 import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
23 26
 import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper;
27
+import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
28
+import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
29
+import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
24 30
 import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
25 31
 import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
26 32
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
33
+import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
27 34
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
28 35
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
29 36
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
30 37
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
31 38
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*;
39
+import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
40
+import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper;
41
+import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
32 42
 import com.ruoyi.wisdomarbitrate.mapper.mscase.*;
33 43
 import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper;
34 44
 import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper;
@@ -36,6 +46,7 @@ import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper;
36 46
 import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
37 47
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
38 48
 import com.ruoyi.wisdomarbitrate.utils.OCRUtils;
49
+import com.ruoyi.wisdomarbitrate.utils.SignAward;
39 50
 import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
40 51
 import org.apache.pdfbox.pdmodel.PDDocument;
41 52
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
@@ -109,6 +120,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
109 120
     private SmsRecordMapper smsRecordMapper;
110 121
     @Autowired
111 122
     private MsCaseLogRecordMapper caseLogRecordMapper;
123
+    @Autowired
124
+    private SysUserMapper sysUserMapper;
125
+    @Autowired
126
+    private DeptIdentifyMapper deptIdentifyMapper;
127
+    @Autowired
128
+    private SealManageMapper sealManageMapper;
129
+    @Autowired
130
+    private MsSealSignRecordMapper sealSignRecordMapper;
112 131
     // 案件基本字段
113 132
     public static final List<String> CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule");
114 133
     public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -1011,7 +1030,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1011 1030
     @Transactional
1012 1031
 
1013 1032
     @Override
1014
-    public AjaxResult confirmMediation(MsCaseAttachVO attach) {
1033
+    public AjaxResult confirmMediation(MsCaseAttachVO attach) throws EsignDemoException, InterruptedException {
1015 1034
         if(attach.getAnnexId()!=null){
1016 1035
             // 删除之前的调解书
1017 1036
             msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
@@ -1019,6 +1038,278 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1019 1038
         }
1020 1039
         // 更新流程节点
1021 1040
         nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
1041
+
1042
+        Long id = attach.getCaseAppliId();
1043
+        MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
1044
+        // 查询案件相关人员
1045
+        MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
1046
+        // 查询附件
1047
+        List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id);
1048
+        if (caseAttachList != null && caseAttachList.size() > 0) {
1049
+            for (MsCaseAttach caseAttach : caseAttachList) {
1050
+                if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
1051
+                    String prefix = "/profile";
1052
+                    int startIndex = prefix.length();
1053
+                    String annexPath = caseAttach.getAnnexPath();
1054
+                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
1055
+                    //获取文件上传地址
1056
+                    EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
1057
+                    String body = response.getBody();
1058
+                    if (body != null) {
1059
+                        JSONObject jsonObject = JSONObject.parseObject(body);
1060
+                        String fileId = jsonObject.getJSONObject("data").getString("fileId");
1061
+                        String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
1062
+                        //上传文件流
1063
+                        EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
1064
+                        JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
1065
+                        if (jsonObject1.getIntValue("errCode") == 0) {
1066
+                            //查看文件上传状态
1067
+                            Thread.sleep(1000);
1068
+                            EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
1069
+                            JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
1070
+                            JSONObject data = jsonObject2.getJSONObject("data");
1071
+                            int fileStatus = data.getIntValue("fileStatus");
1072
+                            if (fileStatus == 2 || fileStatus == 5) {
1073
+                                String fileName = data.getString("fileName");
1074
+                                //上传成功,获取文件签名印章位置
1075
+                                SealSignRecord sealSignRecord = new SealSignRecord();
1076
+                                sealSignRecord.setFileid(fileId);
1077
+                                EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
1078
+                                Gson gson = new Gson();
1079
+                                JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
1080
+                                JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
1081
+                                String keywordPositions = positionsData.get("keywordPositions").toString();
1082
+                                //发起签署
1083
+                                sealSignRecord.setFilename(fileName);
1084
+
1085
+                                String arbitratorId = caseApplication.getMediatorId();
1086
+                                if (StringUtils.isNotEmpty(arbitratorId)) {
1087
+                                    SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
1088
+                                    if (sysUser == null) {
1089
+                                        return AjaxResult.error();
1090
+                                    }
1091
+                                    sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
1092
+                                    sealSignRecord.setPensonNameMedi(sysUser.getNickName());
1093
+                                }
1094
+
1095
+                                sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1096
+                                sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
1097
+                                sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone());
1098
+                                sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName());
1099
+
1100
+                                DeptIdentify deptIdentify = new DeptIdentify();
1101
+                                deptIdentify.setIsUse(1);
1102
+                                DeptIdentify deptIdentifyselect = new DeptIdentify();
1103
+                                List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
1104
+                                if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
1105
+                                    deptIdentifyselect = deptIdentifysnew.get(0);
1106
+                                    sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName());
1107
+                                    sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone());
1108
+                                    sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName());
1109
+                                } else {
1110
+                                    return AjaxResult.error("没有用印时的机构名称及经办人信息");
1111
+                                }
1112
+
1113
+                                //解析文件签名印章位置
1114
+                                JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
1115
+                                for (int i = 0; i < jsonArray.size(); i++) {
1116
+                                    JSONObject jsonObject3 = jsonArray.getJSONObject(i);
1117
+                                    String keyword = jsonObject3.getString("keyword");
1118
+                                    if (keyword.equals("甲方(签字):")) {
1119
+                                        //签名
1120
+                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
1121
+                                        // 遍历 positionsArray 中的每个元素
1122
+                                        for (int j = 0; j < positionsArray.size(); j++) {
1123
+                                            JSONObject positionObj = positionsArray.getJSONObject(j);
1124
+                                            int pageNum = positionObj.getIntValue("pageNum");
1125
+                                            sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
1126
+                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
1127
+                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
1128
+                                            double positionX = coordinateObj.getDoubleValue("positionX");
1129
+                                            double positionY = coordinateObj.getDoubleValue("positionY");
1130
+                                            sealSignRecord.setPositionXpsn(positionX + 90);
1131
+                                            sealSignRecord.setPositionYpsn(positionY + 30);
1132
+                                        }
1133
+                                    }else if (keyword.equals("乙方(签字):")) {
1134
+                                        //签名
1135
+                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
1136
+                                        // 遍历 positionsArray 中的每个元素
1137
+                                        for (int j = 0; j < positionsArray.size(); j++) {
1138
+                                            JSONObject positionObj = positionsArray.getJSONObject(j);
1139
+                                            int pageNum = positionObj.getIntValue("pageNum");
1140
+                                            sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
1141
+                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
1142
+                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
1143
+                                            double positionX = coordinateObj.getDoubleValue("positionX");
1144
+                                            double positionY = coordinateObj.getDoubleValue("positionY");
1145
+                                            sealSignRecord.setPositionXpsnRes(positionX + 90);
1146
+                                            sealSignRecord.setPositionYpsnRes(positionY);
1147
+                                        }
1148
+                                    }else if (keyword.equals("调解员(签字):")) {
1149
+                                        //签名
1150
+                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
1151
+                                        // 遍历 positionsArray 中的每个元素
1152
+                                        for (int j = 0; j < positionsArray.size(); j++) {
1153
+                                            JSONObject positionObj = positionsArray.getJSONObject(j);
1154
+                                            int pageNum = positionObj.getIntValue("pageNum");
1155
+                                            sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum));
1156
+                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
1157
+                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
1158
+                                            double positionX = coordinateObj.getDoubleValue("positionX");
1159
+                                            double positionY = coordinateObj.getDoubleValue("positionY");
1160
+                                            sealSignRecord.setPositionXpsnMedi(positionX + 90);
1161
+                                            sealSignRecord.setPositionYpsnMedi(positionY);
1162
+                                        }
1163
+                                    }else {
1164
+                                        //用印
1165
+                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
1166
+                                        // 遍历 positionsArray 中的每个元素
1167
+                                        for (int j = 0; j < positionsArray.size(); j++) {
1168
+                                            JSONObject positionObj = positionsArray.getJSONObject(j);
1169
+                                            int pageNum = positionObj.getIntValue("pageNum");
1170
+                                            sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
1171
+                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
1172
+                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
1173
+                                            double positionX = coordinateObj.getDoubleValue("positionX");
1174
+                                            double positionY = coordinateObj.getDoubleValue("positionY");
1175
+                                            sealSignRecord.setPositionXorg(positionX + 90);
1176
+                                            sealSignRecord.setPositionYorg(positionY);
1177
+                                        }
1178
+                                    }
1179
+                                }
1180
+                                        /*DeptIdentify deptIdentify1 = new DeptIdentify();
1181
+                                        deptIdentify1.setSealStatus(1); // 印章状态为启用
1182
+                                        //根据机构名称查询部门id
1183
+                                        SysDept sysDept = new SysDept();
1184
+                                        sysDept.setDeptName(sealSignRecord.getOrgnizeName());
1185
+                                        List<SysDept> sysDepts = deptMapper.selectDeptList(sysDept);
1186
+                                        if (sysDepts != null && sysDepts.size() > 0) {
1187
+                                            Long deptId = sysDepts.get(0).getDeptId();
1188
+                                            deptIdentify1.setDeptId(deptId);
1189
+                                        }
1190
+                                        List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1);
1191
+                                        List<String> sealIds = new ArrayList<>();
1192
+                                        if (deptIdentifies != null && deptIdentifies.size() > 0) {
1193
+                                            for (DeptIdentify identify : deptIdentifies) {
1194
+                                                String sealId = identify.getSealId();
1195
+                                                sealIds.add(sealId);
1196
+                                            }
1197
+                                        }*/
1198
+                                String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称
1199
+                                String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名
1200
+                                String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式
1201
+                                //查询机构信息
1202
+                                DeptIdentify deptIdentify1 = new DeptIdentify();
1203
+                                deptIdentify1.setIdentifyName(orgnizeName);
1204
+                                deptIdentify1.setOperName(orgnizeNamepsnName);
1205
+                                deptIdentify1.setOperPhone(orgnizeNamePsnAccount);
1206
+                                List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1);
1207
+                                if (deptIdentifies != null && deptIdentifies.size() > 0) {
1208
+                                    Long iddeptIdent = deptIdentifies.get(0).getId();
1209
+                                    SealManage sealManage = new SealManage();
1210
+                                    sealManage.setIdentifyId(iddeptIdent);
1211
+                                    List<String> sealIdList = new ArrayList<>();
1212
+                                    List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
1213
+                                    if (selectSealList != null && selectSealList.size() > 0) {
1214
+                                        for (SealManage manage : selectSealList) {
1215
+                                            Integer sealStatus = manage.getSealStatus();
1216
+                                            Integer isUse = manage.getIsUse();
1217
+                                            if (sealStatus == 1 && isUse ==1) {
1218
+                                                sealIdList.add(manage.getSealId());
1219
+                                            }
1220
+                                        }
1221
+                                        EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList);
1222
+
1223
+                                        JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1224
+                                        if (jsonObject3 != null) {
1225
+                                            if (jsonObject3.getIntValue("code") == 0) {
1226
+                                                //获取签署流程ID
1227
+                                                JSONObject data1 = jsonObject3.getJSONObject("data");
1228
+                                                String signFlowId = data1.getString("signFlowId");
1229
+                                                //保存案件id,文件id,文件名称.流程id到签署用印记录表里
1230
+                                                sealSignRecord.setCaseAppliId(caseApplication.getId());
1231
+                                                sealSignRecord.setSignFlowid(signFlowId);
1232
+                                                sealSignRecord.setSignFlowStatus(1);//待签名
1233
+                                                MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
1234
+                                                BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
1235
+                                                msSealSignRecord.setFileId(sealSignRecord.getFileid());
1236
+                                                msSealSignRecord.setFileName(sealSignRecord.getFilename());
1237
+                                                msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
1238
+                                                msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount());
1239
+                                                msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName());
1240
+                                                sealSignRecordMapper.insert(msSealSignRecord);
1241
+
1242
+                                                SealSignRecord sealSignRecordapply = new SealSignRecord();
1243
+                                                sealSignRecordapply.setSignFlowid(signFlowId);
1244
+                                                sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1245
+                                                EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
1246
+                                                JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
1247
+                                                JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
1248
+                                                String urlapply = signUrlData.get("shortUrl").getAsString();
1249
+                                                String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
1250
+
1251
+                                                //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
1252
+                                                SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1253
+                                                request.setTemplateId("2047719");
1254
+                                                request.setPhone(caseAffiliate.getContactTelphoneAgent());
1255
+                                                request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew});
1256
+                                                Boolean aBoolean = SmsUtils.sendSms(request);
1257
+
1258
+                                                SealSignRecord sealSignRecordRespon = new SealSignRecord();
1259
+                                                sealSignRecordRespon.setSignFlowid(signFlowId);
1260
+                                                sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
1261
+                                                EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
1262
+                                                JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
1263
+                                                JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
1264
+                                                String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
1265
+                                                String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
1266
+
1267
+                                                SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
1268
+                                                request1.setTemplateId("2047719");
1269
+                                                request1.setPhone(caseAffiliate.getRespondentPhone());
1270
+                                                request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew});
1271
+                                                Boolean aBoolean1 = SmsUtils.sendSms(request1);
1272
+
1273
+                                                SealSignRecord sealSignRecordMedi = new SealSignRecord();
1274
+                                                sealSignRecordMedi.setSignFlowid(signFlowId);
1275
+                                                sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
1276
+                                                EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
1277
+                                                JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
1278
+                                                JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
1279
+                                                String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
1280
+                                                String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
1281
+
1282
+                                                SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
1283
+                                                requestMedi.setTemplateId("2047719");
1284
+                                                requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
1285
+                                                requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi});
1286
+                                                Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
1287
+
1288
+                                            } else {
1289
+                                                throw new ServiceException(jsonObject3.getString("message"));
1290
+                                            }
1291
+                                        } else {
1292
+                                            return AjaxResult.error();
1293
+                                        }
1294
+
1295
+                                    }
1296
+
1297
+
1298
+                                } else {
1299
+                                    return AjaxResult.error();
1300
+                                }
1301
+                            }
1302
+                        }
1303
+                    }
1304
+                    break;
1305
+                }
1306
+
1307
+            }
1308
+
1309
+        }
1310
+
1311
+
1312
+
1022 1313
         return AjaxResult.success();
1023 1314
     }
1024 1315
 

+ 27
- 13
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java Просмотреть файл

@@ -14,6 +14,7 @@ import com.ruoyi.common.constant.CaseApplicationConstants;
14 14
 import com.ruoyi.common.core.domain.AjaxResult;
15 15
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
16 16
 import com.ruoyi.common.core.domain.entity.SysUser;
17
+import com.ruoyi.common.enums.AnnexTypeEnum;
17 18
 import com.ruoyi.common.enums.YesOrNoEnum;
18 19
 import com.ruoyi.common.exception.EsignDemoException;
19 20
 import com.ruoyi.common.exception.ServiceException;
@@ -110,9 +111,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
110 111
         List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id);
111 112
         if (caseAttachList != null && caseAttachList.size() > 0) {
112 113
             for (MsCaseAttach caseAttach : caseAttachList) {
113
-                if (caseAttach.getAnnexType() == 3) {
114
+                if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
115
+//                    String annexPath = caseAttach.getAnnexPath();
116
+//                    String path = "/home/ruoyi" + annexPath;
117
+                    String prefix = "/profile";
118
+                    int startIndex = prefix.length();
114 119
                     String annexPath = caseAttach.getAnnexPath();
115
-                    String path = "/home/ruoyi" + annexPath;
120
+//                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
121
+                    String path = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\12\\f8551b0e003e4af89acae7b500dacb77调解书.docx";
116 122
                     //获取文件上传地址
117 123
                     EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
118 124
                     String body = response.getBody();
@@ -176,7 +182,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
176 182
                                 for (int i = 0; i < jsonArray.size(); i++) {
177 183
                                     JSONObject jsonObject3 = jsonArray.getJSONObject(i);
178 184
                                     String keyword = jsonObject3.getString("keyword");
179
-                                    if (keyword.equals("申请人:")) {
185
+                                    if (keyword.equals("甲方(签字):")) {
180 186
                                         //签名
181 187
                                         JSONArray positionsArray = jsonObject3.getJSONArray("positions");
182 188
                                         // 遍历 positionsArray 中的每个元素
@@ -191,7 +197,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
191 197
                                             sealSignRecord.setPositionXpsn(positionX + 90);
192 198
                                             sealSignRecord.setPositionYpsn(positionY + 30);
193 199
                                         }
194
-                                    }else if (keyword.equals("被申请人:")) {
200
+                                    }else if (keyword.equals("乙方(签字):")) {
195 201
                                         //签名
196 202
                                         JSONArray positionsArray = jsonObject3.getJSONArray("positions");
197 203
                                         // 遍历 positionsArray 中的每个元素
@@ -206,7 +212,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
206 212
                                             sealSignRecord.setPositionXpsnRes(positionX + 90);
207 213
                                             sealSignRecord.setPositionYpsnRes(positionY);
208 214
                                         }
209
-                                    }else if (keyword.equals("调解员:")) {
215
+                                    }else if (keyword.equals("调解员(签字):")) {
210 216
                                         //签名
211 217
                                         JSONArray positionsArray = jsonObject3.getJSONArray("positions");
212 218
                                         // 遍历 positionsArray 中的每个元素
@@ -523,11 +529,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
523 529
                 List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
524 530
                 if (caseAttachList != null && caseAttachList.size() > 0) {
525 531
                     for (MsCaseAttach caseAttach : caseAttachList) {
526
-                        if (caseAttach.getAnnexType() == 3) {
527
-                            String annexName = caseAttach.getAnnexName();
528
-                            String prefix = "/profile/upload/";
532
+                        if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
533
+//                            String annexName = caseAttach.getAnnexName();
534
+//                            String prefix = "/profile/upload/";
535
+//                            int startIndex = prefix.length();
536
+//                            String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
537
+                            String prefix = "/profile";
529 538
                             int startIndex = prefix.length();
530
-                            String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
539
+                            String annexPath = caseAttach.getAnnexPath();
540
+                            String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
531 541
                             File file = new File(path);
532 542
                             // todo 部署放开
533 543
                             if (!file.exists()) {
@@ -671,11 +681,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
671 681
         File file = null;
672 682
         if (caseAttachList != null && caseAttachList.size() > 0) {
673 683
             for (MsCaseAttach caseAttach : caseAttachList) {
674
-                if (caseAttach.getAnnexType() == 3) {
675
-                    String annexName = caseAttach.getAnnexName();
676
-                    String prefix = "/profile/upload/";
684
+                if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
685
+//                    String annexName = caseAttach.getAnnexName();
686
+//                    String prefix = "/profile/upload/";
687
+//                    int startIndex = prefix.length();
688
+//                    String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
689
+                    String prefix = "/profile";
677 690
                     int startIndex = prefix.length();
678
-                    String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
691
+                    String annexPath = caseAttach.getAnnexPath();
692
+                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
679 693
                     // todo 部署放开
680 694
                     file = new File(path);
681 695
                     fileList.add(file);

+ 5
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Просмотреть файл

@@ -335,8 +335,10 @@ public class FixSelectFlowDetailUtils {
335 335
                                 String day = String.format("%02d", now.getDayOfMonth());
336 336
                                 String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
337 337
                                 String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
338
-                                String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
339
-                                String savePath = "/home/ruoyi/uploadPath/upload/";
338
+//                                String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
339
+//                                String savePath = "/home/ruoyi/uploadPath/upload/";
340
+                                String saveName = fileName;
341
+                                String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
340 342
 
341 343
                                 // 创建日期目录
342 344
                                 File saveFolder = new File(saveFolderPath);
@@ -355,7 +357,7 @@ public class FixSelectFlowDetailUtils {
355 357
                                     Long caseAppliId = sealSignRecord.getCaseAppliId();
356 358
                                     MsCaseAttach caseAttach = new MsCaseAttach();
357 359
                                     caseAttach.setCaseAppliId(caseAppliId);
358
-                                    caseAttach.setAnnexType(3);
360
+                                    caseAttach.setAnnexType(7);
359 361
                                     caseAttach.setAnnexPath(savePath);
360 362
                                     caseAttach.setAnnexName(saveName);
361 363
                                     caseAttachMapper.updateCaseAttachBycaseid(caseAttach);

+ 4
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java Просмотреть файл

@@ -728,10 +728,10 @@ public class SignAward {
728 728
         String apiaddr = "/v3/files/" + fileId + "/keyword-positions";
729 729
         String jsonParm = "{\n" +
730 730
                 "    \"keywords\": [\n" +
731
-                "        \"申请人:\",\n" +
732
-                "        \"被申请人:\",\n" +
733
-                "        \"调解员:\",\n" +
734
-                "        \"(盖章)\"\n" +
731
+                "        \"甲方(签字):\",\n" +
732
+                "        \"乙方(签字):\",\n" +
733
+                "        \"调解员(签字):\",\n" +
734
+                "        \"调解机构(盖章):\"\n" +
735 735
                 "    ]\n" +
736 736
                 "}";
737 737
         //请求方法