|
|
@@ -13,13 +13,17 @@ import cfca.trustsign.util.PdfUtil;
|
|
|
import cfca.trustsign.util.SecurityUtil;
|
|
|
import cfca.trustsign.util.TimeUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import me.zhengjie.application.admin.service.DictDetailService;
|
|
|
+import me.zhengjie.utils.SpringContextHolder;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
public class CFCACertUtil {
|
|
|
@@ -27,8 +31,6 @@ public class CFCACertUtil {
|
|
|
private static final String PROJECT_CODE = "005";
|
|
|
private static final String AUTH_MODE = "公安部";
|
|
|
public static boolean proxySwitchOn = false;
|
|
|
-
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 注册安心签企业用户
|
|
|
@@ -263,9 +265,29 @@ public class CFCACertUtil {
|
|
|
*/
|
|
|
public static String uploadSignContract(UploadSignInfoVO notaryUser, UploadSignInfoVO notaryOffice,
|
|
|
InputStream file, String fileName) throws Exception {
|
|
|
- SignKeywordVO keywordNotaryUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
|
|
|
+
|
|
|
+ DictDetailService dictDetailService = SpringContextHolder.getBean(DictDetailService.class);
|
|
|
+ Map<String, String> map = dictDetailService.getValueByName("signed_position");
|
|
|
+ // signed 公证员签名
|
|
|
+ // 公证员签名
|
|
|
+ String signed = map.get("signed");
|
|
|
+ JSONObject json = JSONObject.parseObject(signed);
|
|
|
+ String keyword = json.getString("keyword");
|
|
|
+ String offsetX = json.getString("offsetX");
|
|
|
+ String offsetY = json.getString("offsetY");
|
|
|
+ String width = json.getString("width");
|
|
|
+ String height = json.getString("height");
|
|
|
+ SignKeywordVO keywordNotaryUser = getSignKeywork(keyword, offsetX, offsetY, width, height);
|
|
|
setSignInfoDefault(notaryUser, keywordNotaryUser);
|
|
|
- SignKeywordVO keywordNotaryOffice = getSignKeywork(Constants.stamp , "0", "0", "150", "150");
|
|
|
+ // 盖章
|
|
|
+ String stamp = map.get("stamp");
|
|
|
+ json = JSONObject.parseObject(stamp);
|
|
|
+ keyword = json.getString("keyword");
|
|
|
+ offsetX = json.getString("offsetX");
|
|
|
+ offsetY = json.getString("offsetY");
|
|
|
+ width = json.getString("width");
|
|
|
+ height = json.getString("height");
|
|
|
+ SignKeywordVO keywordNotaryOffice = getSignKeywork(keyword, offsetX, offsetY, width, height);
|
|
|
setSignInfoDefault(notaryOffice, keywordNotaryOffice);
|
|
|
|
|
|
UploadSignInfoVO[] signInfos = { notaryUser, notaryOffice };
|
|
|
@@ -291,40 +313,41 @@ public class CFCACertUtil {
|
|
|
return tx3203ResVO.getContract().getContractNo();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 上传签署合同
|
|
|
- *
|
|
|
- * @param user
|
|
|
- * @param file
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- public static String uploadSignContract(UploadSignInfoVO user, InputStream file, String fileName) throws Exception {
|
|
|
- SignKeywordVO keywordUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
|
|
|
- setSignInfoDefault(user, keywordUser);
|
|
|
-
|
|
|
- UploadSignInfoVO[] signInfos = { user };
|
|
|
- UploadContractVO uploadContract = new UploadContractVO();
|
|
|
- uploadContract.setSignInfos(signInfos);
|
|
|
- uploadContract.setContractTypeCode("WT");
|
|
|
- uploadContract.setContractName("赋强公证");
|
|
|
-
|
|
|
- HeadVO head = new HeadVO();
|
|
|
- head.setTxTime(TimeUtil.getCurrentTime(TimeUtil.FORMAT_14));
|
|
|
-
|
|
|
- Tx3203ReqVO tx3203ReqVO = new Tx3203ReqVO();
|
|
|
- tx3203ReqVO.setHead(head);
|
|
|
- tx3203ReqVO.setUploadContract(uploadContract);
|
|
|
- // 读取文件的流,TODO
|
|
|
- String response = requestAPI(tx3203ReqVO, "3203", file, fileName);
|
|
|
- if (!isSucess(response)) {
|
|
|
- ErrorResVO errorResVO = new ObjectMapper().readValue(response, ErrorResVO.class);
|
|
|
- System.out.println(errorResVO.getErrorCode() + ": " + errorResVO.getErrorMessage());
|
|
|
- throw new Exception("安心签服务请求失败");
|
|
|
- }
|
|
|
- Tx3203ResVO tx3203ResVO = new ObjectMapper().readValue(response, Tx3203ResVO.class);
|
|
|
- return tx3203ResVO.getContract().getContractNo();
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 上传签署合同
|
|
|
+// *
|
|
|
+// * @param user
|
|
|
+// * @param file
|
|
|
+// * @return
|
|
|
+// * @throws Exception
|
|
|
+// */
|
|
|
+// public static String uploadSignContract(UploadSignInfoVO user, InputStream file, String fileName) throws Exception {
|
|
|
+//
|
|
|
+// SignKeywordVO keywordUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
|
|
|
+// setSignInfoDefault(user, keywordUser);
|
|
|
+//
|
|
|
+// UploadSignInfoVO[] signInfos = { user };
|
|
|
+// UploadContractVO uploadContract = new UploadContractVO();
|
|
|
+// uploadContract.setSignInfos(signInfos);
|
|
|
+// uploadContract.setContractTypeCode("WT");
|
|
|
+// uploadContract.setContractName("赋强公证");
|
|
|
+//
|
|
|
+// HeadVO head = new HeadVO();
|
|
|
+// head.setTxTime(TimeUtil.getCurrentTime(TimeUtil.FORMAT_14));
|
|
|
+//
|
|
|
+// Tx3203ReqVO tx3203ReqVO = new Tx3203ReqVO();
|
|
|
+// tx3203ReqVO.setHead(head);
|
|
|
+// tx3203ReqVO.setUploadContract(uploadContract);
|
|
|
+// // 读取文件的流,TODO
|
|
|
+// String response = requestAPI(tx3203ReqVO, "3203", file, fileName);
|
|
|
+// if (!isSucess(response)) {
|
|
|
+// ErrorResVO errorResVO = new ObjectMapper().readValue(response, ErrorResVO.class);
|
|
|
+// System.out.println(errorResVO.getErrorCode() + ": " + errorResVO.getErrorMessage());
|
|
|
+// throw new Exception("安心签服务请求失败");
|
|
|
+// }
|
|
|
+// Tx3203ResVO tx3203ResVO = new ObjectMapper().readValue(response, Tx3203ResVO.class);
|
|
|
+// return tx3203ResVO.getContract().getContractNo();
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 下载签名公证书
|
|
|
@@ -427,34 +450,58 @@ public class CFCACertUtil {
|
|
|
|
|
|
/**
|
|
|
* 多个人签证,最多三个人
|
|
|
- ** @param notaryUserInfos 签名多个,包含了可能是借款人,抵押人,担保人
|
|
|
- * @param notaryUser 公证员签名信息
|
|
|
- * @param seal 盖章的位置
|
|
|
- * @param file 文件的
|
|
|
- * @param fileName 文件名称
|
|
|
+ **
|
|
|
+ * @param notaryUserInfos 签名多个,包含了可能是借款人,抵押人,担保人
|
|
|
+ * @param notaryUser 公证员签名信息
|
|
|
+ * @param seal 盖章的位置
|
|
|
+ * @param file 文件的
|
|
|
+ * @param fileName 文件名称
|
|
|
* @return 返回合同编号
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public static String uploadMultiSignContract(List<UploadSignInfoVO> notaryUserInfos, UploadSignInfoVO notaryUser,
|
|
|
UploadSignInfoVO seal, InputStream file, String fileName) throws Exception {
|
|
|
-
|
|
|
-
|
|
|
+ DictDetailService dictDetailService = SpringContextHolder.getBean(DictDetailService.class);
|
|
|
+ Map<String, String> map = dictDetailService.getValueByName("signed_position");
|
|
|
int i = 0;
|
|
|
+ String signature = map.get("signature");
|
|
|
+ JSONObject json = JSONObject.parseObject(signature);
|
|
|
+ int start = json.getIntValue("start");
|
|
|
+ int step = json.getIntValue("step");
|
|
|
+ String keyword = json.getString("keyword");
|
|
|
+ String offsetY = json.getString("offsetY");
|
|
|
+ String width = json.getString("width");
|
|
|
+ String height = json.getString("height");
|
|
|
for (UploadSignInfoVO user : notaryUserInfos) {
|
|
|
- String x = String.valueOf(10 + i * 70);
|
|
|
+ String x = String.valueOf(start + i * step);
|
|
|
i++;
|
|
|
- SignKeywordVO keywordNotaryUser = getSignKeywork(Constants.signature, x, "0", "80", "40");
|
|
|
+ SignKeywordVO keywordNotaryUser = getSignKeywork(keyword, x, offsetY, width, height);
|
|
|
setSignInfoDefault(user, keywordNotaryUser);
|
|
|
}
|
|
|
- //公证员签名
|
|
|
+ // 公证员签名
|
|
|
+ String signed = map.get("signed");
|
|
|
+ json = JSONObject.parseObject(signed);
|
|
|
+ keyword = json.getString("keyword");
|
|
|
+ String offsetX = json.getString("offsetX");
|
|
|
+ offsetY = json.getString("offsetY");
|
|
|
+ width = json.getString("width");
|
|
|
+ height = json.getString("height");
|
|
|
+ // 公证员签名
|
|
|
if (notaryUser != null) {
|
|
|
- SignKeywordVO keywordNotaryUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
|
|
|
+ SignKeywordVO keywordNotaryUser = getSignKeywork(keyword, offsetX, offsetY, width, height);
|
|
|
setSignInfoDefault(notaryUser, keywordNotaryUser);
|
|
|
notaryUserInfos.add(notaryUser);
|
|
|
}
|
|
|
- //盖章
|
|
|
+ // 盖章
|
|
|
+ String stamp = map.get("stamp");
|
|
|
+ json = JSONObject.parseObject(stamp);
|
|
|
+ keyword = json.getString("keyword");
|
|
|
+ offsetX = json.getString("offsetX");
|
|
|
+ offsetY = json.getString("offsetY");
|
|
|
+ width = json.getString("width");
|
|
|
+ height = json.getString("height");
|
|
|
if (seal != null) {
|
|
|
- SignKeywordVO keywordNotaryOffice = getSignKeywork(Constants.stamp, "0", "0", "150", "150");
|
|
|
+ SignKeywordVO keywordNotaryOffice = getSignKeywork(keyword, offsetX, offsetY, width, height);
|
|
|
setSignInfoDefault(seal, keywordNotaryOffice);
|
|
|
notaryUserInfos.add(seal);
|
|
|
}
|