loemkie 1 mês atrás
pai
commit
d91102c0e8

+ 2 - 2
src/main/java/com/qmrb/system/controller/OrderController.java

@@ -89,9 +89,9 @@ public class OrderController extends CommonController {
         Long id = IdUtil.getSnowflake().nextId();
         toCreatOrderVO.setOutTradeNo(id.toString());
         //订单入库
-        orderService.save(new Order().setAmount(toCreatOrderVO.getTotal())
+        orderService.save(new Order().setAmountsPayable(toCreatOrderVO.getTotal())
                 .setPayDescription(toCreatOrderVO.getDescription())
-                 .setPkId(id)
+                 .setId(id)
                  .setPayStatus(SystemConstant.NUM_ZERO));
         return process(() -> orderService.createOrder(toolWxConfigService.findConf(),toCreatOrderVO));
     }

+ 6 - 6
src/main/java/com/qmrb/system/pojo/entity/Order.java

@@ -28,20 +28,20 @@ public class Order implements Serializable {
     /**
      * 本系统生成的订单
      */
-    @TableId("pk_id")
-    private Long pkId;
+    @TableId("id")
+    private Long id;
 
     /**
      * 商品实付金额(单位:分)
      */
-    @TableField("amount")
-    private Integer amount;
+    @TableField("amounts_payable")
+    private Integer amountsPayable;
 
     /**
      * 下单时间
      */
-    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
-    private LocalDateTime gmtCreate;
+    @TableField(value = "order_time", fill = FieldFill.INSERT)
+    private LocalDateTime orderTime;
 
     /**
      * 支付状态:0 未支付 1 已支付 2 退款中 3 已退款 4 退款失败

+ 10 - 10
src/main/java/com/qmrb/system/service/impl/OrderServiceImpl.java

@@ -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("退款失败,请联系客服解决");
         }
     }

+ 2 - 2
src/main/java/com/qmrb/system/wxpayback/constant/SystemConstant.java

@@ -13,9 +13,9 @@ public class SystemConstant {
     /**
      * 支付回调url
      */
-    public final static String PAY_NOTIFY_URL="https://域名配置/pay/order/wechatPayCallback";
+    public final static String PAY_NOTIFY_URL="https://mini.qmrb.net/api/order/wechatPayCallback";
 
-    public final static String REFUND_NOTIFY_URL="https://域名配置/pay/order/wechatRefundBack";
+    public final static String REFUND_NOTIFY_URL="https://mini.qmrb.net/api/order/wechatRefundBack";
     /**
      * 固定支付参数 package
      */