Bladeren bron

新增根据订单id查询赛事相关信息

zhangxin 2 weken geleden
bovenliggende
commit
3521d64afa

+ 11 - 6
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/game/GameController.java

@@ -6,10 +6,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.app.service.IGameService;
-import org.jeecg.modules.app.vo.game.FindByGameIdPriceVo;
-import org.jeecg.modules.app.vo.game.FindByIdResponse;
-import org.jeecg.modules.app.vo.game.FindPagResponse;
-import org.jeecg.modules.app.vo.game.FindPageGameVO;
+import org.jeecg.modules.app.vo.game.*;
 import org.jeecg.modules.system.app.entity.AppGame;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -18,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * app赛事
@@ -54,7 +52,14 @@ public class GameController {
 
     @GetMapping("/findScoreByGameId")
     @Operation(summary = "查询赛事成绩")
-    public Result<AppGame> findScoreByGameId(@RequestParam("id") String id){
-        return iGameService.findScoreByGameId(id);
+    public Result<AppGame> findScoreByGameId(@RequestParam("orderId") String orderId){
+        return iGameService.findScoreByGameId(orderId);
     }
+
+    @GetMapping("/findScheduleByOrderId")
+    @Operation(summary = "查询赛事安排")
+    public Result<List<GameScheduleVO>> findScheduleByOrderId(@RequestParam("orderId") String orderId){
+        return iGameService.findScheduleByOrderId(orderId);
+    }
+
 }

+ 9 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IGameService.java

@@ -2,12 +2,11 @@ package org.jeecg.modules.app.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.modules.app.vo.game.FindByGameIdPriceVo;
-import org.jeecg.modules.app.vo.game.FindByIdResponse;
-import org.jeecg.modules.app.vo.game.FindPagResponse;
-import org.jeecg.modules.app.vo.game.FindPageGameVO;
+import org.jeecg.modules.app.vo.game.*;
 import org.jeecg.modules.system.app.entity.AppGame;
 
+import java.util.List;
+
 /**
  * @Description: 赛事表
  * @Author: jeecg-boot
@@ -24,5 +23,10 @@ public interface IGameService {
 
     Result<FindByGameIdPriceVo> findByGameId(String id);
 
-    Result<AppGame> findScoreByGameId(String id);
+    Result<AppGame> findScoreByGameId(String orderId);
+
+    Result<String> findGetGameId(String orderId);
+
+    Result<List<GameScheduleVO>> findScheduleByOrderId(String orderId);
+
 }

+ 39 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/GameServiceImpl.java

@@ -11,9 +11,7 @@ import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.util.DictAnnotationUtil;
 import org.jeecg.modules.app.service.IGameService;
 import org.jeecg.modules.app.vo.game.*;
-import org.jeecg.modules.system.app.entity.AppGame;
-import org.jeecg.modules.system.app.entity.AppInsure;
-import org.jeecg.modules.system.app.entity.InsurePrice;
+import org.jeecg.modules.system.app.entity.*;
 import org.jeecg.modules.system.app.mapper.*;
 import org.jeecg.modules.system.app.utils.StringMasker;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +36,9 @@ public class GameServiceImpl  implements IGameService {
     @Autowired
     private AppGamePriceRulesMapper appGamePriceRulesMapper;
 
+    @Autowired
+    private AppGameScheduleMapper appGameScheduleMapper;
+
     @Autowired
     private AppInsureMapper appInsureMapper;
     @Autowired
@@ -164,8 +165,12 @@ public class GameServiceImpl  implements IGameService {
     }
 
     @Override
-    public Result<AppGame> findScoreByGameId(String id) {
-        AppGame appGame = appGameMapper.selectById(id);
+    public Result<AppGame> findScoreByGameId(String orderId) {
+        Result<String> result = findGetGameId(orderId);
+        if (!result.isSuccess()){
+            return Result.error(result.getMessage());
+        }
+        AppGame appGame = appGameMapper.selectById(result.getMessage());
         if (appGame==null){
             return Result.error("请确认所查询需要的数据是否存在");
         }
@@ -175,5 +180,34 @@ public class GameServiceImpl  implements IGameService {
         return Result.ok(appGame);
     }
 
+    @Override
+    public Result<String> findGetGameId(String orderId) {
+        AppOrder appOrder = appOrderMapper.selectById(orderId);
+        if (appOrder==null){
+            return Result.error("该订单不存在");
+        }
+        if (StringUtils.isEmpty(appOrder.getProductIds())||appOrder.getType()!=1){
+            return Result.error("该订单不存在赛事商品");
+        }
+        AppGamePriceRules appGamePriceRules = appGamePriceRulesMapper.selectById(appOrder.getProductIds());
+        if (appGamePriceRules==null){
+            return Result.error("该商品不存在,订单号:"+appOrder.getOrderCode());
+        }
+        if (StringUtils.isEmpty(appGamePriceRules.getGameId())){
+            return Result.error("该商品未关联赛事,订单号:"+appOrder.getOrderCode());
+        }
+        return Result.ok(appGamePriceRules.getGameId());
+    }
+
+    @Override
+    public Result<List<GameScheduleVO>> findScheduleByOrderId(String orderId) {
+        Result<String> result = findGetGameId(orderId);
+        if (!result.isSuccess()){
+            return Result.error(result.getMessage());
+        }
+
+        return Result.ok(appGameScheduleMapper.findByGameId(result.getMessage()));
+    }
+
 
 }

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.system.app.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.app.vo.AppGameScheduleVO;
+import org.jeecg.modules.app.vo.game.GameScheduleVO;
 import org.jeecg.modules.system.app.entity.AppGameSchedule;
 
 import java.util.List;
@@ -18,4 +19,6 @@ public interface AppGameScheduleMapper extends BaseMapper<AppGameSchedule> {
     int updateByIdDel(@Param("id") String id);
 
     List<AppGameScheduleVO> getListVo(String id);
+
+    List<GameScheduleVO> findByGameId(@Param("gameId")String gameId);
 }

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

@@ -26,4 +26,14 @@
             </if>
         </where>
     </select>
+    <select id="findByGameId" resultType="org.jeecg.modules.app.vo.game.GameScheduleVO">
+        <![CDATA[
+        SELECT id,name,arrange,start_time,end_time, CASE
+        WHEN NOW() < start_time THEN '未开始'
+        WHEN NOW() >= end_time THEN '已结束'
+        ELSE '进行中'
+        END AS startStatus
+        from nm_game_schedule where del_flag = 0 and game_id = #{gameId} order by start_time
+        ]]>
+    </select>
 </mapper>