Browse Source

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

gqx 2 years ago
parent
commit
26c3d3f9f9

+ 4 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusDictController.java

@@ -216,7 +216,8 @@ public class BusDictController extends JeecgController<BusDict, IBusDictService>
 	  * @return
 	  */
 	 @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
-	 public Result<List<BusDictTreeModel>> queryTreeList(@RequestParam(name = "ids", required = false) String ids) {
+	 public Result<List<BusDictTreeModel>> queryTreeList(@RequestParam(name = "ids", required = false) String ids
+	 ,@RequestParam(name = "hotelId", required = false) String hotelId) {
 		 Result<List<BusDictTreeModel>> result = new Result<>();
 		 try {
 			 // 从内存中读取
@@ -225,10 +226,10 @@ public class BusDictController extends JeecgController<BusDict, IBusDictService>
 //				list = sysDepartService.queryTreeList();
 //			}
 			 if(oConvertUtils.isNotEmpty(ids)){
-				 List<BusDictTreeModel> departList = busDictService.queryTreeList(ids);
+				 List<BusDictTreeModel> departList = busDictService.queryTreeList(ids,hotelId);
 				 result.setResult(departList);
 			 }else{
-				 List<BusDictTreeModel> list = busDictService.queryTreeList();
+				 List<BusDictTreeModel> list = busDictService.queryTreeList(hotelId);
 				 result.setResult(list);
 			 }
 			 result.setSuccess(true);

+ 3 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusDictItemController.java

@@ -308,9 +308,12 @@ public class BusDictItemController extends JeecgController<BusDictItem, IBusDict
 		 }
 		 List<BusDictItem> list = new ArrayList<>();
 		 String dictName = req.getParameter("dictName");
+		 String hotelId = req.getParameter("hotelId");
 		 if(oConvertUtils.isNotEmpty(dictName)){
 			 LambdaQueryWrapper<BusDict> queryDictWrapper = new LambdaQueryWrapper<>();
 			 queryDictWrapper.eq(BusDict::getDictName,dictName);
+			 queryDictWrapper.eq(BusDict::getTenantId,user.getRelTenantIds());
+			 queryDictWrapper.eq(BusDict::getHotelId,hotelId);
 			 BusDict busDict = busDictService.getOne(queryDictWrapper);
 
 			 if (busDict != null) {

+ 33 - 5
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusHotelController.java

@@ -1,9 +1,6 @@
 package org.jeecg.modules.business.controller;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -28,7 +25,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
 import org.jeecg.modules.base.service.BaseCommonService;
+import org.jeecg.modules.business.entity.BusDict;
 import org.jeecg.modules.business.entity.BusHotel;
+import org.jeecg.modules.business.service.IBusDictService;
 import org.jeecg.modules.business.service.IBusHotelService;
 import org.jeecg.modules.business.util.MapUtil;
 import org.jeecg.modules.system.entity.SysTenant;
@@ -68,6 +67,9 @@ public class BusHotelController extends JeecgController<BusHotel, IBusHotelServi
 	 @Autowired
 	 private ISysTenantService sysTenantService;
 
+	 @Autowired
+	 private IBusDictService busDictService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -118,8 +120,8 @@ public class BusHotelController extends JeecgController<BusHotel, IBusHotelServi
 		busHotel.setStatus(1);
 		busHotel.setDelFlag(CommonConstant.DEL_FLAG_0);
 		busHotel.setCheckStatus(0);
+		LoginUser user = TokenUtils.getAuthUser();
 		if(busHotel.getTenantId() == null || busHotel.getTenantId().equals("")){
-			LoginUser user = TokenUtils.getAuthUser();
 			if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
 				busHotel.setTenantId(user.getRelTenantIds());
 			} else {
@@ -127,6 +129,32 @@ public class BusHotelController extends JeecgController<BusHotel, IBusHotelServi
 			}
 		}
 		busHotelService.save(busHotel);
+
+		//添加酒店后需要初始化部分数据
+		//初始化系统设置-字典管理
+		LambdaQueryWrapper<BusDict> queryDict = new LambdaQueryWrapper<BusDict>();
+		queryDict.eq(BusDict::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
+		queryDict.eq(BusDict::getHotelId, "0");
+		queryDict.eq(BusDict::getTenantId, "0");
+		List<BusDict> listDict = busDictService.list(queryDict);
+		if (listDict != null && listDict.size() > 0){
+//			for (BusDict busDict : listDict) {
+//
+//			}
+			List<BusDict> batchDict = new ArrayList<>();
+			listDict.forEach( busDict -> {
+				BusDict newDict = busDict;
+				newDict.setTenantId(busHotel.getTenantId());
+				newDict.setHotelId(busHotel.getId());
+				batchDict.add(newDict);
+			});
+			busDictService.saveBatch(batchDict);
+		}
+
+		//初始化打印模板
+		//初始化参数设置
+
+
 		return Result.OK("添加成功!");
 	}
 

+ 1 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusMarketAgreementUnitController.java

@@ -238,6 +238,7 @@ public class BusMarketAgreementUnitController extends JeecgController<BusMarketA
 		editModel.setHomepage(busMarketAgreementUnit.getHomepage());
 		editModel.setEmail(busMarketAgreementUnit.getEmail());
 		editModel.setCustomerIndustry(busMarketAgreementUnit.getCustomerIndustry());
+		editModel.setLeaveTime(busMarketAgreementUnit.getLeaveTime());
 		busAgreementUnitService.updateById(editModel);
 		return Result.OK("编辑成功!");
 	}

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

@@ -494,6 +494,13 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	 }
 
 
+	 @ApiOperation(value="换房", notes="换房")
+	 @RequestMapping(value = "/change-living-room",method = RequestMethod.POST)
+	 public  Result<Boolean> changeRoom(@RequestBody List<BusLivingLayoutDayPrice> prices, String livingOrderId,String changeRoomId) {
+		 return Result.OK(service.changeLivingRoom(prices, livingOrderId, changeRoomId));
+	 }
+
+
 
 
 

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

@@ -205,4 +205,8 @@ public class BusMarketAgreementUnit implements Serializable {
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+    /**离店时间*/
+    @Excel(name = "离店时间", width = 15)
+    @ApiModelProperty(value = "离店时间")
+    private String leaveTime;
 }

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

@@ -175,6 +175,10 @@ public class BusMarketMember implements Serializable {
     @ApiModelProperty(value = "卡片描述")
     private String content;
 
+    /**离店时间*/
+    @Excel(name = "离店时间", width = 15)
+    @ApiModelProperty(value = "离店时间")
+	private String leaveTime;
 
     @TableField(exist = false)
     private String hotelName;

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

@@ -18,11 +18,11 @@ public interface IBusDictService extends IService<BusDict> {
      * 查询所有字典信息,并分节点进行显示
      * @return
      */
-    List<BusDictTreeModel> queryTreeList();
+    List<BusDictTreeModel> queryTreeList(String hotelId);
     /**
      * 查询所有部门信息,并分节点进行显示
      * @param ids 多个部门id
      * @return
      */
-    List<BusDictTreeModel> queryTreeList(String ids);
+    List<BusDictTreeModel> queryTreeList(String ids,String hotelId);
 }

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

@@ -74,6 +74,8 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
     void syncDayOrderFeeItem(BusRoomsLivingOrder order, CesAllDayPriceRule allDayRule);
     List<BusRoomBookingOrders> countTodayYD(String hotelId);
 
+    Boolean changeLivingRoom(List<BusLivingLayoutDayPrice> prices,String livingOrderId, String roomId);
+
     /**
      * 根据手机号查询入住历史列表
      * @param hotelId

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

@@ -32,9 +32,10 @@ public class BusDictServiceImpl extends ServiceImpl<BusDictMapper, BusDict> impl
      * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
      */
     @Override
-    public List<BusDictTreeModel> queryTreeList() {
+    public List<BusDictTreeModel> queryTreeList(String hotelId) {
         LambdaQueryWrapper<BusDict> query = new LambdaQueryWrapper<BusDict>();
         query.eq(BusDict::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
+        query.eq(BusDict::getHotelId, hotelId);
 //        query.orderByAsc(BusDict::getCreateTime);
         List<BusDict> list = this.list(query);
         //update-begin---author:wangshuai ---date:20220307  for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理
@@ -50,10 +51,11 @@ public class BusDictServiceImpl extends ServiceImpl<BusDictMapper, BusDict> impl
      * queryTreeList 根据部门id查询,前端回显调用
      */
     @Override
-    public List<BusDictTreeModel> queryTreeList(String ids) {
+    public List<BusDictTreeModel> queryTreeList(String ids,String hotelId) {
         List<BusDictTreeModel> listResult=new ArrayList<>();
         LambdaQueryWrapper<BusDict> query = new LambdaQueryWrapper<BusDict>();
         query.eq(BusDict::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
+        query.eq(BusDict::getHotelId, hotelId);
         if(oConvertUtils.isNotEmpty(ids)){
             query.in(true,BusDict::getId,ids.split(","));
         }

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

@@ -19,9 +19,11 @@ import org.jeecg.modules.business.service.*;
 import org.jeecg.modules.business.util.MxTools;
 import org.jeecg.modules.business.vo.*;
 import org.jeecg.modules.fw.entity.FwRoomClean;
+import org.jeecg.modules.fw.entity.FwRoomExamine;
 import org.jeecg.modules.fw.entity.FwRoomLock;
 import org.jeecg.modules.fw.entity.FwRoomRepair;
 import org.jeecg.modules.fw.service.IFwRoomCleanService;
+import org.jeecg.modules.fw.service.IFwRoomExamineService;
 import org.jeecg.modules.fw.service.IFwRoomLockService;
 import org.jeecg.modules.fw.service.IFwRoomRepairService;
 import org.jeecg.modules.pos.service.IPosJialiaoConfigDetailService;
@@ -126,6 +128,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
     @Resource
     private IFwRoomRepairService fwRoomRepairService;
+
+    @Resource
+    private IFwRoomExamineService fwRoomExamineService;
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
@@ -929,6 +934,16 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         livingOrder.setArrivalTime(new Date());// todo 这个地方的入住开始时间应该怎么算
         if(customers.size() > 0) livingOrder.setContactId(customers.get(0).getCustomerId());
         roomsLivingOrderService.save(livingOrder);
+
+        // 添加查房记录 start
+        FwRoomExamine examine = new FwRoomExamine();
+        examine.setHotelId(hotelId);
+        examine.setCreateTime(new Date());
+        examine.setLivingOrderId(livingOrder.getId());
+        examine.setRoomId(bkRoom.getRoomId());
+        fwRoomExamineService.save(examine);
+        // 添加查房记录 end
+
         CesRooms room = roomsService.getById(bkRoom.getRoomId());
         if(room==null) throw new JeecgBootException("房间不存在");
         room.setLivingOrderId(livingOrder.getId());
@@ -2343,4 +2358,36 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         return "";
     }
 
+    // 换房
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean changeLivingRoom(List<BusLivingLayoutDayPrice> prices,String livingOrderId, String roomId) {
+        if(prices == null || prices.size() == 0) throw new JeecgBootException("请传入房价");
+        BusRoomsLivingOrder livingOrder = roomsLivingOrderService.getById(livingOrderId);
+        if(livingOrder == null) throw  new JeecgBootException("入住记录不存在");
+        BusBookingRooms bkRoom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
+        if(bkRoom == null) throw new JeecgBootException("入住房间记录不存在");
+        CesRooms origLivingRoom = roomsService.getById(bkRoom.getRoomId());
+        if(origLivingRoom == null) throw new JeecgBootException("原房间不存在");
+        CesRooms changeRoom = roomsService.getById(roomId);
+        if(changeRoom == null) throw new JeecgBootException("更换房间不存在");
+        bkRoom.setRoomId(changeRoom.getId());
+        bkRoom.setLayoutId(changeRoom.getLayoutId());
+        bookingRoomsService.updateById(bkRoom);
+        origLivingRoom.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
+        roomsService.updateById(origLivingRoom);
+        changeRoom.setRoomStatus(RoomStatusEnum.LIVE_CLEAR.getKey());
+        roomsService.updateById(changeRoom);
+        livingLayoutDayPriceService.remove(Wrappers.<BusLivingLayoutDayPrice>query().eq("living_order_id",livingOrderId));
+        prices.forEach(s->{
+            s.setRoomLayoutId(changeRoom.getLayoutId());
+            s.setRoomId(changeRoom.getId());
+            s.setLivingType(1);
+            s.setLivingOrderId(livingOrderId);
+        });
+        livingLayoutDayPriceService.saveBatch(prices);
+
+        return true;
+    }
+
 }