Merge branch 'qtz' of SH-Arbitrate/Arbitrate-Backend into dev
This commit was merged in pull request #35.
This commit is contained in:
@@ -13,10 +13,37 @@ public class ArbitrSignatuVO {
|
|||||||
/**
|
/**
|
||||||
* 用户帐号
|
* 用户帐号
|
||||||
* 任务id
|
* 任务id
|
||||||
|
* 文件MD5
|
||||||
|
* 文件内容
|
||||||
|
* 文件总页数
|
||||||
|
* 文件名称
|
||||||
|
* 文件类型
|
||||||
|
* 合同标题
|
||||||
|
* 有效期
|
||||||
|
* 合同编号
|
||||||
|
* 签署者账号
|
||||||
|
* 签名位置页码
|
||||||
|
* x坐标
|
||||||
|
* y坐标
|
||||||
*/
|
*/
|
||||||
private String account;
|
private String account;
|
||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
|
private String fileMd5;
|
||||||
|
private String fileData;
|
||||||
|
private String filePages;
|
||||||
|
private String fileName;
|
||||||
|
private String fileType;
|
||||||
|
private String contractTitle;
|
||||||
|
private String periodValidity;
|
||||||
|
|
||||||
|
private String contractNum;
|
||||||
|
private String signerAccout;
|
||||||
|
private String pageNumSigner;
|
||||||
|
private String pageNumSignerX;
|
||||||
|
private String pageNumSignerY;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.ruoyi.bestsign.utils;
|
package com.ruoyi.bestsign.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.bestsign.domain.ArbitrSignatuVO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -173,11 +175,8 @@ public class BestsignOpenApiClient {
|
|||||||
// 签名参数追加为url参数
|
// 签名参数追加为url参数
|
||||||
String fullUrlParams = String.format(urlSignParams, this.developerId,
|
String fullUrlParams = String.format(urlSignParams, this.developerId,
|
||||||
timestamsParam, paramsSign);
|
timestamsParam, paramsSign);
|
||||||
|
|
||||||
String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
|
String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
|
||||||
fullUrlParams, requestParam.toJSONString());
|
fullUrlParams, requestParam.toJSONString());
|
||||||
|
|
||||||
|
|
||||||
JSONObject responseObj = JSON.parseObject(responseResult);
|
JSONObject responseObj = JSON.parseObject(responseResult);
|
||||||
// 返回errno为0,表示成功,其他表示失败
|
// 返回errno为0,表示成功,其他表示失败
|
||||||
if (responseObj.getIntValue("errno") == 0) {
|
if (responseObj.getIntValue("errno") == 0) {
|
||||||
@@ -193,4 +192,139 @@ public class BestsignOpenApiClient {
|
|||||||
}
|
}
|
||||||
return responseObj.toJSONString();
|
return responseObj.toJSONString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件
|
||||||
|
*
|
||||||
|
* @param arbitrSignatuVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String uploadContact(ArbitrSignatuVO arbitrSignatuVO) throws Exception {
|
||||||
|
String methodInvoke = "/storage/contract/upload/";
|
||||||
|
JSONObject requestParam = new JSONObject();
|
||||||
|
|
||||||
|
requestParam.put("account", arbitrSignatuVO.getAccount());
|
||||||
|
requestParam.put("fmd5", arbitrSignatuVO.getFileMd5());
|
||||||
|
requestParam.put("fdata", arbitrSignatuVO.getFileData());
|
||||||
|
requestParam.put("fpages", arbitrSignatuVO.getFilePages());
|
||||||
|
requestParam.put("fname", arbitrSignatuVO.getFileName());
|
||||||
|
requestParam.put("ftype", arbitrSignatuVO.getFileType());
|
||||||
|
requestParam.put("title", arbitrSignatuVO.getContractTitle());
|
||||||
|
requestParam.put("expireTime", arbitrSignatuVO.getPeriodValidity());
|
||||||
|
|
||||||
|
|
||||||
|
String timestamsParam = RSAUtils.getRtick();
|
||||||
|
// 计算参数签名
|
||||||
|
String paramsSign = RSAUtils.calcRsaSign(this.developerId,
|
||||||
|
this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
|
||||||
|
requestParam.toJSONString());
|
||||||
|
// 签名参数追加为url参数
|
||||||
|
String fullUrlParams = String.format(urlSignParams, this.developerId,
|
||||||
|
timestamsParam, paramsSign);
|
||||||
|
String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
|
||||||
|
fullUrlParams, requestParam.toJSONString());
|
||||||
|
JSONObject responseObj = JSON.parseObject(responseResult);
|
||||||
|
// 返回errno为0,表示成功,其他表示失败
|
||||||
|
if (responseObj.getIntValue("errno") == 0) {
|
||||||
|
JSONObject data = responseObj.getJSONObject("data");
|
||||||
|
if (data != null) {
|
||||||
|
String contractId = data.getString("contractId");
|
||||||
|
return contractId;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error("上传文件异常:" + responseObj.toJSONString());
|
||||||
|
}
|
||||||
|
return responseObj.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取签署链接
|
||||||
|
*
|
||||||
|
* @param arbitrSignatuVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String getSignLink(ArbitrSignatuVO arbitrSignatuVO) throws Exception {
|
||||||
|
String methodInvoke = "/contract/send/";
|
||||||
|
JSONObject requestParam = new JSONObject();
|
||||||
|
|
||||||
|
requestParam.put("contractId", arbitrSignatuVO.getContractNum());
|
||||||
|
requestParam.put("signer", arbitrSignatuVO.getSignerAccout());
|
||||||
|
|
||||||
|
JSONArray signatureArray = new JSONArray();
|
||||||
|
|
||||||
|
JSONObject signatuItem = new JSONObject();
|
||||||
|
signatuItem.put("pageNum", arbitrSignatuVO.getPageNumSigner());
|
||||||
|
//x坐标
|
||||||
|
signatuItem.put("x", arbitrSignatuVO.getPageNumSignerX());
|
||||||
|
//y坐标
|
||||||
|
signatuItem.put("y", arbitrSignatuVO.getPageNumSignerY());
|
||||||
|
signatureArray.add(signatuItem);
|
||||||
|
|
||||||
|
requestParam.put("signaturePositions", signatureArray);
|
||||||
|
|
||||||
|
|
||||||
|
String timestamsParam = RSAUtils.getRtick();
|
||||||
|
// 计算参数签名
|
||||||
|
String paramsSign = RSAUtils.calcRsaSign(this.developerId,
|
||||||
|
this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
|
||||||
|
requestParam.toJSONString());
|
||||||
|
// 签名参数追加为url参数
|
||||||
|
String fullUrlParams = String.format(urlSignParams, this.developerId,
|
||||||
|
timestamsParam, paramsSign);
|
||||||
|
String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
|
||||||
|
fullUrlParams, requestParam.toJSONString());
|
||||||
|
JSONObject responseObj = JSON.parseObject(responseResult);
|
||||||
|
// 返回errno为0,表示成功,其他表示失败
|
||||||
|
if (responseObj.getIntValue("errno") == 0) {
|
||||||
|
JSONObject data = responseObj.getJSONObject("data");
|
||||||
|
if (data != null) {
|
||||||
|
String signLink = data.getString("url");
|
||||||
|
return signLink;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error("获取签署链接异常:" + responseObj.toJSONString());
|
||||||
|
}
|
||||||
|
return responseObj.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成签署
|
||||||
|
*
|
||||||
|
* @param arbitrSignatuVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String finishSign(ArbitrSignatuVO arbitrSignatuVO) throws Exception {
|
||||||
|
String methodInvoke = "/storage/contract/lock/";
|
||||||
|
JSONObject requestParam = new JSONObject();
|
||||||
|
requestParam.put("contractId", arbitrSignatuVO.getContractNum());
|
||||||
|
String timestamsParam = RSAUtils.getRtick();
|
||||||
|
// 计算参数签名
|
||||||
|
String paramsSign = RSAUtils.calcRsaSign(this.developerId,
|
||||||
|
this.privateKey, this.serverHost, methodInvoke, timestamsParam, null,
|
||||||
|
requestParam.toJSONString());
|
||||||
|
// 签名参数追加为url参数
|
||||||
|
String fullUrlParams = String.format(urlSignParams, this.developerId,
|
||||||
|
timestamsParam, paramsSign);
|
||||||
|
String responseResult = HttpClientSender.sendHttpPost(this.serverHost, methodInvoke,
|
||||||
|
fullUrlParams, requestParam.toJSONString());
|
||||||
|
JSONObject responseObj = JSON.parseObject(responseResult);
|
||||||
|
// 返回errno为0,表示成功,其他表示失败
|
||||||
|
if (responseObj.getIntValue("errno") == 0) {
|
||||||
|
return "完成签名";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error("完成签署异常:" + responseObj.toJSONString());
|
||||||
|
}
|
||||||
|
return responseObj.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user