浏览代码

feat(system): 新增无固定场功能

- 新增无固定场相关的数据结构和接口
- 实现无固定场的添加、编辑、删除和查询功能
-优化原有场所查询接口,支持按类型筛选
lix 2 周之前
父节点
当前提交
6915308ca7

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

@@ -62,11 +62,23 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
 	 * @return
 	 */
 	//@AutoLog(value = "商户场所表-分页列表查询")
-	@Operation(summary="商户场所-分页列表查询")
+	@Operation(summary="商户场所学校、体育馆包场-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<IPage<AppSitePlaceCuDTO>> queryPageList(AppSitePlacePageDTO appSitePlace) {
 		return Result.OK(appSitePlaceService.queryWitchPriceRulesPage(appSitePlace));
 	}
+	/**
+	 * 分页列表查询
+	 *
+	 * @param appSitePlace
+	 * @return
+	 */
+	//@AutoLog(value = "商户场所表-分页列表查询")
+	@Operation(summary="商户场所无固定场-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<AppSitePlaceCuDTO>> queryUnfixePageList(AppSitePlacePageDTO appSitePlace) {
+		return Result.OK(appSitePlaceService.queryWitchPriceRulesPage(appSitePlace));
+	}
 	
 	/**
 	 *   添加
@@ -74,8 +86,8 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
 	 * @param appSitePlace
 	 * @return
 	 */
-	@AutoLog(value = "商户场所-添加")
-	@Operation(summary="商户场所-添加")
+	@AutoLog(value = "商户场所学校、体育馆包场-添加")
+	@Operation(summary="商户场所学校、体育馆包场-添加")
 //	@RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:add")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody AppSitePlaceDTO appSitePlace) {
@@ -89,8 +101,8 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
 	 * @param appSitePlace
 	 * @return
 	 */
-	@AutoLog(value = "商户场所-编辑")
-	@Operation(summary="商户场所-编辑")
+	@AutoLog(value = "商户场所学校、体育馆包场-编辑")
+	@Operation(summary="商户场所学校、体育馆包场-编辑")
 //	@RequiresPermissions("org.jeecg.modules.system.app:nm_site_place:edit")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
 	public Result<String> edit(@RequestBody AppSitePlaceDTO appSitePlace) {
@@ -104,8 +116,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 = "/delete")
 	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
@@ -135,7 +147,7 @@ public class AppSitePlaceController extends JeecgController<AppSitePlace, IAppSi
 	 * @return
 	 */
 	//@AutoLog(value = "商户场所表-通过id查询")
-	@Operation(summary="商户场所-通过id查询")
+	@Operation(summary="商户场所学校、体育馆包场-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<AppSitePlaceDTO> queryById(@RequestParam(name="id",required=true) String id) {
 		return Result.OK(appSitePlaceService.queryWitchPriceRulesById( id));

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

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 /**
  * @author DM
@@ -30,4 +31,9 @@ public class AppGameRuleDTO {
     /**售价*/
     @Schema(description = "售价")
     private String sellingPrice;
+    @Schema(description = "人数")
+    private Integer peopleNum;
+    /**比赛类型;0个人1团队*/
+    @Schema(description = "比赛类型;0个人1团队")
+    private Integer type;
 }

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

@@ -19,6 +19,10 @@ import lombok.experimental.Accessors;
 @NoArgsConstructor
 @Schema(description="场所分页入参自定义DTO")
 public class AppSitePlacePageDTO extends BasePageDTO{
+    @Schema(description = "商户门店id")
+    private String siteId ;
     @Schema(description = "名称")
     private String name;
+    @Schema(description = "类型0学校 1体育馆")
+    private Integer type;
 }

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

@@ -0,0 +1,78 @@
+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 org.jeecgframework.poi.excel.annotation.Excel;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+/**
+ * @author DM
+ * @date 2025/7/10 09:32
+ * @description
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description = "无固定场入参DTO")
+public class AppSitePlaceUnfixedDTO {
+    @Schema(description = "id")
+    private String id;
+    /**部门id*/
+    @Excel(name = "部门id", width = 15)
+    @Schema(description = "部门id")
+    private String tenantId;
+    /**部门编码*/
+    @Excel(name = "部门编码", width = 15)
+    @Schema(description = "部门编码")
+    private String orgCode;
+    /**商户补充信息id*/
+    @Excel(name = "商户补充信息id", width = 15)
+    @Schema(description = "商户补充信息id")
+    private String siteId;
+    /**名称*/
+    @Excel(name = "名称", width = 15)
+    @Schema(description = "名称")
+    private String name;
+    /**封面*/
+    @Excel(name = "封面", width = 15)
+    @Schema(description = "封面")
+    private String cover;
+    /**退款类型;0可退/到期自动退 1限时退 2不可退*/
+    @Excel(name = "退款类型;0可退/到期自动退 1限时退 2不可退", width = 15)
+    @Schema(description = "退款类型;0可退/到期自动退 1限时退 2不可退")
+    private Integer refundType;
+    /**适用人数*/
+    @Excel(name = "适用人数", width = 15)
+    @Schema(description = "适用人数")
+    private Integer usableCount;
+    /**提示/须知*/
+    @Excel(name = "提示/须知", width = 15)
+    @Schema(description = "提示/须知")
+    private String reminder;
+    /**不可用日期;多个逗号分割*/
+    @Excel(name = "不可用日期;多个逗号分割", width = 15)
+    @Schema(description = "不可用日期;多个逗号分割")
+    private String downTime;
+    /**提前预约时间:0免预约 单位:时*/
+    @Excel(name = "提前预约时间:0免预约 单位:时", width = 15)
+    @Schema(description = "提前预约时间:0免预约 单位:时")
+    private Integer advanceTime;
+    /**有效期;单位:天*/
+    @Excel(name = "有效期;单位:天", width = 15)
+    @Schema(description = "有效期;单位:天")
+    private Integer indate;
+    @Schema(description = "原价")
+    private BigDecimal originalPrice;
+    /**售价*/
+    @NotNull(message = "售价不允许为空")
+    @Schema(description = "售价")
+    private BigDecimal sellingPrice;
+}

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

@@ -0,0 +1,24 @@
+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;
+
+/**
+ * @author DM
+ * @date 2025/7/10 09:41
+ * @description
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description = "无固定场分页入参DTO")
+public class AppSitePlaceUnfixedPageDTO extends BasePageDTO{
+    @Schema(description = "名称")
+    private String name;
+}

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

@@ -47,6 +47,7 @@ public class AppSiteRuleDTO {
     /**星期几*/
     @Schema(description = "星期几")
     private String dayOfWeek;
+    /**原价*/
     @Schema(description = "原价")
     private BigDecimal originalPrice;
     /**售价*/

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

@@ -118,6 +118,10 @@ public class AppSitePlace implements Serializable {
 	@Excel(name = "购买限制", width = 15)
     @Schema(description = "购买限制")
     private Integer buyLimit;
+	/**0学校 1体育馆包场 2体育馆不固定场*/
+	@Excel(name = "0学校 1体育馆包场 2体育馆不固定场", width = 15)
+    @Schema(description = "0学校 1体育馆包场 2体育馆不固定场")
+    private Integer type;
 	/**有效期;单位:天*/
 	@Excel(name = "有效期;单位:天", width = 15)
     @Schema(description = "有效期;单位:天")

+ 4 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/enums/SitePriceTypeEnum.java → national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/enums/SitePlaceTypeEnum.java

@@ -3,14 +3,14 @@ package org.jeecg.modules.system.app.enums;
 import lombok.Getter;
 
 @Getter
-public enum SitePriceTypeEnum {
+public enum SitePlaceTypeEnum {
     //    0学校 1包场 2不固定场
     SCHOOL(0, "学校"),
     PACKAGE(1, "包场"),
     UNFIXED(2, "不固定场");
     final int code;
     final String name;
-    SitePriceTypeEnum(int code, String name) {
+    SitePlaceTypeEnum(int code, String name) {
         this.code = code;
         this.name = name;
     }
@@ -20,8 +20,8 @@ public enum SitePriceTypeEnum {
     public String getName() {
         return name;
     }
-    public static SitePriceTypeEnum getByCode(int code) {
-        for (SitePriceTypeEnum value : values()) {
+    public static SitePlaceTypeEnum getByCode(int code) {
+        for (SitePlaceTypeEnum value : values()) {
             if (value.code == code) {
                 return value;
             }

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

@@ -2,9 +2,7 @@ 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.AppSitePlaceCuDTO;
-import org.jeecg.modules.system.app.dto.AppSitePlaceDTO;
-import org.jeecg.modules.system.app.dto.AppSitePlacePageDTO;
+import org.jeecg.modules.system.app.dto.*;
 import org.jeecg.modules.system.app.entity.AppSitePlace;
 
 /**
@@ -47,4 +45,42 @@ public interface IAppSitePlaceService extends IService<AppSitePlace> {
 
     IPage<AppSitePlaceCuDTO> queryWitchPriceRulesPage(AppSitePlacePageDTO dto);
 
+
+
+
+    //Unfixed
+    /**
+     * 添加无固定场
+     * @param unsetDTO
+     * @return
+     */
+
+    Boolean addUnfixed(AppSitePlaceUnfixedDTO unsetDTO);
+    /**
+     * 编辑无固定场
+     * @param unsetDTO
+     * @return
+     */
+    Boolean updateUnfixed(AppSitePlaceUnfixedDTO unsetDTO);
+    /**
+     * 删除无固定场
+     * @param id
+     * @return
+     */
+    Boolean deleteUnfixed(String id);
+    /**
+     * 无固定场分页列表
+     * @param dto
+     * @return
+     */
+    IPage<AppSitePlaceUnfixedDTO> queryUnfixedPage(AppSitePlaceUnfixedPageDTO dto);
+    /**
+     * 无固定场详情
+     * @param id
+     * @return
+     */
+    AppSitePlaceUnfixedDTO queryUnfixedById(String id);
+
+
+
 }

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

@@ -8,13 +8,10 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.system.app.dto.AppSitePlaceCuDTO;
-import org.jeecg.modules.system.app.dto.AppSitePlaceDTO;
-import org.jeecg.modules.system.app.dto.AppSitePlacePageDTO;
-import org.jeecg.modules.system.app.dto.AppSiteRuleDTO;
-import org.jeecg.modules.system.app.entity.AppSite;
+import org.jeecg.modules.system.app.dto.*;
 import org.jeecg.modules.system.app.entity.AppSitePlace;
 import org.jeecg.modules.system.app.entity.AppSitePriceRules;
+import org.jeecg.modules.system.app.enums.SitePlaceTypeEnum;
 import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper;
 import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper;
 import org.jeecg.modules.system.app.service.IAppSitePlaceService;
@@ -27,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import static org.jeecg.common.constant.CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
 
@@ -42,6 +38,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
     @Resource
     private AppSitePriceRulesMapper appSitePriceRulesMapper;
 
+    //学校 包场 一对多
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean saveWitchPriceRules(AppSitePlaceDTO placeDTO) {
@@ -177,9 +175,10 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
 
     @Override
     public IPage<AppSitePlaceCuDTO> queryWitchPriceRulesPage(AppSitePlacePageDTO dto) {
+        if (null==dto.getType()) throw new JeecgBootException("请选择类型", SC_INTERNAL_SERVER_ERROR_500);
         LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize());
-        LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery()
+        LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, dto.getType())
                 .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName());
 //                .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode());
         IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper);
@@ -190,6 +189,100 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
         });
     }
 
+// 无固定场
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean addUnfixed(AppSitePlaceUnfixedDTO unsetDTO) {
+        if (null==unsetDTO.getSiteId()) throw new JeecgBootException("请选择商户门店", SC_INTERNAL_SERVER_ERROR_500);
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        AppSitePlace appSitePlace = new AppSitePlace();
+        BeanUtils.copyProperties(unsetDTO, appSitePlace);
+        appSitePlace.setType(SitePlaceTypeEnum.UNFIXED.getCode());
+        appSitePlace.setOrgCode(sysUser.getOrgCode());
+        appSitePlace.setTenantId(sysUser.getOrgId());
+        int insert = baseMapper.insert(appSitePlace);
+        if (insert < 1) throw new JeecgBootException("无固定场添加失败", SC_INTERNAL_SERVER_ERROR_500);
+        AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+        appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+        appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+        appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+        int insert1 = appSitePriceRulesMapper.insert(appSitePriceRules);
+        if (insert1 < 1) throw new JeecgBootException("无固定场价格添加失败", SC_INTERNAL_SERVER_ERROR_500);
+        return Boolean.TRUE;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updateUnfixed(AppSitePlaceUnfixedDTO unsetDTO) {
+        if (null==unsetDTO.getSiteId()) throw new JeecgBootException("商户门店不能为空", SC_INTERNAL_SERVER_ERROR_500);
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        AppSitePlace dbSitePlace = baseMapper.selectById(unsetDTO.getId());
+        if (null==dbSitePlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500);
+//        checkPermission(dbSitePlace,sysUser);
+
+        AppSitePlace appSitePlace = new AppSitePlace();
+        BeanUtils.copyProperties(unsetDTO, appSitePlace);
+        //固定
+        appSitePlace.setType(SitePlaceTypeEnum.UNFIXED.getCode());
+        appSitePlace.setOrgCode(sysUser.getOrgCode());
+        appSitePlace.setTenantId(sysUser.getOrgId());
+        int updateById = baseMapper.updateById(appSitePlace);
+        if (updateById < 1) throw new JeecgBootException("无固定场编辑失败", SC_INTERNAL_SERVER_ERROR_500);
+        AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
+        appSitePriceRules.setSitePlaceId(appSitePlace.getId());
+        appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
+        appSitePriceRules.setTenantId(appSitePlace.getTenantId());
+        int updateById1 = appSitePriceRulesMapper.updateById(appSitePriceRules);
+        if (updateById1 < 1) throw new JeecgBootException("无固定场价格编辑失败", SC_INTERNAL_SERVER_ERROR_500);
+        return Boolean.TRUE;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean deleteUnfixed(String id) {
+        AppSitePlace dbPlace = baseMapper.selectById(id);
+        if (null == dbPlace)throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500);
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        dbPlace.setUpdateBy(sysUser.getUsername());
+        int deleteById = baseMapper.deleteById(dbPlace);
+        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;
+    }
+
+    @Override
+    public IPage<AppSitePlaceUnfixedDTO> queryUnfixedPage(AppSitePlaceUnfixedPageDTO dto) {
+        Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize());
+        LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, SitePlaceTypeEnum.UNFIXED.getCode());
+
+        IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper);
+        return resultPage.convert(record -> {
+            AppSitePlaceUnfixedDTO appSitePlaceUnfixedDTO = new AppSitePlaceUnfixedDTO();
+            BeanUtils.copyProperties(record, appSitePlaceUnfixedDTO);
+            AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne(
+                    Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, record.getId()));
+            appSitePlaceUnfixedDTO.setOriginalPrice(appSitePriceRules.getOriginalPrice());
+            appSitePlaceUnfixedDTO.setSellingPrice(appSitePriceRules.getSellingPrice());
+            return appSitePlaceUnfixedDTO;
+        });
+    }
+
+    @Override
+    public AppSitePlaceUnfixedDTO queryUnfixedById(String id) {
+        AppSitePlace dbSitePlace = baseMapper.selectById(id);
+        if (null==dbSitePlace) throw new JeecgBootException("无固定场数据不存在", SC_INTERNAL_SERVER_ERROR_500);
+        AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne(
+                Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, dbSitePlace.getId()));
+        AppSitePlaceUnfixedDTO appSitePlaceUnfixedDTO = new AppSitePlaceUnfixedDTO();
+        BeanUtils.copyProperties(dbSitePlace, appSitePlaceUnfixedDTO);
+        appSitePlaceUnfixedDTO.setOriginalPrice(appSitePriceRules.getOriginalPrice());
+        appSitePlaceUnfixedDTO.setSellingPrice(appSitePriceRules.getSellingPrice());
+
+        return appSitePlaceUnfixedDTO;
+    }
+
     /**
      * 权限校验
      *