generated from root/miduo_server
增加DNA01支付
parent
1b63a90b7f
commit
2b63a0532e
|
@ -18,186 +18,13 @@ import java.util.Map;
|
||||||
* 太初行DNA01安卓支付,该渠道安卓和ios要分开参数,比较诡异
|
* 太初行DNA01安卓支付,该渠道安卓和ios要分开参数,比较诡异
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class Dna01AdRechargeController {
|
public class Dna01AdRechargeController extends Dna01IosRechargeController{
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Dna01AdRechargeController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(Dna01AdRechargeController.class);
|
||||||
private static final String appId = "3";
|
private static final String adAppId = "3";
|
||||||
private static final String appKey = "915c3274597aa3edc802a52315ffc48f";
|
private static final String adAppKey = "915c3274597aa3edc802a52315ffc48f";
|
||||||
|
|
||||||
@RequestMapping(value = "/Dna01AdCallback")
|
@RequestMapping(value = "/Dna01AdCallback")
|
||||||
public String Dna01Callback(HttpServletRequest request) throws Exception {
|
public String Dna01Callback(HttpServletRequest request) throws Exception {
|
||||||
return process(request,appId,appKey);
|
return process(request,adAppId,adAppKey);
|
||||||
}
|
|
||||||
|
|
||||||
public static String process(HttpServletRequest request,String appId,String appKey) throws Exception{
|
|
||||||
String result = "FAILURE";
|
|
||||||
|
|
||||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap2(request);
|
|
||||||
if (parameterMap.isEmpty()) {
|
|
||||||
LOGGER.error("Dna01Callback request data is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("app_id")){
|
|
||||||
LOGGER.error("Dna01Callback request app_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String appIdFrom = parameterMap.get("app_id");
|
|
||||||
if(appIdFrom == null){
|
|
||||||
LOGGER.error("Dna01Callback request app_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!appIdFrom.equals(appId)){
|
|
||||||
LOGGER.error("Dna01Callback request app_id is not exist channel app_id : " + appIdFrom + "---local app_id : " + appId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("cp_order_id")){
|
|
||||||
LOGGER.error("Dna01Callback request cp_order_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String cpOrderId = parameterMap.get("cp_order_id");
|
|
||||||
if(cpOrderId == null){
|
|
||||||
LOGGER.error("Dna01Callback request cp_order_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("mem_id")){
|
|
||||||
LOGGER.error("Dna01Callback request mem_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String userId = parameterMap.get("mem_id");
|
|
||||||
if(userId == null){
|
|
||||||
LOGGER.error("Dna01Callback request mem_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("order_id")){
|
|
||||||
LOGGER.error("Dna01Callback request order_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String orderId = parameterMap.get("order_id");
|
|
||||||
if(orderId == null){
|
|
||||||
LOGGER.error("Dna01Callback request orderId is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("orderStatus")){
|
|
||||||
LOGGER.error("Dna01Callback request orderStatus is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String orderStatusStr = parameterMap.get("orderStatus");
|
|
||||||
if(orderStatusStr == null){
|
|
||||||
LOGGER.error("Dna01Callback request orderStatus is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
int orderStatus = Integer.parseInt(orderStatusStr);
|
|
||||||
if(!parameterMap.containsKey("pay_time")){
|
|
||||||
LOGGER.error("Dna01Callback request pay_time is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String payTimeStr = parameterMap.get("pay_time");
|
|
||||||
if(payTimeStr == null){
|
|
||||||
LOGGER.error("Dna01Callback request pay_time is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
int payTime = Integer.parseInt(payTimeStr);
|
|
||||||
if(!parameterMap.containsKey("product_id")){
|
|
||||||
LOGGER.error("Dna01Callback request product_id is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String productId = parameterMap.get("product_id");
|
|
||||||
if(productId == null){
|
|
||||||
LOGGER.error("Dna01Callback request orderId is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("product_name")){
|
|
||||||
LOGGER.error("Dna01Callback request product_name is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String productName = parameterMap.get("product_name");
|
|
||||||
if(productName == null){
|
|
||||||
LOGGER.error("Dna01Callback request productName is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("product_price")){
|
|
||||||
LOGGER.error("Dna01Callback request product_price is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String moneyStr = parameterMap.get("product_price");
|
|
||||||
if(moneyStr == null){
|
|
||||||
LOGGER.error("Dna01Callback request product_price is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
float money = Float.parseFloat(moneyStr);
|
|
||||||
if(!parameterMap.containsKey("ext")){
|
|
||||||
LOGGER.error("Dna01Callback request ext is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
//ext参数传用户的uid即可
|
|
||||||
String extInfo = parameterMap.get("ext");
|
|
||||||
if(extInfo == null){
|
|
||||||
LOGGER.error("Dna01Callback request ext is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if(!parameterMap.containsKey("sign")){
|
|
||||||
LOGGER.error("Dna01Callback request sign is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
String sign = parameterMap.get("sign");
|
|
||||||
if(sign == null){
|
|
||||||
LOGGER.error("Dna01Callback request sign is null");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
//充值成功
|
|
||||||
if(orderStatus == 1){
|
|
||||||
String inserted = insertOrder(extInfo, productId,"ANDROID",cpOrderId,money);
|
|
||||||
if("SUCCESS".equals(inserted)){
|
|
||||||
result = "SUCCESS";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param roleId
|
|
||||||
* @param itemId
|
|
||||||
* @param type
|
|
||||||
* @param orderNo
|
|
||||||
* @param money
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String insertOrder(String roleId, String itemId,String type,String orderNo,float money) {
|
|
||||||
String ccId = "0";
|
|
||||||
String callbackInfo = roleId + "_" + itemId + "_" +ccId + "_" + type;
|
|
||||||
String amount = String.valueOf( money* 100);
|
|
||||||
Date time = new Date(System.currentTimeMillis());
|
|
||||||
String s = PayLogic.initOrder(callbackInfo, orderNo, amount, time, callbackInfo, PaySdkEnum.DNA01);
|
|
||||||
if ("ORDER_IS_EXIST".equals(s)) {
|
|
||||||
return "SUCCESS";
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
String url = "http://8.154.16.171:9991/delivery/Hb027Callback";
|
|
||||||
Map<String,String> parms = new HashMap<>();
|
|
||||||
String appId = "ae526ad09217c7de12b3130d8ef9c176";
|
|
||||||
String userId = "500360680&";
|
|
||||||
String orderNum = "BR66e267eb47827910994106412";
|
|
||||||
String money = "6.00";
|
|
||||||
String serverId = "10001";
|
|
||||||
String roleId = "10000012";
|
|
||||||
String roleName = "蔚明亮";
|
|
||||||
String extInfo = "11101";
|
|
||||||
String status = "1";
|
|
||||||
String sign = "f1d5c6b9699fa2e8a149a2c2615653d2&sign2=0a71e9b1d5b3f06069a26134e7465888&sign3=b33ebfec1a690a88153b7406420704a0";
|
|
||||||
parms.put("appId",appId);
|
|
||||||
parms.put("userId",userId);
|
|
||||||
parms.put("orderNum",orderNum);
|
|
||||||
parms.put("money",money);
|
|
||||||
parms.put("serverId",serverId);
|
|
||||||
parms.put("roleId",roleId);
|
|
||||||
parms.put("roleName",roleName);
|
|
||||||
parms.put("extInfo",extInfo);
|
|
||||||
parms.put("status",status);
|
|
||||||
parms.put("sign",sign);
|
|
||||||
String r = HttpUtils.doPost(url, parms);
|
|
||||||
System.out.print("------------------" + r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ import java.util.Map;
|
||||||
@RestController
|
@RestController
|
||||||
public class Dna01IosRechargeController {
|
public class Dna01IosRechargeController {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Dna01AdRechargeController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(Dna01AdRechargeController.class);
|
||||||
private static final String appId = "4";
|
private static final String iosAppId = "4";
|
||||||
private static final String appKey = "94b817ed89ffe487fcdd280c35feb7fa";
|
private static final String iosAppKey = "94b817ed89ffe487fcdd280c35feb7fa";
|
||||||
|
|
||||||
@RequestMapping(value = "/Dna01IosCallback")
|
@RequestMapping(value = "/Dna01IosCallback")
|
||||||
public String Dna01Callback(HttpServletRequest request) throws Exception {
|
public String Dna01Callback(HttpServletRequest request) throws Exception {
|
||||||
return process(request,appId,appKey);
|
return process(request,iosAppId,iosAppKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String process(HttpServletRequest request,String appId,String appKey) throws Exception{
|
public static String process(HttpServletRequest request,String appId,String appKey) throws Exception{
|
||||||
|
@ -220,31 +220,4 @@ public class Dna01IosRechargeController {
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
String url = "http://8.154.16.171:9991/delivery/Hb027Callback";
|
|
||||||
Map<String,String> parms = new HashMap<>();
|
|
||||||
String appId = "ae526ad09217c7de12b3130d8ef9c176";
|
|
||||||
String userId = "500360680&";
|
|
||||||
String orderNum = "BR66e267eb47827910994106412";
|
|
||||||
String money = "6.00";
|
|
||||||
String serverId = "10001";
|
|
||||||
String roleId = "10000012";
|
|
||||||
String roleName = "蔚明亮";
|
|
||||||
String extInfo = "11101";
|
|
||||||
String status = "1";
|
|
||||||
String sign = "f1d5c6b9699fa2e8a149a2c2615653d2&sign2=0a71e9b1d5b3f06069a26134e7465888&sign3=b33ebfec1a690a88153b7406420704a0";
|
|
||||||
parms.put("appId",appId);
|
|
||||||
parms.put("userId",userId);
|
|
||||||
parms.put("orderNum",orderNum);
|
|
||||||
parms.put("money",money);
|
|
||||||
parms.put("serverId",serverId);
|
|
||||||
parms.put("roleId",roleId);
|
|
||||||
parms.put("roleName",roleName);
|
|
||||||
parms.put("extInfo",extInfo);
|
|
||||||
parms.put("status",status);
|
|
||||||
parms.put("sign",sign);
|
|
||||||
String r = HttpUtils.doPost(url, parms);
|
|
||||||
System.out.print("------------------" + r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue