소스 검색

提交信息

覃浩 2 년 전
부모
커밋
17937aa645

+ 7 - 1
jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -575,7 +575,13 @@ public class DateUtils extends PropertyEditorSupport {
         cal.add(Calendar.DATE, amount);
         return formatDate(cal);
     }
-
+    public static Date formatAddDateMin(Date orgDate, int amount) {
+        Date date = orgDate;
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MINUTE, amount);
+        return cal.getTime();
+    }
     /**
      * 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
      *

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

@@ -12,5 +12,19 @@ public class UpdateOrderInfoDto {
     private String customerSource;
     private String remark;
     private String warranter;
+    // 钟点房方案id 麻痹 会死 操ni玛 狗日滴~,该你麻痹,狗东西,看不到头,加你吗的自定义逻辑,想他妈比砍死你~~
+    private String fangAnId;
+    // 入住类型
+    private Integer liveType;
+    // 修改入住类型时携带的每天的房价
+    private UpdateOrderPriceDto prices;
+    // 早餐数量
+    private Integer brkfstNum;
+    // 中参数
+    private Integer lchNum;
+    // 晚餐数
+    private Integer dnrNum;
+
+
 
 }

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

@@ -32,14 +32,8 @@ import org.jeecg.modules.rooms.Enum.RoomStatusEnum;
 import org.jeecg.modules.rooms.Vo.BookingRealtimeVo;
 import org.jeecg.modules.rooms.Vo.FloorBuildingRoomVo;
 import org.jeecg.modules.rooms.Vo.LivingRealtimeVo;
-import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
-import org.jeecg.modules.rooms.entity.CesRoomBuildingFloor;
-import org.jeecg.modules.rooms.entity.CesRoomLayout;
-import org.jeecg.modules.rooms.entity.CesRooms;
-import org.jeecg.modules.rooms.service.CesAllDayPriceRuleServiceImpl;
-import org.jeecg.modules.rooms.service.CesRoomBuildingFloorServiceImpl;
-import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
-import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
+import org.jeecg.modules.rooms.entity.*;
+import org.jeecg.modules.rooms.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -131,6 +125,10 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
     @Resource
     private IFwRoomExamineService fwRoomExamineService;
+
+    @Resource
+    private CesHourRoomRuleServiceImpl hourRoomRuleService;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
@@ -1693,6 +1691,37 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 updateById(order);
                 return true;
             }
+
+            if(info.getLiveType() != null && info.getLiveType().equals(2)){
+                if(info.getFangAnId() != null && !info.getFangAnId().isEmpty()) {
+                    CesHourRoomRule hourRoomRule = hourRoomRuleService.getById(info.getFangAnId());
+                    Integer timeMins = hourRoomRule.getAfterOpenRoom();// 分钟
+                    Date targetTime = DateUtils.formatAddDateMin(order.getArrivalTime(),timeMins);
+                    if(targetTime.getTime() > new Date().getTime()) throw new JeecgBootException("方案时间超时");
+                    order.setBookingType(2);
+                    order.setHourRoomId(info.getFangAnId());
+                    updateById(order);
+                } else throw new JeecgBootException("请选择时租房规则");
+            }
+
+            if(info.getBrkfstNum() != null && info.getBrkfstNum() >= 0) {
+                order.setBreakfastNum(info.getBrkfstNum());
+                updateById(order);
+                return true;
+            }
+
+            if(info.getLchNum() != null && info.getLchNum() >= 0) {
+                order.setLunchNum(info.getLchNum());
+                updateById(order);
+                return true;
+            }
+
+            if(info.getDnrNum() != null && info.getDnrNum() >= 0) {
+                order.setDinnerNum(info.getDnrNum());
+                updateById(order);
+                return true;
+            }
+
             return false;
         }
         if(type.equals(2)) {
@@ -1712,10 +1741,20 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                     newCustomer.setPhone(info.getCusPhone());
                     newCustomer.setCertType(1); // 身份证
                     customerService.save(newCustomer);
+                    customer = newCustomer;
                     order.setContactId(newCustomer.getId());
                 } else {
                     order.setContactId(customer.getId());
                 }
+                List<BusLivingCustomer> customers = livingCustomerService.list(Wrappers.<BusLivingCustomer>query().eq("living_order_id",order.getId()));
+                if(customers.size() > 0) {
+                    BusLivingCustomer firstCustomer = customers.get(0);
+                    firstCustomer.setCustomerId(customer.getId());
+                    firstCustomer.setCustomerName(customer.getName());
+                    firstCustomer.setPhone(customer.getPhone());
+                    firstCustomer.setCertNo(customer.getCertNo());
+                    livingCustomerService.updateById(firstCustomer);
+                }
                 roomsLivingOrderService.updateById(order);
                 return true;
             }
@@ -1742,6 +1781,40 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 roomsLivingOrderService.updateById(order);
                 return true;
             }
+            if(info.getLiveType() != null && info.getLiveType().equals(2)){
+                if(info.getFangAnId() != null && !info.getFangAnId().isEmpty()) {
+                    CesHourRoomRule hourRoomRule = hourRoomRuleService.getById(info.getFangAnId());
+                    Integer timeMins = hourRoomRule.getAfterOpenRoom();// 分钟
+                    Date targetTime = DateUtils.formatAddDateMin(order.getArrivalTime(),timeMins);
+                    if(targetTime.getTime() > new Date().getTime()) throw new JeecgBootException("方案时间超时");
+                    order.setLivingType(2);
+                    order.setHourRoomId(info.getFangAnId());
+
+                } else throw new JeecgBootException("请选择时租房规则");
+                if(info.getPrices() != null && info.getPrices().getDayPrices().size() > 0) {
+                    updateOrderPrice(info.getPrices());
+                }
+                roomsLivingOrderService.updateById(order);
+                return true;
+            }
+
+            if(info.getBrkfstNum() != null && info.getBrkfstNum() >= 0) {
+                order.setBreakfastNum(info.getBrkfstNum());
+                roomsLivingOrderService.updateById(order);
+                return true;
+            }
+
+            if(info.getLchNum() != null && info.getLchNum() >= 0) {
+                order.setLunchNum(info.getLchNum());
+                roomsLivingOrderService.updateById(order);
+                return true;
+            }
+
+            if(info.getDnrNum() != null && info.getDnrNum() >= 0) {
+                order.setDinnerNum(info.getDnrNum());
+                roomsLivingOrderService.updateById(order);
+                return true;
+            }
             return false;
         }
         return false;