ソースを参照

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

gqx 2 年 前
コミット
2f22819c29
共有14 個のファイルを変更した603 個の追加16 個の削除を含む
  1. 79 8
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusMarketAgreementCustomerController.java
  2. 191 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusMarketAgreementCustomerHousePriceController.java
  3. 6 6
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusMarketAgreementCustomer.java
  4. 107 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusMarketAgreementCustomerHousePrice.java
  5. 2 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/CommissionTypeEnum.java
  6. 52 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/CommissionUnitEnum.java
  7. 17 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusMarketAgreementCustomerHousePriceMapper.java
  8. 5 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusMarketAgreementCustomerHousePriceMapper.xml
  9. 14 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusMarketAgreementCustomerHousePriceService.java
  10. 14 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusMarketAgreementCustomerService.java
  11. 19 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusMarketAgreementCustomerHousePriceServiceImpl.java
  12. 77 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusMarketAgreementCustomerServiceImpl.java
  13. 18 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/AgreementCustomerHousePriceVo.java
  14. 2 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesHousePriceSchemeServiceImpl.java

+ 79 - 8
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusMarketAgreementCustomerController.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.business.controller;
 
 import java.math.BigDecimal;
+import java.sql.Time;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -8,6 +10,7 @@ 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;
 
@@ -26,13 +29,15 @@ 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.BusMarketAgreementContacts;
-import org.jeecg.modules.business.entity.BusMarketAgreementCustomer;
-import org.jeecg.modules.business.entity.BusMarketAgreementUnit;
-import org.jeecg.modules.business.entity.BusOrderSound;
+import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.AgreementCommonEnum;
 import org.jeecg.modules.business.enums.CommissionTypeEnum;
+import org.jeecg.modules.business.enums.CommissionUnitEnum;
+import org.jeecg.modules.business.service.IBusMarketAgreementCustomerHousePriceService;
 import org.jeecg.modules.business.service.IBusMarketAgreementCustomerService;
+import org.jeecg.modules.business.vo.AgreementCustomerHousePriceVo;
+import org.jeecg.modules.rooms.entity.CesRoomLayout;
+import org.jeecg.modules.rooms.mapper.CesRoomLayoutMapper;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -64,6 +69,11 @@ public class BusMarketAgreementCustomerController extends JeecgController<BusMar
 	@Autowired
 	private IBusMarketAgreementCustomerService busMarketAgreementCustomerService;
 
+//	 @Autowired
+//	 private IBusMarketAgreementCustomerHousePriceService busMarketAgreementCustomerHousePriceService;
+//
+//	 @Resource
+//	 private CesRoomLayoutMapper cesRoomLayoutMapper;
 	/**
 	 * 分页列表查询
 	 *
@@ -106,7 +116,7 @@ public class BusMarketAgreementCustomerController extends JeecgController<BusMar
 		 List<BusMarketAgreementCustomer> list = busMarketAgreementCustomerService.list(queryWrapper);
 		 return Result.OK(list);
 	 }
-
+	 String _tenantId = "";
 	/**
 	 *   添加
 	 *
@@ -119,8 +129,8 @@ public class BusMarketAgreementCustomerController extends JeecgController<BusMar
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody BusMarketAgreementCustomer busMarketAgreementCustomer) {
 		busMarketAgreementCustomer.setDelFlag(CommonConstant.DEL_FLAG_0);
+		LoginUser user = TokenUtils.getAuthUser();
 		if(busMarketAgreementCustomer.getTenantId() == null || busMarketAgreementCustomer.getTenantId().equals("")){
-			LoginUser user = TokenUtils.getAuthUser();
 			if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
 				busMarketAgreementCustomer.setTenantId(user.getRelTenantIds());
 			} else {
@@ -143,7 +153,36 @@ public class BusMarketAgreementCustomerController extends JeecgController<BusMar
 		busMarketAgreementCustomer.setCommission(AgreementCommonEnum.yes.getKey());
 		busMarketAgreementCustomer.setFixedDiscount(AgreementCommonEnum.yes.getKey());
 		busMarketAgreementCustomer.setDiscount(BigDecimal.valueOf(100));
-		busMarketAgreementCustomerService.save(busMarketAgreementCustomer);
+		busMarketAgreementCustomerService.saveCustomer(busMarketAgreementCustomer,user.getRelTenantIds());
+
+//		busMarketAgreementCustomerService.save(busMarketAgreementCustomer);
+//		//客户协议添加完成后,处理关联的房价信息
+//		// 获取到所有房型
+//		List<CesRoomLayout> layoutList = cesRoomLayoutMapper.selectList(new QueryWrapper<CesRoomLayout>()
+//				.eq(CesRoomLayout.HOTEL_ID, busMarketAgreementCustomer.getHotelId())
+//				.eq(CesRoomLayout.INVALID,false));
+//		List<BusMarketAgreementCustomerHousePrice> customerHousePriceList = new ArrayList<>();
+//		if (layoutList != null && layoutList.size() >0) {
+//			LoginUser user = TokenUtils.getAuthUser();
+//			if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
+//				_tenantId = user.getRelTenantIds();
+//			}
+//			layoutList.forEach(item -> {
+//				BusMarketAgreementCustomerHousePrice customerHousePrice = new BusMarketAgreementCustomerHousePrice();
+//				customerHousePrice.setCustomerId(busMarketAgreementCustomer.getId());
+//				customerHousePrice.setLayoutId(item.getId());
+//				customerHousePrice.setAgreementPrice(item.getMarketPrice());
+//				customerHousePrice.setAgreementDiscount(BigDecimal.valueOf(100));
+//				customerHousePrice.setAgreementDiscount(BigDecimal.valueOf(100));
+//				customerHousePrice.setBreakfastNumber(0);
+//				customerHousePrice.setMonthPrice(BigDecimal.valueOf(0));
+//				customerHousePrice.setCommissionUnit(CommissionUnitEnum.yuan.getKey());
+//				customerHousePrice.setDailyCommission(BigDecimal.valueOf(0));
+//				customerHousePrice.setDelFlag(CommonConstant.DEL_FLAG_0);
+//				customerHousePriceList.add(customerHousePrice);
+//			});
+//			busMarketAgreementCustomerHousePriceService.saveBatch(customerHousePriceList);
+//		}
 		return Result.OK("添加成功!");
 	}
 
@@ -159,8 +198,8 @@ public class BusMarketAgreementCustomerController extends JeecgController<BusMar
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
 	public Result<String> edit(@RequestBody BusMarketAgreementCustomer busMarketAgreementCustomer) {
 //		busMarketAgreementCustomerService.updateById(busMarketAgreementCustomer);
+		LoginUser user = TokenUtils.getAuthUser();
 		if(busMarketAgreementCustomer.getTenantId() == null || busMarketAgreementCustomer.getTenantId().equals("")){
-			LoginUser user = TokenUtils.getAuthUser();
 			if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
 				busMarketAgreementCustomer.setTenantId(user.getRelTenantIds());
 			} else {
@@ -194,6 +233,38 @@ public class BusMarketAgreementCustomerController extends JeecgController<BusMar
 		return Result.OK("编辑成功!");
 	}
 
+	 /**
+	  *  编辑
+	  *
+	  * @param agreementCustomerHousePriceVo
+	  * @return
+	  */
+	 @AutoLog(value = "客户协议房价-编辑")
+	 @ApiOperation(value="客户协议房价-编辑", notes="客户协议房价-编辑")
+	 @RequestMapping(value = "/editHousePrice", method = {RequestMethod.PUT,RequestMethod.POST})
+	 public Result<String> editHousePrice(@RequestBody AgreementCustomerHousePriceVo agreementCustomerHousePriceVo) {
+		 LoginUser user = TokenUtils.getAuthUser();
+		 BusMarketAgreementCustomer busMarketAgreementCustomer = agreementCustomerHousePriceVo.getAgreementCustomer();
+		 if(busMarketAgreementCustomer.getTenantId() == null || busMarketAgreementCustomer.getTenantId().equals("")){
+			 if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
+				 busMarketAgreementCustomer.setTenantId(user.getRelTenantIds());
+			 } else {
+				 throw new JeecgBootException("当前登录人租户信息错误");
+			 }
+		 }
+		 BusMarketAgreementCustomer editModel = busMarketAgreementCustomerService.getById(busMarketAgreementCustomer.getId());
+		 editModel.setRoomType(busMarketAgreementCustomer.getRoomType());
+		 editModel.setCommissionUnit(busMarketAgreementCustomer.getCommissionUnit());
+		 editModel.setDailyCommission(busMarketAgreementCustomer.getDailyCommission());
+		 editModel.setCommission(busMarketAgreementCustomer.getCommission());
+		 editModel.setFixedDiscount(busMarketAgreementCustomer.getFixedDiscount());
+		 editModel.setDiscount(busMarketAgreementCustomer.getDiscount());
+		 //协议房价信息处理
+		 List<BusMarketAgreementCustomerHousePrice> customerHousePriceList = agreementCustomerHousePriceVo.getCustomerHousePriceList();
+		 busMarketAgreementCustomerService.editCustomer(editModel,customerHousePriceList);
+		 return Result.OK("编辑成功!");
+	 }
+
 	/**
 	 *   通过id删除
 	 *

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

@@ -0,0 +1,191 @@
+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.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 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.BusMarketAgreementCustomerHousePrice;
+import org.jeecg.modules.business.service.IBusMarketAgreementCustomerHousePriceService;
+import org.jeecg.modules.rooms.entity.CesRoomLayout;
+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;
+
+ /**
+ * @Description: 客户协议-房价管理
+ * @Author: jeecg-boot
+ * @Date:   2023-04-12
+ * @Version: V1.0
+ */
+@Api(tags="客户协议-房价管理")
+@RestController
+@RequestMapping("/business/busMarketAgreementCustomerHousePrice")
+@Slf4j
+public class BusMarketAgreementCustomerHousePriceController extends JeecgController<BusMarketAgreementCustomerHousePrice, IBusMarketAgreementCustomerHousePriceService> {
+	@Autowired
+	private IBusMarketAgreementCustomerHousePriceService busMarketAgreementCustomerHousePriceService;
+
+	 @Resource
+	 private CesRoomLayoutServiceImpl cesRoomLayoutService;
+
+	/**
+	 * 分页列表查询
+	 *
+	 * @param busMarketAgreementCustomerHousePrice
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "客户协议-房价管理-分页列表查询")
+	@ApiOperation(value="客户协议-房价管理-分页列表查询", notes="客户协议-房价管理-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BusMarketAgreementCustomerHousePrice>> queryPageList(BusMarketAgreementCustomerHousePrice busMarketAgreementCustomerHousePrice,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<BusMarketAgreementCustomerHousePrice> queryWrapper = QueryGenerator.initQueryWrapper(busMarketAgreementCustomerHousePrice, req.getParameterMap());
+		Page<BusMarketAgreementCustomerHousePrice> page = new Page<BusMarketAgreementCustomerHousePrice>(pageNo, pageSize);
+		IPage<BusMarketAgreementCustomerHousePrice> pageList = busMarketAgreementCustomerHousePriceService.page(page, queryWrapper);
+		pageList.getRecords().forEach(item->{
+			CesRoomLayout layout = cesRoomLayoutService.getById(item.getLayoutId());
+			if (layout != null) {
+				item.setLayoutName(layout.getName());
+				item.setLayoutPrice(layout.getMarketPrice());
+			}
+		});
+		return Result.OK(pageList);
+	}
+
+	/**
+	 *   添加
+	 *
+	 * @param busMarketAgreementCustomerHousePrice
+	 * @return
+	 */
+	@AutoLog(value = "客户协议-房价管理-添加")
+	@ApiOperation(value="客户协议-房价管理-添加", notes="客户协议-房价管理-添加")
+	//@RequiresPermissions("business:bus_market_agreement_customer_house_price_info:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BusMarketAgreementCustomerHousePrice busMarketAgreementCustomerHousePrice) {
+		busMarketAgreementCustomerHousePriceService.save(busMarketAgreementCustomerHousePrice);
+		return Result.OK("添加成功!");
+	}
+
+	/**
+	 *  编辑
+	 *
+	 * @param busMarketAgreementCustomerHousePrice
+	 * @return
+	 */
+	@AutoLog(value = "客户协议-房价管理-编辑")
+	@ApiOperation(value="客户协议-房价管理-编辑", notes="客户协议-房价管理-编辑")
+	//@RequiresPermissions("business:bus_market_agreement_customer_house_price_info:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BusMarketAgreementCustomerHousePrice busMarketAgreementCustomerHousePrice) {
+		busMarketAgreementCustomerHousePriceService.updateById(busMarketAgreementCustomerHousePrice);
+		return Result.OK("编辑成功!");
+	}
+
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "客户协议-房价管理-通过id删除")
+	@ApiOperation(value="客户协议-房价管理-通过id删除", notes="客户协议-房价管理-通过id删除")
+	//@RequiresPermissions("business:bus_market_agreement_customer_house_price_info:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		busMarketAgreementCustomerHousePriceService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "客户协议-房价管理-批量删除")
+	@ApiOperation(value="客户协议-房价管理-批量删除", notes="客户协议-房价管理-批量删除")
+	//@RequiresPermissions("business:bus_market_agreement_customer_house_price_info:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.busMarketAgreementCustomerHousePriceService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "客户协议-房价管理-通过id查询")
+	@ApiOperation(value="客户协议-房价管理-通过id查询", notes="客户协议-房价管理-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BusMarketAgreementCustomerHousePrice> queryById(@RequestParam(name="id",required=true) String id) {
+		BusMarketAgreementCustomerHousePrice busMarketAgreementCustomerHousePrice = busMarketAgreementCustomerHousePriceService.getById(id);
+		if(busMarketAgreementCustomerHousePrice==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(busMarketAgreementCustomerHousePrice);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param busMarketAgreementCustomerHousePrice
+    */
+    //@RequiresPermissions("business:bus_market_agreement_customer_house_price_info:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BusMarketAgreementCustomerHousePrice busMarketAgreementCustomerHousePrice) {
+        return super.exportXls(request, busMarketAgreementCustomerHousePrice, BusMarketAgreementCustomerHousePrice.class, "客户协议-房价管理");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("business:bus_market_agreement_customer_house_price_info:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, BusMarketAgreementCustomerHousePrice.class);
+    }
+
+}

+ 6 - 6
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusMarketAgreementCustomer.java

@@ -94,9 +94,9 @@ public class BusMarketAgreementCustomer implements Serializable {
     @ApiModelProperty(value = "备注")
     private String remarks;
 
-    /**计佣类型(0-固定计佣;1-房类计佣)*/
-    @Excel(name = "计佣类型(0-固定计佣;1-房类计佣)", width = 15)
-    @ApiModelProperty(value = "计佣类型(0-固定计佣;1-房类计佣)")
+    /**记佣类型(0-固定记佣;1-房类记佣)*/
+    @Excel(name = "记佣类型(0-固定记佣;1-房类记佣)", width = 15)
+    @ApiModelProperty(value = "记佣类型(0-固定记佣;1-房类记佣)")
     private java.lang.Integer roomType;
     /**佣金单位(0-元;1-%)*/
     @Excel(name = "佣金单位(0-元;1-%)", width = 15)
@@ -106,9 +106,9 @@ public class BusMarketAgreementCustomer implements Serializable {
     @Excel(name = "每日佣金", width = 15)
     @ApiModelProperty(value = "每日佣金")
     private java.math.BigDecimal dailyCommission;
-    /**每日佣(0-否;1-是)*/
-    @Excel(name = "每日佣(0-否;1-是)", width = 15)
-    @ApiModelProperty(value = "每日佣(0-否;1-是)")
+    /**每日佣(0-否;1-是)*/
+    @Excel(name = "每日佣(0-否;1-是)", width = 15)
+    @ApiModelProperty(value = "每日佣(0-否;1-是)")
     private java.lang.Integer commission;
     /**使用固定房价折扣(0-否;1-是)*/
     @Excel(name = "使用固定房价折扣(0-否;1-是)", width = 15)

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

@@ -0,0 +1,107 @@
+package org.jeecg.modules.business.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+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: 客户协议-房价管理
+ * @Author: jeecg-boot
+ * @Date:   2023-04-12
+ * @Version: V1.0
+ */
+@Data
+@TableName("bus_market_agreement_customer_house_price_info")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="bus_market_agreement_customer_house_price_info对象", description="客户协议-房价管理")
+public class BusMarketAgreementCustomerHousePrice implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**主键*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private String id;
+	/**关联租户*/
+	@Excel(name = "关联租户", width = 15)
+    @ApiModelProperty(value = "关联租户")
+    private String tenantId;
+	/**关联酒店*/
+	@Excel(name = "关联酒店", width = 15)
+    @ApiModelProperty(value = "关联酒店")
+    private String hotelId;
+	/**关联客户协议*/
+	@Excel(name = "关联客户协议", width = 15)
+    @ApiModelProperty(value = "关联客户协议")
+    private String customerId;
+	/**关联房型*/
+	@Excel(name = "关联房型", width = 15)
+    @ApiModelProperty(value = "关联房型")
+    private String layoutId;
+	/**协议房价*/
+	@Excel(name = "协议房价", width = 15)
+    @ApiModelProperty(value = "协议房价")
+    private BigDecimal agreementPrice;
+	/**协议折扣*/
+	@Excel(name = "协议折扣", width = 15)
+    @ApiModelProperty(value = "协议折扣")
+    private BigDecimal agreementDiscount;
+	/**房价折扣*/
+	@Excel(name = "房价折扣", width = 15)
+    @ApiModelProperty(value = "房价折扣")
+    private BigDecimal discount;
+	/**早餐数量*/
+	@Excel(name = "早餐数量", width = 15)
+    @ApiModelProperty(value = "早餐数量")
+    private Integer breakfastNumber;
+	/**月长包房价*/
+	@Excel(name = "月长包房价", width = 15)
+    @ApiModelProperty(value = "月长包房价")
+    private BigDecimal monthPrice;
+	/**佣金单位(0-元;1-%)*/
+	@Excel(name = "佣金单位(0-元;1-%)", width = 15)
+    @ApiModelProperty(value = "佣金单位(0-元;1-%)")
+    private Integer commissionUnit;
+	/**日佣金*/
+	@Excel(name = "日佣金", width = 15)
+    @ApiModelProperty(value = "日佣金")
+    private BigDecimal dailyCommission;
+	/**删除状态(0-正常,1-已删除)*/
+	@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
+    @TableLogic
+    private Integer delFlag;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    private transient String layoutName;
+    private transient BigDecimal layoutPrice;
+}

+ 2 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/CommissionTypeEnum.java

@@ -6,8 +6,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 public enum CommissionTypeEnum {
-    house(1, ""),
-    fix(0, ""),;
+    house(1, "房类记佣"),
+    fix(0, "固定记佣"),;
 
     Integer key;
 

+ 52 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/CommissionUnitEnum.java

@@ -0,0 +1,52 @@
+package org.jeecg.modules.business.enums;
+
+import org.jeecg.common.system.vo.DictModel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public enum CommissionUnitEnum {
+    percentage(1, "%"),
+    yuan(0, "元"),;
+
+    Integer key;
+
+    String title;
+
+    CommissionUnitEnum(Integer key, String title){
+        this.key = key;
+        this.title = title;
+    }
+    public Integer getKey() {
+        return key;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * 获取字典数据
+     * @return
+     */
+    public static List<DictModel> getDictList(){
+        List<DictModel> list = new ArrayList<>();
+        DictModel dictModel = null;
+        for(CommissionUnitEnum e: CommissionUnitEnum.values()){
+            dictModel = new DictModel();
+            dictModel.setValue(e.key.toString());
+            dictModel.setText(e.title);
+            list.add(dictModel);
+        }
+        return list;
+    }
+
+    public static CommissionUnitEnum val(Integer key){
+        for(CommissionUnitEnum bld: values()){
+            if(bld.key == key){
+                return bld;
+            }
+        }
+        return null;
+    }
+}

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

@@ -0,0 +1,17 @@
+package org.jeecg.modules.business.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomerHousePrice;
+
+/**
+ * @Description: 客户协议-房价管理
+ * @Author: jeecg-boot
+ * @Date:   2023-04-12
+ * @Version: V1.0
+ */
+public interface BusMarketAgreementCustomerHousePriceMapper extends BaseMapper<BusMarketAgreementCustomerHousePrice> {
+
+}

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusMarketAgreementCustomerHousePriceMapper.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.demo.business.mapper.BusMarketAgreementCustomerHousePriceMapper">
+
+</mapper>

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomerHousePrice;
+
+/**
+ * @Description: 客户协议-房价管理
+ * @Author: jeecg-boot
+ * @Date:   2023-04-12
+ * @Version: V1.0
+ */
+public interface IBusMarketAgreementCustomerHousePriceService extends IService<BusMarketAgreementCustomerHousePrice> {
+
+}

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

@@ -2,6 +2,10 @@ package org.jeecg.modules.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.business.entity.BusMarketAgreementCustomer;
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomerHousePrice;
+import org.jeecg.modules.system.entity.SysUser;
+
+import java.util.List;
 
 /**
  * @Description: 协议单位-客户协议
@@ -10,5 +14,15 @@ import org.jeecg.modules.business.entity.BusMarketAgreementCustomer;
  * @Version: V1.0
  */
 public interface IBusMarketAgreementCustomerService extends IService<BusMarketAgreementCustomer> {
+    /**
+     * 保存客户协议
+     * @param agreementCustomer 客户协议
+     */
+    void saveCustomer(BusMarketAgreementCustomer agreementCustomer,String tenantId);
 
+    /**
+     * 编辑客户协议
+     * @param agreementCustomer 客户协议
+     */
+    void editCustomer(BusMarketAgreementCustomer agreementCustomer, List<BusMarketAgreementCustomerHousePrice> customerHousePriceList);
 }

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.business.service.impl;
+
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomerHousePrice;
+import org.jeecg.modules.business.mapper.BusMarketAgreementCustomerHousePriceMapper;
+import org.jeecg.modules.business.service.IBusMarketAgreementCustomerHousePriceService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 客户协议-房价管理
+ * @Author: jeecg-boot
+ * @Date:   2023-04-12
+ * @Version: V1.0
+ */
+@Service
+public class BusMarketAgreementCustomerHousePriceServiceImpl extends ServiceImpl<BusMarketAgreementCustomerHousePriceMapper, BusMarketAgreementCustomerHousePrice> implements IBusMarketAgreementCustomerHousePriceService {
+
+}

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

@@ -1,11 +1,30 @@
 package org.jeecg.modules.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.TokenUtils;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.business.entity.BusMarketAgreementCustomer;
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomerHousePrice;
+import org.jeecg.modules.business.enums.CommissionUnitEnum;
+import org.jeecg.modules.business.mapper.BusMarketAgreementCustomerHousePriceMapper;
 import org.jeecg.modules.business.mapper.BusMarketAgreementCustomerMapper;
 import org.jeecg.modules.business.service.IBusMarketAgreementCustomerService;
+import org.jeecg.modules.rooms.entity.CesRoomLayout;
+import org.jeecg.modules.rooms.mapper.CesRoomLayoutMapper;
+import org.jeecg.modules.system.entity.*;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 协议单位-客户协议
@@ -15,5 +34,63 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class BusMarketAgreementCustomerServiceImpl extends ServiceImpl<BusMarketAgreementCustomerMapper, BusMarketAgreementCustomer> implements IBusMarketAgreementCustomerService {
+    @Resource
+    private CesRoomLayoutMapper cesRoomLayoutMapper;
+
+    @Resource
+    private BusMarketAgreementCustomerHousePriceMapper agreementCustomerHousePriceMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveCustomer(BusMarketAgreementCustomer agreementCustomer,String tenantId) {
+        //step.1 保存客户协议
+        this.save(agreementCustomer);
+        //step.2 处理协议关联房价信息
+        // 获取到所有房型
+        List<CesRoomLayout> layoutList = cesRoomLayoutMapper.selectList(new QueryWrapper<CesRoomLayout>()
+                .eq(CesRoomLayout.HOTEL_ID, agreementCustomer.getHotelId())
+                .eq(CesRoomLayout.INVALID,false));
+        List<BusMarketAgreementCustomerHousePrice> customerHousePriceList = new ArrayList<>();
+        if (layoutList != null && layoutList.size() >0) {
+            layoutList.forEach(item -> {
+                BusMarketAgreementCustomerHousePrice customerHousePrice = new BusMarketAgreementCustomerHousePrice();
+                customerHousePrice.setTenantId(tenantId);
+                customerHousePrice.setHotelId(agreementCustomer.getHotelId());
+                customerHousePrice.setCustomerId(agreementCustomer.getId());
+                customerHousePrice.setLayoutId(item.getId());
+                customerHousePrice.setAgreementPrice(item.getMarketPrice());
+                customerHousePrice.setAgreementDiscount(BigDecimal.valueOf(100));
+                customerHousePrice.setDiscount(BigDecimal.valueOf(100));
+                customerHousePrice.setBreakfastNumber(0);
+                customerHousePrice.setMonthPrice(BigDecimal.valueOf(0));
+                customerHousePrice.setCommissionUnit(CommissionUnitEnum.yuan.getKey());
+                customerHousePrice.setDailyCommission(BigDecimal.valueOf(0));
+                customerHousePrice.setDelFlag(CommonConstant.DEL_FLAG_0);
+                customerHousePriceList.add(customerHousePrice);
+                agreementCustomerHousePriceMapper.insert(customerHousePrice);
+            });
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void editCustomer(BusMarketAgreementCustomer agreementCustomer,List<BusMarketAgreementCustomerHousePrice> customerHousePriceList) {
+        //step.1 修改客户协议基础信息
+        this.updateById(agreementCustomer);
 
+        //step.2 修改关联协议房价信息
+        if (customerHousePriceList != null && customerHousePriceList.size() > 0){
+            customerHousePriceList.forEach(item->{
+                agreementCustomerHousePriceMapper.updateById(item);
+            });
+        }
+//        //查询已关联房价信息
+//        List<BusMarketAgreementCustomerHousePrice> customerHousePriceList = agreementCustomerHousePriceMapper
+//                .selectList(new QueryWrapper<BusMarketAgreementCustomerHousePrice>()
+//                        .lambda().eq(BusMarketAgreementCustomerHousePrice::getCustomerId, agreementCustomer.getId()));
+//        if(customerHousePriceList != null && customerHousePriceList.size()>0){
+//            for(BusMarketAgreementCustomerHousePrice housePrice : customerHousePriceList ){
+//            }
+//        }
+    }
 }

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

@@ -0,0 +1,18 @@
+package org.jeecg.modules.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.modules.business.entity.BusBookingBatch;
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomer;
+import org.jeecg.modules.business.entity.BusMarketAgreementCustomerHousePrice;
+
+import java.util.List;
+
+@Data
+public class AgreementCustomerHousePriceVo {
+    @ApiModelProperty(value = "客户协议")
+    private BusMarketAgreementCustomer agreementCustomer;
+
+    @ApiModelProperty(value = "客户协议房价列表")
+    private List<BusMarketAgreementCustomerHousePrice> customerHousePriceList;
+}

+ 2 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesHousePriceSchemeServiceImpl.java

@@ -30,6 +30,7 @@ import org.jeecg.modules.rooms.mapper.CesRoomLayoutMapper;
 import org.jeecg.modules.system.entity.SysTenant;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.sql.Time;
@@ -115,6 +116,7 @@ public class CesHousePriceSchemeServiceImpl extends ServiceImpl<CesHousePriceSch
     }
 
     String _tenantId = "";
+    @Transactional(rollbackFor = Exception.class)
     public Result create(CesHousePriceSchemeDto dto) {
         dto.setCreateAt(LocalDateTime.now());
         dto.setUpdateAt(LocalDateTime.now());