|
|
@@ -3,8 +3,6 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|
3
|
3
|
|
|
4
|
4
|
import cn.hutool.core.collection.CollectionUtil;
|
|
5
|
5
|
import cn.hutool.core.util.StrUtil;
|
|
6
|
|
-
|
|
7
|
|
-
|
|
8
|
6
|
import com.alibaba.fastjson.JSONArray;
|
|
9
|
7
|
import com.alibaba.fastjson.JSONObject;
|
|
10
|
8
|
import com.google.gson.Gson;
|
|
|
@@ -12,10 +10,8 @@ import com.google.gson.JsonArray;
|
|
12
|
10
|
import com.google.gson.JsonObject;
|
|
13
|
11
|
import com.ruoyi.common.annotation.DataScope;
|
|
14
|
12
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
15
|
|
-import com.ruoyi.common.constant.Constants;
|
|
16
|
13
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
17
|
14
|
import com.ruoyi.common.core.domain.entity.*;
|
|
18
|
|
-
|
|
19
|
15
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
20
|
16
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
21
|
17
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
@@ -26,6 +22,7 @@ import com.ruoyi.system.domain.SysUserRole;
|
|
26
|
22
|
import com.ruoyi.system.mapper.SysRoleMapper;
|
|
27
|
23
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
28
|
24
|
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
|
|
25
|
+import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
|
29
|
26
|
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
|
30
|
27
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
31
|
28
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
|
|
@@ -35,12 +32,19 @@ import com.ruoyi.wisdomarbitrate.mapper.*;
|
|
35
|
32
|
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
36
|
33
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
|
37
|
34
|
import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
|
|
|
35
|
+import com.tencentyun.TLSSigAPIv2;
|
|
|
36
|
+import org.apache.http.HttpEntity;
|
|
|
37
|
+import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
38
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
39
|
+import org.apache.http.entity.StringEntity;
|
|
|
40
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
41
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
42
|
+import org.apache.http.util.EntityUtils;
|
|
38
|
43
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
44
|
+import org.springframework.beans.factory.annotation.Value;
|
|
39
|
45
|
import org.springframework.stereotype.Service;
|
|
40
|
46
|
import org.springframework.transaction.annotation.Transactional;
|
|
41
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
42
|
47
|
import org.springframework.web.multipart.MultipartFile;
|
|
43
|
|
-
|
|
44
|
48
|
import java.io.*;
|
|
45
|
49
|
import java.math.BigDecimal;
|
|
46
|
50
|
import java.math.RoundingMode;
|
|
|
@@ -51,6 +55,7 @@ import java.text.SimpleDateFormat;
|
|
51
|
55
|
import java.time.LocalDate;
|
|
52
|
56
|
import java.time.ZoneId;
|
|
53
|
57
|
import java.util.*;
|
|
|
58
|
+import java.util.concurrent.ThreadLocalRandom;
|
|
54
|
59
|
import java.util.regex.Pattern;
|
|
55
|
60
|
import java.util.stream.Collectors;
|
|
56
|
61
|
|
|
|
@@ -61,6 +66,12 @@ import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
61
|
66
|
|
|
62
|
67
|
@Service
|
|
63
|
68
|
public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
69
|
+ // 腾讯云即时通信sdkAppId
|
|
|
70
|
+ @Value("${imConfig.sdkAppId}")
|
|
|
71
|
+ private long sdkAppId;
|
|
|
72
|
+ // 腾讯云即时通信密钥
|
|
|
73
|
+ @Value("${imConfig.secretKey}")
|
|
|
74
|
+ private String secretKey;
|
|
64
|
75
|
@Autowired
|
|
65
|
76
|
private CaseApplicationMapper caseApplicationMapper;
|
|
66
|
77
|
|
|
|
@@ -2436,74 +2447,73 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
2436
|
2447
|
}
|
|
2437
|
2448
|
|
|
2438
|
2449
|
|
|
2439
|
|
-// @Transactional
|
|
2440
|
|
-// public void fixExecuteSelectFlowDetailUtils() throws EsignDemoException {
|
|
2441
|
|
-//
|
|
2442
|
|
-// Gson gson = new Gson();
|
|
2443
|
|
-//
|
|
2444
|
|
-// SealSignRecord sealSignRecordselect = new SealSignRecord();
|
|
2445
|
|
-// sealSignRecordselect.setSignFlowStatus(1);
|
|
2446
|
|
-//
|
|
2447
|
|
-// List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecordselect);
|
|
2448
|
|
-// if(sealSignRecords!=null&&sealSignRecords.size()>0){
|
|
2449
|
|
-// for (int i = 0; i < sealSignRecords.size(); i++) {
|
|
2450
|
|
-// SealSignRecord sealSignRecord = sealSignRecords.get(i);
|
|
2451
|
|
-// EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
|
|
2452
|
|
-// JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
|
|
2453
|
|
-// JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
|
|
2454
|
|
-// JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
|
|
2455
|
|
-// for (int j = 0; j < signersArray.size(); j++) {
|
|
2456
|
|
-// JsonObject signerObject = (JsonObject)signersArray.get(j);
|
|
2457
|
|
-// Integer psnsignStatus ;
|
|
2458
|
|
-// Integer orgsignStatus ;
|
|
2459
|
|
-// if(!(signerObject.get("psnSigner").toString()).equals("null")){
|
|
2460
|
|
-// JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
|
|
2461
|
|
-// if(psnSignerData!=null){
|
|
2462
|
|
-// psnsignStatus = signerObject.get("signStatus").getAsInt();
|
|
2463
|
|
-// sealSignRecord.setPsnsignStatus(psnsignStatus);
|
|
2464
|
|
-//
|
|
2465
|
|
-// if(psnsignStatus.intValue()==2){
|
|
2466
|
|
-// //更新立案申请状态为待用印
|
|
2467
|
|
-// CaseApplication caseApplication = new CaseApplication();
|
|
2468
|
|
-// caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
|
|
2469
|
|
-// caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
2470
|
|
-//
|
|
2471
|
|
-// //修改"签署用印记录表"的状态为待用印
|
|
2472
|
|
-// sealSignRecord.setSignFlowStatus(2);
|
|
2473
|
|
-// sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
|
|
2474
|
|
-//
|
|
2475
|
|
-// }
|
|
2476
|
|
-// }
|
|
2477
|
|
-// }
|
|
2478
|
|
-// if(!(signerObject.get("orgSigner").toString()).equals("null")){
|
|
2479
|
|
-// JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
|
|
2480
|
|
-// if(orgSignerData!=null){
|
|
2481
|
|
-// orgsignStatus = signerObject.get("signStatus").getAsInt();
|
|
2482
|
|
-// sealSignRecord.setOrgsignStatus(orgsignStatus);
|
|
2483
|
|
-// //更新立案申请状态为待送达
|
|
2484
|
|
-// CaseApplication caseApplication = new CaseApplication();
|
|
2485
|
|
-// caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
|
|
2486
|
|
-// caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
2487
|
|
-//
|
|
2488
|
|
-// //修改"签署用印记录表"的状态为签署完成
|
|
2489
|
|
-// sealSignRecord.setSignFlowStatus(3);
|
|
2490
|
|
-// sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
|
|
2491
|
|
-//
|
|
2492
|
|
-// //下载审核完成的裁决书,
|
|
2493
|
|
-//// SaaSAPIFileUtils.fileDownloadUrl();
|
|
2494
|
|
-//
|
|
2495
|
|
-// }
|
|
2496
|
|
-//
|
|
2497
|
|
-// }
|
|
2498
|
|
-//
|
|
2499
|
|
-// }
|
|
2500
|
|
-//
|
|
2501
|
|
-// }
|
|
2502
|
|
-//
|
|
2503
|
|
-// }
|
|
|
2450
|
+ /**
|
|
|
2451
|
+ * 获取userSign,默认过期时间10小时
|
|
|
2452
|
+ * @param userId
|
|
|
2453
|
+ * @return
|
|
|
2454
|
+ */
|
|
|
2455
|
+ public String generateUserSign(String userId){
|
|
|
2456
|
+ TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, secretKey);
|
|
|
2457
|
+ return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
|
|
|
2458
|
+ }
|
|
2504
|
2459
|
|
|
2505
|
2460
|
|
|
2506
|
|
-// }
|
|
|
2461
|
+ /**
|
|
|
2462
|
+ * 预约会议
|
|
|
2463
|
+ * @param reservedConferenceVO
|
|
|
2464
|
+ * @return
|
|
|
2465
|
+ * @throws Exception
|
|
|
2466
|
+ */
|
|
|
2467
|
+ @Transactional
|
|
|
2468
|
+ @Override
|
|
|
2469
|
+ public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) throws Exception {
|
|
|
2470
|
+ // 生成administrator的userSig
|
|
|
2471
|
+ String administrator = "administrator";
|
|
|
2472
|
+ String userSign = generateUserSign(administrator);
|
|
|
2473
|
+ if (StrUtil.isEmpty(userSign)) {
|
|
|
2474
|
+ return AjaxResult.error("生成userSign失败");
|
|
|
2475
|
+ }
|
|
|
2476
|
+ int random = ThreadLocalRandom.current().nextInt(0, 214748364);
|
|
|
2477
|
+ String url="https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" +random + "&contenttype=json";
|
|
|
2478
|
+ HttpPost post = new HttpPost(url);
|
|
|
2479
|
+ String result = "";
|
|
|
2480
|
+
|
|
|
2481
|
+
|
|
|
2482
|
+ //添加参数
|
|
|
2483
|
+ JSONObject bodyParams = new JSONObject();
|
|
|
2484
|
+ bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
|
|
|
2485
|
+ bodyParams.put("roomId", reservedConferenceVO.getRoomId());
|
|
|
2486
|
+ bodyParams.put("scheduleStartTime", reservedConferenceVO.getScheduleStartTime());
|
|
|
2487
|
+ bodyParams.put("scheduleEndTime", reservedConferenceVO.getScheduleEndTime());
|
|
|
2488
|
+ StringEntity postingString = new StringEntity(bodyParams.toString());
|
|
|
2489
|
+ post.setEntity(postingString);
|
|
|
2490
|
+ CloseableHttpClient client = HttpClients.createDefault();
|
|
|
2491
|
+ //启动执行请求,并获得返回值
|
|
|
2492
|
+ CloseableHttpResponse response = client.execute(post);
|
|
|
2493
|
+ //得到返回的entity对象
|
|
|
2494
|
+ HttpEntity entity = response.getEntity();
|
|
|
2495
|
+ //把实体对象转换为string
|
|
|
2496
|
+ result = EntityUtils.toString(entity, "UTF-8");
|
|
|
2497
|
+ if (StrUtil.isNotEmpty(result)) {
|
|
|
2498
|
+ JSONObject resJson = JSONObject.parseObject(result);
|
|
|
2499
|
+ if ((int) resJson.get("errorCode") == 0 ) {
|
|
|
2500
|
+ // 绑定房间号和案件id
|
|
|
2501
|
+ caseApplicationMapper.bindCaseId(reservedConferenceVO.getCaseId(),reservedConferenceVO.getRoomId());
|
|
|
2502
|
+ return AjaxResult.success("预约会议成功");
|
|
|
2503
|
+ } else if((int) resJson.get("errorCode") == 42003){
|
|
|
2504
|
+ return AjaxResult.error("请求频繁");
|
|
|
2505
|
+ }else if((int) resJson.get("errorCode") == 84005){
|
|
|
2506
|
+ return AjaxResult.error("房间号已被占用");
|
|
|
2507
|
+ }else {
|
|
|
2508
|
+ return AjaxResult.error("预约会议失败");
|
|
|
2509
|
+ }
|
|
|
2510
|
+
|
|
|
2511
|
+ }else {
|
|
|
2512
|
+ return AjaxResult.error("预约会议失败");
|
|
|
2513
|
+ }
|
|
|
2514
|
+ }
|
|
2507
|
2515
|
|
|
2508
|
2516
|
|
|
2509
|
2517
|
}
|
|
|
2518
|
+
|
|
|
2519
|
+
|