gqx 2 lat temu
rodzic
commit
3acafc6376

+ 45 - 4
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/HotelController.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -32,6 +33,7 @@ import org.jeecg.modules.business.dto.BookingOrderSaveDto;
 import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.CheckInTypeEnum;
 import org.jeecg.modules.business.service.*;
+import org.jeecg.modules.business.service.impl.BusRoomPayTypeServiceImpl;
 import org.jeecg.modules.business.vo.KeLiItemVo;
 import org.jeecg.modules.mall.entity.MallHotelOrder;
 import org.jeecg.modules.mall.entity.MallOrderGoods;
@@ -49,6 +51,7 @@ import org.jeecg.modules.mall.entity.MallUserInfo;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.wxuser.service.IUserInfoService;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -113,6 +116,10 @@ public class HotelController extends WebConfig {
     private ISysBaseAPI sysBaseAPI;
     @Resource
     private ISysUserService sysUserService;
+    @Resource
+    private BusRoomPayTypeServiceImpl busRoomPayTypeService;
+    @Resource
+    private IBusLivingCustomerService busLivingCustomerService;
     /**
      * 酒店列表查询
      *
@@ -490,6 +497,7 @@ public class HotelController extends WebConfig {
         String tenantId = TenantContextHolder.getTenantId();
         String userId = ThirdSessionHolder.getUserId();
         LambdaQueryWrapper<BusRoomsLivingOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(BusRoomsLivingOrder::getSettleType,-1);
         lambdaQueryWrapper.eq(BusRoomsLivingOrder::getThirdLoginUserId, userId).orderByDesc(BusRoomsLivingOrder::getCreateTime).last("limit 1");
         BusRoomsLivingOrder busRoomsLivingOrder = busRoomsLivingOrderService.getOne(lambdaQueryWrapper);
         if (busRoomsLivingOrder != null && StringUtils.isNotBlank(busRoomsLivingOrder.getBookingOrderId())) {
@@ -501,7 +509,15 @@ public class HotelController extends WebConfig {
                 if (cesRooms != null) {
                     busHotel = busHotelService.getById(cesRooms.getHotelId());
                     busHotel.setRoomName(cesRooms.getName());
+                    CesRoomLayout cesRoomLayout = cesRoomLayoutService.getById(cesRooms.getLayoutId());
+                    busHotel.setCesRoomLayout(cesRoomLayout);
                     busHotel.setLivingOrder(busRoomsLivingOrder);
+                    LambdaQueryWrapper<BusLivingCustomer> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
+                    lambdaQueryWrapper2.eq(BusLivingCustomer::getLivingOrderId, busRoomsLivingOrder.getId());
+                    List<BusLivingCustomer> livingCustomers = busLivingCustomerService.list(lambdaQueryWrapper2);
+                    if (livingCustomers != null && livingCustomers.size() > 0) {
+                        busHotel.setBusLivingCustomer(livingCustomers.get(0));
+                    }
                 }
             }
         }
@@ -977,8 +993,21 @@ public class HotelController extends WebConfig {
     @RequestMapping(value = "/living-settle-checkout",method = RequestMethod.POST)
     @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
     @ApiLogin
-    public Result<Boolean> livingSettleBillCheckOut(@RequestBody List<BusOrderFee> fees, String livingOrderId) {
-        Boolean isOk = busRoomBookingOrdersService.livingSettleBillCheckOut(fees,livingOrderId);
+    public Result<Boolean> livingSettleBillCheckOut(@RequestBody List<BusOrderFee> fees,@RequestParam(name = "livingOrderId") String livingOrderId,@RequestParam(name = "hotelId") String hotelId) {
+        if (fees != null && fees.size() > 0) {
+            LambdaQueryWrapper<BusRoomPayType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(BusRoomPayType::getHotelId, hotelId);
+            List<BusRoomPayType> list = busRoomPayTypeService.list(lambdaQueryWrapper);
+            if (list != null && list.size() > 0) {
+                Optional<BusRoomPayType> optional = list.stream().filter(t -> t.getName().contains("现金")).findFirst();
+                if (optional.isPresent()) {
+                    fees.get(0).setPayType(optional.get().getId());
+                } else {
+                    fees.get(0).setPayType(list.get(0).getId());
+                }
+            }
+        }
+        Boolean isOk = busRoomBookingOrdersService.settleBillCheckOut(fees, livingOrderId);
         return Result.OK(isOk);
     }
 
@@ -990,8 +1019,20 @@ public class HotelController extends WebConfig {
     @RequestMapping(value = "/continue-living",method = RequestMethod.POST)
     @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
     @ApiLogin
-    public Result<Boolean> continueLiving(@RequestBody BusOrderFee fees, Date dueOutTime,String livingOrderId , String hotelId) {
-        Boolean isOk = busRoomBookingOrdersService.continueLiving(fees,dueOutTime,livingOrderId,hotelId);
+    public Result<Boolean> continueLiving(@RequestBody BusOrderFee fees,@RequestParam(name = "dueOutTime") @JsonFormat(pattern = "yyyy-MM-dd HH:mm")  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")  Date dueOutTime, @RequestParam(name = "livingOrderId") String livingOrderId ,@RequestParam(name = "hotelId") String hotelId) {
+        LambdaQueryWrapper<BusRoomPayType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(BusRoomPayType::getHotelId, hotelId);
+        fees.setPayType("");
+        List<BusRoomPayType> list = busRoomPayTypeService.list(lambdaQueryWrapper);
+        if (list != null && list.size() > 0) {
+            Optional<BusRoomPayType> optional = list.stream().filter(t -> t.getName().contains("微信")).findFirst();
+            if (optional.isPresent()) {
+                fees.setPayType(optional.get().getId());
+            } else {
+                fees.setPayType(list.get(0).getId());
+            }
+        }
+        Boolean isOk = busRoomBookingOrdersService.continueLiving(fees, dueOutTime, livingOrderId, hotelId);
         return Result.OK(isOk);
     }
 }

+ 11 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusHotel.java

@@ -7,6 +7,7 @@ import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import org.jeecg.modules.rooms.entity.CesRoomLayout;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.jeecg.common.aspect.annotation.Dict;
@@ -290,4 +291,14 @@ public class BusHotel implements Serializable {
     @ApiModelProperty(value = "入住订单信息")
     @TableField(exist = false)
     private  BusRoomsLivingOrder livingOrder;
+
+    @ApiModelProperty(value = "房型信息")
+    @TableField(exist = false)
+    private  CesRoomLayout cesRoomLayout;
+
+    @ApiModelProperty(value = "入住联系人信息")
+    @TableField(exist = false)
+    private  BusLivingCustomer busLivingCustomer;
+
+
 }

+ 4 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusRoomsLivingOrder.java

@@ -39,14 +39,14 @@ public class BusRoomsLivingOrder implements Serializable {
     @ApiModelProperty(value = "预定类型:1,全天;2时租")
     private Integer livingType;
 	/**入住时间*/
-	@Excel(name = "入住时间", width = 15, format = "yyyy-MM-dd")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+	@Excel(name = "入住时间", width = 15, format = "yyyy-MM-dd HH:mm")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "入住时间")
     private Date arrivalTime;
 	/**预离时间*/
-	@Excel(name = "预离时间", width = 15, format = "yyyy-MM-dd")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+	@Excel(name = "预离时间", width = 15, format = "yyyy-MM-dd HH:mm")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "预离时间")
     private Date dueOutTime;

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

@@ -1894,7 +1894,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         if(settleFees.size() == 0) throw new JeecgBootException("参数错误");
         String hotelId =  getBookingRoomHotelId(mainRoom);
         LoginUser user = TokenUtils.getAuthUser();
-        if(user == null) throw new JeecgBootException("请登录");
+//        if(user == null) throw new JeecgBootException("请登录");
         if(hotelId == null) throw  new JeecgBootException("未找到酒店");
         BusOrderFee preferFeeItem = null;
         if(settleFees.stream().anyMatch(s->s.getIsPreferential().equals(true))){
@@ -1953,7 +1953,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                     balanceLog.setGiveMoney(new BigDecimal(0));
                     balanceLog.setRemarks("房间收费扣款");
                     balanceLog.setHotelId(hotelId);
-                    balanceLog.setTenantId(user.getRelTenantIds());
+                    if(user!=null) {
+                        balanceLog.setTenantId(user.getRelTenantIds());
+                    }
                     balanceLog.setPaymentMethod("");
                     balanceLog.setPayMoney(new BigDecimal(0));
                     balanceLog.setCode(BusMemberBalanceLogServiceImpl.randomNumber("KF"));