|
@@ -168,19 +168,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
Integer queryAmountByOrderNo(String orderNo) {
|
|
|
QueryWrapper<Order> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.select("amount").eq("pk_id",orderNo);
|
|
|
- return getOne(wrapper).getAmount();
|
|
|
+ wrapper.select("amount").eq("id",orderNo);
|
|
|
+ return getOne(wrapper).getAmountsPayable();
|
|
|
}
|
|
|
|
|
|
void updateStatus(Integer status,String pkId) {
|
|
|
UpdateWrapper<Order> wrapper = new UpdateWrapper<>();
|
|
|
- wrapper.set("pay_status",status).eq("pk_id",pkId);
|
|
|
+ wrapper.set("pay_status",status).eq("id",pkId);
|
|
|
update(wrapper);
|
|
|
}
|
|
|
|
|
|
Integer getStatus(String pkId) {
|
|
|
QueryWrapper<Order> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.select("pay_status").eq("pk_id",pkId);
|
|
|
+ wrapper.select("pay_status").eq("id",pkId);
|
|
|
return getOne(wrapper).getPayStatus();
|
|
|
}
|
|
|
|
|
@@ -258,18 +258,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
ObjectNode rootNode = objectMapper.createObjectNode();
|
|
|
//2.配置参数 订单商户号 退款订单号 微信订单号(微信生成) 退款回调地址(与下单回调地址不一样) 金额信息 amount: 原订单金额 total 退款金额 refund (单位都是分) 退款币种 CNY 人民币
|
|
|
//商户订单号 下单时生成
|
|
|
- rootNode.put(WXOrderConstant.OUT_TRADE_NO, order.getPkId().toString())
|
|
|
+ rootNode.put(WXOrderConstant.OUT_TRADE_NO, order.getId().toString())
|
|
|
//微信支付系统生成的订单号 下单时生成(系统生成)
|
|
|
- .put(WXOrderConstant.OUT_REFUND_NO, order.getPkId().toString())
|
|
|
+ .put(WXOrderConstant.OUT_REFUND_NO, order.getId().toString())
|
|
|
//退款回调地址
|
|
|
.put(WXOrderConstant.NOTIFY_URL, SystemConstant.REFUND_NOTIFY_URL);
|
|
|
//金额信息 amount: 原订单金额 total 退款金额 refund (单位都是分)
|
|
|
rootNode.putObject(WXOrderConstant.AMOUNT)
|
|
|
//现阶段 total==refund 不支持部分退款
|
|
|
//原订单金额 total
|
|
|
- .put(WXOrderConstant.AMOUNT_TOTAL, order.getAmount())
|
|
|
+ .put(WXOrderConstant.AMOUNT_TOTAL, order.getAmountsPayable())
|
|
|
//退款金额 refund
|
|
|
- .put(WXOrderConstant.AMOUNT_REFUND, order.getAmount())
|
|
|
+ .put(WXOrderConstant.AMOUNT_REFUND, order.getAmountsPayable())
|
|
|
//退款币种 CNY 人民币
|
|
|
.put(WXOrderConstant.AMOUNT_CURRENCY, SystemConstant.CURRENCY_RMB);
|
|
|
objectMapper.writeValue(bos, rootNode);
|
|
@@ -284,10 +284,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
String status = refundNode.get(WXOrderConstant.STATUS).textValue();
|
|
|
log.info("微信方=====退款状态====={}======",status);
|
|
|
Integer statusCode = WxPayStatusEnum.getCode(status);
|
|
|
- updateStatus(statusCode,order.getPkId().toString());
|
|
|
+ updateStatus(statusCode,order.getId().toString());
|
|
|
return "退款申请成功 注意退款查收";
|
|
|
} catch (Exception e) {
|
|
|
- log.info("微信退款" +order.getPkId() + "失败");
|
|
|
+ log.info("微信退款" +order.getId() + "失败");
|
|
|
throw new ApiException("退款失败,请联系客服解决");
|
|
|
}
|
|
|
}
|