Bladeren bron

待结账功能

夏文涛 3 jaren geleden
bovenliggende
commit
20f6ee9f40

File diff suppressed because it is too large
+ 392 - 423
.idea/workspace.xml


+ 4 - 0
src/main/java/com/chuanghai/ihotel/controller/HotelOrderController.java

@@ -16,6 +16,7 @@ import com.chuanghai.ihotel.controller.request.OrderQueryRequest;
 import com.chuanghai.ihotel.controller.request.StatisticalReportRequest;
 import com.chuanghai.ihotel.controller.request.SubmitOrderRequest;
 import com.chuanghai.ihotel.dto.LoginUserDTO;
+import com.chuanghai.ihotel.service.HotelOrderBillService;
 import com.chuanghai.ihotel.service.HotelOrderService;
 import com.chuanghai.ihotel.util.AesUtils;
 import com.chuanghai.ihotel.util.CommonUtil;
@@ -60,6 +61,8 @@ public class HotelOrderController {
     private StringRedisTemplate redisTemplate;
     @Autowired
     private HotelOrderService hotelOrderService;
+    @Autowired
+    private HotelOrderBillService hotelOrderBillService;
 
     /**
      * 获取请求令牌
@@ -280,6 +283,7 @@ public class HotelOrderController {
         return CommonResult.ok();
     }
 
+
     /**
      * 办理退房
      *

+ 3 - 2
src/main/java/com/chuanghai/ihotel/scheduled/SystemScheduled.java

@@ -35,9 +35,10 @@ public class SystemScheduled {
      * 每月1号的凌晨5点整 自动执行一次
      */
     @Async
-    @Scheduled(cron = "0 0 5 1 * ? ")
-//    @Scheduled(cron = "30 * * * * ? ")
+    @Scheduled(cron = "0 0 5 1 * ? ")//每月1号的凌晨5点整 自动执行一次
+    //@Scheduled(cron = "0/30 * * * * ? ")//每三十秒执行一次
     public void autoCreateReport() {
+        System.out.println("自动生成报表");
         orderService.statisticalReport();
     }
 }

+ 11 - 11
src/main/java/com/chuanghai/ihotel/service/impl/HotelOrderServiceImpl.java

@@ -1043,18 +1043,15 @@ public class HotelOrderServiceImpl extends ServiceImpl<HotelOrderDao, HotelOrder
 
         String orderStatu = OrderStatuEnum.WAIT_BILL.getCode();
         BillHandleResultDTO billHandleResult = orderBillService.calcBill(orderId);
-        if (payAmount.doubleValue() == 0) { // 实际支付金额为0,表明不需要支付
-            // 自动完结订单
-            orderStatu = OrderStatuEnum.FINISH.getCode();
-        } else {
-            if ("1".equals(billHandleResult.getResultFlag())) { // 待退款
-                if (billHandleResult.getReturnFee().doubleValue() > 0) {
-                    // TODO 发起退款
-                } else {
-                    // 自动完结订单
-                    orderStatu = OrderStatuEnum.FINISH.getCode();
-                }
+        if ("1".equals(billHandleResult.getResultFlag())) { // 待退款
+            if (billHandleResult.getReturnFee().doubleValue() > 0) {
+                // TODO 发起退款
+            } else {
+                // 自动完结订单
+                orderStatu = OrderStatuEnum.FINISH.getCode();
             }
+        }else{//待结账
+            orderStatu = OrderStatuEnum.WAIT_BILL.getCode();
         }
 
         // 密码锁密码删除
@@ -1067,6 +1064,9 @@ public class HotelOrderServiceImpl extends ServiceImpl<HotelOrderDao, HotelOrder
         UpdateWrapper<HotelOrderEntity> updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("id", orderId);
         updateWrapper.set("order_statu", orderStatu);
+        if(orderStatu.equals(OrderStatuEnum.WAIT_BILL.getCode())){
+            updateWrapper.set("order_statu", orderStatu);
+        }
         updateWrapper.last("limit 1");
         this.update(null, updateWrapper);
 

+ 1 - 1
src/main/java/com/chuanghai/ihotel/service/impl/RoomRealtimeStatuServiceImpl.java

@@ -106,7 +106,7 @@ public class RoomRealtimeStatuServiceImpl extends ServiceImpl<RoomRealtimeStatuD
             if (roomId == null) {
                 return null;
             }
-
+            roomId = 1561549059160961028L;
             // 锁定房间
             RoomRealtimeStatuEntity roomRealtimeStatu = new RoomRealtimeStatuEntity();
             roomRealtimeStatu.setRoomId(roomId);

File diff suppressed because it is too large
+ 567 - 567
src/main/resources/static/doc/index.html


BIN
target/classes/com/chuanghai/ihotel/controller/HotelOrderController.class


BIN
target/classes/com/chuanghai/ihotel/scheduled/SystemScheduled.class


BIN
target/classes/com/chuanghai/ihotel/service/impl/HotelOrderServiceImpl.class


BIN
target/classes/com/chuanghai/ihotel/service/impl/RoomRealtimeStatuServiceImpl.class


File diff suppressed because it is too large
+ 567 - 567
target/classes/static/doc/index.html


BIN
target/ihotel-0.0.1-SNAPSHOT.jar


BIN
target/ihotel-0.0.1-SNAPSHOT.jar.original


File diff suppressed because it is too large
+ 4 - 4
target/surefire-reports/TEST-com.chuanghai.ihotel.IhotelApplicationTests.xml


+ 1 - 1
target/surefire-reports/com.chuanghai.ihotel.IhotelApplicationTests.txt

@@ -1,4 +1,4 @@
 -------------------------------------------------------------------------------
 Test set: com.chuanghai.ihotel.IhotelApplicationTests
 -------------------------------------------------------------------------------
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.718 s - in com.chuanghai.ihotel.IhotelApplicationTests
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.344 s - in com.chuanghai.ihotel.IhotelApplicationTests