|
|
@@ -20,6 +20,7 @@ import com.ruoyi.common.utils.SmsUtils;
|
|
20
|
20
|
import com.ruoyi.common.utils.StringUtils;
|
|
21
|
21
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
22
|
22
|
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
|
|
|
23
|
+import com.ruoyi.system.mapper.SysUserMapper;
|
|
23
|
24
|
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
|
|
24
|
25
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
|
25
|
26
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
|
|
@@ -68,6 +69,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
68
|
69
|
@Autowired
|
|
69
|
70
|
MsCaseFlowMapper caseFlowMapper;
|
|
70
|
71
|
|
|
|
72
|
+ @Autowired
|
|
|
73
|
+ private SysUserMapper sysUserMapper;
|
|
|
74
|
+
|
|
71
|
75
|
@Autowired
|
|
72
|
76
|
private MsSealSignRecordMapper sealSignRecordMapper;
|
|
73
|
77
|
|
|
|
@@ -125,6 +129,16 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
125
|
129
|
//发起签署
|
|
126
|
130
|
sealSignRecord.setFilename(fileName);
|
|
127
|
131
|
|
|
|
132
|
+ Long arbitratorId = caseApplication.getMediatorId();
|
|
|
133
|
+ if (arbitratorId != null) {
|
|
|
134
|
+ SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
|
|
|
135
|
+ if (sysUser == null) {
|
|
|
136
|
+ return AjaxResult.error();
|
|
|
137
|
+ }
|
|
|
138
|
+ sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
|
|
|
139
|
+ sealSignRecord.setPensonNameMedi(sysUser.getNickName());
|
|
|
140
|
+ }
|
|
|
141
|
+
|
|
128
|
142
|
sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
|
|
129
|
143
|
sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
|
|
130
|
144
|
sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone());
|
|
|
@@ -161,7 +175,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
161
|
175
|
double positionX = coordinateObj.getDoubleValue("positionX");
|
|
162
|
176
|
double positionY = coordinateObj.getDoubleValue("positionY");
|
|
163
|
177
|
sealSignRecord.setPositionXpsn(positionX + 90);
|
|
164
|
|
- sealSignRecord.setPositionYpsn(positionY);
|
|
|
178
|
+ sealSignRecord.setPositionYpsn(positionY + 30);
|
|
165
|
179
|
}
|
|
166
|
180
|
}else if (keyword.equals("被申请人:")) {
|
|
167
|
181
|
//签名
|
|
|
@@ -178,6 +192,21 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
178
|
192
|
sealSignRecord.setPositionXpsnRes(positionX + 90);
|
|
179
|
193
|
sealSignRecord.setPositionYpsnRes(positionY);
|
|
180
|
194
|
}
|
|
|
195
|
+ }else 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.setPositionPagepsnMedi(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.setPositionXpsnMedi(positionX + 90);
|
|
|
208
|
+ sealSignRecord.setPositionYpsnMedi(positionY);
|
|
|
209
|
+ }
|
|
181
|
210
|
}else {
|
|
182
|
211
|
//用印
|
|
183
|
212
|
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
|
|
|
@@ -288,6 +317,20 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
288
|
317
|
request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew});
|
|
289
|
318
|
Boolean aBoolean1 = SmsUtils.sendSms(request1);
|
|
290
|
319
|
|
|
|
320
|
+ SealSignRecord sealSignRecordMedi = new SealSignRecord();
|
|
|
321
|
+ sealSignRecordMedi.setSignFlowid(signFlowId);
|
|
|
322
|
+ sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
|
|
|
323
|
+ EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
|
|
|
324
|
+ JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
|
|
|
325
|
+ JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
|
|
|
326
|
+ String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
|
|
|
327
|
+ String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
|
|
|
328
|
+
|
|
|
329
|
+ SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
|
|
|
330
|
+ requestMedi.setTemplateId("2047719");
|
|
|
331
|
+ requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
|
|
|
332
|
+ requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi});
|
|
|
333
|
+ Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
|
|
291
|
334
|
|
|
292
|
335
|
} else {
|
|
293
|
336
|
throw new ServiceException(jsonObject3.getString("message"));
|
|
|
@@ -646,7 +689,103 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
646
|
689
|
|
|
647
|
690
|
}
|
|
648
|
691
|
|
|
|
692
|
+ @Override
|
|
|
693
|
+ @Transactional
|
|
|
694
|
+ public AjaxResult testSeal(MsSignSealDTO dto) {
|
|
|
695
|
+
|
|
|
696
|
+ Gson gson = new Gson();
|
|
|
697
|
+
|
|
|
698
|
+ List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat();
|
|
|
699
|
+
|
|
|
700
|
+ try {
|
|
|
701
|
+ if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
|
702
|
+ for (int i = 0; i < sealSignRecords.size(); i++) {
|
|
|
703
|
+ MsSealSignRecord mssealSignRecord = sealSignRecords.get(i);
|
|
|
704
|
+ SealSignRecord sealSignRecord = new SealSignRecord();
|
|
|
705
|
+ BeanUtil.copyProperties(mssealSignRecord, sealSignRecord);
|
|
|
706
|
+
|
|
|
707
|
+ String signFlowId = mssealSignRecord.getSignFlowId();
|
|
|
708
|
+ if(StringUtils.isNotEmpty(signFlowId) && "819e60824fe241e9b862bd787403fa5e".equals(signFlowId)){
|
|
|
709
|
+ sealSignRecord.setSignFlowid(mssealSignRecord.getSignFlowId());
|
|
|
710
|
+ EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
|
|
|
711
|
+ JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
|
|
|
712
|
+ JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
|
|
|
713
|
+ JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
|
|
|
714
|
+ List<Integer> psnsignStatusList = new ArrayList<>();
|
|
|
715
|
+ Integer psnsignStatus = null;
|
|
|
716
|
+ Integer orgsignStatus = null;
|
|
|
717
|
+ for (int j = 0; j < signersArray.size(); j++) {
|
|
|
718
|
+ JsonObject signerObject = (JsonObject) signersArray.get(j);
|
|
|
719
|
+
|
|
|
720
|
+ if (!(signerObject.get("psnSigner").toString()).equals("null")) {
|
|
|
721
|
+ JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
|
|
|
722
|
+ if (psnSignerData != null) {
|
|
|
723
|
+ psnsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
724
|
+ psnsignStatusList.add(psnsignStatus);
|
|
|
725
|
+ }
|
|
|
726
|
+ }
|
|
|
727
|
+ if (!(signerObject.get("orgSigner").toString()).equals("null")) {
|
|
|
728
|
+ JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
|
|
|
729
|
+ if (orgSignerData != null) {
|
|
|
730
|
+ orgsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
731
|
+ }
|
|
|
732
|
+ }
|
|
|
733
|
+
|
|
|
734
|
+ }
|
|
|
735
|
+
|
|
|
736
|
+ List<Integer> psnsignStatusListnew = psnsignStatusList.stream().distinct().collect(Collectors.toList());
|
|
|
737
|
+
|
|
|
738
|
+ if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 1)) {
|
|
|
739
|
+ //更新立案申请状态为待用印
|
|
|
740
|
+ MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
|
|
|
741
|
+ if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 1)) {
|
|
|
742
|
+ // 根据流程id查找下一个流程节点
|
|
|
743
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
|
|
|
744
|
+ MsCaseApplication application = new MsCaseApplication();
|
|
|
745
|
+ application.setId(caseApplicationselect.getId());
|
|
|
746
|
+ application.setCaseFlowId(nextFlow.getId());
|
|
|
747
|
+ application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
748
|
+ caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
749
|
+
|
|
|
750
|
+ //修改"签署用印记录表"的状态为待用印
|
|
|
751
|
+ mssealSignRecord.setSignFlowStatus(2);
|
|
|
752
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
|
|
|
753
|
+ }
|
|
|
754
|
+ }
|
|
|
755
|
+ if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 2)) {
|
|
|
756
|
+ //更新立案申请状态为待送达
|
|
|
757
|
+ MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
|
|
|
758
|
+
|
|
|
759
|
+ if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 2)) {
|
|
|
760
|
+ //修改"签署用印记录表"的状态为签署完成
|
|
|
761
|
+ mssealSignRecord.setSignFlowStatus(3);
|
|
|
762
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
|
|
|
763
|
+
|
|
|
764
|
+ // 根据流程id查找下一个流程节点
|
|
|
765
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
|
|
|
766
|
+ MsCaseApplication application = new MsCaseApplication();
|
|
|
767
|
+ application.setId(caseApplicationselect.getId());
|
|
|
768
|
+ application.setCaseFlowId(nextFlow.getId());
|
|
|
769
|
+ application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
770
|
+ caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
771
|
+ }
|
|
|
772
|
+ }
|
|
|
773
|
+
|
|
|
774
|
+ }
|
|
|
775
|
+
|
|
|
776
|
+
|
|
|
777
|
+ }
|
|
649
|
778
|
|
|
|
779
|
+ }
|
|
|
780
|
+ } catch (EsignDemoException e) {
|
|
|
781
|
+ e.printStackTrace();
|
|
|
782
|
+ }
|
|
|
783
|
+
|
|
|
784
|
+ return AjaxResult.success();
|
|
|
785
|
+
|
|
|
786
|
+
|
|
|
787
|
+
|
|
|
788
|
+ }
|
|
650
|
789
|
|
|
651
|
790
|
|
|
652
|
791
|
}
|