|
|
|
@@ -423,72 +423,72 @@ public class WxOrderController extends BaseController { |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
@ApiOperation(value = "继续支付", notes = "{\"composeOrderId\":\"string\"}") |
|
|
|
@PostMapping("/continueToPay") |
|
|
|
public ResultData continueToPay(@RequestBody Map<String, Object> paramMap) { |
|
|
|
logger.info("/api/order/continueToPay" + paramMap.toString()); |
|
|
|
String orderIdStr = (String) paramMap.get("composeOrderId"); |
|
|
|
if (StringUtils.isBlank(orderIdStr)) { |
|
|
|
logger.info("orderId不能为空: " + paramMap.toString()); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); |
|
|
|
} |
|
|
|
Long orderId = 0L; |
|
|
|
try { |
|
|
|
orderId = Long.valueOf(orderIdStr); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); |
|
|
|
} |
|
|
|
|
|
|
|
WxBatchOrder batchOrder = wxOrderService.getWxBatchOrder(getTenantInfo(),orderId); |
|
|
|
if(batchOrder == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到订单"); |
|
|
|
} |
|
|
|
|
|
|
|
WxPayOrder payOrder = new WxPayOrder(); |
|
|
|
payOrder.setOrderId(orderId); |
|
|
|
payOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
payOrder.setPayVendor(batchOrder.getPayVendor()); |
|
|
|
payOrder.setComposeOrder(batchOrder.getOrderType()); |
|
|
|
|
|
|
|
try { |
|
|
|
WxPayOrder byObj = wxPayOrderService.getByObj(payOrder); |
|
|
|
if(byObj == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到支付订单"); |
|
|
|
} |
|
|
|
if(EnumPayStatus.PAY_STATUS_WAIT.getCode().equals(byObj.getPayOrderStatus())){ |
|
|
|
WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(byObj.getComposeOrder()).getComposeOrder(byObj.getOrderId(), byObj.getTenantId()); |
|
|
|
|
|
|
|
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(byObj, EnumPayWay.getEnum(byObj.getPayVendor()).getPlat()); |
|
|
|
//WxCUser user = getUser(); |
|
|
|
//WxAppinfo appInfo = getAppInfo(user.getAppId()); |
|
|
|
if (null == appInfo) { |
|
|
|
return new ResultData(ErrorCode.PAY_ORDER_ERROR, "当前支付类型["+byObj.getPayVendor()+"]找不到C端appInfo"); |
|
|
|
} |
|
|
|
WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); |
|
|
|
try { |
|
|
|
WxPayOrder wo = wxPayOrderService.handleWxOrderQuery(byObj, composeOrder,appInfo, payAccount, IdWorker.get(),false); |
|
|
|
if (null != wo) { |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("outOrderNo",orderId); |
|
|
|
return new ResultData(map); |
|
|
|
} |
|
|
|
}catch(MallinkException e) { |
|
|
|
//已经同步了微信的支付状态,表示已经更新 |
|
|
|
return new ResultData(e.getErrorCode(),e.getMessage()); |
|
|
|
} |
|
|
|
return new ResultData(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "查询微信订单支付状态失败,请稍后!"); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "订单"+EnumPayStatus.getEnum(payOrder.getPayOrderStatus()).getMessage()); |
|
|
|
} |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error("支付状态更新失败2: " + orderId + ", e:" + e.getMessage(),e); |
|
|
|
return new ResultData(e.getErrorCode(), e.getMessage()); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("支付状态更新失败3: " + orderId + ", e:" + e.getMessage(),e); |
|
|
|
return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + orderId + ", e:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
// @ApiOperation(value = "继续支付", notes = "{\"composeOrderId\":\"string\"}") |
|
|
|
// @PostMapping("/continueToPay") |
|
|
|
// public ResultData continueToPay(@RequestBody Map<String, Object> paramMap) { |
|
|
|
// logger.info("/api/order/continueToPay" + paramMap.toString()); |
|
|
|
// String orderIdStr = (String) paramMap.get("composeOrderId"); |
|
|
|
// if (StringUtils.isBlank(orderIdStr)) { |
|
|
|
// logger.info("orderId不能为空: " + paramMap.toString()); |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); |
|
|
|
// } |
|
|
|
// Long orderId = 0L; |
|
|
|
// try { |
|
|
|
// orderId = Long.valueOf(orderIdStr); |
|
|
|
// } catch (NumberFormatException e) { |
|
|
|
// logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); |
|
|
|
// } |
|
|
|
// |
|
|
|
// WxBatchOrder batchOrder = wxOrderService.getWxBatchOrder(getTenantInfo(),orderId); |
|
|
|
// if(batchOrder == null){ |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到订单"); |
|
|
|
// } |
|
|
|
// |
|
|
|
// WxPayOrder payOrder = new WxPayOrder(); |
|
|
|
// payOrder.setOrderId(orderId); |
|
|
|
// payOrder.updateTenantInfo(getTenantInfo()); |
|
|
|
// payOrder.setPayVendor(batchOrder.getPayVendor()); |
|
|
|
// payOrder.setComposeOrder(batchOrder.getOrderType()); |
|
|
|
// |
|
|
|
// try { |
|
|
|
// WxPayOrder byObj = wxPayOrderService.getByObj(payOrder); |
|
|
|
// if(byObj == null){ |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到支付订单"); |
|
|
|
// } |
|
|
|
// if(EnumPayStatus.PAY_STATUS_WAIT.getCode().equals(byObj.getPayOrderStatus())){ |
|
|
|
// WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(byObj.getComposeOrder()).getComposeOrder(byObj.getOrderId(), byObj.getTenantId()); |
|
|
|
// |
|
|
|
// WxAppinfo appInfo = wxAppinfoService.getCAppInfo(byObj, EnumPayWay.getEnum(byObj.getPayVendor()).getPlat()); |
|
|
|
// //WxCUser user = getUser(); |
|
|
|
// //WxAppinfo appInfo = getAppInfo(user.getAppId()); |
|
|
|
// if (null == appInfo) { |
|
|
|
// return new ResultData(ErrorCode.PAY_ORDER_ERROR, "当前支付类型["+byObj.getPayVendor()+"]找不到C端appInfo"); |
|
|
|
// } |
|
|
|
// WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); |
|
|
|
// try { |
|
|
|
// WxPayOrder wo = wxPayOrderService.handleWxOrderQuery(byObj, composeOrder,appInfo, payAccount, IdWorker.get(),false); |
|
|
|
// if (null != wo) { |
|
|
|
// Map<String,Object> map = new HashMap<>(); |
|
|
|
// map.put("outOrderNo",orderId); |
|
|
|
// return new ResultData(map); |
|
|
|
// } |
|
|
|
// }catch(MallinkException e) { |
|
|
|
// //已经同步了微信的支付状态,表示已经更新 |
|
|
|
// return new ResultData(e.getErrorCode(),e.getMessage()); |
|
|
|
// } |
|
|
|
// return new ResultData(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "查询微信订单支付状态失败,请稍后!"); |
|
|
|
// }else{ |
|
|
|
// return new ResultData(ErrorCode.PAY_ORDER_QUERY_ERROR.getCode(), "订单"+EnumPayStatus.getEnum(payOrder.getPayOrderStatus()).getMessage()); |
|
|
|
// } |
|
|
|
// } catch (MallinkException e) { |
|
|
|
// logger.error("支付状态更新失败2: " + orderId + ", e:" + e.getMessage(),e); |
|
|
|
// return new ResultData(e.getErrorCode(), e.getMessage()); |
|
|
|
// } catch (Exception e) { |
|
|
|
// logger.error("支付状态更新失败3: " + orderId + ", e:" + e.getMessage(),e); |
|
|
|
// return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + orderId + ", e:" + e.getMessage()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|