添加设备商城支付
This commit is contained in:
@@ -12,7 +12,7 @@ public interface ApiPayService {
|
||||
|
||||
JSONObject pay(String json,String ip);
|
||||
|
||||
Result<Object> orderPay(String userId, String orderNumber);
|
||||
Result<Object> orderPay(String userId, String orderNumber,String appId);
|
||||
|
||||
/**
|
||||
* @description:退款
|
||||
|
||||
@@ -652,7 +652,7 @@ public class ApiPayServiceImpl implements ApiPayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Object> orderPay(String userId, String orderNumber) {
|
||||
public Result<Object> orderPay(String userId, String orderNumber,String appId) {
|
||||
if(StringUtil.isEmpty(userId)){
|
||||
return ResultGenerator.genFailResult("缺失参数!");
|
||||
}
|
||||
@@ -698,11 +698,15 @@ public class ApiPayServiceImpl implements ApiPayService {
|
||||
if(mercOrderNew == null){
|
||||
order = oldPay(userId,orderNumber,order);
|
||||
}
|
||||
Long cTime = order.getCreateDt().getTime();
|
||||
Long nowTime = System.currentTimeMillis();
|
||||
if(nowTime - cTime >= 1000 * 60 * 1000){
|
||||
return ResultGenerator.genFailResult("订单已超时,请重新下单!");
|
||||
|
||||
if(ObjectUtil.isNotEmpty(order)){
|
||||
Long cTime = order.getCreateDt().getTime();
|
||||
Long nowTime = System.currentTimeMillis();
|
||||
if(nowTime - cTime >= 1000 * 60 * 1000){
|
||||
return ResultGenerator.genFailResult("订单已超时,请重新下单!");
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isNotEmpty(order.getPayData())){
|
||||
return ResultGenerator.genSuccessResult("获取成功",JSONObject.parseObject(order.getPayData()));
|
||||
}
|
||||
@@ -730,6 +734,7 @@ public class ApiPayServiceImpl implements ApiPayService {
|
||||
|
||||
// TODO 测试金额上线会删除
|
||||
order.setConsumeFee(mercOrderNew.getActualAmt().doubleValue());
|
||||
order.setAppletsAppid(appId);
|
||||
|
||||
JSONObject result = sxfPayService.tradePay(order, channel,merchant);
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ public class AliPayController {
|
||||
|
||||
@PostMapping("/orderPay")
|
||||
@ResponseBody
|
||||
public Result<Object> orderPay(String authCode,String orderNumber) {
|
||||
public Result<Object> orderPay(String authCode,String orderNumber,String appId) {
|
||||
if(StringUtil.isEmpty(authCode)){
|
||||
return ResultGenerator.genFailResult("授权码信息为空");
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public class AliPayController {
|
||||
return ResultGenerator.genFailResult("订单号为空");
|
||||
}
|
||||
AlipaySystemOauthTokenResponse tokenResponse = AliUtil.getAliUserIdV2(authCode, ParametersUtil.ZY_PRI, ParametersUtil.ZY_PUB, ParametersUtil.ZY_ALI_APP_ID);
|
||||
return apiPayService.orderPay(tokenResponse.getUserId(),orderNumber);
|
||||
return apiPayService.orderPay(tokenResponse.getUserId(),orderNumber,appId);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -199,7 +199,8 @@ public class ApiPayController {
|
||||
public Result<Object> orderPay(@RequestBody JSONObject params) {
|
||||
String userId = params.getString("userId");
|
||||
String orderNumber = params.getString("orderNumber");
|
||||
return apiPayService.orderPay(userId,orderNumber);
|
||||
|
||||
return apiPayService.orderPay(userId,orderNumber,null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -485,7 +485,8 @@ public class WechantController {
|
||||
System.out.println("openid"+openid);
|
||||
String orderNumber = params.getString("orderNumber");
|
||||
System.out.println("orderNumber"+orderNumber);
|
||||
return apiPayService.orderPay(openid,orderNumber);
|
||||
String appId=params.containsKey("appId")?params.getString("appId"):null;
|
||||
return apiPayService.orderPay(openid,orderNumber,appId);
|
||||
}
|
||||
|
||||
@PostMapping("/getAddress")
|
||||
|
||||
Reference in New Issue
Block a user