Commit 79ab2763 authored by 高东东's avatar 高东东

修改换流站天气获取,以及新增区域接口

parent 78c1b9b2
...@@ -39,6 +39,33 @@ public class RiskSourceTreeResponse { ...@@ -39,6 +39,33 @@ public class RiskSourceTreeResponse {
private Integer omission; private Integer omission;
private Integer unplan; private Integer unplan;
private Long value;
private Long pId;
private String title;
private String lable;
public Long getValue() {
return id;
}
public Long getpId() {
return parentId;
}
public String getTitle() {
return name;
}
public String getLable() {
return name;
}
private List<RiskSourceTreeResponse> children; private List<RiskSourceTreeResponse> children;
public String getPosition3d() { public String getPosition3d() {
......
...@@ -115,6 +115,21 @@ public class RiskSourceController extends BaseController { ...@@ -115,6 +115,21 @@ public class RiskSourceController extends BaseController {
return CommonResponseUtil.success(getRiskSourcesTree(riskSources)); return CommonResponseUtil.success(getRiskSourcesTree(riskSources));
} }
/**
* 获取区域树型结构
*
* @return
*/
//@Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "获取区域树型结构", notes = "获取区域树型结构")
@RequestMapping(value = "/regionTress", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse getRegionTress() {
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
List<RiskSourceTreeResponse> riskSources = riskSourceService.findRiskSourceTrees(compCode);
return CommonResponseUtil.success(getRegionTree(riskSources));
}
//@Authorization(ingore = true) //@Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "统计级别为1的风险点下面", notes = "获取风险点树型结构") @ApiOperation(httpMethod = "GET", value = "统计级别为1的风险点下面", notes = "获取风险点树型结构")
@RequestMapping(value = "/query3DStatistics/{markerType}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/query3DStatistics/{markerType}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
...@@ -482,6 +497,24 @@ public class RiskSourceController extends BaseController { ...@@ -482,6 +497,24 @@ public class RiskSourceController extends BaseController {
return treeList; return treeList;
} }
private static List<RiskSourceTreeResponse> getRegionTree(List<RiskSourceTreeResponse> list) {
List<RiskSourceTreeResponse> treeList = new ArrayList<RiskSourceTreeResponse>();
for (RiskSourceTreeResponse tree : list) {
if (tree.getParentId() != null && tree.getParentId() == 0) {
treeList.add(tree);
}
for (RiskSourceTreeResponse treeNode : list) {
if (treeNode.getParentId().longValue() == tree.getId() && "TRUE".equals(treeNode.getIsRegion())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
return treeList;
}
/** /**
* 根据风险点查询关联巡检点 * 根据风险点查询关联巡检点
*/ */
......
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.zip.GZIPInputStream;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -43,23 +46,27 @@ public class WeatherController extends BaseController { ...@@ -43,23 +46,27 @@ public class WeatherController extends BaseController {
URLConnection connection = realUrl.openConnection(); URLConnection connection = realUrl.openConnection();
// 设置通用的请求属性 // 设置通用的请求属性
connection.setRequestProperty("accept", "*/*"); connection.setRequestProperty("Accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive"); connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// connection.setRequestProperty("Charset", "utf-8");
connection.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
connection.setUseCaches(false);
// 建立实际的连接 // 建立实际的连接
connection.connect(); connection.connect();
// 获取所有响应头字段 StringBuffer sb = new StringBuffer();
Map<String, List<String>> map = connection.getHeaderFields(); String readLine = new String();
GZIPInputStream gZipS=new GZIPInputStream(connection.getInputStream());
// 定义 BufferedReader输入流来读取URL的响应 InputStreamReader res = new InputStreamReader(gZipS,"UTF-8");
in = new BufferedReader(new InputStreamReader( BufferedReader responseReader = new BufferedReader(res);
connection.getInputStream())); while ((readLine = responseReader.readLine()) != null) {
String line; sb.append(readLine);
while ((line = in.readLine()) != null) {
result += line;
} }
responseReader.close();
result = sb.toString();
System.out.println(result);
} catch (Exception e) { } catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e); System.out.println("发送GET请求出现异常!" + e);
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
......
...@@ -30,10 +30,10 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor ...@@ -30,10 +30,10 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
params.remoteRuleUrl=http://magintursh.xicp.net:18080/ params.remoteRuleUrl=http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl=http://172.16.10.91:10600/ params.remoteWebsocketUrl=http://172.16.10.91:10600/
spring.redis.database=5 spring.redis.database=0
spring.redis.host=172.16.11.33 spring.redis.host=172.16.10.85
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=1234560 spring.redis.password=amos2019Redis
spring.redis.jedis.pool.max-active=200 spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.max-idle=10
......
spring.application.name = Amos-autosys spring.application.name = Amos-autosys-gdd
server.port = 8083 server.port = 8083
...@@ -52,4 +52,5 @@ windows.img.path = F:\\ ...@@ -52,4 +52,5 @@ windows.img.path = F:\\
linux.img.path = / linux.img.path = /
param.safetyIndexChange.cron = 0 0 2 * * ? param.safetyIndexChange.cron = 0 0 2 * * ?
param.weather.url = http://t.weather.sojson.com/api/weather/city/ #param.weather.url = http://t.weather.sojson.com/api/weather/city/
param.weather.url = http://wthrcdn.etouch.cn/weather_mini?citykey=
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment