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
@@ -13,6 +13,7 @@ import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@@ -49,6 +50,17 @@ public class DeptIdentifyController extends BaseController {
return deptIdentifyService.enableDept(deptIdentify); return deptIdentifyService.enableDept(deptIdentify);
} }
/**
* 上传自定义公章
* @param deptIdentify
* @param file
* @return
*/
@PostMapping("sealUpload")
public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify
,@RequestParam("file") MultipartFile file){
return deptIdentifyService.sealUpload(deptIdentify,file);
}
@@ -80,9 +80,8 @@ public class SealUtil {
* *
* @return * @return
*/ */
public static EsignHttpResponse getFileUploadUrl() throws EsignDemoException { public static EsignHttpResponse getFileUploadUrl(String filePath) throws EsignDemoException {
//自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据 //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据
String filePath = "D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg";
EsignFileBean esignFileBean = new EsignFileBean(filePath); EsignFileBean esignFileBean = new EsignFileBean(filePath);
String apiaddr="/v3/files/file-key"; String apiaddr="/v3/files/file-key";
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
@@ -42,5 +42,9 @@ public class CaseAttach {
* 用户账户 * 用户账户
*/ */
private String userName; private String userName;
/**
* 印章状态(0未启用,1已启用)
*/
private Integer sealStatus;
} }
@@ -2,7 +2,6 @@ package com.ruoyi.wisdomarbitrate.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date; import java.util.Date;
public class DeptIdentify extends BaseEntity { public class DeptIdentify extends BaseEntity {
@@ -39,6 +38,30 @@ public class DeptIdentify extends BaseEntity {
/** 认证授权流程ID */ /** 认证授权流程ID */
private String authFlowId; private String authFlowId;
public String getSealId() {
return sealId;
}
public void setSealId(String sealId) {
this.sealId = sealId;
}
/** 印章id */
private String sealId;
/**
* 附件id
*/
private Integer annexId;
public Integer getAnnexId() {
return annexId;
}
public void setAnnexId(Integer annexId) {
this.annexId = annexId;
}
public String getAuthFlowId() { public String getAuthFlowId() {
return authFlowId; return authFlowId;
} }
@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@@ -15,4 +16,8 @@ public interface IDeptIdentifyService {
DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException; DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException;
AjaxResult enableDept(DeptIdentify deptIdentify); AjaxResult enableDept(DeptIdentify deptIdentify);
AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file);
} }
@@ -1,18 +1,26 @@
package com.ruoyi.wisdomarbitrate.service.impl; package com.ruoyi.wisdomarbitrate.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService; import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
import com.ruoyi.wisdomarbitrate.utils.SignAward; import com.ruoyi.wisdomarbitrate.utils.SignAward;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -21,19 +29,21 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
@Autowired @Autowired
private DeptIdentifyMapper deptIdentifyMapper; private DeptIdentifyMapper deptIdentifyMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Override @Override
@Transactional @Transactional
public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) { public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify); List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if(deptIdentifys!=null&&deptIdentifys.size()>0){ if (deptIdentifys != null && deptIdentifys.size() > 0) {
for (int i = 0; i < deptIdentifys.size(); i++) { for (int i = 0; i < deptIdentifys.size(); i++) {
DeptIdentify deptIdentifyselect = deptIdentifys.get(i); DeptIdentify deptIdentifyselect = deptIdentifys.get(i);
List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect); List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect);
if(deptIdentifylist!=null&&deptIdentifylist.size()>0){ if (deptIdentifylist != null && deptIdentifylist.size() > 0) {
continue; continue;
}else { } else {
deptIdentifyselect.setIdentifyStatus(0); deptIdentifyselect.setIdentifyStatus(0);
deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect); deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect);
} }
@@ -49,21 +59,21 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException { public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
DeptIdentify deptIdentifynew = new DeptIdentify(); DeptIdentify deptIdentifynew = new DeptIdentify();
if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){ if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
Gson gson = new Gson(); Gson gson = new Gson();
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0); DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect); EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class); JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
int code = signUrlJsonObject.get("code").getAsInt();
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("authUrl").getAsString(); String url = signUrlData.get("authUrl").getAsString();
//获取本次认证授权流程ID //获取本次认证授权流程ID
String authFlowId = signUrlData.get("authFlowId").getAsString(); String authFlowId = signUrlData.get("authFlowId").getAsString();
deptIdentify.setAuthFlowId(authFlowId); deptIdentify.setAuthFlowId(authFlowId);
deptIdentifynew.setIdentifyUrl(url); deptIdentifynew.setIdentifyUrl(url);
deptIdentify.setIdentifyDate(new Date());
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
} }
deptIdentify.setIdentifyDate(new Date());
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
return deptIdentifynew; return deptIdentifynew;
} }
@@ -73,9 +83,9 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0); DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
Integer identifyStatus = deptIdentifyselect.getIdentifyStatus(); Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
if(identifyStatus.intValue()==0){ if (identifyStatus.intValue() == 0) {
return AjaxResult.error("这个认证数据未进行认证,不能启用"); return AjaxResult.error("这个认证数据未进行认证,不能启用");
}else if(identifyStatus.intValue()==1){ } else if (identifyStatus.intValue() == 1) {
deptIdentifyselect.setIsUse(1); deptIdentifyselect.setIsUse(1);
deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect); deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
@@ -83,7 +93,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
deptIdentifySel.setId(deptIdentify.getId()); deptIdentifySel.setId(deptIdentify.getId());
deptIdentifySel.setIdentifyStatus(1); deptIdentifySel.setIdentifyStatus(1);
List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel); List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel);
if(deptIdentifysother!=null&&deptIdentifysother.size()>0){ if (deptIdentifysother != null && deptIdentifysother.size() > 0) {
for (int i = 0; i < deptIdentifysother.size(); i++) { for (int i = 0; i < deptIdentifysother.size(); i++) {
DeptIdentify deptIdentifyother = deptIdentifysother.get(i); DeptIdentify deptIdentifyother = deptIdentifysother.get(i);
deptIdentifyother.setIsUse(0); deptIdentifyother.setIsUse(0);
@@ -96,5 +106,53 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
} }
@Override
public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) {
try {
if (file.isEmpty()) {
return AjaxResult.error("请选择要上传的文件");
}
String filePath = RuoYiConfig.getUploadPath();
// 上传
String fileName = FileUploadUtils.upload(filePath, file);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
for (DeptIdentify identify : deptIdentifies) {
//先判断企业用户是否授予资源管理权限
String authFlowId = identify.getAuthFlowId();
EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId);
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus");
if (authorizedStatus == 1){//授权流程状态 0流程过期失效 1已授权 2授权中 3审批未通过
String prefix = "/profile";
int startIndex = fileName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/uploadPath" + fileName.substring(startIndex);
//创建机构图片印章
EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code");
if (code == 0) { //业务码,0表示成功,非0表示异常。
String sealId = jsonObject.getJSONObject("data").getString("sealId");
identify.setSealId(sealId);
identify.setIsUse(0); //设置印章使用状态为未启用
//保存到表里
int i = deptIdentifyMapper.updateDeptIdentify(identify);
if (i>0){
return AjaxResult.success("上传成功");
}
}
}
return AjaxResult.error("企业用户未授予资源管理权限");
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (EsignDemoException e) {
e.printStackTrace();
}
return AjaxResult.error();
}
} }
@@ -1,5 +1,7 @@
package com.ruoyi.wisdomarbitrate.utils; package com.ruoyi.wisdomarbitrate.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@@ -42,7 +44,7 @@ public class FixSelectFlowDetailUtils {
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
@Transactional @Transactional
public void fixExecuteSelectFlowDetailUtils(){ public void fixExecuteSelectFlowDetailUtils() {
Gson gson = new Gson(); Gson gson = new Gson();
SealSignRecord sealSignRecordselect = new SealSignRecord(); SealSignRecord sealSignRecordselect = new SealSignRecord();
@@ -50,40 +52,40 @@ public class FixSelectFlowDetailUtils {
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect); List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
try { try {
if(sealSignRecords!=null&&sealSignRecords.size()>0){ if (sealSignRecords != null && sealSignRecords.size() > 0) {
for (int i = 0; i < sealSignRecords.size(); i++) { for (int i = 0; i < sealSignRecords.size(); i++) {
SealSignRecord sealSignRecord = sealSignRecords.get(i); SealSignRecord sealSignRecord = sealSignRecords.get(i);
EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord); 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"); JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray(); JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
Integer psnsignStatus = null; Integer psnsignStatus = null;
Integer orgsignStatus = null; Integer orgsignStatus = null;
for (int j = 0; j < signersArray.size(); j++) { 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"); JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
if(psnSignerData!=null){ if (psnSignerData != null) {
psnsignStatus = signerObject.get("signStatus").getAsInt(); psnsignStatus = signerObject.get("signStatus").getAsInt();
} }
} }
if(!(signerObject.get("orgSigner").toString()).equals("null")){ if (!(signerObject.get("orgSigner").toString()).equals("null")) {
JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner"); JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
if(orgSignerData!=null){ if (orgSignerData != null) {
orgsignStatus = signerObject.get("signStatus").getAsInt(); orgsignStatus = signerObject.get("signStatus").getAsInt();
} }
} }
} }
if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==1)){ if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 1)) {
//更新立案申请状态为待用印 //更新立案申请状态为待用印
CaseApplication caseApplication = new CaseApplication(); CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(sealSignRecord.getCaseAppliId()); caseApplication.setId(sealSignRecord.getCaseAppliId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if(caseApplicationselect!=null){ if (caseApplicationselect != null) {
if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.SIGN_ARBITRATION)){ if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.SIGN_ARBITRATION)) {
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplicationMapper.submitCaseApplication(caseApplication); 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 caseApplication = new CaseApplication();
caseApplication.setId(sealSignRecord.getCaseAppliId()); caseApplication.setId(sealSignRecord.getCaseAppliId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if(caseApplicationselect!=null){ if (caseApplicationselect != null) {
if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.ARBITRATED_SEAL)){ if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.ARBITRATED_SEAL)) {
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
//下载审核完成的裁决书, //下载审核完成的裁决书,
String signFlowId = sealSignRecord.getSignFlowid(); String signFlowId = sealSignRecord.getSignFlowid();
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); 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"); JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
if(filesArray!=null&&filesArray.size()>0){ if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject)filesArray.get(0); JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString(); String fileDownloadUrl = fileObject.get("downloadUrl").toString();
//修改"签署用印记录表"的状态为签署完成 //修改"签署用印记录表"的状态为签署完成
sealSignRecord.setSignFlowStatus(3); sealSignRecord.setSignFlowStatus(3);
sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1,fileDownloadUrl.length()-1)); sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1));
sealSignRecordMapper.updataSealSignRecord(sealSignRecord); sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
String filearbitraUrl = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1); String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
caseApplication.setFilearbitraUrl(filearbitraUrl); caseApplication.setFilearbitraUrl(filearbitraUrl);
caseApplicationMapper.submitCaseApplication(caseApplication); caseApplicationMapper.submitCaseApplication(caseApplication);
@@ -136,22 +138,22 @@ public class FixSelectFlowDetailUtils {
saveFolder.mkdirs(); saveFolder.mkdirs();
} }
String resultFilePath = saveFolderPath + "/" + fileName; String resultFilePath = saveFolderPath + "/" + fileName;
File resultFilePathFile = new File(resultFilePath); File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) { if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile(); resultFilePathFile.createNewFile();
} }
String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1); String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if(downLoadFile) { if (downLoadFile) {
Long caseAppliId = sealSignRecord.getCaseAppliId(); Long caseAppliId = sealSignRecord.getCaseAppliId();
CaseAttach caseAttach = new CaseAttach(); CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseAppliId); caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(3); caseAttach.setAnnexType(3);
caseAttach.setAnnexPath(savePath); caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName); caseAttach.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach); caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
} }
} }
} }
@@ -163,7 +165,7 @@ public class FixSelectFlowDetailUtils {
} }
} catch (EsignDemoException e) { } catch (EsignDemoException e) {
e.printStackTrace(); e.printStackTrace();
}catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -176,13 +178,13 @@ public class FixSelectFlowDetailUtils {
DeptIdentify deptIdentify = new DeptIdentify(); DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setIdentifyStatus(0); deptIdentify.setIdentifyStatus(0);
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify); 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++) { for (int i = 0; i < deptIdentifysnew.size(); i++) {
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i)); EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class); JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data"); JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt(); int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
if(realnameStatus==1){ if (realnameStatus == 1) {
String orgId = identifyInfoData.get("orgId").getAsString(); String orgId = identifyInfoData.get("orgId").getAsString();
EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId); EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
//将orgId保存到数据库里 //将orgId保存到数据库里
@@ -192,15 +194,15 @@ public class FixSelectFlowDetailUtils {
JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data"); JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray(); JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
String sealNames = ""; String sealNames = "";
if(sealArray.size()>0){ if (sealArray.size() > 0) {
for (int j = 0; j < sealArray.size(); j++) { 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 sealName = sealObject.get("sealName").toString();
String sealNamenew = sealName.substring(1,sealName.length()-1); String sealNamenew = sealName.substring(1, sealName.length() - 1);
sealNames += sealNamenew +","; sealNames += sealNamenew + ",";
} }
} }
String sealName = sealNames.substring(0,sealNames.length()-1); String sealName = sealNames.substring(0, sealNames.length() - 1);
deptIdentifynew.setIdentifyStatus(1); deptIdentifynew.setIdentifyStatus(1);
deptIdentifynew.setSealName(sealName); deptIdentifynew.setSealName(sealName);
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew); 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();
}
}
} }
@@ -1,5 +1,6 @@
package com.ruoyi.wisdomarbitrate.utils; package com.ruoyi.wisdomarbitrate.utils;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@@ -9,6 +10,7 @@ import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.EsignApplicaConfig; import com.ruoyi.common.utils.EsignApplicaConfig;
import com.ruoyi.common.utils.EsignHttpHelper; import com.ruoyi.common.utils.EsignHttpHelper;
import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord; import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
@@ -18,10 +20,9 @@ import java.util.Map;
public class SignAward { public class SignAward {
private static String eSignHost= EsignApplicaConfig.EsignHost; private static String eSignHost = EsignApplicaConfig.EsignHost;
private static String eSignAppId= EsignApplicaConfig.EsignAppId; private static String eSignAppId = EsignApplicaConfig.EsignAppId;
private static String eSignAppSecret= EsignApplicaConfig.EsignAppSecret; private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
public static void main(String[] args) throws EsignDemoException { public static void main(String[] args) throws EsignDemoException {
@@ -89,8 +90,6 @@ public class SignAward {
// System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1)); // System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1));
//查询签署流程详情 //查询签署流程详情
// EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord); // EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord);
// JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class); // JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
@@ -120,31 +119,30 @@ public class SignAward {
// System.out.println(signFlowDetailJsonObject); // System.out.println(signFlowDetailJsonObject);
} }
/** /**
* 查询签署流程详情 * 查询签署流程详情
*
* @return * @return
*/ */
public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException { public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException {
String signFlowId = sealSignRecord.getSignFlowid(); String signFlowId = sealSignRecord.getSignFlowid();
String apiaddr= "/v3/sign-flow/"+ signFlowId + "/detail"; String apiaddr = "/v3/sign-flow/" + signFlowId + "/detail";
String jsonParm = null; String jsonParm = null;
//请求方法 //请求方法
EsignRequestType requestType = EsignRequestType.GET; EsignRequestType requestType = EsignRequestType.GET;
//生成签名鉴权方式的的header //生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
//发起接口请求 //发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
} }
/** /**
* 发起签署 * 发起签署
*
* @return * @return
* @throws EsignDemoException * @throws EsignDemoException
*/ */
@@ -174,8 +172,8 @@ public class SignAward {
String jsonParm = "{\n" + String jsonParm = "{\n" +
" \"docs\": [\n" + " \"docs\": [\n" +
" {\n" + " {\n" +
" \"fileId\": \"" + fileId + "\",\n" + " \"fileId\": \"" + fileId + "\",\n" +
" \"fileName\": \"" + fileName + "\"\n" + " \"fileName\": \"" + fileName + "\"\n" +
" }\n" + " }\n" +
" ],\n" + " ],\n" +
" \"signFlowConfig\": {\n" + " \"signFlowConfig\": {\n" +
@@ -203,22 +201,22 @@ public class SignAward {
" \"signers\": [\n" + " \"signers\": [\n" +
" {\n" + " {\n" +
" \"psnSignerInfo\": {\n" + " \"psnSignerInfo\": {\n" +
" \"psnAccount\": \"" + psnAccount + "\",\n" + " \"psnAccount\": \"" + psnAccount + "\",\n" +
" \"psnInfo\": {\n" + " \"psnInfo\": {\n" +
" \"psnName\": \"" + psnName + "\"\n" + " \"psnName\": \"" + psnName + "\"\n" +
" }\n" + " }\n" +
" },\n" + " },\n" +
" \"signFields\": [\n" + " \"signFields\": [\n" +
" {\n" + " {\n" +
" \"fileId\": \"" + fileId + "\",\n" + " \"fileId\": \"" + fileId + "\",\n" +
" \"normalSignFieldConfig\": {\n" + " \"normalSignFieldConfig\": {\n" +
" \"autoSign\": false,\n" + " \"autoSign\": false,\n" +
" \"freeMode\": false,\n" + " \"freeMode\": false,\n" +
" \"movableSignField\": false,\n" + " \"movableSignField\": false,\n" +
" \"signFieldPosition\": {\n" + " \"signFieldPosition\": {\n" +
" \"positionPage\": \"" + positionPagepsn + "\",\n" + " \"positionPage\": \"" + positionPagepsn + "\",\n" +
" \"positionX\": " + positionXpsn + ",\n" + " \"positionX\": " + positionXpsn + ",\n" +
" \"positionY\": " + positionYpsn + "\n" + " \"positionY\": " + positionYpsn + "\n" +
" },\n" + " },\n" +
" \"signFieldStyle\": 1\n" + " \"signFieldStyle\": 1\n" +
" },\n" + " },\n" +
@@ -230,31 +228,31 @@ public class SignAward {
" {\n" + " {\n" +
" \"orgSignerInfo\": {\n" + " \"orgSignerInfo\": {\n" +
" \"orgName\": \"" + orgName + "\",\n" + " \"orgName\": \"" + orgName + "\",\n" +
" \"transactorInfo\": {\n" + " \"transactorInfo\": {\n" +
" \"psnAccount\": \"" + orgNamePsnAccount + "\",\n" + " \"psnAccount\": \"" + orgNamePsnAccount + "\",\n" +
" \"psnInfo\": {\n" + " \"psnInfo\": {\n" +
" \"psnName\": \"" + orgNamepsnName + "\"\n" + " \"psnName\": \"" + orgNamepsnName + "\"\n" +
" }\n" + " }\n" +
" }\n" + " }\n" +
" },\n" + " },\n" +
" \"signFields\": [\n" + " \"signFields\": [\n" +
" {\n" + " {\n" +
" \"fileId\": \"" + fileId + "\",\n" + " \"fileId\": \"" + fileId + "\",\n" +
" \"normalSignFieldConfig\": {\n" + " \"normalSignFieldConfig\": {\n" +
" \"autoSign\": false,\n" + " \"autoSign\": false,\n" +
" \"freeMode\": false,\n" + " \"freeMode\": false,\n" +
" \"availableSealIds\": [\n" + " \"availableSealIds\": [\n" +
" \"" + availableSealId + "\"\n" + " \"" + availableSealId + "\"\n" +
" ],\n" + " ],\n" +
" \"signFieldPosition\": {\n" + " \"signFieldPosition\": {\n" +
" \"positionPage\": \"" + positionPageorg + "\",\n" + " \"positionPage\": \"" + positionPageorg + "\",\n" +
" \"positionX\": " + positionXorg + ",\n" + " \"positionX\": " + positionXorg + ",\n" +
" \"positionY\": " + positionYorg + "\n" + " \"positionY\": " + positionYorg + "\n" +
" },\n" + " },\n" +
" \"signFieldStyle\": 1\n" + " \"signFieldStyle\": 1\n" +
" },\n" + " },\n" +
@@ -277,6 +275,7 @@ public class SignAward {
/** /**
* 获取合同文件签名链接 * 获取合同文件签名链接
*
* @return * @return
* @throws EsignDemoException * @throws EsignDemoException
*/ */
@@ -291,7 +290,7 @@ public class SignAward {
" \"clientType\": \"PC\",\n" + " \"clientType\": \"PC\",\n" +
" \"operator\": {\n" + " \"operator\": {\n" +
" \"psnAccount\": \"" + psnAccount + "\"\n" + " \"psnAccount\": \"" + psnAccount + "\"\n" +
" }\n" + " }\n" +
"}"; "}";
//请求方法 //请求方法
@@ -304,6 +303,7 @@ public class SignAward {
/** /**
* 获取合同文件用印链接 * 获取合同文件用印链接
*
* @return * @return
* @throws EsignDemoException * @throws EsignDemoException
*/ */
@@ -317,10 +317,10 @@ public class SignAward {
String jsonParm = "{\n" + String jsonParm = "{\n" +
" \"operator\": {\n" + " \"operator\": {\n" +
" \"psnAccount\": \"" + psnAccount + "\"\n" + " \"psnAccount\": \"" + psnAccount + "\"\n" +
" },\n" + " },\n" +
" \"organization\": {\n" + " \"organization\": {\n" +
" \"orgName\": \"" + orgName + "\"\n" + " \"orgName\": \"" + orgName + "\"\n" +
" }\n" + " }\n" +
"}"; "}";
@@ -346,10 +346,10 @@ public class SignAward {
" \"orgAuthConfig\": {\n" + " \"orgAuthConfig\": {\n" +
" \"orgName\": \"" + deptName + " \",\n" + " \"orgName\": \"" + deptName + " \",\n" +
" \"transactorInfo\": {\n" + " \"transactorInfo\": {\n" +
" \"psnAccount\": \"" + phonenumber + "\",\n" + " \"psnAccount\": \"" + phonenumber + "\",\n" +
" \"psnInfo\": {\n" + " \"psnInfo\": {\n" +
" \"psnName\": \"" + nickName + "\",\n" + " \"psnName\": \"" + nickName + "\",\n" +
" \"psnMobile\": \"" + phonenumber + "\"\n" + " \"psnMobile\": \"" + phonenumber + "\"\n" +
" }\n" + " }\n" +
" }\n" + " }\n" +
" },\n" + " },\n" +
@@ -377,36 +377,37 @@ public class SignAward {
* 查询企业认证状态 * 查询企业认证状态
*/ */
public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException { public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException {
String apiaddr="/v3/organizations/identity-info?orgName="+deptIdentify.getDeptName(); String apiaddr = "/v3/organizations/identity-info?orgName=" + deptIdentify.getDeptName();
String jsonParm="{}"; String jsonParm = "{}";
//请求方法 //请求方法
EsignRequestType requestType= EsignRequestType.GET; EsignRequestType requestType = EsignRequestType.GET;
//生成签名鉴权方式的的header //生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
//发起接口请求 //发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
} }
/** /**
* 查询企业认证印章信息 * 查询企业认证印章信息
*/ */
public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException { public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException {
int pageNum=1; int pageNum = 1;
int pageSize=10; int pageSize = 10;
String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize; String apiaddr = "/v3/seals/org-own-seal-list?orgId=" + orgId + "&pageNum=" + pageNum + "&pageSize=" + pageSize;
String jsonParm=null; String jsonParm = null;
//请求方法 //请求方法
EsignRequestType requestType= EsignRequestType.GET; EsignRequestType requestType = EsignRequestType.GET;
//生成签名鉴权方式的的header //生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
//发起接口请求 //发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
} }
/** /**
* 获取文件签名印章位置 * 获取文件签名印章位置
*
* @return * @return
* @throws EsignDemoException * @throws EsignDemoException
*/ */
@@ -432,27 +433,70 @@ public class SignAward {
* *
* @return * @return
*/ */
public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify) throws EsignDemoException { public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify, String filePath) throws EsignDemoException {
String apiaddr = "/v3/seals/org-seals/create-by-image"; //获取认证授权流程ID
String orgId = deptIdentify.getOrgId(); String authFlowId = deptIdentify.getAuthFlowId();
String sealImageFileKey = ""; //查询认证授权流程详情
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null EsignHttpResponse response = SealUtil.queryAuthProcess(authFlowId);
String jsonParm = "{\n" + String body = response.getBody();
" \"orgId\": \"" + orgId + "\",\n" + if (body != null) {
" \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" + JSONObject jsonObject = JSONObject.parseObject(body);
" \"sealName\": \"企业公章1\",\n" + //查询授权流程状态
" \"sealWidth\": 50,\n" + int authorizedStatus = jsonObject.getJSONObject("data").getIntValue("authorizedStatus");
" \"sealHeight\": 50,\n" + if (authorizedStatus == 1) {//0 -流程过期失效 1 - 已授权 2 - 授权中 3 - 审批未通过
"}"; String apiaddr = "/v3/seals/org-seals/create-by-image";
//请求方法 String orgId = deptIdentify.getOrgId();
EsignRequestType requestType = EsignRequestType.POST; //上传印章图片
//生成签名鉴权方式的的header //步骤一:获取印章图片上传地址fileUploadUrl
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath);
//发起接口请求 JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
EsignHttpResponse response = EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl");
System.out.println(response); //步骤二:将印章图片文件流上传到fileUploadUrl
return response; EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath);
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
int errCode = jsonObject2.getIntValue("errCode");
if (errCode == 0){ //业务码,0表示成功,非0表示异常。
//获取步骤一里面的fileKey
String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey");
String sealName = deptIdentify.getSealName();
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
String jsonParm = "{\n" +
" \"orgId\": \"" + orgId + "\",\n" +
" \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
" \"sealName\": \" " + sealName + " \",\n" +
" \"sealWidth\": 50,\n" +
" \"sealHeight\": 50,\n" +
"}";
//请求方法
EsignRequestType requestType = EsignRequestType.POST;
//生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
}
}
}
return null;
} }
/**
* 查询企业内部印章
*/
public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException {
String orgId=deptIdentify.getOrgId();
int pageNum=1;
int pageSize=20;
String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize;
//请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
String jsonParm=null;
//请求方法
EsignRequestType requestType= EsignRequestType.GET;
//生成签名鉴权方式的的header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
}
} }
@@ -12,10 +12,11 @@
<result property="note" column="note" /> <result property="note" column="note" />
<result property="userId" column="use_id" /> <result property="userId" column="use_id" />
<result property="userName" column="use_account" /> <result property="userName" column="use_account" />
<result property="sealStatus" column="seal_status" />
</resultMap> </resultMap>
<insert id="save" useGeneratedKeys="true" keyProperty="annexId"> <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account) INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status)
VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName}) VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName},#{sealStatus})
</insert> </insert>
<delete id="deleteByFileIds"> <delete id="deleteByFileIds">
delete from case_attach delete from case_attach
@@ -14,6 +14,9 @@
<result property="phonenumber" column="phonenumber" /> <result property="phonenumber" column="phonenumber" />
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name" />
<result property="sealName" column="seal_name" /> <result property="sealName" column="seal_name" />
<result property="orgId" column="org_id" />
<result property="authFlowId" column="auth_flow_id" />
<result property="sealId" column="seal_id" />
</resultMap> </resultMap>
@@ -28,7 +31,7 @@
</select> </select>
<select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult"> <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
SELECT d.id ,d.dept_id ,d.user_id SELECT d.id ,d.dept_id ,d.user_id ,d.org_id ,d.auth_flow_id
from dept_identify d from dept_identify d
<where> <where>
<if test="deptId != null"> <if test="deptId != null">
@@ -53,8 +56,8 @@
</insert> </insert>
<select id="selectDeptIdentifylist" parameterType="DeptIdentify" resultMap="DeptIdentifyResult"> <select id="selectDeptIdentifylist" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
SELECT d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name, sd.dept_name , SELECT d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name,
u.nick_name ,u.phonenumber d.org_id , d.seal_id ,sd.dept_name , u.nick_name ,u.phonenumber
from dept_identify d left join sys_dept sd on d.dept_id = sd.dept_id from dept_identify d left join sys_dept sd on d.dept_id = sd.dept_id
left join sys_user u on u.user_id = d.user_id left join sys_user u on u.user_id = d.user_id
<where> <where>
@@ -90,6 +93,7 @@
<if test="isUse != null">is_use = #{isUse},</if> <if test="isUse != null">is_use = #{isUse},</if>
<if test="identifyStatus != null ">identify_status = #{identifyStatus},</if> <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
<if test="sealName != null and sealName != ''">seal_name = #{sealName},</if> <if test="sealName != null and sealName != ''">seal_name = #{sealName},</if>
<if test="sealId != null and sealId != ''">seal_id = #{sealId},</if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>