From bf0eb543e2deab8a1629dd2a46f8e1cd191531e1 Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期四, 17 七月 2025 15:22:01 +0800
Subject: [PATCH] Merge branch 'master' of http://103.135.160.14:9034/r/NslWeb

---
 src/api/hpApi.js |  287 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 269 insertions(+), 18 deletions(-)

diff --git a/src/api/hpApi.js b/src/api/hpApi.js
index b2e0f5b..9c220ff 100644
--- a/src/api/hpApi.js
+++ b/src/api/hpApi.js
@@ -4,7 +4,7 @@
 export async function fetchToken() {
   try {
     const response = await axios.post("/hp/auth/getToken", {
-      username: "yxxx",
+      username: "yunweiyonghu",
       password: "c2d6bba7f0a67701a97550684e39fa5f",
       systemName: "RS_SYSTEM",
     });
@@ -28,21 +28,272 @@
     });
   }, intervalTime);
 }
-// 鑾峰彇闆ㄩ噺鏁版嵁
-export async function getRainfallData(year) {
-  try {
-    const response = await axios.post("/hp/rainfallCountyCity/getData", {
-      filterObject: {
-        year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
-      },
-    });
-    console.log("Response:", response); // 鎵撳嵃瀹屾暣鍝嶅簲锛堣皟璇曠敤锛�
-    return response.data; // 鍋囪鍚庣杩斿洖鐨勬暟鎹湪 response.data 涓�
-  } catch (error) {
-    console.error(
-      "Error fetching rainfall data:",
-      error.response ? error.response.data : error.message
-    );
-    throw error; // 鎶涘嚭閿欒浠ヤ究璋冪敤鏂瑰鐞�
-  }
+
+// 鑾峰彇閬块櫓浣嶇疆
+export async function getSafeLocation(data) {
+  const response = await axios.post("/hp/safeHavenLocation/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getSafeLocation:", response);
+  return response.data;
 }
+
+// 鑾峰彇閬块櫓绾胯矾
+export async function getEscapeRoute(data) {
+  const response = await axios.post("/hp/escapeRoute/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getEscapeRoute:", response);
+  return response.data;
+}
+
+// 鑾峰彇浼犳劅鍣ㄥ垪琛�
+export async function getSensor(data) {
+  const response = await axios.post("/hp/sensor/getData", {
+    filterObject: {
+      year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟
+    },
+  });
+  console.log("getSensor:", response);
+  return response.data;
+}
+
+// 鑾峰彇闆ㄩ噺鏁版嵁
+export async function getRainfallData() {
+  const response = await axios.post("/hp/rainfallCountyCity/getData", {
+    filterObject: {},
+    "pageSize": 1000
+  });
+  console.log("getRainfallData:", response);
+  return response.data;
+}
+
+// 鎸夌収鍖椾含甯俢ode鏌ヨ琛屾斂鍖篶ode
+export async function getAeraCode() {
+  const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerCountByDistrict", {
+    "dictDisasterGrade": "",
+    "dictDisasterType": "",
+    "dictRiskLevel": "",
+    "districtCode": "110000000000",
+    "dictThreatObj": "",
+    "year": "2025"
+  });
+  return response.data;
+}
+
+// 鎸夌収琛屾斂鍖篶ode鏌ヨ涔¢晣code(姝ゆ帴鍙e寘鍚殣鎮g偣鏁伴噺鏌ヨ)
+export async function getAeraTownCode(data) {
+  const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerTownCount", {
+    "dictDisasterGrade": "",
+    "dictDisasterType": "",
+    "dictRiskLevel": "",
+    "districtCode": data,
+    "dictThreatObj": "",
+    "year": "2025"
+  });
+  return response.data;
+}
+
+// 鏍规嵁涔¢晣Code鑾峰彇闅愭偅鐐�(姝ゆ帴鍙e寘鍚殣鎮g偣鏁伴噺鏌ヨ)
+export async function getDangerPoint(data) {
+  const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getData", {
+    filterObject: {
+      "divisionTown": data,
+      "year": 2025
+    },
+    "pageSize": 10000
+  });
+  return response.data;
+}
+
+
+// 鍒嗛〉鑾峰彇琛屾斂鍖哄垝闅愭偅鐐逛俊鎭�
+export async function getDangerPointByPage(data, pageNum) {
+  const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getData", {
+    filterObject: {
+      "divisionCounty": data,
+      "year": 2025
+    },
+    "pageSize": 50,
+    "pageNum": pageNum,
+  });
+  return response.data;
+}
+
+
+// 鐩戞祴璁惧鎺ュ彛
+/**
+ * @param {string} data - 闆ㄩ噺璁¤澶囩被鍨媔d
+ * @param {string} townCode - 涔¢晣code,鍙互鏌ヨ涔¢晣鐩戞祴璁惧淇℃伅
+ */
+export async function getDeviceInfo(data, townCode) {
+  const response = await axios.post("/hp/deviceInfo/getData", {
+    filterObject: {
+      "dictCommunicationType": data,
+      "townCodeList": [townCode],
+      "year": 2025,
+      // 鎵�灞為」鐩�
+      "belongObjList": [
+        "1797461961110261762"
+      ],
+    },
+    "pageSize": 10000
+  });
+  return response.data;
+}
+
+// 鎺ュ彛澶氬啓鍑犱釜搴旇鏃犲Θ鍚�
+export async function getDeviceNWJ(data, townCode) {
+  const response = await axios.post("/hp/deviceInfo/getData", {
+    filterObject: {
+      "dictDeviceTypeList": [data],
+      "townCodeList": [townCode],
+      "year": 2025,
+    },
+    "pageSize": 10000
+  });
+  return response.data;
+}
+
+// 鏌ヨ瀛欒儭娌熺洃娴嬭澶囷紝dictCommunicationType涓烘煡璇㈠瓩鑳℃矡鐨勯洦閲忚
+export async function getDeviceInfoSHG(data) {
+  const response = await axios.post("/hp/deviceInfo/getData", {
+    filterObject: {
+      "dictCommunicationType": data,
+      "townCodeList": ["110116110000"],
+      "year": 2025,
+    },
+    "pageSize": 10000
+
+  });
+  return response.data;
+}
+
+
+// 鍒嗛〉鏌ヨ琛屾斂鍖哄垝鐩戞祴璁惧淇℃伅
+export async function getDeviceInfoByPage(data, pageNum) {
+  const response = await axios.post("/hp/deviceInfo/getData", {
+    filterObject: {
+      "divisionDistrictList": [data],
+      // 鎵�灞為」鐩�
+      // 濡傛灉涓嶅姞杩欎釜锛屽垯杩斿洖鐨勫叏鏄己闇囦华锛�1933099069385355265锛�
+      "belongObjList": [
+        "1797461961110261762"
+      ],
+    },
+    "pageSize": 50,
+    "pageNum": pageNum
+  });
+  return response.data;
+}
+
+
+// 鏍规嵁骞翠唤鑾峰彇闆ㄩ噺鏁版嵁
+export async function getRainfallDataYears(data) {
+  const response = await axios.post("/hp/rainfallCountyCity/getData", {
+    filterObject: {
+      year: data
+    },
+    "pageSize": 1000
+  });
+  return response.data;
+}
+
+// 鏌ヨ闆ㄩ噺璁¤鏁�
+export async function getYLJData(data) {
+  // 鑾峰彇褰撳墠鏃堕棿
+  const now = new Date();
+
+  // 璁$畻涓�灏忔椂鍓嶇殑鏃堕棿
+  const oneHourAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000);
+
+  // 鏍煎紡鍖栨椂闂翠负YYYY-MM-DD HH:mm:ss
+  const formatTime = (date) => {
+    const pad = (num) => num.toString().padStart(2, '0');
+    return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
+  };
+
+  const response = await axios.post("/hp/ylclyPacket/getData", {
+    "currentPage": 1,
+    "pageSize": 20,
+    "filterObject": {
+      "deviceName": "",
+      "deviceCode": data,
+      "sendTimeList": [
+        formatTime(oneHourAgo),  // 涓�灏忔椂鍓�
+        formatTime(now)         // 褰撳墠鏃堕棿
+      ],
+      "divisionDistrict": "110116000000",
+      "townCode": "110116110000",
+      "dictPacketsDataStatus": "1887255639886540806",
+    }
+  });
+
+  console.log("getYLJData:", response);
+  return response.data;
+}
+
+
+
+// 鏌ヨ鍖椾含甯傜洃娴嬭澶囩殑鏁伴噺
+export async function getDeviceCount(params = {}) {
+  const response = await axios.get("/hp/device/statisticsCountyByDeviceType", {
+    params
+  });
+  return response.data;
+}
+
+// 鏌ヨ鍖椾含甯傞伩闄╁満鎵�
+export async function getSafePoint(data) {
+  const response = await axios.get("/hp/safeHavenLocation/getDataSelect", {
+    params: {
+      divisionId: data
+    }
+  });
+  return response.data;
+}
+// 110116110218
+
+
+
+// 鏌ヨ鍖椾含甯�
+export async function getAllCode() {
+  const response = await axios.get("/hp/district/getAll");
+  return response.data;
+}
+
+// 鑾峰彇澶╂皵棰勬姤
+export async function getWeather() {
+  // 鑾峰彇褰撳墠鏃堕棿鎴�
+  const currentTimestamp = Date.now();
+
+  // 鍒涘缓Date瀵硅薄
+  const currentDate = new Date(currentTimestamp);
+
+  // 鏍煎紡鍖栦负骞�-鏈�-鏃ワ紙YYYY-MM-DD锛�
+  const year = currentDate.getFullYear();
+  const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝鎵�浠ヨ+1
+  const day = String(currentDate.getDate()).padStart(2, '0');
+  const formattedDate = `${year}-${month}-${day}`;
+
+  const response = await axios.get("/hp/weatherForecast/getSevenDaysWeather", {
+    params: {
+      inputDate: formattedDate
+    }
+  });
+  return response.data;
+}
+
+// 鐩戞祴璁惧涓叧鑱旂殑闅愭偅鐐圭殑鍏蜂綋淇℃伅
+export async function hdByDevice(data) {
+  const response = await axios.get("/hp/sinoDzHiddenDangerPoint/getDetail", {
+    params: {
+      unifiedCode: data
+    }
+  });
+  return response.data;
+}
\ No newline at end of file

--
Gitblit v1.9.3