|
|
@@ -4,8 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
|
|
4
|
4
|
import cn.hutool.core.collection.CollectionUtil;
|
|
5
|
5
|
import cn.hutool.core.date.DatePattern;
|
|
6
|
6
|
import cn.hutool.core.date.DateUtil;
|
|
|
7
|
+import cn.hutool.core.io.FileUtil;
|
|
7
|
8
|
import cn.hutool.core.util.StrUtil;
|
|
8
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
9
|
9
|
import com.alibaba.fastjson.JSONObject;
|
|
10
|
10
|
import com.google.gson.Gson;
|
|
11
|
11
|
import com.google.gson.JsonArray;
|
|
|
@@ -16,18 +16,20 @@ import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
16
|
16
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
17
|
17
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
18
|
18
|
import com.ruoyi.common.enums.AnnexTypeEnum;
|
|
|
19
|
+import com.ruoyi.common.enums.AttachmentOperateTypeEnum;
|
|
|
20
|
+import com.ruoyi.common.enums.PushCaseStatusEnum;
|
|
19
|
21
|
import com.ruoyi.common.enums.YesOrNoEnum;
|
|
20
|
22
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
21
|
23
|
import com.ruoyi.common.exception.ServiceException;
|
|
22
|
24
|
import com.ruoyi.common.utils.EmailOutUtil;
|
|
23
|
25
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
24
|
|
-import com.ruoyi.common.utils.SmsUtils;
|
|
25
|
26
|
import com.ruoyi.common.utils.StringUtils;
|
|
26
|
27
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
27
|
28
|
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
|
|
28
|
29
|
import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
|
|
29
|
30
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
30
|
31
|
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
|
|
|
32
|
+import com.ruoyi.system.service.impl.BeiMingInterfaceService;
|
|
31
|
33
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
|
32
|
34
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
|
33
|
35
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord;
|
|
|
@@ -40,6 +42,7 @@ import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
|
|
40
|
42
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
|
41
|
43
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
|
|
42
|
44
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
|
|
45
|
+import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo;
|
|
43
|
46
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
|
44
|
47
|
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
|
|
45
|
48
|
import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper;
|
|
|
@@ -54,6 +57,7 @@ import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
|
|
54
|
57
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
55
|
58
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
|
56
|
59
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
60
|
+import org.springframework.beans.factory.annotation.Value;
|
|
57
|
61
|
import org.springframework.stereotype.Service;
|
|
58
|
62
|
import org.springframework.transaction.annotation.Transactional;
|
|
59
|
63
|
import tk.mybatis.mapper.entity.Example;
|
|
|
@@ -106,286 +110,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
106
|
110
|
|
|
107
|
111
|
@Autowired
|
|
108
|
112
|
private SendMailRecordMapper sendMailRecordMapper;
|
|
|
113
|
+ // 北明配置
|
|
|
114
|
+ @Value("${BMConfig.userName}")
|
|
|
115
|
+ private String BMUserName;
|
|
|
116
|
+ @Value("${BMConfig.password}")
|
|
|
117
|
+ private String BMPassword;
|
|
|
118
|
+ @Value("${BMConfig.syncSource}")
|
|
|
119
|
+ private String BMSyncSource;
|
|
|
120
|
+ @Autowired
|
|
|
121
|
+ BeiMingInterfaceService beiMingInterfaceService;
|
|
109
|
122
|
|
|
110
|
123
|
|
|
111
|
124
|
|
|
112
|
125
|
|
|
113
|
|
- @Override
|
|
114
|
|
- @Transactional
|
|
115
|
|
- public AjaxResult sureMediationSeal(MsCaseApplicationVO caseApplicationVO) throws EsignDemoException, InterruptedException {
|
|
116
|
|
- Long id = caseApplicationVO.getId();
|
|
117
|
|
- MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
118
|
|
- // 查询案件相关人员
|
|
119
|
|
- MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
|
|
120
|
|
- // 查询附件
|
|
121
|
|
- List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(id);
|
|
122
|
|
- if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
123
|
|
- for (MsCaseAttach caseAttach : caseAttachList) {
|
|
124
|
|
- if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
|
125
|
|
-// String annexPath = caseAttach.getAnnexPath();
|
|
126
|
|
-// String path = "/home/ruoyi" + annexPath;
|
|
127
|
|
- String prefix = "/profile";
|
|
128
|
|
- int startIndex = prefix.length();
|
|
129
|
|
- String annexPath = caseAttach.getAnnexPath();
|
|
130
|
|
-// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
|
|
131
|
|
- String path = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\12\\f8551b0e003e4af89acae7b500dacb77调解书.docx";
|
|
132
|
|
- //获取文件上传地址
|
|
133
|
|
- EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
|
134
|
|
- String body = response.getBody();
|
|
135
|
|
- if (body != null) {
|
|
136
|
|
- JSONObject jsonObject = JSONObject.parseObject(body);
|
|
137
|
|
- String fileId = jsonObject.getJSONObject("data").getString("fileId");
|
|
138
|
|
- String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
|
|
139
|
|
- //上传文件流
|
|
140
|
|
- EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
|
|
141
|
|
- JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
|
|
142
|
|
- if (jsonObject1.getIntValue("errCode") == 0) {
|
|
143
|
|
- //查看文件上传状态
|
|
144
|
|
- Thread.sleep(1000);
|
|
145
|
|
- EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
|
|
146
|
|
- JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
|
|
147
|
|
- JSONObject data = jsonObject2.getJSONObject("data");
|
|
148
|
|
- int fileStatus = data.getIntValue("fileStatus");
|
|
149
|
|
- if (fileStatus == 2 || fileStatus == 5) {
|
|
150
|
|
- String fileName = data.getString("fileName");
|
|
151
|
|
- //上传成功,获取文件签名印章位置
|
|
152
|
|
- SealSignRecord sealSignRecord = new SealSignRecord();
|
|
153
|
|
- sealSignRecord.setFileid(fileId);
|
|
154
|
|
- EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
|
|
155
|
|
- Gson gson = new Gson();
|
|
156
|
|
- JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
|
|
157
|
|
- JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
|
|
158
|
|
- String keywordPositions = positionsData.get("keywordPositions").toString();
|
|
159
|
|
- //发起签署
|
|
160
|
|
- sealSignRecord.setFilename(fileName);
|
|
161
|
|
-
|
|
162
|
|
- Long arbitratorId = caseApplication.getMediatorId();
|
|
163
|
|
- if (arbitratorId!=null) {
|
|
164
|
|
- SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
|
|
165
|
|
- if (sysUser == null) {
|
|
166
|
|
- return AjaxResult.error();
|
|
167
|
|
- }
|
|
168
|
|
- sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
|
|
169
|
|
- sealSignRecord.setPensonNameMedi(sysUser.getNickName());
|
|
170
|
|
- }
|
|
171
|
|
-
|
|
172
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
173
|
|
- sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
|
|
174
|
|
- sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone());
|
|
175
|
|
- sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName());
|
|
176
|
|
-
|
|
177
|
|
- DeptIdentify deptIdentify = new DeptIdentify();
|
|
178
|
|
- deptIdentify.setIsUse(1);
|
|
179
|
|
- DeptIdentify deptIdentifyselect = new DeptIdentify();
|
|
180
|
|
- List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
|
181
|
|
- if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
|
|
182
|
|
- deptIdentifyselect = deptIdentifysnew.get(0);
|
|
183
|
|
- sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName());
|
|
184
|
|
- sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone());
|
|
185
|
|
- sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName());
|
|
186
|
|
- } else {
|
|
187
|
|
- return AjaxResult.error("没有用印时的机构名称及经办人信息");
|
|
188
|
|
- }
|
|
189
|
|
-
|
|
190
|
|
- //解析文件签名印章位置
|
|
191
|
|
- JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
|
|
192
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
193
|
|
- JSONObject jsonObject3 = jsonArray.getJSONObject(i);
|
|
194
|
|
- String keyword = jsonObject3.getString("keyword");
|
|
195
|
|
- if (keyword.equals("甲方(签字):")) {
|
|
196
|
|
- //签名
|
|
197
|
|
- JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
198
|
|
- // 遍历 positionsArray 中的每个元素
|
|
199
|
|
- for (int j = 0; j < positionsArray.size(); j++) {
|
|
200
|
|
- JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
201
|
|
- int pageNum = positionObj.getIntValue("pageNum");
|
|
202
|
|
- sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
|
|
203
|
|
- JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
204
|
|
- JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
205
|
|
- double positionX = coordinateObj.getDoubleValue("positionX");
|
|
206
|
|
- double positionY = coordinateObj.getDoubleValue("positionY");
|
|
207
|
|
- sealSignRecord.setPositionXpsn(positionX + 90);
|
|
208
|
|
- sealSignRecord.setPositionYpsn(positionY + 30);
|
|
209
|
|
- }
|
|
210
|
|
- }else if (keyword.equals("乙方(签字):")) {
|
|
211
|
|
- //签名
|
|
212
|
|
- JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
213
|
|
- // 遍历 positionsArray 中的每个元素
|
|
214
|
|
- for (int j = 0; j < positionsArray.size(); j++) {
|
|
215
|
|
- JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
216
|
|
- int pageNum = positionObj.getIntValue("pageNum");
|
|
217
|
|
- sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
|
|
218
|
|
- JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
219
|
|
- JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
220
|
|
- double positionX = coordinateObj.getDoubleValue("positionX");
|
|
221
|
|
- double positionY = coordinateObj.getDoubleValue("positionY");
|
|
222
|
|
- sealSignRecord.setPositionXpsnRes(positionX + 90);
|
|
223
|
|
- sealSignRecord.setPositionYpsnRes(positionY);
|
|
224
|
|
- }
|
|
225
|
|
- }else if (keyword.equals("调解员(签字):")) {
|
|
226
|
|
- //签名
|
|
227
|
|
- JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
228
|
|
- // 遍历 positionsArray 中的每个元素
|
|
229
|
|
- for (int j = 0; j < positionsArray.size(); j++) {
|
|
230
|
|
- JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
231
|
|
- int pageNum = positionObj.getIntValue("pageNum");
|
|
232
|
|
- sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum));
|
|
233
|
|
- JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
234
|
|
- JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
235
|
|
- double positionX = coordinateObj.getDoubleValue("positionX");
|
|
236
|
|
- double positionY = coordinateObj.getDoubleValue("positionY");
|
|
237
|
|
- sealSignRecord.setPositionXpsnMedi(positionX + 90);
|
|
238
|
|
- sealSignRecord.setPositionYpsnMedi(positionY);
|
|
239
|
|
- }
|
|
240
|
|
- }else {
|
|
241
|
|
- //用印
|
|
242
|
|
- JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
243
|
|
- // 遍历 positionsArray 中的每个元素
|
|
244
|
|
- for (int j = 0; j < positionsArray.size(); j++) {
|
|
245
|
|
- JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
246
|
|
- int pageNum = positionObj.getIntValue("pageNum");
|
|
247
|
|
- sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
|
|
248
|
|
- JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
249
|
|
- JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
250
|
|
- double positionX = coordinateObj.getDoubleValue("positionX");
|
|
251
|
|
- double positionY = coordinateObj.getDoubleValue("positionY");
|
|
252
|
|
- sealSignRecord.setPositionXorg(positionX + 90);
|
|
253
|
|
- sealSignRecord.setPositionYorg(positionY);
|
|
254
|
|
- }
|
|
255
|
|
- }
|
|
256
|
|
- }
|
|
257
|
|
- /*DeptIdentify deptIdentify1 = new DeptIdentify();
|
|
258
|
|
- deptIdentify1.setSealStatus(1); // 印章状态为启用
|
|
259
|
|
- //根据机构名称查询部门id
|
|
260
|
|
- SysDept sysDept = new SysDept();
|
|
261
|
|
- sysDept.setDeptName(sealSignRecord.getOrgnizeName());
|
|
262
|
|
- List<SysDept> sysDepts = deptMapper.selectDeptList(sysDept);
|
|
263
|
|
- if (sysDepts != null && sysDepts.size() > 0) {
|
|
264
|
|
- Long deptId = sysDepts.get(0).getDeptId();
|
|
265
|
|
- deptIdentify1.setDeptId(deptId);
|
|
266
|
|
- }
|
|
267
|
|
- List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1);
|
|
268
|
|
- List<String> sealIds = new ArrayList<>();
|
|
269
|
|
- if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
|
270
|
|
- for (DeptIdentify identify : deptIdentifies) {
|
|
271
|
|
- String sealId = identify.getSealId();
|
|
272
|
|
- sealIds.add(sealId);
|
|
273
|
|
- }
|
|
274
|
|
- }*/
|
|
275
|
|
- String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称
|
|
276
|
|
- String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名
|
|
277
|
|
- String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式
|
|
278
|
|
- //查询机构信息
|
|
279
|
|
- DeptIdentify deptIdentify1 = new DeptIdentify();
|
|
280
|
|
- deptIdentify1.setIdentifyName(orgnizeName);
|
|
281
|
|
- deptIdentify1.setOperName(orgnizeNamepsnName);
|
|
282
|
|
- deptIdentify1.setOperPhone(orgnizeNamePsnAccount);
|
|
283
|
|
- List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1);
|
|
284
|
|
- if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
|
285
|
|
- Long iddeptIdent = deptIdentifies.get(0).getId();
|
|
286
|
|
- SealManage sealManage = new SealManage();
|
|
287
|
|
- sealManage.setIdentifyId(iddeptIdent);
|
|
288
|
|
- List<String> sealIdList = new ArrayList<>();
|
|
289
|
|
- List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
|
|
290
|
|
- if (selectSealList != null && selectSealList.size() > 0) {
|
|
291
|
|
- for (SealManage manage : selectSealList) {
|
|
292
|
|
- Integer sealStatus = manage.getSealStatus();
|
|
293
|
|
- Integer isUse = manage.getIsUse();
|
|
294
|
|
- if (sealStatus == 1 && isUse ==1) {
|
|
295
|
|
- sealIdList.add(manage.getSealId());
|
|
296
|
|
- }
|
|
297
|
|
- }
|
|
298
|
|
- EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList);
|
|
299
|
|
-
|
|
300
|
|
- JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
|
|
301
|
|
- if (jsonObject3 != null) {
|
|
302
|
|
- if (jsonObject3.getIntValue("code") == 0) {
|
|
303
|
|
- //获取签署流程ID
|
|
304
|
|
- JSONObject data1 = jsonObject3.getJSONObject("data");
|
|
305
|
|
- String signFlowId = data1.getString("signFlowId");
|
|
306
|
|
- //保存案件id,文件id,文件名称.流程id到签署用印记录表里
|
|
307
|
|
- sealSignRecord.setCaseAppliId(caseApplication.getId());
|
|
308
|
|
- sealSignRecord.setSignFlowid(signFlowId);
|
|
309
|
|
- sealSignRecord.setSignFlowStatus(1);//待签名
|
|
310
|
|
- MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
|
|
311
|
|
- BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
|
|
312
|
|
- msSealSignRecord.setFileId(sealSignRecord.getFileid());
|
|
313
|
|
- msSealSignRecord.setFileName(sealSignRecord.getFilename());
|
|
314
|
|
- msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
|
|
315
|
|
- msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount());
|
|
316
|
|
- msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName());
|
|
317
|
|
- sealSignRecordMapper.insert(msSealSignRecord);
|
|
318
|
|
-
|
|
319
|
|
- SealSignRecord sealSignRecordapply = new SealSignRecord();
|
|
320
|
|
- sealSignRecordapply.setSignFlowid(signFlowId);
|
|
321
|
|
- sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
322
|
|
- EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
|
|
323
|
|
- JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
|
|
324
|
|
- JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
325
|
|
- String urlapply = signUrlData.get("shortUrl").getAsString();
|
|
326
|
|
- String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
|
|
327
|
|
-
|
|
328
|
|
- //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
|
|
329
|
|
- SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
330
|
|
- request.setTemplateId("2047719");
|
|
331
|
|
- request.setPhone(caseAffiliate.getContactTelphoneAgent());
|
|
332
|
|
- request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), caseApplication.getCaseNum(),urlapplynew});
|
|
333
|
|
- Boolean aBoolean = SmsUtils.sendSms(request);
|
|
334
|
|
-
|
|
335
|
|
- SealSignRecord sealSignRecordRespon = new SealSignRecord();
|
|
336
|
|
- sealSignRecordRespon.setSignFlowid(signFlowId);
|
|
337
|
|
- sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
|
|
338
|
|
- EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
|
|
339
|
|
- JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
|
|
340
|
|
- JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
|
|
341
|
|
- String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
|
|
342
|
|
- String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
|
|
343
|
|
-
|
|
344
|
|
- SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
|
|
345
|
|
- request1.setTemplateId("2047719");
|
|
346
|
|
- request1.setPhone(caseAffiliate.getRespondentPhone());
|
|
347
|
|
- request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew});
|
|
348
|
|
- Boolean aBoolean1 = SmsUtils.sendSms(request1);
|
|
349
|
|
-
|
|
350
|
|
- SealSignRecord sealSignRecordMedi = new SealSignRecord();
|
|
351
|
|
- sealSignRecordMedi.setSignFlowid(signFlowId);
|
|
352
|
|
- sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
|
|
353
|
|
- EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
|
|
354
|
|
- JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
|
|
355
|
|
- JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
|
|
356
|
|
- String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
|
|
357
|
|
- String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
|
|
358
|
|
-
|
|
359
|
|
- SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
|
|
360
|
|
- requestMedi.setTemplateId("2047719");
|
|
361
|
|
- requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
|
|
362
|
|
- requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi});
|
|
363
|
|
- Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
|
|
364
|
|
-
|
|
365
|
|
- } else {
|
|
366
|
|
- throw new ServiceException(jsonObject3.getString("message"));
|
|
367
|
|
- }
|
|
368
|
|
- } else {
|
|
369
|
|
- return AjaxResult.error();
|
|
370
|
|
- }
|
|
371
|
|
-
|
|
372
|
|
- }
|
|
373
|
|
-
|
|
374
|
|
-
|
|
375
|
|
- } else {
|
|
376
|
|
- return AjaxResult.error();
|
|
377
|
|
- }
|
|
378
|
|
- }
|
|
379
|
|
- }
|
|
380
|
|
- }
|
|
381
|
|
- break;
|
|
382
|
|
- }
|
|
383
|
|
-
|
|
384
|
|
- }
|
|
385
|
|
-
|
|
386
|
|
- }
|
|
387
|
|
- return AjaxResult.success();
|
|
388
|
|
- }
|
|
389
|
126
|
|
|
390
|
127
|
@Override
|
|
391
|
128
|
@Transactional
|
|
|
@@ -457,8 +194,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
457
|
194
|
public AjaxResult selectCaseProgress(MsSignSealDTO dto) {
|
|
458
|
195
|
Map<String, Object> datas = new HashMap<>();
|
|
459
|
196
|
Long id = dto.getCaseId();
|
|
460
|
|
-// MsCaseLogRecord caseLogRecord = new MsCaseLogRecord();
|
|
461
|
|
-// caseLogRecord.setCaseAppliId(id);
|
|
462
|
197
|
List<MsCaseLogRecordVO> records = caseLogRecordMapper.selectCaseLogRecordListCaseProgress(dto.getCaseId());
|
|
463
|
198
|
|
|
464
|
199
|
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
|
@@ -468,7 +203,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
468
|
203
|
List<MsCaseLogRecordVO> recordsNew = new ArrayList<>();
|
|
469
|
204
|
if (records != null && records.size() > 0) {
|
|
470
|
205
|
for (MsCaseLogRecordVO msCaseLogRecordVO : records) {
|
|
471
|
|
-// String content = msCaseLogRecordVO.getContent();
|
|
472
|
206
|
String content = msCaseLogRecordVO.getCaseStatusName();
|
|
473
|
207
|
if(StringUtils.isNotEmpty(content)){
|
|
474
|
208
|
if(content.equals("结束")){
|
|
|
@@ -594,6 +328,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
594
|
328
|
@Override
|
|
595
|
329
|
@Transactional(rollbackFor = Exception.class)
|
|
596
|
330
|
public AjaxResult msCaseFile(List<Long> ids){
|
|
|
331
|
+ // todo
|
|
597
|
332
|
try {
|
|
598
|
333
|
for (Long id : ids) {
|
|
599
|
334
|
MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
|
@@ -606,10 +341,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
606
|
341
|
if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
607
|
342
|
for (MsCaseAttach caseAttach : caseAttachList) {
|
|
608
|
343
|
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
|
609
|
|
-// String annexName = caseAttach.getAnnexName();
|
|
610
|
|
-// String prefix = "/profile/upload/";
|
|
611
|
|
-// int startIndex = prefix.length();
|
|
612
|
|
-// String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
|
|
613
|
344
|
String prefix = "/profile";
|
|
614
|
345
|
int startIndex = prefix.length();
|
|
615
|
346
|
String annexPath = caseAttach.getAnnexPath();
|
|
|
@@ -638,9 +369,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
638
|
369
|
String day = String.format("%02d", now.getDayOfMonth());
|
|
639
|
370
|
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
640
|
371
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
|
641
|
|
-
|
|
642
|
|
-// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
643
|
|
-// String savePath = "/home/ruoyi/uploadPath/upload/";
|
|
644
|
372
|
String saveName = fileName;
|
|
645
|
373
|
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
646
|
374
|
|
|
|
@@ -687,62 +415,49 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
687
|
415
|
caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
688
|
416
|
caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1);
|
|
689
|
417
|
|
|
690
|
|
- String appEmail = "";
|
|
691
|
|
- String resEmail = "";
|
|
692
|
|
- MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
|
|
693
|
|
-
|
|
694
|
|
- Integer organizeFlag = caseAffiliate.getOrganizeFlag();
|
|
695
|
|
- if(organizeFlag!=null){
|
|
696
|
|
- if(organizeFlag.intValue()==1){
|
|
697
|
|
- appEmail = caseAffiliate.getAgentEmail();
|
|
698
|
|
- }else {
|
|
699
|
|
- appEmail = caseAffiliate.getApplicationEmail();
|
|
700
|
|
- }
|
|
701
|
|
- }
|
|
702
|
|
- resEmail = caseAffiliate.getRespondentEmail();
|
|
703
|
|
- boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList);
|
|
704
|
|
-
|
|
705
|
|
- SendMailRecord sendMailRecord = new SendMailRecord();
|
|
706
|
|
- sendMailRecord.setCaseId(id);
|
|
707
|
|
- sendMailRecord.setMailAddress(appEmail);
|
|
708
|
|
- sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅");
|
|
709
|
|
-// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
|
|
710
|
|
- sendMailRecord.setMailName("签署后的调解书");
|
|
711
|
|
- sendMailRecord.setSendTime(new Date());
|
|
712
|
|
- sendMailRecord.setCreateBy(SecurityUtils.getUsername());
|
|
713
|
|
- if (appEmailFlag) {
|
|
714
|
|
- sendMailRecord.setSendStatus(1);
|
|
715
|
|
- } else {
|
|
716
|
|
- sendMailRecord.setSendStatus(0);
|
|
717
|
|
- }
|
|
718
|
|
- sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
|
719
|
|
-
|
|
720
|
|
- boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList);
|
|
721
|
|
-
|
|
722
|
|
- SendMailRecord sendMailRecord1 = new SendMailRecord();
|
|
723
|
|
- sendMailRecord1.setCaseId(id);
|
|
724
|
|
- sendMailRecord1.setMailAddress(resEmail);
|
|
725
|
|
-// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
|
|
726
|
|
- sendMailRecord1.setMailContent("您好,审核后的调解书在附件中请查阅");
|
|
727
|
|
- sendMailRecord1.setMailName("签署后的调解书");
|
|
728
|
|
- sendMailRecord1.setSendTime(new Date());
|
|
729
|
|
- sendMailRecord1.setCreateBy(SecurityUtils.getUsername());
|
|
730
|
|
- if (resEmailFlag) {
|
|
731
|
|
- sendMailRecord1.setSendStatus(1);
|
|
732
|
|
- }else {
|
|
733
|
|
- sendMailRecord1.setSendStatus(0);
|
|
|
418
|
+ // 获取案件相关人员
|
|
|
419
|
+ List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(id);
|
|
|
420
|
+ if(CollectionUtil.isEmpty(affiliates)){
|
|
|
421
|
+ return AjaxResult.error("未找到案件相关人员");
|
|
734
|
422
|
}
|
|
735
|
|
- sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
|
|
736
|
|
- if(!appEmailFlag&&!resEmailFlag){
|
|
737
|
|
- throw new ServiceException("调解书发送失败");
|
|
|
423
|
+ List<MsCaseAffiliate> oprratorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null
|
|
|
424
|
+ && affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail()))
|
|
|
425
|
+ .collect(Collectors.toList());
|
|
|
426
|
+ if(CollectionUtil.isEmpty(oprratorList)){
|
|
|
427
|
+ return AjaxResult.error("未找到案件操作人员");
|
|
738
|
428
|
}
|
|
739
|
|
- if(!appEmailFlag){
|
|
740
|
|
- throw new ServiceException("申请人调解书发送失败");
|
|
741
|
|
- }
|
|
742
|
|
- if(!resEmailFlag){
|
|
743
|
|
- throw new ServiceException("被申请人调解书发送失败");
|
|
|
429
|
+
|
|
|
430
|
+ for (MsCaseAffiliate affiliate : oprratorList) {
|
|
|
431
|
+ if(affiliate.getRoleType()==null){
|
|
|
432
|
+ continue;
|
|
|
433
|
+ }
|
|
|
434
|
+ boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList);
|
|
|
435
|
+
|
|
|
436
|
+ SendMailRecord sendMailRecord = new SendMailRecord();
|
|
|
437
|
+ sendMailRecord.setCaseId(id);
|
|
|
438
|
+ sendMailRecord.setMailAddress(affiliate.getEmail());
|
|
|
439
|
+ sendMailRecord.setMailContent("您好,审核后的调解书在附件中请查阅");
|
|
|
440
|
+ sendMailRecord.setMailName("签署后的调解书");
|
|
|
441
|
+ sendMailRecord.setSendTime(new Date());
|
|
|
442
|
+ sendMailRecord.setCreateBy(SecurityUtils.getUsername());
|
|
|
443
|
+ if (appEmailFlag) {
|
|
|
444
|
+ sendMailRecord.setSendStatus(1);
|
|
|
445
|
+ } else {
|
|
|
446
|
+ sendMailRecord.setSendStatus(0);
|
|
|
447
|
+ }
|
|
|
448
|
+ sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
|
744
|
449
|
}
|
|
745
|
450
|
|
|
|
451
|
+// if(!appEmailFlag&&!resEmailFlag){
|
|
|
452
|
+// throw new ServiceException("调解书发送失败");
|
|
|
453
|
+// }
|
|
|
454
|
+// if(!appEmailFlag){
|
|
|
455
|
+// throw new ServiceException("申请人调解书发送失败");
|
|
|
456
|
+// }
|
|
|
457
|
+// if(!resEmailFlag){
|
|
|
458
|
+// throw new ServiceException("被申请人调解书发送失败");
|
|
|
459
|
+// }
|
|
|
460
|
+
|
|
746
|
461
|
CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
|
|
747
|
462
|
|
|
748
|
463
|
}
|
|
|
@@ -778,8 +493,10 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
778
|
493
|
// }
|
|
779
|
494
|
// }
|
|
780
|
495
|
if (dto.getIsSignApply() != null && dto.getIsSignApply().intValue() == 1) {
|
|
781
|
|
- caseAffiliate.setIsSignApply(1);
|
|
782
|
|
- msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate);
|
|
|
496
|
+ // todo 签收不要该字段
|
|
|
497
|
+ // caseAffiliate.setIsSignApply(1);
|
|
|
498
|
+ // todo 签收不要该字段
|
|
|
499
|
+ // msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate);
|
|
783
|
500
|
|
|
784
|
501
|
// 根据流程id查找下一个流程节点
|
|
785
|
502
|
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
|
|
|
@@ -802,8 +519,10 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
802
|
519
|
// }
|
|
803
|
520
|
|
|
804
|
521
|
if (dto.getIsSignRespon() != null && dto.getIsSignRespon().intValue() == 1) {
|
|
805
|
|
- caseAffiliate.setIsSignRespon(1);
|
|
806
|
|
- msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate);
|
|
|
522
|
+ // todo 签收不要该字段
|
|
|
523
|
+// caseAffiliate.setIsSignRespon(1);
|
|
|
524
|
+ // todo 签收不要该字段
|
|
|
525
|
+// msCaseAffiliateMapper.updateByPrimaryKeySelective(caseAffiliate);
|
|
807
|
526
|
|
|
808
|
527
|
// 根据流程id查找下一个流程节点
|
|
809
|
528
|
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
|
|
|
@@ -811,6 +530,11 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
811
|
530
|
caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
812
|
531
|
caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
|
|
813
|
532
|
CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
|
|
|
533
|
+ CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
|
|
|
534
|
+ // todo 被申请人签收结束对接北明,为调解成功状态
|
|
|
535
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
|
|
|
536
|
+ applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
|
|
|
537
|
+ }
|
|
814
|
538
|
}
|
|
815
|
539
|
|
|
816
|
540
|
return AjaxResult.success("签收成功");
|
|
|
@@ -819,12 +543,29 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
819
|
543
|
|
|
820
|
544
|
@Override
|
|
821
|
545
|
public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException {
|
|
|
546
|
+ // todo
|
|
822
|
547
|
Long caseId = dto.getCaseId();
|
|
823
|
|
- MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
|
|
824
|
|
- Integer organizeFlag = caseAffiliate.getOrganizeFlag();
|
|
|
548
|
+ //MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
|
|
|
549
|
+ List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId);
|
|
|
550
|
+ if(CollectionUtil.isEmpty(affiliates)){
|
|
|
551
|
+ return AjaxResult.error("未找到案件相关人员");
|
|
|
552
|
+ }
|
|
|
553
|
+ List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null
|
|
|
554
|
+ && msCaseAffiliate.getOperatorFlag() == 1
|
|
|
555
|
+ && StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList());
|
|
|
556
|
+ Optional<MsCaseAffiliate> appOpt =null;
|
|
|
557
|
+ Optional<MsCaseAffiliate> resOpt =null;
|
|
|
558
|
+ if(CollectionUtil.isNotEmpty(operatorList)){
|
|
|
559
|
+ appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null
|
|
|
560
|
+ && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2))
|
|
|
561
|
+ .findFirst();
|
|
|
562
|
+ resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null
|
|
|
563
|
+ && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4))
|
|
|
564
|
+ .findFirst();
|
|
|
565
|
+ }
|
|
825
|
566
|
|
|
826
|
567
|
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
|
|
827
|
|
-
|
|
|
568
|
+ Integer organizeFlag = caseApplication.getOrganizeFlag();
|
|
828
|
569
|
SysUser user = new SysUser();
|
|
829
|
570
|
Long userId = SecurityUtils.getUserId();
|
|
830
|
571
|
user.setUserId(userId);
|
|
|
@@ -836,6 +577,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
836
|
577
|
}
|
|
837
|
578
|
List<String> roleNames = allSysRole.stream().map(SysRole::getRoleName).collect(Collectors.toList());
|
|
838
|
579
|
if(roleNames.contains("申请人")){
|
|
|
580
|
+ if(appOpt==null || !appOpt.isPresent()){
|
|
|
581
|
+ return AjaxResult.error("未找到案件申请操作人");
|
|
|
582
|
+ }
|
|
839
|
583
|
SealSignRecord sealSignRecordres = new SealSignRecord();
|
|
840
|
584
|
MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
|
|
841
|
585
|
mssealSignRecord.setCaseAppliId(caseId);
|
|
|
@@ -844,19 +588,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
844
|
588
|
String signFlowid = sealSignRecords.get(0).getSignFlowId();
|
|
845
|
589
|
if(organizeFlag!=null){
|
|
846
|
590
|
SealSignRecord sealSignRecord = new SealSignRecord();
|
|
847
|
|
- if(organizeFlag.intValue()==1){
|
|
848
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
849
|
|
- sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
|
|
850
|
|
- }else {
|
|
851
|
|
- String nameAgent = caseAffiliate.getNameAgent();
|
|
852
|
|
- if(StringUtils.isNotBlank(nameAgent)){
|
|
853
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
854
|
|
- sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
|
|
855
|
|
- }else {
|
|
856
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone());
|
|
857
|
|
- sealSignRecord.setPensonName(caseAffiliate.getApplicationName());
|
|
858
|
|
- }
|
|
859
|
|
- }
|
|
|
591
|
+ sealSignRecord.setPensonAccount(appOpt.get().getPhone());
|
|
|
592
|
+ sealSignRecord.setPensonName(appOpt.get().getName());
|
|
860
|
593
|
sealSignRecord.setSignFlowid(signFlowid);
|
|
861
|
594
|
|
|
862
|
595
|
Gson gson = new Gson();
|
|
|
@@ -873,6 +606,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
873
|
606
|
|
|
874
|
607
|
|
|
875
|
608
|
}else if(roleNames.contains("被申请人")){
|
|
|
609
|
+ if(resOpt==null || !resOpt.isPresent()){
|
|
|
610
|
+ return AjaxResult.error("未找到案件申请操作人");
|
|
|
611
|
+ }
|
|
876
|
612
|
SealSignRecord sealSignRecordres = new SealSignRecord();
|
|
877
|
613
|
MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
|
|
878
|
614
|
mssealSignRecord.setCaseAppliId(caseId);
|
|
|
@@ -880,7 +616,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
880
|
616
|
if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
881
|
617
|
String signFlowid = sealSignRecords.get(0).getSignFlowId();
|
|
882
|
618
|
SealSignRecord sealSignRecord = new SealSignRecord();
|
|
883
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getRespondentPhone());
|
|
|
619
|
+ sealSignRecord.setPensonAccount(resOpt.get().getPhone());
|
|
|
620
|
+ sealSignRecord.setPensonName(resOpt.get().getName());
|
|
884
|
621
|
sealSignRecord.setSignFlowid(signFlowid);
|
|
885
|
622
|
|
|
886
|
623
|
Gson gson = new Gson();
|
|
|
@@ -927,95 +664,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
927
|
664
|
return AjaxResult.success();
|
|
928
|
665
|
}
|
|
929
|
666
|
|
|
930
|
|
- @Override
|
|
931
|
|
- public AjaxResult msCaseSignUrlResPC(MsSignSealDTO dto) throws EsignDemoException {
|
|
932
|
|
- Long caseId = dto.getCaseId();
|
|
933
|
|
- MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
|
|
934
|
|
- SealSignRecord sealSignRecordres = new SealSignRecord();
|
|
935
|
|
- MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
|
|
936
|
|
- mssealSignRecord.setCaseAppliId(caseId);
|
|
937
|
|
- List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
|
|
938
|
|
- if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
939
|
|
- String signFlowid = sealSignRecords.get(0).getSignFlowId();
|
|
940
|
|
- SealSignRecord sealSignRecord = new SealSignRecord();
|
|
941
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getRespondentPhone());
|
|
942
|
|
- sealSignRecord.setSignFlowid(signFlowid);
|
|
943
|
|
-
|
|
944
|
|
- Gson gson = new Gson();
|
|
945
|
|
- EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord);
|
|
946
|
|
- JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
|
|
947
|
|
- JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
948
|
|
- String urlapply = signUrlData.get("shortUrl").getAsString();
|
|
949
|
|
- sealSignRecordres.setSealUrl(urlapply);
|
|
950
|
|
- }
|
|
951
|
|
-
|
|
952
|
|
- return AjaxResult.success(sealSignRecordres);
|
|
953
|
|
- }
|
|
954
|
|
-
|
|
955
|
|
- @Override
|
|
956
|
|
- public AjaxResult msCaseSignUrlApplyAPP(MsSignSealDTO dto) throws EsignDemoException {
|
|
957
|
|
- Long caseId = dto.getCaseId();
|
|
958
|
|
- MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
|
|
959
|
|
- Integer organizeFlag = caseAffiliate.getOrganizeFlag();
|
|
960
|
|
- SealSignRecord sealSignRecordres = new SealSignRecord();
|
|
961
|
|
- MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
|
|
962
|
|
- mssealSignRecord.setCaseAppliId(caseId);
|
|
963
|
|
- List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
|
|
964
|
|
- if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
965
|
|
- String signFlowid = sealSignRecords.get(0).getSignFlowId();
|
|
966
|
|
- if(organizeFlag!=null){
|
|
967
|
|
- SealSignRecord sealSignRecord = new SealSignRecord();
|
|
968
|
|
- if(organizeFlag.intValue()==1){
|
|
969
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
970
|
|
- sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
|
|
971
|
|
- }else {
|
|
972
|
|
- String nameAgent = caseAffiliate.getNameAgent();
|
|
973
|
|
- if(StringUtils.isNotBlank(nameAgent)){
|
|
974
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
975
|
|
- sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
|
|
976
|
|
- }else {
|
|
977
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone());
|
|
978
|
|
- sealSignRecord.setPensonName(caseAffiliate.getApplicationName());
|
|
979
|
|
- }
|
|
980
|
|
- }
|
|
981
|
|
- sealSignRecord.setSignFlowid(signFlowid);
|
|
982
|
|
-
|
|
983
|
|
- Gson gson = new Gson();
|
|
984
|
|
- EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecord);
|
|
985
|
|
- JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
|
|
986
|
|
- JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
987
|
|
- String urlapply = signUrlData.get("shortUrl").getAsString();
|
|
988
|
|
- sealSignRecordres.setSealUrl(urlapply);
|
|
989
|
|
- }
|
|
990
|
|
- }
|
|
991
|
|
- return AjaxResult.success(sealSignRecordres);
|
|
992
|
|
-
|
|
993
|
|
- }
|
|
994
|
|
-
|
|
995
|
|
- @Override
|
|
996
|
|
- public AjaxResult msCaseSignUrlResAPP(MsSignSealDTO dto) throws EsignDemoException {
|
|
997
|
|
- Long caseId = dto.getCaseId();
|
|
998
|
|
- MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
|
|
999
|
|
- SealSignRecord sealSignRecordres = new SealSignRecord();
|
|
1000
|
|
- MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
|
|
1001
|
|
- mssealSignRecord.setCaseAppliId(caseId);
|
|
1002
|
|
- List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
|
|
1003
|
|
- if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
1004
|
|
- String signFlowid = sealSignRecords.get(0).getSignFlowId();
|
|
1005
|
|
- SealSignRecord sealSignRecord = new SealSignRecord();
|
|
1006
|
|
- sealSignRecord.setPensonAccount(caseAffiliate.getRespondentPhone());
|
|
1007
|
|
- sealSignRecord.setSignFlowid(signFlowid);
|
|
1008
|
|
-
|
|
1009
|
|
- Gson gson = new Gson();
|
|
1010
|
|
- EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecord);
|
|
1011
|
|
- JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
|
|
1012
|
|
- JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
1013
|
|
- String urlapply = signUrlData.get("shortUrl").getAsString();
|
|
1014
|
|
- sealSignRecordres.setSealUrl(urlapply);
|
|
1015
|
|
- }
|
|
1016
|
|
-
|
|
1017
|
|
- return AjaxResult.success(sealSignRecordres);
|
|
1018
|
|
- }
|
|
1019
|
667
|
|
|
1020
|
668
|
@Override
|
|
1021
|
669
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -1187,12 +835,38 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1187
|
835
|
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
|
1188
|
836
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
1189
|
837
|
if (downLoadFile) {
|
|
|
838
|
+ // 先删除已经存在的调解书
|
|
|
839
|
+ if(StrUtil.isEmpty(application.getCaseSource())){
|
|
|
840
|
+ List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
|
841
|
+ if(CollectionUtil.isNotEmpty(existAttach)){
|
|
|
842
|
+ // todo 对接北明,同步案件状态,删除
|
|
|
843
|
+ for (MsCaseAttach msCaseAttach : existAttach) {
|
|
|
844
|
+ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
|
845
|
+ continue;
|
|
|
846
|
+ }
|
|
|
847
|
+ beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
|
848
|
+ }
|
|
|
849
|
+ }
|
|
|
850
|
+ }
|
|
|
851
|
+ msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1190
|
852
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
|
1191
|
853
|
caseAttach.setCaseAppliId(caseAppliId);
|
|
1192
|
|
- caseAttach.setAnnexType(7);
|
|
|
854
|
+ caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1193
|
855
|
caseAttach.setAnnexPath(savePath);
|
|
1194
|
856
|
caseAttach.setAnnexName(saveName);
|
|
1195
|
|
- caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
857
|
+ caseAttachMapper.save(caseAttach);
|
|
|
858
|
+ // todo 对接北明,调用上传附件接口
|
|
|
859
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
|
|
|
860
|
+ String templatePath = "/home/ruoyi" + savePath;
|
|
|
861
|
+ File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
|
|
862
|
+ MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD);
|
|
|
863
|
+ // 更新附件表
|
|
|
864
|
+ if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
|
|
|
865
|
+ caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
|
|
866
|
+ msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
867
|
+ }
|
|
|
868
|
+
|
|
|
869
|
+ }
|
|
1196
|
870
|
}
|
|
1197
|
871
|
|
|
1198
|
872
|
}
|
|
|
@@ -1256,12 +930,38 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1256
|
930
|
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
|
1257
|
931
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
1258
|
932
|
if (downLoadFile) {
|
|
|
933
|
+ // 先删除已经存在的调解书
|
|
|
934
|
+ if(StrUtil.isEmpty(application.getCaseSource())){
|
|
|
935
|
+ List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
|
936
|
+ if(CollectionUtil.isNotEmpty(existAttach)){
|
|
|
937
|
+ // todo 对接北明,同步案件状态,删除
|
|
|
938
|
+ for (MsCaseAttach msCaseAttach : existAttach) {
|
|
|
939
|
+ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
|
940
|
+ continue;
|
|
|
941
|
+ }
|
|
|
942
|
+ beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
|
943
|
+ }
|
|
|
944
|
+ }
|
|
|
945
|
+ }
|
|
|
946
|
+ msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1259
|
947
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
|
1260
|
948
|
caseAttach.setCaseAppliId(caseAppliId);
|
|
1261
|
|
- caseAttach.setAnnexType(7);
|
|
|
949
|
+ caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1262
|
950
|
caseAttach.setAnnexPath(savePath);
|
|
1263
|
951
|
caseAttach.setAnnexName(saveName);
|
|
1264
|
|
- caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
952
|
+ caseAttachMapper.save(caseAttach);
|
|
|
953
|
+ // todo 对接北明,调用上传附件接口
|
|
|
954
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
|
|
|
955
|
+ String templatePath = "/home/ruoyi" + savePath;
|
|
|
956
|
+ File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
|
|
957
|
+ MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD);
|
|
|
958
|
+ // 更新附件表
|
|
|
959
|
+ if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
|
|
|
960
|
+ caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
|
|
961
|
+ msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
962
|
+ }
|
|
|
963
|
+
|
|
|
964
|
+ }
|
|
1265
|
965
|
}
|
|
1266
|
966
|
|
|
1267
|
967
|
}
|
|
|
@@ -1322,12 +1022,39 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1322
|
1022
|
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
|
1323
|
1023
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
1324
|
1024
|
if (downLoadFile) {
|
|
|
1025
|
+ // 先删除已经存在的调解书
|
|
|
1026
|
+ if(StrUtil.isEmpty(application.getCaseSource())){
|
|
|
1027
|
+ List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
|
1028
|
+ if(CollectionUtil.isNotEmpty(existAttach)){
|
|
|
1029
|
+ // todo 对接北明,同步案件状态,删除
|
|
|
1030
|
+ for (MsCaseAttach msCaseAttach : existAttach) {
|
|
|
1031
|
+ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
|
1032
|
+ continue;
|
|
|
1033
|
+ }
|
|
|
1034
|
+ beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
|
1035
|
+ }
|
|
|
1036
|
+ }
|
|
|
1037
|
+ }
|
|
|
1038
|
+ msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1325
|
1039
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
|
1326
|
1040
|
caseAttach.setCaseAppliId(caseAppliId);
|
|
1327
|
1041
|
caseAttach.setAnnexType(7);
|
|
1328
|
1042
|
caseAttach.setAnnexPath(savePath);
|
|
1329
|
1043
|
caseAttach.setAnnexName(saveName);
|
|
1330
|
|
- caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
1044
|
+ caseAttachMapper.save(caseAttach);
|
|
|
1045
|
+ // todo 对接北明,调用上传附件接口
|
|
|
1046
|
+
|
|
|
1047
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
|
|
|
1048
|
+ String templatePath = "/home/ruoyi" + savePath;
|
|
|
1049
|
+ File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
|
|
1050
|
+ MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD);
|
|
|
1051
|
+
|
|
|
1052
|
+ // 更新附件表
|
|
|
1053
|
+ if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
|
|
|
1054
|
+ caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
|
|
1055
|
+ msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
1056
|
+ }
|
|
|
1057
|
+ }
|
|
1331
|
1058
|
}
|
|
1332
|
1059
|
|
|
1333
|
1060
|
}
|