|
|
@@ -1,58 +1,46 @@
|
|
|
package org.jeecg.modules.business.controller;
|
|
|
|
|
|
-import java.sql.Time;
|
|
|
-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.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
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 org.apache.commons.lang.StringUtils;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
-import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.CommonUtils;
|
|
|
import org.jeecg.common.util.TokenUtils;
|
|
|
-import org.jeecg.common.util.oConvertUtils;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-
|
|
|
-import org.jeecg.modules.business.entity.*;
|
|
|
+import org.jeecg.modules.business.entity.BusHousePriceSchemeLayout;
|
|
|
+import org.jeecg.modules.business.entity.BusSchemeLayoutDailyPrice;
|
|
|
import org.jeecg.modules.business.service.IBusHousePriceSchemeLayoutService;
|
|
|
import org.jeecg.modules.business.service.IBusSchemeLayoutDailyPriceService;
|
|
|
import org.jeecg.modules.rooms.entity.CesHousePriceScheme;
|
|
|
import org.jeecg.modules.rooms.entity.CesRoomLayout;
|
|
|
import org.jeecg.modules.rooms.service.CesHousePriceSchemeServiceImpl;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
|
|
|
-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;
|
|
|
|
|
|
- /**
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalTime;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
* @Description: 房价方案-房型关联表
|
|
|
* @Author: jeecg-boot
|
|
|
* @Date: 2023-04-07
|
|
|
@@ -67,19 +55,13 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
private IBusHousePriceSchemeLayoutService busHousePriceSchemeLayoutService;
|
|
|
|
|
|
@Resource
|
|
|
- IBusSchemeLayoutDailyPriceService schemeLayoutDailyPriceService;
|
|
|
+ private IBusSchemeLayoutDailyPriceService schemeLayoutDailyPriceService;
|
|
|
@Resource
|
|
|
private CesRoomLayoutServiceImpl cesRoomLayoutService;
|
|
|
@Resource
|
|
|
private CesHousePriceSchemeServiceImpl housePriceSchemeService;
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
- *
|
|
|
- * @param busHousePriceSchemeLayout
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
*/
|
|
|
//@AutoLog(value = "房价方案-房型关联表-分页列表查询")
|
|
|
@ApiOperation(value="房价方案-房型关联表-分页列表查询", notes="房价方案-房型关联表-分页列表查询")
|
|
|
@@ -90,7 +72,7 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
HttpServletRequest req) {
|
|
|
if (type != null){
|
|
|
- CesHousePriceScheme housePriceScheme = housePriceSchemeService.getOne(Wrappers.<CesHousePriceScheme>lambdaQuery().eq(CesHousePriceScheme::getType,type).last("limit 1"));
|
|
|
+ CesHousePriceScheme housePriceScheme = housePriceSchemeService.getOne(Wrappers.<CesHousePriceScheme>lambdaQuery().eq(CesHousePriceScheme::getSchemeType,type).last("limit 1"));
|
|
|
busHousePriceSchemeLayout.setSchemeId(housePriceScheme.getId());
|
|
|
}
|
|
|
QueryWrapper<BusHousePriceSchemeLayout> queryWrapper = QueryGenerator.initQueryWrapper(busHousePriceSchemeLayout, req.getParameterMap());
|
|
|
@@ -107,15 +89,25 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 重置每日房价
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "房价方案-房型关联表-分页列表查询")
|
|
|
+ @ApiOperation(value="重置每日房价", notes="重置每日房价")
|
|
|
+ @GetMapping(value = "/resetDailyPrice")
|
|
|
+ public Result<Boolean> resetDailyPrice(String priceSchemeLayoutId) {
|
|
|
+ BusHousePriceSchemeLayout priceSchemeLayout = service.getById(priceSchemeLayoutId);
|
|
|
+ if (priceSchemeLayout == null){
|
|
|
+ return Result.error("未找到对应的 房价方案与房型关联");
|
|
|
+ }
|
|
|
+ schemeLayoutDailyPriceService.remove(Wrappers.<BusSchemeLayoutDailyPrice>lambdaQuery()
|
|
|
+ .eq(BusSchemeLayoutDailyPrice::getSchemeLayoutId, priceSchemeLayout.getId()));
|
|
|
+ return Result.OK("重置成功");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
- *
|
|
|
- * @param busHousePriceSchemeLayout
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
*/
|
|
|
//@AutoLog(value = "房价方案-房型关联表-分页列表查询")
|
|
|
@ApiOperation(value="房价方案-房型关联表-分页列表查询", notes="房价方案-房型关联表-分页列表查询")
|
|
|
@@ -125,7 +117,7 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
HttpServletRequest req) {
|
|
|
QueryWrapper<BusHousePriceSchemeLayout> queryWrapper = QueryGenerator.initQueryWrapper(busHousePriceSchemeLayout, req.getParameterMap());
|
|
|
- Page<BusHousePriceSchemeLayout> page = new Page<BusHousePriceSchemeLayout>(pageNo, pageSize);
|
|
|
+ Page<BusHousePriceSchemeLayout> page = new Page<>(pageNo, pageSize);
|
|
|
IPage<BusHousePriceSchemeLayout> pageList = busHousePriceSchemeLayoutService.page(page, queryWrapper);
|
|
|
pageList.getRecords().forEach(item->{
|
|
|
CesRoomLayout layout = cesRoomLayoutService.getById(item.getLayoutId());
|
|
|
@@ -141,10 +133,6 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
|
|
|
/**
|
|
|
* 列表查询
|
|
|
- *
|
|
|
- * @param busHousePriceSchemeLayout
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
*/
|
|
|
//@AutoLog(value = "房价方案-房型关联表-列表查询")
|
|
|
@ApiOperation(value="房价方案-房型关联表-列表查询", notes="房价方案-房型关联表-列表查询")
|
|
|
@@ -160,11 +148,54 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
return Result.OK(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "房价方案-房型关联表-分页列表查询")
|
|
|
+ @ApiOperation(value="房价方案-房型关联表-分页列表查询", notes="房价方案-房型关联表-分页列表查询")
|
|
|
+ @PostMapping(value = "/getSchemeLayoutByLayoutId")
|
|
|
+ public Result<List<CesHousePriceScheme>> getSchemeLayoutByLayoutId(@RequestBody List<String> layoutIds,String hotelId) {
|
|
|
+ if (CollUtil.isEmpty(layoutIds)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ // 房价方案
|
|
|
+ LambdaQueryWrapper<CesHousePriceScheme> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(CesHousePriceScheme::getHotelId,hotelId);
|
|
|
+ queryWrapper.eq(CesHousePriceScheme::getInvalid,false);
|
|
|
+ queryWrapper.eq(CesHousePriceScheme::getOpen,1);
|
|
|
+ queryWrapper.and(e -> e.le(CesHousePriceScheme::getValidStartTime, LocalDate.now())
|
|
|
+ .ge(CesHousePriceScheme::getValidEndTime, LocalDate.now()).or().eq(CesHousePriceScheme::getValidTime, 0));
|
|
|
+ queryWrapper.and(e -> e.le(CesHousePriceScheme::getStartTime, LocalTime.now())
|
|
|
+ .ge(CesHousePriceScheme::getEndTime, LocalTime.now()).or().eq(CesHousePriceScheme::getCheckInTime, 0));
|
|
|
+ List<CesHousePriceScheme> cesHousePriceSchemes = housePriceSchemeService.list(queryWrapper);
|
|
|
+ List<String> priceSchemeIds = cesHousePriceSchemes.stream().map(CesHousePriceScheme::getId).collect(Collectors.toList());
|
|
|
+ if (CollUtil.isEmpty(priceSchemeIds)){
|
|
|
+ throw new JeecgBootException("未找到方案");
|
|
|
+ }
|
|
|
+ // 房价方案房型
|
|
|
+ List<BusHousePriceSchemeLayout> schemeLayouts = busHousePriceSchemeLayoutService.list(Wrappers.<BusHousePriceSchemeLayout>lambdaQuery()
|
|
|
+ .eq(BusHousePriceSchemeLayout::getDelFlag, 0).in(BusHousePriceSchemeLayout::getLayoutId, layoutIds));
|
|
|
+ List<String> ids = schemeLayouts.stream().map(BusHousePriceSchemeLayout::getId).collect(Collectors.toList());
|
|
|
+ if (CollUtil.isEmpty(ids)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ // 房价方案房型 自定义的每天价格
|
|
|
+ List<BusSchemeLayoutDailyPrice> dailyPrices = schemeLayoutDailyPriceService.list(Wrappers
|
|
|
+ .<BusSchemeLayoutDailyPrice>lambdaQuery().in(BusSchemeLayoutDailyPrice::getSchemeLayoutId, ids));
|
|
|
+ schemeLayouts.forEach(e -> {
|
|
|
+ List<BusSchemeLayoutDailyPrice> layoutDailyPrices = dailyPrices.stream().filter(ele ->
|
|
|
+ StrUtil.equals(e.getId(), ele.getSchemeLayoutId())).collect(Collectors.toList());
|
|
|
+ e.setSchemeLayoutDailyPriceList(layoutDailyPrices);
|
|
|
+ });
|
|
|
+ cesHousePriceSchemes.forEach(e -> {
|
|
|
+ List<BusHousePriceSchemeLayout> findSchemeLayouts = schemeLayouts.stream().filter(ele -> StrUtil.equals(e.getId(), ele.getSchemeId())).collect(Collectors.toList());
|
|
|
+ e.setSchemeLayouts(findSchemeLayouts);
|
|
|
+ });
|
|
|
+ return Result.OK(cesHousePriceSchemes);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
- *
|
|
|
- * @param busHousePriceSchemeLayout
|
|
|
- * @return
|
|
|
*/
|
|
|
@AutoLog(value = "房价方案-房型关联表-添加")
|
|
|
@ApiOperation(value="房价方案-房型关联表-添加", notes="房价方案-房型关联表-添加")
|
|
|
@@ -177,9 +208,6 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
|
|
|
/**
|
|
|
* 编辑
|
|
|
- *
|
|
|
- * @param busHousePriceSchemeLayout
|
|
|
- * @return
|
|
|
*/
|
|
|
@AutoLog(value = "房价方案-房型关联表-编辑")
|
|
|
@ApiOperation(value="房价方案-房型关联表-编辑", notes="房价方案-房型关联表-编辑")
|
|
|
@@ -192,9 +220,6 @@ public class BusHousePriceSchemeLayoutController extends JeecgController<BusHous
|
|
|
|
|
|
/**
|
|
|
* 编辑
|
|
|
- *
|
|
|
- * @param busHousePriceSchemeLayout
|
|
|
- * @return
|
|
|
*/
|
|
|
@AutoLog(value = "房价方案-房型关联表-编辑")
|
|
|
@ApiOperation(value="房价方案-房型关联表-编辑", notes="房价方案-房型关联表-编辑")
|