|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
5
|
5
|
import cn.hutool.core.util.StrUtil;
|
|
6
|
6
|
|
|
7
|
7
|
|
|
|
8
|
+
|
|
8
|
9
|
import com.alibaba.fastjson.JSONArray;
|
|
9
|
10
|
import com.alibaba.fastjson.JSONObject;
|
|
10
|
11
|
import com.google.gson.Gson;
|
|
|
@@ -12,9 +13,16 @@ import com.google.gson.JsonArray;
|
|
12
|
13
|
import com.google.gson.JsonObject;
|
|
13
|
14
|
import com.ruoyi.common.annotation.DataScope;
|
|
14
|
15
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
|
16
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
15
|
17
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
16
|
18
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
17
|
19
|
|
|
|
20
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
21
|
+import com.ruoyi.common.exception.EsignDemoException;
|
|
|
22
|
+import com.ruoyi.common.exception.ServiceException;
|
|
|
23
|
+import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
|
24
|
+
|
|
|
25
|
+
|
|
18
|
26
|
|
|
19
|
27
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
20
|
28
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
|
@@ -57,14 +65,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
57
|
65
|
private ArbitratorMapper arbitratorMapper;
|
|
58
|
66
|
@Autowired
|
|
59
|
67
|
private ArbitrateRecordMapper arbitrateRecordMapper;
|
|
60
|
|
-
|
|
|
68
|
+ @Autowired
|
|
|
69
|
+ private ICaseApplicationService caseApplicationService;
|
|
61
|
70
|
@Autowired
|
|
62
|
71
|
private CaseAttachMapper caseAttachMapper;
|
|
63
|
72
|
@Autowired
|
|
64
|
73
|
private SysDeptMapper sysDeptMapper;
|
|
65
|
74
|
@Autowired
|
|
66
|
|
- private ICaseApplicationService caseApplicationService;
|
|
67
|
|
- @Autowired
|
|
68
|
75
|
private SysUserMapper sysUserMapper;
|
|
69
|
76
|
@Autowired
|
|
70
|
77
|
private SealSignRecordMapper sealSignRecordMapper;
|
|
|
@@ -712,6 +719,121 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
712
|
719
|
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
|
|
713
|
720
|
Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck();
|
|
714
|
721
|
if(agreeOrNotCheck.intValue()==1){//同意审核
|
|
|
722
|
+ try {
|
|
|
723
|
+ //获取当前案件的裁决书
|
|
|
724
|
+ CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
|
|
|
725
|
+ List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
|
|
|
726
|
+ if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
|
727
|
+ for (CaseAttach caseAttach : caseAttachList) {
|
|
|
728
|
+ if (caseAttach.getAnnexType() == 3) {
|
|
|
729
|
+ String annexPath = caseAttach.getAnnexPath();
|
|
|
730
|
+ String path = "/home/ruoyi/" + annexPath;
|
|
|
731
|
+ System.out.println("这是查询到的裁决书路径"+path);
|
|
|
732
|
+ //String path ="D:\\home\\仲裁裁决书模板.docx";
|
|
|
733
|
+ //获取文件上传地址
|
|
|
734
|
+ EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
|
|
735
|
+ String body = response.getBody();
|
|
|
736
|
+ if (body != null){
|
|
|
737
|
+ JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
738
|
+ String fileId = jsonObject.getJSONObject("data").getString("fileId");
|
|
|
739
|
+ String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
|
|
|
740
|
+ //上传文件流
|
|
|
741
|
+ EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
|
|
|
742
|
+ JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
|
|
|
743
|
+ if (jsonObject1.getIntValue("errCode")==0){
|
|
|
744
|
+ //查看文件上传状态
|
|
|
745
|
+ Thread.sleep(5000);
|
|
|
746
|
+ EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
|
|
|
747
|
+ JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
|
|
|
748
|
+ JSONObject data = jsonObject2.getJSONObject("data");
|
|
|
749
|
+ int fileStatus =data.getIntValue("fileStatus");
|
|
|
750
|
+ if (fileStatus == 2 || fileStatus == 5){
|
|
|
751
|
+ String fileName = data.getString("fileName");
|
|
|
752
|
+ //上传成功,获取文件签名印章位置
|
|
|
753
|
+ SealSignRecord sealSignRecord = new SealSignRecord();
|
|
|
754
|
+ sealSignRecord.setFileid(fileId);
|
|
|
755
|
+ EsignHttpResponse positions = SignAward.getPositions(sealSignRecord);
|
|
|
756
|
+ Gson gson = new Gson();
|
|
|
757
|
+ JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
|
|
|
758
|
+ JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
|
|
|
759
|
+ String keywordPositions = positionsData.get("keywordPositions").toString();
|
|
|
760
|
+ //发起签署
|
|
|
761
|
+ sealSignRecord.setFilename(fileName);
|
|
|
762
|
+ String arbitratorId = caseApplication2.getArbitratorId();
|
|
|
763
|
+ if (arbitratorId!=null){
|
|
|
764
|
+ SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
|
|
|
765
|
+ if (sysUser == null){
|
|
|
766
|
+ return rows;
|
|
|
767
|
+ }
|
|
|
768
|
+ sealSignRecord.setPensonAccount(sysUser.getPhonenumber());
|
|
|
769
|
+ sealSignRecord.setPensonName(sysUser.getNickName());
|
|
|
770
|
+ }
|
|
|
771
|
+ sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
|
|
|
772
|
+ sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
|
|
|
773
|
+ sealSignRecord.setOrgnizeNamepsnName("韩超勃");
|
|
|
774
|
+ //解析文件签名印章位置
|
|
|
775
|
+ JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
|
|
|
776
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
777
|
+ JSONObject jsonObject3 = jsonArray.getJSONObject(i);
|
|
|
778
|
+ String keyword = jsonObject3.getString("keyword");
|
|
|
779
|
+ if (keyword.equals("仲裁员:")){
|
|
|
780
|
+ //签名
|
|
|
781
|
+ JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
|
782
|
+ // 遍历 positionsArray 中的每个元素
|
|
|
783
|
+ for (int j = 0; j < positionsArray.size(); j++){
|
|
|
784
|
+ JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
|
785
|
+ int pageNum = positionObj.getIntValue("pageNum");
|
|
|
786
|
+ sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
|
|
|
787
|
+ JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
|
788
|
+ JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
|
789
|
+ double positionX = coordinateObj.getDoubleValue("positionX");
|
|
|
790
|
+ double positionY = coordinateObj.getDoubleValue("positionY");
|
|
|
791
|
+ sealSignRecord.setPositionXpsn(positionX);
|
|
|
792
|
+ sealSignRecord.setPositionYpsn(positionY);
|
|
|
793
|
+ }
|
|
|
794
|
+ }else {
|
|
|
795
|
+ //用印
|
|
|
796
|
+ JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
|
797
|
+ // 遍历 positionsArray 中的每个元素
|
|
|
798
|
+ for (int j = 0; j < positionsArray.size(); j++) {
|
|
|
799
|
+ JSONObject positionObj = positionsArray.getJSONObject(j);
|
|
|
800
|
+ int pageNum = positionObj.getIntValue("pageNum");
|
|
|
801
|
+ sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
|
|
|
802
|
+ JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
|
|
|
803
|
+ JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
|
|
|
804
|
+ double positionX = coordinateObj.getDoubleValue("positionX");
|
|
|
805
|
+ double positionY = coordinateObj.getDoubleValue("positionY");
|
|
|
806
|
+ sealSignRecord.setPositionXorg(positionX);
|
|
|
807
|
+ sealSignRecord.setPositionYorg(positionY);
|
|
|
808
|
+ }
|
|
|
809
|
+ }
|
|
|
810
|
+ }
|
|
|
811
|
+ EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
|
|
|
812
|
+ JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
|
|
|
813
|
+ if (jsonObject3.getIntValue("code")==0){
|
|
|
814
|
+ //获取签署流程ID
|
|
|
815
|
+ JSONObject data1 = jsonObject3.getJSONObject("data");
|
|
|
816
|
+ String signFlowId = data1.getString("signFlowId");
|
|
|
817
|
+ //保存案件id,文件id,文件名称.流程id到签署用印记录表里
|
|
|
818
|
+ sealSignRecord.setCaseAppliId(caseApplication.getId());
|
|
|
819
|
+ sealSignRecord.setSignFlowid(signFlowId);
|
|
|
820
|
+ sealSignRecord.setSignFlowStatus(1);//待签名
|
|
|
821
|
+ sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
|
|
|
822
|
+ }else {
|
|
|
823
|
+ throw new ServiceException("发起签署流程失败,请检查参数是否有误");
|
|
|
824
|
+ }
|
|
|
825
|
+ }
|
|
|
826
|
+ }
|
|
|
827
|
+ }
|
|
|
828
|
+ break;
|
|
|
829
|
+ }
|
|
|
830
|
+ }
|
|
|
831
|
+ }
|
|
|
832
|
+ } catch (EsignDemoException e) {
|
|
|
833
|
+ e.printStackTrace();
|
|
|
834
|
+ } catch (InterruptedException e) {
|
|
|
835
|
+ e.printStackTrace();
|
|
|
836
|
+ }
|
|
715
|
837
|
caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION);
|
|
716
|
838
|
// 新增日志
|
|
717
|
839
|
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,"");
|