|
@@ -12,6 +12,7 @@ import com.szwl.model.utils.HttpClientUtils;
|
|
|
import com.szwl.model.utils.RSAUtil;
|
|
|
import com.szwl.service.TJoinpayMchService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
@@ -35,6 +36,7 @@ import java.util.*;
|
|
|
* @author wuhs
|
|
|
* @since 2022-04-29
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoinpayMch> implements TJoinpayMchService {
|
|
|
@Autowired
|
|
@@ -45,7 +47,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
|
|
|
Long adminId = mch.getAdminId();
|
|
|
- if(null == adminId){
|
|
|
+ if (null == adminId) {
|
|
|
return "找不到对应的管理员";
|
|
|
}
|
|
|
|
|
@@ -67,48 +69,47 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
requestData.put("login_name", login_name);
|
|
|
requestData.put("alt_mch_name", alt_mch_name);
|
|
|
- requestData.put("alt_mch_short_name", "");
|
|
|
- requestData.put("alt_merchant_type", mch.getAltMerchantType());
|
|
|
- requestData.put("busi_contact_name", mch.getBusiContactName());
|
|
|
- requestData.put("busi_contact_mobile_no", mch.getBusiContactMobileNo());
|
|
|
- requestData.put("phone_no", mch.getPhoneNo());
|
|
|
- requestData.put("manage_scope", mch.getManageScope());
|
|
|
- requestData.put("manage_addr", mch.getManageAddr());
|
|
|
- requestData.put("legal_person", AESUtil.encrypt(mch.getLegalPerson() , aes_key1 , aes_key2 ));
|
|
|
- requestData.put("id_card_no", AESUtil.encrypt(mch.getIdCardNo(), aes_key1 , aes_key2 ));
|
|
|
- requestData.put("id_card_expiry", mch.getIdCardExpiry());
|
|
|
+ requestData.put("alt_mch_short_name", "");
|
|
|
+ requestData.put("alt_merchant_type", mch.getAltMerchantType());
|
|
|
+ requestData.put("busi_contact_name", mch.getBusiContactName());
|
|
|
+ requestData.put("busi_contact_mobile_no", mch.getBusiContactMobileNo());
|
|
|
+ requestData.put("phone_no", mch.getPhoneNo());
|
|
|
+ requestData.put("manage_scope", mch.getManageScope());
|
|
|
+ requestData.put("manage_addr", mch.getManageAddr());
|
|
|
+ requestData.put("legal_person", AESUtil.encrypt(mch.getLegalPerson(), aes_key1, aes_key2));
|
|
|
+ requestData.put("id_card_no", AESUtil.encrypt(mch.getIdCardNo(), aes_key1, aes_key2));
|
|
|
+ requestData.put("id_card_expiry", mch.getIdCardExpiry());
|
|
|
// 个体工商户和企业必填:营业执照编号 / 营业执照有效期
|
|
|
- if(JoinpayConstant.alt_merchant_type2== alt_merchant_type || JoinpayConstant.alt_merchant_type3== alt_merchant_type){
|
|
|
- requestData.put("license_no", mch.getLicenseNo());
|
|
|
- requestData.put("license_expiry", mch.getLicenseExpiry());
|
|
|
+ if (JoinpayConstant.alt_merchant_type2 == alt_merchant_type || JoinpayConstant.alt_merchant_type3 == alt_merchant_type) {
|
|
|
+ requestData.put("license_no", mch.getLicenseNo());
|
|
|
+ requestData.put("license_expiry", mch.getLicenseExpiry());
|
|
|
}
|
|
|
- if(mch.getSettMode()!=null){
|
|
|
- requestData.put("sett_mode", mch.getSettMode());
|
|
|
- }else {
|
|
|
+ if (mch.getSettMode() != null) {
|
|
|
+ requestData.put("sett_mode", mch.getSettMode());
|
|
|
+ } else {
|
|
|
// 由汇聚自动结算
|
|
|
- requestData.put("sett_mode", JoinpayConstant.sett_mode1);
|
|
|
+ requestData.put("sett_mode", JoinpayConstant.sett_mode1);
|
|
|
}
|
|
|
|
|
|
// 结算周期类型:自然日
|
|
|
- requestData.put("sett_date_type", JoinpayConstant.sett_date_type2);
|
|
|
- if(mch.getRiskDay()!=null){
|
|
|
+ requestData.put("sett_date_type", JoinpayConstant.sett_date_type2);
|
|
|
+ if (mch.getRiskDay() != null) {
|
|
|
requestData.put("risk_day", mch.getRiskDay());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 结算周期:1
|
|
|
- requestData.put("risk_day", 1);
|
|
|
+ requestData.put("risk_day", 1);
|
|
|
}
|
|
|
|
|
|
- if(JoinpayConstant.alt_merchant_type2== alt_merchant_type || JoinpayConstant.alt_merchant_type3== alt_merchant_type){
|
|
|
+ if (JoinpayConstant.alt_merchant_type2 == alt_merchant_type || JoinpayConstant.alt_merchant_type3 == alt_merchant_type) {
|
|
|
// 企业用对公账户
|
|
|
- requestData.put("bank_account_type", JoinpayConstant.bank_account_type4);
|
|
|
- }else if(JoinpayConstant.alt_merchant_type1== alt_merchant_type){
|
|
|
+ requestData.put("bank_account_type", JoinpayConstant.bank_account_type4);
|
|
|
+ } else if (JoinpayConstant.alt_merchant_type1 == alt_merchant_type) {
|
|
|
// 个人用借记卡
|
|
|
- requestData.put("bank_account_type", JoinpayConstant.bank_account_type1);
|
|
|
+ requestData.put("bank_account_type", JoinpayConstant.bank_account_type1);
|
|
|
}
|
|
|
- requestData.put("bank_account_name", AESUtil.encrypt(mch.getBankAccountName(), aes_key1 , aes_key2 ));
|
|
|
- requestData.put("bank_account_no", AESUtil.encrypt(mch.getBankAccountNo(), aes_key1 , aes_key2 ));
|
|
|
- requestData.put("bank_channel_no", mch.getBankChannelNo());
|
|
|
-
|
|
|
+ requestData.put("bank_account_name", AESUtil.encrypt(mch.getBankAccountName(), aes_key1, aes_key2));
|
|
|
+ requestData.put("bank_account_no", AESUtil.encrypt(mch.getBankAccountNo(), aes_key1, aes_key2));
|
|
|
+ requestData.put("bank_channel_no", mch.getBankChannelNo());
|
|
|
|
|
|
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
@@ -121,10 +122,10 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
|
|
|
- requestJson.put("aes_key", RSAUtil.encrypt(aes_key1+":"+aes_key2 , JoinpayConstant.publickey ));
|
|
|
+ requestJson.put("aes_key", RSAUtil.encrypt(aes_key1 + ":" + aes_key2, JoinpayConstant.publickey));
|
|
|
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
|
|
@@ -133,21 +134,21 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
mch.setRespCode(jsonObject.getString("resp_code"));
|
|
|
}
|
|
|
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_code")){
|
|
|
+ if (data.has("biz_code")) {
|
|
|
mch.setBizCode(data.getString("biz_code"));
|
|
|
}
|
|
|
|
|
|
- if (data.has("alt_mch_no")){
|
|
|
+ if (data.has("alt_mch_no")) {
|
|
|
mch.setAltMchNo(data.getString("alt_mch_no"));
|
|
|
}
|
|
|
|
|
|
- if(data.has("order_status")){
|
|
|
+ if (data.has("order_status")) {
|
|
|
mch.setOrderStatus(data.getString("order_status"));
|
|
|
}
|
|
|
|
|
@@ -160,17 +161,17 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
mch.setCreateDate(new Date());
|
|
|
mch.setModifyDate(new Date());
|
|
|
mch.setType("1");
|
|
|
- if(StringUtils.isNotEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isNotEmpty(mch.getAltMchNo())) {
|
|
|
save(mch);
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- if(JoinpayConstant.resp_code2.equals(resp_code)){
|
|
|
+ if (JoinpayConstant.resp_code2.equals(resp_code)) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_msg")){
|
|
|
+ if (data.has("biz_msg")) {
|
|
|
return data.getString("biz_msg");
|
|
|
}
|
|
|
}
|
|
@@ -179,9 +180,9 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isNotEmpty(mch.getAltMchNo())) {
|
|
|
return Constant.correct_code;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return "注册失败";
|
|
|
}
|
|
|
|
|
@@ -190,13 +191,13 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
@Override
|
|
|
public String updateMch(TJoinpayMch mch) {
|
|
|
Long adminId = mch.getAdminId();
|
|
|
- if(null == adminId){
|
|
|
+ if (null == adminId) {
|
|
|
return "找不到对应的管理员";
|
|
|
}
|
|
|
|
|
|
- if(JoinpayConstant.alt_merchant_type1!=mch.getAltMerchantType()
|
|
|
- && JoinpayConstant.alt_merchant_type2!= mch.getAltMerchantType()
|
|
|
- && JoinpayConstant.alt_merchant_type3!= mch.getAltMerchantType()){
|
|
|
+ if (JoinpayConstant.alt_merchant_type1 != mch.getAltMerchantType()
|
|
|
+ && JoinpayConstant.alt_merchant_type2 != mch.getAltMerchantType()
|
|
|
+ && JoinpayConstant.alt_merchant_type3 != mch.getAltMerchantType()) {
|
|
|
return "商家类型不正确";
|
|
|
}
|
|
|
|
|
@@ -210,10 +211,10 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
String aes_key2 = getRandomString(16);
|
|
|
|
|
|
requestData.put("alt_mch_no", mch.getAltMchNo());
|
|
|
- if(StringUtils.isNotEmpty(mch.getApproveStatus())) {
|
|
|
- if(!mch.getApproveStatus().equals("审核通过")){
|
|
|
+ if (StringUtils.isNotEmpty(mch.getApproveStatus())) {
|
|
|
+ if (!mch.getApproveStatus().equals("审核通过")) {
|
|
|
requestData.put("legal_person", mch.getLegalPerson());
|
|
|
- requestData.put("id_card_no", mch.getIdCardNo());
|
|
|
+ requestData.put("id_card_no", mch.getIdCardNo());
|
|
|
}
|
|
|
}
|
|
|
// requestData.put("legal_person", AESUtil.encrypt(legal_person, aes_key1 , aes_key2 ));
|
|
@@ -221,43 +222,43 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
// requestData.put("id_card_no", AESUtil.encrypt(id_card_no, aes_key1 , aes_key2 ));
|
|
|
// requestData.put("id_card_no", mch.getIdCardNo());
|
|
|
|
|
|
- if(JoinpayConstant.alt_merchant_type2== mch.getAltMerchantType() || JoinpayConstant.alt_merchant_type3== mch.getAltMerchantType()){
|
|
|
+ if (JoinpayConstant.alt_merchant_type2 == mch.getAltMerchantType() || JoinpayConstant.alt_merchant_type3 == mch.getAltMerchantType()) {
|
|
|
// 企业用对公账户
|
|
|
- requestData.put("bank_account_type", JoinpayConstant.bank_account_type4);
|
|
|
+ requestData.put("bank_account_type", JoinpayConstant.bank_account_type4);
|
|
|
mch.setBankAccountType(JoinpayConstant.bank_account_type4);
|
|
|
String alt_mch_name = mch.getBankAccountName();
|
|
|
- if(StringUtils.isNotEmpty(mch.getApproveStatus()) && !mch.getApproveStatus().equals("审核通过")){
|
|
|
+ if (StringUtils.isNotEmpty(mch.getApproveStatus()) && !mch.getApproveStatus().equals("审核通过")) {
|
|
|
requestData.put("alt_mch_name", alt_mch_name);
|
|
|
- requestData.put("license_no", mch.getLicenseNo());
|
|
|
+ requestData.put("license_no", mch.getLicenseNo());
|
|
|
}
|
|
|
// requestData.put("alt_mch_name", AESUtil.encrypt(alt_mch_name, aes_key1 , aes_key2 ));/**/
|
|
|
|
|
|
- }else if(JoinpayConstant.alt_merchant_type1== mch.getAltMerchantType()){
|
|
|
+ } else if (JoinpayConstant.alt_merchant_type1 == mch.getAltMerchantType()) {
|
|
|
// 个人用借记卡
|
|
|
- requestData.put("bank_account_type", JoinpayConstant.bank_account_type1);
|
|
|
+ requestData.put("bank_account_type", JoinpayConstant.bank_account_type1);
|
|
|
mch.setBankAccountType(JoinpayConstant.bank_account_type1);
|
|
|
}
|
|
|
|
|
|
- requestData.put("bank_account_name", mch.getBankAccountName());
|
|
|
+ requestData.put("bank_account_name", mch.getBankAccountName());
|
|
|
// requestData.put("bank_account_name", AESUtil.encrypt(bank_account_name, aes_key1 , aes_key2 ));
|
|
|
- requestData.put("bank_account_no", mch.getBankAccountNo());
|
|
|
+ requestData.put("bank_account_no", mch.getBankAccountNo());
|
|
|
// requestData.put("bank_account_no", AESUtil.encrypt(bank_account_no, aes_key1 , aes_key2 ));
|
|
|
// requestData.put("bank_channel_no", AESUtil.encrypt(bank_channel_no, aes_key1 , aes_key2 ));
|
|
|
- requestData.put("bank_channel_no", mch.getBankChannelNo());
|
|
|
- if(mch.getSettMode()!=null){
|
|
|
- requestData.put("sett_mode", mch.getSettMode());
|
|
|
- }else {
|
|
|
+ requestData.put("bank_channel_no", mch.getBankChannelNo());
|
|
|
+ if (mch.getSettMode() != null) {
|
|
|
+ requestData.put("sett_mode", mch.getSettMode());
|
|
|
+ } else {
|
|
|
// 由汇聚自动结算
|
|
|
- requestData.put("sett_mode", JoinpayConstant.sett_mode1);
|
|
|
+ requestData.put("sett_mode", JoinpayConstant.sett_mode1);
|
|
|
}
|
|
|
|
|
|
// 结算周期类型:自然日
|
|
|
- requestData.put("sett_date_type", JoinpayConstant.sett_date_type2);
|
|
|
- if(mch.getRiskDay()!=null){
|
|
|
+ requestData.put("sett_date_type", JoinpayConstant.sett_date_type2);
|
|
|
+ if (mch.getRiskDay() != null) {
|
|
|
requestData.put("risk_day", mch.getRiskDay());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 结算周期:1
|
|
|
- requestData.put("risk_day", 1);
|
|
|
+ requestData.put("risk_day", 1);
|
|
|
}
|
|
|
// mch.setLegal_person(legal_person);
|
|
|
// mch.setId_card_no(id_card_no);
|
|
@@ -265,7 +266,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
// mch.setBank_account_name(bank_account_name);
|
|
|
// mch.setBank_account_no(bank_account_no);
|
|
|
// mch.setBank_channel_no(bank_channel_no);
|
|
|
- if(mch.getAltMerchantType()==12){
|
|
|
+ if (mch.getAltMerchantType() == 12) {
|
|
|
String alt_mch_name = mch.getBankAccountName();
|
|
|
// mch.setAlt_mch_name(alt_mch_name);
|
|
|
}
|
|
@@ -279,9 +280,9 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
- requestJson.put("aes_key", RSAUtil.encrypt(aes_key1+":"+aes_key2 , JoinpayConstant.publickey ));
|
|
|
+ requestJson.put("aes_key", RSAUtil.encrypt(aes_key1 + ":" + aes_key2, JoinpayConstant.publickey));
|
|
|
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
|
|
@@ -290,32 +291,32 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
mch.setRespCode(jsonObject.getString("resp_code"));
|
|
|
}
|
|
|
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_code")){
|
|
|
+ if (data.has("biz_code")) {
|
|
|
mch.setBizCode(data.getString("biz_code"));
|
|
|
}
|
|
|
|
|
|
- if (data.has("alt_mch_no")){
|
|
|
+ if (data.has("alt_mch_no")) {
|
|
|
mch.setAltMchNo(data.getString("alt_mch_no"));
|
|
|
}
|
|
|
|
|
|
- if(data.has("order_status")){
|
|
|
+ if (data.has("order_status")) {
|
|
|
mch.setOrderStatus(data.getString("order_status"));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- if(JoinpayConstant.resp_code2.equals(resp_code)){
|
|
|
+ if (JoinpayConstant.resp_code2.equals(resp_code)) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_msg")){
|
|
|
+ if (data.has("biz_msg")) {
|
|
|
return data.getString("biz_msg");
|
|
|
}
|
|
|
}
|
|
@@ -336,7 +337,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
String url = "https://www.joinpay.com/allocFunds";
|
|
|
|
|
|
- if(StringUtils.isEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isEmpty(mch.getAltMchNo())) {
|
|
|
return "找不到商家编号";
|
|
|
}
|
|
|
Date currentTime = new Date();
|
|
@@ -344,9 +345,9 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
String dateString = formatter.format(currentTime);
|
|
|
|
|
|
JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
- requestData.put("alt_mch_no" , mch.getAltMchNo());
|
|
|
- requestData.put("sign_status" , "P1000");
|
|
|
- requestData.put("sign_time" , dateString);
|
|
|
+ requestData.put("alt_mch_no", mch.getAltMchNo());
|
|
|
+ requestData.put("sign_status", "P1000");
|
|
|
+ requestData.put("sign_time", dateString);
|
|
|
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
requestJson.put("method", "altMchSign.sign");
|
|
@@ -358,10 +359,10 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
- String back=null;
|
|
|
+ String back = null;
|
|
|
org.json.JSONObject jsonObject;
|
|
|
try {
|
|
|
|
|
@@ -369,33 +370,33 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
// 判断请求是否正确,受理成功
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- if(JoinpayConstant.resp_code2.equals(resp_code)){
|
|
|
+ if (JoinpayConstant.resp_code2.equals(resp_code)) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_msg")){
|
|
|
+ if (data.has("biz_msg")) {
|
|
|
return data.getString("biz_msg");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return JoinpayConstant.resp_code.get(resp_code);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return "请求失败";
|
|
|
}
|
|
|
|
|
|
|
|
|
// 处理data
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
String biz_code = data.getString("biz_code");
|
|
|
- if(biz_code.equals("B100000")){
|
|
|
+ if (biz_code.equals("B100000")) {
|
|
|
String sign_trx_no = data.getString("sign_trx_no");
|
|
|
String sign_status = data.getString("sign_status");
|
|
|
- if(sign_status.equals("P1000")){
|
|
|
- sign_status="签约成功";
|
|
|
- }else {
|
|
|
- sign_status="签约失败";
|
|
|
+ if (sign_status.equals("P1000")) {
|
|
|
+ sign_status = "签约成功";
|
|
|
+ } else {
|
|
|
+ sign_status = "签约失败";
|
|
|
}
|
|
|
mch.setSignStatus(sign_status);
|
|
|
mch.setSignTrxNo(sign_trx_no);
|
|
@@ -414,16 +415,17 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
/**
|
|
|
* 传送身份证图片
|
|
|
+ *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public String sendCard(TJoinpayMch mch,String cardPositive,String cardNegative,String staus) {
|
|
|
+ public String sendCard(TJoinpayMch mch, String cardPositive, String cardNegative, String staus) {
|
|
|
|
|
|
// String url = "https://www.joinpay.com/allocFunds";
|
|
|
String url = "https://upload.joinpay.com/allocFunds";
|
|
|
|
|
|
- if(StringUtils.isEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isEmpty(mch.getAltMchNo())) {
|
|
|
return "找不到商家编号";
|
|
|
}
|
|
|
// String card_positive = ImageToBase64ByLocal(cardPositive);
|
|
@@ -432,14 +434,14 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
String card_negative = cardNegative;
|
|
|
|
|
|
JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
- requestData.put("alt_mch_no" , mch.getAltMchNo());
|
|
|
- requestData.put("card_positive" , card_positive);
|
|
|
- requestData.put("card_negative" , card_negative);
|
|
|
+ requestData.put("alt_mch_no", mch.getAltMchNo());
|
|
|
+ requestData.put("card_positive", card_positive);
|
|
|
+ requestData.put("card_negative", card_negative);
|
|
|
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
- if(staus.equals("0")){
|
|
|
+ if (staus.equals("0")) {
|
|
|
requestJson.put("method", "altMchPics.uploadPic");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
requestJson.put("method", "altMchPics.modifyPic");
|
|
|
}
|
|
|
requestJson.put("version", "1.0");
|
|
@@ -450,10 +452,10 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
- String back=null;
|
|
|
+ String back = null;
|
|
|
org.json.JSONObject jsonObject;
|
|
|
try {
|
|
|
|
|
@@ -461,31 +463,31 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
// 判断请求是否正确,受理成功
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return "请求失败";
|
|
|
}
|
|
|
// 处理data
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
String biz_code = data.getString("biz_code");
|
|
|
- if(biz_code.equals("B100000")){
|
|
|
+ if (biz_code.equals("B100000")) {
|
|
|
String approve_status = "审核中";
|
|
|
mch.setApproveStatus(approve_status);
|
|
|
mch.setApproveNote("");
|
|
|
mch.setStep("1");
|
|
|
back = approve_status;
|
|
|
}
|
|
|
- if(biz_code.equals("B100002")){
|
|
|
+ if (biz_code.equals("B100002")) {
|
|
|
String approve_status = "上传失败";
|
|
|
String approve_note = data.getString("biz_msg");
|
|
|
mch.setApproveNote(approve_note);
|
|
|
mch.setApproveStatus(approve_status);
|
|
|
back = approve_status;
|
|
|
}
|
|
|
- if(biz_code.equals("B101017")){
|
|
|
+ if (biz_code.equals("B101017")) {
|
|
|
String approve_status = "上传失败";
|
|
|
String approve_note = data.getString("biz_msg");
|
|
|
mch.setApproveNote(approve_note);
|
|
@@ -494,7 +496,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
}
|
|
|
String approve_note = data.getString("biz_msg");
|
|
|
mch.setApproveNote(approve_note);
|
|
|
- if(StringUtils.isEmpty(back)){
|
|
|
+ if (StringUtils.isEmpty(back)) {
|
|
|
back = approve_note;
|
|
|
}
|
|
|
updateById(mch);
|
|
@@ -506,18 +508,20 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
return back;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 传送身份证图片
|
|
|
+ *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public String sendCardBusiness(TJoinpayMch mch, String cardPositive, String cardNegative, String tradeLicence, String openAccountLicence,String staus) {
|
|
|
+ public String sendCardBusiness(TJoinpayMch mch, String cardPositive, String cardNegative, String tradeLicence, String openAccountLicence, String staus) {
|
|
|
|
|
|
// String url = "https://www.joinpay.com/allocFunds";
|
|
|
String url = "https://upload.joinpay.com/allocFunds";
|
|
|
|
|
|
- if(StringUtils.isEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isEmpty(mch.getAltMchNo())) {
|
|
|
return "找不到商家编号";
|
|
|
}
|
|
|
// String card_positive = ImageToBase64ByLocal(cardPositive);
|
|
@@ -528,20 +532,20 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
String open_account_licence = openAccountLicence;
|
|
|
|
|
|
JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
- requestData.put("alt_mch_no" , mch.getAltMchNo());
|
|
|
- requestData.put("card_positive" , card_positive);
|
|
|
- requestData.put("card_negative" , card_negative);
|
|
|
- requestData.put("trade_licence" , trade_licence);
|
|
|
- requestData.put("open_account_licence" , open_account_licence);
|
|
|
+ requestData.put("alt_mch_no", mch.getAltMchNo());
|
|
|
+ requestData.put("card_positive", card_positive);
|
|
|
+ requestData.put("card_negative", card_negative);
|
|
|
+ requestData.put("trade_licence", trade_licence);
|
|
|
+ requestData.put("open_account_licence", open_account_licence);
|
|
|
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
- if(staus.equals("0")){
|
|
|
+ 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{
|
|
|
+ } else {
|
|
|
requestJson.put("method", "altMchPics.modifyPic");
|
|
|
}
|
|
|
requestJson.put("version", "1.0");
|
|
@@ -552,11 +556,11 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
String s = requestJson.toString();
|
|
|
- String back=null;
|
|
|
+ String back = null;
|
|
|
org.json.JSONObject jsonObject;
|
|
|
try {
|
|
|
|
|
@@ -564,31 +568,31 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
// 判断请求是否正确,受理成功
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return "请求失败";
|
|
|
}
|
|
|
// 处理data
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
String biz_code = data.getString("biz_code");
|
|
|
- if(biz_code.equals("B100000")){
|
|
|
+ if (biz_code.equals("B100000")) {
|
|
|
String approve_status = "审核中";
|
|
|
mch.setApproveStatus(approve_status);
|
|
|
mch.setApproveNote("");
|
|
|
back = approve_status;
|
|
|
mch.setStep("1");
|
|
|
}
|
|
|
- if(biz_code.equals("B100002")){
|
|
|
+ if (biz_code.equals("B100002")) {
|
|
|
String approve_status = "上传失败";
|
|
|
String approve_note = data.getString("biz_msg");
|
|
|
mch.setApproveNote(approve_note);
|
|
|
mch.setApproveStatus(approve_status);
|
|
|
back = approve_status;
|
|
|
}
|
|
|
- if(biz_code.equals("B101017")){
|
|
|
+ if (biz_code.equals("B101017")) {
|
|
|
String approve_status = "上传失败";
|
|
|
String approve_note = data.getString("biz_msg");
|
|
|
mch.setApproveNote(approve_note);
|
|
@@ -610,12 +614,12 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
String url = "https://www.joinpay.com/allocFunds";
|
|
|
|
|
|
- if(StringUtils.isEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isEmpty(mch.getAltMchNo())) {
|
|
|
return "找不到商家编号";
|
|
|
}
|
|
|
|
|
|
JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
- requestData.put("alt_mch_no" , mch.getAltMchNo());
|
|
|
+ requestData.put("alt_mch_no", mch.getAltMchNo());
|
|
|
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
requestJson.put("method", "altMchPics.queryPicsInfo");
|
|
@@ -627,34 +631,34 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
- String back=null;
|
|
|
+ String back = null;
|
|
|
org.json.JSONObject jsonObject;
|
|
|
try {
|
|
|
jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
System.out.println(jsonObject.getJSONObject("data"));
|
|
|
|
|
|
// 判断请求是否正确,受理成功
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return "请求失败";
|
|
|
}
|
|
|
// 处理data
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
String biz_code = data.getString("biz_code");
|
|
|
String approve_status = data.getString("approve_status");
|
|
|
String approve_note = data.getString("approve_note");
|
|
|
- if(biz_code.equals("B100000")){
|
|
|
- if(approve_status.equals("P1000")) {
|
|
|
+ if (biz_code.equals("B100000")) {
|
|
|
+ if (approve_status.equals("P1000")) {
|
|
|
mch.setApproveStatus("审核通过");
|
|
|
mch.setApproveNote("");
|
|
|
back = approve_status;
|
|
|
- } else if (approve_status.equals("P2000")){
|
|
|
+ } else if (approve_status.equals("P2000")) {
|
|
|
mch.setApproveStatus("审核不通过");
|
|
|
mch.setApproveNote(approve_note);
|
|
|
back = approve_status;
|
|
@@ -673,33 +677,36 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
|
|
|
/**
|
|
|
* 获取随机字符串
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public static String getRandomString(int length){
|
|
|
- String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
|
- Random random=new Random();
|
|
|
- StringBuffer sb=new StringBuffer();
|
|
|
- for(int i=0;i<length;i++){
|
|
|
- int number=random.nextInt(62);
|
|
|
+ public static String getRandomString(int length) {
|
|
|
+ String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
|
+ Random random = new Random();
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
+ int number = random.nextInt(62);
|
|
|
sb.append(str.charAt(number));
|
|
|
}
|
|
|
return sb.toString();
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 签名算法sign , MD5 签名
|
|
|
+ *
|
|
|
* @param requestJson
|
|
|
* @return
|
|
|
*/
|
|
|
- public static String createMD5Sign(JSONObject requestJson , String key){
|
|
|
+ public static String createMD5Sign(JSONObject requestJson, String key) {
|
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
Set es = requestJson.entrySet();
|
|
|
Iterator it = es.iterator();
|
|
|
- while(it.hasNext()) {
|
|
|
- Map.Entry entry = (Map.Entry)it.next();
|
|
|
- String k = (String)entry.getKey();
|
|
|
+ while (it.hasNext()) {
|
|
|
+ Map.Entry entry = (Map.Entry) it.next();
|
|
|
+ String k = (String) entry.getKey();
|
|
|
Object v = entry.getValue();
|
|
|
- if(null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k)) {
|
|
|
+ if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k)) {
|
|
|
sb.append(k + "=" + v + "&");
|
|
|
}
|
|
|
}
|
|
@@ -711,7 +718,6 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public String uniPay(String sn, BigDecimal amount, String productName, String productDesc, String commonParameter,
|
|
|
String returnUrl, String notifyUrl, String frpCode, String isShowPic, String openId, String authCode,
|
|
@@ -724,7 +730,6 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
List<BasicNameValuePair> data = new ArrayList<BasicNameValuePair>();
|
|
|
|
|
|
|
|
|
-
|
|
|
data.add(new BasicNameValuePair("p0_Version", JoinpayConstant.pay_version));
|
|
|
data.add(new BasicNameValuePair("p1_MerchantNo", JoinpayConstant.mch_no));
|
|
|
data.add(new BasicNameValuePair("p2_OrderNo", sn));
|
|
@@ -743,17 +748,17 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
data.add(new BasicNameValuePair("q7_AppId", appid));
|
|
|
data.add(new BasicNameValuePair("q8_TerminalNo", ""));
|
|
|
data.add(new BasicNameValuePair("q9_TransactionModel", transactionModel));
|
|
|
- if(!StringUtils.isEmpty(tradeMerchantNo)){
|
|
|
- data.add(new BasicNameValuePair("qa_TradeMerchantNo",tradeMerchantNo));
|
|
|
+ if (!StringUtils.isEmpty(tradeMerchantNo)) {
|
|
|
+ data.add(new BasicNameValuePair("qa_TradeMerchantNo", tradeMerchantNo));
|
|
|
}
|
|
|
// data.add(new BasicNameValuePair("qa_TradeMerchantNo", tradeMerchantNo));
|
|
|
data.add(new BasicNameValuePair("qb_buyerId", buyerId));
|
|
|
data.add(new BasicNameValuePair("qc_IsAlt", isAlt));
|
|
|
data.add(new BasicNameValuePair("qd_AltType", altType));
|
|
|
- data.add(new BasicNameValuePair("qe_AltInfo", altInfo==null?null:altInfo.toString()));
|
|
|
+ data.add(new BasicNameValuePair("qe_AltInfo", altInfo == null ? null : altInfo.toString()));
|
|
|
data.add(new BasicNameValuePair("qf_AltUrl", altUrl));
|
|
|
|
|
|
- data.add(new BasicNameValuePair("qg_MarketingAmount", marketingAmount==null?null:marketingAmount.setScale(2, RoundingMode.HALF_DOWN).toString()));
|
|
|
+ data.add(new BasicNameValuePair("qg_MarketingAmount", marketingAmount == null ? null : marketingAmount.setScale(2, RoundingMode.HALF_DOWN).toString()));
|
|
|
|
|
|
// TODO: 2019-04-01 空值不参与签名!!!!!!!!!!!!!!!!!!
|
|
|
|
|
@@ -773,7 +778,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
public String refreshMch(TJoinpayMch mch) {
|
|
|
|
|
|
String login_name = mch.getLoginName();
|
|
|
- if(StringUtils.isEmpty(login_name)){
|
|
|
+ if (StringUtils.isEmpty(login_name)) {
|
|
|
return "账户不存在";
|
|
|
}
|
|
|
|
|
@@ -793,7 +798,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
|
|
@@ -805,11 +810,11 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
mch.setRespCode(jsonObject.getString("resp_code"));
|
|
|
}
|
|
|
|
|
|
- if(jsonObject.has("data")) {
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
if (data.has("biz_code")) {
|
|
|
mch.setBizCode(data.getString("biz_code"));
|
|
@@ -828,25 +833,23 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
// 判断请求是否正确,受理成功
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- if(JoinpayConstant.resp_code2.equals(resp_code)){
|
|
|
+ if (JoinpayConstant.resp_code2.equals(resp_code)) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_msg")){
|
|
|
+ if (data.has("biz_msg")) {
|
|
|
return data.getString("biz_msg");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return JoinpayConstant.resp_code.get(resp_code);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return "请求失败";
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -860,12 +863,12 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
public String refreshMyAccount(TJoinpayMch mch) {
|
|
|
String url = "https://www.joinpay.com/allocFunds";
|
|
|
|
|
|
- if(StringUtils.isEmpty(mch.getAltMchNo())){
|
|
|
+ if (StringUtils.isEmpty(mch.getAltMchNo())) {
|
|
|
return "找不到商家编号";
|
|
|
}
|
|
|
|
|
|
JSONObject requestData = new JSONObject(new LinkedHashMap());
|
|
|
- requestData.put("alt_mch_no" , mch.getAltMchNo());
|
|
|
+ requestData.put("alt_mch_no", mch.getAltMchNo());
|
|
|
|
|
|
JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
|
|
|
requestJson.put("method", "altAccount.get");
|
|
@@ -877,7 +880,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
|
|
|
requestJson.put("mch_no", JoinpayConstant.mch_no);
|
|
|
|
|
|
- String sign = createMD5Sign(requestJson , JoinpayConstant.key);
|
|
|
+ String sign = createMD5Sign(requestJson, JoinpayConstant.key);
|
|
|
requestJson.put("sign", sign.toUpperCase());
|
|
|
// logger.info("请求参数:" + requestJson);
|
|
|
|
|
@@ -888,37 +891,37 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
// logger.info("响应参数:" + jsonObject);
|
|
|
|
|
|
// 判断请求是否正确,受理成功
|
|
|
- if(jsonObject.has("resp_code")){
|
|
|
+ if (jsonObject.has("resp_code")) {
|
|
|
String resp_code = jsonObject.getString("resp_code");
|
|
|
mch.setRespCode(resp_code);
|
|
|
- if(JoinpayConstant.resp_code2.equals(resp_code)){
|
|
|
+ if (JoinpayConstant.resp_code2.equals(resp_code)) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- if(data.has("biz_msg")){
|
|
|
+ if (data.has("biz_msg")) {
|
|
|
return data.getString("biz_msg");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return JoinpayConstant.resp_code.get(resp_code);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return "请求失败";
|
|
|
}
|
|
|
|
|
|
|
|
|
// 处理data
|
|
|
- if(jsonObject.has("data")){
|
|
|
+ if (jsonObject.has("data")) {
|
|
|
org.json.JSONObject data = jsonObject.getJSONObject("data");
|
|
|
|
|
|
// 更新账户的金额
|
|
|
|
|
|
- if(data.has("alt_main_balance")){
|
|
|
+ if (data.has("alt_main_balance")) {
|
|
|
mch.setAltMainBalance(new BigDecimal(data.getString("alt_main_balance")).divide(new BigDecimal(100)));
|
|
|
}
|
|
|
|
|
|
- if(data.has("alt_guar_balance")){
|
|
|
+ if (data.has("alt_guar_balance")) {
|
|
|
mch.setAltGuarBalance(new BigDecimal(data.getString("alt_guar_balance")).divide(new BigDecimal(100)));
|
|
|
}
|
|
|
|
|
|
- if(data.has("alt_avil_balance")){
|
|
|
+ if (data.has("alt_avil_balance")) {
|
|
|
mch.setAltAvilBalance(new BigDecimal(data.getString("alt_avil_balance")).divide(new BigDecimal(100)));
|
|
|
}
|
|
|
|
|
@@ -938,7 +941,7 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
* @param data
|
|
|
* @return
|
|
|
*/
|
|
|
- public static String createHmacSign( List<BasicNameValuePair> data , String key) throws UnsupportedEncodingException {
|
|
|
+ public static String createHmacSign(List<BasicNameValuePair> data, String key) throws UnsupportedEncodingException {
|
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
Iterator<BasicNameValuePair> es = data.iterator();
|
|
@@ -958,5 +961,4 @@ public class TJoinpayMchServiceImpl extends ServiceImpl<TJoinpayMchMapper, TJoin
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|