Commit a6d91800 authored by 5359's avatar 5359

正式环境参数修改

parent 18c9ffa8
...@@ -12,12 +12,16 @@ import com.hand.hap.core.IRequest; ...@@ -12,12 +12,16 @@ import com.hand.hap.core.IRequest;
import com.hand.hap.system.controllers.BaseController; import com.hand.hap.system.controllers.BaseController;
import hls.support.core.wechat.formbean.AttachmentInfo; import hls.support.core.wechat.formbean.AttachmentInfo;
import com.hand.hap.system.dto.ResponseData; import com.hand.hap.system.dto.ResponseData;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*; import java.util.*;
/** /**
...@@ -321,6 +325,39 @@ public class SignHclcController extends BaseController { ...@@ -321,6 +325,39 @@ public class SignHclcController extends BaseController {
} }
/**
* 获取人身核验地址
*
* @param request
* @param dto 获取人身核验地址
* @return Map
*/
@ResponseBody
@RequestMapping("/auth/api/license/ocr")
public JSONObject getOcrLicense(HttpServletRequest request,
@RequestBody SignUserInfoHclc dto) {
String img = "";
String realPath = "d:\\1610543886923.jpg";
File file = new File(realPath);
FileInputStream inputFile;
byte[] buffer = null;
try {
inputFile = new FileInputStream(file);
buffer = new byte[(int) file.length()];
inputFile.read(buffer);
inputFile.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
img= Base64.encodeBase64String(buffer);
return signHclcService.ocrLicense(createRequestContext(request), img);
}
/** /**
* 经办人授权/取消授权 * 经办人授权/取消授权
* *
...@@ -530,6 +567,21 @@ public class SignHclcController extends BaseController { ...@@ -530,6 +567,21 @@ public class SignHclcController extends BaseController {
} }
/**
* 文件直传
*
* @param request
* @param dto 文件直传
* @return Map
*/
@ResponseBody
@RequestMapping("/sign/files/download")
public Map<String, Object> signFileDownload(HttpServletRequest request,
@RequestBody AttachmentInfo dto) {
return signHclcService.signFileDownload(createRequestContext(request), dto);
}
/** /**
* 创建签署流程 * 创建签署流程
* *
...@@ -562,6 +614,20 @@ public class SignHclcController extends BaseController { ...@@ -562,6 +614,20 @@ public class SignHclcController extends BaseController {
return json; return json;
} }
/**
* 创建印章
*
* @param request
* @param params 创建签署流程
* @return Map
*/
@ResponseBody
@RequestMapping(value = "/sign/flows/cancel", method = RequestMethod.POST)
public JSONObject cancelSignFlows(HttpServletRequest request,
@RequestBody(required = true) JSONObject params) {
return signHclcService.cancelSignFlows(createRequestContext(request), params);
}
// /** // /**
// * 创建签署流程 // * 创建签署流程
// * // *
......
...@@ -51,4 +51,17 @@ public class SignHclcListenController extends BaseController { ...@@ -51,4 +51,17 @@ public class SignHclcListenController extends BaseController {
responseData.setMessage("接收成功!"); responseData.setMessage("接收成功!");
return responseData; return responseData;
} }
@ResponseBody
@RequestMapping(value = "/api/public/user", method = RequestMethod.POST)
public JSONObject posttest(HttpServletRequest request,
@RequestBody(required = false) JSONObject params) {
JSONObject responseData = new JSONObject();
responseData.put("objectVersionNumber",1);
responseData.put("_token","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9/eyJhdWQiOlsiYXBpLXJlc291cmNlIl0sInVzZXJfbmFt==");
responseData.put("id",1);
responseData.put("code","lishuangyi");
responseData.put("name","黎双意");
return responseData;
}
} }
...@@ -33,8 +33,12 @@ public interface ISignInfoHclcService extends IBaseService<SignUserInfoHclc>, Pr ...@@ -33,8 +33,12 @@ public interface ISignInfoHclcService extends IBaseService<SignUserInfoHclc>, Pr
Map<String, Object> signFileUpload(IRequest requestContext, AttachmentInfo dto); Map<String, Object> signFileUpload(IRequest requestContext, AttachmentInfo dto);
Map<String, Object> signFileDownload(IRequest requestContext, AttachmentInfo dto);
JSONObject createSignFlows(IRequest requestContext, JSONObject params); JSONObject createSignFlows(IRequest requestContext, JSONObject params);
JSONObject cancelSignFlows(IRequest requestContext, JSONObject params);
String createTemplateSeals(String accountId, String openId); String createTemplateSeals(String accountId, String openId);
// JSONObject cancelSignFlows(IRequest requestContext, JSONObject params); // JSONObject cancelSignFlows(IRequest requestContext, JSONObject params);
...@@ -42,4 +46,6 @@ public interface ISignInfoHclcService extends IBaseService<SignUserInfoHclc>, Pr ...@@ -42,4 +46,6 @@ public interface ISignInfoHclcService extends IBaseService<SignUserInfoHclc>, Pr
void postSignFlowsResult(IRequest iRequest, JSONObject params); void postSignFlowsResult(IRequest iRequest, JSONObject params);
JSONObject sendWxTemplateMsg(JSONObject json); JSONObject sendWxTemplateMsg(JSONObject json);
JSONObject ocrLicense(IRequest iRequest, String img);
} }
...@@ -20,6 +20,7 @@ import com.hand.hap.intergration.service.IHapInterfaceHeaderService; ...@@ -20,6 +20,7 @@ import com.hand.hap.intergration.service.IHapInterfaceHeaderService;
import com.hand.hap.intergration.utils.HttpUtil; import com.hand.hap.intergration.utils.HttpUtil;
import com.hand.hap.system.service.impl.BaseServiceImpl; import com.hand.hap.system.service.impl.BaseServiceImpl;
import hls.support.core.wechat.formbean.AttachmentInfo; import hls.support.core.wechat.formbean.AttachmentInfo;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
...@@ -88,6 +89,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -88,6 +89,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
public static final String tokenApiName = "getToken"; public static final String tokenApiName = "getToken";
public static final String indivApiName = "getIndivAuthUrl"; public static final String indivApiName = "getIndivAuthUrl";
public static final String getAccIdApiName = "getAccByThirdId"; public static final String getAccIdApiName = "getAccByThirdId";
public static final String getLicenseApiName = "getLicenseInfo";
//公众号接口信息 //公众号接口信息
public static final String wxSysName = "wxgzh_hitachics"; public static final String wxSysName = "wxgzh_hitachics";
public static final String wxDownLoadApiName = "media_download"; public static final String wxDownLoadApiName = "media_download";
...@@ -127,8 +129,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -127,8 +129,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
public SignInfoHclcServiceImpl() { public SignInfoHclcServiceImpl() {
// ensure e-sign SDK will be init only once // ensure e-sign SDK will be init only once
RequestConfig config = RequestConfig.custom().setConnectTimeout(60 * 1000).setSocketTimeout(15000).build(); // RequestConfig config = RequestConfig.custom().setConnectTimeout(60 * 1000).setSocketTimeout(60000).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build(); // httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
} }
...@@ -137,7 +139,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -137,7 +139,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (Objects.isNull(info.getOpenId()) || "undefined".equalsIgnoreCase(info.getOpenId())) { if (Objects.isNull(info.getOpenId()) || "undefined".equalsIgnoreCase(info.getOpenId())) {
logger.error("关键参数openId不存在,调用失败!"); logger.info("关键参数openId不存在,调用失败!");
map.put("code", "000001"); map.put("code", "000001");
map.put("message", "关键参数openId不存在,调用失败!"); map.put("message", "关键参数openId不存在,调用失败!");
return map; return map;
...@@ -263,7 +265,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -263,7 +265,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//获取鉴权Token //获取鉴权Token
String tokenApiUrl = getApiUrl(indivSysName, tokenApiName); String tokenApiUrl = getApiUrl(indivSysName, tokenApiName);
logger.debug("token url: {}", tokenApiUrl); logger.info("token url: {}", tokenApiUrl);
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, signInfoHclc.getAppId(), signInfoHclc.getSecret()); String token = signHclcUtils.getFaceApiToken(tokenApiUrl, signInfoHclc.getAppId(), signInfoHclc.getSecret());
if (Objects.nonNull(token)) { if (Objects.nonNull(token)) {
...@@ -311,7 +313,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -311,7 +313,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口密钥参数信息 //初始化接口密钥参数信息
HapInterfaceHeader headerAndLineDTO = headerService.getHeaderAndLine(sysName, apiName); HapInterfaceHeader headerAndLineDTO = headerService.getHeaderAndLine(sysName, apiName);
if (headerAndLineDTO == null) { if (headerAndLineDTO == null) {
logger.debug("headerAndLineDTO is null, apiName:{}, sysName:{}", apiName, sysName); logger.info("headerAndLineDTO is null, apiName:{}, sysName:{}", apiName, sysName);
return null; return null;
} }
return headerAndLineDTO.getDomainUrl() + headerAndLineDTO.getIftUrl(); return headerAndLineDTO.getDomainUrl() + headerAndLineDTO.getIftUrl();
...@@ -373,7 +375,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -373,7 +375,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口url信息 //初始化接口url信息
// String faceApiurl = getApiUrl(indivSysName, indivApiName).replace("{accountId}", info.getAuthAccountId()); // String faceApiurl = getApiUrl(indivSysName, indivApiName).replace("{accountId}", info.getAuthAccountId());
String faceApiurl = getApiUrl(indivSysName, indivApiName); String faceApiurl = getApiUrl(indivSysName, indivApiName);
logger.debug("get face api url: {}", faceApiurl); logger.info("get face api url: {}", faceApiurl);
//发送http请求 //发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
...@@ -429,7 +431,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -429,7 +431,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
try { try {
//初始化接口url信息 //初始化接口url信息
String accIdApiurl = getApiUrl(indivSysName, getAccIdApiName) + "?" + param; String accIdApiurl = getApiUrl(indivSysName, getAccIdApiName) + "?" + param;
logger.debug("get accountId api url: {}", accIdApiurl); logger.info("get accountId api url: {}", accIdApiurl);
//发送http请求 //发送http请求
HttpResponse execute = HttpUtil.getJson(accIdApiurl, headInfo); HttpResponse execute = HttpUtil.getJson(accIdApiurl, headInfo);
...@@ -476,7 +478,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -476,7 +478,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// //
// JSONObject json = null; // JSONObject json = null;
// if (Objects.isNull(attachmentInfo.getMediaId())) { // if (Objects.isNull(attachmentInfo.getMediaId())) {
// logger.error("upload attachment failed, attachmentInfo:{} 关键参数mediaId不存在,调用失败!", JSON.toJSONString(attachmentInfo)); // logger.info("upload attachment failed, attachmentInfo:{} 关键参数mediaId不存在,调用失败!", JSON.toJSONString(attachmentInfo));
// json.put("code", "3"); // json.put("code", "3");
// json.put("message", "关键参数mediaId不存在,调用失败"); // json.put("message", "关键参数mediaId不存在,调用失败");
// return json; // return json;
...@@ -529,7 +531,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -529,7 +531,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// return json; // return json;
// //
// } catch (Exception e) { // } catch (Exception e) {
// logger.error("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(attachmentInfo), e); // logger.info("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(attachmentInfo), e);
// json.put("code", "2"); // json.put("code", "2");
// json.put("message", e.getMessage()); // json.put("message", e.getMessage());
// return json; // return json;
...@@ -537,6 +539,75 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -537,6 +539,75 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// //
// } // }
/***
* E签宝营业执照OCR;
* @param iRequest
* @param img 营业执照
***/
public JSONObject ocrLicense(IRequest iRequest, String img) {
JSONObject resultjson = new JSONObject();
//业务方交互上下文信息
JSONObject result = new JSONObject();
//营业执照图片BASE64字符串
result.put("img", img);
JSONObject json = new JSONObject(result);
//初始化接口密钥参数信息
SignHclcUtils signHclcUtils = new SignHclcUtils();
//获取鉴权Token
// String tokenApiUrl = getApiUrl(indivSysName, tokenApiName);
String tokenApiUrl = "https://smlopenapi.esign.cn/v1/oauth2/access_token";
logger.info("token url: {}", tokenApiUrl);
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, "7438830952", "07e5a0e1bf7ff6891058c1f52b8e141b");
//初始化接口密钥参数信息
// String token = signHclcUtils.getFaceApiToken(tokenApiUrl, appId, secret);
//设置http请求head信息
Map<String, String> headInfo = new HashMap<String, String>();
// headInfo.put("X-Tsign-Open-App-Id", appId);
headInfo.put("X-Tsign-Open-App-Id", "7438830952");
headInfo.put("X-Tsign-Open-Token", token);
JSONObject jsonResult = null;
try {
//初始化接口信息
// String url = getApiUrl(indivSysName , getLicenseApiName);
String url = "https://smlopenapi.esign.cn/v2/identity/auth/api/ocr/license";
logger.info("get ocr result url: {}", url);
//发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, signHclcUtils1.APPLICATION_JSON);
//解析返回结果
jsonResult = JSONObject.parseObject(stringResult);
if ("0".equalsIgnoreCase(jsonResult.getString("code"))) {
JSONObject data = jsonResult.getJSONObject("data");
resultjson.put("法人", data.getString("legalRepName"));
resultjson.put("单位名称", data.getString("name"));
resultjson.put("社会信用代码", data.getString("certNo"));
resultjson.put("地址", data.getString("address"));
resultjson.put("有效期", data.getString("validTerm"));
resultjson.put("code", "0");
resultjson.put("message", "e签宝营业执照OCR成功!");
} else {
logger.info("get ocr result failed, code:{} ,message:{}", jsonResult.getString("code"), jsonResult.getString("message"));
resultjson.put("code", jsonResult.getString("code"));
resultjson.put("message", "e签宝营业执照OCR失败," + jsonResult.getString("message"));
}
} catch (Exception e) {
logger.info("get ocr result failed, msg:{}", e.getMessage());
resultjson.put("code", "000006");
resultjson.put("message", "e签宝营业执照OCR失败," + e.getMessage());
}
return resultjson;
}
/*** /***
* 下载微信图片资源上传至业务系统; * 下载微信图片资源上传至业务系统;
* @param iRequest * @param iRequest
...@@ -547,7 +618,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -547,7 +618,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
if (Objects.isNull(attachmentInfo.getMediaId())) { if (Objects.isNull(attachmentInfo.getMediaId())) {
logger.error("upload attachment failed, attachmentInfo:{} 关键参数mediaId不存在,调用失败!", JSON.toJSONString(attachmentInfo)); logger.info("upload attachment failed, attachmentInfo:{} 关键参数mediaId不存在,调用失败!", JSON.toJSONString(attachmentInfo));
json.put("code", "000003"); json.put("code", "000003");
json.put("message", "关键参数mediaId不存在,调用失败"); json.put("message", "关键参数mediaId不存在,调用失败");
return json; return json;
...@@ -589,7 +660,9 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -589,7 +660,9 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
json = signHclcUtils.idcard(bytes); json = signHclcUtils.idcard(bytes);
} else { } else {
//营业执照 //营业执照
json = signHclcUtils.businessLicense(bytes); // json = signHclcUtils.businessLicense(bytes);
String idNOBlob = Base64.encodeBase64String(bytes);
json = ocrLicense(iRequest, idNOBlob);
} }
json.put("code", "0"); json.put("code", "0");
...@@ -604,7 +677,6 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -604,7 +677,6 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
if (Objects.nonNull(attchmentId)) { if (Objects.nonNull(attchmentId)) {
//设置用户信息表附件信息--身份证 //设置用户信息表附件信息--身份证
signUserAttachInfo.setAttachmentIdHclc(Long.valueOf(attchmentId)); signUserAttachInfo.setAttachmentIdHclc(Long.valueOf(attchmentId));
iSignUserAttachInfoService.updateByPrimaryKey(iRequest, signUserAttachInfo);
json.put("attchmentId", attchmentId); json.put("attchmentId", attchmentId);
} else { } else {
json.put("code", "000005"); json.put("code", "000005");
...@@ -616,10 +688,12 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -616,10 +688,12 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
json.put("message", "下载服务器图片失败,OCR识别失败"); json.put("message", "下载服务器图片失败,OCR识别失败");
} }
iSignUserAttachInfoService.updateByPrimaryKey(iRequest, signUserAttachInfo);
logger.info("upload attachment json:{}", json.toString());
return json; return json;
} catch (Exception e) { } catch (Exception e) {
logger.error("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(attachmentInfo), e); logger.info("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(attachmentInfo), e);
json.put("code", "000002"); json.put("code", "000002");
json.put("message", e.getMessage()); json.put("message", e.getMessage());
return json; return json;
...@@ -635,7 +709,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -635,7 +709,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// //
// //初始化接口信息 // //初始化接口信息
// String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName()); // String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName());
// logger.debug("upload url: {}", url); // logger.info("upload url: {}", url);
// //
// //发起http请求下载文件 // //发起http请求下载文件
// HttpPost httpPost = new HttpPost(url); // HttpPost httpPost = new HttpPost(url);
...@@ -667,7 +741,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -667,7 +741,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// //
// return filePath; // return filePath;
// } catch (IOException e) { // } catch (IOException e) {
// logger.error("获取服务器图片失败,msg:{}", e.getMessage()); // logger.info("获取服务器图片失败,msg:{}", e.getMessage());
// e.printStackTrace(); // e.printStackTrace();
// return "-1"; // return "-1";
// } // }
...@@ -685,7 +759,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -685,7 +759,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName()); String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName());
logger.debug("upload url: {}", url); logger.info("upload url: {}", url);
//发起http请求下载文件 //发起http请求下载文件
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
...@@ -696,6 +770,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -696,6 +770,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
httpPost.setEntity(se); httpPost.setEntity(se);
//获取微信服务器媒体文件 //获取微信服务器媒体文件
RequestConfig config = RequestConfig.custom().setConnectTimeout(60 * 1000).setSocketTimeout(60000).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
CloseableHttpResponse response = httpClient.execute(httpPost); CloseableHttpResponse response = httpClient.execute(httpPost);
InputStream inputStream = response.getEntity().getContent(); InputStream inputStream = response.getEntity().getContent();
return inputStream; return inputStream;
...@@ -732,7 +808,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -732,7 +808,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(wxSysName, wxSendTemplateApiName); String url = getApiUrl(wxSysName, wxSendTemplateApiName);
logger.debug("upload url: {}", url); logger.info("upload url: {}", url);
//发送http请求 //发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
...@@ -743,7 +819,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -743,7 +819,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
result.put("code", "0"); result.put("code", "0");
result.put("message", "微信消息发送成功!"); result.put("message", "微信消息发送成功!");
} else { } else {
logger.error("send wx message failed, errCode:{} ,msg:{}", jsonResult.getString("resultCode"), jsonResult.getString("resultMessage")); logger.info("send wx message failed, errCode:{} ,msg:{}", jsonResult.getString("resultCode"), jsonResult.getString("resultMessage"));
result.put("code", jsonResult.getString("resultCode")); result.put("code", jsonResult.getString("resultCode"));
result.put("message", "微信消息发送失败," + jsonResult.getString("resultMessage")); result.put("message", "微信消息发送失败," + jsonResult.getString("resultMessage"));
} }
...@@ -752,13 +828,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -752,13 +828,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// public String uploadFileToHclc(String filePath, AttachmentInfo info) { // public String uploadFileToHclc(String filePath, AttachmentInfo info) {
// //todo upload file // //todo upload file
// logger.debug("params,filePath:{}, attachmentInfo:{}", filePath, JSON.toJSONString(info)); // logger.info("params,filePath:{}, attachmentInfo:{}", filePath, JSON.toJSONString(info));
// if (filePath == null || info == null || StringUtils.isBlank(info.getPkValue()) || StringUtils.isBlank(info.getSourceType())) { // if (filePath == null || info == null || StringUtils.isBlank(info.getPkValue()) || StringUtils.isBlank(info.getSourceType())) {
// return null; // return null;
// } // }
// //
// String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName()); // String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName());
// logger.debug("upload url: {}", url); // logger.info("upload url: {}", url);
// HttpPost httpPost = new HttpPost(url); // HttpPost httpPost = new HttpPost(url);
// //
// //prepare params // //prepare params
...@@ -788,7 +864,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -788,7 +864,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// } // }
// return result; // return result;
// } catch (IOException e) { // } catch (IOException e) {
// logger.error("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(info), e); // logger.info("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(info), e);
// } // }
// return null; // return null;
// } // }
...@@ -800,13 +876,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -800,13 +876,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
***/ ***/
public String uploadFileToHclc(byte[] bytes, AttachmentInfo info) { public String uploadFileToHclc(byte[] bytes, AttachmentInfo info) {
//todo upload file //todo upload file
logger.debug("params,bytes:{}, attachmentInfo:{}", bytes, JSON.toJSONString(info)); logger.info("params, attachmentInfo:{}", JSON.toJSONString(info));
if (ArrayUtils.isEmpty(bytes) || info == null || StringUtils.isBlank(info.getPkValue()) || StringUtils.isBlank(info.getSourceType())) { if (ArrayUtils.isEmpty(bytes) || info == null || StringUtils.isBlank(info.getPkValue()) || StringUtils.isBlank(info.getSourceType())) {
return null; return null;
} }
String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName()); String url = getApiUrl(info.getUploadSysName(), info.getUploadApiName());
logger.debug("upload url: {}", url); logger.info("upload url: {}", url);
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
//prepare params //prepare params
...@@ -826,15 +902,18 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -826,15 +902,18 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
.setCharset(CharsetUtils.get("utf-8")) .setCharset(CharsetUtils.get("utf-8"))
.build(); .build();
httpPost.setEntity(entity); httpPost.setEntity(entity);
RequestConfig config = RequestConfig.custom().setConnectTimeout(60 * 1000).setSocketTimeout(60000).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
CloseableHttpResponse response = httpClient.execute(httpPost); CloseableHttpResponse response = httpClient.execute(httpPost);
InputStream content = response.getEntity().getContent(); InputStream content = response.getEntity().getContent();
String result = IOUtils.toString(content); String result = IOUtils.toString(content);
logger.info("upload attachment , attchmentId:{}", result);
if (StringUtils.equals(RESULT_ERROR, result)) { if (StringUtils.equals(RESULT_ERROR, result)) {
return null; return null;
} }
return result; return result;
} catch (IOException e) { } catch (IOException e) {
logger.error("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(info), e); logger.info("upload attachment failed, attachmentInfo:{}", JSON.toJSONString(info), e);
} }
return null; return null;
} }
...@@ -851,7 +930,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -851,7 +930,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (Objects.isNull(dto.getAttachmentId())) { if (Objects.isNull(dto.getAttachmentId())) {
logger.error("关键参数AttachmentId不存在,调用失败!"); logger.info("关键参数AttachmentId不存在,调用失败!");
map.put("success", "false"); map.put("success", "false");
map.put("message", "关键参数AttachmentId不存在,调用失败!"); map.put("message", "关键参数AttachmentId不存在,调用失败!");
return map; return map;
...@@ -874,7 +953,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -874,7 +953,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
map.put("message", "上传成功"); map.put("message", "上传成功");
} }
} else { } else {
logger.error("业务系统文件下载失败请检查文件下载路径!"); logger.info("业务系统文件下载失败请检查文件下载路径!");
map.put("success", "false"); map.put("success", "false");
map.put("message", "业务系统文件下载失败请检查文件下载路径!"); map.put("message", "业务系统文件下载失败请检查文件下载路径!");
} }
...@@ -894,15 +973,17 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -894,15 +973,17 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
url = url + (url.indexOf("?") > 0 ? "&attachment_id=" : "?attachment_id=") + attachmentId; url = url + (url.indexOf("?") > 0 ? "&attachment_id=" : "?attachment_id=") + attachmentId;
HttpGet httpGet = new HttpGet(url); HttpGet httpGet = new HttpGet(url);
RequestConfig config = RequestConfig.custom().setConnectTimeout(60 * 1000).setSocketTimeout(60000).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
CloseableHttpResponse response = httpClient.execute(httpGet); CloseableHttpResponse response = httpClient.execute(httpGet);
if (HttpStatus.SC_OK != response.getStatusLine().getStatusCode()) { if (HttpStatus.SC_OK != response.getStatusLine().getStatusCode()) {
logger.error("request target attachment({}) failed,sysName:{}, apiName:{}", attachmentId, hclcSysName, hclcDownloadApiName); logger.info("request target attachment({}) failed,sysName:{}, apiName:{}", attachmentId, hclcSysName, hclcDownloadApiName);
return null; return null;
} }
InputStream content = response.getEntity().getContent(); InputStream content = response.getEntity().getContent();
return IOUtils.toByteArray(content); return IOUtils.toByteArray(content);
} catch (Exception e) { } catch (Exception e) {
logger.error("request target attachment({}) failed,sysName:{}, apiName:{}", attachmentId, hclcSysName, hclcDownloadApiName); logger.info("request target attachment({}) failed,sysName:{}, apiName:{}", attachmentId, hclcSysName, hclcDownloadApiName);
return null; return null;
} }
...@@ -920,7 +1001,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -920,7 +1001,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
private String fileUpload(byte[] bytes, String uploadUrl, String fileName) { private String fileUpload(byte[] bytes, String uploadUrl, String fileName) {
String res = ""; String res = "";
//初始化接口url信息 //初始化接口url信息
logger.debug("upload url: {}", uploadUrl); logger.info("upload url: {}", uploadUrl);
try { try {
HttpPost httpPost = new HttpPost(uploadUrl); HttpPost httpPost = new HttpPost(uploadUrl);
...@@ -940,6 +1021,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -940,6 +1021,8 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
.build(); .build();
httpPost.setEntity(entity); httpPost.setEntity(entity);
RequestConfig config = RequestConfig.custom().setConnectTimeout(60 * 1000).setSocketTimeout(60000).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
CloseableHttpResponse response = httpClient.execute(httpPost); CloseableHttpResponse response = httpClient.execute(httpPost);
InputStream content = response.getEntity().getContent(); InputStream content = response.getEntity().getContent();
res = IOUtils.toString(content); res = IOUtils.toString(content);
...@@ -1004,7 +1087,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1004,7 +1087,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(signatureSysName, accountsApiName); String url = getApiUrl(signatureSysName, accountsApiName);
logger.debug("add person account url: {}", url); logger.info("add person account url: {}", url);
//发送http请求 //发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
...@@ -1024,12 +1107,12 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1024,12 +1107,12 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
map.put("code", "0"); map.put("code", "0");
map.put("message", "个人e签宝账户创建成功!"); map.put("message", "个人e签宝账户创建成功!");
} else { } else {
logger.error("create person account failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg")); logger.info("create person account failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
map.put("code", jsonResult.getString("errCode")); map.put("code", jsonResult.getString("errCode"));
map.put("message", "个人e签宝账户创建失败," + jsonResult.getString("msg")); map.put("message", "个人e签宝账户创建失败," + jsonResult.getString("msg"));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("create person account failed, msg:{}", e.getMessage()); logger.info("create person account failed, msg:{}", e.getMessage());
map.put("code", "000006"); map.put("code", "000006");
map.put("message", "个人e签宝账户创建失败," + e.getMessage()); map.put("message", "个人e签宝账户创建失败," + e.getMessage());
} }
...@@ -1065,7 +1148,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1065,7 +1148,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(signatureSysName, createSealsApiName); String url = getApiUrl(signatureSysName, createSealsApiName);
logger.debug("create seals url: {}", url); logger.info("create seals url: {}", url);
//发送http请求 //发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
...@@ -1077,11 +1160,11 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1077,11 +1160,11 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
JSONObject data = jsonResult.getJSONObject("data"); JSONObject data = jsonResult.getJSONObject("data");
return data.getString("sealId"); return data.getString("sealId");
} else { } else {
logger.error("create seals failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg")); logger.info("create seals failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
return "-1"; return "-1";
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("create seals failed, msg:{}", e.getMessage()); logger.info("create seals failed, msg:{}", e.getMessage());
return "-1"; return "-1";
} }
...@@ -1093,7 +1176,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1093,7 +1176,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
signInfoHclc = this.selectByPrimaryKey(iRequest, signInfoHclc); signInfoHclc = this.selectByPrimaryKey(iRequest, signInfoHclc);
if (Objects.isNull(signInfoHclc)) { if (Objects.isNull(signInfoHclc)) {
logger.debug("未找到对应e签宝个人用户信息,请检查!"); logger.info("未找到对应e签宝个人用户信息,请检查!");
map.put("code", "000002"); map.put("code", "000002");
map.put("message", "未找到对应e签宝个人用户信息,请检查!"); map.put("message", "未找到对应e签宝个人用户信息,请检查!");
return map; return map;
...@@ -1110,7 +1193,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1110,7 +1193,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
} }
if (Objects.isNull(accountId) || "".equalsIgnoreCase(accountId)) { if (Objects.isNull(accountId) || "".equalsIgnoreCase(accountId)) {
logger.debug("e签宝个人账户不存在,无需注销!"); logger.info("e签宝个人账户不存在,无需注销!");
map.put("code", "40051667"); map.put("code", "40051667");
map.put("message", "e签宝个人账户不存在,无需注销!"); map.put("message", "e签宝个人账户不存在,无需注销!");
return map; return map;
...@@ -1138,7 +1221,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1138,7 +1221,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(signatureSysName, deleteApiName); String url = getApiUrl(signatureSysName, deleteApiName);
logger.debug("delete person account url: {}", url); logger.info("delete person account url: {}", url);
//发送http请求 //发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
...@@ -1146,17 +1229,17 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1146,17 +1229,17 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//解析返回结果 //解析返回结果
JSONObject jsonResult = JSONObject.parseObject(stringResult); JSONObject jsonResult = JSONObject.parseObject(stringResult);
if ("0".equalsIgnoreCase(jsonResult.getString("errCode")) || "40051667".equalsIgnoreCase(jsonResult.getString("errCode"))) { if ("0".equalsIgnoreCase(jsonResult.getString("errCode")) || "40051667".equalsIgnoreCase(jsonResult.getString("errCode")) || ("-1".equalsIgnoreCase(jsonResult.getString("errCode")) && "用户不存在".equalsIgnoreCase(jsonResult.getString("msg")))) {
map.put("code", "0"); map.put("code", "0");
map.put("message", "e签宝个人用户注销成功!"); map.put("message", "e签宝个人用户注销成功!");
} else { } else {
logger.error("delete person account failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg")); logger.info("delete person account failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
map.put("code", jsonResult.getString("errCode")); map.put("code", jsonResult.getString("errCode"));
map.put("message", "e签宝个人用户注销失败," + jsonResult.getString("msg")); map.put("message", "e签宝个人用户注销失败," + jsonResult.getString("msg"));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("delete person account failed, msg:{}", e.getMessage()); logger.info("delete person account failed, msg:{}", e.getMessage());
map.put("code", "000004"); map.put("code", "000004");
map.put("message", "e签宝个人用户注销失败," + e.getMessage()); map.put("message", "e签宝个人用户注销失败," + e.getMessage());
} }
...@@ -1222,7 +1305,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1222,7 +1305,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
List<SignUserInfoHclc> signInfoHclcs = signInfoHclcMapper.queryUserInfo(signInfoHclc); List<SignUserInfoHclc> signInfoHclcs = signInfoHclcMapper.queryUserInfo(signInfoHclc);
if (signInfoHclcs.size() == 0) { if (signInfoHclcs.size() == 0) {
logger.error("create sign flows failed, account:{} is not defined in wx", name + idNo); logger.info("create sign flows failed, account:{} is not defined in wx", name + idNo);
jsonResult.put("errCode", "2"); jsonResult.put("errCode", "2");
jsonResult.put("msg", "创建签署流程失败,用户" + name + idNo + ((Objects.nonNull(agentIdNo) && !"".equalsIgnoreCase(agentIdNo)) ? ("经办人" + agentIdNo) : "") + "在移动端未完成实名认证授权,请先认证授权!"); jsonResult.put("msg", "创建签署流程失败,用户" + name + idNo + ((Objects.nonNull(agentIdNo) && !"".equalsIgnoreCase(agentIdNo)) ? ("经办人" + agentIdNo) : "") + "在移动端未完成实名认证授权,请先认证授权!");
return jsonResult; return jsonResult;
...@@ -1234,7 +1317,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1234,7 +1317,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//用户类型是个人时 //用户类型是个人时
if (signInfoHclc.getCtitype().compareTo(1L) == 0) { if (signInfoHclc.getCtitype().compareTo(1L) == 0) {
json1.put("accountId", signInfoHclc.getAccountId()); json1.put("accountId", signInfoHclc.getAccountId());
json1.put("uniqueId", signInfoHclc.getOpenId().replace("personHclc","")); json1.put("uniqueId", signInfoHclc.getOpenId().replace("personHclc", ""));
//用户类型是机构时 //用户类型是机构时
} else { } else {
json1.put("accountId", signInfoHclc.getAgentAccountId()); json1.put("accountId", signInfoHclc.getAgentAccountId());
...@@ -1335,7 +1418,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1335,7 +1418,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//流程主题 //流程主题
result.put("subject", params.get("subject")); result.put("subject", params.get("subject"));
//一键落章 // //一键落章
// result.put("signSceneNo", "QSCJ0001"); // result.put("signSceneNo", "QSCJ0001");
JSONObject json = new JSONObject(result); JSONObject json = new JSONObject(result);
...@@ -1356,7 +1439,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1356,7 +1439,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(signatureSysName, signFlowsApiName); String url = getApiUrl(signatureSysName, signFlowsApiName);
logger.debug("sign flows url: {}", url); logger.info("sign flows url: {}", url);
signFlowsInfoHclc.setContractNo(params.getString("bizNo")); signFlowsInfoHclc.setContractNo(params.getString("bizNo"));
signFlowsInfoHclc.setSignAction("SIGN_CREATE"); signFlowsInfoHclc.setSignAction("SIGN_CREATE");
...@@ -1373,7 +1456,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1373,7 +1456,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
jsonResult = JSONObject.parseObject(stringResult); jsonResult = JSONObject.parseObject(stringResult);
signFlowsInfoHclc.setResponseClob(stringResult); signFlowsInfoHclc.setResponseClob(stringResult);
if (!"0".equalsIgnoreCase(jsonResult.getString("errCode"))) { if (!"0".equalsIgnoreCase(jsonResult.getString("errCode"))) {
logger.error("create sign flows failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg")); logger.info("create sign flows failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
} else { } else {
JSONObject data = jsonResult.getJSONObject("data"); JSONObject data = jsonResult.getJSONObject("data");
...@@ -1428,7 +1511,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1428,7 +1511,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
} catch (Exception e) { } catch (Exception e) {
logger.error("create sign flows failed, msg:{}", e.getMessage()); logger.info("create sign flows failed, msg:{}", e.getMessage());
jsonResult.put("errCode", "000004"); jsonResult.put("errCode", "000004");
jsonResult.put("msg", "创建签署流程失败," + e.getMessage()); jsonResult.put("msg", "创建签署流程失败," + e.getMessage());
} }
...@@ -1520,7 +1603,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1520,7 +1603,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(hclcSysName, signSendApiName); String url = getApiUrl(hclcSysName, signSendApiName);
logger.debug("sign flow url: {}", url); logger.info("sign flow url: {}", url);
Map<String, String> headInfo = new HashMap<String, String>(); Map<String, String> headInfo = new HashMap<String, String>();
headInfo.put("Content-Type", "application/x-www-form-urlencoded"); headInfo.put("Content-Type", "application/x-www-form-urlencoded");
...@@ -1538,7 +1621,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1538,7 +1621,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
signFlowsInfoHclc.setSendFlag("Y"); signFlowsInfoHclc.setSendFlag("Y");
iSignFlowsInfoHclcService.updateByPrimaryKey(iRequest, signFlowsInfoHclc); iSignFlowsInfoHclcService.updateByPrimaryKey(iRequest, signFlowsInfoHclc);
} else { } else {
logger.error("post sign flow failed, errCode:{} ,msg:{}", jsonResult.getJSONObject("error").getString("code"), jsonResult.getJSONObject("error").getString("message")); logger.info("post sign flow failed, errCode:{} ,msg:{}", jsonResult.getJSONObject("error").getString("code"), jsonResult.getJSONObject("error").getString("message"));
} }
...@@ -1547,7 +1630,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1547,7 +1630,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// if (downloadFlag) { // if (downloadFlag) {
//初始化签署文件下载接口信息 //初始化签署文件下载接口信息
String signUrl = getApiUrl(hclcSysName, signFileDownApiName); String signUrl = getApiUrl(hclcSysName, signFileDownApiName);
logger.debug("sign flow url: {}", url); logger.info("sign flow url: {}", url);
Map<String, String> downHeadInfo = new HashMap<String, String>(); Map<String, String> downHeadInfo = new HashMap<String, String>();
headInfo.put("Content-Type", "application/x-www-form-urlencoded"); headInfo.put("Content-Type", "application/x-www-form-urlencoded");
...@@ -1558,13 +1641,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1558,13 +1641,13 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//解析返回结果 //解析返回结果
JSONObject jsonResult2 = JSONObject.parseObject(stringResult2); JSONObject jsonResult2 = JSONObject.parseObject(stringResult2);
if (!"true".equalsIgnoreCase(jsonResult2.getString("success"))) { if (!"true".equalsIgnoreCase(jsonResult2.getString("success"))) {
logger.error("down sign file failed, errCode:{} ,msg:{}", jsonResult2.getJSONObject("error").getString("code"), jsonResult2.getJSONObject("error").getString("message")); logger.info("down sign file failed, errCode:{} ,msg:{}", jsonResult2.getJSONObject("error").getString("code"), jsonResult2.getJSONObject("error").getString("message"));
} }
} }
// } // }
} catch (Exception e) { } catch (Exception e) {
logger.error("post sign flow failed ,msg:{}", e.getMessage()); logger.info("post sign flow failed ,msg:{}", e.getMessage());
} }
} }
...@@ -1588,7 +1671,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1588,7 +1671,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//初始化接口信息 //初始化接口信息
String url = getApiUrl(signatureSysName, getSignUrlsApiName); String url = getApiUrl(signatureSysName, getSignUrlsApiName);
logger.debug("upload url: {}", url); logger.info("upload url: {}", url);
//发送http请求 //发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils(); SignHclcUtils signHclcUtils1 = new SignHclcUtils();
...@@ -1603,12 +1686,60 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1603,12 +1686,60 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
map.put("code", "0"); map.put("code", "0");
map.put("message", "获取签署流程文档下载地址成功!"); map.put("message", "获取签署流程文档下载地址成功!");
} else { } else {
logger.error("get sign flow doc urls failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg")); logger.info("get sign flow doc urls failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
map.put("code", jsonResult.getString("errCode"));
map.put("message", "获取签署流程文档下载地址失败," + jsonResult.getString("msg"));
}
} catch (Exception e) {
logger.info("create person account failed, msg:{}", e.getMessage());
map.put("code", "000001");
map.put("message", "获取签署流程文档下载地址失败,请检查!" + e.getMessage());
}
return map;
}
public Map<String, Object> signFileDownload(IRequest requestContext, AttachmentInfo dto) {
Map<String, Object> map = new HashMap<>();
String filekey = dto.getMediaId();
//业务方交互上下文信息
String param = "fileKey=" + filekey;
//获取HMAC加密后的X-timevale-signature签名信息
AlgorithmHelper algorithmHelper = new AlgorithmHelper();
String EncryptedString = algorithmHelper.getXtimevaleSignature("", projectSecret, HASH_ALGORITHM, "UTF-8");
//设置http请求head信息
Map<String, String> headInfo = new HashMap<String, String>();
headInfo.put("x-timevale-project-id", projectId);
headInfo.put("x-timevale-signature", EncryptedString);
try {
//初始化接口信息
String url = "http://139.196.20.44:8035/v1/files/getDownloadUrl";
logger.info("download url: {}", url);
//发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.getStr(url, param, headInfo);
//解析返回结果
JSONObject jsonResult = JSONObject.parseObject(stringResult);
if ("0".equalsIgnoreCase(jsonResult.getString("errCode"))) {
JSONObject data = jsonResult.getJSONObject("data");
//设置返回accountId
map.put("downloadUrl", data.getString("downloadUrl"));
map.put("code", "0");
map.put("message", "获取签署流程文档下载地址成功!");
} else {
logger.info("get sign flow doc urls failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
map.put("code", jsonResult.getString("errCode")); map.put("code", jsonResult.getString("errCode"));
map.put("message", "获取签署流程文档下载地址失败," + jsonResult.getString("msg")); map.put("message", "获取签署流程文档下载地址失败," + jsonResult.getString("msg"));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("create person account failed, msg:{}", e.getMessage()); logger.info("create person account failed, msg:{}", e.getMessage());
map.put("code", "000001"); map.put("code", "000001");
map.put("message", "获取签署流程文档下载地址失败,请检查!" + e.getMessage()); map.put("message", "获取签署流程文档下载地址失败,请检查!" + e.getMessage());
} }
...@@ -1616,6 +1747,51 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1616,6 +1747,51 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
return map; return map;
} }
public JSONObject cancelSignFlows(IRequest requestContext, JSONObject params) {
JSONObject jsonResult = new JSONObject();
//业务方交互上下文信息
JSONObject result = new JSONObject();
//作废原因
result.put("bizNo", params.getString("bizNo"));
//业务id
result.put("reason", "");
//原签署流程id
result.put("signFlowId", params.getString("signFlowId"));
JSONObject json = new JSONObject(result);
String param = json.toString();
//获取HMAC加密后的X-timevale-signature签名信息
AlgorithmHelper algorithmHelper = new AlgorithmHelper();
String EncryptedString = algorithmHelper.getXtimevaleSignature(param, projectSecret, HASH_ALGORITHM, "UTF-8");
//设置http请求head信息
Map<String, String> headInfo = new HashMap<String, String>();
headInfo.put("x-timevale-project-id", projectId);
headInfo.put("x-timevale-signature", EncryptedString);
try {
//初始化接口信息
// String url = getApiUrl(signatureSysName, createSealsApiName);
String url = "http://139.196.20.44:8035/V1/signFlows/cancel";
logger.info("cancel sign url: {}", url);
//发送http请求
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, signHclcUtils1.APPLICATION_JSON);
//解析返回结果
jsonResult = JSONObject.parseObject(stringResult);
} catch (Exception e) {
logger.info("cancel sign flow failed, msg:{}", e.getMessage());
jsonResult.put("code", "-1");
jsonResult.put("code", "作废失败" + e.getMessage());
}
return jsonResult;
}
// public JSONObject cancelSignFlows(IRequest requestContext, JSONObject params) { // public JSONObject cancelSignFlows(IRequest requestContext, JSONObject params) {
// //
// JSONObject jsonResult = new JSONObject(); // JSONObject jsonResult = new JSONObject();
...@@ -1647,7 +1823,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1647,7 +1823,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// //
// //初始化接口信息 // //初始化接口信息
// String url = getApiUrl(signatureSysName, signFlowsApiName); // String url = getApiUrl(signatureSysName, signFlowsApiName);
// logger.debug("sign flows url: {}", url); // logger.info("sign flows url: {}", url);
// //
// signFlowsInfoHclc.setContractNo(params.getString("bizNo")); // signFlowsInfoHclc.setContractNo(params.getString("bizNo"));
// signFlowsInfoHclc.setSignAction("SIGN_CANCEL"); // signFlowsInfoHclc.setSignAction("SIGN_CANCEL");
...@@ -1664,7 +1840,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1664,7 +1840,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// jsonResult = JSONObject.parseObject(stringResult); // jsonResult = JSONObject.parseObject(stringResult);
// signFlowsInfoHclc.setResponseClob(stringResult); // signFlowsInfoHclc.setResponseClob(stringResult);
// if (!"0".equalsIgnoreCase(jsonResult.getString("errCode"))) { // if (!"0".equalsIgnoreCase(jsonResult.getString("errCode"))) {
// logger.error("create sign flows failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg")); // logger.info("create sign flows failed, errCode:{} ,msg:{}", jsonResult.getString("errCode"), jsonResult.getString("msg"));
// } else { // } else {
// //
// JSONObject data = jsonResult.getJSONObject("data"); // JSONObject data = jsonResult.getJSONObject("data");
...@@ -1698,7 +1874,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i ...@@ -1698,7 +1874,7 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
// } // }
// //
// } catch (Exception e) { // } catch (Exception e) {
// logger.error("create sign flows failed, msg:{}", e.getMessage()); // logger.info("create sign flows failed, msg:{}", e.getMessage());
// jsonResult.put("errCode", "000004"); // jsonResult.put("errCode", "000004");
// jsonResult.put("msg", "创建签署流程失败," + e.getMessage()); // jsonResult.put("msg", "创建签署流程失败," + e.getMessage());
// } // }
......
...@@ -116,10 +116,18 @@ public class SignHclcUtils { ...@@ -116,10 +116,18 @@ public class SignHclcUtils {
inStream.close(); inStream.close();
result = strber.toString(); result = strber.toString();
if (httpResponse.getStatusLine().getStatusCode() == 200) { if (!urls.contains("v2/identity/auth/api/ocr/license")) {
logger.info("请求服务器成功, urls ={},params ={} ,contentType ={} ,result ={}", urls, params.toString(), contentType, result); if (httpResponse.getStatusLine().getStatusCode() == 200) {
} else { logger.info("请求服务器成功, urls ={},params ={} ,contentType ={} ,result ={}", urls, params.toString(), contentType, result);
logger.info("请求服务端失败, urls ={},params ={} ,contentType ={} ,result ={}", urls, params.toString(), contentType, result); } else {
logger.info("请求服务端失败, urls ={},params ={} ,contentType ={} ,result ={}", urls, params.toString(), contentType, result);
}
}else{
if (httpResponse.getStatusLine().getStatusCode() == 200) {
logger.info("请求服务器成功, urls ={},contentType ={} ,result ={}", urls, contentType, result);
} else {
logger.info("请求服务端失败, urls ={},contentType ={} ,result ={}", urls, contentType, result);
}
} }
return result; return result;
......
...@@ -82,6 +82,9 @@ ...@@ -82,6 +82,9 @@
<logger name="com.hand.app.esignHclc.utils.SignHclcUtils" level="INFO" additivity="false"> <logger name="com.hand.app.esignHclc.utils.SignHclcUtils" level="INFO" additivity="false">
<appender-ref ref="REQ"/> <appender-ref ref="REQ"/>
</logger> </logger>
<logger name="com.hand.app.esignHclc.service.impl.SignInfoHclcServiceImpl" level="INFO" additivity="false">
<appender-ref ref="REQ"/>
</logger>
<logger name="com.timevale" level="INFO" additivity="false"> <logger name="com.timevale" level="INFO" additivity="false">
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment