generated from root/miduo_server
支付接口添加字段
parent
2d3677557a
commit
e2342f2c44
|
@ -5,6 +5,7 @@ import com.jmfy.dto.CPayOrder;
|
|||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.CUserInfo;
|
||||
import com.jmfy.paramBean.CHRechargeBean;
|
||||
import com.jmfy.paramBean.PaySdkEnum;
|
||||
import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
import com.jmfy.thrift.pool.ClientAdapterPo;
|
||||
|
@ -29,7 +30,7 @@ import java.util.*;
|
|||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/6/8
|
||||
* @discribe
|
||||
* @discribe 草花支付接口
|
||||
*/
|
||||
@RestController
|
||||
public class CHGnRechargeController {
|
||||
|
@ -107,105 +108,16 @@ public class CHGnRechargeController {
|
|||
|
||||
|
||||
private String insertOrder(CHRechargeBean data) {
|
||||
try {
|
||||
//String user_id = data.getUserid();
|
||||
//String consumerName = data.getExtra();
|
||||
|
||||
// 角色id_物品id_cc值
|
||||
String callbackInfo = data.getExtra();
|
||||
String[] callback = callbackInfo.split("_");
|
||||
String uid,goodid,cc_id;
|
||||
if (callback.length >= 3){
|
||||
uid = callback[0];
|
||||
goodid = callback[1];
|
||||
cc_id = callback[2];
|
||||
}else {
|
||||
uid = callback[0];
|
||||
goodid = callback[1];
|
||||
cc_id = "";
|
||||
}
|
||||
|
||||
String orderNo = data.getOrderno_cp();
|
||||
int amount = data.getPay_amt();
|
||||
CUserInfo cUserInfo = cuserDao.findUserInfo(Integer.valueOf(uid));
|
||||
if (cUserInfo == null) {
|
||||
LOGGER.info("该用户无此角色" + uid);
|
||||
return "FAIL";
|
||||
}
|
||||
String amount = String.valueOf(data.getPay_amt());
|
||||
|
||||
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderNo);
|
||||
|
||||
if (cPayOrder != null) {
|
||||
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!", cUserInfo.getId(), cUserInfo.getOpenId());
|
||||
return "FAIL";
|
||||
} else {
|
||||
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = dateTimeformat.format(new Date());
|
||||
cPayOrder = new CPayOrder();
|
||||
cPayOrder.setOrderId(orderNo);
|
||||
cPayOrder.setServerId(cUserInfo.getServerid());
|
||||
cPayOrder.setDelivery_time(date);
|
||||
cPayOrder.setUserId(uid);
|
||||
cPayOrder.setAmount(String.valueOf(amount));
|
||||
cPayOrder.setGoodsId(goodid);
|
||||
cPayOrder.setCc_id(cc_id);
|
||||
// cPayOrder.setRecharge_type();
|
||||
|
||||
Result result = null;
|
||||
String userAddress = cuserDao.findUserAddress(cUserInfo.getId());
|
||||
if (userAddress != null) {
|
||||
LOGGER.info("callback==>userAddress={} ", userAddress);
|
||||
String[] split = userAddress.split(":");
|
||||
String ip = split[0];
|
||||
String port = split[1];
|
||||
LOGGER.info("RPC address --> IP : " + ip + "; PORT : " + port);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = JsonUtil.getServiceKey(ServiceKey.RPCCore, ip, port);
|
||||
LOGGER.info("serviceKey : " + serviceKey);
|
||||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
result = rPCClient.getClient().deliveryRecharge(cUserInfo.getId(),goodid, data.getUserid(), orderNo, 0, amount);//amount 以分为单位
|
||||
|
||||
|
||||
//result = rPCClient.getClient().deliveryRecharge(cUserInfo.getId(), consumerName, data.getConsumerid(), orderNo, 0, 0);
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("callback=>", e);
|
||||
} finally {
|
||||
if (rPCClient != null) {
|
||||
rPCClient.returnObject(serviceKey);
|
||||
} else {
|
||||
LOGGER.info("callback=> rPCClient is null ");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("not get the user url,the openID={} ", uid);
|
||||
return "FAIL";
|
||||
}
|
||||
if (result != null && result.getResultCode() == 1) {
|
||||
LOGGER.info(" callback==>RPC result : ResultCode : " + result.getResultCode() + "; ResultMsg : " + result.getResultMsg());
|
||||
cuserDao.addCpayOrder(cPayOrder);
|
||||
} else {
|
||||
System.out.println("测试代码");
|
||||
return "FAIL";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("callback==>err " + e.toString());
|
||||
return "FAIL";
|
||||
}
|
||||
return "SUCCESS";
|
||||
return PayLogic.getInstence().initOrder(callbackInfo,orderNo,amount,new Date(),data.getUserid(), PaySdkEnum.CH);
|
||||
}
|
||||
|
||||
private static String getMySign(CHRechargeBean rechargeRequestBean,String appsecret) throws IllegalAccessException {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
TreeMap<String, String> tempMap = new TreeMap<>(new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
});
|
||||
TreeMap<String, String> tempMap = new TreeMap<>(String::compareTo);
|
||||
|
||||
Class<? extends CHRechargeBean> aClass = rechargeRequestBean.getClass();
|
||||
Field[] fields = aClass.getDeclaredFields();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.jmfy.dto.CPayOrder;
|
|||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.CUserInfo;
|
||||
import com.jmfy.paramBean.MHTGnWebRechargeRequestBean;
|
||||
import com.jmfy.paramBean.PaySdkEnum;
|
||||
import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
import com.jmfy.thrift.pool.ClientAdapterPo;
|
||||
|
@ -27,7 +28,7 @@ import java.util.*;
|
|||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/3/15
|
||||
* @discribe
|
||||
* @discribe 国内先遣
|
||||
*/
|
||||
@RestController
|
||||
public class MHTGnWebRechargeController {
|
||||
|
@ -98,90 +99,13 @@ public class MHTGnWebRechargeController {
|
|||
|
||||
|
||||
private String insertOrder(MHTGnWebRechargeRequestBean data) {
|
||||
try {
|
||||
// 角色id_物品id_cc值
|
||||
String user_id = data.getConsumerid();
|
||||
String[] collback = user_id.split("_");
|
||||
String uid,cc_id;
|
||||
if (collback.length >= 3){
|
||||
uid = collback[0];
|
||||
cc_id = collback[2];
|
||||
}else {
|
||||
uid = collback[0];
|
||||
cc_id = "";
|
||||
}
|
||||
|
||||
String consumerName = data.getConsumername();
|
||||
|
||||
String consumerId = data.getConsumerid();
|
||||
String orderNo = data.getOrderNo();
|
||||
String amount = data.getMhtOrderAmt();
|
||||
String time = data.getTime();
|
||||
CUserInfo cUserInfo = cuserDao.findUserInfo(Integer.valueOf(uid));
|
||||
if (cUserInfo == null) {
|
||||
LOGGER.info("该用户无此角色" + uid);
|
||||
return "FAIL";
|
||||
}
|
||||
Date time = new Date(Long.parseLong(data.getTime())*1000);;
|
||||
|
||||
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderNo);
|
||||
|
||||
if (cPayOrder != null) {
|
||||
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!", cUserInfo.getId(), cUserInfo.getOpenId());
|
||||
return "FAIL";
|
||||
} else {
|
||||
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = dateTimeformat.format(new Date(Long.parseLong(time)*1000));
|
||||
cPayOrder = new CPayOrder();
|
||||
cPayOrder.setOrderId(orderNo);
|
||||
cPayOrder.setServerId(cUserInfo.getServerid());
|
||||
cPayOrder.setDelivery_time(date);
|
||||
cPayOrder.setUserId(uid);
|
||||
cPayOrder.setAmount(amount);
|
||||
cPayOrder.setGoodsId(consumerName);
|
||||
cPayOrder.setCc_id(cc_id);
|
||||
// cPayOrder.setRecharge_type();
|
||||
|
||||
Result result = null;
|
||||
String userAddress = cuserDao.findUserAddress(cUserInfo.getId());
|
||||
if (userAddress != null) {
|
||||
LOGGER.info("callback==>userAddress={} ", userAddress);
|
||||
String[] split = userAddress.split(":");
|
||||
String ip = split[0];
|
||||
String port = split[1];
|
||||
LOGGER.info("RPC address --> IP : " + ip + "; PORT : " + port);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = JsonUtil.getServiceKey(ServiceKey.RPCCore, ip, port);
|
||||
LOGGER.info("serviceKey : " + serviceKey);
|
||||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
result = rPCClient.getClient().deliveryRecharge(cUserInfo.getId(), consumerName, data.getConsumerid(), orderNo, 0, (int)Double.parseDouble(amount));
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("callback=>", e);
|
||||
} finally {
|
||||
if (rPCClient != null) {
|
||||
rPCClient.returnObject(serviceKey);
|
||||
} else {
|
||||
LOGGER.info("callback=> rPCClient is null ");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("not get the user url,the openID={} ", uid);
|
||||
return "FAIL";
|
||||
}
|
||||
if (result != null && result.getResultCode() == 1) {
|
||||
LOGGER.info(" callback==>RPC result : ResultCode : " + result.getResultCode() + "; ResultMsg : " + result.getResultMsg());
|
||||
cuserDao.addCpayOrder(cPayOrder);
|
||||
} else {
|
||||
System.out.println("测试代码");
|
||||
return "FAIL";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("callback==>err " + e.toString());
|
||||
return "FAIL";
|
||||
}
|
||||
return "SUCCESS";
|
||||
return PayLogic.getInstence().initOrder(consumerId,orderNo,amount,time,consumerId,PaySdkEnum.MHT);
|
||||
}
|
||||
|
||||
private static String getMySign(MHTGnWebRechargeRequestBean rechargeRequestBean,String appsecret) throws IllegalAccessException {
|
||||
|
@ -215,23 +139,4 @@ public class MHTGnWebRechargeController {
|
|||
return MD5Util.encrypByMd5(plain);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException {
|
||||
// MHTGnWebRechargeRequestBean mhtGnWebRechargeRequestBean = new MHTGnWebRechargeRequestBean();
|
||||
// mhtGnWebRechargeRequestBean.setConsumerid("2");
|
||||
// mhtGnWebRechargeRequestBean.setConsumername("300妖晶");
|
||||
// mhtGnWebRechargeRequestBean.setGameCurrency("152.0");
|
||||
// mhtGnWebRechargeRequestBean.setMhtOrderAmt("400");
|
||||
// mhtGnWebRechargeRequestBean.setOrderDetail("充值300妖晶");
|
||||
// mhtGnWebRechargeRequestBean.setOrderNo("21031614371371712089483120640");
|
||||
// mhtGnWebRechargeRequestBean.setTime("1615876722");
|
||||
// mhtGnWebRechargeRequestBean.setSign("08cb75d5b2a4c743c80e7f2b2619214a");
|
||||
// String en = getMySign(mhtGnWebRechargeRequestBean, "eb4287c41d8318c140334da7588e4159");
|
||||
String enep = "consumerid=2&consumername=300妖晶&gameCurrency=152.0&mhtOrderAmt=400&orderDetail=充值300妖晶&orderNo=21031614371371712089483120640&time=1615877506";
|
||||
// System.out.println("参数拼接:"+enep);
|
||||
// System.out.println("最终sign:"+MD5Util.encrypByMd5(enep+md));
|
||||
String md = MD5Util.encrypByMd5("bdbda1c460fb2273f061d9123ee39dae");
|
||||
System.out.println("秘钥加密后:"+md);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jmfy.dto.CPayOrder;
|
||||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.CUserInfo;
|
||||
import com.jmfy.paramBean.MHTGnWebRechargeRequestBean;
|
||||
import com.jmfy.paramBean.PaySdkEnum;
|
||||
import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
import com.jmfy.thrift.pool.ClientAdapterPo;
|
||||
import com.jmfy.thrift.pool.ServiceKey;
|
||||
import com.jmfy.util.JsonUtil;
|
||||
import com.jmfy.util.MD5Util;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/23 17:06
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class PayLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PayLogic.class);
|
||||
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
@Resource
|
||||
private CUserDao cuserDao;
|
||||
|
||||
private PayLogic() {
|
||||
}
|
||||
public static PayLogic getInstence() {
|
||||
return InnerClass.instance;
|
||||
}
|
||||
private static class InnerClass {
|
||||
private static final PayLogic instance = new PayLogic();
|
||||
}
|
||||
|
||||
public String initOrder(String collBackInfo, String orderId, String amount, Date time, String openId, PaySdkEnum sdk){
|
||||
try {
|
||||
// 角色id_物品id_ccId_平台
|
||||
String[] collback = collBackInfo.split("_");
|
||||
String uid = Optional.ofNullable(collback[0]).orElse("0");
|
||||
String goodsId = Optional.ofNullable(collback[1]).orElse("0");
|
||||
String ccId = Optional.ofNullable(collback[2]).orElse("0");
|
||||
String platform = Optional.ofNullable(collback[3]).orElse("ANDROID");
|
||||
|
||||
CUserInfo cUserInfo = cuserDao.findUserInfo(Integer.valueOf(uid));
|
||||
if (cUserInfo == null) {
|
||||
LOGGER.info("该用户无此角色" + uid);
|
||||
return "FAIL";
|
||||
}
|
||||
|
||||
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderId);
|
||||
|
||||
if (cPayOrder != null) {
|
||||
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!", cUserInfo.getId(), cUserInfo.getOpenId());
|
||||
return "FAIL";
|
||||
} else {
|
||||
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = dateTimeformat.format(time);
|
||||
cPayOrder = new CPayOrder();
|
||||
cPayOrder.setOrderId(orderId);
|
||||
cPayOrder.setServerId(cUserInfo.getServerid());
|
||||
cPayOrder.setDelivery_time(date);
|
||||
cPayOrder.setUserId(uid);
|
||||
cPayOrder.setAmount(amount);
|
||||
cPayOrder.setGoodsId(goodsId);
|
||||
cPayOrder.setCc_id(ccId);
|
||||
cPayOrder.setPaySdk(sdk.getName());
|
||||
cPayOrder.setPlatform(platform);
|
||||
|
||||
Result result = null;
|
||||
String userAddress = cuserDao.findUserAddress(cUserInfo.getId());
|
||||
if (userAddress != null) {
|
||||
LOGGER.info("callback==>userAddress={} ", userAddress);
|
||||
String[] split = userAddress.split(":");
|
||||
String ip = split[0];
|
||||
String port = split[1];
|
||||
LOGGER.info("RPC address --> IP : " + ip + "; PORT : " + port);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = JsonUtil.getServiceKey(ServiceKey.RPCCore, ip, port);
|
||||
LOGGER.info("serviceKey : " + serviceKey);
|
||||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
result = rPCClient.getClient().deliveryRecharge(cUserInfo.getId(), goodsId, openId, orderId, 0, (int)Double.parseDouble(amount));
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("callback=>", e);
|
||||
} finally {
|
||||
if (rPCClient != null) {
|
||||
rPCClient.returnObject(serviceKey);
|
||||
} else {
|
||||
LOGGER.info("callback=> rPCClient is null ");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("not get the user url,the openID={} ", uid);
|
||||
return "FAIL";
|
||||
}
|
||||
if (result != null && result.getResultCode() == 1) {
|
||||
LOGGER.info(" callback==>RPC result : ResultCode : " + result.getResultCode() + "; ResultMsg : " + result.getResultMsg());
|
||||
cuserDao.addCpayOrder(cPayOrder);
|
||||
} else {
|
||||
System.out.println("测试代码");
|
||||
return "FAIL";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("callback==>err " + e.toString());
|
||||
return "FAIL";
|
||||
}
|
||||
return "SUCCESS";
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.jmfy.dto.CPayOrder;
|
|||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.CUserInfo;
|
||||
import com.jmfy.paramBean.MHTGnWebRechargeRequestBean;
|
||||
import com.jmfy.paramBean.PaySdkEnum;
|
||||
import com.jmfy.paramBean.XPParamBean;
|
||||
import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
|
@ -28,7 +29,7 @@ import java.util.*;
|
|||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/6/9
|
||||
* @discribe
|
||||
* @discribe 喜扑专服
|
||||
*/
|
||||
@RestController
|
||||
public class XPRechargeController {
|
||||
|
@ -95,106 +96,16 @@ public class XPRechargeController {
|
|||
|
||||
|
||||
private String insertOrder(XPParamBean data) {
|
||||
try {
|
||||
// 角色id_物品id_cc值
|
||||
String callbackInfo = data.getCallbackInfo();
|
||||
String consumerName,cc_id;
|
||||
String[] callback = callbackInfo.split("_");
|
||||
if (callback.length >= 3){
|
||||
consumerName = callback[1];
|
||||
cc_id = callback[2];
|
||||
}else {
|
||||
consumerName = callbackInfo;
|
||||
cc_id = "";
|
||||
}
|
||||
|
||||
String orderNo = data.getOrderId();
|
||||
String amount = data.getAmount();
|
||||
String uid =data.getRoleId();
|
||||
CUserInfo cUserInfo = cuserDao.findUserInfo(Integer.valueOf(uid));
|
||||
if (cUserInfo == null) {
|
||||
LOGGER.info("该用户无此角色" + uid);
|
||||
return "FAIL";
|
||||
Date time = new Date(System.currentTimeMillis());
|
||||
|
||||
return PayLogic.getInstence().initOrder(callbackInfo,orderNo,amount,time,data.getOpenId(), PaySdkEnum.XP);
|
||||
}
|
||||
|
||||
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderNo);
|
||||
|
||||
if (cPayOrder != null) {
|
||||
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!", cUserInfo.getId(), cUserInfo.getOpenId());
|
||||
return "FAIL";
|
||||
} else {
|
||||
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = dateTimeformat.format(new Date(System.currentTimeMillis()));
|
||||
cPayOrder = new CPayOrder();
|
||||
cPayOrder.setOrderId(orderNo);
|
||||
cPayOrder.setServerId(cUserInfo.getServerid());
|
||||
cPayOrder.setDelivery_time(date);
|
||||
cPayOrder.setUserId(uid);
|
||||
cPayOrder.setAmount(amount);
|
||||
cPayOrder.setGoodsId(consumerName);
|
||||
cPayOrder.setCc_id(cc_id);
|
||||
// cPayOrder.setRecharge_type();
|
||||
|
||||
Result result = null;
|
||||
String userAddress = cuserDao.findUserAddress(cUserInfo.getId());
|
||||
if (userAddress != null) {
|
||||
LOGGER.info("callback==>userAddress={} ", userAddress);
|
||||
String[] split = userAddress.split(":");
|
||||
String ip = split[0];
|
||||
String port = split[1];
|
||||
LOGGER.info("RPC address --> IP : " + ip + "; PORT : " + port);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = JsonUtil.getServiceKey(ServiceKey.RPCCore, ip, port);
|
||||
LOGGER.info("serviceKey : " + serviceKey);
|
||||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
result = rPCClient.getClient().deliveryRecharge(cUserInfo.getId(), consumerName, data.getOpenId(), orderNo, 0, Integer.parseInt(amount));
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("callback=>", e);
|
||||
} finally {
|
||||
if (rPCClient != null) {
|
||||
rPCClient.returnObject(serviceKey);
|
||||
} else {
|
||||
LOGGER.info("callback=> rPCClient is null ");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("not get the user url,the openID={} ", uid);
|
||||
return "FAIL";
|
||||
}
|
||||
if (result != null && result.getResultCode() == 1) {
|
||||
LOGGER.info(" callback==>RPC result : ResultCode : " + result.getResultCode() + "; ResultMsg : " + result.getResultMsg());
|
||||
cuserDao.addCpayOrder(cPayOrder);
|
||||
} else {
|
||||
System.out.println("测试代码");
|
||||
return "FAIL";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("callback==>err " + e.toString());
|
||||
return "FAIL";
|
||||
}
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
private static String getMySign(XPParamBean paramBean,String appsecret) throws IllegalAccessException {
|
||||
// TreeMap<String, String> tempMap = new TreeMap<>(String::compareTo);
|
||||
//
|
||||
// Class<? extends XPParamBean> aClass = paramBean.getClass();
|
||||
// Field[] fields = aClass.getDeclaredFields();
|
||||
// for (Field field : fields) {
|
||||
// field.setAccessible(true);
|
||||
// tempMap.put(field.getName(), field.get(paramBean).toString());
|
||||
// }
|
||||
// for (Map.Entry<String, String> item : tempMap.entrySet()) {
|
||||
// String value = item.getValue();
|
||||
// if (StringUtils.isEmpty(value)) {
|
||||
// continue;
|
||||
// }
|
||||
// stringBuilder.append(value);
|
||||
// }
|
||||
private static String getMySign(XPParamBean paramBean,String appsecret){
|
||||
String paramStr = paramBean.getAppId()+paramBean.getOrderId()+paramBean.getOpenId()+paramBean.getServerId()+paramBean.getRoleId()+paramBean.getMoney()+paramBean.getAmount()+paramBean.getCallbackInfo()+appsecret;
|
||||
String sign = MD5Util.encrypByMd5(paramStr);
|
||||
LOGGER.info("加密前字符串:{}",paramStr);
|
||||
|
|
|
@ -9,17 +9,24 @@ import org.springframework.data.mongodb.core.mapping.Field;
|
|||
*/
|
||||
@Document(collection = "c_pay_order")
|
||||
public class CPayOrder {
|
||||
/**
|
||||
* 充值回调中的pOrderId
|
||||
*/
|
||||
@Id
|
||||
private String orderId;//充值回调中的pOrderId
|
||||
|
||||
private String orderId;
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
@Field(value = "delivery_time")
|
||||
private String delivery_time;//发货时间
|
||||
private String delivery_time;
|
||||
|
||||
@Field(value = "serverId")
|
||||
private int serverId;//
|
||||
|
||||
private int serverId;
|
||||
/**
|
||||
* 充值回调中的userId
|
||||
*/
|
||||
@Field(value = "userId")
|
||||
private String userId;//充值回调中的userId
|
||||
private String userId;
|
||||
|
||||
@Field(value = "roleId")
|
||||
private String roleId;
|
||||
|
@ -27,17 +34,35 @@ public class CPayOrder {
|
|||
@Field(value = "goodsId")
|
||||
private String goodsId;
|
||||
|
||||
/**
|
||||
* 原厂订单号,通常为google或者ios充值才有,充值回调中的remark
|
||||
*/
|
||||
@Field(value = "cpOrderId")
|
||||
private String cpOrderId;//原厂订单号,通常为google或者ios充值才有,充值回调中的remark
|
||||
private String cpOrderId;
|
||||
|
||||
@Field(value = "recharge_type")
|
||||
private String recharge_type ; //
|
||||
|
||||
private String recharge_type;
|
||||
/**
|
||||
* 充值回调中的amount,单位为分
|
||||
*/
|
||||
@Field(value = "amount")
|
||||
private String amount;// 充值回调中的amount,单位为分
|
||||
|
||||
private String amount;
|
||||
/**
|
||||
* 区服渠道和游戏
|
||||
*/
|
||||
@Field(value = "cc_id")
|
||||
private String cc_id;// 区服渠道和游戏
|
||||
private String cc_id;
|
||||
/**
|
||||
* 支付sdk
|
||||
*/
|
||||
@Field(value = "pay_sdk")
|
||||
private String paySdk;
|
||||
|
||||
/**
|
||||
* 平台 Android or ios
|
||||
*/
|
||||
@Field(value = "platform")
|
||||
private String platform;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
|
@ -120,6 +145,22 @@ public class CPayOrder {
|
|||
this.cc_id = cc_id;
|
||||
}
|
||||
|
||||
public String getPaySdk() {
|
||||
return paySdk;
|
||||
}
|
||||
|
||||
public void setPaySdk(String paySdk) {
|
||||
this.paySdk = paySdk;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CPayOrder{" +
|
||||
|
@ -133,6 +174,8 @@ public class CPayOrder {
|
|||
", recharge_type='" + recharge_type + '\'' +
|
||||
", amount='" + amount + '\'' +
|
||||
", cc_id='" + cc_id + '\'' +
|
||||
", paySdk=" + paySdk +
|
||||
", platform='" + platform + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.jmfy.paramBean;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/23 16:09
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum PaySdkEnum {
|
||||
// 支付sdk
|
||||
MHT(1,"猕猴桃"),
|
||||
XP(2,"喜扑"),
|
||||
CH(3,"草花"),
|
||||
;
|
||||
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
PaySdkEnum(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue