generated from root/miduo_server
qiuck渠道支付修改
parent
e2342f2c44
commit
0458131cb7
|
@ -3,6 +3,7 @@ package com.jmfy.controller;
|
|||
import com.jmfy.dto.CPayOrder;
|
||||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.CUserInfo;
|
||||
import com.jmfy.paramBean.PaySdkEnum;
|
||||
import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
import com.jmfy.thrift.pool.ClientAdapterPo;
|
||||
|
@ -86,89 +87,12 @@ public class QuickRechargeController {
|
|||
}
|
||||
|
||||
private String insertOrder(Map<String,String> map) {
|
||||
try {
|
||||
// 角色id_物品id_cc值
|
||||
String callbackInfo = map.get("extras_params");
|
||||
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 callbackInfo = map.get("extras_params");
|
||||
String[] callback = callbackInfo.split("_");
|
||||
String orderNo = map.get("order_no");
|
||||
String amount = map.get("amount");
|
||||
|
||||
String orderNo = map.get("order_no");
|
||||
String amount = map.get("amount");
|
||||
CUserInfo cUserInfo = cuserDao.findUserInfo(Integer.valueOf(uid));
|
||||
if (cUserInfo == null) {
|
||||
LOGGER.info("该用户无此角色" + uid);
|
||||
return "FAILED";
|
||||
}
|
||||
|
||||
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderNo);
|
||||
|
||||
if (cPayOrder != null) {
|
||||
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!", cUserInfo.getId(), cUserInfo.getOpenId());
|
||||
return "FAILED";
|
||||
} 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(goodid);
|
||||
cPayOrder.setCc_id(cc_id);
|
||||
|
||||
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);
|
||||
double amdouble = Double.parseDouble(amount);
|
||||
result = rPCClient.getClient().deliveryRecharge(cUserInfo.getId(), goodid, uid, orderNo, 0, (int)(amdouble*100));
|
||||
} 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 "FAILED";
|
||||
}
|
||||
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 "FAILED";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("callback==>err " + e.toString());
|
||||
return "FAILED";
|
||||
}
|
||||
return "SUCCESS";
|
||||
return PayLogic.getInstence().initOrder(callbackInfo,orderNo,amount,new Date(System.currentTimeMillis()),callback[0],PaySdkEnum.QUICK);
|
||||
}
|
||||
|
||||
public boolean sign(String ntdata0,String sign0,String md5Sign){
|
||||
|
|
|
@ -11,6 +11,7 @@ public enum PaySdkEnum {
|
|||
MHT(1,"猕猴桃"),
|
||||
XP(2,"喜扑"),
|
||||
CH(3,"草花"),
|
||||
QUICK(4,"QUICK"),
|
||||
;
|
||||
|
||||
private int id;
|
||||
|
|
Loading…
Reference in New Issue