覃浩 2 éve
szülő
commit
7a5451e4e1

+ 6 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusRoomsLivingOrder.java

@@ -221,4 +221,10 @@ public class BusRoomsLivingOrder implements Serializable {
     @ApiModelProperty(value = "第三方用戶ID")
     private String thirdLoginUserId;
 
+    @TableField(exist = false)
+    private BigDecimal xiaoFei;
+
+    @TableField(exist = false)
+    private BigDecimal shouKuan;
+
 }

+ 35 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusRoomBookingOrdersServiceImpl.java

@@ -1033,7 +1033,13 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
              Optional<BusRoomsLivingOrder> opLivingOrder=livingOrders.stream().filter(a->a.getId().equals(s.getLivingOrderId())).findFirst();
              if(opLivingOrder.isPresent()) {
-                 vo.getLivingData().setLivingOrder(opLivingOrder.get());
+                 BusRoomsLivingOrder livingOrder = opLivingOrder.get();
+                 Map<String,BigDecimal> feeMap = getRoomOrderFees(livingOrder.getId());
+                 livingOrder.setXiaoFei(feeMap.get("xf"));
+                 livingOrder.setShouKuan(feeMap.get("sk"));
+                 vo.getLivingData().setLivingOrder(livingOrder);
+
+
                  Optional<BusLivingCustomer> opLivingCustomer = livingCustomers.stream().filter(a->a.getLivingOrderId().equals(opLivingOrder.get().getId())).findFirst();
                  if(opLivingCustomer.isPresent()) {
                      vo.getLivingData().setLivingCustomers(opLivingCustomer.get());
@@ -1047,6 +1053,25 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         return roomVos;
     }
 
+    private Map<String, BigDecimal> getRoomOrderFees(String livingOrderId) {
+        List<BusOrderFee> fees = feeService.list(Wrappers.<BusOrderFee>query()
+        .eq("living_order_id",livingOrderId).eq("preferential_status",1));
+        List<BusOrderFee> xiaofeiList = fees.stream().filter(s->s.getFeeType().equals(1)).collect(Collectors.toList());
+        List<BusOrderFee> shoukuanList = fees.stream().filter(s->s.getFeeType().equals(2)).collect(Collectors.toList());
+        final BigDecimal[] xiaoFeiTotal = {new BigDecimal(0)};
+        final BigDecimal[] shouKuanTotal = {new BigDecimal(0)};
+        xiaofeiList.forEach(s->{
+            xiaoFeiTotal[0] = xiaoFeiTotal[0].add(s.getMoney());
+        });
+        shoukuanList.forEach(s->{
+            shouKuanTotal[0] = shouKuanTotal[0].add(s.getMoney());
+        });
+        Map<String,BigDecimal> items = new HashMap<>();
+        items.put("xf",xiaoFeiTotal[0]);
+        items.put("sk",shouKuanTotal[0]);
+        return items;
+    }
+
     @Override
     public List<BusOrderFee> getLivingOrderFee(String orderId) {
         List<BusRoomsLivingOrder> livingOrders = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query().eq("booking_order_id",orderId));
@@ -1747,6 +1772,15 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         }
         Date finalCurrDate = currDate;
         dayStrs.forEach(s->{
+            try {
+                // 如果是当天还没有到退房时间 就不计算当天房费
+                if(s.equals(DateUtils.formatDate(finalCurrDate)) && (order.getDueOutTime().getTime() < DateUtils.parseDate(DateUtils.formatDate(new Date())+" " + allDayRule.getEndTime(),"yyyy-MM-dd HH:mm:ss") .getTime())){
+                    return;
+                }
+
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
             Optional<BusLivingLayoutDayPrice> opPrice = dayPrices.stream().filter(a-> DateUtils.formatDate(a.getDayTime()).equals(s)).findFirst();
             if(!opPrice.isPresent()){
                 BusLivingLayoutDayPrice nPrice = new BusLivingLayoutDayPrice();