2023-10-12 17:20:40 +08:00
|
|
|
package com.ruoyi.wisdomarbitrate.utils;
|
|
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
import com.google.gson.JsonArray;
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
|
|
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
|
|
|
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
2023-10-13 10:57:45 +08:00
|
|
|
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
|
2023-10-12 17:20:40 +08:00
|
|
|
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
|
2023-10-13 10:57:45 +08:00
|
|
|
import com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper;
|
2023-10-12 17:20:40 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2023-10-13 10:57:45 +08:00
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
2023-10-12 17:20:40 +08:00
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Component
|
2023-10-12 17:20:40 +08:00
|
|
|
public class FixSelectFlowDetailUtils {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CaseApplicationMapper caseApplicationMapper;
|
2023-10-13 10:57:45 +08:00
|
|
|
@Autowired
|
|
|
|
|
private SealSignRecordMapper sealSignRecordMapper;
|
2023-10-12 17:20:40 +08:00
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
@Scheduled(cron = "0/3 * * * * ?")
|
2023-10-12 17:20:40 +08:00
|
|
|
public void fixExecuteSelectFlowDetailUtils() throws EsignDemoException {
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
SealSignRecord sealSignRecordselect = new SealSignRecord();
|
|
|
|
|
sealSignRecordselect.setSignFlowStatus(1);
|
2023-10-12 17:20:40 +08:00
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
|
|
|
|
|
if(sealSignRecords!=null&&sealSignRecords.size()>0){
|
|
|
|
|
for (int i = 0; i < sealSignRecords.size(); i++) {
|
|
|
|
|
SealSignRecord sealSignRecord = sealSignRecords.get(i);
|
|
|
|
|
EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
|
|
|
|
|
JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
|
|
|
|
|
JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
|
|
|
|
|
JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
|
2023-10-12 17:20:40 +08:00
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
System.out.println("signFlowDetailJsonObject-----------"+signFlowDetailJsonObject.toString());
|
2023-10-12 17:20:40 +08:00
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
Integer psnsignStatus = null;
|
|
|
|
|
Integer orgsignStatus = null;
|
|
|
|
|
for (int j = 0; j < signersArray.size(); j++) {
|
|
|
|
|
JsonObject signerObject = (JsonObject)signersArray.get(j);
|
2023-10-12 17:20:40 +08:00
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
if(!(signerObject.get("psnSigner").toString()).equals("null")){
|
|
|
|
|
JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
|
|
|
|
|
if(psnSignerData!=null){
|
|
|
|
|
psnsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!(signerObject.get("orgSigner").toString()).equals("null")){
|
|
|
|
|
JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
|
|
|
|
|
if(orgSignerData!=null){
|
|
|
|
|
orgsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
|
|
}
|
2023-10-12 17:20:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
System.out.println("psnsignStatus-----------"+psnsignStatus);
|
|
|
|
|
System.out.println("orgsignStatus-----------"+orgsignStatus);
|
|
|
|
|
|
|
|
|
|
if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==1)){
|
|
|
|
|
//更新立案申请状态为待用印
|
|
|
|
|
CaseApplication caseApplication = new CaseApplication();
|
|
|
|
|
caseApplication.setId(sealSignRecord.getCaseAppliId());
|
|
|
|
|
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
|
|
|
|
|
caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
|
|
|
|
|
|
|
|
//修改"签署用印记录表"的状态为待用印
|
|
|
|
|
sealSignRecord.setSignFlowStatus(2);
|
|
|
|
|
sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
|
|
|
|
|
}
|
|
|
|
|
if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==2)){
|
|
|
|
|
//更新立案申请状态为待送达
|
|
|
|
|
CaseApplication caseApplication = new CaseApplication();
|
|
|
|
|
caseApplication.setId(sealSignRecord.getCaseAppliId());
|
|
|
|
|
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
|
|
|
|
|
caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
|
|
|
|
|
|
|
|
//修改"签署用印记录表"的状态为签署完成
|
|
|
|
|
sealSignRecord.setSignFlowStatus(3);
|
|
|
|
|
sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
|
|
|
|
|
|
|
|
|
|
//下载审核完成的裁决书,
|
|
|
|
|
// SaaSAPIFileUtils.fileDownloadUrl();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-10-12 17:20:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-13 10:57:45 +08:00
|
|
|
// Gson gson = new Gson();
|
|
|
|
|
//
|
|
|
|
|
// SealSignRecord sealSignRecord = new SealSignRecord();
|
|
|
|
|
// sealSignRecord.setSignFlowid("41e6732b48c54c63a91b2379c352212d");
|
|
|
|
|
// EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
|
|
|
|
|
// JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
|
|
|
|
|
// JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
|
|
|
|
|
// JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
|
|
|
|
|
// for (int i = 0; i < signersArray.size(); i++) {
|
|
|
|
|
// JsonObject signerObject = (JsonObject)signersArray.get(i);
|
|
|
|
|
// Integer psnsignStatus ;
|
|
|
|
|
// Integer orgsignStatus ;
|
|
|
|
|
// if(!(signerObject.get("psnSigner").toString()).equals("null")){
|
|
|
|
|
// JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
|
|
|
|
|
// if(psnSignerData!=null){
|
|
|
|
|
// psnsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
|
|
// sealSignRecord.setPsnsignStatus(psnsignStatus);
|
|
|
|
|
//
|
|
|
|
|
// if(psnsignStatus.intValue()==2){
|
|
|
|
|
// //更新立案申请状态为待用印
|
|
|
|
|
// CaseApplication caseApplication = new CaseApplication();
|
|
|
|
|
// caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
|
|
|
|
|
// caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if(!(signerObject.get("orgSigner").toString()).equals("null")){
|
|
|
|
|
// JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
|
|
|
|
|
// if(orgSignerData!=null){
|
|
|
|
|
// orgsignStatus = signerObject.get("signStatus").getAsInt();
|
|
|
|
|
// sealSignRecord.setOrgsignStatus(orgsignStatus);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
2023-10-12 17:20:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|