Parcourir la source

订单保存goodid

guoshuai il y a 4 semaines
Parent
commit
f92adb48ac

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

@@ -195,6 +195,8 @@ public class OrderController extends CommonController {
         orderService.save(new Order().setAmountsPayable(toCreatOrderVO.getTotal())
                 .setPayDescription(toCreatOrderVO.getDescription())
                  .setId(id)
+                 .setGoodId(toCreatOrderVO.getGoodId())
+                 .setGoodsName(toCreatOrderVO.getDescription())
                  .setPayStatus(SystemConstant.NUM_ZERO));
         return process(() -> orderService.createOrder(toolWxConfigService.findConf(),toCreatOrderVO));
     }
@@ -250,17 +252,21 @@ public class OrderController extends CommonController {
         //todo 调用计费模块,计算是否有应付费用
         BigDecimal bigDecimal = new BigDecimal(1);
 
+        
         BarnRecordForm formData = barnRecordService.chargingByBarnId(id);
         if(formData != null && formData.getPendingAmount() != null && formData.getPendingAmount().compareTo(BigDecimal.ZERO) >0){
             ToCreateOrderVO toCreateOrderVO = new ToCreateOrderVO();
             toCreateOrderVO.setTotal(formData.getPendingAmount().multiply(new BigDecimal(100)).intValueExact());
             toCreateOrderVO.setDescription("停车缴费");
             toCreateOrderVO.setOpenId(openId);
-            
+            Long orderId = IdUtil.getSnowflake().nextId();
+            toCreateOrderVO.setOutTradeNo(orderId.toString());
             //订单入库
             orderService.save(new Order().setAmountsPayable(toCreateOrderVO.getTotal())
                     .setPayDescription(toCreateOrderVO.getDescription())
-                    .setId(id)
+                    .setId(orderId)
+                    .setGoodId(id)
+                    .setGoodsName(toCreateOrderVO.getDescription())
                     .setPayStatus(SystemConstant.NUM_ZERO));
             return process(() -> orderService.createOrder(toolWxConfigService.findConf(),toCreateOrderVO));
         }else if(formData != null && formData.getPendingAmount() != null && formData.getPendingAmount().compareTo(BigDecimal.ZERO) <= 0){

+ 5 - 0
src/main/java/com/qmrb/system/pojo/vo/ToCreateOrderVO.java

@@ -37,4 +37,9 @@ public class ToCreateOrderVO {
      * 用户openId
      */
     String openId;
+    
+    /**
+     * 停车记录id
+     */
+    Long goodId;
 }

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

@@ -476,6 +476,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         this.save(new Order().setAmountsPayable(toCreatOrderVO.getTotal())
                 .setPayDescription(toCreatOrderVO.getDescription())
                 .setId(id)
+                .setGoodId(toCreatOrderVO.getGoodId())
+                .setGoodsName(toCreatOrderVO.getDescription())
                 .setPayStatus(SystemConstant.NUM_ZERO));
         //调用微信下单接口
         this.createOrder(toolWxConfigService.findConf(),toCreatOrderVO);