11.9开发

This commit is contained in:
hejinbo
2023-11-09 17:34:12 +08:00
parent ae2c8fe59f
commit 94d3f1cb1e
10 changed files with 351 additions and 124 deletions
@@ -1,5 +1,7 @@
package com.ruoyi.wisdomarbitrate.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@@ -42,7 +44,7 @@ public class FixSelectFlowDetailUtils {
@Scheduled(cron = "0/10 * * * * ?")
@Transactional
public void fixExecuteSelectFlowDetailUtils(){
public void fixExecuteSelectFlowDetailUtils() {
Gson gson = new Gson();
SealSignRecord sealSignRecordselect = new SealSignRecord();
@@ -50,40 +52,40 @@ public class FixSelectFlowDetailUtils {
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
try {
if(sealSignRecords!=null&&sealSignRecords.size()>0){
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 signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
Integer psnsignStatus = null;
Integer orgsignStatus = null;
for (int j = 0; j < signersArray.size(); j++) {
JsonObject signerObject = (JsonObject)signersArray.get(j);
JsonObject signerObject = (JsonObject) signersArray.get(j);
if(!(signerObject.get("psnSigner").toString()).equals("null")){
if (!(signerObject.get("psnSigner").toString()).equals("null")) {
JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
if(psnSignerData!=null){
if (psnSignerData != null) {
psnsignStatus = signerObject.get("signStatus").getAsInt();
}
}
if(!(signerObject.get("orgSigner").toString()).equals("null")){
if (!(signerObject.get("orgSigner").toString()).equals("null")) {
JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
if(orgSignerData!=null){
if (orgSignerData != null) {
orgsignStatus = signerObject.get("signStatus").getAsInt();
}
}
}
if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==1)){
if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 1)) {
//更新立案申请状态为待用印
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(sealSignRecord.getCaseAppliId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if(caseApplicationselect!=null){
if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.SIGN_ARBITRATION)){
if (caseApplicationselect != null) {
if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.SIGN_ARBITRATION)) {
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplicationMapper.submitCaseApplication(caseApplication);
@@ -94,30 +96,30 @@ public class FixSelectFlowDetailUtils {
}
}
if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==2)){
if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 2)) {
//更新立案申请状态为待送达
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(sealSignRecord.getCaseAppliId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if(caseApplicationselect!=null){
if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.ARBITRATED_SEAL)){
if (caseApplicationselect != null) {
if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.ARBITRATED_SEAL)) {
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
//下载审核完成的裁决书,
String signFlowId = sealSignRecord.getSignFlowid();
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(),JsonObject.class);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
if(filesArray!=null&&filesArray.size()>0){
JsonObject fileObject = (JsonObject)filesArray.get(0);
if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
//修改"签署用印记录表"的状态为签署完成
sealSignRecord.setSignFlowStatus(3);
sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1,fileDownloadUrl.length()-1));
sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1));
sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
String filearbitraUrl = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
caseApplication.setFilearbitraUrl(filearbitraUrl);
caseApplicationMapper.submitCaseApplication(caseApplication);
@@ -136,22 +138,22 @@ public class FixSelectFlowDetailUtils {
saveFolder.mkdirs();
}
String resultFilePath = saveFolderPath + "/" + fileName;
File resultFilePathFile = new File(resultFilePath);
File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile();
}
String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if(downLoadFile) {
Long caseAppliId = sealSignRecord.getCaseAppliId();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(3);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if (downLoadFile) {
Long caseAppliId = sealSignRecord.getCaseAppliId();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(3);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}
}
}
@@ -163,7 +165,7 @@ public class FixSelectFlowDetailUtils {
}
} catch (EsignDemoException e) {
e.printStackTrace();
}catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
}
@@ -176,13 +178,13 @@ public class FixSelectFlowDetailUtils {
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setIdentifyStatus(0);
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
for (int i = 0; i < deptIdentifysnew.size(); i++) {
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
if(realnameStatus==1){
if (realnameStatus == 1) {
String orgId = identifyInfoData.get("orgId").getAsString();
EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
//将orgId保存到数据库里
@@ -192,15 +194,15 @@ public class FixSelectFlowDetailUtils {
JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
String sealNames = "";
if(sealArray.size()>0){
if (sealArray.size() > 0) {
for (int j = 0; j < sealArray.size(); j++) {
JsonObject sealObject = (JsonObject)sealArray.get(j);
JsonObject sealObject = (JsonObject) sealArray.get(j);
String sealName = sealObject.get("sealName").toString();
String sealNamenew = sealName.substring(1,sealName.length()-1);
sealNames += sealNamenew +",";
String sealNamenew = sealName.substring(1, sealName.length() - 1);
sealNames += sealNamenew + ",";
}
}
String sealName = sealNames.substring(0,sealNames.length()-1);
String sealName = sealNames.substring(0, sealNames.length() - 1);
deptIdentifynew.setIdentifyStatus(1);
deptIdentifynew.setSealName(sealName);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
@@ -208,4 +210,79 @@ public class FixSelectFlowDetailUtils {
}
}
}
/**
* 定时查询企业内部印章审核状态
*
* @throws EsignDemoException
*/
@Scheduled(cron = "0/30 * * * * ?")
@Transactional
public void searchForInstitutionalSeal() {
try {
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setIsUse(0);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
for (DeptIdentify identify : deptIdentifies) {
//查询企业内部印章
Integer annexId = identify.getAnnexId();
if (annexId == null){
//说明之前没有下载过
EsignHttpResponse response = SignAward.orgOwnSealList(identify);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
JSONObject data = jsonObject.getJSONObject("data");
JSONArray seals = data.getJSONArray("seals");
for (int i = 0; i < seals.size(); i++){
JSONObject seal = seals.getJSONObject(i);
int statusDescription = seal.getIntValue("statusDescription");
if (statusDescription==1){//印章状态 1已启用,2待审核,3审核不通过,4 挂起
//已启用证明审核通过,下载到数据库
String sealImageDownloadUrl = seal.getString("sealImageDownloadUrl");
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String savePath = "/home/ruoyi/uploadPath/upload/";
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
String resultFilePath = saveFolderPath + "/" + fileName;
File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile();
}
boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath);
if (downLoadFile) {
CaseAttach caseAttach = new CaseAttach();
caseAttach.setAnnexType(10); //10代表印章图片
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttach.setSealStatus(1); //1代表印章启用
int i1 = caseAttachMapper.save(caseAttach);
if (i1>0){
//将附件id保存到公章管理表里
Integer annexId1 = caseAttach.getAnnexId();
identify.setAnnexId(annexId1);
deptIdentifyMapper.updateDeptIdentify(identify);
}
}
}
}
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}