|
|
@@ -4,14 +4,22 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|
4
|
4
|
import cn.hutool.core.collection.CollectionUtil;
|
|
5
|
5
|
import cn.hutool.core.util.StrUtil;
|
|
6
|
6
|
|
|
|
7
|
+import com.alibaba.fastjson.JSONArray;
|
|
7
|
8
|
import com.alibaba.fastjson.JSONObject;
|
|
|
9
|
+import com.google.gson.Gson;
|
|
|
10
|
+import com.google.gson.JsonArray;
|
|
|
11
|
+import com.google.gson.JsonObject;
|
|
8
|
12
|
import com.ruoyi.common.annotation.DataScope;
|
|
9
|
13
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
10
|
14
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
11
|
15
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
16
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
12
|
17
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
13
|
18
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
19
|
+import com.ruoyi.common.utils.SignAward;
|
|
|
20
|
+import com.ruoyi.common.utils.bean.SealSignRecord;
|
|
14
|
21
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
|
22
|
+import com.ruoyi.system.mapper.SysUserMapper;
|
|
15
|
23
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
16
|
24
|
import com.ruoyi.common.utils.DateUtils;
|
|
17
|
25
|
import com.ruoyi.common.utils.SmsUtils;
|
|
|
@@ -55,6 +63,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
55
|
63
|
private SysDeptMapper sysDeptMapper;
|
|
56
|
64
|
@Autowired
|
|
57
|
65
|
private ICaseApplicationService caseApplicationService;
|
|
|
66
|
+ @Autowired
|
|
|
67
|
+ private SysUserMapper sysUserMapper;
|
|
|
68
|
+ @Autowired
|
|
|
69
|
+ private SealSignRecordMapper sealSignRecordMapper;
|
|
58
|
70
|
|
|
59
|
71
|
// 手机号正则
|
|
60
|
72
|
private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
|
|
|
@@ -707,7 +719,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
707
|
719
|
for (CaseAttach caseAttach : caseAttachList) {
|
|
708
|
720
|
if (caseAttach.getAnnexType() == 3) {
|
|
709
|
721
|
String annexPath = caseAttach.getAnnexPath();
|
|
710
|
|
- String path = "/home/ruoyi/" + annexPath;
|
|
|
722
|
+ //String path = "/home/ruoyi/" + annexPath;
|
|
|
723
|
+ String path ="D:\\home\\仲裁裁决书模板.docx";
|
|
711
|
724
|
//获取文件上传地址
|
|
712
|
725
|
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
|
713
|
726
|
String body = response.getBody();
|
|
|
@@ -723,13 +736,87 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
723
|
736
|
Thread.sleep(5000);
|
|
724
|
737
|
EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
|
|
725
|
738
|
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
|
|
726
|
|
- int fileStatus = jsonObject2.getJSONObject("data").getIntValue("fileStatus");
|
|
|
739
|
+ JSONObject data = jsonObject2.getJSONObject("data");
|
|
|
740
|
+ int fileStatus =data.getIntValue("fileStatus");
|
|
727
|
741
|
if (fileStatus == 2 || fileStatus == 5){
|
|
728
|
|
- //上传成功,发起签署流程
|
|
729
|
|
- //保存案件id,文件id,文件名称.流程id到签署用印记录表里
|
|
|
742
|
+ String fileName = data.getString("fileName");
|
|
|
743
|
+ //上传成功,获取文件签名印章位置
|
|
|
744
|
+ SealSignRecord sealSignRecord = new SealSignRecord();
|
|
|
745
|
+ sealSignRecord.setFileid(fileId);
|
|
|
746
|
+ EsignHttpResponse positions = SignAward.getPositions(sealSignRecord);
|
|
|
747
|
+ Gson gson = new Gson();
|
|
|
748
|
+ JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
|
|
|
749
|
+ JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
|
|
|
750
|
+ String keywordPositions = positionsData.get("keywordPositions").getAsString();
|
|
|
751
|
+ //发起签署
|
|
|
752
|
+ sealSignRecord.setFilename(fileName);
|
|
|
753
|
+ String arbitratorId = caseApplication2.getArbitratorId();
|
|
|
754
|
+ if (arbitratorId!=null){
|
|
|
755
|
+ SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
|
|
|
756
|
+ if (sysUser == null){
|
|
|
757
|
+ return rows;
|
|
|
758
|
+ }
|
|
|
759
|
+ sealSignRecord.setPensonAccount(sysUser.getPhonenumber());
|
|
|
760
|
+ sealSignRecord.setPensonName(sysUser.getNickName());
|
|
|
761
|
+ }
|
|
|
762
|
+ sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
|
|
|
763
|
+ sealSignRecord.setOrgnizeNamePsnAccount("秦桃则");
|
|
|
764
|
+ sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
|
|
|
765
|
+ sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
|
|
|
766
|
+ sealSignRecord.setOrgnizeNamepsnName("韩超勃");
|
|
|
767
|
+ //解析文件签名印章位置
|
|
|
768
|
+ JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
|
|
|
769
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
770
|
+ JSONObject jsonObject3 = jsonArray.getJSONObject(i);
|
|
|
771
|
+ String keyword = jsonObject3.getString("keyword");
|
|
|
772
|
+ if (keyword.equals("仲裁员")){
|
|
|
773
|
+ //签名
|
|
|
774
|
+ JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
|
775
|
+ // 遍历 positionsArray 中的每个元素
|
|
|
776
|
+ for (int j = 0; j < positionsArray.size(); j++){
|
|
|
777
|
+ JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
|
778
|
+ int pageNum = positionObj.getIntValue("pageNum");
|
|
|
779
|
+ sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
|
|
|
780
|
+ JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
|
781
|
+ JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
|
782
|
+ double positionX = coordinateObj.getDoubleValue("positionX");
|
|
|
783
|
+ double positionY = coordinateObj.getDoubleValue("positionY");
|
|
|
784
|
+ sealSignRecord.setPositionXpsn(positionX);
|
|
|
785
|
+ sealSignRecord.setPositionYpsn(positionY);
|
|
|
786
|
+ }
|
|
|
787
|
+ }else {
|
|
|
788
|
+ //用印
|
|
|
789
|
+ JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
|
790
|
+ // 遍历 positionsArray 中的每个元素
|
|
|
791
|
+ for (int j = 0; j < positionsArray.size(); j++) {
|
|
|
792
|
+ JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
|
793
|
+ int pageNum = positionObj.getIntValue("pageNum");
|
|
|
794
|
+ sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
|
|
|
795
|
+ JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
|
796
|
+ JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
|
797
|
+ double positionX = coordinateObj.getDoubleValue("positionX");
|
|
|
798
|
+ double positionY = coordinateObj.getDoubleValue("positionY");
|
|
|
799
|
+ sealSignRecord.setPositionXorg(positionX);
|
|
|
800
|
+ sealSignRecord.setPositionYorg(positionY);
|
|
|
801
|
+ }
|
|
|
802
|
+ }
|
|
|
803
|
+ }
|
|
|
804
|
+ EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
|
|
|
805
|
+ JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
|
|
|
806
|
+ if (jsonObject1.getIntValue("code")==0){
|
|
|
807
|
+ //获取签署流程ID
|
|
|
808
|
+ JSONObject data1 = jsonObject3.getJSONObject("data");
|
|
|
809
|
+ String signFlowId = data1.getString("signFlowId");
|
|
|
810
|
+ //保存案件id,文件id,文件名称.流程id到签署用印记录表里
|
|
|
811
|
+ sealSignRecord.setCaseAppliId(caseApplication.getId());
|
|
|
812
|
+ sealSignRecord.setSignFlowid(signFlowId);
|
|
|
813
|
+ sealSignRecord.setSignFlowStatus(1);//待签名
|
|
|
814
|
+ sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
|
|
|
815
|
+ }
|
|
730
|
816
|
}
|
|
731
|
817
|
}
|
|
732
|
818
|
}
|
|
|
819
|
+ break;
|
|
733
|
820
|
}
|
|
734
|
821
|
}
|
|
735
|
822
|
}
|