|
|
@@ -9,10 +9,7 @@ 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.dto.BatchOrderSavaDto;
|
|
|
-import org.jeecg.modules.business.dto.BookingBatchRoomsDto;
|
|
|
-import org.jeecg.modules.business.dto.BookingOrderSaveDto;
|
|
|
-import org.jeecg.modules.business.dto.TodayBookingQueryDto;
|
|
|
+import org.jeecg.modules.business.dto.*;
|
|
|
import org.jeecg.modules.business.entity.*;
|
|
|
import org.jeecg.modules.business.enums.*;
|
|
|
import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
|
|
|
@@ -932,7 +929,31 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold desc="todo:账单相关">
|
|
|
- // TODO: 待做
|
|
|
+ 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());
|
|
|
+ CesRooms orderRoom = room;
|
|
|
+ dayOrderFee.setRoomId(orderRoom.getId());
|
|
|
+ String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
|
|
|
+ roomName += roomName + orderRoom.getName();
|
|
|
+ dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDate(dayOrderFee.getDayTime()) + " 当日房费");
|
|
|
+ dayOrderFee.setLivingOrderId(livingOrder.getId());
|
|
|
+ dayOrderFee.setHotelId(hotelId);
|
|
|
+ feeService.save(dayOrderFee);
|
|
|
//</editor-fold>
|
|
|
return livingOrder.getId();
|
|
|
}
|
|
|
@@ -1050,10 +1071,22 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
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();
|
|
|
+ BigDecimal money = new BigDecimal(0);
|
|
|
+ BusLivingLayoutDayPrice price = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>query()
|
|
|
+ .eq("living_order_id", s.getId()).eq("day_time",DateUtils.formatDate(new Date())+" 00:00:00"));
|
|
|
+ if(price != null) {
|
|
|
+ money = price.getPrice();
|
|
|
+ } else {
|
|
|
+ CesRoomLayout layout = layoutService.getById(orderRoom.getLayoutId());
|
|
|
+ if(layout == null) money = new BigDecimal(218);
|
|
|
+ else money = layout.getMarketPrice();
|
|
|
+ }
|
|
|
+
|
|
|
+ dayOrderFee.setMoney(money);
|
|
|
dayOrderFee.setRoomId(orderRoom.getId());
|
|
|
String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
|
|
|
roomName += roomName + orderRoom.getName();
|
|
|
@@ -1433,6 +1466,138 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean updateOrderInfo(Integer type, UpdateOrderInfoDto info){
|
|
|
+ if(info == null || info.getOrderId() == null || info.getOrderId().isEmpty()) throw new JeecgBootException("参数错误");
|
|
|
+ LoginUser user = TokenUtils.getAuthUser();
|
|
|
+ // 预约单
|
|
|
+ if(type.equals(1)) {
|
|
|
+ BusRoomBookingOrders order = getById(info.getOrderId());
|
|
|
+ if(order == null) throw new JeecgBootException("订单未找到");
|
|
|
+ if(info.getCusName() != null && !info.getCusName().isEmpty() && info.getCusPhone() != null && !info.getCusPhone().isEmpty()){
|
|
|
+ BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",info.getCusName())
|
|
|
+ .eq("phone",info.getCusPhone()));
|
|
|
+ if(customer == null) {
|
|
|
+ // save customer
|
|
|
+ BusCustomer newCustomer = new BusCustomer();
|
|
|
+ newCustomer.setCreateTime(new Date());
|
|
|
+ newCustomer.setCreateUser(user.getId());
|
|
|
+ newCustomer.setHotelId(user.getRelTenantIds());
|
|
|
+ newCustomer.setTenantId(user.getRelTenantIds());
|
|
|
+ newCustomer.setName(info.getCusName());
|
|
|
+ newCustomer.setPhone(info.getCusPhone());
|
|
|
+ newCustomer.setCertType(1); // 身份证
|
|
|
+ customerService.save(newCustomer);
|
|
|
+ order.setContactId(newCustomer.getId());
|
|
|
+ } else {
|
|
|
+ order.setContactId(customer.getId());
|
|
|
+ }
|
|
|
+ updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(info.getCustomerSource() != null && !info.getCustomerSource().isEmpty()) {
|
|
|
+ order.setCustomerSource(info.getCustomerSource());
|
|
|
+ updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(info.getRemark() != null && !info.getRemark().isEmpty()) {
|
|
|
+ order.setRemark(info.getRemark());
|
|
|
+ updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(info.getWarranter() != null && !info.getWarranter().isEmpty()) {
|
|
|
+ order.setWarranter(info.getWarranter());
|
|
|
+ updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(info.getCustomerType() != null && CustomerTypeEnum.val(info.getCustomerType()) != null) {
|
|
|
+ order.setCustomerType(info.getCustomerType());
|
|
|
+ updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(type.equals(2)) {
|
|
|
+ BusRoomsLivingOrder order = roomsLivingOrderService.getById(info.getOrderId());
|
|
|
+ if(order == null) throw new JeecgBootException("订单未找到");
|
|
|
+ if(info.getCusName() != null && !info.getCusName().isEmpty() && info.getCusPhone() != null && !info.getCusPhone().isEmpty()){
|
|
|
+ BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",info.getCusName())
|
|
|
+ .eq("phone",info.getCusPhone()));
|
|
|
+ if(customer == null) {
|
|
|
+ // save customer
|
|
|
+ BusCustomer newCustomer = new BusCustomer();
|
|
|
+ newCustomer.setCreateTime(new Date());
|
|
|
+ newCustomer.setCreateUser(user.getId());
|
|
|
+ newCustomer.setHotelId(user.getRelTenantIds());
|
|
|
+ newCustomer.setTenantId(user.getRelTenantIds());
|
|
|
+ newCustomer.setName(info.getCusName());
|
|
|
+ newCustomer.setPhone(info.getCusPhone());
|
|
|
+ newCustomer.setCertType(1); // 身份证
|
|
|
+ customerService.save(newCustomer);
|
|
|
+ order.setContactId(newCustomer.getId());
|
|
|
+ } else {
|
|
|
+ order.setContactId(customer.getId());
|
|
|
+ }
|
|
|
+ roomsLivingOrderService.updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(info.getCustomerSource() != null && !info.getCustomerSource().isEmpty()) {
|
|
|
+ order.setCustomerSource(info.getCustomerSource());
|
|
|
+ roomsLivingOrderService.updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(info.getRemark() != null && !info.getRemark().isEmpty()) {
|
|
|
+ order.setRemark(info.getRemark());
|
|
|
+ roomsLivingOrderService.updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(info.getWarranter() != null && !info.getWarranter().isEmpty()) {
|
|
|
+ order.setWarranter(info.getWarranter());
|
|
|
+ roomsLivingOrderService.updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(info.getCustomerType() != null && CustomerTypeEnum.val(info.getCustomerType()) != null) {
|
|
|
+ order.setCustomerType(info.getCustomerType());
|
|
|
+ roomsLivingOrderService.updateById(order);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ 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("参数错误");
|
|
|
+ info.getDayPrices().forEach(s-> {
|
|
|
+ if(new Date().getTime() < s.getDayTime().getTime()) return;
|
|
|
+ if(s.getId() == null || s.getId().isEmpty()){
|
|
|
+ livingLayoutDayPriceService.save(s);
|
|
|
+ } else {
|
|
|
+ livingLayoutDayPriceService.updateById(s);
|
|
|
+ }
|
|
|
+ if(DateUtils.formatDate(new Date()).equals(DateUtils.formatDate(s.getDayTime()))){
|
|
|
+ // 修改当日房价 产生的当日房费账单也要改
|
|
|
+ BusOrderFee fee = feeService.getOne(Wrappers.<BusOrderFee>query()
|
|
|
+ .eq("day_time",DateUtils.formatDate(new Date())));
|
|
|
+ if(fee != null) {
|
|
|
+ fee.setMoney(s.getPrice());
|
|
|
+ feeService.updateById(fee);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private Boolean mergeSingle(String livingOrderId, String mergeLivingOrderId ) {
|
|
|
BusRoomsLivingOrder mergeLivingOrder = roomsLivingOrderService.getById(mergeLivingOrderId);
|
|
|
if(mergeLivingOrder == null) throw new JeecgBootException("合并的订单不存在");
|