From b27efc697f2f81e0d0f247a2708e58af52a5df9b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 23 十月 2025 15:14:33 +0800
Subject: [PATCH] bug修改,后台新增修改用户积分
---
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/GameDataController.java | 199 ++++++++++++++++++++++++++++---------------------
1 files changed, 114 insertions(+), 85 deletions(-)
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/GameDataController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/GameDataController.java
index 609b06e..a980951 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/GameDataController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/GameDataController.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.course.feignClient.other.model.Site;
+import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.base.controller.BaseController;
import com.dsh.guns.modular.system.model.*;
import com.dsh.guns.modular.system.service.ISiteBookingService;
@@ -67,7 +68,7 @@
if(cityCode==null){
cityCode="";
}
- String apiUrl1 = "https://try.daowepark.com/v7/user_api/general/cityGameRanking?space_id="+spaceId+"&type="+type+"&date="+date+"&city_code="+cityCode;
+ String apiUrl1 = "https://port.daowepark.com/v7/user_api/general/cityGameRanking?space_id="+spaceId+"&type="+type+"&date="+date+"&city_code="+cityCode;
URL url1 = null;
try {
url1 = new URL(apiUrl1);
@@ -102,8 +103,60 @@
}
return new ArrayList<>();
}
+
+ @RequestMapping("/listAll1")
+ @ResponseBody
+ public Object listAll1(String spaceId,String type,String date,String cityCode){
+ if(spaceId==null){
+ spaceId="";
+ }
+ if(type==null){
+ type="y";
+ }
+ if(date==null){
+ date="";
+ }
+ if(cityCode==null){
+ cityCode="";
+ }
+// String apiUrl1 = "https://port.daowepark.com/v7/user_api/general/accuracyGameRanking?space_id=1001"+spaceId+"&type="+type+"&date="+date+"&city_code="+cityCode;
+ String apiUrl1 = "https://port.daowepark.com/v7/user_api/general/accuracyGameRanking?space_id="+spaceId+"&type="+type+"&date="+date+"&city_code="+cityCode;
+ URL url1 = null;
+ try {
+ url1 = new URL(apiUrl1);
+ HttpURLConnection connection1 = (HttpURLConnection) url1.openConnection();
+ connection1.setRequestMethod("GET");
+ // 发送请求并获取响应
+ int responseCode1 = connection1.getResponseCode();
+ if (responseCode1 == HttpURLConnection.HTTP_OK) {
+ BufferedReader reader1 = new BufferedReader(new InputStreamReader(connection1.getInputStream()));
+ String line1;
+ StringBuilder response1 = new StringBuilder();
+ while ((line1 = reader1.readLine()) != null) {
+ response1.append(line1);
+ }
+ reader1.close();
+ // 处理响应数据
+ String data1 = response1.toString();
+ // 使用Jackson库将JSON字符串转换为Java对象
+ ObjectMapper objectMapper1 = new ObjectMapper();
+ AccuracyGameOne res1 = objectMapper1.readValue(data1, AccuracyGameOne.class);
+ List<AccuracyGameDataOne> data2 = res1.getData();
+ return data2;
+ }
+ } catch (ProtocolException e) {
+ e.printStackTrace();
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new ArrayList<>();
+ }
/**
- * 跳转到充值记录页面
+ * 跳转到智慧球场数据统计页面
*/
@RequestMapping("")
public String index(Model model) {
@@ -112,7 +165,7 @@
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 POST 请求
- HttpPost httpPost = new HttpPost("https://try.daowepark.com/v7/user_api/general/gameList");
+ HttpPost httpPost = new HttpPost("https://port.daowepark.com/v7/user_api/general/gameList");
// 设置请求体数据
String postData = "sign=0DB011836143EEE2C2E072967C9F4E4B&space_id=1001&sutu_id=1001";
@@ -142,9 +195,18 @@
}
}
List<TStore> stores = storeService.list(new QueryWrapper<TStore>());
- model.addAttribute("list", result);
model.addAttribute("stores", stores);
+ model.addAttribute("list", result);
model.addAttribute("sites", list);
+ if(UserExt.getUser().getObjectType() == 2){
+ List<TStore> operatorId = storeService.list(new QueryWrapper<TStore>()
+ .eq("operatorId", UserExt.getUser().getObjectId()));
+ model.addAttribute("stores", operatorId);
+ List<TSite> sites = siteService.list(new QueryWrapper<TSite>()
+ .eq("operatorId", UserExt.getUser().getObjectId()));
+ model.addAttribute("sites", sites);
+ }
+
return PREFIX + "GameData.html";
}
@@ -153,16 +215,16 @@
*/
@RequestMapping("/list")
@ResponseBody
- public Object list(Integer storeId) {
+ public Object list(String range,String storeId) {
Map<String, Object> result = new HashMap<>();
try {
// 年度数据
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 POST 请求
- HttpPost httpPost = new HttpPost("https://try.daowepark.com/v7/user_api/general/getBatterData");
+ HttpPost httpPost = new HttpPost("https://port.daowepark.com/v7/user_api/general/getBatterData");
// 设置请求体数据
- String postData = "sign=0DB011836143EEE2C2E072967C9F4E4B&space_id="+""+"&date_type=y";
+ String postData = "sign=0DB011836143EEE2C2E072967C9F4E4B&space_id="+storeId+"&date_type="+range+"&year=";
StringEntity entity = new StringEntity(postData, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(entity);
@@ -186,34 +248,7 @@
// 年度数据
result.put("yDataList", dataList);
}
- // 获取月度数据 (今年的十二个月数据)
- Calendar calendar = Calendar.getInstance();
- // 当前年份
- int year = calendar.get(Calendar.YEAR);
- // 月度数据
- // 创建 HttpClient 实例
- HttpClient httpClient1 = HttpClients.createDefault();
- // 创建 POST 请求
- HttpPost httpPost1 = new HttpPost("https://try.daowepark.com/v7/user_api/general/getBatterData");
- // 设置请求体数据
- String postData1 = "sign=0DB011836143EEE2C2E072967C9F4E4B&space_id=1001&date_type=m&year=2022";
- StringEntity entity1 = new StringEntity(postData1, ContentType.APPLICATION_FORM_URLENCODED);
- httpPost1.setEntity(entity1);
- // 执行请求
- HttpResponse response1 = httpClient1.execute(httpPost1);
- // 处理响应
- HttpEntity responseEntity1 = response1.getEntity();
- if (responseEntity1 != null) {
- String responseData = EntityUtils.toString(responseEntity1);
- ObjectMapper objectMapper = new ObjectMapper();
- Batter batter = objectMapper.readValue(responseData, Batter.class);
- result.put("totalNumber", batter.getData().getAll_batter_num());
- result.put("totalTime", batter.getData().getAll_batter_time());
- List<BatterData> dataList = batter.getData().getList();
- // 月度数据
- result.put("mDataList", dataList);
- }
} catch (Exception e) {
e.printStackTrace();
}
@@ -228,7 +263,7 @@
public Object listSUTU() {
Map<String, Object> result = new HashMap<>();
try {
- String apiUrl = "https://try.daowepark.com/v7/user_api/general/gameDataRate";
+ String apiUrl = "https://port.daowepark.com/v7/user_api/general/gameDataRate";
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
@@ -271,10 +306,10 @@
*/
@RequestMapping("/listSUTU1")
@ResponseBody
- public Object listSUTU1(String gameId, String time, String spaceId, String cityCode) {
+ public Object listSUTU1(String range,String gameId, String time, String spaceId, String cityCode) {
Map<String, Object> result = new HashMap<>();
try {
- String apiUrl = "https://try.daowepark.com/v7/user_api/general/getSingleGameData?game_id=" + gameId + "&date_type=" + "y" + "&date=" + "" + "&space_id=" + spaceId + "&city_code=" + cityCode;
+ String apiUrl = "https://port.daowepark.com/v7/user_api/general/getSingleGameData?game_id=" + gameId + "&date_type=" + range + "&date=" + time + "&space_id=" + spaceId + "&city_code=" + cityCode;
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
@@ -301,42 +336,6 @@
}
result.put("data1", list);
result.put("years", years);
- String monthUrl = "";
- // 月度
- if (!time.contains("-")) {
- monthUrl = "https://try.daowepark.com/v7/user_api/general/getSingleGameData?game_id=" + gameId + "&date_type=" + "m" + "&date=" + time + "&space_id=" + spaceId + "&city_code=" + cityCode;
- } else {
- monthUrl = "https://try.daowepark.com/v7/user_api/general/getSingleGameData?game_id=" + gameId + "&date_type=" + "d" + "&date=" + time + "&space_id=" + spaceId + "&city_code=" + cityCode;
- }
- URL url1 = new URL(monthUrl);
- HttpURLConnection connection1 = (HttpURLConnection) url1.openConnection();
- connection1.setRequestMethod("GET");
- // 发送请求并获取响应
- int responseCode1 = connection1.getResponseCode();
- if (responseCode1 == HttpURLConnection.HTTP_OK) {
- BufferedReader reader1 = new BufferedReader(new InputStreamReader(connection1.getInputStream()));
- String line1;
- StringBuilder response1 = new StringBuilder();
- while ((line1 = reader1.readLine()) != null) {
- response1.append(line1);
- }
- reader1.close();
- // 处理响应数据
- String data1 = response1.toString();
- // 使用Jackson库将JSON字符串转换为Java对象
- ObjectMapper objectMapper1 = new ObjectMapper();
- SUTUOne res1 = objectMapper1.readValue(data1, SUTUOne.class);
- List<SUTUDataOne> list2 = res1.getData().getList();
- List<String> monthOrDays = new ArrayList<>();
- for (SUTUDataOne sutuDataOne : list2) {
- monthOrDays.add(sutuDataOne.getDate());
- }
- result.put("data2", list2);
- result.put("monthOrDays", monthOrDays);
- return result;
- } else {
- System.out.println("请求失败: " + responseCode1);
- }
}
return result;
} catch (ProtocolException e) {
@@ -351,14 +350,14 @@
return result;
}
/**
- * 获取跨城赛统计
+ * 获取90°准度赛全球总数
*/
- @RequestMapping("/cityGame")
+ @RequestMapping("/cityGameOne")
@ResponseBody
- public Object cityGame() {
+ public Object cityGameOne() {
Map<String, Object> result = new HashMap<>();
try {
- String apiUrl = "https://try.daowepark.com/v7/user_api/general/getCityGameCount";
+ String apiUrl = "https://port.daowepark.com/v7/user_api/general/getAccuracyGameCount?space_id=";
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
@@ -377,14 +376,7 @@
// 使用Jackson库将JSON字符串转换为Java对象
ObjectMapper objectMapper = new ObjectMapper();
CityGame res = objectMapper.readValue(data, CityGame.class);
- // 场地总入场人数
- String totalNum = "";
- for (CityGameData datum : res.getData()) {
- totalNum = datum.getTotal_num();
- }
- result.put("totalNum", totalNum);
-
-
+ result.put("totalNum", res.getData().getTotal_num());
return result;
}
}
@@ -393,6 +385,43 @@
}
return result;
}
+
+ /**
+ * 获取跨城赛统计全球总数
+ */
+ @RequestMapping("/cityGame")
+ @ResponseBody
+ public Object cityGame() {
+ Map<String, Object> result = new HashMap<>();
+ try {
+ String apiUrl = "https://port.daowepark.com/v7/user_api/general/getCityGameCount";
+ URL url = new URL(apiUrl);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ // 发送请求并获取响应
+ int responseCode = connection.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String line;
+ StringBuilder response = new StringBuilder();
+ while ((line = reader.readLine()) != null) {
+ response.append(line);
+ }
+ reader.close();
+ // 处理响应数据
+ String data = response.toString();
+ // 使用Jackson库将JSON字符串转换为Java对象
+ ObjectMapper objectMapper = new ObjectMapper();
+ CityGame res = objectMapper.readValue(data, CityGame.class);
+ result.put("totalNum", res.getData().getTotal_num());
+ return result;
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
}
--
Gitblit v1.7.1