Explorar o código

Merge branch 'master' of http://49.4.53.36:3000/hotel/hotel-saas-backend

gqx %!s(int64=2) %!d(string=hai) anos
pai
achega
726e035439

+ 2 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusRoomBookingOrdersService.java

@@ -45,4 +45,6 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
     List<FloorBuildingRoomVo> getRealtimeInfo(List<CesRooms> rooms);
 
     List<BusOrderFee> getLivingOrderFee(String orderId);
+
+    Boolean syncDayRoomOrder(String hotelId);
 }

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

@@ -998,6 +998,38 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
     }
 
+    @Override
+    public Boolean syncDayRoomOrder(String hotelId) {
+        List<CesRooms> hotelRooms = roomsService.list(Wrappers.<CesRooms>query().eq("hotel_id",hotelId).eq("invalid",false));
+        List<CesRooms> inLiveRooms = hotelRooms.stream().filter(s->s.getLivingOrderId() != null && !s.getLivingOrderId().isEmpty()
+                && (s.getRoomStatus().equals(RoomStatusEnum.LIVE_DIRTY.getKey()) || s.getRoomStatus().equals(RoomStatusEnum.LIVE_CLEAR.getKey()))).collect(Collectors.toList());
+        List<String> livingOrderIds = inLiveRooms.stream().map(s->s.getLivingOrderId()).collect(Collectors.toList());
+        List<BusRoomsLivingOrder> livingOrders = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
+                .in("id",livingOrderIds));
+        livingOrders.forEach(s->{
+            Date date = s.getDueOutTime();
+            Calendar calendar = new GregorianCalendar();
+            calendar.setTime(date);
+            calendar.add(Calendar.DATE,1);
+            s.setDueOutTime(calendar.getTime());
+            roomsLivingOrderService.updateById(s);// 更新订单
+            BusOrderFee dayOrderFee = new BusOrderFee();
+            dayOrderFee.setDayTime(date);
+            dayOrderFee.setCreateTime(new Date());
+            dayOrderFee.setMoney(BigDecimal.valueOf(218.00));
+            dayOrderFee.setFeeType(1);
+            dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+            CesRooms orderRoom = inLiveRooms.stream().filter(a->a.getLivingOrderId().equals(s.getId())).findFirst().get();
+            dayOrderFee.setRoomId(orderRoom.getId());
+            String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
+            roomName += roomName + orderRoom.getName();
+            dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDate(date) + " 当日房费");
+            dayOrderFee.setLivingOrderId(s.getId());
+            feeService.save(dayOrderFee);
+        });
+        return null;
+    }
+
     private Map<String,String> bookingRoomToLiving(BookingOrderSaveDto livingData, List<ExtendBusBookingRoomsVo> roomIds, BookingOrderEditVo bookingOrderVo) {
         Map<String,String> results = new HashMap<>();
 
@@ -1029,8 +1061,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             roomFee.setFeeType(1); // 消费
             List<BusLivingLayoutDayPrice> roomDayPrice = livingData.getLivingRoomDayPrices().stream().filter(i->i.getRoomId().equals(bkRoom.getRoomId())).collect(Collectors.toList());
             BigDecimal dayRoomFee =  currentDayFee(roomDayPrice,null);
-            if(dayRoomFee == null)
-                throw new JeecgBootException("未找到当日房价");
+            if(dayRoomFee == null) throw new JeecgBootException("未找到当日房价");
             roomFee.setMoney(dayRoomFee); // 取当日房费的优惠价  其他时间要查询房价方案、每日房价,房型门市价按照规则去取
             roomFee.setCreateTime(new Date());
             roomFee.setDayTime(new Date());

+ 31 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/quartz/job/LivingRoomOrderFeeJob.java

@@ -0,0 +1,31 @@
+package org.jeecg.modules.quartz.job;
+
+
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import javax.annotation.Resource;
+
+/**
+ * 全天房 超时房间转按照全天房计费规则转为全天房,新增全天房计费账单,延房。。。
+ * todo : 基本逻辑fix 待优化处理
+ */
+@Slf4j
+public class LivingRoomOrderFeeJob implements Job {
+
+    private String parameter;
+
+    public void setParameter(String parameter) {
+        this.parameter = parameter;
+    }
+    @Resource
+    private IBusRoomBookingOrdersService bookingOrdersService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        bookingOrdersService.syncDayRoomOrder(parameter);
+    }
+}