소스 검색

修改房价方案,修改添加消费

许智捷 2 년 전
부모
커밋
d4d4855c2b
24개의 변경된 파일523개의 추가작업 그리고 102개의 파일을 삭제
  1. 12 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusHousePriceSchemeLayoutController.java
  2. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusOrderFeeController.java
  3. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusRoomBookingOrdersController.java
  4. 2 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/dto/BookingLayoutRoomsDto.java
  5. 2 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/FeeSubjectType.java
  6. 4 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusOrderFeeService.java
  7. 2 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusRoomBookingOrdersService.java
  8. 75 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusOrderFeeServiceImpl.java
  9. 60 69
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusRoomBookingOrdersServiceImpl.java
  10. 1 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/ExtendBusBookingRoomsVo.java
  11. 55 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/Enum/ChargeTypeEnum.java
  12. 4 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesHouseLongRentChargesController.java
  13. 75 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesHouseLongRentSchemeController.java
  14. 48 22
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesHousePriceSchemeController.java
  15. 51 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesHouseLongRentCharge.java
  16. 35 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesHouseLongRentScheme.java
  17. 17 3
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesHousePriceScheme.java
  18. 7 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/mapper/CesHouseLongRentChargeMapper.java
  19. 7 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/mapper/CesHouseLongRentSchemeMapper.java
  20. 6 4
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesHousePriceSchemeServiceImpl.java
  21. 7 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/ICesHouseLongRentChargeService.java
  22. 8 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/ICesHouseLongRentSchemeService.java
  23. 11 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/impl/CesHouseLongRentChargeServiceImpl.java
  24. 32 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/impl/CesHouseLongRentSchemeServiceImpl.java

+ 12 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusHousePriceSchemeLayoutController.java

@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -30,7 +31,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.service.IBusHousePriceSchemeLayoutService;
 import org.jeecg.modules.business.service.IBusSchemeLayoutDailyPriceService;
+import org.jeecg.modules.rooms.entity.CesHousePriceScheme;
 import org.jeecg.modules.rooms.entity.CesRoomLayout;
+import org.jeecg.modules.rooms.service.CesHousePriceSchemeServiceImpl;
 import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -67,6 +70,8 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
 	IBusSchemeLayoutDailyPriceService schemeLayoutDailyPriceService;
 	 @Resource
 	 private CesRoomLayoutServiceImpl cesRoomLayoutService;
+	 @Resource
+	 private CesHousePriceSchemeServiceImpl housePriceSchemeService;
 	/**
 	 * 分页列表查询
 	 *
@@ -80,9 +85,14 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
 	@ApiOperation(value="房价方案-房型关联表-分页列表查询", notes="房价方案-房型关联表-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<IPage<BusHousePriceSchemeLayout>> queryPageList(BusHousePriceSchemeLayout busHousePriceSchemeLayout,
+								   Integer type,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 								   HttpServletRequest req) {
+		if (type != null){
+			CesHousePriceScheme housePriceScheme = housePriceSchemeService.getOne(Wrappers.<CesHousePriceScheme>lambdaQuery().eq(CesHousePriceScheme::getType,type).last("limit 1"));
+			busHousePriceSchemeLayout.setSchemeId(housePriceScheme.getId());
+		}
 		QueryWrapper<BusHousePriceSchemeLayout> queryWrapper = QueryGenerator.initQueryWrapper(busHousePriceSchemeLayout, req.getParameterMap());
 		Page<BusHousePriceSchemeLayout> page = new Page<BusHousePriceSchemeLayout>(pageNo, pageSize);
 		IPage<BusHousePriceSchemeLayout> pageList = busHousePriceSchemeLayoutService.page(page, queryWrapper);
@@ -96,6 +106,8 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
 		return Result.OK(pageList);
 	}
 
+
+
 	 /**
 	  * 分页列表查询
 	  *

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusOrderFeeController.java

@@ -155,7 +155,7 @@ public class BusOrderFeeController extends JeecgController<BusOrderFee, IBusOrde
 		 consumeFeeIds.addAll(collectionFeeIds);
 		 LambdaUpdateWrapper<BusOrderFee> wrapper = new LambdaUpdateWrapper<>();
 		 wrapper.set(BusOrderFee::getPreferentialStatus,1);
-		 wrapper.in(BusOrderFee::getId, consumeFeeIds);
+		 wrapper.in(CollUtil.isNotEmpty(consumeFeeIds),BusOrderFee::getId, consumeFeeIds);
 		 busOrderFeeService.update(wrapper);
 		 return Result.OK(busOrderFeeService.refundBatch(busOrderFeeList));
 	 }

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusRoomBookingOrdersController.java

@@ -246,7 +246,7 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	 @ApiOperation(value="酒店预定订单-预约房间入住", notes="酒店预定订单-预约房间入住")
 	 @RequestMapping(value = "booking-to-live",method = RequestMethod.POST)
 	 public  Result<String> bookingRoomToLive(String bookingRoomId, @RequestBody List<BusLivingCustomer> customers,String hotelId) {
-		 return Result.OK("入住成功",service.bookingToLive(bookingRoomId, customers,hotelId,true,null));
+		 return Result.OK("入住成功",service.bookingToLive(bookingRoomId, customers,hotelId,true,null,null));
 	 }
 
 	 /**

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

@@ -6,6 +6,7 @@ import lombok.Data;
 import org.jeecg.modules.business.entity.BusLivingCustomer;
 import org.jeecg.modules.business.entity.BusRoomBookingOrders;
 import org.jeecg.modules.business.vo.BusLivingCustomerVo;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
 
 import java.util.List;
 
@@ -24,6 +25,7 @@ public class BookingLayoutRoomsDto {
     private List<String> orderFees;
     @ApiModelProperty(value = "单个房间的入住订单信息")
     private BusRoomBookingOrders roomOrderInfo;
+    private CesHouseLongRentScheme longRentScheme;
 
 
 }

+ 2 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/FeeSubjectType.java

@@ -19,7 +19,8 @@ public enum FeeSubjectType {
     SHOU_GONG_FANG_FEI(10,"手工房费"),
     SHUI_DIAN_MEI(11,"水电煤抄表"),
     PEI_CHANG(12,"赔偿费"),
-    TUI_DAN_JIE_ZHANG_SHOU_KUAN(13,"退单结账");
+    TUI_DAN_JIE_ZHANG_SHOU_KUAN(13,"退单结账"),
+    OTHER(14,"其他");
 
     Integer key;
 

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

@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.business.entity.BusOrderFee;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
 import org.jeecg.modules.business.vo.RoomOrderFeeVo;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
+import org.jeecg.modules.rooms.entity.CesRooms;
 
 import java.util.List;
 
@@ -26,4 +29,5 @@ public interface IBusOrderFeeService extends IService<BusOrderFee> {
     IPage<RoomOrderFeeVo> strikeBalancePage(Page<RoomOrderFeeVo> page, String roomName, Integer preferentialStatus,String bookingOrderId, DateTime startTime, DateTime endTime);
 
 
+    void addBillFee(BusRoomsLivingOrder livingOrder, CesRooms room, CesHouseLongRentScheme longRentScheme);
 }

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

@@ -13,6 +13,7 @@ import org.jeecg.modules.business.vo.*;
 import org.jeecg.modules.rooms.Vo.FloorBuildingRoomVo;
 import org.jeecg.modules.rooms.Vo.LivingContinueVo;
 import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
 import org.jeecg.modules.rooms.entity.CesRooms;
 
 import java.math.BigDecimal;
@@ -44,7 +45,7 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
     String batchOrderSave(BatchOrderSavaDto item);
 
     Boolean setBatchOrderStatus(BusBookingBatch batchOrder);
-    String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId,Boolean bookingLiving, BusRoomBookingOrders livingRoomOrderInfo);
+    String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId,Boolean bookingLiving, BusRoomBookingOrders livingRoomOrderInfo, CesHouseLongRentScheme longRentScheme);
 
     String customerLiving(BookingOrderSaveDto livingData, Boolean isTeam, String hotelId);
 

+ 75 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusOrderFeeServiceImpl.java

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.TokenUtils;
 import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.AgreementOrderStatusEnum;
@@ -22,8 +23,14 @@ import org.jeecg.modules.business.service.*;
 import org.jeecg.modules.business.vo.BusOrderFeeGoodsVo;
 import org.jeecg.modules.business.vo.RoomOrderFeeVo;
 import org.jeecg.modules.kc.entity.KcDepositoryInGoods;
+import org.jeecg.modules.rooms.Enum.ChargeTypeEnum;
 import org.jeecg.modules.rooms.entity.CesGoods;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
+import org.jeecg.modules.rooms.entity.CesRoomLayout;
+import org.jeecg.modules.rooms.entity.CesRooms;
 import org.jeecg.modules.rooms.service.CesGoodsServiceImpl;
+import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentSchemeService;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -59,6 +66,14 @@ public class BusOrderFeeServiceImpl extends ServiceImpl<BusOrderFeeMapper, BusOr
     IBusAgreementOrderFeeService agreementOrderFeeService;
     @Resource
     IBusRoomsLivingOrderService roomsLivingOrderService;
+    @Resource
+    CesRoomLayoutServiceImpl layoutService;
+    @Resource
+    private IBusLivingLayoutDayPriceService livingLayoutDayPriceService;
+    @Resource
+    private ICesHouseLongRentSchemeService longRentSchemeService;
+
+
 
     @Override
     public Boolean strikeBalance(List<BusOrderFee> busOrderFeeList) {
@@ -314,4 +329,64 @@ public class BusOrderFeeServiceImpl extends ServiceImpl<BusOrderFeeMapper, BusOr
         }
         return feePage;
     }
+
+    @Override
+    public void addBillFee(BusRoomsLivingOrder livingOrder, CesRooms room, CesHouseLongRentScheme longRentScheme) {
+        if (livingOrder.getLivingType() != 5){
+            BigDecimal money = new BigDecimal(0);
+            BusLivingLayoutDayPrice price = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>query()
+                    .eq("living_order_id", livingOrder.getId()).eq("day_time", DateUtils.formatDate(new Date())+" 00:00:00"));
+            if(price != null) {
+                money = price.getPrice();
+            } else {
+                CesRoomLayout layout = layoutService.getById(room.getLayoutId());
+                if(layout == null) throw new JeecgBootException("房价不存在");
+                money = layout.getMarketPrice();
+            }
+
+            BusOrderFee dayOrderFee = new BusOrderFee();
+            dayOrderFee.setDayTime(new Date());
+            dayOrderFee.setCreateTime(new Date());
+            dayOrderFee.setMoney(money);
+            dayOrderFee.setFeeType(1);
+            dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+            dayOrderFee.setRoomId(room.getId());
+            String roomName = room.getPrefix() != null? room.getPrefix():"";
+            roomName += roomName + room.getName();
+            dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDateTime() + " 当日房费");
+            dayOrderFee.setLivingOrderId(livingOrder.getId());
+            dayOrderFee.setHotelId(room.getHotelId());
+            save(dayOrderFee);
+        } else {
+            longRentSchemeService.addLivingScheme(longRentScheme, livingOrder.getId());
+            longRentScheme.getHouseLongRentChargeList().forEach(e -> {
+                if (!ChargeTypeEnum.DISPOSABLE.getKey().equals(e.getChargeType()) && !ChargeTypeEnum.PERIODICITY.getKey().equals(e.getChargeType())){
+                    return;
+                }
+                BusOrderFee dayOrderFee = new BusOrderFee();
+                dayOrderFee.setDayTime(new Date());
+                dayOrderFee.setCreateTime(new Date());
+                dayOrderFee.setRemark(e.getName());
+                String roomName = room.getPrefix() != null? room.getPrefix():"";
+                roomName += roomName + room.getName();
+                dayOrderFee.setMoney(e.getMoney());
+                dayOrderFee.setSubjectType(FeeSubjectType.OTHER.getKey());
+                if (e.getIsMust() != null && e.getIsMust()){
+                    dayOrderFee.setMoney(e.getMoney().multiply(BigDecimal.valueOf(e.getNum())));
+                    if (ChargeTypeEnum.DISPOSABLE.getKey().equals(e.getChargeType())){
+                        dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+                    } else {
+                        dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+                    }
+                    dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDateTime() + e.getName());
+                }
+                dayOrderFee.setFeeType(1);
+                dayOrderFee.setRoomId(room.getId());
+                dayOrderFee.setLivingOrderId(livingOrder.getId());
+                dayOrderFee.setHotelId(room.getHotelId());
+                save(dayOrderFee);
+            });
+        }
+
+    }
 }

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

@@ -16,7 +16,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
-import org.aspectj.weaver.ast.Var;
 import org.jeecg.common.api.dto.message.MessageDTO;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.exception.JeecgBootException;
@@ -175,6 +174,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
     @Resource
     private IBusHotelService busHotelService;
 
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
@@ -253,7 +253,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 }
             } else if(item.getLivingRoomDayPrices() != null && item.getLivingRoomDayPrices().size() > 0){
 
-            } else throw new JeecgBootException("客人信息不能为空");
+            } else if (item.getOrderInfo().getBookingType() == 5) {
+
+            }else throw new JeecgBootException("客人信息不能为空");
 
         // 【添加客人信息 end】
         // 散客预定
@@ -309,27 +311,30 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             }
             bookingRoomsService.saveBatch(bookingRooms);
 
-            // 处理预定每天的房型价格 Start
-            if(item.getLivingRoomDayPrices() != null && item.getLivingRoomDayPrices().size() > 0) {
-                if(item.getLivingRoomDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomId() == null))
-                    throw new JeecgBootException("参数错误,请传入价格、日期、房型");
-                // 入住之后在save
-            } else {
-                if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
-                    throw new JeecgBootException("参数错误,对应房型当天价格必传");
-                if(item.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
-                    throw new JeecgBootException("参数错误,请传入价格、日期、房型");
-                item.getLayoutDayPrices().forEach(g->{
-                    long roomCount = item.getRoomIds().stream().filter(e->e.getLayoutId().equals(g.getRoomLayoutId())).count();
-                    if(roomCount > 0) {
-                        g.setBookingOrderId(item.getOrderInfo().getId());
-                        g.setBookingType(BookingOrdersType.NORMAL.getKey());
-                    }
-                });
-                List<String> lList = item.getRoomIds().stream().map(w->w.getLayoutId()).collect(Collectors.toList());
-                dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(l->lList.contains(l.getRoomLayoutId())).collect(Collectors.toList()));
+            if (item.getOrderInfo().getBookingType() != 5){
+                // 处理预定每天的房型价格 Start
+                if(item.getLivingRoomDayPrices() != null && item.getLivingRoomDayPrices().size() > 0) {
+                    if(item.getLivingRoomDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomId() == null))
+                        throw new JeecgBootException("参数错误,请传入价格、日期、房型");
+                    // 入住之后在save
+                } else {
+                    if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
+                        throw new JeecgBootException("参数错误,对应房型当天价格必传");
+                    if(item.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
+                        throw new JeecgBootException("参数错误,请传入价格、日期、房型");
+                    item.getLayoutDayPrices().forEach(g->{
+                        long roomCount = item.getRoomIds().stream().filter(e->e.getLayoutId().equals(g.getRoomLayoutId())).count();
+                        if(roomCount > 0) {
+                            g.setBookingOrderId(item.getOrderInfo().getId());
+                            g.setBookingType(BookingOrdersType.NORMAL.getKey());
+                        }
+                    });
+                    List<String> lList = item.getRoomIds().stream().map(w->w.getLayoutId()).collect(Collectors.toList());
+                    dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(l->lList.contains(l.getRoomLayoutId())).collect(Collectors.toList()));
+                }
             }
 
+
             // 处理预定每天的房型价格 End
 
             // 预约时不添加联房和团队标识,入住时才添加
@@ -1023,7 +1028,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId, Boolean bookingLiving, BusRoomBookingOrders livingRoomOrderInfo) {
+    public String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId, Boolean bookingLiving,
+                                BusRoomBookingOrders livingRoomOrderInfo, CesHouseLongRentScheme longRentScheme) {
         BusBookingRooms bkRoom = bookingRoomsService.getById(bookingRoomId);
         if(bkRoom == null) throw  new JeecgBootException("关联房间不存在");
         BusRoomBookingOrders bookingOrders = getById(bkRoom.getBookingOrdersId());
@@ -1121,33 +1127,11 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
          //</editor-fold>
 
         //<editor-fold desc="todo:账单相关">
-        if(bookingLiving != null && bookingLiving) {
-            BigDecimal money = new BigDecimal(0);
-            BusLivingLayoutDayPrice  price = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>query()
-                    .eq("living_order_id", livingOrder.getId()).eq("day_time",DateUtils.formatDate(new Date())+" 00:00:00"));
-            if(price != null) {
-                money = price.getPrice();
-            } else {
-                CesRoomLayout layout = layoutService.getById(room.getLayoutId());
-                if(layout == null) throw new JeecgBootException("房价不存在");
-                money = layout.getMarketPrice();
-            }
+//        if(bookingLiving != null && bookingLiving) {
 
-            BusOrderFee dayOrderFee = new BusOrderFee();
-            dayOrderFee.setDayTime(new Date());
-            dayOrderFee.setCreateTime(new Date());
-            dayOrderFee.setMoney(money);
-            dayOrderFee.setFeeType(1);
-            dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
-            CesRooms orderRoom = room;
-            dayOrderFee.setRoomId(orderRoom.getId());
-            String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
-            roomName += roomName + orderRoom.getName();
-            dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDateTime() + " 当日房费");
-            dayOrderFee.setLivingOrderId(livingOrder.getId());
-            dayOrderFee.setHotelId(hotelId);
-            feeService.save(dayOrderFee);
-        }
+        feeService.addBillFee(livingOrder, room,longRentScheme);
+
+//        }
 
         /*添加消息通知*/
         BusHotel busHotel = busHotelService.getById(room.getHotelId());
@@ -1175,9 +1159,13 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         if(ObjectUtils.isEmpty(cesAllDayPriceRule)) {
             throw new JeecgBootException("未找到超时收费规则");
         }
-        Calendar calendar = getRemindTime(livingOrder, cesAllDayPriceRule, livingRoomOrderInfo.getBookingType());
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        redisTemplate.opsForZSet().add("overTimerOrder", livingOrder.getId(), calendar.getTimeInMillis());
+        if (livingOrder.getLivingType() != 5){
+            Calendar calendar = getRemindTime(livingOrder, cesAllDayPriceRule, livingRoomOrderInfo.getBookingType());
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+            redisTemplate.opsForZSet().add("overTimerOrder", livingOrder.getId(), calendar.getTimeInMillis());
+        } else {
+
+        }
         roomsService.getReserveRoom();
         //</editor-fold>
         return livingOrder.getId();
@@ -1365,7 +1353,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
     private Map<String, BigDecimal> getRoomOrderFees(String livingOrderId) {
         List<BusOrderFee> fees = feeService.list(Wrappers.<BusOrderFee>query()
-        .eq("living_order_id",livingOrderId).eq("preferential_status",1));
+        .eq("living_order_id",livingOrderId));
         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());
         List<BusOrderFee> depositList = shoukuanList.stream().filter(s->ObjectUtil.equals(s.getSubjectType(),"1")).collect(Collectors.toList());
@@ -1836,7 +1824,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         nextCalendar.setTime(livingOrder.getDueOutTime());
         nextCalendar.set(Calendar.YEAR, nowCalendar.get(Calendar.YEAR));
         nextCalendar.set(Calendar.MONTH, nowCalendar.get(Calendar.MONTH));
-        nextCalendar.set(Calendar.DAY_OF_MONTH, nowCalendar.get(Calendar.YEAR));
+        nextCalendar.set(Calendar.DAY_OF_MONTH, nowCalendar.get(Calendar.DAY_OF_MONTH));
         nextCalendar.add(Calendar.DAY_OF_YEAR,1);
         // 修改预离时间
         if(nextCalendar.getTime().compareTo(livingOrder.getDueOutTime()) > 0){
@@ -2377,7 +2365,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         livingCustomer.setId(null);
         livingCustomer.setLivingOrderId(null);
         customers.add(livingCustomer);
-        String livingOrderId = bookingToLive(bookingRooms.getId(), customers,hotelId,null,null);
+        String livingOrderId = bookingToLive(bookingRooms.getId(), customers,hotelId,null,null, null);
 
         return true;
     }
@@ -3177,8 +3165,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             BookingLayoutRoomsDto bkRoomItem = livingData.getRoomIds().stream().filter(s->s.getRoomId().equals(bkRoom.getRoomId())).findFirst().get();
             List<BusLivingCustomer> customers = bkRoomItem.getLivingCustomers();
             if(customers == null || customers.isEmpty()) throw new JeecgBootException("请添加客户信息");
+
             // 保存入住单,修改房间状态
-            String livingOrderId = bookingToLive(bkRoom.getId(), customers,hotelId,null, bkRoomItem.getRoomOrderInfo());
+            String livingOrderId = bookingToLive(bkRoom.getId(), customers,hotelId,null, bkRoomItem.getRoomOrderInfo(),bkRoomItem.getLongRentScheme());
             // 将预约时交的押金,放到主房
             if (bkRoom.getIsMain()){
                 LambdaUpdateWrapper<BusOrderFee> updateWrapper = new LambdaUpdateWrapper<>();
@@ -3189,6 +3178,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 updateWrapper.isNull(BusOrderFee::getLivingOrderId);
                 feeService.update(updateWrapper);
             }
+
             // 费用关联到主房
             if(livingData.getOrderFees()!=null && !livingData.getOrderFees().isEmpty()) {
                 List<BusOrderFee> findRoomFees = livingData.getOrderFees().stream().filter(t->t.getRoomId().equals(bkRoom.getRoomId())).collect(Collectors.toList());
@@ -3252,21 +3242,22 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 //                });
                 feeService.collectionBatch(findRoomFees, hotelId);
             }
+
             // 另外每个房间还要在入住时生成每日房费账单
-            BusOrderFee roomFee = new BusOrderFee();
-            roomFee.setRoomId(bkRoom.getRoomId());
-            roomFee.setLivingOrderId(livingOrderId);
-            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("未找到当日房价");
-            roomFee.setMoney(dayRoomFee); // 取当日房费的优惠价  其他时间要查询房价方案、每日房价,房型门市价按照规则去取
-            roomFee.setCreateTime(new Date());
-            roomFee.setDayTime(new Date());
-            roomFee.setHotelId(hotelId);
-            roomFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
-            feeService.save(roomFee);
+//            BusOrderFee roomFee = new BusOrderFee();
+//            roomFee.setRoomId(bkRoom.getRoomId());
+//            roomFee.setLivingOrderId(livingOrderId);
+//            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("未找到当日房价");
+//            roomFee.setMoney(dayRoomFee); // 取当日房费的优惠价  其他时间要查询房价方案、每日房价,房型门市价按照规则去取
+//            roomFee.setCreateTime(new Date());
+//            roomFee.setDayTime(new Date());
+//            roomFee.setHotelId(hotelId);
+//            roomFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+//            feeService.save(roomFee);
             results.put(bkRoom.getRoomId(),livingOrderId);
         });
         return results;

+ 1 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/ExtendBusBookingRoomsVo.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.business.vo;
 import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
 
 import java.util.List;
 

+ 55 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/Enum/ChargeTypeEnum.java

@@ -0,0 +1,55 @@
+package org.jeecg.modules.rooms.Enum;
+
+import org.jeecg.common.system.vo.DictModel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public enum ChargeTypeEnum {
+    DISPOSABLE(1,"一次性"),
+    PERIODICITY(2,"周期性"),
+    WATER(3,"水费"),
+    ELECTRIC(4,"电费"),
+    GAS(5,"燃气费");
+
+    Integer key;
+
+    String title;
+
+    ChargeTypeEnum(Integer key, String title){
+        this.key = key;
+        this.title = title;
+    }
+    public Integer getKey() {
+        return key;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * 获取字典数据
+     * @return
+     */
+    public static List<DictModel> getDictList(){
+        List<DictModel> list = new ArrayList<>();
+        DictModel dictModel = null;
+        for(ChargeTypeEnum e: ChargeTypeEnum.values()){
+            dictModel = new DictModel();
+            dictModel.setValue(e.key.toString());
+            dictModel.setText(e.title);
+            list.add(dictModel);
+        }
+        return list;
+    }
+
+    public static ChargeTypeEnum val(Integer key){
+        for(ChargeTypeEnum bld: values()){
+            if(bld.key .equals(key)){
+                return bld;
+            }
+        }
+        return null;
+    }
+}

+ 4 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesHouseLongRentChargesController.java

@@ -0,0 +1,4 @@
+package org.jeecg.modules.rooms.controller;
+
+public class CesHouseLongRentChargesController {
+}

+ 75 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesHouseLongRentSchemeController.java

@@ -0,0 +1,75 @@
+package org.jeecg.modules.rooms.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentCharge;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentChargeService;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentSchemeService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RestController
+@RequestMapping("/rooms/cesHouseLongRentScheme")
+@Api(tags = "ces_hour_room_rule")
+@Slf4j
+public class CesHouseLongRentSchemeController extends JeecgController<CesHouseLongRentScheme, ICesHouseLongRentSchemeService> {
+
+    @Resource
+    private ICesHouseLongRentChargeService houseLongRentChargeService;
+
+    @AutoLog(value = "新增房价方案")
+    @ApiOperation(value="新增房价方案", notes="新增房价方案")
+    @PostMapping(value = "/add")
+    public Result<Boolean> add(@RequestBody CesHouseLongRentScheme scheme){
+        boolean isSuccess = service.save(scheme);
+        if (isSuccess && CollUtil.isNotEmpty(scheme.getHouseLongRentChargeList())){
+            scheme.getHouseLongRentChargeList().forEach(e -> e.setSchemeId(scheme.getId()));
+            isSuccess = houseLongRentChargeService.saveBatch(scheme.getHouseLongRentChargeList());
+        }
+        return isSuccess ? Result.ok("新增成功") : Result.error("新增失败");
+    }
+
+    @AutoLog(value = "修改房价方案")
+    @ApiOperation(value="修改房价方案", notes="修改房价方案")
+    @Transactional(rollbackFor = Exception.class)
+    @PostMapping(value = "/edit")
+    public Result<Boolean> edit(@RequestBody CesHouseLongRentScheme scheme){
+        if (StrUtil.isEmpty(scheme.getId())){
+            Result.error("未找到要修改的方案");
+        }
+        service.updateById(scheme);
+        houseLongRentChargeService.remove(Wrappers.<CesHouseLongRentCharge>lambdaQuery().eq(CesHouseLongRentCharge::getSchemeId,scheme.getId()));
+        if (CollUtil.isNotEmpty(scheme.getHouseLongRentChargeList())){
+            scheme.getHouseLongRentChargeList().forEach(e -> e.setSchemeId(scheme.getId()));
+            houseLongRentChargeService.saveBatch(scheme.getHouseLongRentChargeList());
+        }
+        return Result.ok("修改成功");
+    }
+
+    @AutoLog(value = "新增房价方案")
+    @ApiOperation(value="新增房价方案", notes="新增房价方案")
+    @GetMapping(value = "/page")
+    public Result<Page<CesHouseLongRentScheme>> page(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                     @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
+        Page<CesHouseLongRentScheme> page = new Page<>(pageNo, pageSize);
+        Page<CesHouseLongRentScheme> houseLongRentSchemePage = service.page(page);
+        houseLongRentSchemePage.getRecords().forEach(e -> {
+            List<CesHouseLongRentCharge> list = houseLongRentChargeService.list(Wrappers.<CesHouseLongRentCharge>lambdaQuery()
+                    .eq(CesHouseLongRentCharge::getSchemeId, e.getId()).isNull(CesHouseLongRentCharge::getLivingOrderId));
+            e.setHouseLongRentChargeList(list);
+        });
+        return Result.ok(houseLongRentSchemePage);
+    }
+}

+ 48 - 22
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesHousePriceSchemeController.java

@@ -1,6 +1,9 @@
 package org.jeecg.modules.rooms.controller;
 
 
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -23,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.time.format.DateTimeFormatter;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -67,6 +71,31 @@ public class CesHousePriceSchemeController extends JeecgController<CesHousePrice
         }
     }
 
+
+    @ApiOperation(value="房价方案查询", notes="房价方案查询")
+    @GetMapping(value = "/findAcquiesceScheme")
+    public Result<CesHousePriceScheme> findAcquiesceScheme(Integer type, String hotelId){
+        if (ObjectUtil.isEmpty(type) || StrUtil.isEmpty(hotelId)){
+            return Result.error("参数异常");
+        }
+        CesHousePriceScheme scheme = cesHousePriceSchemeService.getOne(Wrappers.<CesHousePriceScheme>lambdaQuery()
+                .eq(CesHousePriceScheme::getType, type).eq(CesHousePriceScheme::getHotelId, hotelId).last("limit 1"));
+        if (scheme == null){
+            return Result.error("参数异常");
+        }
+//        String _checkText = scheme.getCheckInTime() == 0?"无限制":(scheme.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))+" - "
+//                +scheme.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+//        scheme.setCheckInTimeText(_checkText);
+//        String _validText = scheme.getValidTime() == 0?"无限制":(scheme.getValidStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))+" - "
+//                +scheme.getValidEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+//        scheme.setValidTimeText(_validText);
+        try{
+            return Result.ok(scheme);
+        }catch (Exception e){
+            return Result.error(e.getMessage());
+        }
+    }
+
     @ApiOperation(value="房价方案查询", notes="房价方案查询")
     @GetMapping(value = "/listEnum")
     public Result listEnum(CesHousePriceSchemeSearchDto dto){
@@ -107,15 +136,12 @@ public class CesHousePriceSchemeController extends JeecgController<CesHousePrice
 //        if (StringUtils.isBlank(dto.getSimpleCode())){
 //            return Result.error(ResultCode.PARAM_MISS);
 //        }
-        if (StringUtils.isBlank(dto.getNumber())){
-            return Result.error(ResultCode.PARAM_MISS);
-        }
-        if (null==dto.getGuestSource()){
-            return Result.error(ResultCode.PARAM_MISS);
-        }
-        if (null==dto.getGuestType()){
-            return Result.error(ResultCode.PARAM_MISS);
-        }
+//        if (StringUtils.isBlank(dto.getNumber())){
+//            return Result.error(ResultCode.PARAM_MISS);
+//        }
+//        if (null==dto.getGuestType()){
+//            return Result.error(ResultCode.PARAM_MISS);
+//        }
         if (null==dto.getCheckInTime()){
             return Result.error(ResultCode.PARAM_MISS);
         }else{
@@ -137,9 +163,9 @@ public class CesHousePriceSchemeController extends JeecgController<CesHousePrice
         if (null==dto.getOpen()||(0!=dto.getOpen().intValue()&&1!=dto.getOpen().intValue())){
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if (null==dto.getSort()||1>dto.getSort().intValue()){
-            return Result.error("排序不能为空且不能小于1!");
-        }
+//        if (null==dto.getSort()||1>dto.getSort().intValue()){
+//            return Result.error("排序不能为空且不能小于1!");
+//        }
         if(CustomerTypeEnum.val(dto.getGuestType()) == null){
             throw new JeecgBootException("客人类型不正确");
         }
@@ -171,12 +197,12 @@ public class CesHousePriceSchemeController extends JeecgController<CesHousePrice
 //        if (StringUtils.isBlank(dto.getSimpleCode())){
 //            return Result.error(ResultCode.PARAM_MISS);
 //        }
-        if (StringUtils.isBlank(dto.getNumber())){
-            return Result.error(ResultCode.PARAM_MISS);
-        }
-        if (null==dto.getGuestSource()){
-            return Result.error(ResultCode.PARAM_MISS);
-        }
+//        if (dto.getType() == 3 && StringUtils.isBlank(dto.getNumber())){
+//            return Result.error(ResultCode.PARAM_MISS);
+//        }
+//        if (null==dto.getGuestSource()){
+//            return Result.error(ResultCode.PARAM_MISS);
+//        }
         if (null==dto.getGuestType()){
             return Result.error(ResultCode.PARAM_MISS);
         }
@@ -201,10 +227,10 @@ public class CesHousePriceSchemeController extends JeecgController<CesHousePrice
         if (null==dto.getOpen()||(0!=dto.getOpen().intValue()&&1!=dto.getOpen().intValue())){
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if (null==dto.getSort()||1>dto.getSort().intValue()){
-            return Result.error("排序不能为空且不能小于1!");
-        }
-        if(CustomerTypeEnum.val(dto.getGuestType()) == null){
+//        if (dto.getType() == 3 && (null==dto.getSort()||1>dto.getSort().intValue())){
+//            return Result.error("排序不能为空且不能小于1!");
+//        }
+        if(dto.getType() == 3 && CustomerTypeEnum.val(dto.getGuestType()) == null){
             throw new JeecgBootException("客人类型不正确");
         }
         try{

+ 51 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesHouseLongRentCharge.java

@@ -0,0 +1,51 @@
+package org.jeecg.modules.rooms.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@TableName("ces_house_long_rent_charge")
+@Data
+public class CesHouseLongRentCharge {
+
+    private String id;
+
+    /**方案id*/
+    private String schemeId;
+
+    /**方案id*/
+    private String livingOrderId;
+
+    /**收费类型 1一次性 2 周期性 3 水费 4 电费 5 燃气费*/
+    private Integer chargeType;
+
+    /**费项名称*/
+    private String name;
+
+    /**金额*/
+    private BigDecimal money;
+
+    /**周期单位 1月 2季 3年*/
+    private Integer cycleUnit;
+
+    /**周期数 */
+    private Integer cycleNum;
+
+    /**创建时间*/
+    private Date createTime;
+
+    /**修改时间*/
+    private Date updateTime;
+
+    /**压付数量*/
+    private Integer num;
+
+    /**押金或租金*/
+    private Boolean isMust;
+
+    /**是自定义押金*/
+    private Boolean isDepositCustom;
+
+}

+ 35 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesHouseLongRentScheme.java

@@ -0,0 +1,35 @@
+package org.jeecg.modules.rooms.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+@TableName("ces_house_long_rent_scheme")
+@Data
+public class CesHouseLongRentScheme {
+
+    private String id;
+    private String name;
+    private String hotelId;
+    private Integer state;
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "修改")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private List<CesHouseLongRentCharge> houseLongRentChargeList;
+
+
+}

+ 17 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesHousePriceScheme.java

@@ -3,12 +3,15 @@ package org.jeecg.modules.rooms.entity;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 
 /**
  * <p>
@@ -51,7 +54,7 @@ public class CesHousePriceScheme extends Model<CesHousePriceScheme> {
     /**
      * 客人来源
      */
-    private String guestSource;
+//    private String guestSource;
 
     /**
      * 客人类型
@@ -81,12 +84,16 @@ public class CesHousePriceScheme extends Model<CesHousePriceScheme> {
     /**
      * 入住开始时间
      */
-    private LocalDateTime startTime;
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm")
+    @DateTimeFormat(pattern="HH:mm")
+    private LocalTime startTime;
 
     /**
      * 入住结束时间
      */
-    private LocalDateTime endTime;
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm")
+    @DateTimeFormat(pattern="HH:mm")
+    private LocalTime endTime;
 
     /**
      * 周末假日(1代表星期一,2代表星期二直到星期日以此类推)
@@ -124,6 +131,11 @@ public class CesHousePriceScheme extends Model<CesHousePriceScheme> {
     private Integer sort;
 
     /**
+     * 类型 1 周末 2节假日 3 特殊
+     */
+    private Integer type;
+
+    /**
      * 创建时间
      */
     @TableField("createAt")
@@ -187,6 +199,8 @@ public class CesHousePriceScheme extends Model<CesHousePriceScheme> {
 
     public static final String INVALID = "invalid";
 
+    public static final String TYPE = "type";
+
     @Override
     public Serializable pkVal() {
         return this.id;

+ 7 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/mapper/CesHouseLongRentChargeMapper.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.rooms.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentCharge;
+
+public interface CesHouseLongRentChargeMapper extends BaseMapper<CesHouseLongRentCharge> {
+}

+ 7 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/mapper/CesHouseLongRentSchemeMapper.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.rooms.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
+
+public interface CesHouseLongRentSchemeMapper extends BaseMapper<CesHouseLongRentScheme> {
+}

+ 6 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesHousePriceSchemeServiceImpl.java

@@ -78,6 +78,7 @@ public class CesHousePriceSchemeServiceImpl extends ServiceImpl<CesHousePriceSch
                     .or()
                     .like(CesHousePriceScheme.NUMBER, CommonUtils.escapeChar(dto.getParamName())));
         }
+        queryWrapper.eq(CesHousePriceScheme.TYPE,3);
         queryWrapper.eq(CesHousePriceScheme.INVALID,false);
         queryWrapper.orderByAsc(CesHousePriceScheme.SORT);
         IPage<CesHousePriceScheme> dataPage = cesHousePriceSchemeMapper.selectPage(new Page<>(dto.getPageNo().intValue(),dto.getPageSize().intValue()),queryWrapper);
@@ -92,8 +93,8 @@ public class CesHousePriceSchemeServiceImpl extends ServiceImpl<CesHousePriceSch
 
             DateFormat startDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-            String _checkText = vo.getCheckInTime() == 0?"无限制":(vo.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))+" - "
-                    +vo.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+            String _checkText = vo.getCheckInTime() == 0?"无限制":(vo.getStartTime().format(DateTimeFormatter.ofPattern("HH:mm"))+" - "
+                    +vo.getEndTime().format(DateTimeFormatter.ofPattern("HH:mm")));
             vo.setCheckInTimeText(_checkText);
             String _validText = vo.getValidTime() == 0?"无限制":(vo.getValidStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))+" - "
                     +vo.getValidEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -114,8 +115,9 @@ public class CesHousePriceSchemeServiceImpl extends ServiceImpl<CesHousePriceSch
         QueryWrapper<CesHousePriceScheme> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq(CesHousePriceScheme.HOTEL_ID,dto.getHotelId());
         queryWrapper.eq(CesHousePriceScheme.INVALID,false);
-        queryWrapper.ge(CesHousePriceScheme.VALID_START_TIME, LocalTime.now());
-        queryWrapper.le(CesHousePriceScheme.VALID_END_TIME, LocalDate.now());
+        queryWrapper.eq(CesHousePriceScheme.TYPE,3);
+        queryWrapper.and(e -> e.ge(CesHousePriceScheme.VALID_START_TIME, LocalDate.now())
+                .le(CesHousePriceScheme.VALID_END_TIME, LocalDate.now()).or().eq(CesHousePriceScheme.VALID_TIME, 0));
         queryWrapper.orderByAsc(CesHousePriceScheme.SORT);
         List<CesHousePriceScheme> cesHousePriceSchemes = cesHousePriceSchemeMapper.selectList(queryWrapper);
         List<String> idList = cesHousePriceSchemes.stream().map(CesHousePriceScheme :: getId).collect(Collectors.toList());

+ 7 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/ICesHouseLongRentChargeService.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.rooms.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentCharge;
+
+public interface ICesHouseLongRentChargeService extends IService<CesHouseLongRentCharge> {
+}

+ 8 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/ICesHouseLongRentSchemeService.java

@@ -0,0 +1,8 @@
+package org.jeecg.modules.rooms.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
+
+public interface ICesHouseLongRentSchemeService  extends IService<CesHouseLongRentScheme> {
+    void addLivingScheme(CesHouseLongRentScheme scheme, String livingOrderId);
+}

+ 11 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/impl/CesHouseLongRentChargeServiceImpl.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.rooms.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentCharge;
+import org.jeecg.modules.rooms.mapper.CesHouseLongRentChargeMapper;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentChargeService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CesHouseLongRentChargeServiceImpl extends ServiceImpl<CesHouseLongRentChargeMapper, CesHouseLongRentCharge> implements ICesHouseLongRentChargeService {
+}

+ 32 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/impl/CesHouseLongRentSchemeServiceImpl.java

@@ -0,0 +1,32 @@
+package org.jeecg.modules.rooms.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
+import org.jeecg.modules.rooms.mapper.CesHouseLongRentSchemeMapper;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentChargeService;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentSchemeService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class CesHouseLongRentSchemeServiceImpl extends ServiceImpl<CesHouseLongRentSchemeMapper, CesHouseLongRentScheme> implements ICesHouseLongRentSchemeService {
+
+    @Resource
+    private ICesHouseLongRentChargeService houseLongRentChargeService;
+
+    @Override
+    public void addLivingScheme(CesHouseLongRentScheme scheme,String livingOrderId) {
+        if (scheme == null || StrUtil.isEmpty(scheme.getId())) {
+            throw new JeecgBootException("请选择长租房方案");
+        }
+        scheme.getHouseLongRentChargeList().forEach(e -> {
+            e.setId(null);
+            e.setSchemeId(scheme.getId());
+            e.setLivingOrderId(livingOrderId);
+        });
+        houseLongRentChargeService.saveBatch(scheme.getHouseLongRentChargeList());
+    }
+}