|
@@ -8,15 +8,20 @@ import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jeecg.common.Enum.ResultCode;
|
|
import org.jeecg.common.Enum.ResultCode;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.modules.rooms.DTO.CesHourRoomRuleDto;
|
|
import org.jeecg.modules.rooms.DTO.CesHourRoomRuleDto;
|
|
|
|
|
+import org.jeecg.modules.rooms.DTO.CesHourRoomRuleModifyDto;
|
|
|
import org.jeecg.modules.rooms.entity.CesHourRoomRule;
|
|
import org.jeecg.modules.rooms.entity.CesHourRoomRule;
|
|
|
import org.jeecg.modules.rooms.service.CesHourRoomRuleServiceImpl;
|
|
import org.jeecg.modules.rooms.service.CesHourRoomRuleServiceImpl;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
+import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -34,6 +39,8 @@ public class CesHourRoomRuleController extends JeecgController<CesHourRoomRule,
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
CesHourRoomRuleServiceImpl cesHourRoomRuleService;
|
|
CesHourRoomRuleServiceImpl cesHourRoomRuleService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ CesRoomLayoutServiceImpl cesRoomLayoutService;
|
|
|
|
|
|
|
|
@ApiOperation(value="钟点房规则查询", notes="钟点房规则查询")
|
|
@ApiOperation(value="钟点房规则查询", notes="钟点房规则查询")
|
|
|
@GetMapping(value = "/list")
|
|
@GetMapping(value = "/list")
|
|
@@ -47,7 +54,7 @@ public class CesHourRoomRuleController extends JeecgController<CesHourRoomRule,
|
|
|
if (0>=cesHourRoomRuleDto.getPageSize()){
|
|
if (0>=cesHourRoomRuleDto.getPageSize()){
|
|
|
return Result.error("页码尺寸不能小于等于0");
|
|
return Result.error("页码尺寸不能小于等于0");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isEmpty(cesHourRoomRuleDto.getHotelId())){
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(cesHourRoomRuleDto.getHotelId())){
|
|
|
return Result.error(ResultCode.PARAM_MISS);
|
|
return Result.error(ResultCode.PARAM_MISS);
|
|
|
}
|
|
}
|
|
|
try{
|
|
try{
|
|
@@ -55,7 +62,157 @@ public class CesHourRoomRuleController extends JeecgController<CesHourRoomRule,
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
return Result.error(e.getMessage());
|
|
return Result.error(e.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value="显示关联房型", notes="显示关联房型")
|
|
|
|
|
+ @GetMapping(value = "/listLayout")
|
|
|
|
|
+ public Result listLayout(String hotelId){
|
|
|
|
|
+ if (StringUtils.isBlank(hotelId)){
|
|
|
|
|
+ return Result.error("房型ID必要!");
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ return cesRoomLayoutService.getRoomLayoutsByHotelId(hotelId);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ @AutoLog(value = "新增钟点房规则")
|
|
|
|
|
+ @ApiOperation(value="新增钟点房规则", notes="新增钟点房规则")
|
|
|
|
|
+ @PostMapping(value = "/save")
|
|
|
|
|
+ public Result save(@RequestBody CesHourRoomRuleModifyDto dto){
|
|
|
|
|
+ if (ObjectUtils.isEmpty(dto)){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(dto.getHotelId())){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(dto.getHourRoomName())){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getAfterOpenRoom()||0>=dto.getAfterOpenRoom()){
|
|
|
|
|
+ return Result.error("开房后时间为空或小于等于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getAfterOpenRoomPay()||BigDecimal.ZERO.compareTo(dto.getAfterOpenRoomPay())>0){
|
|
|
|
|
+ return Result.error("开房后花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getExceedTime()||0>=dto.getExceedTime()){
|
|
|
|
|
+ return Result.error("超过时间为空或小于等于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getExceedPay()||BigDecimal.ZERO.compareTo(dto.getExceedPay())>0){
|
|
|
|
|
+ return Result.error("超时花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getNotReachExceedTime()||0>=dto.getNotReachExceedTime()){
|
|
|
|
|
+ return Result.error("未达超时周期时间为空或小于等于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getNotReachExceedTimePay()||BigDecimal.ZERO.compareTo(dto.getNotReachExceedTimePay())>0){
|
|
|
|
|
+ return Result.error("未达超市周期花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getMaxExtraPay()||BigDecimal.ZERO.compareTo(dto.getMaxExtraPay())>0){
|
|
|
|
|
+ return Result.error("封顶花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getLimitTimeTransferAllDay()||0>dto.getLimitTimeTransferAllDay()){
|
|
|
|
|
+ return Result.error("超时转全天时间为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ return cesHourRoomRuleService.create(dto);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @AutoLog(value = "修改钟点房规则")
|
|
|
|
|
+ @ApiOperation(value="修改钟点房规则", notes="修改钟点房规则")
|
|
|
|
|
+ @PostMapping(value = "/modify")
|
|
|
|
|
+ public Result modify(@RequestBody CesHourRoomRuleModifyDto dto){
|
|
|
|
|
+ if (ObjectUtils.isEmpty(dto)){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isBlank(dto.getId())){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS,"数据ID必传!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(dto.getHotelId())){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(dto.getHourRoomName())){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getAfterOpenRoom()||0>=dto.getAfterOpenRoom()){
|
|
|
|
|
+ return Result.error("开房后时间为空或小于等于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getAfterOpenRoomPay()||BigDecimal.ZERO.compareTo(dto.getAfterOpenRoomPay())>0){
|
|
|
|
|
+ return Result.error("开房后花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getExceedTime()||0>=dto.getExceedTime()){
|
|
|
|
|
+ return Result.error("超过时间为空或小于等于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getExceedPay()||BigDecimal.ZERO.compareTo(dto.getExceedPay())>0){
|
|
|
|
|
+ return Result.error("超时花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getNotReachExceedTime()||0>=dto.getNotReachExceedTime()){
|
|
|
|
|
+ return Result.error("未达超时周期时间为空或小于等于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getNotReachExceedTimePay()||BigDecimal.ZERO.compareTo(dto.getNotReachExceedTimePay())>0){
|
|
|
|
|
+ return Result.error("未达超市周期花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getMaxExtraPay()||BigDecimal.ZERO.compareTo(dto.getMaxExtraPay())>0){
|
|
|
|
|
+ return Result.error("封顶花费为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (null==dto.getLimitTimeTransferAllDay()||0>dto.getLimitTimeTransferAllDay()){
|
|
|
|
|
+ return Result.error("超时转全天时间为空或小于0!");
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ return cesHourRoomRuleService.modify(dto);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @AutoLog(value = "钟点房规则关联房型")
|
|
|
|
|
+ @ApiOperation(value="钟点房规则关联房型", notes="钟点房规则关联房型")
|
|
|
|
|
+ @PostMapping(value = "/relate")
|
|
|
|
|
+ public Result relate(@RequestBody CesHourRoomRuleModifyDto dto){
|
|
|
|
|
+ if (ObjectUtils.isEmpty(dto)){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(dto.getId())){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS);
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ return cesHourRoomRuleService.relateLayout(dto);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @AutoLog(value = "批量删除钟点房计费规则")
|
|
|
|
|
+ @ApiOperation(value="批量删除钟点房计费规则", notes="批量删除钟点房计费规则")
|
|
|
|
|
+ @DeleteMapping(value = "/batchDelete")
|
|
|
|
|
+ public Result batchDelete(@RequestParam String idStr){
|
|
|
|
|
+ if(StringUtils.isBlank(idStr)){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS,"数据IDSTR必传!");
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ List<String> ids = Stream.of(idStr.split(",")).collect(Collectors.toList());
|
|
|
|
|
+ return cesHourRoomRuleService.batchDelete(ids);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @AutoLog(value = "删除一条钟点房计费规则")
|
|
|
|
|
+ @ApiOperation(value="删除一条钟点房计费规则", notes="删除一条钟点房计费规则")
|
|
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
|
|
+ public Result delete(@RequestParam String id){
|
|
|
|
|
+ if(StringUtils.isBlank(id)){
|
|
|
|
|
+ return Result.error(ResultCode.PARAM_MISS,"数据ID必传!");
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ return cesHourRoomRuleService.deleteOne(id);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|