Browse Source

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

gqx 2 years ago
parent
commit
e8d2ca37e2

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

@@ -359,8 +359,8 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	  */
 	 @ApiOperation(value="酒店预定订单-获取入住订单", notes="酒店预定订单-获取入住订单")
 	 @RequestMapping(value = "/living-orders",method = RequestMethod.GET)
-	 public Result<IPage<RoomLivingQueryVo>> livingOrders(Page<RoomLivingQueryVo> page, String keyw, Integer status){
-		 return Result.OK(service.getLivingPageData(status,keyw,page));
+	 public Result<IPage<RoomLivingQueryVo>> livingOrders(Page<RoomLivingQueryVo> page, String keyw, Integer status,String hotelId){
+		 return Result.OK(service.getLivingPageData(status,keyw,page,hotelId));
 	 }
 
 	 /**
@@ -460,6 +460,17 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 		 return Result.OK(service.updateOrderPrice(info));
 	 }
 
+	 /**
+	  * 同步房间ORDER
+	  * @return
+	  */
+	 @ApiOperation(value="酒店预定订单-同步房间ORDER", notes="酒店预定订单-同步房间ORDER")
+	 @RequestMapping(value = "/sync-order-status",method = RequestMethod.GET)
+	 public  Result syncLivingOrderStatus() {
+	 	service.syncDayOrderFee();
+	 	return Result.OK();
+	 }
+
 
 
 

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusRoomBookingOrdersMapper.java

@@ -27,7 +27,7 @@ public interface BusRoomBookingOrdersMapper extends BaseMapper<BusRoomBookingOrd
             @Param("endAt") Date endAt,
             @Param("roomIds") List<String> roomIds);
 
-    IPage<RoomLivingQueryVo> getPage(IPage<RoomLivingQueryVo> page,Integer status, String keyw);
+    IPage<RoomLivingQueryVo> getPage(IPage<RoomLivingQueryVo> page,Integer status, String keyw,String hotelId);
 
     List<ForwardFangTaiQueryVo> forwardFangTaiQuery(String hotelId,
                                                     String start,

+ 5 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusRoomBookingOrdersMapper.xml

@@ -69,11 +69,13 @@
         o.id,
         f.fee_type
         ) AS t ON t.id = o.id
-
-        GROUP BY o.id,tb.living_order_id,rm.id,tb.customer_id,tb.customer_name
+        where o.hotel_id = #{hotelId}
         <if test="keyw != null and keyw != ''">
-            where (o.living_order_no like '%#{keyw}%' or rm.`name` like '%#{keyw}%' or tb.customer_name like '%#{keyw}%')
+            and (o.living_order_no like '%#{keyw}%' or rm.`name` like '%#{keyw}%' or tb.customer_name like '%#{keyw}%')
         </if>
+        GROUP BY o.id,tb.living_order_id,rm.id,tb.customer_id,tb.customer_name
+
+
     </select>
 
     <select id="forwardFangTaiQuery" resultType="org.jeecg.modules.business.vo.ForwardFangTaiQueryVo">

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

@@ -58,7 +58,7 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
     Boolean splitLiving(String livingOrderId);
     Boolean leaveNotSettle(String bookingOrderId, String livingOrderId);
 
-    IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page);
+    IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page,String hotelId);
     IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId, Page<KeLiItemVo> page);
     IPage<KeLiItemVo> getBookingOrderKL(Integer status,String keyw,String hotelId, Page<KeLiItemVo> page);
     Boolean setLivingOrderFee(List<BusOrderFee> fees,String livingOrderId,String hotelId);

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

@@ -19,6 +19,8 @@ import org.jeecg.modules.business.entity.BusHotel;
 import org.jeecg.modules.business.entity.BusRoomPayType;
 import org.jeecg.modules.business.mapper.BusHotelMapper;
 import org.jeecg.modules.business.service.IBusHotelService;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.service.CesAllDayPriceRuleServiceImpl;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.mapper.SysUserMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,9 +46,21 @@ public class BusHotelServiceImpl extends ServiceImpl<BusHotelMapper, BusHotel> i
     @Resource
     private BusHotelMapper busHotelMapper;
 
+    @Resource
+    private CesAllDayPriceRuleServiceImpl allDayPriceRuleService;
+
     @Override
     public Result<?> hotelCheck(BusHotel busHotel) {
 
+        CesAllDayPriceRule findRule = allDayPriceRuleService.getOne(Wrappers.<CesAllDayPriceRule>query()
+        .eq("hotel_id",busHotel.getId()));
+        // 审核酒店通过时,添加默认的全天放计费规则
+        if(findRule == null && busHotel.getCheckStatus().equals(1)) {
+            findRule = allDayPriceRuleService.defaultRule();
+            findRule.setHotelId(busHotel.getId());
+            findRule.setInvalid(false);
+            allDayPriceRuleService.save(findRule);
+        }
 //        this.busHotelMapper.updateById(busHotel);
         this.busHotelMapper.update(busHotel, new LambdaQueryWrapper<BusHotel>().eq(BusHotel::getId, busHotel.getId()));
         return Result.ok("信息审核成功!");

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

@@ -1282,8 +1282,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
     }
 
     @Override
-    public IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page) {
-        return baseMapper.getPage(page,status,keyw);
+    public IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page,String hotelId) {
+        return baseMapper.getPage(page,status,keyw,hotelId);
     }
     @Override
     public IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId, Page<KeLiItemVo> page) {
@@ -1674,12 +1674,21 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         List<BusLivingLayoutDayPrice> dayPrices = livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query()
                 .eq("living_order_id",order.getId()).eq("booking_room_id",order.getBookingRoomId()));
         List<BusOrderFee> dayFees = feeService.list(Wrappers.<BusOrderFee>query()
-                .eq("living_order_id",order.getId()).eq("room_id",room.getId()).eq("subject_type",FeeSubjectType.MEI_RI_FANG_FEI.getKey()));
+                .eq("living_order_id",order.getId()).eq("room_id",room.getId()).and(
+                        c->c.eq("subject_type",FeeSubjectType.MEI_RI_FANG_FEI.getKey()).or().eq("subject_type",FeeSubjectType.YE_SHEN_FANG_FEI.getKey())
+                ));
 
         // 如果预离时间小于当天 全天房退房时间,默认16:00,则根据全天规则续房为全天房
         if(order.getDueOutTime().getTime() < DateUtils.parseDate(DateUtils.formatDate(new Date())+" " + allDayRule.getEndTime(),"yyyy-MM-dd") .getTime()) {
             Date orderLeave = order.getDueOutTime();
-//            orderLeave.
+            Calendar calendar = new GregorianCalendar();
+            calendar.setTime(orderLeave);
+            // 把日期往后增加一天,整数  往后推,负数往前移动
+            calendar.add(Calendar.DATE, 1);
+            // 这个时间就是日期往后推一天的结果
+            orderLeave = calendar.getTime();
+            order.setDueOutTime(orderLeave);
+            roomsLivingOrderService.updateById(order);
         }
         dayStrs.forEach(s->{
             Optional<BusLivingLayoutDayPrice> opPrice = dayPrices.stream().filter(a-> DateUtils.formatDate(a.getDayTime()).equals(s)).findFirst();
@@ -1695,6 +1704,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 nPrice.setRoomLayoutId(room.getLayoutId());
                 nPrice.setPrice(layout.getMarketPrice());
                 nPrice.setLivingOrderId(order.getId());
+                nPrice.setLivingType(order.getLivingType());
+
                 livingLayoutDayPriceService.save(nPrice);
             }
             Optional<BusOrderFee> opFee = dayFees.stream().filter(a->DateUtils.formatDate(a.getDayTime()).equals(s)).findFirst();
@@ -1716,7 +1727,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 nFee.setPreferentialStatus(1);
                 nFee.setLivingOrderId(order.getId());
                 try {
-                    if(DateUtils.parseDate(s,"yyyy-MM-dd").getTime() < new Date().getTime()) {
+                    if(DateUtils.parseDate(s,"yyyy-MM-dd").getTime() < DateUtils.parseDate(DateUtils.formatDate(new Date()),"yyyy-MM-dd").getTime()) {
                         nFee.setCustorerOrderRemark("夜审房费");
                         nFee.setSubjectType(FeeSubjectType.YE_SHEN_FANG_FEI.getKey());
                     }

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/test/Test.java

@@ -14,7 +14,7 @@ public class Test {
         Calendar calendar = new GregorianCalendar();
         calendar.setTime(date);
         // 把日期往后增加一天,整数  往后推,负数往前移动
-        calendar.add(Calendar.DATE, 1);
+        calendar.add(Calendar.MONTH, 1);
         // 这个时间就是日期往后推一天的结果
         date = calendar.getTime();
         System.out.println(DateUtils.formatDate(date));

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

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import javax.transaction.Transactional;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
@@ -70,6 +71,20 @@ public class CesAllDayPriceRuleServiceImpl extends ServiceImpl<CesAllDayPriceRul
         return Result.ok("成功!");
     }
 
+    public CesAllDayPriceRule defaultRule() {
+        CesAllDayPriceRule d = new CesAllDayPriceRule();
+        d.setEndTime("14:00");
+        d.setLeaveTime("12:00");
+        d.setDayTime("10");
+        d.setMinute(10);
+        d.setMoreThenMinute(30);
+        d.setMoreThenPrice(new BigDecimal(3));
+        d.setPrice(new BigDecimal(5));
+        d.setRuleType(1);
+        d.setTimeOutRule(1);
+        return d;
+    }
+
 
     /**
      * 查询