فهرست منبع

feat(app):
1.包场场相关页面接口
2.新增关联规则时间表及其相关mapper\service

wzq 18 ساعت پیش
والد
کامیت
5bcab5cbaf
21فایلهای تغییر یافته به همراه884 افزوده شده و 176 حذف شده
  1. 10 12
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppCoursesPriceRulesController.java
  2. 63 9
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppSitePlaceController.java
  3. 27 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteCategoryRuleDTO.java
  4. 0 6
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSitePlaceCuDTO.java
  5. 25 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSitePlaceParkDTO.java
  6. 5 3
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteRuleDTO.java
  7. 43 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteRuleTimeDTO.java
  8. 46 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteRuleTimeFormDTO.java
  9. 11 11
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppCoursesPriceRules.java
  10. 4 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSitePriceRules.java
  11. 79 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSiteRuleTime.java
  12. 9 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppSiteRuleTimeMapper.java
  13. 3 2
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSitePriceRulesMapper.xml
  14. 5 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSiteRuleTimeMapper.xml
  15. 1 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppCoursesPriceRulesService.java
  16. 12 4
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppSitePlaceService.java
  17. 7 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppSiteRuleTimeService.java
  18. 8 21
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppCoursesPriceRulesServiceImpl.java
  19. 512 106
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSitePlaceServiceImpl.java
  20. 11 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSiteRuleTimeServiceImpl.java
  21. 3 0
      national-motion-module-system/national-motion-system-start/src/main/resources/application-dev.yml

+ 10 - 12
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppCoursesPriceRulesController.java

@@ -1,19 +1,17 @@
 package org.jeecg.modules.system.app.controller;
 
-import java.util.List;
-
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.system.app.dto.AppCoursesRuleDTO;
 import org.jeecg.modules.system.app.entity.AppCoursesPriceRules;
 import org.jeecg.modules.system.app.service.IAppCoursesPriceRulesService;
-
-import lombok.extern.slf4j.Slf4j;
-
-import org.jeecg.common.system.base.controller.JeecgController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
+
+import java.util.List;
 
 /**
  * @Description: 课程价格规则表
@@ -123,18 +121,18 @@ public class AppCoursesPriceRulesController extends JeecgController<AppCoursesPr
 	//@AutoLog(value = "课程价格规则表-通过id查询")
 	@Operation(summary="课程价格规则表-通过课程id查询")
 	@GetMapping(value = "/queryListByCoursesId")
-	public Result<List<AppCoursesRuleDTO>> queryListByCoursesId(@RequestParam(name="id",required=true) String coursesId) {
-		return Result.OK(appCoursesPriceRulesService.queryCoursesPriceRulesList(coursesId));
+	public Result<List<AppCoursesRuleDTO>> queryListByCoursesId(@RequestParam(name="id",required=true) String coursesId,@RequestParam(name="coursesType",required=true) Integer coursesType) {
+		return Result.OK(appCoursesPriceRulesService.queryCoursesPriceRulesList(coursesId,coursesType));
 	}
 
 	/**
-	 * 编辑保存课时
+	 * 补课列表编辑
 	 *
 	 * @param dtoList
 	 * @return
 	 */
 	//@AutoLog(value = "课程价格规则表-通过id查询")
-	@Operation(summary="课程价格规则表-编辑保存课时")
+	@Operation(summary="课程价格规则表-补课列表编辑")
 	@PostMapping(value = "/editPriceRules")
 	public Result<String> editPriceRules(List<AppCoursesRuleDTO> dtoList) {
 		return appCoursesPriceRulesService.editWitchPriceRules(dtoList)?Result.OK("操作成功"):Result.error("保存失败");

+ 63 - 9
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppSitePlaceController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.system.app.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
@@ -9,11 +10,14 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.jmreport.common.annotation.RequiresPermissions;
 import org.jeecg.modules.system.app.dto.*;
+import org.jeecg.modules.system.app.entity.AppSite;
 import org.jeecg.modules.system.app.entity.AppSitePlace;
 import org.jeecg.modules.system.app.service.IAppSitePlaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @Description: 商户场所表
  * @Author: jeecg-boot
@@ -84,18 +88,27 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
         Boolean b = appSitePlaceService.addUnfixed(unfixedDTO);
         return b ? Result.OK("添加成功!") : Result.error("添加失败!");
     }
+
+//    @AutoLog(value = "商户包场-添加")
+//    @Operation(summary = "商户包场-添加")
+//    @RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:add")
+//    @PostMapping(value = "/savePack")
+//    public Result<String> savePack(@RequestBody AppSitePlaceDTO unfixedDTO) {
+//        Boolean b = appSitePlaceService.savePack(unfixedDTO);
+//        return b ? Result.OK("添加成功!") : Result.error("添加失败!");
+//    }
     /**
      * 添加
      *
-     * @param unfixedDTO
+     * @param appSitePlaceParkDTO
      * @return
      */
     @AutoLog(value = "商户包场-添加")
     @Operation(summary = "商户包场-添加")
-//	@RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:add")
+    @RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:add")
     @PostMapping(value = "/savePack")
-    public Result<String> savePack(@RequestBody AppSitePlaceDTO unfixedDTO) {
-        Boolean b = appSitePlaceService.savePack(unfixedDTO);
+    public Result<String> savePack(@RequestBody AppSitePlaceParkDTO appSitePlaceParkDTO) {
+        Boolean b = appSitePlaceService.savePack(appSitePlaceParkDTO);
         return b ? Result.OK("添加成功!") : Result.error("添加失败!");
     }
 
@@ -116,7 +129,7 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
     /**
      * 编辑
      *
-     * @param appSitePlace
+     * @param appSitePlaceParkDTO
      * @return
      */
     @AutoLog(value = "商户包场-编辑")
@@ -124,11 +137,39 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
 //	@RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:edit")
     @RequestMapping(value = "/editPack", method = {RequestMethod.PUT, RequestMethod.POST})
     public Result<String> editPack(@RequestBody
-                                   AppSitePlaceDTO appSitePlace) {
-        Boolean b = appSitePlaceService.editPack(appSitePlace);
+                                   AppSitePlaceParkDTO appSitePlaceParkDTO) {
+        Boolean b = appSitePlaceService.editPack(appSitePlaceParkDTO);
         return b ? Result.OK("编辑成功!") : Result.error("编辑失败!");
     }
 
+    /**
+     * 编辑
+     *
+     * @param siteId
+     * @return
+     */
+    @AutoLog(value = "商户包场-查询")
+    @Operation(summary = "商户包场-查询")
+    @GetMapping(value = "/queryPack")
+    public Result<AppSitePlaceParkDTO> queryPack(@RequestParam(name = "siteId", required = true) String siteId) {
+        AppSitePlaceParkDTO appSitePlaceParkDTO= appSitePlaceService.queryPack(siteId);
+        return Result.OK(appSitePlaceParkDTO);
+    }
+
+    /**
+     * 根据部门ID查询site列表
+     *
+     * @param deptId
+     * @return
+     */
+    @AutoLog(value = "根据部门ID查询商户信息列表")
+    @Operation(summary = "根据部门ID查询site列表")
+    @GetMapping(value = "/queryByDeptId/{deptId}")
+    public Result<List<AppSite>> queryByDeptId(@PathVariable(name = "deptId") String deptId) {
+        List<AppSite> appSites = appSitePlaceService.queryByDeptId(deptId);
+        return Result.OK(appSites);
+    }
+
     /**
      * 编辑
      *
@@ -180,8 +221,8 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
      * @param id
      * @return
      */
-    @AutoLog(value = "商户无固定场所-通过id删除")
-    @Operation(summary = "商户无固定场所-通过id删除")
+    @AutoLog(value = "商户包场-通过id删除")
+    @Operation(summary = "商户包场-通过id删除")
 //	@RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:delete")
     @DeleteMapping(value = "/deletePackById")
     public Result<String> deletePackById(@RequestParam(name = "id", required = true) String id) {
@@ -189,6 +230,19 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
         return Result.OK("删除成功!");
     }
 
+    /**
+     * 通过id删除
+     *
+     * @param siteId
+     * @return
+     */
+    @Operation(summary = "查询商户门店列表")
+    @GetMapping(value = "/querySitePlaceList")
+    public Result<List<AppSitePlace>> querySitePlaceList(@RequestParam(name = "id", required = true) String siteId) {
+        List<AppSitePlace> list = appSitePlaceService.list(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, siteId));
+        return Result.OK(list);
+    }
+
     /**
      * 通过id查询
      *

+ 27 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteCategoryRuleDTO.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.system.app.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description="场地价格规则自定义DTO")
+public class AppSiteCategoryRuleDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String categoryId;
+
+    private Integer count;
+
+    private List<AppSiteRuleTimeFormDTO> appSiteRuleTimeFormDTOList;
+}

+ 0 - 6
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSitePlaceCuDTO.java

@@ -1,7 +1,5 @@
 package org.jeecg.modules.system.app.dto;
 
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -9,10 +7,8 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
 
 import javax.validation.constraints.NotNull;
-import java.util.Date;
 
 /**
  * @author DM
@@ -27,8 +23,6 @@ import java.util.Date;
 @NoArgsConstructor
 @Schema(description="场所入参自定义DTO")
 public class AppSitePlaceCuDTO {
-    @Schema(description = "id")
-    private String id;
     /**商户补充信息id*/
     @Excel(name = "商户补充信息id", width = 15)
     @Schema(description = "商户补充信息id")

+ 25 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSitePlaceParkDTO.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.system.app.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description="包场自定义DTO")
+public class AppSitePlaceParkDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private AppSitePlaceCuDTO appSitePlaceCuDTO;
+
+    private List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS;
+}

+ 5 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteRuleDTO.java

@@ -7,7 +7,6 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import javax.validation.constraints.NotNull;
@@ -29,8 +28,8 @@ public class AppSiteRuleDTO {
     @Schema(description = "id")
     private String id;
     /**场地*/
-    @Schema(description = "场")
-    private String siteId;
+    @Schema(description = "场")
+    private String sitePlaceId;
     /**运动类型*/
     @Schema(description = "运动类型")
     private String categoryId;
@@ -60,6 +59,9 @@ public class AppSiteRuleDTO {
     /**是否教学日0是1不是*/
     @Schema(description = "是否教学日0是1不是")
     private Integer isTeaching;
+    /**关联规则时间ID*/
+    @Schema(description = "关联规则时间ID")
+    private String siteRuleTimeId;
     /**场数*/
     @Schema(description = "场数/库存")
     private Integer inventory;

+ 43 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteRuleTimeDTO.java

@@ -0,0 +1,43 @@
+package org.jeecg.modules.system.app.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description="场地规则时间DTO")
+public class AppSiteRuleTimeDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @Schema(description = "id")
+    private String id;
+    /**开始时间*/
+    @Excel(name = "开始时间", width = 20, format = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    @Schema(description = "开始时间")
+    private Date startTime;
+    /**结束时间*/
+    @Excel(name = "结束时间", width = 20, format = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    @Schema(description = "结束时间")
+    private Date endTime;
+}

+ 46 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppSiteRuleTimeFormDTO.java

@@ -0,0 +1,46 @@
+package org.jeecg.modules.system.app.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description="场地价格规则列表入参DTO")
+public class AppSiteRuleTimeFormDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @Schema(description = "id")
+    private String id;
+    /**开始时间*/
+    @Excel(name = "开始时间", width = 20, format = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    @Schema(description = "开始时间")
+    private Date startTime;
+    /**结束时间*/
+    @Excel(name = "结束时间", width = 20, format = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    @Schema(description = "结束时间")
+    private Date endTime;
+
+    private List<AppSiteRuleDTO> appSiteRuleDTOList;
+}

+ 11 - 11
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppCoursesPriceRules.java

@@ -1,23 +1,19 @@
 package org.jeecg.modules.system.app.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 org.jeecg.common.constant.ProvinceCityArea;
-import org.jeecg.common.util.SpringContextUtils;
-import lombok.Data;
+import com.baomidou.mybatisplus.annotation.TableName;
 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.v3.oas.annotations.media.Schema;
+import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * @Description: 课程价格规则表
@@ -69,6 +65,10 @@ public class AppCoursesPriceRules implements Serializable {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @Schema(description = "结束时间")
     private Date endTime;
+    /**结束时间*/
+    @Excel(name = "课程类型(0-正常 1-补课)", width = 20)
+    @Schema(description = "课程类型(0-正常 1-补课)")
+    private Integer coursesType;
 	/**乐观锁*/
 	@Excel(name = "乐观锁", width = 15)
     @Schema(description = "乐观锁")

+ 4 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSitePriceRules.java

@@ -86,7 +86,10 @@ public class AppSitePriceRules implements Serializable {
     @Excel(name = "展示状态(0正常,1已定,2过期)", width = 15)
     @Schema(description = "展示状态(0正常,1已定,2过期)")
     private Integer viewStatus;
-
+    /**售价*/
+    @Excel(name = "关联规则时间ID", width = 15)
+    @Schema(description = "关联规则时间ID")
+    private String siteRuleTimeId;
     /**乐观锁*/
     @Excel(name = "乐观锁", width = 15)
     @Schema(description = "乐观锁")

+ 79 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSiteRuleTime.java

@@ -0,0 +1,79 @@
+package org.jeecg.modules.system.app.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("nm_site_rules_time")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="场地规则时间表")
+public class AppSiteRuleTime implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @Schema(description = "id")
+    private String id;
+    /**关联编码id*/
+    @Excel(name = "关联商户补充信息id", width = 15)
+    @Schema(description = "关联商户补充信息id")
+    private String siteId;
+    /**运动类型*/
+    @Excel(name = "运动类型", width = 15)
+    @Schema(description = "运动类型")
+    private String categoryId;
+    /**开始时间*/
+    @Excel(name = "开始时间", width = 20, format = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    @Schema(description = "开始时间")
+    private Date startTime;
+    /**结束时间*/
+    @Excel(name = "结束时间", width = 20, format = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
+    @DateTimeFormat(pattern="HH:mm:ss")
+    @Schema(description = "结束时间")
+    private Date endTime;
+    /**乐观锁*/
+    @Excel(name = "乐观锁", width = 15)
+    @Schema(description = "乐观锁")
+    private Integer revision;
+    /**创建人;创建人*/
+    @Schema(description = "创建人;创建人")
+    private String createBy;
+    /**创建时间;创建时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "创建时间;创建时间")
+    private Date createTime;
+    /**更新人;更新人*/
+    @Schema(description = "更新人;更新人")
+    private String updateBy;
+    /**更新时间;更新时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "更新时间;更新时间")
+    private Date updateTime;
+    /**系统状态;状态(0-正常,1-冻结)*/
+    @Excel(name = "系统状态;状态(0-正常,1-冻结)", width = 15)
+    @Schema(description = "系统状态;状态(0-正常,1-冻结)")
+    private Integer status;
+    /**删除标志;删除状态(0-正常,1-已删除)*/
+    @Excel(name = "删除标志;删除状态(0-正常,1-已删除)", width = 15)
+    @Schema(description = "删除标志;删除状态(0-正常,1-已删除)")
+    @TableLogic
+    private Integer delFlag;
+}

+ 9 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppSiteRuleTimeMapper.java

@@ -0,0 +1,9 @@
+package org.jeecg.modules.system.app.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.jeecg.modules.system.app.entity.AppSiteRuleTime;
+
+@Mapper
+public interface AppSiteRuleTimeMapper extends BaseMapper<AppSiteRuleTime> {
+}

+ 3 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSitePriceRulesMapper.xml

@@ -96,8 +96,8 @@
         a.date_of_sale ASC
     </select>
 
-    <insert id="insertList">
-        INSERT INTO `nm_site_price_rules` (id,org_code,tenant_id,site_place_id,category_id,type,date_of_sale,start_time,end_time,day_of_week,original_price,selling_price,is_teaching,view_status,inventory,revision,create_by,create_time,update_by,update_time,status,del_flag)
+    <insert id="insertList" parameterType="java.util.List">
+        INSERT INTO `nm_site_price_rules` (id,org_code,tenant_id,site_place_id,category_id,type,date_of_sale,start_time,end_time,day_of_week,original_price,selling_price,is_teaching,view_status,inventory,site_rule_time_id,revision,create_by,create_time,update_by,update_time,status,del_flag)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.id},
@@ -115,6 +115,7 @@
             #{item.isTeaching},
             #{item.viewStatus},
             #{item.inventory},
+            #{item.siteRuleTimeId},
             #{item.revision},
             #{item.createBy},
             #{item.createTime},

+ 5 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSiteRuleTimeMapper.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.system.app.mapper.AppSiteRuleTimeMapper">
+
+</mapper>

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppCoursesPriceRulesService.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 public interface IAppCoursesPriceRulesService extends IService<AppCoursesPriceRules> {
 
-    List<AppCoursesRuleDTO> queryCoursesPriceRulesList(String courseId);
+    List<AppCoursesRuleDTO> queryCoursesPriceRulesList(String courseId,Integer coursesType);
 
     Boolean editWitchPriceRules(List<AppCoursesRuleDTO> dtoList);
 }

+ 12 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppSitePlaceService.java

@@ -3,8 +3,11 @@ package org.jeecg.modules.system.app.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.system.app.dto.*;
+import org.jeecg.modules.system.app.entity.AppSite;
 import org.jeecg.modules.system.app.entity.AppSitePlace;
 
+import java.util.List;
+
 /**
  * @Description: 商户场所表
  * @Author: jeecg-boot
@@ -84,16 +87,17 @@ public interface IAppSitePlaceService extends IService<AppSitePlace> {
 //体育馆包场
     /**
      *包场场所新增
-     * @param placeDTO
+     * @param appSitePlaceParkDTO
      * @return
      */
-    Boolean savePack(AppSitePlaceDTO placeDTO);
+//    Boolean savePack(AppSitePlaceDTO placeDTO);
+    Boolean savePack(AppSitePlaceParkDTO appSitePlaceParkDTO);
     /**
      * 包场场所修改
-     * @param placeDTO
+     * @param appSitePlaceParkDTO
      * @return
      */
-    Boolean editPack(AppSitePlaceDTO placeDTO);
+    Boolean editPack(AppSitePlaceParkDTO appSitePlaceParkDTO);
     /**
      * 通过id查询包场场所
      * @param id
@@ -110,4 +114,8 @@ public interface IAppSitePlaceService extends IService<AppSitePlace> {
     boolean addSchoolPlace(SchoolPlaceAddDTO schoolPlaceAddDTO);
 
     SchoolPlaceAddDTO querySchoolPlace(String tenantId);
+
+    AppSitePlaceParkDTO queryPack(String siteId);
+
+    List<AppSite> queryByDeptId(String deptId);
 }

+ 7 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppSiteRuleTimeService.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.system.app.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.system.app.entity.AppSiteRuleTime;
+
+public interface IAppSiteRuleTimeService extends IService<AppSiteRuleTime> {
+}

+ 8 - 21
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppCoursesPriceRulesServiceImpl.java

@@ -1,19 +1,17 @@
 package org.jeecg.modules.system.app.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.system.app.dto.AppCoursesRuleDTO;
-import org.jeecg.modules.system.app.dto.AppSiteRuleDTO;
 import org.jeecg.modules.system.app.entity.AppCourses;
 import org.jeecg.modules.system.app.entity.AppCoursesPriceRules;
-import org.jeecg.modules.system.app.entity.AppSitePriceRules;
 import org.jeecg.modules.system.app.mapper.AppCoursesMapper;
 import org.jeecg.modules.system.app.mapper.AppCoursesPriceRulesMapper;
 import org.jeecg.modules.system.app.service.IAppCoursesPriceRulesService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
@@ -33,12 +31,14 @@ public class AppCoursesPriceRulesServiceImpl extends ServiceImpl<AppCoursesPrice
     private AppCoursesMapper appCoursesMapper;
 
     @Override
-    public List<AppCoursesRuleDTO> queryCoursesPriceRulesList(String courseId) {
+    public List<AppCoursesRuleDTO> queryCoursesPriceRulesList(String courseId,Integer coursesType) {
         List<AppCoursesRuleDTO> ruleDTOS = new ArrayList<>();
-        baseMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId, courseId))
+        //查询补课类型的数据
+        baseMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId, courseId).eq(AppCoursesPriceRules::getCoursesType,coursesType))
                 .forEach(appCourses -> {
                     AppCoursesRuleDTO appCoursesRuleDTO = new AppCoursesRuleDTO();
                     BeanUtils.copyProperties(appCourses, appCoursesRuleDTO);
+                    ruleDTOS.add(appCoursesRuleDTO);
                 });
         return ruleDTOS;
     }
@@ -47,22 +47,7 @@ public class AppCoursesPriceRulesServiceImpl extends ServiceImpl<AppCoursesPrice
     @Transactional(rollbackFor = Exception.class)
     public Boolean editWitchPriceRules(List<AppCoursesRuleDTO> dtoList) {
         if (dtoList.isEmpty()) throw new JeecgBootException("课时列表不能为空");
-        Optional<Date> minStartTime = dtoList.stream()
-                .map(AppCoursesRuleDTO::getStartTime)
-                .filter(Objects::nonNull)
-                .min(Date::compareTo);
-
-        Optional<Date> maxEndTime = dtoList.stream()
-                .map(AppCoursesRuleDTO::getEndTime)
-                .filter(Objects::nonNull)
-                .max(Date::compareTo);
         AppCourses appCourses = appCoursesMapper.selectById(dtoList.get(0).getCoursesId());
-        appCourses.setStartTime(minStartTime.orElse(null));
-        appCourses.setEndTime(maxEndTime.orElse(null));
-        int saveCourseResult = appCoursesMapper.updateById(appCourses);
-        if (saveCourseResult < 1) {
-            throw new JeecgBootException("课程信息更新失败");
-        }
         List<AppCoursesPriceRules> priceRules = baseMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId, appCourses.getId()));
         //删除的
         List<AppCoursesPriceRules> deletePriceRules = priceRules.stream()
@@ -82,6 +67,8 @@ public class AppCoursesPriceRulesServiceImpl extends ServiceImpl<AppCoursesPrice
                 .map(dto -> {
                     AppCoursesPriceRules appCoursesPriceRules = new AppCoursesPriceRules();
                     BeanUtils.copyProperties(dto, appCoursesPriceRules);
+                    //标记为补课类型
+                    appCoursesPriceRules.setCoursesType(CommonConstant.STATUS_1_INT);
                     return appCoursesPriceRules;
                 })
                 .collect(Collectors.toList());

+ 512 - 106
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSitePlaceServiceImpl.java

@@ -47,6 +47,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
     private AppSiteMapper appSiteMapper;
     @Resource
     private AppCategoryMapper appCategoryMapper;
+    @Resource
+    private AppSiteRuleTimeMapper appSiteRuleTimeMapper;
 
     //学校 一对多
 
@@ -285,7 +287,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
         appSitePlace.setTenantId(site.getTenantId());
         int updateById = baseMapper.updateById(appSitePlace);
         if (updateById < 1) throw new JeecgBootException("无固定场编辑失败", SC_INTERNAL_SERVER_ERROR_500);
-       //查询无固定场价格表对应数据,查询对应数据修改
+        //查询无固定场价格表对应数据,查询对应数据修改
         List<AppSitePriceRules> appSitePriceRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, unsetDTO.getId()));
         String[] split = unsetDTO.getDownTime().split(",");
         List<String> downTimes = Arrays.stream(split).collect(Collectors.toList());
@@ -317,7 +319,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
         if (deleteById < 1) throw new JeecgBootException("无固定场删除失败", SC_INTERNAL_SERVER_ERROR_500);
         int deleteById1 = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, id));
         if (deleteById1 < 1) throw new JeecgBootException("固定场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
-        return null;
+        return Boolean.TRUE;
     }
 
     @Override
@@ -327,8 +329,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
         LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, SitePlaceTypeEnum.UNFIXED.getCode())
 //                .eq(AppSitePlace::getSiteId, dto.getSiteId())
                 .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode())
-                .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName())
-                ;
+                .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName());
 
         IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper);
         return resultPage.convert(record -> {
@@ -360,71 +361,139 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
     }
 
     //包场
+//    @Override
+//    @Transactional(rollbackFor = Exception.class)
+//    public Boolean savePack(AppSitePlaceDTO placeDTO) {
+//        AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
+//        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
+//        AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId,placeCuDTO.getSiteId()));
+
+    /// /        AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
+//        placeDTO.getSiteCategoryDOTS().forEach(item -> {
+//            AppCategory category = appCategoryMapper.selectById(item.getCategoryId());
+//            for (int i = 0; i < item.getCount(); i++) {
+//                AppSitePlace appSitePlace = new AppSitePlace();
+//                BeanUtils.copyProperties(placeCuDTO, appSitePlace);
+//                appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
+//                appSitePlace.setName(category.getName() + (i + 1));
+//                appSitePlace.setSiteId(site.getId());
+//                appSitePlace.setOrgCode(site.getOrgCode());
+//                appSitePlace.setTenantId(site.getTenantId());
+//                appSitePlace.setCategoryId(category.getId());
+//                int insert = baseMapper.insert(appSitePlace);
+//                if (insert < 1) throw new JeecgBootException("包场保存失败", SC_INTERNAL_SERVER_ERROR_500);
+//                siteRuleDTOS.stream().filter(rule -> rule.getCategoryId().equals(category.getId())).collect(Collectors.toList()).forEach(rule -> {
+//                    AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+//                    BeanUtils.copyProperties(rule, appSitePriceRules);
+//                    appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+//                    appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+//                    appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+//
+//                    String batchUUID = IdUtil.simpleUUID();
+//                    appSitePriceRules.setBatchuuid(batchUUID);
+//                    int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
+//                    if (savePriceResult < 1)
+//                        throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
+//            }
+//        });
+//        return Boolean.TRUE;
+//    }
+
+    //包场新增
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean savePack(AppSitePlaceDTO placeDTO) {
-        AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
-        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
-//        AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId,placeCuDTO.getSiteId()));
+    public Boolean savePack(AppSitePlaceParkDTO appSitePlaceParkDTO) {
+        AppSitePlaceCuDTO placeCuDTO = appSitePlaceParkDTO.getAppSitePlaceCuDTO();
+        List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = appSitePlaceParkDTO.getAppSiteCategoryRuleDTOS();
         AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
-        placeDTO.getSiteCategoryDOTS().forEach(item -> {
+        appSiteCategoryRuleDTOS.forEach(item -> {
             AppCategory category = appCategoryMapper.selectById(item.getCategoryId());
+
+            List<AppSiteRuleTimeFormDTO> appSiteRuleTimeFormDTOList = item.getAppSiteRuleTimeFormDTOList();
+            for (AppSiteRuleTimeFormDTO appSiteRuleTimeFormDTO : appSiteRuleTimeFormDTOList) {
+                AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
+                appSiteRuleTime.setSiteId(site.getId());
+                appSiteRuleTime.setCategoryId(category.getId());
+                appSiteRuleTime.setStartTime(appSiteRuleTimeFormDTO.getStartTime());
+                appSiteRuleTime.setEndTime(appSiteRuleTimeFormDTO.getEndTime());
+                appSiteRuleTimeMapper.insert(appSiteRuleTime);
+                List<AppSiteRuleDTO> appSiteRuleDTOList = appSiteRuleTimeFormDTO.getAppSiteRuleDTOList();
+                for (AppSiteRuleDTO appSiteRuleDTO : appSiteRuleDTOList) {
+                    appSiteRuleDTO.setSiteRuleTimeId(appSiteRuleTime.getId());
+                }
+            }
+
             for (int i = 0; i < item.getCount(); i++) {
                 AppSitePlace appSitePlace = new AppSitePlace();
                 BeanUtils.copyProperties(placeCuDTO, appSitePlace);
                 appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
                 appSitePlace.setName(category.getName() + (i + 1));
+                appSitePlace.setSiteId(site.getId());
                 appSitePlace.setOrgCode(site.getOrgCode());
                 appSitePlace.setTenantId(site.getTenantId());
+                appSitePlace.setCategoryId(category.getId());
+                appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
                 int insert = baseMapper.insert(appSitePlace);
                 if (insert < 1) throw new JeecgBootException("包场保存失败", SC_INTERNAL_SERVER_ERROR_500);
-                siteRuleDTOS.stream().filter(rule -> rule.getCategoryId().equals(category.getId())).collect(Collectors.toList()).forEach(rule -> {
-                    AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
-                    BeanUtils.copyProperties(rule, appSitePriceRules);
-                    appSitePriceRules.setSitePlaceId(appSitePlace.getId());
-                    appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
-                    appSitePriceRules.setTenantId(appSitePlace.getTenantId());
-                    int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
-                    if (savePriceResult < 1)
-                        throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
+
+                List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
+
+                item.getAppSiteRuleTimeFormDTOList().forEach(formDTO -> {
+                    formDTO.getAppSiteRuleDTOList().forEach(ruleDTO -> {
+                        System.out.println();
+                        AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                        BeanUtils.copyProperties(formDTO, appSitePriceRules);
+                        appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+                        appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+                        appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+                        appSitePriceRules.setCategoryId(category.getId());
+                        appSitePriceRules.setDayOfWeek(ruleDTO.getDayOfWeek());
+                        appSitePriceRules.setSellingPrice(ruleDTO.getSellingPrice());
+                        appSitePriceRules.setType(appSitePlace.getType());
+                        appSitePriceRules.setSiteRuleTimeId(ruleDTO.getSiteRuleTimeId());
+                        appSitePriceRules.setStatus(CommonConstant.STATUS_0_INT);
+                        appSitePriceRules.setDelFlag(CommonConstant.STATUS_0_INT);
+                        appSitePriceRulesList.add(appSitePriceRules);
+                    });
+                });
+                appSitePriceRulesList.forEach(appSitePriceRule -> {
+                    System.out.println(appSitePriceRule.toString());
                 });
+                appSitePriceRulesMapper.insertList(appSitePriceRulesList);
             }
-
         });
+
         return Boolean.TRUE;
     }
 
     @Override
-    public Boolean editPack(AppSitePlaceDTO placeDTO) {
-        AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
-        List<AppSiteCategoryDOT> siteCategoryDOTS = placeDTO.getSiteCategoryDOTS();
-        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
-
-        // 按 categoryId 分组价格规则
-        Map<String, List<AppSiteRuleDTO>> ruleMap = siteRuleDTOS.stream()
-                .collect(Collectors.groupingBy(AppSiteRuleDTO::getCategoryId));
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean editPack(AppSitePlaceParkDTO appSitePlaceParkDTO) {
+        AppSitePlaceCuDTO placeCuDTO = appSitePlaceParkDTO.getAppSitePlaceCuDTO();
+        List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = appSitePlaceParkDTO.getAppSiteCategoryRuleDTOS();
 
         AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
         if (site == null) {
             throw new JeecgBootException("商户门店不存在", SC_INTERNAL_SERVER_ERROR_500);
         }
-
         // 查询当前场地的所有包场场所
         List<AppSitePlace> existingPlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
                 .eq(AppSitePlace::getSiteId, site.getId())
                 .eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
-
         if (existingPlaces.isEmpty()) {
-            throw new JeecgBootException("包场数据不存在", SC_INTERNAL_SERVER_ERROR_500);
+            //无须对比直接做新增
+            return savePack(appSitePlaceParkDTO);
         }
 
         // 用于存储需要保留的场地ID
         List<String> updatedPlaceIds = new ArrayList<>();
 
-        // 更新或新增场地
-        for (AppSiteCategoryDOT item : siteCategoryDOTS) {
-            String categoryId = item.getCategoryId();
-            int count = item.getCount();
+        //对比修改
+        for (AppSiteCategoryRuleDTO appSiteCategoryRuleDTO : appSiteCategoryRuleDTOS) {
+            String categoryId = appSiteCategoryRuleDTO.getCategoryId();
+            Integer count = appSiteCategoryRuleDTO.getCount();
+
             // 查询该分类已有的场地
             List<AppSitePlace> categoryPlaces = existingPlaces.stream()
                     .filter(p -> p.getCategoryId() != null && p.getCategoryId().equals(categoryId))
@@ -452,6 +521,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                     appSitePlace.setCategoryId(categoryId);
                 }
 
+                updatedPlaceIds.add(appSitePlace.getId());
+
                 // 设置场地名称
                 appSitePlace.setName(category.getName() + (i + 1));
                 // 保存或更新场地
@@ -466,76 +537,148 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                         throw new JeecgBootException("包场场地更新失败", SC_INTERNAL_SERVER_ERROR_500);
                     }
                 }
-                //传回的当前场地的包场价格规则
-                List<AppSiteRuleDTO> rules = ruleMap.getOrDefault(categoryId, Collections.emptyList());
-                // 当前场地 更新价格规则
-                List<AppSitePriceRules> priceRules = rules.stream()
-                        .map(rule -> {
-                            AppSitePriceRules priceRule = new AppSitePriceRules();
-                            BeanUtils.copyProperties(rule, priceRule);
-                            priceRule.setSitePlaceId(appSitePlace.getId());
-                            priceRule.setOrgCode(site.getOrgCode());
-                            priceRule.setTenantId(site.getTenantId());
-                            return priceRule;
-                        })
-                        .collect(Collectors.toList());
-
-                // 获取数据库中已有的价格规则
-                List<AppSitePriceRules> dbRules = appSitePriceRulesMapper.selectList(
-                        Wrappers.<AppSitePriceRules>lambdaQuery()
-                                .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
-                );
-
-                // 构建新旧规则的映射(以 startTime + endTime 作为唯一标识)
-                Map<String, AppSitePriceRules> dbRuleMap = dbRules.stream()
-                        .collect(Collectors.toMap(
-                                rule -> rule.getStartTime() + "-" + rule.getEndTime(),
-                                rule -> rule));
-
-                Map<String, AppSitePriceRules> newRuleMap = priceRules.stream()
-                        .collect(Collectors.toMap(
-                                rule -> rule.getStartTime() + "-" + rule.getEndTime(),
-                                rule -> rule));
-
-                // 找出要删除的旧规则(存在于db,不存在于new)
-                List<AppSitePriceRules> toDelete = dbRules.stream()
-                        .filter(rule -> !newRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
-                        .collect(Collectors.toList());
-
-                // 找出要新增的规则(存在于new,不存在于db)
-                List<AppSitePriceRules> toAdd = priceRules.stream()
-                        .filter(rule -> !dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
-                        .collect(Collectors.toList());
-
-                // 找出需要更新的规则(存在交集且内容不同)
-                List<AppSitePriceRules> toUpdate = priceRules.stream()
-                        .filter(rule -> dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
-                        .filter(rule -> {
-                            AppSitePriceRules dbRule = dbRuleMap.get(rule.getStartTime() + "-" + rule.getEndTime());
-                            return !rule.equals(dbRule); // 自定义 equals 或手动比较字段
-                        })
-                        .collect(Collectors.toList());
-
-                // 执行操作
-                toDelete.forEach(rule -> {
-                    int deleteResult = appSitePriceRulesMapper.deleteById(rule.getId());
-                    if (deleteResult < 1)
-                        throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
-                });
 
-                toAdd.forEach(rule -> {
-                    int insertResult = appSitePriceRulesMapper.insert(rule);
-                    if (insertResult < 1)
-                        throw new JeecgBootException("包场价格规则新增失败", SC_INTERNAL_SERVER_ERROR_500);
+                //定义存在于表单的数据
+                List<String> appSiteRuleTimeIds = new ArrayList<>();
+
+                //新增或修改
+                appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().forEach(appSiteRuleTimeFormDTO -> {
+
+                    //新增
+                    if (ObjectUtils.isEmpty(appSiteRuleTimeFormDTO.getId())) {
+                        AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
+                        appSiteRuleTime.setSiteId(site.getId());
+                        appSiteRuleTime.setCategoryId(category.getId());
+                        appSiteRuleTime.setStartTime(appSiteRuleTimeFormDTO.getStartTime());
+                        appSiteRuleTime.setEndTime(appSiteRuleTimeFormDTO.getEndTime());
+                        appSiteRuleTimeMapper.insert(appSiteRuleTime);
+
+                        appSiteRuleTimeFormDTO.getAppSiteRuleDTOList().forEach(rule -> {
+                            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                            BeanUtils.copyProperties(rule, appSitePriceRules);
+                            appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+                            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+                            appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+                            appSitePriceRules.setSiteRuleTimeId(appSiteRuleTime.getId());
+                            int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
+                            if (savePriceResult < 1)
+                                throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
+                        });
+                    }else {
+                        appSiteRuleTimeIds.add(appSiteRuleTimeFormDTO.getId());
+                        //修改
+                        AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
+                        appSiteRuleTime.setSiteId(site.getId());
+//                        appSiteRuleTime.setSitePlaceId(appSitePlace.getId());
+                        appSiteRuleTime.setCategoryId(category.getId());
+                        appSiteRuleTime.setStartTime(appSiteRuleTimeFormDTO.getStartTime());
+                        appSiteRuleTime.setEndTime(appSiteRuleTimeFormDTO.getEndTime());
+                        appSiteRuleTimeMapper.updateById(appSiteRuleTime);
+                        appSiteRuleTimeFormDTO.getAppSiteRuleDTOList().forEach(rule -> {
+                            AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+                            BeanUtils.copyProperties(rule, appSitePriceRules);
+                            appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+                            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+                            appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+                            appSitePriceRules.setSiteRuleTimeId(appSiteRuleTime.getId());
+
+                            int updateResult = appSitePriceRulesMapper.updateById(appSitePriceRules);
+                            if (updateResult < 1)
+                                throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
+                        });
+                    }
                 });
 
-                toUpdate.forEach(rule -> {
-                    int updateResult = appSitePriceRulesMapper.updateById(rule);
-                    if (updateResult < 1)
-                        throw new JeecgBootException("包场价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500);
-                });
+                //删除
+                //查询本地所有的siteRuleTime
+                List<AppSiteRuleTime> appSiteRuleTimeList = appSiteRuleTimeMapper.selectList(Wrappers.<AppSiteRuleTime>lambdaQuery()
+                       // .eq(AppSiteRuleTime::getSitePlaceId, appSitePlace.getId())
+                        .eq(AppSiteRuleTime::getCategoryId, categoryId)
+                );
+                if(ObjectUtils.isEmpty(appSiteRuleTimeList)){
+                    List<String> localIds = appSiteRuleTimeList.stream().map(AppSiteRuleTime::getId).collect(Collectors.toList());
+                    // 找出要删除的旧规则(存在于db,不存在于new)
+                    List<String> toDelete = getDifferListByMap(localIds, appSiteRuleTimeIds);
 
-                updatedPlaceIds.add(appSitePlace.getId());
+                    toDelete.forEach(id -> {
+                        appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSiteRuleTimeId, id));
+                    });
+                    appSiteRuleTimeMapper.deleteBatchIds(toDelete);
+                }
+//                //当前场地的包场价格规则
+//                List<AppSiteRuleDTO> rules = appSiteCategoryRuleDTO.getAppSiteRuleDTOList();//表单数据
+//                // 当前场地 更新价格规则
+//                List<AppSitePriceRules> priceRules = rules.stream()
+//                        .map(rule -> {
+//                            AppSitePriceRules priceRule = new AppSitePriceRules();
+//                            BeanUtils.copyProperties(rule, priceRule);
+//                            priceRule.setSitePlaceId(appSitePlace.getId());
+//                            priceRule.setOrgCode(site.getOrgCode());
+//                            priceRule.setTenantId(site.getTenantId());
+//                            return priceRule;
+//                        })
+//                        .collect(Collectors.toList());//表单数据
+//
+//                // 获取数据库中已有的价格规则
+//                List<AppSitePriceRules> dbRules = appSitePriceRulesMapper.selectList(
+//                        Wrappers.<AppSitePriceRules>lambdaQuery()
+//                                .eq(AppSitePriceRules::getCategoryId, categoryId)
+//                                .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
+//                );//本地数据,当前的场地的规则数据
+//
+//                // 找出要新增的规则(存在于new,不存在于db)
+//                List<AppSitePriceRules> toAdd = priceRules.stream()
+//                        .filter(rule -> rule.getId() == null)
+//                        .collect(Collectors.toList());
+//                toAdd.forEach(rule -> {
+//                    int insertResult = appSitePriceRulesMapper.insert(rule);
+//                    if (insertResult < 1)
+//                        throw new JeecgBootException("包场价格规则新增失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
+//
+//                // 找出需要更新的规则(存在ID的数据)
+//                List<AppSitePriceRules> toUpdate = priceRules.stream()
+//                        .filter(rule -> rule.getId() != null)
+//                        .collect(Collectors.toList());
+//
+//                //切换成当前场地的数据
+//                for (AppSitePriceRules appSitePriceRules : toUpdate) {
+//                    AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery()
+//                            .eq(AppSitePriceRules::getCategoryId, categoryId)
+//                            .eq(AppSitePriceRules::getBatchuuid, appSitePriceRules.getBatchuuid())
+//                            .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId()));
+//                    appSitePriceRules.setId(sitePriceRules.getId());
+//                }
+//
+//                toUpdate.forEach(rule -> {
+//                    int updateResult = appSitePriceRulesMapper.updateById(rule);
+//                    if (updateResult < 1)
+//                        throw new JeecgBootException("包场价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
+
+                //过滤掉新增数据
+//                List<String> filterIds = rules.stream().map(AppSiteRuleDTO::getId).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
+//                List<String> localIds = dbRules.stream().map(AppSitePriceRules::getId).collect(Collectors.toList());
+//                // 找出要删除的旧规则(存在于db,不存在于new)
+//                List<String> toDelete = getDifferListByMap(localIds, filterIds);
+//
+//                List<AppSitePriceRules> toDeleteList = dbRules.stream().filter(rule -> toDelete.contains(rule.getId())).collect(Collectors.toList());
+//
+//                //切换成当前场地的数据
+//                for (AppSitePriceRules appSitePriceRules : toDeleteList) {
+//                    AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery()
+//                            .eq(AppSitePriceRules::getCategoryId, categoryId)
+//                            .eq(AppSitePriceRules::getBatchuuid, appSitePriceRules.getBatchuuid())
+//                            .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId()));
+//                    appSitePriceRules.setId(sitePriceRules.getId());
+//                }
+//
+//                // 执行操作
+//                toDeleteList.forEach(rule -> {
+//                    int deleteResult = appSitePriceRulesMapper.deleteById(rule);
+//                    if (deleteResult < 1)
+//                        throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
             }
         }
 
@@ -546,7 +689,10 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                 if (deleteResult < 1) {
                     throw new JeecgBootException("包场场地删除失败", SC_INTERNAL_SERVER_ERROR_500);
                 }
-
+                // 删除对应的时间规则
+                appSiteRuleTimeMapper.deleteById(Wrappers.<AppSiteRuleTime>lambdaQuery()
+//                        .eq(AppSiteRuleTime::getSitePlaceId, existingPlace.getId())
+                       );
                 // 删除对应的价格规则
                 int delete = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery()
                         .eq(AppSitePriceRules::getSitePlaceId, existingPlace.getId()));
@@ -555,10 +701,195 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                 }
             }
         }
-
         return Boolean.TRUE;
     }
 
+    public static List<String> getDifferListByMap(List<String> listA, List<String> listB) {
+        List<String> differList = new ArrayList<>();
+        Map<String, Integer> map = new HashMap<>();
+        for (String strA : listA) {
+            map.put(strA, 1);
+        }
+        for (String strB : listB) {
+            Integer value = map.get(strB);
+            if (value != null) {
+                map.put(strB, ++value);
+                continue;
+            }
+            map.put(strB, 1);
+        }
+        for (Map.Entry<String, Integer> entry : map.entrySet()) {
+            if (entry.getValue() == 1) {
+                differList.add(entry.getKey());
+            }
+        }
+        return differList;
+    }
+
+//    @Override
+//    public Boolean editPack(AppSitePlaceDTO placeDTO) {
+//        AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
+//        List<AppSiteCategoryDOT> siteCategoryDOTS = placeDTO.getSiteCategoryDOTS();
+//        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
+//
+//        // 按 categoryId 分组价格规则
+//        Map<String, List<AppSiteRuleDTO>> ruleMap = siteRuleDTOS.stream()
+//                .collect(Collectors.groupingBy(AppSiteRuleDTO::getCategoryId));
+//
+//        AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
+//        if (site == null) {
+//            throw new JeecgBootException("商户门店不存在", SC_INTERNAL_SERVER_ERROR_500);
+//        }
+//
+//        // 查询当前场地的所有包场场所
+//        List<AppSitePlace> existingPlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+//                .eq(AppSitePlace::getSiteId, site.getId())
+//                .eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
+//
+//        if (existingPlaces.isEmpty()) {
+//            throw new JeecgBootException("包场数据不存在", SC_INTERNAL_SERVER_ERROR_500);
+//        }
+//
+//        // 用于存储需要保留的场地ID
+//        List<String> updatedPlaceIds = new ArrayList<>();
+//
+//        // 更新或新增场地
+//        for (AppSiteCategoryDOT item : siteCategoryDOTS) {
+//            String categoryId = item.getCategoryId();
+//            int count = item.getCount();
+//            // 查询该分类已有的场地
+//            List<AppSitePlace> categoryPlaces = existingPlaces.stream()
+//                    .filter(p -> p.getCategoryId() != null && p.getCategoryId().equals(categoryId))
+//                    .sorted(Comparator.comparing(AppSitePlace::getName)) // 按名称排序以确保顺序一致
+//                    .collect(Collectors.toList());
+//
+//            AppCategory category = appCategoryMapper.selectById(categoryId);
+//            if (category == null) {
+//                throw new JeecgBootException("分类不存在", SC_INTERNAL_SERVER_ERROR_500);
+//            }
+//
+//            // 扩展或裁剪场地数量
+//            for (int i = 0; i < count; i++) {
+//                AppSitePlace appSitePlace;
+//                if (i < categoryPlaces.size()) {
+//                    // 更新现有场地
+//                    appSitePlace = categoryPlaces.get(i);
+//                } else {
+//                    // 创建新场地
+//                    appSitePlace = new AppSitePlace();
+//                    BeanUtils.copyProperties(placeCuDTO, appSitePlace);
+//                    appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
+//                    appSitePlace.setOrgCode(site.getOrgCode());
+//                    appSitePlace.setTenantId(site.getTenantId());
+//                    appSitePlace.setCategoryId(categoryId);
+//                }
+//
+//                // 设置场地名称
+//                appSitePlace.setName(category.getName() + (i + 1));
+//                // 保存或更新场地
+//                if (appSitePlace.getId() == null) {
+//                    int insertResult = baseMapper.insert(appSitePlace);
+//                    if (insertResult < 1) {
+//                        throw new JeecgBootException("包场场地创建失败", SC_INTERNAL_SERVER_ERROR_500);
+//                    }
+//                } else {
+//                    int updateResult = baseMapper.updateById(appSitePlace);
+//                    if (updateResult < 1) {
+//                        throw new JeecgBootException("包场场地更新失败", SC_INTERNAL_SERVER_ERROR_500);
+//                    }
+//                }
+//                //传回的当前场地的包场价格规则
+//                List<AppSiteRuleDTO> rules = ruleMap.getOrDefault(categoryId, Collections.emptyList());
+//                // 当前场地 更新价格规则
+//                List<AppSitePriceRules> priceRules = rules.stream()
+//                        .map(rule -> {
+//                            AppSitePriceRules priceRule = new AppSitePriceRules();
+//                            BeanUtils.copyProperties(rule, priceRule);
+//                            priceRule.setSitePlaceId(appSitePlace.getId());
+//                            priceRule.setOrgCode(site.getOrgCode());
+//                            priceRule.setTenantId(site.getTenantId());
+//                            return priceRule;
+//                        })
+//                        .collect(Collectors.toList());
+//
+//                // 获取数据库中已有的价格规则
+//                List<AppSitePriceRules> dbRules = appSitePriceRulesMapper.selectList(
+//                        Wrappers.<AppSitePriceRules>lambdaQuery()
+//                                .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
+//                );
+//
+//                // 构建新旧规则的映射(以 startTime + endTime 作为唯一标识)
+//                Map<String, AppSitePriceRules> dbRuleMap = dbRules.stream()
+//                        .collect(Collectors.toMap(
+//                                rule -> rule.getStartTime() + "-" + rule.getEndTime(),
+//                                rule -> rule));
+//
+//                Map<String, AppSitePriceRules> newRuleMap = priceRules.stream()
+//                        .collect(Collectors.toMap(
+//                                rule -> rule.getStartTime() + "-" + rule.getEndTime(),
+//                                rule -> rule));
+//
+//                // 找出要删除的旧规则(存在于db,不存在于new)
+//                List<AppSitePriceRules> toDelete = dbRules.stream()
+//                        .filter(rule -> !newRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
+//                        .collect(Collectors.toList());
+//
+//                // 找出要新增的规则(存在于new,不存在于db)
+//                List<AppSitePriceRules> toAdd = priceRules.stream()
+//                        .filter(rule -> !dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
+//                        .collect(Collectors.toList());
+//
+//                // 找出需要更新的规则(存在交集且内容不同)
+//                List<AppSitePriceRules> toUpdate = priceRules.stream()
+//                        .filter(rule -> dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
+//                        .filter(rule -> {
+//                            AppSitePriceRules dbRule = dbRuleMap.get(rule.getStartTime() + "-" + rule.getEndTime());
+//                            return !rule.equals(dbRule); // 自定义 equals 或手动比较字段
+//                        })
+//                        .collect(Collectors.toList());
+//
+//                // 执行操作
+//                toDelete.forEach(rule -> {
+//                    int deleteResult = appSitePriceRulesMapper.deleteById(rule.getId());
+//                    if (deleteResult < 1)
+//                        throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
+//
+//                toAdd.forEach(rule -> {
+//                    int insertResult = appSitePriceRulesMapper.insert(rule);
+//                    if (insertResult < 1)
+//                        throw new JeecgBootException("包场价格规则新增失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
+//
+//                toUpdate.forEach(rule -> {
+//                    int updateResult = appSitePriceRulesMapper.updateById(rule);
+//                    if (updateResult < 1)
+//                        throw new JeecgBootException("包场价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500);
+//                });
+//
+//                updatedPlaceIds.add(appSitePlace.getId());
+//            }
+//        }
+//
+//        // 删除不再需要的场地
+//        for (AppSitePlace existingPlace : existingPlaces) {
+//            if (!updatedPlaceIds.contains(existingPlace.getId())) {
+//                int deleteResult = baseMapper.deleteById(existingPlace.getId());
+//                if (deleteResult < 1) {
+//                    throw new JeecgBootException("包场场地删除失败", SC_INTERNAL_SERVER_ERROR_500);
+//                }
+//
+//                // 删除对应的价格规则
+//                int delete = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery()
+//                        .eq(AppSitePriceRules::getSitePlaceId, existingPlace.getId()));
+//                if (delete < 1) {
+//                    throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
+//                }
+//            }
+//        }
+//        return Boolean.TRUE;
+//    }
+
     @Override
     public AppSitePlaceDTO queryPackById(String id) {
         AppSitePlace dbPlace = baseMapper.selectById(id);
@@ -618,7 +949,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
 
             int year = DateUtils.getYear();
 
-            Map<String, List<String>> HolidayMap = HolidayUtil.getYearHoliday(String.valueOf(year));
+//            Map<String, List<String>> HolidayMap = HolidayUtil.getYearHoliday(String.valueOf(year));
 
             //当前日期
             Date currDate = DateUtils.str2Date(DateUtils.now(), new SimpleDateFormat("yyyy-MM-dd"));
@@ -700,7 +1031,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                 }
             }
             //存放开放时段列表(删除再新增)
-            appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().gt(AppSitePriceRules::getDateOfSale,currDate).eq(AppSitePriceRules::getTenantId, site.getTenantId()));
+            appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().gt(AppSitePriceRules::getDateOfSale, currDate).eq(AppSitePriceRules::getTenantId, site.getTenantId()));
             appSitePriceRulesMapper.insertList(appSitePriceRulesList);
 
             appSiteMapper.updateById(site);
@@ -715,13 +1046,16 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public SchoolPlaceAddDTO querySchoolPlace(String orgCode) {
 
         SchoolPlaceAddDTO schoolPlaceAddDTO = new SchoolPlaceAddDTO();
 
         AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, orgCode));
 
-        if (ObjectUtils.isEmpty(site)) {return null;}
+        if (ObjectUtils.isEmpty(site)) {
+            return null;
+        }
 
         AppSitePlace appSitePlace = this.baseMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getOrgCode, orgCode));
 
@@ -742,13 +1076,85 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
                     .setReminder(appSitePlace.getReminder());
         }
 
-        if ("admin".equals(loginUser.getRoleCode())){
+        if ("admin".equals(loginUser.getRoleCode())) {
             schoolPlaceAddDTO.setHavePermission(Boolean.TRUE);
         }
 
         return schoolPlaceAddDTO;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public AppSitePlaceParkDTO queryPack(String siteId) {
+        AppSitePlaceParkDTO appSitePlaceParkDTO = new AppSitePlaceParkDTO();
+        AppSite site = appSiteMapper.selectById(siteId);
+        List<AppSitePlace> appSitePlaceList = this.baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+                .eq(AppSitePlace::getSiteId, site.getId()));
+        if (ObjectUtils.isNotEmpty(appSitePlaceList)) {
+            List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = new ArrayList<>();
+            if (CollUtil.isNotEmpty(appSitePlaceList)) {
+                AppSitePlace appSitePlace = appSitePlaceList.get(0);
+                AppSitePlaceCuDTO placeCuDTO = new AppSitePlaceCuDTO();
+                BeanUtils.copyProperties(appSitePlace, placeCuDTO);
+                appSitePlaceParkDTO.setAppSitePlaceCuDTO(placeCuDTO);
+
+                Map<String, List<AppSitePlace>> map = appSitePlaceList.stream().collect(Collectors.groupingBy(AppSitePlace::getCategoryId));
+                for (String key : map.keySet()) {
+                    List<AppSitePlace> placeList = map.get(key);
+                    AppSiteCategoryRuleDTO appSiteCategoryRuleDTO = new AppSiteCategoryRuleDTO();
+                    appSiteCategoryRuleDTO.setCategoryId(key);
+                    appSiteCategoryRuleDTO.setCount(placeList.size());
+                    //查询当前场地的规则时间列表
+                    List<AppSiteRuleTime> appSiteRuleTimeList = appSiteRuleTimeMapper.selectList(Wrappers.<AppSiteRuleTime>lambdaQuery()
+                            .eq(AppSiteRuleTime::getSiteId, site.getId())
+                            .eq(AppSiteRuleTime::getCategoryId,key)
+                    );
+                    List<AppSiteRuleTimeFormDTO> formDTOList = new ArrayList<>();
+                    if (ObjectUtils.isNotEmpty(appSiteRuleTimeList)) {
+                        for (AppSiteRuleTime appSiteRuleTime : appSiteRuleTimeList) {
+                            System.out.println("appsiteTimede id======================="+appSiteRuleTime.getId());
+                            AppSiteRuleTimeFormDTO appSiteRuleTimeFormDTO = new AppSiteRuleTimeFormDTO();
+
+                            appSiteRuleTimeFormDTO.setId(appSiteRuleTime.getId());
+                            appSiteRuleTimeFormDTO.setStartTime(appSiteRuleTime.getStartTime());
+                            appSiteRuleTimeFormDTO.setEndTime(appSiteRuleTime.getEndTime());
+
+                            List<AppSiteRuleDTO>  appSiteRuleDTOS = new ArrayList<>();
+
+                            //todo 去除重的,根据星期,只取一条
+                            List<AppSitePriceRules> appSitePriceRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery()
+                                    .eq(AppSitePriceRules::getSiteRuleTimeId, appSiteRuleTime.getId())
+//                                    .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
+                            );
+                            System.out.println("appSitePriceRulesList的数量为++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+appSitePriceRulesList.size());
+                            if (ObjectUtils.isNotEmpty(appSitePriceRulesList)) {
+                                for (AppSitePriceRules appSitePriceRules : appSitePriceRulesList) {
+                                    AppSiteRuleDTO appSiteRuleDTO = new AppSiteRuleDTO();
+                                    BeanUtils.copyProperties(appSitePriceRules, appSiteRuleDTO);
+                                    appSiteRuleDTOS.add(appSiteRuleDTO);
+                                }
+                                appSiteRuleTimeFormDTO.setAppSiteRuleDTOList(appSiteRuleDTOS);
+                            }
+                            appSiteRuleTimeFormDTO.setAppSiteRuleDTOList(appSiteRuleDTOS);
+                            formDTOList.add(appSiteRuleTimeFormDTO);
+                        }
+                        System.out.println("数量为+++++++++++++++++++++++++++++++"+formDTOList.size());
+                        appSiteCategoryRuleDTO.setAppSiteRuleTimeFormDTOList(formDTOList);
+                    }
+                    appSiteCategoryRuleDTOS.add(appSiteCategoryRuleDTO);
+                }
+                appSitePlaceParkDTO.setAppSiteCategoryRuleDTOS(appSiteCategoryRuleDTOS);
+            }
+            return appSitePlaceParkDTO;
+        }
+       return null;
+    }
+
+    @Override
+    public List<AppSite> queryByDeptId(String deptId) {
+        return appSiteMapper.selectList(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId, deptId));
+    }
+
     /**
      * 权限校验
      *

+ 11 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppSiteRuleTimeServiceImpl.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.system.app.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.system.app.entity.AppSiteRuleTime;
+import org.jeecg.modules.system.app.mapper.AppSiteRuleTimeMapper;
+import org.jeecg.modules.system.app.service.IAppSiteRuleTimeService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AppSiteRuleTimeServiceImpl extends ServiceImpl<AppSiteRuleTimeMapper, AppSiteRuleTime> implements IAppSiteRuleTimeService {
+}

+ 3 - 0
national-motion-module-system/national-motion-system-start/src/main/resources/application-dev.yml

@@ -175,6 +175,9 @@ mybatis-plus:
       id-type: ASSIGN_ID
       # 默认数据库表下划线命名
       table-underline: true
+      logic-delete-field: delFlag # 逻辑删除字段名
+      logic-delete-value: 1 # 已删除值
+      logic-not-delete-value: 0 # 未删除值
   configuration:
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl