|
@@ -534,10 +534,6 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
if (staus.equals("0")) {
|
|
|
requestJson.put("method", "altMchPics.uploadPic");
|
|
|
- // 格式为16 位随机字符串:16 位随机字符串
|
|
|
-// String aes_key1 = getRandomString(16);
|
|
|
-// String aes_key2 = getRandomString(16);
|
|
|
-// requestJson.put("aes_key", RSAUtil.encrypt(aes_key1+":"+aes_key2 , JoinpayConstant.publickey ));
|
|
|
} else {
|
|
|
requestJson.put("method", "altMchPics.modifyPic");
|
|
|
}
|
|
@@ -551,14 +547,12 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
-// logger.info("请求参数:" + requestJson);
|
|
|
String s = requestJson.toString();
|
|
|
String back = null;
|
|
|
org.json.JSONObject jsonObject;
|
|
|
try {
|
|
|
|
|
|
jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
-// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
// 判断请求是否正确,受理成功
|
|
|
if (jsonObject.has("resp_code")) {
|
|
@@ -925,6 +919,143 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String newCreateMch(TJoinpayMch joinpayMch) {
|
|
|
+ Integer altMerchantType = joinpayMch.getAltMerchantType();
|
|
|
+ String url = "https://www.joinpay.com/allocFunds";
|
|
|
+
|
|
|
+ JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
+
|
|
|
+ String loginName = "sunzee" + RandomUtil.randomNumbers(10) + "@mianhuatang.com";
|
|
|
+ joinpayMch.setLoginName(loginName);
|
|
|
+ String altMchName = joinpayMch.getBankAccountName();
|
|
|
+ joinpayMch.setAltMchName(altMchName);
|
|
|
+
|
|
|
+ // 格式为16 位随机字符串:16 位随机字符串
|
|
|
+// String aeskey1 = getRandomString(16);
|
|
|
+// String aeskey2 = getRandomString(16);
|
|
|
+
|
|
|
+ requestData.put("login_name", loginName);
|
|
|
+ requestData.put("alt_mch_name", altMchName);
|
|
|
+ requestData.put("alt_merchant_type", altMerchantType);
|
|
|
+ requestData.put("busi_contact_name", joinpayMch.getBusiContactName());
|
|
|
+ requestData.put("busi_contact_mobile_no", joinpayMch.getBusiContactMobileNo());
|
|
|
+ requestData.put("phone_no", joinpayMch.getPhoneNo());
|
|
|
+// requestData.put("legal_person", AESUtil.encrypt(joinpayMch.getLegalPerson(), aeskey1, aeskey2));
|
|
|
+// requestData.put("id_card_no", AESUtil.encrypt(joinpayMch.getIdCardNo(), aeskey1, aeskey2));
|
|
|
+ requestData.put("legal_person", joinpayMch.getLegalPerson());
|
|
|
+ requestData.put("id_card_no", joinpayMch.getIdCardNo());
|
|
|
+ requestData.put("id_card_expiry", joinpayMch.getIdCardExpiry());
|
|
|
+ // 企业必填:营业执照编号 / 营业执照有效期
|
|
|
+ if (JoinpayConstant.ALT_MERCHANT_TYPE_ENTERPRISE == altMerchantType) {
|
|
|
+ requestData.put("license_no", joinpayMch.getLicenseNo());
|
|
|
+ requestData.put("license_expiry", joinpayMch.getLicenseExpiry());
|
|
|
+ }
|
|
|
+ if (joinpayMch.getSettMode() != null) {
|
|
|
+ requestData.put("sett_mode", joinpayMch.getSettMode());
|
|
|
+ } else {
|
|
|
+ // 由汇聚自动结算
|
|
|
+ requestData.put("sett_mode", JoinpayConstant.SETT_MODE_ONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 结算周期类型:自然日
|
|
|
+ requestData.put("sett_date_type", JoinpayConstant.SETT_DATE_DAY);
|
|
|
+ if (joinpayMch.getRiskDay() != null) {
|
|
|
+ requestData.put("risk_day", joinpayMch.getRiskDay());
|
|
|
+ } else {
|
|
|
+ // 结算周期:1
|
|
|
+ requestData.put("risk_day", 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (JoinpayConstant.ALT_MERCHANT_TYPE_ENTERPRISE == altMerchantType) {
|
|
|
+ // 企业用对公账户
|
|
|
+ requestData.put("bank_account_type", JoinpayConstant.BANK_ACCOUNT_TYPE_FOUR);
|
|
|
+ requestData.put("bank_channel_no", joinpayMch.getBankChannelNo());
|
|
|
+ } else if (JoinpayConstant.ALT_MERCHANT_TYPE_PERSON == altMerchantType) {
|
|
|
+ // 个人用借记卡
|
|
|
+ requestData.put("bank_account_type", JoinpayConstant.BANK_ACCOUNT_TYPE_ONE);
|
|
|
+ }
|
|
|
+// requestData.put("bank_account_name", AESUtil.encrypt(joinpayMch.getBankAccountName(), aeskey1, aeskey2));
|
|
|
+// requestData.put("bank_account_no", AESUtil.encrypt(joinpayMch.getBankAccountNo(), aeskey1, aeskey2));
|
|
|
+ requestData.put("bank_account_name", joinpayMch.getBankAccountName());
|
|
|
+ requestData.put("bank_account_no", joinpayMch.getBankAccountNo());
|
|
|
+ requestData.put("notify_url", JoinpayConstant.MERCHANT_URL);
|
|
|
+
|
|
|
+ JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
+ requestJson.put("method", "altmch.create");
|
|
|
+ requestJson.put("version", "1.1");
|
|
|
+ requestJson.put("data", requestData);
|
|
|
+ // 32位随机字符串
|
|
|
+ String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
|
|
|
+ requestJson.put("rand_str", uuid);
|
|
|
+ requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
+ requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
+
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
+ requestJson.put("sign", sign.toUpperCase());
|
|
|
+
|
|
|
+ String result = "";
|
|
|
+ try {
|
|
|
+ org.json.JSONObject jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
+
|
|
|
+ String respCode = jsonObject.getString("resp_code");
|
|
|
+ String respMsg = jsonObject.getString("resp_msg");
|
|
|
+ joinpayMch.setRespCode(respCode);
|
|
|
+ if (JoinpayConstant.resp_code1.equals(respCode)) {
|
|
|
+ // 受理成功
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
+ org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+ if (data.has("biz_code")) {
|
|
|
+ joinpayMch.setBizCode(data.getString("biz_code"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.has("alt_mch_no")) {
|
|
|
+ joinpayMch.setAltMchNo(data.getString("alt_mch_no"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.has("order_status")) {
|
|
|
+ joinpayMch.setOrderStatus(data.getString("order_status"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return respMsg;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新一下分销商户的 各种响应码 & login_name
|
|
|
+ */
|
|
|
+// joinpayMch.setCreateDate(new Date());
|
|
|
+// joinpayMch.setModifyDate(new Date());
|
|
|
+// joinpayMch.setType("1");
|
|
|
+// if (StringUtils.isNotEmpty(joinpayMch.getAltMchNo())) {
|
|
|
+// save(joinpayMch);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (jsonObject.has("resp_code")) {
|
|
|
+// String resp_code = jsonObject.getString("resp_code");
|
|
|
+// mch.setRespCode(resp_code);
|
|
|
+// if (JoinpayConstant.resp_code2.equals(resp_code)) {
|
|
|
+// org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+// if (data.has("biz_msg")) {
|
|
|
+// return data.getString("biz_msg");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+// if (StringUtils.isNotEmpty(mch.getAltMchNo())) {
|
|
|
+// return Constant.correct_code;
|
|
|
+// } else {
|
|
|
+// return "注册失败";
|
|
|
+// }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取随机字符串
|