From 5771c822e99c38f0484559f1f68843979f0df24b Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期三, 20 九月 2023 19:12:54 +0800
Subject: [PATCH] 后台代码

---
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java |  122 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 116 insertions(+), 6 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 2b42da9..9d8a468 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
@@ -3,9 +3,18 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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;
@@ -16,12 +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;
@@ -51,9 +62,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")
@@ -85,7 +139,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
 
 
@@ -163,10 +216,6 @@
             return ResultUtil.runErr();
         }
     }
-
-
-
-
 
     /**
      * 购买课程微信支付回调
@@ -270,6 +319,8 @@
             if(null == uid){
                 return ResultUtil.tokenErr();
             }
+
+
             return siteService.cancelMySite(uid, id);
         }catch (Exception e){
             e.printStackTrace();
@@ -299,7 +350,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);
                 }
@@ -353,5 +404,64 @@
         }
     }
 
+    /**
+     * 查询所有现金支付的预约记录
+     * @param requestVo
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/base/site/queryPaymentSiteDetail")
+    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;
+    }
+
+    /**
+     * 查询所有玩湃币支付的预约记录
+     * @param appUserId
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/base/site/queryPlaypaiGoldSiteDetail")
+    public List<SiteBooking> wanpaiGoldSiteBookingList(@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)
+                .eq("payType",3)
+                .eq("appUserId",appUserId));
+    }
+
+
+    @ResponseBody
+    @PostMapping("/base/site/getNewAddSiteList")
+    public List<SiteVo> getAppUserSiteList(){
+        List<SiteVo> siteVos = new ArrayList<>();
+
+        List<Site> list = siteService.list(new QueryWrapper<Site>()
+                .orderByDesc("insertTime"));
+        if (list.size() > 0 ){
+            for (Site site : list) {
+                SiteVo vo = new SiteVo();
+                vo.setSiteId(site.getId());
+                vo.setSiteName(site.getName());
+                vo.setSiteTime(site.getAppointmentStartTime() + "-" + site.getAppointmentEndTime());
+                SiteType byId = siteTypeService.getById(site.getSiteTypeId());
+                vo.setSiteType(byId.getName());
+                vo.setPrice(site.getCashPrice());
+                siteVos.add(vo);
+            }
+        }
+        return siteVos;
+
+    }
 
 }

--
Gitblit v1.7.1