From 94957a09881d41800588afeb6b357c29d2f2cdc3 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期三, 06 九月 2023 15:14:41 +0800
Subject: [PATCH] 设备健康列表
---
ard-work/pom.xml | 6 +
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java | 5 +
ard-work/src/main/java/com/ruoyi/utils/soap/ARDSoapUtil.java | 64 +++++++++++++++++++++
ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java | 65 +++++++++++++++++++++
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java | 10 +++
5 files changed, 149 insertions(+), 1 deletions(-)
diff --git a/ard-work/pom.xml b/ard-work/pom.xml
index cb68f01..a0196e6 100644
--- a/ard-work/pom.xml
+++ b/ard-work/pom.xml
@@ -181,7 +181,11 @@
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.1</version>
</dependency>
-
+ <dependency>
+ <groupId>commons-discovery</groupId>
+ <artifactId>commons-discovery</artifactId>
+ <version>0.2</version>
+ </dependency>
</dependencies>
diff --git a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
new file mode 100644
index 0000000..fa34022
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
@@ -0,0 +1,65 @@
+package com.ruoyi.health.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.utils.result.Results;
+import com.ruoyi.utils.soap.ARDSoapUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Administrator
+ */
+@RestController
+@RequestMapping("/health")
+@Api(tags = "璁惧鍋ュ悍绠$悊")
+public class HealthController {
+
+ @Autowired
+ ISysConfigService configService;
+
+ @PreAuthorize("@ss.hasPermi('sy:syCar:getSDKCarPositionByRight')")
+ @ApiOperation("鑾峰彇璁惧鍒楄〃")
+ @GetMapping("getEquipmentList")
+ public Results getEquipmentList(){
+ String url = configService.getHealth();
+ JSONObject j = new JSONObject();
+
+ Map<String, Object> map = new HashMap();
+ String result = ARDSoapUtil.postSoapResult(url, "GetEquipmentList", map);
+ if ("".equals(result)) {
+ //杩斿洖缁撴灉涓虹┖
+ return Results.error("鏌ヨ澶辫触锛�");
+ }
+ Map<String, Object> mapResult = (Map<String, Object>) JSON.parse((String) result);
+ if ((int) mapResult.get("code") == 200) {
+ j.put("code", mapResult.get("code"));
+ List<Map<String, Object>> listResult = (List<Map<String, Object>>) JSON.parse((String) mapResult.get("resdata"));
+ for (int i = 0; i < listResult.size(); i++) {
+ Map<String, Object> mapTemp = listResult.get(i);
+ int id = (Integer) mapTemp.get("id"); //涓婚敭id
+ String equipKey = (String) mapTemp.get("EquipKey"); //璁惧Key
+ String equipNumber = (String) mapTemp.get("EquipNumber"); //璁惧缂栧彿
+ String equipName = (String) mapTemp.get("EquipName"); //璁惧鍚嶇О
+ String equipLevel = (String) mapTemp.get("EquipLevel"); //璁惧鎶ヨ绛夌骇 0姝e父 1娉ㄦ剰 2涓ラ噸
+ String measureDate = (String) mapTemp.get("MeasureDate"); //鏈�杩戜竴娆℃祴閲忔椂闂�
+ j.put(id + "", mapTemp);
+ }
+ } else {
+ //閿欒鎻愮ず
+ j.put("errmsg", mapResult.get("errmsg"));
+ j.put("code", mapResult.get("code"));
+ }
+ return Results.succeed(j);
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/soap/ARDSoapUtil.java b/ard-work/src/main/java/com/ruoyi/utils/soap/ARDSoapUtil.java
new file mode 100644
index 0000000..bce2914
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/utils/soap/ARDSoapUtil.java
@@ -0,0 +1,64 @@
+package com.ruoyi.utils.soap;
+
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+import org.apache.axis.encoding.XMLType;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**璁惧鍋ュ悍鎺ュ彛
+ * 20221130
+ * zj
+ * */
+public class ARDSoapUtil {
+ private static String url = "http://221.1.80.74:15024/ZX/ZX2WebService.asmx";
+
+ /**post鏂规硶鑾峰彇鏁版嵁
+ * String url ,
+ * **/
+ public static String postSoapResult(String url , String method ,Map<String , Object> map){
+ try {
+ //瀛楃闆�
+ String encodingStyle = "utf-8";
+ //WSDL鐨勫湴鍧�
+ String endpoint = url + "?wsdl";
+ //鍛藉悕绌洪棿锛屽湪WSDL涓搴旂殑鏍囩鏄細鍙傝璇存槑绗�3鏉�
+ String targetNamespace = "http://tempuri.org/";
+ //鍏蜂綋鏂规硶鐨勮皟鐢║RI锛屽湪WSDL涓搴旂殑鏍囩鏄細鍙傝璇存槑绗�4鏉�
+ String soapActionURI = "http://tempuri.org/" + method;
+ //鍏蜂綋璋冪敤鐨勬柟娉曞悕锛屽湪WSDL涓搴旂殑鏍囩鏄細鍙傝璇存槑绗�5鏉�
+
+ Service service = new Service();
+ Call call = (Call) service.createCall();
+ call.setSOAPActionURI(soapActionURI);
+ call.setTargetEndpointAddress(new java.net.URL(endpoint)); //璁剧疆鐩爣鎺ュ彛鐨勫湴鍧�
+ call.setEncodingStyle(encodingStyle);//璁剧疆浼犲叆鏈嶅姟绔殑瀛楃闆嗘牸寮忓utf-8绛�
+ call.setOperationName(new QName(targetNamespace,method));// 鍏蜂綋璋冪敤鐨勬柟娉曞悕锛屽彲浠ョ敱鎺ュ彛鎻愪緵鏂瑰憡璇変綘锛屼篃鍙互鑷繁浠嶹SDL涓壘
+ call.setUseSOAPAction(true);
+// call.setReturnType(XMLType.XSD_STRING);
+ Object[] o = new Object[map.size()];
+ int i=0;
+ for (String key :map.keySet() ){
+ call.addParameter(new QName(targetNamespace , key),
+ XMLType.XSD_INTEGER,
+ javax.xml.rpc.ParameterMode.IN);
+ o[i] = map.get(key);
+ i++;
+ }
+ String result = (String) call.invoke(o);
+ // 鎵撳嵃杩斿洖鍊�
+ System.out.println("result is :"+result);
+ return result;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "";
+ }
+
+ }
+
+}
+
+
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
index 6aebca6..6305d48 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
@@ -93,4 +93,9 @@
*/
String getSYURL();
+ /**
+ * 璁惧鍋ュ悍绠$悊
+ * @return
+ */
+ String getHealth();
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
index 3a42b75..95141d2 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
@@ -240,4 +240,14 @@
return "";
}
}
+
+ @Override
+ public String getHealth() {
+ List<SysConfig> result = configMapper.selectByType("health");
+ if(result.size() > 0){
+ return result.get(0).getConfigValue();
+ }else{
+ return "";
+ }
+ }
}
--
Gitblit v1.9.3