From 8c55ab2701c99cec16eff92a26fefdf77fcdd28f Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期一, 25 九月 2023 16:17:44 +0800
Subject: [PATCH] app接口修改

---
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java |  104 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 82 insertions(+), 22 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index 3d3f7e9..32bb027 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -4,10 +4,17 @@
 import com.dsh.other.entity.Site;
 import com.dsh.other.entity.SiteBooking;
 import com.dsh.other.entity.SiteType;
+import com.dsh.other.feignclient.account.CityManagerClient;
 import com.dsh.other.feignclient.activity.UserCouponClient;
+import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId;
 import com.dsh.other.feignclient.activity.model.UserCoupon;
+import com.dsh.other.feignclient.model.BillingDataRequestVo;
+import com.dsh.other.feignclient.model.SiteChangeStateVO;
 import com.dsh.other.feignclient.model.SiteVo;
 import com.dsh.other.model.*;
+import com.dsh.other.model.dto.siteDto.TSiteDTO;
+import com.dsh.other.model.vo.siteVo.ExpireSiteSearchVO;
+import com.dsh.other.model.vo.siteVo.SiteSearchVO;
 import com.dsh.other.service.ISiteBookingService;
 import com.dsh.other.service.ISiteService;
 import com.dsh.other.service.ISiteTypeService;
@@ -18,16 +25,14 @@
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author zhibing.pu
@@ -54,9 +59,52 @@
 
     @Resource
     private UserCouponClient userCouponClient;
+    @Autowired
+    private CityManagerClient cityManagerClient;
 
 
+    /**
+     * 获取所有场地
+     * @return
+     */
+    @RequestMapping("/base/site/list")
+    public List<TSiteDTO> listAll(@RequestBody SiteSearchVO vo){
 
+        return siteTypeService.listAll(vo);
+
+    }
+    /**
+     * 获取场地有效期在两个月内的场地列表
+     * @return
+     */
+    @RequestMapping("/base/site/listExipre")
+    public List<TSiteDTO> listExipre(@RequestBody ExpireSiteSearchVO vo){
+
+        return siteTypeService.listExipre(vo);
+
+    }
+
+    /**
+     * 上/下架、删除常见问题 type=1为上架 2为下架 3为删除
+     */
+    @RequestMapping("/base/site/changeState")
+    public Object changeState(@RequestBody SiteChangeStateVO vo){
+
+        return siteService.changeState(vo);
+    }
+    /**
+     * 添加场地管理
+     * @return
+     */
+    @RequestMapping("/base/site/addSite")
+    public Object addSite(@RequestBody Site site){
+        if(site.getId()!= null ){
+
+            return siteService.updateById(site);
+        }else {
+            return siteService.save(site);
+        }
+    }
 
     @ResponseBody
     @PostMapping("/base/site/querySiteType")
@@ -88,7 +136,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
 
 
@@ -166,10 +213,6 @@
             return ResultUtil.runErr();
         }
     }
-
-
-
-
 
     /**
      * 购买课程微信支付回调
@@ -258,6 +301,22 @@
             return ResultUtil.runErr();
         }
     }
+    @ResponseBody
+    @PostMapping("/api/site/queryMySiteById")
+    @ApiOperation(value = "获取我的预约场地列表详情2.0", tags = {"用户—预约场地"})
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "id", name = "id", dataType = "int", required = true),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
+    })
+    public ResultUtil<SiteBooking> queryMySiteById(Integer id){
+        try {
+            SiteBooking byId = siteBookingService.getById(id);
+            return ResultUtil.success(byId);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
 
 
     @ResponseBody
@@ -273,6 +332,8 @@
             if(null == uid){
                 return ResultUtil.tokenErr();
             }
+
+
             return siteService.cancelMySite(uid, id);
         }catch (Exception e){
             e.printStackTrace();
@@ -302,7 +363,7 @@
                 siteBooking.setRefundOrderNo(refund_id);
                 siteBookingService.updateById(siteBooking);
                 if(null != siteBooking.getUserCouponId()){
-                    UserCoupon userCoupon = userCouponClient.queryUserCouponById(siteBooking.getUserCouponId());
+                    UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),siteBooking.getAppUserId()));
                     userCoupon.setStatus(1);
                     userCouponClient.updateUserCoupon(userCoupon);
                 }
@@ -358,21 +419,18 @@
 
     /**
      * 查询所有现金支付的预约记录
-     * @param appUserId
+     * @param requestVo
      * @return
      */
+    @ResponseBody
     @PostMapping("/base/site/queryPaymentSiteDetail")
-    public List<SiteBooking> getAllSiteBookingList(@RequestBody Integer appUserId){
-        ArrayList<Integer> integers = new ArrayList<>();
-        integers.add(1);
-        integers.add(2);
-        integers.add(3);
-        integers.add(4);
-        integers.add(5);
-        return siteBookingService.list(new QueryWrapper<SiteBooking>()
-                .in("status",integers)
-                .ne("payType",3)
-                .eq("appUserId",appUserId));
+    public RequestOfTypeVo getAllSiteBookingList(@RequestBody BillingDataRequestVo requestVo){
+        RequestOfTypeVo typeVo = new RequestOfTypeVo();
+        List<BillingRequestOfType> billingRequestOfTypes = siteBookingService.queryDatas(requestVo.getAppUserId(), requestVo.getMonthStart(), requestVo.getMonthEnd());
+        if (billingRequestOfTypes.size() > 0 ){
+            typeVo.setRequest(billingRequestOfTypes);
+        }
+        return typeVo;
     }
 
     /**
@@ -380,6 +438,7 @@
      * @param appUserId
      * @return
      */
+    @ResponseBody
     @PostMapping("/base/site/queryPlaypaiGoldSiteDetail")
     public List<SiteBooking> wanpaiGoldSiteBookingList(@RequestBody Integer appUserId){
         ArrayList<Integer> integers = new ArrayList<>();
@@ -395,6 +454,7 @@
     }
 
 
+    @ResponseBody
     @PostMapping("/base/site/getNewAddSiteList")
     public List<SiteVo> getAppUserSiteList(){
         List<SiteVo> siteVos = new ArrayList<>();

--
Gitblit v1.7.1