From cf8524f0eeb0e897e31077695a410fc97633c3f5 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 15 三月 2024 20:35:36 +0800
Subject: [PATCH] 添加方法

---
 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java |   94 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 69 insertions(+), 25 deletions(-)

diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
index ffb7485..102a74f 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -10,10 +10,12 @@
 import com.dsh.communityWorldCup.feignclient.account.model.TStudent;
 import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient;
 import com.dsh.communityWorldCup.feignclient.competition.model.Participant;
+import com.dsh.communityWorldCup.feignclient.other.GameClient;
 import com.dsh.communityWorldCup.feignclient.other.SiteClient;
 import com.dsh.communityWorldCup.feignclient.other.StoreClient;
 import com.dsh.communityWorldCup.feignclient.other.model.Site;
 import com.dsh.communityWorldCup.feignclient.other.model.Store;
+import com.dsh.communityWorldCup.feignclient.other.model.TGame;
 import com.dsh.communityWorldCup.model.*;
 import com.dsh.communityWorldCup.service.*;
 import com.dsh.communityWorldCup.util.GDMapGeocodingUtil;
@@ -26,6 +28,7 @@
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -91,6 +94,12 @@
     @Autowired
     private IWorldCupPaymentService worldCupPaymentService;
 
+    @Resource
+    private GameClient gameClient;
+
+
+
+
     /**
      * 根据门店id获取门店关系数据
      * @param storeId
@@ -98,8 +107,19 @@
      */
     @ResponseBody
     @PostMapping("/worldCup/getWorldCupStoreListByStoreId")
-    public List<WorldCupStore> getWorldCupStoreListByStoreId(@RequestBody Integer storeId){
-        return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId));
+    public List<WorldCupStoreVO> getWorldCupStoreListByStoreId(@RequestBody Integer storeId){
+        List<WorldCupStoreVO> res = new ArrayList<>();
+
+        List<WorldCupStore> storeId1 = worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId));
+        for (WorldCupStore worldCupStore : storeId1) {
+            WorldCupStoreVO worldCupStoreVO = new WorldCupStoreVO();
+            BeanUtils.copyProperties(worldCupStore,worldCupStoreVO);
+            // 查询世界杯活动名称
+            WorldCup byId = worldCupService.getById(worldCupStore.getWorldCupId());
+            worldCupStoreVO.setName(byId.getName());
+            res.add(worldCupStoreVO);
+        }
+        return res;
     }
     /**
      * 根据门店id修改门店关系数据
@@ -177,7 +197,7 @@
                 .eq("worldCupId", worldCupPeople.getWorldCupId()).eq("participantId", id).eq("participantType", isStudent)
                 .orderByDesc("createTime").last(" limit 0, 1"));
         if(null == worldCupPaymentParticipant){
-            return ResultUtil.error("无效二维码");
+            return ResultUtil.error("报名失败,当前用户未报名当前比赛");
         }
         WorldCupPeopleVo worldCupPeopleVo = new WorldCupPeopleVo();
         worldCupPeopleVo.setId(worldCupPaymentParticipant.getParticipantId());
@@ -195,7 +215,7 @@
             Participant participant = participantClient.getParticipant(worldCupPaymentParticipant.getParticipantId());
             worldCupPeopleVo.setName(participant.getName());
             worldCupPeopleVo.setAge(null == participant.getBirthday() ? 0 : Integer.valueOf(sdf.format(new Date())) -Integer.valueOf(sdf.format(participant.getBirthday())));
-            worldCupPeopleVo.setAvatar(appUser.getHeadImg());
+            worldCupPeopleVo.setAvatar(participant.getHeadImg());
             worldCupPeopleVo.setParticipantType(2);
         }
         return ResultUtil.success(worldCupPeopleVo);
@@ -224,13 +244,19 @@
             return ResultUtil.error("二维码不正确");
         }
         Integer space_id = jsonObject.getInteger("space_id");
-        Store store = storeClient.queryStoreById(space_id);
-        if(null == store){
+        Site site = siteClient.getSite(space_id);
+        if(null == site){
             return ResultUtil.error("无法获取场地信息");
+        }
+        Store store = storeClient.queryStoreById(site.getStoreId());
+        String sutu_id = jsonObject.getString("sutu_id");
+        TGame tGame = gameClient.getTGameBySutuId(sutu_id);
+        if(null == tGame){
+            return ResultUtil.error("无效的游戏二维码");
         }
         Map<String, String> map = new HashMap<>();
         map.put("name", store.getName());
-        map.put("address", store.getAddress());
+        map.put("address", site.getName());
         return ResultUtil.success(map);
     }
 
@@ -385,11 +411,10 @@
             if(null != map){
                 String code = map.get("out_trade_no");
                 String transaction_id = map.get("trade_no");
-                String result = map.get("result");
                 ResultUtil resultUtil = worldCupService.paymentWorldCupCallback(code, transaction_id);
                 if(resultUtil.getCode() == 200){
                     PrintWriter out = response.getWriter();
-                    out.println(result);
+                    out.println("success");
                     out.flush();
                     out.close();
                 }else{
@@ -486,12 +511,12 @@
     @PostMapping("/api/worldCup/getMyWorldCupInfo")
     @ApiOperation(value = "获取已报名世界杯详情【2.0】", tags = {"APP-个人中心"})
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "Long"),
             @ApiImplicitParam(name = "lon", value = "经度", required = true, dataType = "string"),
             @ApiImplicitParam(name = "lat", value = "纬度", required = true, dataType = "string"),
             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
-    public ResultUtil<MyWorldCupInfo> getMyWorldCupInfo(String id, String lon, String lat){
+    public ResultUtil<MyWorldCupInfo> getMyWorldCupInfo(Long id, String lon, String lat){
         MyWorldCupInfo myWorldCupInfo = worldCupPaymentParticipantService.getMyWorldCupInfo(id, lon, lat);
         return ResultUtil.success(myWorldCupInfo);
     }
@@ -500,10 +525,10 @@
     @PostMapping("/api/worldCup/cancelMyWorldCup")
     @ApiOperation(value = "取消已报名的世界杯【2.0】", tags = {"APP-个人中心"})
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "Long"),
             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
-    public ResultUtil cancelMyWorldCup(String id){
+    public ResultUtil cancelMyWorldCup(Long id){
         return worldCupPaymentService.cancelMyWorldCup(id);
     }
 
@@ -631,9 +656,10 @@
      */
     @ResponseBody
     @PostMapping("/worldCup/editWorldCup")
-    public Integer editWorldCup(@RequestBody WorldCup worldCup){
-        String lon = worldCup.getLon();
-        String lat = worldCup.getLat();
+    public Integer editWorldCup(@RequestBody String worldCup){
+        WorldCup worldCup2 = JSON.parseObject(worldCup, WorldCup.class);
+        String lon = worldCup2.getLon();
+        String lat = worldCup2.getLat();
         Map<String, String> geocode = null;
         try {
             geocode = gdMapGeocodingUtil.geocode(lon, lat);
@@ -644,15 +670,15 @@
         String provinceCode = geocode.get("provinceCode");
         String city = geocode.get("city");
         String cityCode = geocode.get("cityCode");
-        worldCup.setProvince(province.replace("省", ""));
-        worldCup.setProvinceCode(provinceCode);
-        worldCup.setCity(city.replace("市", ""));
-        worldCup.setCityCode(cityCode);
-        WorldCup worldCup1 = worldCupService.getById(worldCup.getId());
-        worldCup.setCreateTime(worldCup1.getCreateTime());
-        worldCup.setMatchNumber(worldCup1.getMatchNumber());
-        worldCupService.updateWorldCupAll(worldCup);
-        return worldCup.getId();
+        worldCup2.setProvince(province.replace("省", ""));
+        worldCup2.setProvinceCode(provinceCode);
+        worldCup2.setCity(city.replace("市", ""));
+        worldCup2.setCityCode(cityCode);
+        WorldCup worldCup1 = worldCupService.getById(worldCup2.getId());
+        worldCup2.setCreateTime(worldCup1.getCreateTime());
+        worldCup2.setMatchNumber(worldCup1.getMatchNumber());
+        worldCupService.updateWorldCupAll(worldCup2);
+        return worldCup2.getId();
     }
 
 
@@ -729,6 +755,7 @@
             worldCupPayment.setRefundOrderNo(refund_id);
             worldCupPayment.setRefundTime(new Date());
             worldCupPayment.setPayStatus(3);
+            worldCupPayment.setWorldCupId(null);
             worldCupPaymentService.updateById(worldCupPayment);
             PrintWriter out = null;
             try {
@@ -849,4 +876,21 @@
         }
         return worldCupPaymentParticipantService.getCount(worldCupId, collect);
     }
+
+
+    /**
+     * 获取支付记录
+     * @param getWorldCupPayment
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/worldCup/getWorldCupPayment")
+    public List<WorldCupPayment> getWorldCupPayment(@RequestBody GetWorldCupPayment getWorldCupPayment){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String payType = getWorldCupPayment.getPayType();
+        List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("appUserId", getWorldCupPayment.getAppUserId())
+                .in("payType", Arrays.asList(payType.split(","))).ne("payStatus", 1).eq("state", 1)
+                .last(" and createTime between '" + sdf.format(getWorldCupPayment.getStartTime()) + "' and  '" + sdf.format(getWorldCupPayment.getEndTime()) + "' order by createTime desc"));
+        return list;
+    }
 }

--
Gitblit v1.7.1