Ver código fonte

处理文档中提出的问题

许智捷 2 anos atrás
pai
commit
4daec33b62

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

@@ -1,17 +1,21 @@
 package org.jeecg.modules.business.controller;
 
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
-import java.util.Map;
+import java.util.Optional;
+import java.util.function.Consumer;
 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.exception.JeecgBootException;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.business.entity.BusOrderFee;
 import org.jeecg.modules.business.service.IBusOrderFeeService;
 
@@ -20,22 +24,16 @@ 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.format.annotation.DateTimeFormat;
+import org.springframework.transaction.annotation.Transactional;
 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_order_fee
@@ -72,7 +70,7 @@ public class BusOrderFeeController extends JeecgController<BusOrderFee, IBusOrde
 		IPage<BusOrderFee> pageList = busOrderFeeService.page(page, queryWrapper);
 		return Result.OK(pageList);
 	}
-	
+
 	/**
 	 *   添加
 	 *
@@ -87,6 +85,14 @@ public class BusOrderFeeController extends JeecgController<BusOrderFee, IBusOrde
 		busOrderFeeService.save(busOrderFee);
 		return Result.OK("添加成功!");
 	}
+
+	 @AutoLog(value = "bus_order_fee-添加")
+	 @ApiOperation(value="bus_order_fee-添加", notes="bus_order_fee-添加")
+	 //@RequiresPermissions("business:bus_order_fee:add")
+	 @PostMapping(value = "/saveBatch")
+	 public Result<Boolean> add(@RequestBody List<BusOrderFee> busOrderFeeList) {
+		 return Result.OK(busOrderFeeService.saveBatch(busOrderFeeList));
+	 }
 	
 	/**
 	 *  编辑
@@ -102,8 +108,22 @@ public class BusOrderFeeController extends JeecgController<BusOrderFee, IBusOrde
 		busOrderFeeService.updateById(busOrderFee);
 		return Result.OK("编辑成功!");
 	}
-	
-	/**
+
+	 /**
+	  *  编辑
+	  *
+	  * @param
+	  * @return
+	  */
+	 @AutoLog(value = "bus_order_fee-编辑")
+	 @ApiOperation(value="bus_order_fee-编辑", notes="bus_order_fee-编辑")
+	 @RequestMapping(value = "/strike-balance", method = {RequestMethod.PUT,RequestMethod.POST})
+	 public Result strikeBalance(@RequestBody List<BusOrderFee> busOrderFeeList) {
+		 return Result.OK(busOrderFeeService.strikeBalance(busOrderFeeList));
+	 }
+
+
+	 /**
 	 *   通过id删除
 	 *
 	 * @param id

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

@@ -220,11 +220,13 @@ lo.booking_order_id
         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,
         l.`name` as layout_name,
+        r.roomId,
         concat(IFNULL(r.prefix,''),r.`name`) as room_name,
         o.arrival_time,
         o.due_out_time,

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

@@ -3,6 +3,8 @@ package org.jeecg.modules.business.service;
 import org.jeecg.modules.business.entity.BusOrderFee;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: bus_order_fee
  * @Author: jeecg-boot
@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IBusOrderFeeService extends IService<BusOrderFee> {
 
+    Boolean strikeBalance(List<BusOrderFee> busOrderFeeList);
 }

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

@@ -1,12 +1,20 @@
 package org.jeecg.modules.business.service.impl;
 
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.business.entity.BusLivingLayoutDayPrice;
 import org.jeecg.modules.business.entity.BusOrderFee;
 import org.jeecg.modules.business.mapper.BusOrderFeeMapper;
 import org.jeecg.modules.business.service.IBusOrderFeeService;
+import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
 /**
  * @Description: bus_order_fee
  * @Author: jeecg-boot
@@ -16,4 +24,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class BusOrderFeeServiceImpl extends ServiceImpl<BusOrderFeeMapper, BusOrderFee> implements IBusOrderFeeService {
 
+    @Override
+    public Boolean strikeBalance(List<BusOrderFee> busOrderFeeList) {
+        List<String> ids = busOrderFeeList.stream().filter(e -> e.getCreateTime().before(new Date())).
+                map(BusOrderFee::getId).collect(Collectors.toList());
+        List<BusOrderFee> findBusOrderFees = listByIds(ids);
+        if (findBusOrderFees.isEmpty()){
+            throw new JeecgBootException("未找到订单");
+        }
+        findBusOrderFees.forEach(findFee ->{
+            Optional<BusOrderFee> orderFee = busOrderFeeList.stream().filter(fee -> findFee.getId().equals(fee.getId())).findFirst();
+            orderFee.ifPresent(e -> {
+                findFee.setMoney(e.getMoney());
+                findFee.setRemark(e.getRemark());
+            });
+        });
+
+        return updateBatchById(findBusOrderFees);
+    }
 }

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

@@ -332,7 +332,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 }
             }
             //</editor-fold>
-
+            roomsService.getReserveRoom();
             return item.getOrderInfo().getBookingOrdersNo();
             // 团队预定
         } else if(item.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
@@ -405,6 +405,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 dayPriceService.saveBatch(c.getLayoutDayPrices().stream().filter(x->lList.contains(x.getRoomLayoutId())).collect(Collectors.toList()));
                 //批次中处理每天房型价格 End
             });
+            roomsService.getReserveRoom();
             return item.getOrderInfo().getBookingOrdersNo();
         } else { // not exist type
             throw new JeecgBootException("参数错误");
@@ -759,7 +760,12 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
              new JeecgBootException("订单不存在");
         removeById(id);
         bookingBatchService.remove(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",order.getId()));
-        bookingRoomsService.remove(Wrappers.<BusBookingRooms>query().eq("booking_orders_id",order.getId()));
+        // 找出预约单的 房间预定关联表 删除关联表,房间如果房间是预约状态,就变成上一个状态
+        List<BusBookingRooms> busBookingRoomList = bookingRoomsService.list(Wrappers.<BusBookingRooms>query().eq("booking_orders_id", order.getId()));
+        bookingRoomsService.removeBatchByIds(busBookingRoomList);
+        List<String> roomIds = busBookingRoomList.stream().map(BusBookingRooms::getRoomId).collect(Collectors.toList());
+        roomsService.update(Wrappers.<CesRooms>update().setSql("room_status = last_room_status")
+                .eq("room_status",RoomStatusEnum.RESERVE.getKey()).in("id",roomIds));
         dayPriceService.remove(Wrappers.<BusBookingLayoutDayPrice>query().eq("booking_order_id",order.getId()));
         return true;
     }
@@ -1221,9 +1227,16 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 // 订单为 商品订单 时
                 if (FeeSubjectType.SHANG_PIN.getKey().equals(e.getSubjectType())){
                     List<BusOrderFeeGoodsVo> busOrderFeeGoodsVo = busOrderFeeGoodVos.stream().filter(orderFeeGoodVo -> StrUtil.equals(orderFeeGoodVo.getOrderFeeId(), e.getId())).collect(Collectors.toList());
-                    busOrderFeeVo.setFeeGoodVos(busOrderFeeGoodsVo);
+                    // 当一个订单费用是商品时,找出包含的商品,把每种商品都分成一个个订单费用
+                    busOrderFeeGoodsVo.forEach(goods -> {
+                        BusOrderFeeVo childOrderFeeVo = BeanUtil.copyProperties(e, BusOrderFeeVo.class);
+                        childOrderFeeVo.setMoney(goods.getPrice());
+                        childOrderFeeVo.setFeeGoodVo(goods);
+                        busOrderFeeVos.add(childOrderFeeVo);
+                    });
+                } else {
+                    busOrderFeeVos.add(busOrderFeeVo);
                 }
-                busOrderFeeVos.add(busOrderFeeVo);
                 }
             );
             return busOrderFeeVos;

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

@@ -21,5 +21,5 @@ import java.util.List;
 public class BusOrderFeeVo extends BusOrderFee {
 
     @ApiModelProperty(value = "关联商品信息")
-    private List<BusOrderFeeGoodsVo> feeGoodVos;
+    private BusOrderFeeGoodsVo feeGoodVo;
 }

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

@@ -13,6 +13,8 @@ public class KeLiItemVo {
     private String id;
     private String layoutId;
     private String orderNo;
+    private String bookingOrderId;
+    private String roomId;
     private String customerName;
     private String customerPhone;
     private Integer customerType;

+ 6 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesRoomsController.java

@@ -121,6 +121,12 @@ public class CesRoomsController {
         }
     }
 
+    @ApiOperation(value="房间分页列表查询", notes="房间分页列表查询")
+    @GetMapping(value = "/batchEditPassword")
+    public Result<Boolean> batchEditPassword(CesRoomSearchDto dto, String type, String firstValue, String endValue){
+        return Result.ok(roomsService.batchEditPassword(dto, type, firstValue, endValue));
+    }
+
     @ApiOperation(value="实时房态-房间列表", notes="实时房态")
     @GetMapping(value = "/realtime-rooms")
     public Result getHotelRooms(@RequestParam Map params){

+ 46 - 26
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesRoomsServiceImpl.java

@@ -2,30 +2,20 @@ package org.jeecg.modules.rooms.service;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.lang.tree.Tree;
-import cn.hutool.core.lang.tree.TreeNode;
-import cn.hutool.core.lang.tree.TreeUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.business.entity.BusBookingRooms;
 import org.jeecg.modules.business.entity.BusHotel;
-import org.jeecg.modules.business.entity.BusRoomPayType;
-import org.jeecg.modules.business.enums.BookingOrdersType;
 import org.jeecg.modules.business.enums.CheckInTypeEnum;
 import org.jeecg.modules.business.service.IBusBookingRoomsService;
 import org.jeecg.modules.business.service.impl.BusHotelServiceImpl;
@@ -40,10 +30,10 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import javax.transaction.Transactional;
 import java.math.BigDecimal;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 /**
@@ -85,20 +75,11 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
      * @return
      */
     public Result list(CesRoomSearchDto dto) {
-
-        QueryWrapper<CesRooms> queryWrapper = new QueryWrapper<>();
-        if (!StringUtils.isBlank(dto.getBuildId())) {
-            queryWrapper.eq(CesRooms.BUILD_ID, dto.getBuildId());
-        }
-        if (!StringUtils.isBlank(dto.getFloorId())) {
-            queryWrapper.eq(CesRooms.FLOOR_ID, dto.getFloorId());
-        }
-        if (!StringUtils.isBlank(dto.getHotelId())) {
-//           List<String> hotelIds = Arrays.stream(dto.getHotelId().split(",")).collect(Collectors.toList());
-            queryWrapper.eq(CesRooms.HOTEL_ID, dto.getHotelId());
-        }
-        queryWrapper.eq(CesRooms.INVALID, false);
-        queryWrapper.orderByDesc(CesRooms.SORT, CesRooms.CREATEAT);
+        QueryWrapper<CesRooms> queryWrapper = new QueryWrapper<CesRooms>()
+                .eq(!StringUtils.isBlank(dto.getBuildId()),CesRooms.BUILD_ID, dto.getBuildId())
+                .eq(!StringUtils.isBlank(dto.getFloorId()),CesRooms.FLOOR_ID, dto.getFloorId())
+                .eq(!StringUtils.isBlank(dto.getHotelId()),CesRooms.HOTEL_ID, dto.getHotelId())
+                .eq(CesRooms.INVALID, false).orderByDesc(CesRooms.SORT, CesRooms.CREATEAT);
         IPage<CesRooms> dataPage = roomsMapper.selectPage(new Page<>(dto.getPageNo().intValue(), dto.getPageSize().intValue()), queryWrapper);
         List<CesRooms> records = dataPage.getRecords();
         Map<String, Object> map = new HashedMap();
@@ -139,6 +120,44 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
     }
 
     /**
+     * 修改房间密码
+     *
+     * @param dto
+     * @return
+     */
+    public Boolean batchEditPassword(CesRoomSearchDto dto, String type, String firstValue, String endValue) {
+        QueryWrapper<CesRooms> queryWrapper = new QueryWrapper<CesRooms>()
+                .eq(!StringUtils.isBlank(dto.getBuildId()),CesRooms.BUILD_ID, dto.getBuildId())
+                .eq(!StringUtils.isBlank(dto.getFloorId()),CesRooms.FLOOR_ID, dto.getFloorId())
+                .eq(!StringUtils.isBlank(dto.getHotelId()),CesRooms.HOTEL_ID, dto.getHotelId())
+                .eq(CesRooms.INVALID, false);
+        List<CesRooms> cesRooms = roomsMapper.selectList(queryWrapper);
+        if ("0".equals(type) || "1".equals(type)) {
+            cesRooms.forEach(e -> {
+                e.setPassWord(firstValue + e.getPrefix() + e.getName() + endValue);
+            });
+        } else if ("2".equals(type)){
+            cesRooms.forEach(e -> {
+                e.setPassWord(firstValue + e.getName() + endValue);
+            });
+        } else if("3".equals(type)){
+            AtomicInteger num = new AtomicInteger();
+            try {
+                num.set(Integer.parseInt(type));
+            } catch (NumberFormatException e){
+                throw new JeecgBootException("参数错误");
+            }
+            cesRooms.forEach(e -> {
+                num.getAndIncrement();
+                e.setPassWord(Integer.toString(num.get()));
+            });
+        }
+        return updateBatchById(cesRooms);
+    }
+
+
+
+    /**
      * 创建房间
      *
      * @param roomsDto
@@ -427,10 +446,11 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
         for (CesRooms cesRoom : CesRoomList){
             if (cesRoom.getRoomStatus() < 3){
                 cesRoom.setLastRoomStatus(cesRoom.getRoomStatus());
-                cesRoom.setRoomStatus(7);
+                cesRoom.setRoomStatus(RoomStatusEnum.RESERVE.getKey());
                 newCesRooms.add(cesRoom);
             }
         }
         return updateBatchById(newCesRooms);
     }
+
 }