From 561e8590782ccea6037fcd50d24429ce8757cb64 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 09 十月 2023 09:23:58 +0800
Subject: [PATCH] 广告修改
---
cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java | 66 +++++++++++++++++++++++++++++++-
1 files changed, 63 insertions(+), 3 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 220999a..5082c8b 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
@@ -1,5 +1,9 @@
package com.dsh.other.controller;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.other.entity.Site;
import com.dsh.other.entity.SiteBooking;
@@ -62,7 +66,14 @@
@Autowired
private CityManagerClient cityManagerClient;
-
+ /**
+ * 获取所有场地
+ */
+ @RequestMapping("/base/site/getList")
+ @ResponseBody
+ public List<Site> getList(){
+ return siteService.list(new QueryWrapper<Site>().ne("state",3));
+ }
/**
* 获取场地预约记录
*/
@@ -111,6 +122,33 @@
}
}
+
+ /**
+ * 添加场地管理
+ * @return
+ */
+ @RequestMapping("/base/site/addSiteBooking")
+ public Object addSiteBooking(@RequestBody SiteBooking siteBooking){
+ if(siteBooking.getId()!= null ){
+
+ return siteBookingService.updateById(siteBooking);
+ }else {
+ return siteBookingService.save(siteBooking);
+ }
+ }
+
+ @RequestMapping("/base/site/listById")
+ public Site listById(@RequestParam("id") Integer id){
+ Site byId = siteService.getById(id);
+ return byId;
+ }
+
+
+ @RequestMapping("/base/site/listBooks")
+ public List<SiteBooking> listBooks(@RequestParam("id") Integer id){
+ List<SiteBooking> siteId = siteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id));
+ return siteId;
+ }
@ResponseBody
@PostMapping("/base/site/querySiteType")
@ApiOperation(value = "获取场地类型", tags = {"用户—预约场地"})
@@ -313,16 +351,38 @@
@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){
+ public ResultUtil<Map<String,Object>> queryMySiteById(Integer id){
try {
+ HashMap<String, Object> map = new HashMap<>();
SiteBooking byId = siteBookingService.getById(id);
- return ResultUtil.success(byId);
+ List<Integer> ids = getIds(byId.getSiteId());
+ map.put("data",byId);
+ map.put("ids",ids);
+ return ResultUtil.success(map);
}catch (Exception e){
e.printStackTrace();
return ResultUtil.runErr();
}
}
+ public List<Integer> getIds(Integer siteId) {
+ HttpRequest httpRequest = HttpRequest.get("https://try.daowepark.com/v7/user_api/general/get_space_area?space_id=" + siteId);
+ HttpResponse execute = httpRequest.execute();
+ String body = execute.body();
+ JSONObject jsonObject = JSONObject.parseObject(body);
+ Object data = jsonObject.get("data");
+ JSONArray array = JSONArray.parseArray(data.toString());
+ List<Integer> ids =new ArrayList<>();
+ for (Object o : array) {
+ JSONObject jsonObject1 = JSONObject.parseObject(o.toString());
+ Object id = jsonObject1.get("id");
+ Integer integer = Integer.valueOf(id.toString());
+ ids.add(integer);
+ }
+ return ids;
+
+ }
+
@ResponseBody
@PostMapping("/api/site/cancelMySite")
--
Gitblit v1.7.1