|
|
@@ -1638,6 +1638,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @SneakyThrows
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateOrderInfo(Integer type, UpdateOrderInfoDto info){
|
|
|
@@ -1781,19 +1782,36 @@ 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());
|
|
|
+ if(info.getLiveType() != null){
|
|
|
+ if(info.getPrices() == null || info.getPrices().getDayPrices().size() <= 0) {
|
|
|
+ throw new JeecgBootException("请传入价格");
|
|
|
+ }
|
|
|
+ if(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());
|
|
|
+ order.setDueOutTime(targetTime);
|
|
|
+ updateOrderPrice(info.getPrices());
|
|
|
+ } else throw new JeecgBootException("请选择时租房规则");
|
|
|
+
|
|
|
+ } else if(info.getLiveType().equals(1)) {
|
|
|
+ CesAllDayPriceRule rule = allDayPriceRuleService.getOne(Wrappers.<CesAllDayPriceRule>query().eq("hotel_id",order.getHotelId()));
|
|
|
+ String leaveTime = "13:00";
|
|
|
+ if(rule == null || rule.getLeaveTime() == null) {
|
|
|
+ leaveTime = rule.getLeaveTime();
|
|
|
+ }
|
|
|
+ String dateStr = DateUtils.formatAddDate(DateUtils.formatDate(new Date())+leaveTime,"yyyy-MM-dd HH:mm:ss",info.getPrices().getDayPrices().size());
|
|
|
+ order.setDueOutTime(DateUtils.parseDatetime(dateStr));
|
|
|
}
|
|
|
+ updateOrderPrice(info.getPrices());
|
|
|
+ long dayCount = livingLayoutDayPriceService.count(Wrappers.<BusLivingLayoutDayPrice>query()
|
|
|
+ .eq("living_order_id", order.getId()));
|
|
|
+ order.setDayCount((int)dayCount);
|
|
|
roomsLivingOrderService.updateById(order);
|
|
|
return true;
|
|
|
}
|
|
|
@@ -1825,6 +1843,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
public Boolean updateOrderPrice(UpdateOrderPriceDto info) {
|
|
|
if(info.getLivingOrderId() == null || info.getLivingOrderId().isEmpty()) throw new JeecgBootException("参数错误");
|
|
|
if(info.getDayPrices() == null || info.getDayPrices().size() == 0) throw new JeecgBootException("参数错误");
|
|
|
+ livingLayoutDayPriceService.remove(Wrappers.<BusLivingLayoutDayPrice>query()
|
|
|
+ .ge("day_time", DateUtils.formatDate(new Date()))
|
|
|
+ .eq("living_order_id",info.getLivingOrderId()));
|
|
|
info.getDayPrices().forEach(s-> {
|
|
|
if(new Date().getTime() < s.getDayTime().getTime()) return;
|
|
|
if(s.getId() == null || s.getId().isEmpty()){
|