Procházet zdrojové kódy

补充赛事详情订单部分

zhangxin před 2 dny
rodič
revize
ad6d78078a

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

@@ -46,7 +46,7 @@ public class GameController {
     }
 
     @GetMapping("/findByGameId")
-    @Operation(summary = "根据赛事id查询比赛详情缺少保险部分")
+    @Operation(summary = "根据赛事id查询比赛详情")
     public Result<FindByGameIdPriceVo> findByGameId(@RequestParam("id") String id){
         return iGameService.findByGameId(id);
     }

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

@@ -7,15 +7,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.jeecg.common.api.vo.Result;
+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.AppInsure;
 import org.jeecg.modules.system.app.entity.InsurePrice;
-import org.jeecg.modules.system.app.mapper.AppGameMapper;
-import org.jeecg.modules.system.app.mapper.AppGamePriceRulesMapper;
-import org.jeecg.modules.system.app.mapper.AppInsureMapper;
-import org.jeecg.modules.system.app.mapper.InsurePriceMapper;
+import org.jeecg.modules.system.app.mapper.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -42,6 +40,8 @@ public class GameServiceImpl  implements IGameService {
     private AppInsureMapper appInsureMapper;
     @Autowired
     InsurePriceMapper insurePriceMapper;
+    @Autowired
+    private AppOrderMapper appOrderMapper;
 
 
     @Override
@@ -80,7 +80,10 @@ public class GameServiceImpl  implements IGameService {
             return Result.error("经纬度格式错误");
         }
         FindByIdResponse findByIdResponse =  appGameMapper.findById(id,longitudeNew,latitudeNew);
-        if (findByIdResponse!=null&&StringUtils.isNotEmpty(findByIdResponse.getBackgroundImage())){
+        if (findByIdResponse==null){
+            return Result.error("未查询到数据,请确认赛事是否存在");
+        }
+        if (StringUtils.isNotEmpty(findByIdResponse.getBackgroundImage())){
             List<String> backgroundImageList = new ArrayList<>();
             if (findByIdResponse.getBackgroundImage().indexOf(",")>0){
                 backgroundImageList= Arrays.asList(findByIdResponse.getBackgroundImage().split(","));
@@ -89,6 +92,17 @@ public class GameServiceImpl  implements IGameService {
             }
             findByIdResponse.setBackgroundImageList(backgroundImageList);
         }
+        List<String> strings = new ArrayList<>();
+        if (findByIdResponse.getGamePriceRulesVOList()!=null&&!findByIdResponse.getGamePriceRulesVOList().isEmpty()){
+            for (GamePriceRulesVO gamePriceRulesVO : findByIdResponse.getGamePriceRulesVOList()) {
+                strings.add(gamePriceRulesVO.getId());
+            }
+        }
+
+        int orderNum = appOrderMapper.countTypeAndProductIds(strings, CommonConstant.ORDER_TYPE_1);
+        findByIdResponse.setOrderNum(orderNum);
+        List<GameOrderVo> gameOrderVoList = appOrderMapper.findByNewOrderInfo(strings,CommonConstant.ORDER_TYPE_1);
+        findByIdResponse.setGameOrderVoList(gameOrderVoList);
         return Result.OK(findByIdResponse);
     }
 

+ 6 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/game/FindByIdResponse.java

@@ -60,4 +60,10 @@ public class FindByIdResponse {
     private List<GamePriceRulesVO> gamePriceRulesVOList;
     @Schema(description = "赛程")
     private List<GameScheduleVO> gameScheduleVOList;
+
+
+    @Schema(description = "报名总数")
+    private Integer  orderNum;
+    @Schema(description = "最新20个报名用户")
+    private List<GameOrderVo>  gameOrderVoList;
 }

+ 22 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/game/GameOrderVo.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.app.vo.game;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * 赛事订单报名数据
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="赛事详情订单返回参数")
+public class GameOrderVo {
+
+    @Schema(description = "头像")
+    private  String avatar;
+
+    @Schema(description = "昵称")
+    private String username;
+}

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

@@ -10,7 +10,6 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
-import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -69,15 +68,15 @@ public class AppSiteDTO {
     @Schema(description = "经营类型0全天 1自定义")
     private Integer runType;
     /**开始营业时间 */
-    @Excel(name = "开始营业时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @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 = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @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)

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

@@ -3,10 +3,13 @@ package org.jeecg.modules.system.app.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.app.vo.game.GameOrderVo;
 import org.jeecg.modules.system.app.entity.AppOrder;
 import org.jeecg.modules.system.app.form.AppOrderPageForm;
 import org.jeecg.modules.system.app.vo.OrderPageVO;
 
+import java.util.List;
+
 /**
  * @Description: 订单表
  * @Author: jeecg-boot
@@ -16,4 +19,14 @@ import org.jeecg.modules.system.app.vo.OrderPageVO;
 public interface AppOrderMapper extends BaseMapper<AppOrder> {
 
     Page<OrderPageVO> queryPage(Page<OrderPageVO> page, @Param("appOrderPageForm") AppOrderPageForm appOrderPageForm);
+
+    /**
+     * 查询已报名数
+     * @param productIds
+     * @param type
+     * @return
+     */
+    int countTypeAndProductIds(@Param("productId") List<String> productIds, @Param("type") int type);
+
+    List<GameOrderVo> findByNewOrderInfo(@Param("productIds")  List<String> productIds,@Param("orderType")  Integer orderType);
 }

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

@@ -38,4 +38,22 @@
         </where>
         ORDER BY o.create_time DESC
     </select>
+    <select id="countTypeAndProductIds" resultType="java.lang.Integer">
+        select  count(1) from nm_order where product_ids in
+        <foreach collection="productIds" item="productId" open="(" separator="," close=")">
+            #{productId}
+        </foreach>
+        and `type`=#{type} and order_status in (1,2,3)
+    </select>
+    <select id="findByNewOrderInfo" resultType="org.jeecg.modules.app.vo.game.GameOrderVo">
+        select b.avatar,b.username  from nm_order a
+        left join  sys_user b on a.user_id = b.id
+        where product_ids in
+        <foreach collection="productIds" item="productId" open="(" separator="," close=")">
+            #{productId}
+        </foreach>
+        and `type`=#{type} and order_status in (1,2,3)
+        order by pay_time desc
+        limit 20
+    </select>
 </mapper>

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

@@ -75,10 +75,12 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
         if (null == site.getType()) throw new JeecgBootException("场地类型不能为空", SC_INTERNAL_SERVER_ERROR_500);
         AppSite dbSite = baseMapper.selectById(site.getId());
         if (null == dbSite) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500);
-        if (null == site.getOrgCode())
+        if (null == dbSite.getOrgCode())
             throw new JeecgBootException("商户部门编码不能为空", SC_INTERNAL_SERVER_ERROR_500);
-        if (null == site.getTenantId())
+        if (null == dbSite.getTenantId())
             throw new JeecgBootException("商户部门id不能为空", SC_INTERNAL_SERVER_ERROR_500);
+        site.setOrgCode(dbSite.getOrgCode());
+        site.setTenantId(dbSite.getTenantId());
         int updateSiteResult = baseMapper.updateById(site);
         if (updateSiteResult < 1) {
             throw new JeecgBootException("商户信息保存失败", SC_INTERNAL_SERVER_ERROR_500);