Forráskód Böngészése

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

覃浩 2 éve
szülő
commit
2253a85b24

+ 204 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/controller/FwLivingJxController.java

@@ -0,0 +1,204 @@
+package org.jeecg.modules.fw.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.annotation.Resource;
+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.BusBookingRooms;
+import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
+import org.jeecg.modules.business.service.IBusBookingRoomsService;
+import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
+import org.jeecg.modules.fw.entity.FwLivingJx;
+import org.jeecg.modules.fw.service.IFwLivingJxService;
+
+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.rooms.entity.CesRooms;
+import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
+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: fw_living_jx
+ * @Author: jeecg-boot
+ * @Date:   2023-06-01
+ * @Version: V1.0
+ */
+@Api(tags="fw_living_jx")
+@RestController
+@RequestMapping("/fw/fwLivingJx")
+@Slf4j
+public class FwLivingJxController extends JeecgController<FwLivingJx, IFwLivingJxService> {
+	@Autowired
+	private IFwLivingJxService fwLivingJxService;
+@Resource
+private IBusRoomsLivingOrderService busRoomsLivingOrderService;
+@Resource
+private IBusBookingRoomsService busBookingRoomsService;
+@Resource
+private CesRoomsServiceImpl cesRoomsService;
+
+	/**
+	 * 分页列表查询
+	 *
+	 * @param fwLivingJx
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "fw_living_jx-分页列表查询")
+	@ApiOperation(value="fw_living_jx-分页列表查询", notes="fw_living_jx-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<FwLivingJx>> queryPageList(FwLivingJx fwLivingJx,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<FwLivingJx> queryWrapper = QueryGenerator.initQueryWrapper(fwLivingJx, req.getParameterMap());
+		Page<FwLivingJx> page = new Page<FwLivingJx>(pageNo, pageSize);
+		IPage<FwLivingJx> pageList = fwLivingJxService.page(page, queryWrapper);
+		pageList.getRecords().forEach(t -> {
+			BusRoomsLivingOrder busRoomsLivingOrder = busRoomsLivingOrderService.getById(t.getLivingOrderId());
+			if (busRoomsLivingOrder != null) {
+				BusBookingRooms busBookingRooms = busBookingRoomsService.getById(busRoomsLivingOrder.getBookingRoomId());
+				if (busBookingRooms != null) {
+					t.setRoomId(busBookingRooms.getRoomId());
+					CesRooms cesRooms = cesRoomsService.getById(busBookingRooms.getRoomId());
+					if (cesRooms != null) {
+						t.setRoomName(cesRooms.getName());
+					}
+				}
+			}
+		});
+		return Result.OK(pageList);
+	}
+
+	/**
+	 *   添加
+	 *
+	 * @param fwLivingJx
+	 * @return
+	 */
+	@AutoLog(value = "fw_living_jx-添加")
+	@ApiOperation(value="fw_living_jx-添加", notes="fw_living_jx-添加")
+	//@RequiresPermissions("fw:fw_living_jx:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody FwLivingJx fwLivingJx) {
+		fwLivingJxService.save(fwLivingJx);
+		return Result.OK("添加成功!");
+	}
+
+	/**
+	 *  编辑
+	 *
+	 * @param fwLivingJx
+	 * @return
+	 */
+	@AutoLog(value = "fw_living_jx-编辑")
+	@ApiOperation(value="fw_living_jx-编辑", notes="fw_living_jx-编辑")
+	//@RequiresPermissions("fw:fw_living_jx:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody FwLivingJx fwLivingJx) {
+		fwLivingJxService.updateById(fwLivingJx);
+		return Result.OK("编辑成功!");
+	}
+
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "fw_living_jx-通过id删除")
+	@ApiOperation(value="fw_living_jx-通过id删除", notes="fw_living_jx-通过id删除")
+	//@RequiresPermissions("fw:fw_living_jx:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		fwLivingJxService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "fw_living_jx-批量删除")
+	@ApiOperation(value="fw_living_jx-批量删除", notes="fw_living_jx-批量删除")
+	//@RequiresPermissions("fw:fw_living_jx:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.fwLivingJxService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "fw_living_jx-通过id查询")
+	@ApiOperation(value="fw_living_jx-通过id查询", notes="fw_living_jx-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<FwLivingJx> queryById(@RequestParam(name="id",required=true) String id) {
+		FwLivingJx fwLivingJx = fwLivingJxService.getById(id);
+		if(fwLivingJx==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(fwLivingJx);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param fwLivingJx
+    */
+    //@RequiresPermissions("fw:fw_living_jx:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, FwLivingJx fwLivingJx) {
+        return super.exportXls(request, fwLivingJx, FwLivingJx.class, "fw_living_jx");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("fw:fw_living_jx:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, FwLivingJx.class);
+    }
+
+}

+ 57 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/entity/FwLivingJx.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.fw.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: fw_living_jx
+ * @Author: jeecg-boot
+ * @Date:   2023-06-01
+ * @Version: V1.0
+ */
+@Data
+@TableName("fw_living_jx")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="fw_living_jx对象", description="fw_living_jx")
+public class FwLivingJx implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+	/**入住订单id*/
+	@Excel(name = "入住订单id", width = 15)
+    @ApiModelProperty(value = "入住订单id")
+    private String livingOrderId;
+	/**叫醒日期*/
+	@Excel(name = "叫醒日期", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "叫醒日期")
+    private Date jxDate;
+	/**叫醒时间*/
+	@Excel(name = "叫醒时间", width = 15)
+    @ApiModelProperty(value = "叫醒时间")
+    private String jxTime;
+
+	@TableField(exist = false)
+	private String roomName;
+
+    @TableField(exist = false)
+    private String roomId;
+}

+ 17 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/mapper/FwLivingJxMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.fw.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.fw.entity.FwLivingJx;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: fw_living_jx
+ * @Author: jeecg-boot
+ * @Date:   2023-06-01
+ * @Version: V1.0
+ */
+public interface FwLivingJxMapper extends BaseMapper<FwLivingJx> {
+
+}

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/mapper/xml/FwLivingJxMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.fw.mapper.FwLivingJxMapper">
+
+</mapper>

+ 14 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/service/IFwLivingJxService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.fw.service;
+
+import org.jeecg.modules.fw.entity.FwLivingJx;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: fw_living_jx
+ * @Author: jeecg-boot
+ * @Date:   2023-06-01
+ * @Version: V1.0
+ */
+public interface IFwLivingJxService extends IService<FwLivingJx> {
+
+}

+ 19 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/fw/service/impl/FwLivingJxServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.fw.service.impl;
+
+import org.jeecg.modules.fw.entity.FwLivingJx;
+import org.jeecg.modules.fw.mapper.FwLivingJxMapper;
+import org.jeecg.modules.fw.service.IFwLivingJxService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: fw_living_jx
+ * @Author: jeecg-boot
+ * @Date:   2023-06-01
+ * @Version: V1.0
+ */
+@Service
+public class FwLivingJxServiceImpl extends ServiceImpl<FwLivingJxMapper, FwLivingJx> implements IFwLivingJxService {
+
+}

+ 37 - 5
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/order/controller/CesOrderLeaseGoodsController.java

@@ -1,9 +1,6 @@
 package org.jeecg.modules.order.controller;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -16,6 +13,7 @@ import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import io.swagger.annotations.Info;
 import org.apache.commons.lang3.ObjectUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -92,16 +90,30 @@ public class CesOrderLeaseGoodsController extends JeecgController<CesOrderLeaseG
 	public Result<IPage<CesOrderLeaseGoods>> queryPageList(CesOrderLeaseGoods cesOrderLeaseGoods,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														   @RequestParam(name="livingOrderId",required = false) String livingOrderId,
 														   @RequestParam(name="startTime",required = false) String startTime,
 														   @RequestParam(name="endTime",required = false) String endTime,
 								   HttpServletRequest req) {
-		LambdaQueryWrapper<CesOrderLeaseGoods> queryWrapper = QueryGenerator.initQueryWrapper(cesOrderLeaseGoods, req.getParameterMap()).lambda();
+		Map<String, String[]> map=req.getParameterMap();
+		Map writeAbleMap = new HashMap();
+		writeAbleMap.putAll(map);
+//		writeAbleMap.remove("livingOrderId");
+		LambdaQueryWrapper<CesOrderLeaseGoods> queryWrapper = QueryGenerator.initQueryWrapper(cesOrderLeaseGoods, writeAbleMap).lambda();
+
 		if (ObjectUtils.isNotEmpty(startTime)) {
 			queryWrapper.ge(CesOrderLeaseGoods::getCreateDate, DateUtil.parseDate(startTime));
 		}
 		if (ObjectUtils.isNotEmpty(endTime)) {
 			queryWrapper.le(CesOrderLeaseGoods::getCreateDate, DateUtil.parseDate(endTime));
 		}
+//		if(ObjectUtils.isNotEmpty(livingOrderId)) {
+//			List<String> livingOrderIds = Arrays.asList(livingOrderId.split(","));
+//			queryWrapper.and(i -> {
+//				livingOrderIds.forEach(t -> {
+//					i.or().eq(CesOrderLeaseGoods::getLivingOrderId, t);
+//				});
+//			});
+//		}
 		Page<CesOrderLeaseGoods> page = new Page<CesOrderLeaseGoods>(pageNo, pageSize);
 		IPage<CesOrderLeaseGoods> pageList = cesOrderLeaseGoodsService.page(page, queryWrapper);
 		pageList.getRecords().forEach(item -> {
@@ -118,6 +130,26 @@ public class CesOrderLeaseGoodsController extends JeecgController<CesOrderLeaseG
 	}
 
 	 /**
+	  * 检查物品是否归还
+	  * @param livingOrderId
+	  * @return
+	  */
+	 @ApiOperation(value="检查物品是否归还", notes="检查物品是否归还")
+	 @GetMapping(value = "/checkReturnGoods")
+	 public Result<Long> checkReturnGoods(@RequestParam(name="livingOrderId") String livingOrderId) {
+		 List<String> livingOrderIds = Arrays.asList(livingOrderId.split(","));
+		 LambdaQueryWrapper<CesOrderLeaseGoods> queryWrapper = new LambdaQueryWrapper<>();
+		 queryWrapper.isNull(CesOrderLeaseGoods::getRevertDate);
+		 queryWrapper.and(i -> {
+			 livingOrderIds.forEach(t -> {
+				 i.or().eq(CesOrderLeaseGoods::getLivingOrderId, t);
+			 });
+		 });
+		 Long count = cesOrderLeaseGoodsService.count(queryWrapper);
+		 return Result.OK(count);
+	 }
+
+	 /**
 	  * 归还
 	  * @param dto
 	  * @return

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

@@ -3,6 +3,9 @@ package org.jeecg.modules.rooms.controller;
 
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -13,21 +16,26 @@ import org.jeecg.common.api.vo.Result;
 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.TokenUtils;
 import org.jeecg.common.util.UUIDGenerator;
 import org.jeecg.modules.business.entity.BusMemberCard;
+import org.jeecg.modules.pos.entity.PosSellClearGoods;
 import org.jeecg.modules.rooms.DTO.CesGoodsDelDto;
 import org.jeecg.modules.rooms.DTO.CesGoodsDto;
 import org.jeecg.modules.rooms.DTO.CesGoodsSearchDto;
 import org.jeecg.modules.rooms.DTO.CesGoodsUnitSearchDto;
 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.springframework.web.bind.annotation.*;
 
 import org.springframework.stereotype.Controller;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.List;
@@ -50,27 +58,29 @@ public class CesGoodsController extends JeecgController<CesGoods,CesGoodsService
 
     @Resource
     private CesGoodsServiceImpl goodsService;
+    @Resource
+    private CesStockTypeServiceImpl cesStockTypeService;
 
     /***
      * 查询
      * @param dto
      * @return
      */
-    @ApiOperation(value="查询", notes="查询")
+    @ApiOperation(value = "查询", notes = "查询")
     @GetMapping(value = "/list")
-    public Result list(CesGoodsSearchDto dto){
-        if(StringUtils.isBlank(dto.getHotelId())){
+    public Result list(CesGoodsSearchDto dto) {
+        if (StringUtils.isBlank(dto.getHotelId())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(dto.getPageNo().intValue() <= 0){
+        if (dto.getPageNo().intValue() <= 0) {
             return Result.error("页数不能小于等于0");
         }
-        if(dto.getPageSize().intValue() < 10){
+        if (dto.getPageSize().intValue() < 10) {
             return Result.error("分页条数不能小于10");
         }
-        try{
+        try {
             return goodsService.fetchList(dto);
-        }catch (Exception e){
+        } catch (Exception e) {
             return Result.error(e.getMessage());
         }
     }
@@ -80,116 +90,116 @@ public class CesGoodsController extends JeecgController<CesGoods,CesGoodsService
      * @param dto
      * @return
      */
-    @ApiOperation(value="查询", notes="查询")
+    @ApiOperation(value = "查询", notes = "查询")
     @GetMapping(value = "/queryList")
-    public Result queryList(CesGoodsSearchDto dto){
-        if(StringUtils.isBlank(dto.getHotelId())){
+    public Result queryList(CesGoodsSearchDto dto) {
+        if (StringUtils.isBlank(dto.getHotelId())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        try{
+        try {
             return goodsService.queryList(dto);
-        }catch (Exception e){
+        } catch (Exception e) {
             return Result.error(e.getMessage());
         }
     }
 
 
-    @ApiOperation(value="创建", notes="创建")
+    @ApiOperation(value = "创建", notes = "创建")
     @PostMapping(value = "/create")
-    public Result create(@RequestBody  CesGoodsDto dto){
-        if(StringUtils.isBlank(dto.getHotelId())){
+    public Result create(@RequestBody CesGoodsDto dto) {
+        if (StringUtils.isBlank(dto.getHotelId())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getGoodType())){
+        if (StringUtils.isBlank(dto.getGoodType())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getGoodUnit())){
+        if (StringUtils.isBlank(dto.getGoodUnit())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getBarCode())){
+        if (StringUtils.isBlank(dto.getBarCode())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getName())){
+        if (StringUtils.isBlank(dto.getName())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getBid().toString())){
+        if (StringUtils.isBlank(dto.getBid().toString())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getSellingPrice().toString())){
+        if (StringUtils.isBlank(dto.getSellingPrice().toString())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(dto.getPurchases().intValue() < 0){
+        if (dto.getPurchases().intValue() < 0) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(dto.getSalesVolume().intValue() < 0){
+        if (dto.getSalesVolume().intValue() < 0) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(dto.getInventory().intValue() < 0){
+        if (dto.getInventory().intValue() < 0) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        try{
+        try {
             return goodsService.create(dto);
-        }catch (Exception e){
+        } catch (Exception e) {
             return Result.error(e.getMessage());
         }
     }
 
 
-    @ApiOperation(value="修改", notes="修改")
+    @ApiOperation(value = "修改", notes = "修改")
     @PutMapping(value = "/modify")
-    public Result modify(@RequestBody CesGoodsDto dto){
-        if(StringUtils.isBlank(dto.getHotelId())){
+    public Result modify(@RequestBody CesGoodsDto dto) {
+        if (StringUtils.isBlank(dto.getHotelId())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(dto.getId())){
+        if (StringUtils.isBlank(dto.getId())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        try{
+        try {
             return goodsService.modify(dto);
-        }catch (Exception e){
+        } catch (Exception e) {
             return Result.error(e.getMessage());
         }
     }
 
-    @ApiOperation(value="删除", notes="删除")
+    @ApiOperation(value = "删除", notes = "删除")
     @DeleteMapping(value = "/delete")
-    public Result delete(String id,String hotelId){
-        if(StringUtils.isBlank(hotelId)){
+    public Result delete(String id, String hotelId) {
+        if (StringUtils.isBlank(hotelId)) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        if(StringUtils.isBlank(id)){
+        if (StringUtils.isBlank(id)) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        try{
-            return goodsService.delete(id,hotelId);
-        }catch (Exception e){
+        try {
+            return goodsService.delete(id, hotelId);
+        } catch (Exception e) {
 
             return Result.error(e.getMessage());
         }
     }
 
-    @ApiOperation(value="删除", notes="删除")
+    @ApiOperation(value = "删除", notes = "删除")
     @DeleteMapping(value = "/delBatch")
-    public Result delBatch(@RequestBody CesGoodsDelDto dto){
-        if(StringUtils.isBlank(dto.getIdStr())){
+    public Result delBatch(@RequestBody CesGoodsDelDto dto) {
+        if (StringUtils.isBlank(dto.getIdStr())) {
             return Result.error(ResultCode.PARAM_MISS);
         }
-        try{
+        try {
             List<String> ids = Stream.of(dto.getIdStr().split(",")).collect(Collectors.toList());
             return goodsService.delBatch(ids);
-        }catch (Exception e){
+        } catch (Exception e) {
             return Result.error(e.getMessage());
         }
     }
 
     /**
-     *   添加临时菜品
+     * 添加临时菜品
      *
      * @param cesGoods
      * @return
      */
     @AutoLog(value = "添加临时菜品")
-    @ApiOperation(value="添加临时菜品", notes="添加临时菜品")
+    @ApiOperation(value = "添加临时菜品", notes = "添加临时菜品")
     @PostMapping(value = "/addTemp")
     public Result<CesGoods> addTemp(@RequestBody CesGoods cesGoods) {
         //临时
@@ -206,5 +216,56 @@ public class CesGoodsController extends JeecgController<CesGoods,CesGoodsService
         goodsService.save(cesGoods);
         return Result.OK(cesGoods);
     }
+
+    /**
+     * 适用于客房商品
+     *
+     * @param cesGoods
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "适用于客房商品", notes = "适用于客房商品")
+    @GetMapping(value = "/kf-goods-list")
+    public Result<IPage<CesGoods>> queryKfGoodsPageList(CesGoods cesGoods,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        LambdaQueryWrapper<CesGoods> queryWrapper = QueryGenerator.initQueryWrapper(cesGoods, req.getParameterMap()).lambda();
+        queryWrapper.eq(CesGoods::getInvalid, false);
+        queryWrapper.eq(CesGoods::getIsTemp, false);
+
+        LambdaQueryWrapper<CesStockType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(CesStockType::getHotelId, cesGoods.getHotelId());
+        lambdaQueryWrapper.eq(CesStockType::getState, true);
+        lambdaQueryWrapper.eq(CesStockType::getParentId, "0");
+        lambdaQueryWrapper.eq(CesStockType::getInvalid, false);
+        lambdaQueryWrapper.like(CesStockType::getApplyScope, "1");
+        List<CesStockType> goodTypes = cesStockTypeService.list(lambdaQueryWrapper);
+        if (ObjectUtils.isNotEmpty(goodTypes)) {
+            List<CesStockType> list = cesStockTypeService.list(Wrappers.<CesStockType>lambdaQuery()
+                    .eq(CesStockType::getHotelId, cesGoods.getHotelId())
+                    .eq(CesStockType::getInvalid, false));
+            queryWrapper.and(j -> {
+                for (int k = 0; k < goodTypes.size(); k++) {
+                    String id = goodTypes.get(k).getId();
+                    List<CesStockType> stockTypeList = list.stream().filter(t -> t.getParentId().equals(id)).collect(Collectors.toList());
+                    if (ObjectUtils.isNotEmpty(stockTypeList)) {
+                        for (int z = 0; z < stockTypeList.size(); z++) {
+                            j = j.or().eq(CesGoods::getGoodType, stockTypeList.get(z).getId());
+                        }
+                    }
+                    j = j.or().eq(CesGoods::getGoodType, id);
+                }
+            });
+            Page<CesGoods> page = new Page<CesGoods>(pageNo, pageSize);
+            IPage<CesGoods> pageList = goodsService.page(page, queryWrapper);
+            return Result.OK(pageList);
+        } else {
+            IPage<CesGoods> pageList = new Page<>();
+            return Result.OK(pageList);
+        }
+    }
 }
 

+ 121 - 19
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleController.java

@@ -23,9 +23,13 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.PmsUtil;
 import org.jeecg.common.util.TokenUtils;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.base.service.BaseCommonService;
+import org.jeecg.modules.business.entity.BusHotel;
+import org.jeecg.modules.business.service.IBusHotelService;
 import org.jeecg.modules.system.entity.*;
 import org.jeecg.modules.system.model.TreeModel;
 import org.jeecg.modules.system.service.*;
+import org.jeecg.modules.system.vo.RolePermissionVO;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -68,19 +72,25 @@ import lombok.extern.slf4j.Slf4j;
 public class SysRoleController {
 	@Autowired
 	private ISysRoleService sysRoleService;
-	
+
 	@Autowired
 	private ISysPermissionDataRuleService sysPermissionDataRuleService;
-	
+
 	@Autowired
 	private ISysRolePermissionService sysRolePermissionService;
-	
+
 	@Autowired
 	private ISysPermissionService sysPermissionService;
 
 	@Autowired
 	private ISysUserRoleService sysUserRoleService;
 
+	@Autowired
+	private BaseCommonService baseCommonService;
+
+	@Autowired
+	private IBusHotelService busHotelService;
+
 	/**
 	  * 分页列表查询
 	 * @param role
@@ -107,11 +117,103 @@ public class SysRoleController {
 			queryWrapper.isNull("tenant_id");
 		}
 		IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
+		pageList.getRecords().forEach(item->{
+			BusHotel hotle = busHotelService.getById(item.getHotelId());
+			if (hotle != null) {
+				item.setHotelName(hotle.getName());
+			}
+		});
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
+	/**
+	 *   添加
+	 * @param rolePermissionVO
+	 * @return
+	 */
+	@RequestMapping(value = "/saveRoleAndPermission", method = RequestMethod.POST)
+	//@RequiresRoles({"admin"})
+	public Result<SysRole> saveRoleAndPermission(@RequestBody RolePermissionVO rolePermissionVO) {
+		Result<SysRole> result = new Result<SysRole>();
+		if(rolePermissionVO==null) {
+			result.error500("参数错误");
+		}
+		SysRole role = rolePermissionVO.getRole();
+		JSONObject json = rolePermissionVO.getPermissionJson();
+		try {
+			role.setCreateTime(new Date());
+			// 如果当前登录人是租户,添加的角色应该有租户id
+			String userTenant = TokenUtils.currentTenantId();
+			if(userTenant != null && !userTenant.isEmpty()){
+				role.setTenantId(Integer.parseInt(userTenant));
+			}
+			sysRoleService.save(role);
+
+			long start = System.currentTimeMillis();
+			String roleId = role.getId();
+			String permissionIds = json.getString("permissionIds");
+			String lastPermissionIds = json.getString("lastpermissionIds");
+			this.sysRolePermissionService.saveRolePermission(roleId, permissionIds, lastPermissionIds);
+			//update-begin---author:wangshuai ---date:20220316  for:[VUEN-234]用户管理角色授权添加敏感日志------------
+			LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			baseCommonService.addLog("修改角色ID: "+roleId+" 的权限配置,操作人: " +loginUser.getUsername() ,CommonConstant.LOG_TYPE_2, 2);
+			//update-end---author:wangshuai ---date:20220316  for:[VUEN-234]用户管理角色授权添加敏感日志------------
+			log.info("======角色授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
+
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(), e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	 *  编辑
+	 * @param rolePermissionVO
+	 * @return
+	 */
+	//@RequiresRoles({"admin"})
+	@RequestMapping(value = "/editRoleAndPermission",method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<SysRole> editRoleAndPermission(@RequestBody RolePermissionVO rolePermissionVO) {
+		Result<SysRole> result = new Result<SysRole>();
+		if(rolePermissionVO==null) {
+			result.error500("参数错误");
+		}
+		SysRole role = rolePermissionVO.getRole();
+		JSONObject json = rolePermissionVO.getPermissionJson();
+		SysRole sysrole = sysRoleService.getById(role.getId());
+		if(sysrole==null) {
+			result.error500("未找到对应实体");
+		}else {
+			role.setUpdateTime(new Date());
+			// 编辑是默认给编辑的内容当前角色的租户
+			if(sysrole.getTenantId() != null) {
+				role.setTenantId(sysrole.getTenantId());
+			}
+			boolean ok = sysRoleService.updateById(role);
+			//TODO 返回false说明什么? qh:说明脑子有病毒,得清理一下
+			if(ok) {
+				long start = System.currentTimeMillis();
+				String roleId = role.getId();
+				String permissionIds = json.getString("permissionIds");
+				String lastPermissionIds = json.getString("lastpermissionIds");
+				this.sysRolePermissionService.saveRolePermission(roleId, permissionIds, lastPermissionIds);
+				//update-begin---author:wangshuai ---date:20220316  for:[VUEN-234]用户管理角色授权添加敏感日志------------
+				LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+				baseCommonService.addLog("修改角色ID: "+roleId+" 的权限配置,操作人: " +loginUser.getUsername() ,CommonConstant.LOG_TYPE_2, 2);
+				//update-end---author:wangshuai ---date:20220316  for:[VUEN-234]用户管理角色授权添加敏感日志------------
+				log.info("======角色授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
+
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
 	/**
 	  *   添加
 	 * @param role
@@ -136,7 +238,7 @@ public class SysRoleController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param role
@@ -161,10 +263,10 @@ public class SysRoleController {
 				result.success("修改成功!");
 			}
 		}
-		
+
 		return result;
 	}
-	
+
 	/**
 	  *   通过id删除
 	 * @param id
@@ -176,7 +278,7 @@ public class SysRoleController {
 		sysRoleService.deleteRole(id);
 		return Result.ok("删除角色成功");
 	}
-	
+
 	/**
 	  *  批量删除
 	 * @param ids
@@ -194,7 +296,7 @@ public class SysRoleController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  * 通过id查询
 	 * @param id
@@ -212,7 +314,7 @@ public class SysRoleController {
 		}
 		return result;
 	}
-	
+
 	@RequestMapping(value = "/queryall", method = RequestMethod.GET)
 	public Result<List<SysRole>> queryall() {
 		Result<List<SysRole>> result = new Result<>();
@@ -225,7 +327,7 @@ public class SysRoleController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  * 校验角色编码唯一
 	 */
@@ -317,7 +419,7 @@ public class SysRoleController {
 		}
 		return Result.error("文件导入失败!");
 	}
-	
+
 	/**
 	 * 查询数据规则数据
 	 */
@@ -346,7 +448,7 @@ public class SysRoleController {
 			//TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
 		}
 	}
-	
+
 	/**
 	 * 保存数据规则至角色菜单关联表
 	 */
@@ -373,8 +475,8 @@ public class SysRoleController {
 		}
 		return Result.ok("保存成功!");
 	}
-	
-	
+
+
 	/**
 	 * 用户角色授权功能,查询菜单权限树
 	 * @param request
@@ -420,7 +522,7 @@ public class SysRoleController {
 		}
 		return result;
 	}
-	
+
 	private void getTreeModelList(List<TreeModel> treeList,List<SysPermission> metaList,TreeModel temp) {
 		for (SysPermission permission : metaList) {
 			String tempPid = permission.getParentId();
@@ -436,9 +538,9 @@ public class SysRoleController {
 					getTreeModelList(treeList, metaList, tree);
 				}
 			}
-			
+
 		}
 	}
-	
-	
+
+
 }

+ 10 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/SysRole.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.time.LocalDateTime;
 import java.util.Date;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -35,19 +36,19 @@ public class SysRole implements Serializable {
      */
     @TableId(type = IdType.ASSIGN_ID)
     private String id;
-    
+
     /**
      * 角色名称
      */
     @Excel(name="角色名",width=15)
     private String roleName;
-    
+
     /**
      * 角色编码
      */
     @Excel(name="角色编码",width=15)
     private String roleCode;
-    
+
     /**
           * 描述
      */
@@ -83,5 +84,11 @@ public class SysRole implements Serializable {
      */
     private Integer tenantId;
 
+    /**关联酒店*/
+    @Excel(name = "关联酒店", width = 15)
+    @ApiModelProperty(value = "关联酒店")
+    private String hotelId;
 
+    /**酒店名称*/
+    private transient String hotelName;
 }

+ 32 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/vo/RolePermissionVO.java

@@ -0,0 +1,32 @@
+package org.jeecg.modules.system.vo;
+
+        import com.alibaba.fastjson.JSONObject;
+        import lombok.Data;
+        import org.jeecg.modules.system.entity.SysRole;
+
+        import java.io.Serializable;
+        import java.util.List;
+
+/**
+ * @Description: 角色权限vo
+ * @author: jeecg-boot
+ */
+@Data
+public class RolePermissionVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private SysRole role;
+    private JSONObject permissionJson;
+
+    public RolePermissionVO() {
+        super();
+    }
+
+    public RolePermissionVO(String roleId, List<String> userIdList) {
+        super();
+        this.role = role;
+        this.permissionJson = permissionJson;
+    }
+
+}
+