Merge branch 'pre' into dev

dev
胡锐 10 months ago
commit 9b91a98bdc
  1. 14
      service/src/main/java/com/hfkj/channel/tianque/service/TianQueMerService.java
  2. 48
      service/src/main/java/com/hfkj/channel/tianque/utils/RequestUtil.java

@ -225,12 +225,22 @@ public class TianQueMerService {
param.put("settlePersonIdcardOpposite", RequestUtil.requestUpload("07", new File(CommonSysConst.getSysConfig().getFile_url() + "/" + basisModel.getMerSettleAcct().getSettleIdCardNationalEmblemImg())).getString("PhotoUrl")); param.put("settlePersonIdcardOpposite", RequestUtil.requestUpload("07", new File(CommonSysConst.getSysConfig().getFile_url() + "/" + basisModel.getMerSettleAcct().getSettleIdCardNationalEmblemImg())).getString("PhotoUrl"));
param.put("bankCardPositivePic", RequestUtil.requestUpload("05", new File(CommonSysConst.getSysConfig().getFile_url() + "/" + basisModel.getMerSettleAcct().getBankCardImg())).getString("PhotoUrl")); param.put("bankCardPositivePic", RequestUtil.requestUpload("05", new File(CommonSysConst.getSysConfig().getFile_url() + "/" + basisModel.getMerSettleAcct().getBankCardImg())).getString("PhotoUrl"));
} }
if (basisModel.getMerSettleAcct().getSettleType().equals(MerSettleType.status3.getNumber())) { if (basisModel.getMerSettleAcct().getSettleType().equals(MerSettleType.status3.getNumber
())) {
param.put("letterOfAuthPic", RequestUtil.requestUpload("26", new File(CommonSysConst.getSysConfig().getFile_url() + "/" + basisModel.getMerSettleAcct().getCommissionImg())).getString("PhotoUrl")); param.put("letterOfAuthPic", RequestUtil.requestUpload("26", new File(CommonSysConst.getSysConfig().getFile_url() + "/" + basisModel.getMerSettleAcct().getCommissionImg())).getString("PhotoUrl"));
} }
/********* 图片信息 ***********/ /********* 图片信息 ***********/
JSONObject response = RequestUtil.request(TianQueConfig.requestUrl + "/merchant/income", param); // Todo 临时判断
JSONObject response;
if (basisModel.getOrgNo().equals("22206482")) {
// 惠付科技
response = RequestUtil.request(TianQueConfig.requestUrl + "/merchant/income", param);
} else {
// 其他机构
response = RequestUtil.request(basisModel.getOrgNo(), TianQueConfig.requestUrl + "/merchant/income", param);
}
reqStr = JSONObject.toJSONString(param); reqStr = JSONObject.toJSONString(param);
resStr = response.toJSONString(); resStr = response.toJSONString();
if (!"0000".equals(response.getString("bizCode"))) { if (!"0000".equals(response.getString("bizCode"))) {

@ -55,6 +55,54 @@ public class RequestUtil {
return response.getJSONObject("respData"); return response.getJSONObject("respData");
} }
public static JSONObject request(String orgId,String url,Map<String,Object> reqData) {
Map<String,Object> header = new HashMap<>();
header.put("Content-Type", "application/json");
TreeMap<String,Object> treeMap = new TreeMap();
treeMap.putAll(reqData);
Map<String,Object> param = new LinkedHashMap<>();
param.put("orgId", orgId);
param.put("reqData", JSONObject.toJSON(reqData));
param.put("reqId", IdentifyUtil.getGuid());
param.put("signType", "RSA");
param.put("timestamp", DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
param.put("version", "1.0");
param.put("sign", RSASignature.encryptBASE64(RSASignature.sign(RSASignature.getContent(param), TianQueConfig.priKey)));
JSONObject response = HttpsUtils.doPost(url, param, header);
System.out.println("请求参数:" + JSONObject.toJSONString(param));
System.out.println("响应参数:" + response);
if (response != null && !"0000".equals(response.getString("code"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("msg"));
}
// 验证签名
String resSign = response.getString("sign");
response.remove("sign");
if (!RSASignature.doCheck(RSASignature.getContent(JSONObject.toJavaObject(response, Map.class)), resSign, TianQueConfig.pubKey)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "响应参数签名失败");
}
return response.getJSONObject("respData");
}
/**
* 文件上传请求
* @param file
* @return
*/
public static JSONObject requestUpload(String orgId,String pictureType,File file) {
Map<String,Object> param = new HashMap<>();
param.put("orgId", orgId);
param.put("reqId", IdentifyUtil.Guid);
param.put("pictureType", pictureType);
JSONObject response = HttpsUtils.doPostUpload(TianQueConfig.requestUrl + "/merchant/uploadPicture", file, param);
if (response != null && !"0000".equals(response.getString("code"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("msg"));
}
return response.getJSONObject("respData");
}
/** /**
* 文件上传请求 * 文件上传请求
* @param file * @param file

Loading…
Cancel
Save