zhangxin 2 zile în urmă
părinte
comite
1e68201ebb
14 a modificat fișierele cu 284 adăugiri și 104 ștergeri
  1. 25 19
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/AppHomeServiceImpl.java
  2. 4 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java
  3. 1 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/coach/AppCoachDetailsVO.java
  4. 46 36
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppGameController.java
  5. 23 8
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGameCuDTO.java
  6. 8 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGameDTO.java
  7. 9 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGamePageDTO.java
  8. 7 2
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGameRuleDTO.java
  9. 2 1
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGameScheduleDTO.java
  10. 25 11
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppGame.java
  11. 5 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppGameMapper.java
  12. 77 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppGameMapper.xml
  13. 1 0
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/IAppGameService.java
  14. 51 25
      national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppGameServiceImpl.java

+ 25 - 19
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/AppHomeServiceImpl.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.app.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.ObjectUtils;
 import org.jeecg.modules.app.dto.GetPlaceListDTO;
 import org.jeecg.modules.app.dto.SearchDTO;
 import org.jeecg.modules.app.service.IAppHomeService;
@@ -159,24 +160,27 @@ public class AppHomeServiceImpl implements IAppHomeService {
     public Page<PlaceVO> getPlaceList(GetPlaceListDTO getPlaceListDTO) {
         Page<PlaceVO> page = new Page<>(getPlaceListDTO.getCurrent(), getPlaceListDTO.getSize());
         Page<PlaceVO> placeList = appSiteMapper.getPlaceList(page, getPlaceListDTO.getVenueType());
-        placeList.getRecords().forEach(placeVO -> {
-            boolean ticketWhether = false;
-            List<AppSitePriceRules> appSitePriceRules = new ArrayList<>();
-            appSitePlaceMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
-                    .eq(AppSitePlace::getSiteId, placeVO.getId())
-                    .eq(AppSitePlace::getDelFlag,0)
-                    .eq(AppSitePlace::getStatus,0)).forEach(appSitePlace -> {
-                appSitePriceRules.addAll(appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery()
-                        .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
-                        .eq(AppSitePriceRules::getDelFlag, 0)
-                        .eq(AppSitePriceRules::getStatus, 0)
-                        .ne(AppSitePriceRules::getInventory, 0)));
+        if (placeList.getRecords()!=null&&placeList.getRecords().isEmpty()){
+            placeList.getRecords().forEach(placeVO -> {
+                boolean ticketWhether = false;
+                List<AppSitePriceRules> appSitePriceRules = new ArrayList<>();
+                appSitePlaceMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
+                        .eq(AppSitePlace::getSiteId, placeVO.getId())
+                        .eq(AppSitePlace::getDelFlag,0)
+                        .eq(AppSitePlace::getStatus,0)).forEach(appSitePlace -> {
+                    appSitePriceRules.addAll(appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery()
+                            .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
+                            .eq(AppSitePriceRules::getDelFlag, 0)
+                            .eq(AppSitePriceRules::getStatus, 0)
+                            .ne(AppSitePriceRules::getInventory, 0)));
+                });
+                if(!appSitePriceRules.isEmpty()) ticketWhether = true;
+                placeVO.setKm(PositionUtil.calculateDistance(getPlaceListDTO.getLatitude(), getPlaceListDTO.getLongitude(), placeVO.getLatitude().doubleValue(), placeVO.getLongitude().doubleValue()))
+                        .setCategory(getCategoryName(placeVO.getCategoryId()))
+                        .setTicketWhether(ticketWhether);
             });
-            if(!appSitePriceRules.isEmpty()) ticketWhether = true;
-            placeVO.setKm(PositionUtil.calculateDistance(getPlaceListDTO.getLatitude(), getPlaceListDTO.getLongitude(), placeVO.getLatitude().doubleValue(), placeVO.getLongitude().doubleValue()))
-                    .setCategory(getCategoryName(placeVO.getCategoryId()))
-                    .setTicketWhether(ticketWhether);
-        });
+        }
+
         if(getPlaceListDTO.getVenueType().equals("0-2")
                 || getPlaceListDTO.getVenueType().equals("1-1")
                 || getPlaceListDTO.getVenueType().equals("2-1")){
@@ -359,8 +363,10 @@ public class AppHomeServiceImpl implements IAppHomeService {
                     })
                     .collect(Collectors.toList());
             AppSite appSite = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, instructorVO.getOrgCode()));
-            instructorVO.setKm(PositionUtil.calculateDistance(searchDTO.getLatitude(), searchDTO.getLongitude(), appSite.getLatitude().doubleValue(), appSite.getLongitude().doubleValue()))
-                    .setCourseList(courseInfoVOS);
+            if (appSite!=null&& ObjectUtils.isNotEmpty(appSite.getLatitude())&&ObjectUtils.isNotEmpty(appSite.getLongitude())){
+                instructorVO.setKm(PositionUtil.calculateDistance(searchDTO.getLatitude(), searchDTO.getLongitude(), appSite.getLatitude().doubleValue(), appSite.getLongitude().doubleValue()))
+                        .setCourseList(courseInfoVOS);
+            }
         });
         return searchInstructorVOPage;
     }

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.app.service.impl;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
@@ -111,6 +112,9 @@ public class OrderServiceImpl implements IOrderService {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         OrderVO.PreviewOrderCourse previousOrderCourse = new OrderVO.PreviewOrderCourse();
         AppCourses appCourses = appCoursesMapper.selectById(courseId);
+        if (appCourses==null|| StringUtils.isEmpty(appCourses.getCover())){
+            throw new JeecgBootException("未查询到课程数据");
+        }
         List<String> list = Arrays.asList(appCourses.getCover().split(","));
         boolean checkCourseDiscount = checkCourseDiscount(appCourses.getCategoryId(), user.getId());
         previousOrderCourse.setId(appCourses.getId())

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/coach/AppCoachDetailsVO.java

@@ -20,7 +20,7 @@ public class AppCoachDetailsVO {
     private String realname;
     @Schema(description = "教练头像")
     private String avatar;
-    @Schema(description = "教练头像")
+    @Schema(description = "背景图")
     private String backgroundImg;
     @Schema(description = "所教项目编号使用,分割")
     private String trainingPrograms;

+ 46 - 36
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppGameController.java

@@ -1,49 +1,27 @@
 package org.jeecg.modules.system.app.controller;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.shiro.SecurityUtils;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.query.QueryRuleEnum;
-import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.system.app.dto.AppGameDTO;
 import org.jeecg.modules.system.app.dto.AppGamePageDTO;
 import org.jeecg.modules.system.app.entity.AppGame;
 import org.jeecg.modules.system.app.service.IAppGameService;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.extern.slf4j.Slf4j;
-
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.jeecg.common.system.base.controller.JeecgController;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
- /**
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.concurrent.TimeUnit;
+
+/**
  * @Description: 赛事表
  * @Author: jeecg-boot
  * @Date:   2025-07-03
@@ -56,6 +34,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 public class AppGameController extends JeecgController<AppGame, IAppGameService> {
 	@Autowired
 	private IAppGameService appGameService;
+
+
 	
 	/**
 	 * 分页列表查询
@@ -140,6 +120,36 @@ public class AppGameController extends JeecgController<AppGame, IAppGameService>
 		return Result.OK(appGameService.queryWitchPriceRulesById(id));
 	}
 
+	 /**
+	  * 发布成绩
+	  *
+	  * @param appGame
+	  * @return
+	  */
+	 @Operation(summary="赛事表-发布成绩")
+	 @PutMapping(value = "/uploadScore")
+	 public Result<String> uploadScore(@RequestBody  AppGame appGame) {
+		 boolean save = appGameService.save(appGame);
+		 if (!save){
+			 return Result.error("上传成绩失败");
+		 }
+		 return Result.OK("上传成绩成功");
+	 }
+
+	 /**
+	  *
+	  *伪删除 将需要删除的数据保存到redis
+	  * @param id
+	  * @return
+	  */
+	 @Operation(summary="赛事表-发布成绩")
+	 @DeleteMapping(value = "/feignDelete")
+	 public Result<String> feignDelete(@RequestParam(name="id") String  id) {
+		 appGameService.redisSave(id);
+
+		 return Result.OK();
+	 }
+
     /**
     * 导出excel
     *

+ 23 - 8
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGameCuDTO.java

@@ -10,6 +10,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -47,7 +48,7 @@ public class AppGameCuDTO {
     @Schema(description = "举办方")
     private String organizers;
     /**举办地址*/
-    @Schema(description = "举办地址")
+    @Schema(description = "比赛地址")
     private String address;
     /**报名截止时间*/
     @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@@ -58,13 +59,13 @@ public class AppGameCuDTO {
     @Schema(description = "保险id;可能有多个险种")
     private String insureIds;
     /**开始时间*/
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
     @Schema(description = "开始时间")
     private Date startTime;
     /**结束时间*/
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
     @Schema(description = "结束时间")
     private Date endTime;
     /**提示/须知/说明*/
@@ -76,7 +77,21 @@ public class AppGameCuDTO {
     /**赛事成绩*/
     @Schema(description = "赛事成绩")
     private String gameResults;
-    /**排序*/
-    @Schema(description = "排序")
-    private Integer sort;
+
+    @Schema(description = "场地类型")
+    private Integer siteType;
+
+    @Schema(description = "场地id")
+    private String  siteId;
+
+    @Schema(description = "省份code")
+    private String  provinceCode;
+    @Schema(description = "城市code")
+    private String  cityCode;
+    @Schema(description = "区code")
+    private String  areaCode;
+    @Schema(description = "纬度")
+    private BigDecimal latitude;
+    @Schema(description = "经度")
+    private BigDecimal  longitude;
 }

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

@@ -22,9 +22,17 @@ import java.util.List;
 @NoArgsConstructor
 @Schema(description = "赛事-赛程-赛价入参DTO")
 public class AppGameDTO {
+    private String id;
     private AppGameCuDTO game;
     @ArraySchema(schema = @Schema(implementation = AppGameRuleDTO.class), minItems = 1)
     private List<AppGameRuleDTO> gamePriceRules;
     @ArraySchema(schema = @Schema(implementation = AppGameScheduleDTO.class), minItems = 1)
     private List<AppGameScheduleDTO> scheduleDTOS;
+
+
+    public AppGameDTO(AppGameCuDTO game, List<AppGameRuleDTO> gamePriceRules, List<AppGameScheduleDTO> scheduleDTOS) {
+        this.game = game;
+        this.gamePriceRules = gamePriceRules;
+        this.scheduleDTOS = scheduleDTOS;
+    }
 }

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

@@ -19,6 +19,14 @@ import lombok.experimental.Accessors;
 @NoArgsConstructor
 @Schema(description = "赛事-赛程-赛价分页入参DTO")
 public class AppGamePageDTO extends BasePageDTO{
-    @Schema(description = "名称", example = "xxx运动会")
+    @Schema(description = "名称")
     private String name;
+    @Schema(description = "比赛项目")
+    private String categoryId;
+    @Schema(description = "报名结束时间")
+    private String endTime;
+    @Schema(description = "报名开始时间")
+    private String startTime;
+    @Schema(description = "部门")
+    private String orgCode;
 }

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

@@ -6,7 +6,8 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.math.BigDecimal;
 
 /**
  * @author DM
@@ -28,11 +29,15 @@ public class AppGameRuleDTO {
     /**比赛项目*/
     @Schema(description = "比赛项目")
     private String categoryId;
+    @Schema(description = "比赛项目名称")
+    private String categoryName;
     /**售价*/
     @Schema(description = "售价")
-    private String sellingPrice;
+    private BigDecimal sellingPrice;
     @Schema(description = "人数")
     private Integer peopleNum;
+    @Schema(description = "删除标识")
+    private Integer delFlag;
     /**比赛类型;0个人1团队*/
     @Schema(description = "比赛类型;0个人1团队")
     private Integer type;

+ 2 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/AppGameScheduleDTO.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 java.util.Date;
@@ -39,6 +38,8 @@ public class AppGameScheduleDTO {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @Schema(description = "结束时间")
     private Date endTime;
+    @Schema(description = "删除标识")
+    private Integer delFlag;
     /**安排*/
     @Schema(description = "安排")
     private String arrange;

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

@@ -1,23 +1,20 @@
 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.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @Description: 赛事表
@@ -132,4 +129,21 @@ public class AppGame implements Serializable {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @Schema(description = "更新时间;更新时间")
     private Date updateTime;
+
+    @Schema(description = "场地类型")
+    private Integer siteType;
+
+    @Schema(description = "场地id")
+    private String  siteId;
+
+    @Schema(description = "省份code")
+    private String  provinceCode;
+    @Schema(description = "城市code")
+    private String  cityCode;
+    @Schema(description = "区code")
+    private String  areaCode;
+    @Schema(description = "纬度")
+    private BigDecimal latitude;
+    @Schema(description = "经度")
+    private BigDecimal  longitude;
 }

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

@@ -1,10 +1,13 @@
 package org.jeecg.modules.system.app.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.app.dto.SearchDTO;
 import org.jeecg.modules.app.vo.SearchVO;
+import org.jeecg.modules.system.app.dto.AppGameDTO;
+import org.jeecg.modules.system.app.dto.AppGamePageDTO;
 import org.jeecg.modules.system.app.entity.AppGame;
 
 /**
@@ -22,4 +25,6 @@ public interface AppGameMapper extends BaseMapper<AppGame> {
      * @return Page<SearchVO.SearchRaceVO>
      **/
     Page<SearchVO.SearchRaceVO> convertSearchCompetitionVOPage(@Param("page")Page<SearchVO.SearchRaceVO> page,@Param("searchDTO")SearchDTO searchDTO);
+
+    IPage<AppGameDTO> findPage(@Param("page")Page<AppGame> page, @Param("appGamePageDTO")AppGamePageDTO appGamePageDTO);
 }

+ 77 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppGameMapper.xml

@@ -1,6 +1,50 @@
 <?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.AppGameMapper">
+    <resultMap id="appGameDTOResult"  type="org.jeecg.modules.system.app.dto.AppGameDTO">
+        <id property="id" column="a_id"/>
+        <collection property="game" ofType="org.jeecg.modules.system.app.dto.AppGameCuDTO" columnPrefix="a_">
+            <id property="id" column="id" />
+            <result property="orgCode" column="org_code"/>
+            <result property="tenantId" column="tenant_id"/>
+            <result property="name" column="name"/>
+            <result property="cover" column="cover"/>
+            <result property="backgroundImage" column="background_image"/>
+            <result property="organizers" column="organizers"/>
+            <result property="provinceCode" column="province_code"/>
+            <result property="cityCode" column="city_code"/>
+            <result property="areaCode" column="area_code"/>
+            <result property="address" column="address"/>
+            <result property="latitude" column="latitude" javaType="java.math.BigDecimal"/>
+            <result property="longitude" column="longitude" javaType="java.math.BigDecimal"/>
+            <result property="applicationEndTime" column="application_end_time"/>
+            <result property="insureIds" column="insure_ids"/>
+            <result property="startTime" column="start_time"/>
+            <result property="endTime" column="end_time"/>
+            <result property="reminder" column="reminder"/>
+            <result property="aptitudes" column="aptitudes"/>
+            <result property="gameResults" column="game_results"/>
+            <result property="siteType" column="site_type"/>
+            <result property="siteId" column="site_id"/>
+        </collection>
+        <collection property="gamePriceRules" ofType="org.jeecg.modules.system.app.dto.AppGameRuleDTO" javaType="java.util.List" columnPrefix="c_">
+            <id property="id" column="id"/>
+            <result property="gameId" column="game_id"/>
+            <result property="categoryId" column="category_id"/>
+            <result property="categoryName" column="category_name"/>
+            <result property="sellingPrice" column="selling_price" javaType="java.math.BigDecimal"/>
+            <result property="peopleNum" column="people_num"/>
+            <result property="type" column="cType"/>
+        </collection>
+        <collection property="scheduleDTOS" ofType="org.jeecg.modules.system.app.dto.AppGameScheduleDTO" javaType="java.util.List" columnPrefix="e_">
+            <id property="id" column="id"/>
+            <result property="name" column="scheduleName"/>
+            <result property="startTime" column="eStartTime"/>
+            <result property="endTime" column="eEndTime"/>
+            <result property="arrange" column="arrange"/>
+        </collection>
+    </resultMap>
+
     <select id="convertSearchCompetitionVOPage" resultType="org.jeecg.modules.app.vo.SearchVO$SearchRaceVO" parameterType="org.jeecg.modules.app.dto.SearchDTO">
         SELECT
         a.id,
@@ -24,4 +68,37 @@
         </if>
         ORDER BY a.end_time ASC;
     </select>
+    <select id="findPage" resultMap="appGameDTOResult">
+        select  a.id as a_id, a.org_code as a_org_code, a.tenant_id as a_tenant_id, a.name as a_name, a.cover as a_cover,
+                a.background_image as a_background_image, a.organizers as a_organizers, a.site_type as a_site_type,
+                a.site_id as a_site_id, a.province_code as a_province_code,a.city_code as a_city_code,
+                a.area_code as a_area_code, IFNULL(b.name, a.address) as a_address, IFNULL(b.latitude, a.latitude) as a_latitude,IFNULL(b.longitude, a.longitude) as a_longitude,
+                a.application_end_time as a_application_end_time, a.insure_ids as a_insure_ids, a.start_time as a_start_time,
+                a.end_time as a_end_time, a.reminder as  a_reminder, a.aptitudes as a_aptitudes, a.game_results as a_game_results,a.create_time as a_create_time,
+                c.id AS c_id,c.game_id as c_game_id,c.type as c_type,d.name as c_category_name,c.category_id as c_category_id,c.selling_price as  c_selling_price
+                ,c.people_num as c_people_num,c.type as c_type,e.id as e_id,e.name as e_scheduleName,e.start_time as e_eStartTime,e.end_time as e_eEndTime, e.arrange as e_arrange
+                from nm_game a
+                 left join nm_site b on  a.site_id = b.id and b.del_flag=0
+                 left join  nm_game_price_rules c on  c.game_id = a.id and c.del_flag=0
+                 left join nm_game_schedule e on e.game_id =a.id
+                 left join nm_category d on  c.category_id = d.id and d.del_flag=0
+        where a.del_flag = 0
+        <if test="appGamePageDTO != null and appGamePageDTO != ''">
+            <if test="appGamePageDTO.name != null and appGamePageDTO.name != ''">
+                AND a.name LIKE CONCAT('%',#{appGamePageDTO.name},'%')
+            </if>
+            <if test="appGamePageDTO.categoryId != null and appGamePageDTO.categoryId != ''">
+                AND a.id in (select game_id from nm_game_price_rules where category_id  = #{appGamePageDTO.categoryId}  )
+            </if>
+            <if test="appGamePageDTO.endTime!=null  and staffRequestVO.endTime!=''">
+                <![CDATA[   AND DATE_FORMAT(a.application_end_time, '%Y-%m-%d')<=  DATE_FORMAT(#{appGamePageDTO.endTime}, '%Y-%m-%d') ]]>
+            </if>
+            <if test="appGamePageDTO.startTime!=null  and appGamePageDTO.startTime!=''">
+                <![CDATA[   AND DATE_FORMAT(a.application_end_time, '%Y-%m-%d')<=  DATE_FORMAT(#{appGamePageDTO.startTime}, '%Y-%m-%d') ]]>
+            </if>
+            <if test="appGamePageDTO.orgCode != null and appGamePageDTO.orgCode != ''">
+                AND a.org_code LIKE CONCAT(#{appGamePageDTO.orgCode},'%')
+            </if>
+        </if>
+    </select>
 </mapper>

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

@@ -40,4 +40,5 @@ public interface IAppGameService extends IService<AppGame> {
 
     IPage<AppGameDTO> queryWitchPriceRulesPage(AppGamePageDTO dto);
 
+    void redisSave(String id);
 }

+ 51 - 25
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppGameServiceImpl.java

@@ -1,9 +1,9 @@
 package org.jeecg.modules.system.app.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
@@ -18,14 +18,15 @@ import org.jeecg.modules.system.app.mapper.AppGameScheduleMapper;
 import org.jeecg.modules.system.app.mapper.AppSiteMapper;
 import org.jeecg.modules.system.app.service.IAppGameService;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import static org.jeecg.common.constant.CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
 
@@ -44,6 +45,14 @@ public class AppGameServiceImpl extends ServiceImpl<AppGameMapper, AppGame> impl
     @Resource
     private AppSiteMapper siteMapper;
 
+    @Autowired
+    private AppGameMapper appGameMapper;
+
+    @Autowired
+    RedisTemplate<String, String> redisTemplate;
+
+    private String feignDelete ="feignDelete";
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean saveWitchPriceRules(AppGameDTO gameDTO) {
@@ -105,7 +114,12 @@ public class AppGameServiceImpl extends ServiceImpl<AppGameMapper, AppGame> impl
             appGamePriceRules.setGameId(game.getId());
             appGamePriceRules.setOrgCode(game.getOrgCode());
             appGamePriceRules.setTenantId(game.getTenantId());
-            int savePriceResult = rulesMapper.updateById(appGamePriceRules);
+            int savePriceResult =0;
+            if (StringUtils.isNotEmpty(gameRuleDTO.getId())){
+                savePriceResult = rulesMapper.updateById(appGamePriceRules);
+            }else {
+                savePriceResult = rulesMapper.insert(appGamePriceRules);
+            }
             if (savePriceResult < 1) {
                 throw new JeecgBootException("赛事价格规则保存失败");
             }
@@ -117,7 +131,12 @@ public class AppGameServiceImpl extends ServiceImpl<AppGameMapper, AppGame> impl
             appGameSchedule.setGameId(game.getId());
             appGameSchedule.setOrgCode(game.getOrgCode());
             appGameSchedule.setTenantId(game.getTenantId());
-            int saveScheduleResult = scheduleMapper.updateById(appGameSchedule);
+            int saveScheduleResult =0;
+            if (StringUtils.isNotEmpty(scheduleDTO.getId())){
+                saveScheduleResult = scheduleMapper.updateById(appGameSchedule);
+            }else {
+                saveScheduleResult = scheduleMapper.insert(appGameSchedule);
+            }
             if (saveScheduleResult < 1) {
                 throw new JeecgBootException("赛事安排保存失败");
             }
@@ -170,28 +189,35 @@ public class AppGameServiceImpl extends ServiceImpl<AppGameMapper, AppGame> impl
     public IPage<AppGameDTO> queryWitchPriceRulesPage(AppGamePageDTO dto) {
         LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         Page<AppGame> page = new Page<>(dto.getPageNum(), dto.getPageSize());
-        LambdaQueryWrapper<AppGame> wrapper = Wrappers.<AppGame>lambdaQuery()
-                .like(StringUtils.isNotBlank(dto.getName()), AppGame::getName, dto.getName());
+//        LambdaQueryWrapper<AppGame> wrapper = Wrappers.<AppGame>lambdaQuery()
+//                .like(StringUtils.isNotBlank(dto.getName()), AppGame::getName, dto.getName());
 //                .eq(AppGame::getOrgCode, loginUser.getOrgCode());
+        dto.setOrgCode(loginUser.getOrgCode());
+        return  appGameMapper.findPage(page,dto);
+//        IPage<AppGame> resultPage = baseMapper.selectPage(page, wrapper);
+//        return resultPage.convert(record -> {
+//            AppGameCuDTO cuDTO = new AppGameCuDTO();
+//            BeanUtils.copyProperties(cuDTO, record);
+//            List<AppGameRuleDTO> priceRulesDTOList = new ArrayList<>();
+//            rulesMapper.selectList(Wrappers.<AppGamePriceRules>lambdaQuery().eq(AppGamePriceRules::getGameId, record.getId())).forEach(rule-> {
+//                AppGameRuleDTO appGameRuleDTO = new AppGameRuleDTO();
+//                BeanUtils.copyProperties(rule, appGameRuleDTO);
+//                priceRulesDTOList.add(appGameRuleDTO);
+//            });
+//            List<AppGameScheduleDTO> scheduleDTOS = new ArrayList<>();
+//            scheduleMapper.selectList(Wrappers.<AppGameSchedule>lambdaQuery().eq(AppGameSchedule::getGameId, record.getId())).forEach(schedule-> {
+//                AppGameScheduleDTO appGameScheduleDTO = new AppGameScheduleDTO();
+//                BeanUtils.copyProperties(schedule, appGameScheduleDTO);
+//                scheduleDTOS.add(appGameScheduleDTO);
+//            });
+//            return new AppGameDTO(cuDTO, priceRulesDTOList, scheduleDTOS);
+//        });
+    }
 
-        IPage<AppGame> resultPage = baseMapper.selectPage(page, wrapper);
-        return resultPage.convert(record -> {
-            AppGameCuDTO cuDTO = new AppGameCuDTO();
-            BeanUtils.copyProperties(cuDTO, record);
-            List<AppGameRuleDTO> priceRulesDTOList = new ArrayList<>();
-            rulesMapper.selectList(Wrappers.<AppGamePriceRules>lambdaQuery().eq(AppGamePriceRules::getGameId, record.getId())).forEach(rule-> {
-                AppGameRuleDTO appGameRuleDTO = new AppGameRuleDTO();
-                BeanUtils.copyProperties(rule, appGameRuleDTO);
-                priceRulesDTOList.add(appGameRuleDTO);
-            });
-            List<AppGameScheduleDTO> scheduleDTOS = new ArrayList<>();
-            scheduleMapper.selectList(Wrappers.<AppGameSchedule>lambdaQuery().eq(AppGameSchedule::getGameId, record.getId())).forEach(schedule-> {
-                AppGameScheduleDTO appGameScheduleDTO = new AppGameScheduleDTO();
-                BeanUtils.copyProperties(schedule, appGameScheduleDTO);
-                scheduleDTOS.add(appGameScheduleDTO);
-            });
-            return new AppGameDTO(cuDTO, priceRulesDTOList, scheduleDTOS);
-        });
+    @Override
+    public void redisSave(String id) {
+        redisTemplate.opsForSet().add(feignDelete, id);
+        redisTemplate.expire(feignDelete, 600, TimeUnit.SECONDS);
     }
 
     /**