|
@@ -613,7 +613,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
} else if (JoinpayConstant.APPROVE_STATUS_P2000.equals(approveStatus)) {
|
|
|
mch.setApproveStatus("审核不通过");
|
|
|
mch.setApproveNote(approveNote);
|
|
|
- back = approveStatus;
|
|
|
+ back = approveNote;
|
|
|
}
|
|
|
}
|
|
|
updateById(mch);
|
|
@@ -1104,6 +1104,119 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String updateMchApproveStatus(TJoinpayMch joinpayMch) {
|
|
|
+ String url = "https://www.joinpay.com/allocFunds";
|
|
|
+
|
|
|
+ JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
+ // data参数
|
|
|
+ requestData.put("alt_mch_no", joinpayMch.getAltMchNo());
|
|
|
+
|
|
|
+ JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
+ requestJson.put("method", "altmch.query");
|
|
|
+ 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());
|
|
|
+ log.info("查询商户认证结果:{}", jsonObject);
|
|
|
+ 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");
|
|
|
+ String authStatus = data.getString("auth_status");
|
|
|
+ if (JoinpayConstant.AUTH_STATUS_R4004.equals(authStatus)) {
|
|
|
+ // 认证成功
|
|
|
+ joinpayMch.setStatus("1");
|
|
|
+ result = authStatus;
|
|
|
+ } else if (JoinpayConstant.AUTH_STATUS_R4002.equals(authStatus)) {
|
|
|
+ // 认证中
|
|
|
+ joinpayMch.setStatus("0");
|
|
|
+ result = authStatus;
|
|
|
+ } else if (JoinpayConstant.AUTH_STATUS_R4003.equals(authStatus)){
|
|
|
+ // 认证失败
|
|
|
+ String bizMsg = data.getString("biz_msg");
|
|
|
+ joinpayMch.setRemarks(bizMsg);
|
|
|
+ joinpayMch.setStatus("2");
|
|
|
+ result = authStatus;
|
|
|
+ }
|
|
|
+ updateById(joinpayMch);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return respMsg;
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String updateMchSignStatus(TJoinpayMch joinpayMch) {
|
|
|
+ String url = "https://www.joinpay.com/allocFunds";
|
|
|
+
|
|
|
+ JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
+
|
|
|
+ // data参数
|
|
|
+ requestData.put("alt_mch_no", joinpayMch.getAltMchNo());
|
|
|
+
|
|
|
+ JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
+ requestJson.put("method", "altMchSign.querySignRecord");
|
|
|
+ requestJson.put("version", "1.0");
|
|
|
+ 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());
|
|
|
+ log.info("查询商户签约结果:{}", jsonObject);
|
|
|
+ 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");
|
|
|
+ String signStatus = data.getString("sign_status");
|
|
|
+ if (JoinpayConstant.APPROVE_STATUS_P1000.equals(signStatus)) {
|
|
|
+ // 签约成功
|
|
|
+ joinpayMch.setSignStatus("签约成功");
|
|
|
+ String signTrxNo = data.getString("sign_trx_no");
|
|
|
+ joinpayMch.setSignTrxNo(signTrxNo);
|
|
|
+ result = signStatus;
|
|
|
+ }
|
|
|
+ updateById(joinpayMch);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return respMsg;
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取随机字符串
|