Просмотр исходного кода

优化收费方式问题。创建酒店数据初始化。商品添加简拼搜索

许智捷 1 год назад
Родитель
Сommit
1c25826f95
29 измененных файлов с 982 добавлено и 180 удалено
  1. 10 9
      jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/HotelController.java
  2. 17 22
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusCustomerController.java
  3. 1 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusMarketMemberController.java
  4. 14 18
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusRoomBookingOrdersController.java
  5. 4 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusWaiterController.java
  6. 4 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusCustomer.java
  7. 12 11
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusBookingRoomsMapper.java
  8. 7 4
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusRoomBookingOrdersMapper.java
  9. 91 83
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusRoomBookingOrdersMapper.xml
  10. 1 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusOrderFeeService.java
  11. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusRoomBookingOrdersService.java
  12. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusMemberPointLogServiceImpl.java
  13. 55 13
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusRoomBookingOrdersServiceImpl.java
  14. 16 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/PricingStrategy.java
  15. 25 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/PricingStrategyFactory.java
  16. 67 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/DayAddStrategy.java
  17. 157 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/HourRoomStrategy.java
  18. 112 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/LongRentStrategy.java
  19. 112 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/MinuteAddStrategy.java
  20. 63 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/NotAddStrategy.java
  21. 149 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/util/PricingUtil.java
  22. 2 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/ExtendBusBookingRoomsVo.java
  23. 1 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/KeLiItemVo.java
  24. 35 8
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/controller/FwRoomExamineController.java
  25. 8 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/pos/controller/PosSellClearGoodsController.java
  26. 3 3
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/pos/mapper/xml/PosOrderGoodsMapper.xml
  27. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/quartz/job/NightAuditJob.java
  28. 7 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesGoodsController.java
  29. 5 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesGoods.java

+ 10 - 9
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/HotelController.java

@@ -30,6 +30,7 @@ import org.jeecg.config.WebConfig;
 import org.jeecg.modules.bus.vo.CesStockTypeVo;
 import org.jeecg.modules.business.dto.BookingLayoutRoomsDto;
 import org.jeecg.modules.business.dto.BookingOrderSaveDto;
+import org.jeecg.modules.business.dto.KedanOrderDto;
 import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.CheckInTypeEnum;
 import org.jeecg.modules.business.service.*;
@@ -482,15 +483,15 @@ public class HotelController extends WebConfig {
     @RequestMapping(value = "/kedan-orders", method = RequestMethod.GET)
     @ApiLogin
     @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
-    public Result<IPage<KeLiItemVo>> keli(Page<KeLiItemVo> page, String keyw, Integer livingStatus, String hotelId, Integer type, Integer bookingStatus, Date startTime,Date endTime,String layoutId, String customerType) {
-        if (type == null) throw new JeecgBootException("参数错误");
-        if (type == 1 && livingStatus == null) throw new JeecgBootException("参数错误");
-        if (type == 2 && bookingStatus == null) throw new JeecgBootException("参数错误");
-        String userId = ThirdSessionHolder.getUserId();
-        if (type == 1)
-            return Result.OK(busRoomBookingOrdersService.getLivingOrderKL(livingStatus, keyw, hotelId, userId,layoutId,customerType, page, startTime, endTime));
-        if (type == 2)
-            return Result.OK(busRoomBookingOrdersService.getBookingOrderKL(bookingStatus, keyw, hotelId, userId, page, startTime, endTime));
+    public Result<IPage<KeLiItemVo>> keli(Page<KeLiItemVo> page, KedanOrderDto kedanOrderDto) {
+        if (kedanOrderDto.getType() == null) throw new JeecgBootException("参数错误");
+        if (kedanOrderDto.getType() == 1 && kedanOrderDto.getLivingStatus() == null) throw new JeecgBootException("参数错误");
+        if (kedanOrderDto.getType() == 2 && kedanOrderDto.getBookingStatus() == null) throw new JeecgBootException("参数错误");
+        kedanOrderDto.setThirdUserId(ThirdSessionHolder.getUserId());
+        if (kedanOrderDto.getType() == 1)
+            return Result.OK(busRoomBookingOrdersService.getLivingOrderKL(page, kedanOrderDto));
+        if (kedanOrderDto.getType() == 2)
+            return Result.OK(busRoomBookingOrdersService.getBookingOrderKL(page, kedanOrderDto));
         return null;
     }
 

+ 17 - 22
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusCustomerController.java

@@ -1,17 +1,10 @@
 package org.jeecg.modules.business.controller;
 
 import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.business.entity.BusCustomer;
 import org.jeecg.modules.business.service.IBusCustomerService;
 
@@ -20,24 +13,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
 
- /**
+/**
  * @Description: bus_customer
  * @Author: jeecg-boot
  * @Date:   2023-03-28
@@ -50,10 +34,9 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 public class BusCustomerController extends JeecgController<BusCustomer, IBusCustomerService> {
 	@Autowired
 	private IBusCustomerService busCustomerService;
-	
+
 	/**
 	 * 分页列表查询
-	 *
 	 * @param busCustomer
 	 * @param pageNo
 	 * @param pageSize
@@ -75,7 +58,6 @@ public class BusCustomerController extends JeecgController<BusCustomer, IBusCust
 	
 	/**
 	 *   添加
-	 *
 	 * @param busCustomer
 	 * @return
 	 */
@@ -90,7 +72,6 @@ public class BusCustomerController extends JeecgController<BusCustomer, IBusCust
 	
 	/**
 	 *  编辑
-	 *
 	 * @param busCustomer
 	 * @return
 	 */
@@ -105,7 +86,6 @@ public class BusCustomerController extends JeecgController<BusCustomer, IBusCust
 	
 	/**
 	 *   通过id删除
-	 *
 	 * @param id
 	 * @return
 	 */
@@ -117,6 +97,21 @@ public class BusCustomerController extends JeecgController<BusCustomer, IBusCust
 		busCustomerService.removeById(id);
 		return Result.OK("删除成功!");
 	}
+
+	 /**
+	  * 通过id删除
+	  *
+	  * @param id
+	  * @return
+	  */
+	 @AutoLog(value = "bus_customer-加入黑名单")
+	 @ApiOperation(value="bus_customer-加入黑名单", notes="bus_customer-加入黑名单")
+	 @GetMapping(value = "/addBlackStatus")
+	 public Result<Boolean> addBlackStatus(@RequestParam(name="id",required=true) String id, @RequestParam(name="blackStatus",required=true) Boolean blackStatus) {
+		 BusCustomer customer = busCustomerService.getById(id);
+		 customer.setBlackStatus(blackStatus);
+		 return Result.OK("修改成功", busCustomerService.updateById(customer));
+	 }
 	
 	/**
 	 *  批量删除

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

@@ -102,6 +102,7 @@ private IBusHotelService busHotelService;
 
 		LambdaQueryWrapper<BusMarketMember> queryWrapper = new LambdaQueryWrapper<>();
 		queryWrapper.eq(BusMarketMember::getLevel,busMarketMember.getLevel());
+		queryWrapper.eq(BusMarketMember::getHotelId,busMarketMember.getHotelId());
 		BusMarketMember one = busMarketMemberService.getOne(queryWrapper);
 		if (one != null) {
 			return Result.error("已存在相同等级!");

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

@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.date.DateTime;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.poi.ss.formula.functions.T;
@@ -16,10 +17,7 @@ import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.business.dto.BatchOrderSavaDto;
-import org.jeecg.modules.business.dto.BookingOrderSaveDto;
-import org.jeecg.modules.business.dto.UpdateOrderInfoDto;
-import org.jeecg.modules.business.dto.UpdateOrderPriceDto;
+import org.jeecg.modules.business.dto.*;
 import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.BookingStatusTypeEnum;
 import org.jeecg.modules.business.enums.CustomerTypeEnum;
@@ -94,7 +92,7 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	//@RequiresPermissions("business:bus_room_booking_orders:add")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody BookingOrderSaveDto busRoomBookingOrders,String hotelId) {
-		Boolean isTeam = busRoomBookingOrders.getOrderInfo().getBookingOrdersType().equals(2);
+		Boolean isTeam = ObjectUtil.equals(busRoomBookingOrders.getOrderInfo().getBookingOrdersType(), 2);
 		busRoomBookingOrders.getOrderInfo().setBookingOrdersType(1);
 		busRoomBookingOrders.getOrderInfo().setBookingStatus(1);
 		return Result.OK("预定成功",service.bookingOrderSave(busRoomBookingOrders,isTeam,false,hotelId));
@@ -476,15 +474,13 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	 @RequestMapping(value = "/kedan-orders",method = RequestMethod.GET)
 	 public Result<IPage<KeLiItemVo>> keli(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
 										   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-										   @RequestParam(name="startTime" ,required=false) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
-										   @RequestParam(name="endTime" ,required=false) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime,
-										   String thirdUserId, String keyw, Integer livingStatus,String hotelId,Integer type,Integer bookingStatus, String layoutId, String customerType){
-	 	if(type == null) throw new JeecgBootException("参数错误");
-	 	if( type == 1 && livingStatus  == null ) throw new JeecgBootException("参数错误");
-	 	if(type == 2 && bookingStatus == null) throw new JeecgBootException("参数错误");
+										   KedanOrderDto kedanOrderDto){
+	 	if(kedanOrderDto.getType() == null) throw new JeecgBootException("参数错误");
+	 	if(kedanOrderDto.getType() == 1 && kedanOrderDto.getLivingStatus()  == null ) throw new JeecgBootException("参数错误");
+	 	if(kedanOrderDto.getType() == 2 && kedanOrderDto.getBookingStatus() == null) throw new JeecgBootException("参数错误");
 		 Page<KeLiItemVo> page = new Page<KeLiItemVo>(pageNo, pageSize);
-	 	if(type == 1 ) return Result.OK(service.getLivingOrderKL(livingStatus,keyw,hotelId,thirdUserId,layoutId,customerType, page, startTime, endTime));
-	 	if(type == 2) return  Result.OK(service.getBookingOrderKL(bookingStatus,keyw,hotelId,thirdUserId,page, startTime, endTime));
+	 	if(kedanOrderDto.getType() == 1 ) return Result.OK(service.getLivingOrderKL(page, kedanOrderDto));
+	 	if(kedanOrderDto.getType() == 2) return  Result.OK(service.getBookingOrderKL(page, kedanOrderDto));
 	 	return  null;
 	 }
 
@@ -621,22 +617,22 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	 public ModelAndView exportXls2(HttpServletRequest request,
 								   @RequestParam(name="startTime" ,required=false) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime startTime,
 								   @RequestParam(name="endTime" ,required=false) @JsonFormat(pattern = "yyyy-MM-dd")  @DateTimeFormat(pattern="yyyy-MM-dd") DateTime endTime,
-								   String thirdUserId, String keyw, Integer livingStatus,String hotelId,Integer type,Integer bookingStatus, String layoutId, String customerType) {
+								   KedanOrderDto kedanOrderDto) {
 		 Page<KeLiItemVo> page = new Page<>(1,9999999);
 		 IPage<KeLiItemVo> pRes = new Page<>();
 		 String title = "";
-		 if (type == 1){
+		 if (kedanOrderDto.getType() == 1){
 			 title = "入住单";
-			 pRes = baseMapper.getKeLiLiving(page,thirdUserId,hotelId,keyw,livingStatus, layoutId, customerType, startTime,endTime);
+			 pRes = baseMapper.getKeLiLiving(page, kedanOrderDto);
 			 pRes.getRecords().forEach(e -> {
 				 e.setCustomerTypeText(CustomerTypeEnum.val(e.getCustomerType()).getTitle());
 				 e.setOTypeText(LivingTypeEnum.val(e.getOType()).getTitle());
 				 e.setStatusText(SettleTypeEnum.val(e.getSettleType()).getTitle());
 				 e.setConsumerText(e.getYushou().subtract(e.getYuE()));
 			 });
-		 } else if (type == 2){
+		 } else if (kedanOrderDto.getType() == 2){
 			 title = "预约单";
-			 pRes = baseMapper.getKeBooking(page,thirdUserId,hotelId,keyw,bookingStatus,startTime,endTime);
+			 pRes = baseMapper.getKeBooking(page, kedanOrderDto);
 			 pRes.getRecords().forEach(e -> {
 				 e.setCustomerTypeText(CustomerTypeEnum.val(e.getCustomerType()).getTitle());
 				 e.setOTypeText(LivingTypeEnum.val(e.getOType()).getTitle());

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

@@ -125,7 +125,10 @@ public class BusWaiterController extends JeecgController<BusWaiter, IBusWaiterSe
 	 @ApiOperation(value="服务员-分配到的房间", notes="服务员-分配到的房间")
 	 @GetMapping(value = "/getRoomClean")
 	 public Result<List<BusWaiter>> queryList(String hotelId) {
-		 List<BusWaiter> waiterList = busWaiterService.list();
+		 List<BusWaiter> waiterList = busWaiterService.list(Wrappers.<BusWaiter>lambdaQuery().eq(BusWaiter::getHotelId, hotelId));
+		 if (waiterList.isEmpty()){
+			 return Result.ok(waiterList);
+		 }
 		 List<String> waiterIds = waiterList.stream().map(BusWaiter::getId).collect(Collectors.toList());
 		 List<FwRoomClean> roomCleanList = fwRoomCleanService.list(Wrappers.<FwRoomClean>lambdaQuery()
 				 .eq(FwRoomClean::getState, 0).in(FwRoomClean::getWaiterId, waiterIds).eq(FwRoomClean::getHotelId, hotelId));

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

@@ -94,4 +94,8 @@ public class BusCustomer implements Serializable {
 	@Excel(name = "酒店id", width = 15)
     @ApiModelProperty(value = "酒店id")
     private String hotelId;
+	/**酒店id*/
+	@Excel(name = "黑名单", width = 15)
+    @ApiModelProperty(value = "黑名单")
+    private Boolean blackStatus;
 }

+ 12 - 11
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusBookingRoomsMapper.java

@@ -16,17 +16,18 @@ import org.jeecg.modules.business.vo.ExtendBusBookingRoomsVo;
  * @Version: V1.0
  */
 public interface BusBookingRoomsMapper extends BaseMapper<BusBookingRooms> {
-    @Select("SELECT\n" +
-            "\tr.*,\n" +
-            "\tl.`name` AS layoutName, \n" +
-            "\trm.`name` as roomName \n" +
-            "FROM\n" +
-            "\tbus_booking_rooms r \n" +
-            "\tINNER JOIN ces_room_layout l ON r.room_layout_id = l.id \n" +
-            "\tLEFT JOIN ces_rooms rm ON r.room_id = rm.id \n" +
-            "WHERE\n" +
-            "\tr.booking_orders_id = #{bookingId} and\n" +
-            "\tr.booking_type=#{sType}")
+    @Select("SELECT " +
+            "r.*, " +
+            "l.`name` AS layoutName,  " +
+            "l.`market_price`,  " +
+            "rm.`name` as roomName  " +
+            "FROM " +
+            "bus_booking_rooms r  " +
+            "INNER JOIN ces_room_layout l ON r.room_layout_id = l.id  " +
+            "LEFT JOIN ces_rooms rm ON r.room_id = rm.id  " +
+            "WHERE " +
+            "r.booking_orders_id = #{bookingId} and " +
+            "r.booking_type=#{sType}")
     List<ExtendBusBookingRoomsVo> bookingRooms(String bookingId, Integer sType);
 
     @Update("update bus_booking_rooms set is_main = 0 where booking_orders_id = #{orderId}")

+ 7 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusRoomBookingOrdersMapper.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.jeecg.modules.business.dto.KedanOrderDto;
 import org.jeecg.modules.business.dto.TodayBookingQueryDto;
 import org.jeecg.modules.business.entity.BusBookingRooms;
 import org.jeecg.modules.business.entity.BusRoomBookingOrders;
@@ -48,8 +49,8 @@ public interface BusRoomBookingOrdersMapper extends BaseMapper<BusRoomBookingOrd
 
     List<RiLiFangTaiVo> getRiliFangTai(String start, String end,String hotelId);
 
-    IPage<KeLiItemVo> getKeLiLiving(IPage<KeLiItemVo> page,String thirdUserId, String hotelId,String keyw,Integer status,String layoutId, String customerType, Date startTime,Date endTime);
-    IPage<KeLiItemVo> getKeBooking(IPage<KeLiItemVo> page,String thirdUserId, String hotelId,String keyw,Integer status, Date startTime,Date endTime);
+    IPage<KeLiItemVo> getKeLiLiving(IPage<KeLiItemVo> page, KedanOrderDto kedanOrderDto);
+    IPage<KeLiItemVo> getKeBooking(Page<KeLiItemVo> page, KedanOrderDto kedanOrderDto);
     @Select("SELECT o.id from bus_room_booking_orders o inner join bus_booking_rooms br on o.id = br.booking_orders_id inner join ces_room_layout l on l.id = br.room_layout_id where l.hotel_id = #{hotelId} and o.arrival_time >= now() and o.arrival_time <= DATE_ADD(o.arrival_time,interval 1 day)")
     List<BusRoomBookingOrders> countTodayYD(String hotelId);
 
@@ -61,7 +62,9 @@ public interface BusRoomBookingOrdersMapper extends BaseMapper<BusRoomBookingOrd
      * @param phone
      * @return
      */
-    @Select("<script>select o.due_out_time,r.name as room_name,layout.name as layout_name,ldp.price,bc.`name`,bc.phone,bc.cert_no,bc.address,bc.nation, case ifnull(card.id,'0') when '0' then '否' else '是' end as huiyuan from bus_rooms_living_order o inner join bus_customer bc on bc.id=o.contact_id\n" +
+    @Select("<script>select o.due_out_time,r.name as room_name,layout.name as layout_name,ldp.price,bc.id as customer_id, bc.black_status, bc.`name`,bc.phone,bc.cert_no,bc.address,bc.nation, case ifnull(card.id,'0') when '0' then '否' else '是' end as huiyuan " +
+            "from bus_rooms_living_order o " +
+            "inner join bus_customer bc on bc.id=o.contact_id\n" +
             "left join bus_booking_rooms br on br.id=o.booking_room_id\n" +
             "left join ces_rooms r on r.id=br.room_id\n" +
             "left join ces_room_layout layout on layout.id=r.layout_id\n" +
@@ -100,7 +103,7 @@ public interface BusRoomBookingOrdersMapper extends BaseMapper<BusRoomBookingOrd
             "</script>")
     List<BusRoomBookingOrders> findBookingOrder(List<String> roomIds, Date startOf, Date endOf);
 
-    @Select("select brlo.*, cr.name as room_name,cr.id as room_id, bc.name as customer_name, cr.layout_id \n" +
+    @Select("select brlo.*, cr.name as room_name,cr.id as room_id, bc.phone, bc.name as customer_name, cr.layout_id \n" +
             "from bus_rooms_living_order brlo \n" +
             "inner join ces_rooms cr on cr.living_order_id = brlo.id \n" +
             "left join bus_customer bc on brlo.contact_id = bc.id " +

+ 91 - 83
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusRoomBookingOrdersMapper.xml

@@ -107,8 +107,8 @@
 
 	select l.id as layout_id,l.`name` as layoutName,DATE_FORMAT(lo.arrival_time,'%Y-%m-%d') as enter_date,DATE_FORMAT(lo.due_out_time,'%Y-%m-%d') as leave_date ,lo.settle_type,
     r.id as room_id,(r.`name`) as room_name, lo.id as living_id, living_order_no as order_no,1 as is_living,lo.contact_id,
-cus.id as customer_id,cus.`name` as customer_name,lo.arrival_time,lo.due_out_time,
-lo.booking_order_id
+    cus.id as customer_id,cus.`name` as customer_name,lo.arrival_time,lo.due_out_time,
+    lo.booking_order_id
     from bus_booking_rooms br inner join bus_rooms_living_order lo
     on br.id = lo.booking_room_id inner join ces_rooms r
     on r.id = br.room_id
@@ -231,74 +231,82 @@ lo.booking_order_id
     </select>
 
     <select id="getKeLiLiving" resultType="org.jeecg.modules.business.vo.KeLiItemVo">
-        select
-        o.id,
-        o.living_order_no as order_no,
-        o.booking_order_id,
-        cus.`name` as customer_name,
-        cus.phone as customer_phone,
-        o.customer_type,
-        o.living_type as o_type,
-        o.settle_type as settle_type,
-        l.`name` as layout_name,
-        r.id as room_id,
-        concat(IFNULL(r.prefix,''),r.`name`) as room_name,
-        o.arrival_time,
-        o.due_out_time,
-        1 as is_living,
-        sum(if(fee.fee_type = 2 ,fee.money,0)) as yushou,
-        (
-            sum(if(fee.fee_type = 2 ,fee.money,0))
-            -
-            sum(if(fee.fee_type = 1,fee.money,0))
-        ) as yu_e
+        select * from (
+            select
+            o.id,
+            o.living_order_no as order_no,
+            o.booking_order_id,
+            cus.`name` as customer_name,
+            cus.phone as customer_phone,
+            o.customer_source,
+            o.customer_type,
+            o.living_type as o_type,
+            o.settle_type as settle_type,
+            l.`name` as layout_name,
+            r.id as room_id,
+            concat(IFNULL(r.prefix,''),r.`name`) as room_name,
+            o.arrival_time,
+            o.due_out_time,
+            1 as is_living,
+            sum(if(fee.fee_type = 2 ,fee.money,0)) as yushou,
+            (sum(if(fee.fee_type = 2 ,fee.money,0)) - sum(if(fee.fee_type = 1,fee.money,0))) as yu_e
 
-        from bus_rooms_living_order o
-        inner join bus_customer cus
-        on o.contact_id = cus.id
-        inner join bus_order_fee fee
-        on fee.living_order_id = o.id
-        inner join bus_booking_rooms br
-        on br.id = o.booking_room_id
-        inner join ces_rooms r
-        on r.id = br.room_id
-        inner join ces_room_layout l
-        on l.id = r.layout_id
-        where o.hotel_id = #{hotelId}
-        <if test="thirdUserId != null and thirdUserId != ''">
-            and o.third_login_user_id = #{thirdUserId}
-        </if>
-        <if test="customerType != null and customerType != ''">
-            and o.customer_type = #{customerType}
-        </if>
-        <if test="layoutId != null and layoutId != ''">
-            and l.id = #{layoutId}
-        </if>
-          /*正常入住 -1   已结: 1  先走未结: 2  联房退房: 3*/
-          /*-1,"正常入住"  1,"结账退房"  2,"未结退房"*/
-        <if test="status == -1 or status == 1 or status == 2">
-            and o.settle_type = #{status}
-        </if>
-<!--        <if test="status == 2">-->
-<!--            and  br.is_main = 1-->
-<!--        </if>-->
-<!--        <if test="status == 3">-->
-<!--            &#45;&#45; 联防退房-->
-<!--            and  (o.settle_type = 1 or o.settle_type = 2)-->
-<!--            and is_union_settled = 1-->
-<!--        </if>-->
-        <if test="keyw != null and keyw != ''" >
-            and (
-            cus.`name` like '%${keyw}%' or cus.phone like '%${keyw}%' or o.living_order_no like '%${keyw}%'
-            )
-        </if>
-        <if test="startTime != null">
-            and o.arrival_time &gt;= #{startTime}
-        </if>
-        <if test="endTime != null">
-            and o.arrival_time &lt;= #{endTime}
+            from bus_rooms_living_order o
+            inner join bus_customer cus
+            on o.contact_id = cus.id
+            inner join bus_order_fee fee
+            on fee.living_order_id = o.id
+            inner join bus_booking_rooms br
+            on br.id = o.booking_room_id
+            inner join ces_rooms r
+            on r.id = br.room_id
+            inner join ces_room_layout l
+            on l.id = r.layout_id
+            where o.hotel_id = #{kedanOrderDto.hotelId}
+            <if test="kedanOrderDto.thirdUserId != null and kedanOrderDto.thirdUserId != ''">
+                and o.third_login_user_id = #{kedanOrderDto.thirdUserId}
+            </if>
+            <if test="kedanOrderDto.livingType != null">
+                and o.living_type = #{kedanOrderDto.livingType}
+            </if>
+              <if test="kedanOrderDto.customerSource != null and kedanOrderDto.customerSource != ''">
+                and o.customer_source = #{kedanOrderDto.customerSource}
+            </if>
+            <if test="kedanOrderDto.customerType != null">
+                and o.customer_type = #{kedanOrderDto.customerType}
+            </if>
+            <if test="kedanOrderDto.layoutId != null and kedanOrderDto.layoutId != ''">
+                and l.id = #{kedanOrderDto.layoutId}
+            </if>
+              /*正常入住 -1   已结: 1  先走未结: 2  联房退房: 3*/
+              /*-1,"正常入住"  1,"结账退房"  2,"未结退房"*/
+            <if test="kedanOrderDto.livingStatus == -1 or kedanOrderDto.livingStatus == 1 or kedanOrderDto.livingStatus == 2">
+                and o.settle_type = #{kedanOrderDto.livingStatus}
+            </if>
+    <!--        <if test="status == 2">-->
+    <!--            and  br.is_main = 1-->
+    <!--        </if>-->
+    <!--        <if test="status == 3">-->
+    <!--            &#45;&#45; 联防退房-->
+    <!--            and  (o.settle_type = 1 or o.settle_type = 2)-->
+    <!--            and is_union_settled = 1-->
+    <!--        </if>-->
+            <if test="kedanOrderDto.keyw != null and kedanOrderDto.keyw != ''" >
+                and (
+                cus.`name` like '%${kedanOrderDto.keyw}%' or cus.phone like '%${kedanOrderDto.keyw}%' or o.living_order_no like '%${kedanOrderDto.keyw}%'
+                )
+            </if>
+            <if test="kedanOrderDto.startTime != null">
+                and o.arrival_time &gt;= #{kedanOrderDto.startTime}
+            </if>
+            <if test="kedanOrderDto.endTime != null">
+                and o.arrival_time &lt;= #{kedanOrderDto.endTime}
+            </if>
+            GROUP BY o.id order by o.create_time desc) c
+        where 1 = 1
+        <if test="kedanOrderDto.onlyDebt">
+            and c.yu_e &lt; 0
         </if>
-        GROUP BY o.id order by o.create_time desc
     </select>
     <select id="getKeBooking" resultType="org.jeecg.modules.business.vo.KeLiItemVo" >
         select
@@ -323,43 +331,43 @@ lo.booking_order_id
 
         left join bus_rooms_living_order brlo on br.id = brlo.booking_room_id
         left join ces_rooms r
-        on r.id = br.room_id and r.hotel_id = #{hotelId}
+        on r.id = br.room_id and r.hotel_id = #{kedanOrderDto.hotelId}
         left join ces_room_layout l
         on l.id = r.layout_id
         inner join bus_customer cus
         on cus.id = o.contact_id
         where 1 = 1
         -- status: 1预定中 2已入住 3已取消 4已失效 5今日应到未到
-        <if test="status == 1 or status == 2  or status == 5">
+        <if test="kedanOrderDto.bookingStatus == 1 or kedanOrderDto.bookingStatus == 2  or kedanOrderDto.bookingStatus == 5">
             and o.booking_status = 1
         </if>
-        <if test="status == 1">
+        <if test="kedanOrderDto.bookingStatus == 1">
             and (brlo.id is null or brlo.id = '') and o.due_out_time >= now()
         </if>
-        <if test="status == 2">
+        <if test="kedanOrderDto.bookingStatus == 2">
             and brlo.id is not null and brlo.id != ''
         </if>
-        <if test="status == 3">
+        <if test="kedanOrderDto.bookingStatus == 3">
             and o.booking_status = 2
         </if>
-        <if test="status == 4">
+        <if test="kedanOrderDto.bookingStatus == 4">
             -- 已失效
             and o.booking_status = 3
         </if>
-        <if test="status == 5">
+        <if test="kedanOrderDto.bookingStatus == 5">
             and o.due_out_time &lt;= now()
         </if>
-        <if test="thirdUserId != null and thirdUserId != ''">
-            and o.third_login_user_id = #{thirdUserId}
+        <if test="kedanOrderDto.thirdUserId != null and kedanOrderDto.thirdUserId != ''">
+            and o.third_login_user_id = #{kedanOrderDto.thirdUserId}
         </if>
-        <if test="keyw != null and keyw != ''" >
-            and (cus.`name` like '%${keyw}%' or cus.phone like '%${keyw}%' or o.booking_orders_no like '%${keyw}%')
+        <if test="kedanOrderDto.keyw != null and kedanOrderDto.keyw != ''" >
+            and (cus.`name` like '%${kedanOrderDto.keyw}%' or cus.phone like '%${kedanOrderDto.keyw}%' or o.booking_orders_no like '%${kedanOrderDto.keyw}%')
         </if>
-        <if test="startTime != null">
-            and o.arrival_time &gt;= #{startTime}
+        <if test="kedanOrderDto.startTime != null">
+            and o.arrival_time &gt;= #{kedanOrderDto.startTime}
         </if>
-        <if test="endTime != null">
-            and o.arrival_time &lt;= #{endTime}
+        <if test="kedanOrderDto.endTime != null">
+            and o.arrival_time &lt;= #{kedanOrderDto.endTime}
         </if>
         GROUP BY o.id,r.id,brlo.id order by o.create_time desc
     </select>

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.business.service;
 import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.business.entity.BusBookingRooms;
 import org.jeecg.modules.business.entity.BusLivingLayoutDayPrice;
 import org.jeecg.modules.business.entity.BusOrderFee;
 import com.baomidou.mybatisplus.extension.service.IService;

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

@@ -64,8 +64,8 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
 
     IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page,String hotelId);
     IPage<RoomLivingQueryVo> getUnionLivingPageData(String keyw, Page<RoomLivingQueryVo> page,String hotelId);
-    IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId,String layoutId, String customerType,Page<KeLiItemVo> page, Date startTime,Date endTime);
-    IPage<KeLiItemVo> getBookingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page, Date startTime,Date endTime);
+    IPage<KeLiItemVo> getLivingOrderKL(Page<KeLiItemVo> page, KedanOrderDto kedanOrderDto);
+    IPage<KeLiItemVo> getBookingOrderKL(Page<KeLiItemVo> page, KedanOrderDto kedanOrderDto);
     Boolean setLivingOrderFee(List<BusOrderFee> fees,String livingOrderId,String hotelId);
     Boolean unionOrder(String roomId,String targetRoomId, String bookingOrderId, String hotelId);
     Boolean mergeOrder(String hotelId, String livingRoomId, List<String> livingOrderId);

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusMemberPointLogServiceImpl.java

@@ -54,7 +54,7 @@ public class BusMemberPointLogServiceImpl extends ServiceImpl<BusMemberPointLogM
                 balance = member.getIntegral() - dto.getNum();
                 break;
             case 3:
-                balance = 0;
+                balance = dto.getNum();
                 break;
         }
         if (balance < 0) balance = 0;

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

@@ -29,6 +29,9 @@ import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.*;
 import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
 import org.jeecg.modules.business.service.*;
+import org.jeecg.modules.business.strategy.PricingStrategy;
+import org.jeecg.modules.business.strategy.PricingStrategyFactory;
+import org.jeecg.modules.business.strategy.impl.*;
 import org.jeecg.modules.business.util.MxTools;
 import org.jeecg.modules.business.vo.*;
 import org.jeecg.modules.fw.entity.FwRoomClean;
@@ -56,6 +59,7 @@ import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -187,6 +191,20 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
     @Resource
     private SysBaseApiImpl sysBaseAPI;
 
+
+    @Resource
+    private PricingStrategyFactory pricingStrategyFactory;
+    @Resource
+    private MinuteAddStrategy minuteAddStrategy;
+    @Resource
+    private DayAddStrategy dayAddStrategy;
+    @Resource
+    private NotAddStrategy notAddStrategy;
+    @Resource
+    private HourRoomStrategy hourRoomStrategy;
+    @Resource
+    private LongRentStrategy longRentStrategy;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
@@ -381,6 +399,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             } else {
                 BusParamPreset paramPreset = busParamPresetService.getOne(Wrappers.<BusParamPreset>lambdaQuery().eq(BusParamPreset::getHotelId, hotelId));
                 Calendar calendar = Calendar.getInstance();
+                calendar.setTime(item.getOrderInfo().getArrivalTime());
                 if (ObjectUtil.equals(paramPreset.getStatus(), 1)) {
                     calendar.add(Calendar.MINUTE, paramPreset.getMinute());
                 }
@@ -1586,21 +1605,43 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             if (!optional.isPresent()){
                 return;
             }
+//            // 全天房
+//            if (ObjectUtil.equals(1,optional.get().getBookingType())){
+//                // 如果房间超时是按分钟加收费用
+//                if (TimeOutRuleEnum.ADD_BY_MINUTE.getKey().equals(cesAllDayPriceRule.getTimeOutRule())){
+//                    addByMinute(e, cesAllDayPriceRule);
+//                }else if (TimeOutRuleEnum.ADD_BY_DAY.getKey().equals(cesAllDayPriceRule.getTimeOutRule())){
+//                    addByDay(e, cesAllDayPriceRule);
+//                }else if (TimeOutRuleEnum.NOT_ADD.getKey().equals(cesAllDayPriceRule.getTimeOutRule())) {
+//                    notAdd(e, cesAllDayPriceRule);
+//                }
+//                // 钟点房
+//            } else if(ObjectUtil.equals(2,optional.get().getBookingType())){
+//                addHourFee(cesHourRoomRuleList, e, cesAllDayPriceRule);
+//            } else if(ObjectUtil.equals(5,optional.get().getBookingType())) {
+//                addLongRentFee(e);
+//            }
             // 全天房
+            String strategyStr = "";
             if (ObjectUtil.equals(1,optional.get().getBookingType())){
                 // 如果房间超时是按分钟加收费用
                 if (TimeOutRuleEnum.ADD_BY_MINUTE.getKey().equals(cesAllDayPriceRule.getTimeOutRule())){
-                    addByMinute(e, cesAllDayPriceRule);
+                    strategyStr = "minuteAddStrategy";
                 }else if (TimeOutRuleEnum.ADD_BY_DAY.getKey().equals(cesAllDayPriceRule.getTimeOutRule())){
-                    addByDay(e, cesAllDayPriceRule);
+                    strategyStr = "dayAddStrategy";
                 }else if (TimeOutRuleEnum.NOT_ADD.getKey().equals(cesAllDayPriceRule.getTimeOutRule())) {
-                    notAdd(e, cesAllDayPriceRule);
+                    strategyStr = "notAddStrategy";
                 }
                 // 钟点房
             } else if(ObjectUtil.equals(2,optional.get().getBookingType())){
-                addHourFee(cesHourRoomRuleList, e, cesAllDayPriceRule);
+                strategyStr = "hourRoomStrategy";
             } else if(ObjectUtil.equals(5,optional.get().getBookingType())) {
-                addLongRentFee(e);
+                strategyStr = "longRentStrategy";
+            }
+            try {
+                pricingStrategyFactory.getStragegy(strategyStr).calculateFee(e, cesAllDayPriceRule, cesHourRoomRuleList);
+            } catch (Exception ex) {
+                return;
             }
         });
         return null;
@@ -2388,11 +2429,12 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         });
         return roomLivings;
     }
+    //Integer status,String keyw,String hotelId,String thirdUserId,String layoutId,String customerType, Page<KeLiItemVo> page, Date startTime,Date endTime
     @Override
-    public IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId,String layoutId,String customerType, Page<KeLiItemVo> page, Date startTime,Date endTime) {
-        IPage<KeLiItemVo> pRes = baseMapper.getKeLiLiving(page,thirdUserId,hotelId,keyw,status, layoutId,customerType, startTime,endTime);
-        List<String> livingIds = pRes.getRecords().stream().map(s->s.getId()).collect(Collectors.toList());
-        List<BusLivingLayoutDayPrice> prices = livingIds.size() >0? livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query()
+    public IPage<KeLiItemVo> getLivingOrderKL(Page<KeLiItemVo> page, KedanOrderDto kedanOrderDto) {
+        IPage<KeLiItemVo> pRes = baseMapper.getKeLiLiving(page, kedanOrderDto);
+        List<String> livingIds = pRes.getRecords().stream().map(KeLiItemVo::getId).collect(Collectors.toList());
+        List<BusLivingLayoutDayPrice> prices = !livingIds.isEmpty() ? livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query()
         .in("living_order_id",livingIds).orderByAsc("day_time")) : new ArrayList<>();
         pRes.getRecords().forEach(s->{
             List<BusLivingLayoutDayPrice> orderDayPrice = prices.stream().filter(a->a.getLivingOrderId().equals(s.getId())).collect(Collectors.toList());
@@ -2401,10 +2443,10 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         return pRes;
     }
     @Override
-    public IPage<KeLiItemVo> getBookingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page, Date startTime,Date endTime) {
-        IPage<KeLiItemVo> pRes = baseMapper.getKeBooking(page,thirdUserId,hotelId,keyw,status,startTime,endTime);
-        List<String> livingIds = pRes.getRecords().stream().map(s->s.getId()).collect(Collectors.toList());
-        List<BusBookingLayoutDayPrice> prices = livingIds.size() >0? dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
+    public IPage<KeLiItemVo> getBookingOrderKL(Page<KeLiItemVo> page, KedanOrderDto kedanOrderDto) {
+        IPage<KeLiItemVo> pRes = baseMapper.getKeBooking(page, kedanOrderDto);
+        List<String> livingIds = pRes.getRecords().stream().map(KeLiItemVo::getId).collect(Collectors.toList());
+        List<BusBookingLayoutDayPrice> prices = !livingIds.isEmpty() ? dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
                 .in("booking_order_id",livingIds).orderByAsc("day_time")) : new ArrayList<>();
         pRes.getRecords().forEach(s->{
             List<BusBookingLayoutDayPrice> orderDayPrice = prices.stream().filter(a->a.getBookingOrderId().equals(s.getId()) && a.getRoomLayoutId().equals(s.getLayoutId())).collect(Collectors.toList());

+ 16 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/PricingStrategy.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.business.strategy;
+
+import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public interface PricingStrategy {
+
+    void calculateFee(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, List<CesHourRoomRule> hourRoomRuleList);
+
+
+}

+ 25 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/PricingStrategyFactory.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.business.strategy;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.modules.business.entity.BusOrderFee;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+@Service
+public class PricingStrategyFactory {
+
+    @Resource
+    public final Map<String,PricingStrategy> strategys = new ConcurrentHashMap<>();
+
+    public PricingStrategy getStragegy(String component) throws Exception{
+        PricingStrategy strategy = strategys.get(component);
+        if(strategy == null){
+            throw new RuntimeException("未找到该收费方式");
+        }
+        return strategy;
+    }
+
+}

+ 67 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/DayAddStrategy.java

@@ -0,0 +1,67 @@
+package org.jeecg.modules.business.strategy.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.impl.BusBookingRoomsServiceImpl;
+import org.jeecg.modules.business.strategy.PricingStrategy;
+import org.jeecg.modules.business.strategy.util.PricingUtil;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Component("dayAddStrategy")
+public class DayAddStrategy implements PricingStrategy {
+
+    @Resource
+    IBusOrderFeeService feeService;
+
+    @Resource
+    private BusBookingRoomsServiceImpl bookingRoomsService;
+
+    @Resource
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Resource
+    PricingUtil pricingUtil;
+    @Override
+    public void calculateFee(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, List<CesHourRoomRule> hourRoomRuleList) {
+        Date date = new Date();
+        Calendar nowCalendar = Calendar.getInstance();
+        Calendar nextCalendar = Calendar.getInstance();
+        BusBookingRooms bookingroom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
+        if (ObjectUtil.isEmpty(bookingroom)) {
+            log.info("未找到订单{}对应的房间", livingOrder.getId());
+            return;
+        }
+        // 查询当天房间超时消费
+        BusOrderFee fee = pricingUtil.getOverTimeFee(livingOrder, bookingroom);
+        // 需要支付完整费用时间的最后时间
+        Date endTime = pricingUtil.getFullFeeTime(date, cesAllDayPriceRule);
+        BusLivingLayoutDayPrice dayPrice = pricingUtil.addDayPrice(livingOrder, bookingroom, bookingroom.getRoomLayoutId());
+        if (nextCalendar.getTime().compareTo(endTime) < 0){
+            // 超时收取半天费用
+            fee.setMoney(dayPrice.getPrice().divide(new BigDecimal(2)));
+            nextCalendar.setTime(endTime);
+        } else {
+            // 添加每日房费
+            fee.setMoney(dayPrice.getPrice());
+            fee.setIsOverTime(false);
+            // 获取每天超时时间,如果超过预离时间,修改预离时间
+            nextCalendar = pricingUtil.getNextCalendar(livingOrder, nowCalendar,cesAllDayPriceRule);
+        }
+        // 移除处理过的时间订单,添加订单下一次超时的时间戳
+        redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+        redisTemplate.opsForZSet().add("overTimerOrder",livingOrder.getId(),nextCalendar.getTimeInMillis());
+        feeService.saveOrUpdate(fee);
+    }
+}

+ 157 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/HourRoomStrategy.java

@@ -0,0 +1,157 @@
+package org.jeecg.modules.business.strategy.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.business.enums.FeeSubjectType;
+import org.jeecg.modules.business.enums.LivingTypeEnum;
+import org.jeecg.modules.business.service.IBusLivingLayoutDayPriceService;
+import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
+import org.jeecg.modules.business.service.IBusSchemeLayoutDailyPriceService;
+import org.jeecg.modules.business.service.impl.BusBookingRoomsServiceImpl;
+import org.jeecg.modules.business.strategy.PricingStrategy;
+import org.jeecg.modules.business.strategy.util.PricingUtil;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+@Slf4j
+@Component("hourRoomStrategy")
+public class HourRoomStrategy  implements PricingStrategy {
+
+    @Resource
+    IBusOrderFeeService feeService;
+
+    @Resource
+    private BusBookingRoomsServiceImpl bookingRoomsService;
+
+    @Resource
+    private RedisTemplate<String, Object> redisTemplate;
+
+
+    @Resource
+    private IBusLivingLayoutDayPriceService livingLayoutDayPriceService;
+
+    @Resource
+    IBusSchemeLayoutDailyPriceService schemeLayoutDailyPriceService;
+
+    @Resource
+    private IBusRoomsLivingOrderService roomsLivingOrderService;
+
+    @Resource
+    PricingUtil pricingUtil;
+
+    @Override
+    public void calculateFee(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, List<CesHourRoomRule> hourRoomRuleList) {
+        // TODO: 2023/10/24 钟点房超时收费
+        Optional<CesHourRoomRule> ruleOptional = hourRoomRuleList.stream().filter(rule -> rule.getId().equals(livingOrder.getHourRoomId())).findFirst();
+        ruleOptional.ifPresent(rule -> {
+            Calendar nowCalendar = Calendar.getInstance();
+            Calendar nextCalendar = Calendar.getInstance();
+            nextCalendar.setTime(livingOrder.getDueOutTime());
+            Integer overMinutes = Math.round((nowCalendar.getTimeInMillis() - nextCalendar.getTimeInMillis()) / (1000 * 60 ));
+            if (overMinutes <= 0){
+                return;
+            }
+            BusBookingRooms bookingroom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
+            if (ObjectUtil.isEmpty(bookingroom)){
+                log.info("未找到订单{}对应的房间", livingOrder.getId());
+                return;
+            }
+            BusOrderFee fee = pricingUtil.getOverTimeFee(livingOrder, bookingroom);
+            // 转为全天房
+            if (rule.getLimitTimeTransferAllDay() != 0 && overMinutes > rule.getLimitTimeTransferAllDay()){
+                Date arrivalTime = livingOrder.getArrivalTime();
+                Calendar arrivalCalendar = Calendar.getInstance();
+                arrivalCalendar.setTime(arrivalTime);
+                DateTime leaveTime = DateUtil.parse(cesAllDayPriceRule.getLeaveTime(), "HH:mm");
+                Calendar leaveCalendar = Calendar.getInstance();
+                leaveCalendar.setTime(leaveTime);
+                leaveCalendar.set(Calendar.YEAR, arrivalCalendar.get(Calendar.YEAR));
+                leaveCalendar.set(Calendar.MONTH, arrivalCalendar.get(Calendar.MONTH));
+                leaveCalendar.set(Calendar.DAY_OF_MONTH, arrivalCalendar.get(Calendar.DAY_OF_MONTH));
+                Calendar enterCalendar = Calendar.getInstance();
+                DateTime enterTime = DateUtil.parse(cesAllDayPriceRule.getEnterTime(), "HH:mm");
+                enterCalendar.setTime(enterTime);
+                if (arrivalCalendar.get(Calendar.HOUR_OF_DAY) > enterCalendar.get(Calendar.HOUR_OF_DAY)
+                        || arrivalCalendar.get(Calendar.HOUR_OF_DAY) == enterCalendar.get(Calendar.HOUR_OF_DAY)
+                        && arrivalCalendar.get(Calendar.MINUTE) > enterCalendar.get(Calendar.MINUTE)){
+                    // 如果预抵时间在enterTime后面 则预离时间为隔天
+                    leaveCalendar.add(Calendar.DAY_OF_YEAR, 1);
+                }
+                livingOrder.setDueOutTime(leaveCalendar.getTime());
+                livingOrder.setLivingType(LivingTypeEnum.ALL_DAY.getKey());
+                List<BusOrderFee> busOrderFees = feeService.list(Wrappers.<BusOrderFee>lambdaQuery()
+                        .eq(BusOrderFee::getLivingOrderId, livingOrder.getId()).eq(BusOrderFee::getSubjectType, FeeSubjectType.MEI_RI_FANG_FEI.getKey()));
+                Optional<BusOrderFee> orderFee = busOrderFees.stream().filter(e -> !e.getIsOverTime()).findFirst();
+
+                // 修改房费为全天房费
+                orderFee.ifPresent(e -> {
+                    BusLivingLayoutDayPrice dayPrice = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>lambdaQuery()
+                            .eq(BusLivingLayoutDayPrice::getLivingOrderId, livingOrder.getId())
+                            .eq(BusLivingLayoutDayPrice::getDayTime, DateUtils.formatDate(livingOrder.getArrivalTime())).last("limit 1"));
+                    BigDecimal money = schemeLayoutDailyPriceService.getOneDayPrice(bookingroom.getRoomLayoutId(), livingOrder, new Date());
+                    e.setMoney(money);
+                    feeService.updateById(e);
+                    if (dayPrice != null){
+                        dayPrice.setPrice(money);
+                        livingLayoutDayPriceService.updateById(dayPrice);
+                    }
+                });
+                // 删除超时收费项
+                Optional<BusOrderFee> overTimeFee = busOrderFees.stream().filter(BusOrderFee::getIsOverTime).findFirst();
+                overTimeFee.ifPresent(e -> {
+                    feeService.removeById(e.getId());
+                });
+                roomsLivingOrderService.updateById(livingOrder);
+                leaveCalendar.add(Calendar.MINUTE, Integer.parseInt(cesAllDayPriceRule.getDayTime()));
+                redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+                redisTemplate.opsForZSet().add("overTimerOrder",livingOrder.getId(),leaveCalendar.getTimeInMillis());
+                return;
+            }
+            //已经超时的 不足时间
+            Integer minutesDiff = overMinutes % rule.getExceedTime();
+            // 超出 超时时间 的数量
+            Integer minutesDiffNum = (int) Math.floor(overMinutes / rule.getExceedTime());
+            // 不足时间 数量
+            Integer moreThenMinuteDiffNum = (int) Math.floor(minutesDiff / rule.getNotReachExceedTime());
+            // 加上下一次不足时间 >= 超出时间,用超出时间
+            if (minutesDiff + rule.getNotReachExceedTime() > rule.getExceedTime()){
+                Integer newOverTime = rule.getExceedTime() * (minutesDiffNum + 1);
+                nextCalendar.add(Calendar.MINUTE, newOverTime);
+            }else {
+                nextCalendar.add(Calendar.MINUTE, rule.getNotReachExceedTime());
+            }
+            log.info("钟点房{}今日超时分钟{},超时时间数量{},不足时间数量{}",livingOrder.getId(),overMinutes,minutesDiffNum,moreThenMinuteDiffNum);
+            BigDecimal money = rule.getExceedPay().multiply(BigDecimal.valueOf(minutesDiffNum))
+                    .add(rule.getNotReachExceedTimePay().multiply(BigDecimal.valueOf(moreThenMinuteDiffNum)));
+            // 有上限,且金额超过当前上限
+            if (rule.getMaxExtraPay().compareTo(new BigDecimal(0)) != 0 && rule.getMaxExtraPay().compareTo(money) < 0){
+                money = rule.getMaxExtraPay();
+            }
+            fee.setMoney(money);
+            fee.setDayTime(nowCalendar.getTime());
+            redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+            log.info(format.format(nextCalendar.getTime()));
+            redisTemplate.opsForZSet().add("overTimerOrder",livingOrder.getId(),nextCalendar.getTimeInMillis());
+            // 添加超时房费
+            feeService.saveOrUpdate(fee);
+        });
+    }
+}

+ 112 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/LongRentStrategy.java

@@ -0,0 +1,112 @@
+package org.jeecg.modules.business.strategy.impl;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.business.entity.BusBookingRooms;
+import org.jeecg.modules.business.entity.BusOrderFee;
+import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
+import org.jeecg.modules.business.enums.FeeSubjectType;
+import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.impl.BusBookingRoomsServiceImpl;
+import org.jeecg.modules.business.strategy.PricingStrategy;
+import org.jeecg.modules.rooms.Enum.ChargeTypeEnum;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
+import org.jeecg.modules.rooms.entity.CesHouseLongRentCharge;
+import org.jeecg.modules.rooms.entity.CesRooms;
+import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
+import org.jeecg.modules.rooms.service.ICesHouseLongRentChargeService;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Component("longRentStrategy")
+public class LongRentStrategy  implements PricingStrategy {
+    @Resource
+    IBusOrderFeeService feeService;
+
+    @Resource
+    private BusBookingRoomsServiceImpl bookingRoomsService;
+
+    @Resource
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Resource
+    ICesHouseLongRentChargeService houseLongRentChargeService;
+
+    @Resource
+    CesRoomsServiceImpl roomsService;
+
+
+    @Override
+    public void calculateFee(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, List<CesHourRoomRule> hourRoomRuleList) {
+        BusBookingRooms bookingroom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
+        if (ObjectUtil.isEmpty(bookingroom)){
+            log.info("未找到订单{}对应的房间", livingOrder.getId());
+            return;
+        }
+        CesRooms room = roomsService.getById(bookingroom.getRoomId());
+        List<CesHouseLongRentCharge> list = houseLongRentChargeService.list(Wrappers.<CesHouseLongRentCharge>
+                        lambdaQuery().eq(CesHouseLongRentCharge::getLivingOrderId, livingOrder.getId())
+                .eq(CesHouseLongRentCharge::getChargeType, ChargeTypeEnum.PERIODICITY.getKey()));
+        if (list.isEmpty()){
+            return;
+        }
+        Integer cycle = list.get(0).getNum();
+        List<BusOrderFee> orderFees = new ArrayList<>();
+        Calendar nowCalendar = Calendar.getInstance();
+        Calendar arriveCalendar = Calendar.getInstance();
+        arriveCalendar.setTime(livingOrder.getArrivalTime());
+        int year = nowCalendar.get(Calendar.YEAR) - arriveCalendar.get(Calendar.YEAR);
+        int month = nowCalendar.get(Calendar.MONTH) - arriveCalendar.get(Calendar.MONTH);
+        // 当前与入住时相距月份
+        int monthDiffer = year * 12 + month;
+        Calendar dueOutCalendar = Calendar.getInstance();
+        dueOutCalendar.setTime(livingOrder.getDueOutTime());
+        int allYear = dueOutCalendar.get(Calendar.YEAR) - arriveCalendar.get(Calendar.YEAR);
+        int allMonth = dueOutCalendar.get(Calendar.MONTH) - arriveCalendar.get(Calendar.MONTH);
+        // 总入住月份
+        int allMonthDiffer = allYear * 12 + allMonth;
+        if (monthDiffer >= allMonthDiffer){
+            return;
+        }
+        // 下一次收费月份
+        arriveCalendar.set(Calendar.YEAR, nowCalendar.get(Calendar.YEAR));
+        arriveCalendar.set(Calendar.MONTH, nowCalendar.get(Calendar.MONTH));
+        Integer nextMonthNum = allMonthDiffer - monthDiffer < cycle ? allMonthDiffer - monthDiffer : cycle;
+        arriveCalendar.add(Calendar.MONTH, nextMonthNum);
+        list.forEach(e -> {
+            BusOrderFee dayOrderFee = new BusOrderFee();
+            dayOrderFee.setDayTime(new Date());
+            dayOrderFee.setCreateTime(new Date());
+            dayOrderFee.setRemark(e.getName());
+            String roomName = room.getPrefix() != null? room.getPrefix():"";
+            roomName += roomName + room.getName();
+            dayOrderFee.setMoney(e.getMoney());
+            dayOrderFee.setSubjectType(FeeSubjectType.OTHER.getKey());
+            dayOrderFee.setMoney(e.getMoney().multiply(BigDecimal.valueOf(nextMonthNum)));
+            if (e.getIsMust() != null && e.getIsMust()){
+                dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+                dayOrderFee.setRemark(DateUtil.format(new Date(), "yyyy-MM") + e.getName());
+            }
+            dayOrderFee.setFeeType(1);
+            dayOrderFee.setRoomId(room.getId());
+            dayOrderFee.setLivingOrderId(livingOrder.getId());
+            dayOrderFee.setHotelId(room.getHotelId());
+            orderFees.add(dayOrderFee);
+        });
+        feeService.saveBatch(orderFees);
+        redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+        redisTemplate.opsForZSet().add("overTimerOrder",livingOrder.getId(), arriveCalendar.getTimeInMillis());
+
+    }
+}

+ 112 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/MinuteAddStrategy.java

@@ -0,0 +1,112 @@
+package org.jeecg.modules.business.strategy.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.impl.BusBookingRoomsServiceImpl;
+import org.jeecg.modules.business.strategy.PricingStrategy;
+import org.jeecg.modules.business.strategy.util.PricingUtil;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Component("minuteAddStrategy")
+public class MinuteAddStrategy  implements PricingStrategy {
+
+    @Autowired
+    IBusOrderFeeService feeService;
+
+    @Autowired
+    private BusBookingRoomsServiceImpl bookingRoomsService;
+
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Autowired
+    PricingUtil pricingUtil;
+
+    @Override
+    public void calculateFee(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, List<CesHourRoomRule> hourRoomRuleList) {
+        Date date = new Date();
+        Calendar nextCalendar = Calendar.getInstance();
+        Calendar nowCalendar = Calendar.getInstance();
+        nextCalendar.setTime(date);
+        BusBookingRooms bookingroom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
+        if (ObjectUtil.isEmpty(bookingroom)){
+            log.info("未找到订单{}对应的房间", livingOrder.getId());
+            return;
+        }
+        // 查询当天房间超时消费
+        BusOrderFee fee = pricingUtil.getOverTimeFee(livingOrder, bookingroom);
+        // 需要支付完整费用时间的最后时间
+        Date endTime = pricingUtil.getFullFeeTime(date, cesAllDayPriceRule);
+        // 当前时间加上超时收费时间
+//        nextCalendar.add(Calendar.MINUTE, cesAllDayPriceRule.getMinute());
+        // 获取今日第一次超时时间
+        nextCalendar = pricingUtil.getRemindTime(livingOrder, cesAllDayPriceRule, 1);
+        nextCalendar.set(Calendar.YEAR, nowCalendar.get(Calendar.YEAR));
+        nextCalendar.set(Calendar.MONTH, nowCalendar.get(Calendar.MONTH));
+        nextCalendar.set(Calendar.DATE, nowCalendar.get(Calendar.DATE));
+        // 今日超时分钟
+        Integer overMinutes = Math.round((nowCalendar.getTimeInMillis() - nextCalendar.getTimeInMillis()) / (1000 * 60 ));
+        if (overMinutes < 0){
+            return;
+        }
+        //已经超时的 不足时间
+        Integer minutesDiff = overMinutes % cesAllDayPriceRule.getMinute();
+        // 超出 超时时间 的数量
+        int minutesDiffNum = (int) Math.floor(overMinutes / cesAllDayPriceRule.getMinute());
+
+        int moreThenMinuteDiffNum = (int) Math.floor(minutesDiff / cesAllDayPriceRule.getMoreThenMinute());
+        // 加上下一次不足时间 >= 超出时间,用超出时间
+        if (minutesDiff + cesAllDayPriceRule.getMoreThenMinute() > cesAllDayPriceRule.getMinute()){
+            int newOverTime = cesAllDayPriceRule.getMinute() * (minutesDiffNum + 1);
+            nextCalendar.add(Calendar.MINUTE, newOverTime);
+        }else {
+            nextCalendar.add(Calendar.MINUTE, cesAllDayPriceRule.getMoreThenMinute());
+        }
+//        log.info(DateUtil.format(nextCalendar.getTime(), "yyyy-MM-dd HH:mm"));
+
+        log.info("{}今日超时分钟{},超时时间数量{},不足时间数量{}",livingOrder.getId(),overMinutes,minutesDiffNum,moreThenMinuteDiffNum);
+
+        // 当前时间加上超时收费时间 < 按全天收费时间的标准
+        if (nextCalendar.getTime().compareTo(endTime) < 0){
+            // 不满足的情况下,添加超时收费,设置下一次收费时间戳
+            BigDecimal money = cesAllDayPriceRule.getPrice().multiply(BigDecimal.valueOf(minutesDiffNum))
+                    .add(cesAllDayPriceRule.getMoreThenPrice().multiply(BigDecimal.valueOf(moreThenMinuteDiffNum)));
+            fee.setDayTime(date);
+            fee.setMoney(money);
+            redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+
+            // 如果下一次增加收费时间大于 全天收费时间 设置
+        }else {
+            // 如果满足全天收费要求,预离时间增加1天
+            BusLivingLayoutDayPrice dayPrice = pricingUtil.addDayPrice(livingOrder, bookingroom, bookingroom.getRoomLayoutId());
+            fee.setMoney(dayPrice.getPrice());
+            fee.setDayTime(date);
+            // 获取每天超时时间,如果超过预离时间,修改预离时间
+            nextCalendar = pricingUtil.getNextCalendar(livingOrder, nowCalendar,cesAllDayPriceRule);
+            fee.setRemark(DateUtils.formatDate(nowCalendar.getTime(), "MM-dd") + "房费");
+            fee.setIsOverTime(false);
+        }
+        // 移除处理过的时间订单,添加订单下一次超时的时间戳
+        redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+        redisTemplate.opsForZSet().add("overTimerOrder",livingOrder.getId(),nextCalendar.getTimeInMillis());
+        // 添加超时房费
+        feeService.saveOrUpdate(fee);
+    }
+
+}
+

+ 63 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/impl/NotAddStrategy.java

@@ -0,0 +1,63 @@
+package org.jeecg.modules.business.strategy.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.impl.BusBookingRoomsServiceImpl;
+import org.jeecg.modules.business.strategy.PricingStrategy;
+import org.jeecg.modules.business.strategy.util.PricingUtil;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Component("notAddStrategy")
+public class NotAddStrategy  implements PricingStrategy {
+
+    @Resource
+    IBusOrderFeeService feeService;
+
+    @Resource
+    private BusBookingRoomsServiceImpl bookingRoomsService;
+
+    @Resource
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @Resource
+    PricingUtil pricingUtil;
+
+    @Override
+    public void calculateFee(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, List<CesHourRoomRule> hourRoomRuleList) {
+        Date date = new Date();
+        Calendar nowCalendar = Calendar.getInstance();
+        Calendar nextCalendar = Calendar.getInstance();
+        BusBookingRooms bookingroom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
+        if (ObjectUtil.isEmpty(bookingroom)) {
+            log.info("未找到订单{}对应的房间", livingOrder.getId());
+            return;
+        }
+        // 查询当天房间超时消费
+        BusOrderFee fee = pricingUtil.getOverTimeFee(livingOrder, bookingroom);
+        // 需要支付完整费用时间的最后时间
+        Date endTime = pricingUtil.getFullFeeTime(date, cesAllDayPriceRule);
+        if (nextCalendar.getTime().compareTo(endTime) >= 0){
+            // 添加每日房费
+            BusLivingLayoutDayPrice dayPrice = pricingUtil.addDayPrice(livingOrder, bookingroom, bookingroom.getRoomLayoutId());
+            fee.setMoney(dayPrice.getPrice());
+            fee.setIsOverTime(false);
+            // 获取每天超时时间,如果超过预离时间,修改预离时间
+            nextCalendar = pricingUtil.getNextCalendar(livingOrder, nowCalendar,cesAllDayPriceRule);
+        }
+        // 移除处理过的时间订单,添加订单下一次超时的时间戳
+        redisTemplate.opsForZSet().remove("overTimerOrder",livingOrder.getId());
+        redisTemplate.opsForZSet().add("overTimerOrder",livingOrder.getId(),nextCalendar.getTimeInMillis());
+        feeService.saveOrUpdate(fee);
+    }
+}

+ 149 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/strategy/util/PricingUtil.java

@@ -0,0 +1,149 @@
+package org.jeecg.modules.business.strategy.util;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.business.entity.BusBookingRooms;
+import org.jeecg.modules.business.entity.BusLivingLayoutDayPrice;
+import org.jeecg.modules.business.entity.BusOrderFee;
+import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
+import org.jeecg.modules.business.enums.FeeSubjectType;
+import org.jeecg.modules.business.enums.FeeType;
+import org.jeecg.modules.business.service.IBusLivingLayoutDayPriceService;
+import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
+import org.jeecg.modules.business.service.IBusSchemeLayoutDailyPriceService;
+import org.jeecg.modules.rooms.entity.CesAllDayPriceRule;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+@Component
+public class PricingUtil {
+
+    @Resource
+    private IBusLivingLayoutDayPriceService livingLayoutDayPriceService;
+
+    @Resource
+    IBusSchemeLayoutDailyPriceService schemeLayoutDailyPriceService;
+
+    @Resource
+    IBusRoomsLivingOrderService roomsLivingOrderService;
+
+    @Resource
+    IBusOrderFeeService feeService;
+
+    /**
+     * 完整费用时间
+     * @return
+     */
+    public Date getFullFeeTime(Date date, CesAllDayPriceRule cesAllDayPriceRule){
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd ");
+        String endDateStr = dateFormat.format(date);
+        Date endTime = null;
+        try {
+            endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(endDateStr + cesAllDayPriceRule.getEndTime());
+        } catch (ParseException ex) {
+            throw new JeecgBootException("结束时间格式异常");
+        }
+        return endTime;
+    }
+
+    /**
+     * 首次超时收费时间
+     */
+    public Calendar getRemindTime(BusRoomsLivingOrder livingOrder, CesAllDayPriceRule cesAllDayPriceRule, Integer BookingType){
+        Calendar calendar = Calendar.getInstance();
+        if (ObjectUtil.equals(BookingType, 1)) {
+            calendar.setTime(livingOrder.getArrivalTime());
+            calendar.add(Calendar.DAY_OF_YEAR, 1);
+            Calendar overDate = Calendar.getInstance();
+            overDate.setTime(livingOrder.getDueOutTime());
+            calendar.set(Calendar.HOUR_OF_DAY, overDate.get(Calendar.HOUR_OF_DAY));
+            calendar.set(Calendar.MINUTE, overDate.get(Calendar.MINUTE));
+            calendar.add(Calendar.MINUTE, Integer.parseInt(cesAllDayPriceRule.getDayTime()));
+        }else if(ObjectUtil.equals(BookingType, 2)){
+            // TODO: 2023/10/24 钟点房超时时间
+            calendar.setTime(livingOrder.getDueOutTime());
+        }
+        return calendar;
+    }
+
+
+    public BusLivingLayoutDayPrice addDayPrice(BusRoomsLivingOrder livingOrder, BusBookingRooms bookingroom, String layoutId){
+        List<BusLivingLayoutDayPrice> dayPrices = livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query()
+                .eq("living_order_id",livingOrder.getId()));
+        Optional<BusLivingLayoutDayPrice> opPrice = dayPrices.stream().filter(a-> DateUtils.formatDate(a.getDayTime()).equals(DateUtils.formatDate(livingOrder.getDueOutTime()))).findFirst();
+        if(!opPrice.isPresent()){
+            // 根据房价方案查询价格
+            BigDecimal money = schemeLayoutDailyPriceService.getOneDayPrice(layoutId, livingOrder, new Date());
+            BusLivingLayoutDayPrice nPrice = new BusLivingLayoutDayPrice();
+            nPrice.setBookingRoomId(livingOrder.getBookingRoomId());
+            try {
+                nPrice.setDayTime(DateUtils.parseDate(DateUtils.formatDate(new Date()),"yyyy-MM-dd"));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+
+            nPrice.setRoomId(bookingroom.getRoomId());
+            nPrice.setRoomLayoutId(bookingroom.getRoomLayoutId());
+            nPrice.setPrice(money);
+            nPrice.setLivingOrderId(livingOrder.getId());
+            nPrice.setLivingType(livingOrder.getLivingType());
+            livingLayoutDayPriceService.save(nPrice);
+            return nPrice;
+        }
+        return opPrice.get();
+    }
+
+    public Calendar getNextCalendar(BusRoomsLivingOrder livingOrder, Calendar nowCalendar,CesAllDayPriceRule cesAllDayPriceRule) {
+        Calendar nextCalendar = Calendar.getInstance();
+        nextCalendar.setTime(livingOrder.getDueOutTime());
+        nextCalendar.set(Calendar.YEAR, nowCalendar.get(Calendar.YEAR));
+        nextCalendar.set(Calendar.MONTH, nowCalendar.get(Calendar.MONTH));
+        nextCalendar.set(Calendar.DAY_OF_MONTH, nowCalendar.get(Calendar.DAY_OF_MONTH));
+        nextCalendar.add(Calendar.DAY_OF_YEAR,1);
+        // 修改预离时间
+        if(nextCalendar.getTime().compareTo(livingOrder.getDueOutTime()) > 0){
+            livingOrder.setDueOutTime(nextCalendar.getTime());
+            roomsLivingOrderService.updateById(livingOrder);
+        }
+        // 下一次收费时间戳
+        nextCalendar.add(Calendar.MINUTE, Integer.parseInt(cesAllDayPriceRule.getDayTime()));
+        return nextCalendar;
+    }
+
+    public BusOrderFee getOverTimeFee(BusRoomsLivingOrder livingOrder, BusBookingRooms bookingroom) {
+        List<BusOrderFee> feeList = feeService.list(Wrappers.<BusOrderFee>lambdaQuery()
+                .eq(BusOrderFee::getLivingOrderId, livingOrder.getId()).eq(BusOrderFee::getPreferentialStatus, 1)
+                .eq(BusOrderFee::getSubjectType, FeeSubjectType.MEI_RI_FANG_FEI.getKey()).eq(BusOrderFee::getIsOverTime, true)
+                .orderByDesc(BusOrderFee::getCreateTime));
+        if (CollUtil.isNotEmpty(feeList)) {
+            return feeList.get(0);
+        }
+        BusOrderFee fee = new BusOrderFee();
+        fee.setMoney(new BigDecimal(0));
+        fee.setCreateTime(new Date());
+        fee.setDayTime(new Date());
+        fee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+        fee.setLivingOrderId(livingOrder.getId());
+        fee.setHotelId(livingOrder.getHotelId());
+        fee.setFeeType(FeeType.CONSUME.getKey());
+        fee.setRoomId(bookingroom.getRoomId());
+        fee.setRemark("超时房费");
+        fee.setIsOverTime(true);
+        return fee;
+    }
+
+}

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

@@ -5,12 +5,14 @@ import lombok.Data;
 import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.rooms.entity.CesHouseLongRentScheme;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 @Data
 public class ExtendBusBookingRoomsVo extends BusBookingRooms {
     private String layoutName;
     private String roomName;
+    private BigDecimal marketPrice;
     private List<BusBookingLayoutDayPrice> layoutDayPrices;
     private List<BusLivingLayoutDayPrice> livingDayPrices;
     private BusRoomsLivingOrder livingOrder;

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

@@ -24,6 +24,7 @@ public class KeLiItemVo {
     @Excel(name = "电话", width = 15)
     private String customerPhone;
     private Integer customerType;
+    private String customerSource;
     private Integer oType;
     private Integer bookingStatus;
     @Excel(name = "房型", width = 15)

+ 35 - 8
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/controller/FwRoomExamineController.java

@@ -15,18 +15,14 @@ import javax.servlet.http.HttpServletResponse;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.common.api.dto.message.MessageDTO;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.TokenUtils;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.business.entity.BusCustomer;
-import org.jeecg.modules.business.entity.BusLivingCustomer;
-import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
-import org.jeecg.modules.business.entity.BusWaiter;
-import org.jeecg.modules.business.service.IBusCustomerService;
-import org.jeecg.modules.business.service.IBusLivingCustomerService;
-import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
-import org.jeecg.modules.business.service.IBusWaiterService;
+import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.business.service.*;
 import org.jeecg.modules.fw.entity.FwRoomExamine;
 import org.jeecg.modules.fw.service.IFwRoomExamineService;
 
@@ -38,6 +34,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.rooms.Enum.RoomStatusEnum;
 import org.jeecg.modules.rooms.entity.CesRooms;
 import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -79,6 +78,13 @@ public class FwRoomExamineController extends JeecgController<FwRoomExamine, IFwR
 	@Resource
 	private IBusWaiterService busWaiterService;
 
+	 @Resource
+	 private SysBaseApiImpl sysBaseAPI;
+	 @Resource
+	 private ISysUserService sysUserService;
+	 @Resource
+	 private IBusHotelService busHotelService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -168,6 +174,27 @@ public class FwRoomExamineController extends JeecgController<FwRoomExamine, IFwR
 			 case 3:
 				 fwRoomExamine.setCompletedTime(DateTime.now());
 				 fwRoomExamine.setCompletedBy(TokenUtils.getAuthUser().getRealname());
+				 /*添加消息通知*/
+				 BusHotel busHotel = busHotelService.getById(fwRoomExamine.getHotelId());
+				 LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+				 lambdaQueryWrapper.eq(SysUser::getDelFlag, 0);
+				 lambdaQueryWrapper.eq(SysUser::getRelTenantIds, busHotel.getTenantId());
+				 List<SysUser> sysUsers = sysUserService.list(lambdaQueryWrapper);
+				 String userIds = "";
+				 for (SysUser sysUser : sysUsers) {
+					 userIds += sysUser.getUsername() + ",";
+				 }
+				 if (!userIds.isEmpty()) {
+					 MessageDTO messageDTO = new MessageDTO();
+					 messageDTO.setFromUser("");
+					 messageDTO.setToUser(userIds);
+					 messageDTO.setTenantId(busHotel.getTenantId());
+					 messageDTO.setTitle(fwRoomExamine.getRoomName() + "查房完毕");
+					 messageDTO.setContent(fwRoomExamine.getRoomName() + "查房完毕");
+					 messageDTO.setCategory(CommonConstant.MSG_CATEGORY_1);
+					 messageDTO.setMsgCategoryDetail(CommonConstant.MSG_ROOM);
+					 sysBaseAPI.sendSysAnnouncement(messageDTO);
+				 }
 				 break;
 		 }
 		 fwRoomExamineService.updateById(fwRoomExamine);

+ 8 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/pos/controller/PosSellClearGoodsController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.pos.controller;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -118,11 +119,16 @@ public class PosSellClearGoodsController extends JeecgController<PosSellClearGoo
 	 public Result<IPage<CesGoods>> queryPageList(CesGoods cesGoods,
 														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-												  @RequestParam(name="goodTypes[]",required = false) List<String> goodTypes,
+												  			@RequestParam(name="goodTypes[]",required = false) List<String> goodTypes,
+												  			@RequestParam(name="keyw",required = false) String keyw,
 														   HttpServletRequest req) {
 		 LambdaQueryWrapper<CesGoods> queryWrapper = QueryGenerator.initQueryWrapper(cesGoods, req.getParameterMap()).lambda();
 		 queryWrapper.eq(CesGoods::getInvalid, false);
 		 queryWrapper.eq(CesGoods::getIsTemp, false);
+		 if (StrUtil.isNotEmpty(keyw)){
+			 queryWrapper.and(e -> e.eq(CesGoods::getBarCode, keyw).or().
+					 like(CesGoods::getName, keyw).or().like(CesGoods::getSimplySpell, keyw.toUpperCase()));
+		 }
 		 if (ObjectUtils.isNotEmpty(goodTypes)) {
 			 List<CesStockType> list = cesStockTypeService.list(Wrappers.<CesStockType>lambdaQuery()
 					 .eq(CesStockType::getHotelId, cesGoods.getHotelId())
@@ -140,7 +146,7 @@ public class PosSellClearGoodsController extends JeecgController<PosSellClearGoo
 				 }
 			 });
 		 }
-		 Page<CesGoods> page = new Page<CesGoods>(pageNo, pageSize);
+		 Page<CesGoods> page = new Page<>(pageNo, pageSize);
 		 IPage<CesGoods> pageList = cesGoodsService.page(page, queryWrapper);
 		 pageList.getRecords().forEach(item -> {
 			 if (item.getInventory() <= 0) {

+ 3 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/pos/mapper/xml/PosOrderGoodsMapper.xml

@@ -11,9 +11,9 @@
         <if test="bookingOrder.hotelId != null and bookingOrder.hotelId != ''">and pog.hotel_id = #{ bookingOrder.hotelId }</if>
         <if test="bookingOrder.state != null">and pbo.state = #{ bookingOrder.state }</if>
         <if test="bookingOrder.posType != null">and pbo.pos_type = #{ bookingOrder.posType }</if>
-        <if test="bookingOrder.code != null and bookingOrder.code != ''">and pbo.code = #{ bookingOrder.code }</if>
-        <if test="bookingOrder.customerName != null and bookingOrder.customerName != ''">and pbo.customerName = #{ bookingOrder.customerName }</if>
-        <if test="bookingOrder.phone != null and bookingOrder.phone != ''">and pbo.phone = #{ bookingOrder.phone }</if>
+        <if test="bookingOrder.code != null and bookingOrder.code != ''">and pbo.code like concat('%',#{bookingOrder.code},'%')</if>
+        <if test="bookingOrder.customerName != null and bookingOrder.customerName != ''">and pbo.customer_name like concat('%',#{ bookingOrder.customerName },'%')</if>
+        <if test="bookingOrder.phone != null and bookingOrder.phone != ''">and pbo.phone like concat('%',#{ bookingOrder.phone },'%')</if>
         <if test="startTime != null">and pbo.arrive_time &gt;= #{startTime}</if>
         <if test="endTime != null">and pbo.arrive_time &lt;= #{ endTime }</if>
     </select>

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/quartz/job/NightAuditJob.java

@@ -27,7 +27,7 @@ public class NightAuditJob implements Job {
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         log.info("时间{},酒店id:{},修改房费",new Date(),parameter);
-        bookingOrdersService.syncDayRoomFee(parameter);
+//        bookingOrdersService.syncDayRoomFee(parameter);
         cesRoomsService.returnReserveRoom();
         cesRoomsService.getReserveRoom();
     }

+ 7 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesGoodsController.java

@@ -24,6 +24,7 @@ import org.jeecg.modules.rooms.entity.CesGoods;
 import org.jeecg.modules.rooms.entity.CesStockType;
 import org.jeecg.modules.rooms.service.CesGoodsServiceImpl;
 import org.jeecg.modules.rooms.service.CesStockTypeServiceImpl;
+import org.jeecg.modules.rooms.util.Pinyin4jUtil;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -130,6 +131,7 @@ public class CesGoodsController extends JeecgController<CesGoods,CesGoodsService
             return Result.error(ResultCode.PARAM_MISS);
         }
         try {
+            dto.setSimplySpell(Pinyin4jUtil.toPinYinUppercase(dto.getName()));
             return goodsService.create(dto);
         } catch (Exception e) {
             return Result.error(e.getMessage());
@@ -146,6 +148,7 @@ public class CesGoodsController extends JeecgController<CesGoods,CesGoodsService
         if (StringUtils.isBlank(dto.getId())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
+        dto.setSimplySpell(Pinyin4jUtil.toPinYinUppercase(dto.getName()));
         try {
             return goodsService.modify(dto);
         } catch (Exception e) {
@@ -227,8 +230,10 @@ public class CesGoodsController extends JeecgController<CesGoods,CesGoodsService
         LambdaQueryWrapper<CesGoods> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(CesGoods::getInvalid, false);
         queryWrapper.eq(CesGoods::getIsTemp, false);
-        queryWrapper.like(StrUtil.isNotEmpty(cesGoods.getName()),CesGoods::getName, cesGoods.getName());
-        queryWrapper.eq(StrUtil.isNotEmpty(cesGoods.getBarCode()),CesGoods::getBarCode, cesGoods.getBarCode());
+        if (StrUtil.isNotEmpty(cesGoods.getName())) {
+            queryWrapper.and(e -> e.eq(CesGoods::getBarCode, cesGoods.getName()).or().
+                    like(CesGoods::getName, cesGoods.getName()).or().like(CesGoods::getSimplySpell, cesGoods.getName().toUpperCase()));
+        }
         if (StrUtil.isNotEmpty(cesGoods.getGoodType())){
             List<CesStockType> list = cesStockTypeService.list(Wrappers.<CesStockType>lambdaQuery().eq(CesStockType::getParentId, cesGoods.getGoodType()));
             queryWrapper.and(e -> {

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/entity/CesGoods.java

@@ -51,6 +51,11 @@ public class CesGoods extends Model<CesGoods> {
     private String name;
 
     /**
+     * 商品名称
+     */
+    private String simplySpell;
+
+    /**
      * 库存告警数
      */
     private String stockWarning;