|
|
@@ -1,28 +1,41 @@
|
|
1
|
1
|
package com.ruoyi.wisdomarbitrate.utils;
|
|
2
|
2
|
|
|
|
3
|
+import cn.hutool.core.bean.BeanUtil;
|
|
3
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
4
|
5
|
import com.google.gson.Gson;
|
|
5
|
6
|
import com.google.gson.JsonArray;
|
|
6
|
7
|
import com.google.gson.JsonObject;
|
|
|
8
|
+import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
7
|
9
|
import com.ruoyi.common.constant.FileTransformation;
|
|
8
|
10
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
9
|
11
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
|
12
|
+import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
|
13
|
+import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
|
|
|
14
|
+import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
|
|
10
|
15
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
|
11
|
16
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
|
|
17
|
+import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
|
|
18
|
+import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
|
|
|
19
|
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
|
|
12
|
20
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
|
13
|
21
|
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
|
|
|
22
|
+import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper;
|
|
14
|
23
|
import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
|
|
|
24
|
+import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper;
|
|
15
|
25
|
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
|
|
16
|
26
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
17
|
27
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
18
|
28
|
import org.springframework.stereotype.Component;
|
|
19
|
29
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
30
|
+import tk.mybatis.mapper.entity.Example;
|
|
20
|
31
|
|
|
21
|
32
|
import java.io.File;
|
|
22
|
33
|
import java.io.IOException;
|
|
23
|
34
|
import java.time.LocalDate;
|
|
|
35
|
+import java.util.ArrayList;
|
|
24
|
36
|
import java.util.List;
|
|
25
|
37
|
import java.util.UUID;
|
|
|
38
|
+import java.util.stream.Collectors;
|
|
26
|
39
|
|
|
27
|
40
|
@Component
|
|
28
|
41
|
public class FixSelectFlowDetailUtils {
|
|
|
@@ -32,6 +45,14 @@ public class FixSelectFlowDetailUtils {
|
|
32
|
45
|
private DeptIdentifyMapper deptIdentifyMapper;
|
|
33
|
46
|
@Autowired
|
|
34
|
47
|
private SealManageMapper sealManageMapper;
|
|
|
48
|
+ @Autowired
|
|
|
49
|
+ private MsSealSignRecordMapper sealSignRecordMapper;
|
|
|
50
|
+ @Autowired
|
|
|
51
|
+ MsCaseApplicationMapper msCaseApplicationMapper;
|
|
|
52
|
+ @Autowired
|
|
|
53
|
+ MsCaseFlowMapper caseFlowMapper;
|
|
|
54
|
+ @Autowired
|
|
|
55
|
+ private MsCaseApplicationMapper caseApplicationMapper;
|
|
35
|
56
|
|
|
36
|
57
|
|
|
37
|
58
|
|
|
|
@@ -220,6 +241,99 @@ public class FixSelectFlowDetailUtils {
|
|
220
|
241
|
}
|
|
221
|
242
|
}
|
|
222
|
243
|
|
|
|
244
|
+ /*
|
|
|
245
|
+ 定时查询签署流程详情
|
|
|
246
|
+ */
|
|
|
247
|
+// @Scheduled(cron = "0/10 * * * * ?")
|
|
|
248
|
+ @Transactional
|
|
|
249
|
+ public void fixExecuteSelectFlowDetailUtils() {
|
|
|
250
|
+ Gson gson = new Gson();
|
|
|
251
|
+
|
|
|
252
|
+ List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat();
|
|
|
253
|
+
|
|
|
254
|
+ try {
|
|
|
255
|
+ if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
|
256
|
+ for (int i = 0; i < sealSignRecords.size(); i++) {
|
|
|
257
|
+ MsSealSignRecord mssealSignRecord = sealSignRecords.get(i);
|
|
|
258
|
+ SealSignRecord sealSignRecord = new SealSignRecord();
|
|
|
259
|
+ BeanUtil.copyProperties(mssealSignRecord, sealSignRecord);
|
|
|
260
|
+ sealSignRecord.setSignFlowid(mssealSignRecord.getSignFlowId());
|
|
|
261
|
+ EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
|
|
|
262
|
+ JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
|
|
|
263
|
+ JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
|
|
|
264
|
+ JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
|
|
|
265
|
+ List<Integer> psnsignStatusList = new ArrayList<>();
|
|
|
266
|
+ Integer psnsignStatus = null;
|
|
|
267
|
+ Integer orgsignStatus = null;
|
|
|
268
|
+ for (int j = 0; j < signersArray.size(); j++) {
|
|
|
269
|
+ JsonObject signerObject = (JsonObject) signersArray.get(j);
|
|
|
270
|
+
|
|
|
271
|
+ if (!(signerObject.get("psnSigner").toString()).equals("null")) {
|
|
|
272
|
+ JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
|
|
|
273
|
+ if (psnSignerData != null) {
|
|
|
274
|
+ psnsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
275
|
+ psnsignStatusList.add(psnsignStatus);
|
|
|
276
|
+ }
|
|
|
277
|
+ }
|
|
|
278
|
+ if (!(signerObject.get("orgSigner").toString()).equals("null")) {
|
|
|
279
|
+ JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
|
|
|
280
|
+ if (orgSignerData != null) {
|
|
|
281
|
+ orgsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
282
|
+ }
|
|
|
283
|
+ }
|
|
|
284
|
+
|
|
|
285
|
+ }
|
|
|
286
|
+
|
|
|
287
|
+ List<Integer> psnsignStatusListnew = psnsignStatusList.stream().distinct().collect(Collectors.toList());
|
|
|
288
|
+
|
|
|
289
|
+ if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 1)) {
|
|
|
290
|
+ //更新立案申请状态为待用印
|
|
|
291
|
+ MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
|
|
|
292
|
+ if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 1)) {
|
|
|
293
|
+ // 根据流程id查找下一个流程节点
|
|
|
294
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getId().intValue());
|
|
|
295
|
+ MsCaseApplication application = new MsCaseApplication();
|
|
|
296
|
+ application.setId(caseApplicationselect.getId());
|
|
|
297
|
+ application.setCaseFlowId(nextFlow.getId());
|
|
|
298
|
+ application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
299
|
+ caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
300
|
+
|
|
|
301
|
+ //修改"签署用印记录表"的状态为待用印
|
|
|
302
|
+ mssealSignRecord.setSignFlowStatus(2);
|
|
|
303
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
|
|
|
304
|
+ }
|
|
|
305
|
+ }
|
|
|
306
|
+ if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 2)) {
|
|
|
307
|
+ //更新立案申请状态为待送达
|
|
|
308
|
+ MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
|
|
|
309
|
+
|
|
|
310
|
+ if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 2)) {
|
|
|
311
|
+ //修改"签署用印记录表"的状态为签署完成
|
|
|
312
|
+ mssealSignRecord.setSignFlowStatus(3);
|
|
|
313
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
|
|
|
314
|
+
|
|
|
315
|
+ // 根据流程id查找下一个流程节点
|
|
|
316
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getId().intValue());
|
|
|
317
|
+ MsCaseApplication application = new MsCaseApplication();
|
|
|
318
|
+ application.setId(caseApplicationselect.getId());
|
|
|
319
|
+ application.setCaseFlowId(nextFlow.getId());
|
|
|
320
|
+ application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
321
|
+ caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
322
|
+ }
|
|
|
323
|
+ }
|
|
|
324
|
+ }
|
|
|
325
|
+
|
|
|
326
|
+ }
|
|
|
327
|
+ } catch (EsignDemoException e) {
|
|
|
328
|
+ e.printStackTrace();
|
|
|
329
|
+ }
|
|
|
330
|
+
|
|
|
331
|
+ }
|
|
|
332
|
+
|
|
|
333
|
+
|
|
|
334
|
+
|
|
|
335
|
+
|
|
|
336
|
+
|
|
223
|
337
|
}
|
|
224
|
338
|
|
|
225
|
339
|
|