Compare commits
No commits in common. "7f1b578c5f1058b4340ed79a14710e4b327e4c78" and "26b652bcd07b3901bcbbab407d0a77694516db7c" have entirely different histories.
7f1b578c5f
...
26b652bcd0
170
.drone.yml
170
.drone.yml
@ -25,35 +25,35 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
|
|
||||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
||||||
|
|
||||||
# - mkdir -p /app/build/yudao-gateway/target
|
- mkdir -p /app/build/yudao-gateway/target
|
||||||
# - cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target
|
- cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target
|
||||||
# - cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway
|
- cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway
|
||||||
# - cp ./yudao-gateway/run.sh /app/build/yudao-gateway
|
- cp ./yudao-gateway/run.sh /app/build/yudao-gateway
|
||||||
#
|
|
||||||
# - mkdir -p /app/build/yudao-module-system/target
|
- mkdir -p /app/build/yudao-module-system/target
|
||||||
# - cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target
|
- cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target
|
||||||
# - cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system
|
- cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system
|
||||||
# - cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system
|
- cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system
|
||||||
#
|
|
||||||
# - mkdir -p /app/build/yudao-module-infra/target
|
- mkdir -p /app/build/yudao-module-infra/target
|
||||||
# - cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target
|
- cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target
|
||||||
# - cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra
|
- cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra
|
||||||
# - cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra
|
- cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra
|
||||||
#
|
|
||||||
# - mkdir -p /app/build/ludu-job-admin/target
|
- mkdir -p /app/build/ludu-job-admin/target
|
||||||
# - cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target
|
- cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target
|
||||||
# - cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin
|
- cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin
|
||||||
# - cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin
|
- cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin
|
||||||
#
|
|
||||||
# - mkdir -p /app/build/ludu-module-ticketing/target
|
- mkdir -p /app/build/ludu-module-ticketing/target
|
||||||
# - cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target
|
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target
|
||||||
# - cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing
|
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing
|
||||||
# - cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing
|
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing
|
||||||
#
|
|
||||||
# - mkdir -p /app/build/ludu-module-parking/target
|
- mkdir -p /app/build/ludu-module-parking/target
|
||||||
# - cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target
|
- cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target
|
||||||
# - cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking
|
- cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking
|
||||||
# - cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
|
- cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-module-datacenter/target
|
- mkdir -p /app/build/ludu-module-datacenter/target
|
||||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
||||||
@ -81,9 +81,9 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
script:
|
script:
|
||||||
|
|
||||||
- echo "start copy"
|
- echo "start copy"
|
||||||
# - cd /ludu/maven
|
- cd /ludu/maven
|
||||||
# - tar -cf ludu-build.tar ./build
|
- tar -cf ludu-build.tar ./build
|
||||||
# - scp ludu-build.tar root@121.36.203.133:/ludu/maven
|
- scp ludu-build.tar root@121.36.203.133:/ludu/maven
|
||||||
# - scp -r /ludu/maven/build/yudao-gateway root@121.36.203.133:/ludu/maven/build
|
# - scp -r /ludu/maven/build/yudao-gateway root@121.36.203.133:/ludu/maven/build
|
||||||
# - echo "gateway done"
|
# - echo "gateway done"
|
||||||
# - scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
|
# - scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
|
||||||
@ -96,78 +96,78 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
# - echo "infra done"
|
# - echo "infra done"
|
||||||
# - scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
|
# - scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
|
||||||
# - echo "job done"
|
# - echo "job done"
|
||||||
- scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
|
# - scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
|
||||||
- echo "datacenter done"
|
# - echo "system done"
|
||||||
|
|
||||||
- name: build-other-service
|
# - name: build-other-service
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
|
|
||||||
settings:
|
|
||||||
|
|
||||||
host: 120.46.37.243 # 远程连接地址
|
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password2 # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 5m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script:
|
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-module-datacenter/
|
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
|
||||||
- ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
# - name: object-build
|
|
||||||
#
|
#
|
||||||
# image: appleboy/drone-ssh # SSH工具镜像
|
# image: appleboy/drone-ssh # SSH工具镜像
|
||||||
#
|
#
|
||||||
# settings:
|
# settings:
|
||||||
#
|
#
|
||||||
# host: 121.36.203.133 # 远程连接地址
|
# host: 120.46.37.243 # 远程连接地址
|
||||||
#
|
#
|
||||||
# username: root # 远程连接账号
|
# username: root # 远程连接账号
|
||||||
#
|
#
|
||||||
# password:
|
# password:
|
||||||
#
|
#
|
||||||
# from_secret: ssh_password3 # 从Secret中读取SSH密码
|
# from_secret: ssh_password2 # 从Secret中读取SSH密码
|
||||||
#
|
#
|
||||||
# port: 22 # 远程连接端口
|
# port: 22 # 远程连接端口
|
||||||
#
|
#
|
||||||
# command_timeout: 20m # 远程执行命令超时时间
|
# command_timeout: 5m # 远程执行命令超时时间
|
||||||
#
|
#
|
||||||
# script:
|
# script:
|
||||||
# - cd /ludu/maven
|
|
||||||
# - rm -rf ./build
|
|
||||||
# - tar -xf ludu-build.tar -C ./
|
|
||||||
#
|
#
|
||||||
# - cd /ludu/maven/build/yudao-gateway/
|
# - cd /ludu/maven/build/ludu-module-datacenter/
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
|
||||||
# - ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
#
|
|
||||||
# - cd /ludu/maven/build/yudao-module-system/
|
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||||
# - ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
# - ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
||||||
#
|
- name: object-build
|
||||||
# - cd /ludu/maven/build/ludu-module-ticketing/
|
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
image: appleboy/drone-ssh # SSH工具镜像
|
||||||
# - ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
#
|
settings:
|
||||||
# - cd /ludu/maven/build/ludu-module-parking/
|
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
host: 121.36.203.133 # 远程连接地址
|
||||||
# - ./run.sh || echo "ludu-module-parking build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
#
|
username: root # 远程连接账号
|
||||||
# - cd /ludu/maven/build/yudao-module-infra/
|
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
password:
|
||||||
# - ./run.sh || echo "yudao-module-infra build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
#
|
from_secret: ssh_password3 # 从Secret中读取SSH密码
|
||||||
# - cd /ludu/maven/build/ludu-job-admin/
|
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
port: 22 # 远程连接端口
|
||||||
# - ./run.sh || echo "ludu-job-admin build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
|
command_timeout: 20m # 远程执行命令超时时间
|
||||||
|
|
||||||
|
script:
|
||||||
|
- cd /ludu/maven
|
||||||
|
- rm -rf ./build
|
||||||
|
- tar -xf ludu-build.tar -C ./
|
||||||
|
|
||||||
|
- cd /ludu/maven/build/yudao-gateway/
|
||||||
|
- chmod +x ./run.sh # 更改为可执行脚本
|
||||||
|
- ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
||||||
|
|
||||||
|
- cd /ludu/maven/build/yudao-module-system/
|
||||||
|
- chmod +x ./run.sh # 更改为可执行脚本
|
||||||
|
- ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
||||||
|
|
||||||
|
- cd /ludu/maven/build/ludu-module-ticketing/
|
||||||
|
- chmod +x ./run.sh # 更改为可执行脚本
|
||||||
|
- ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
||||||
|
|
||||||
|
- cd /ludu/maven/build/ludu-module-parking/
|
||||||
|
- chmod +x ./run.sh # 更改为可执行脚本
|
||||||
|
- ./run.sh || echo "ludu-module-parking build failed" # 运行脚本打包应用镜像并运行
|
||||||
|
|
||||||
|
- cd /ludu/maven/build/yudao-module-infra/
|
||||||
|
- chmod +x ./run.sh # 更改为可执行脚本
|
||||||
|
- ./run.sh || echo "yudao-module-infra build failed" # 运行脚本打包应用镜像并运行
|
||||||
|
|
||||||
|
- cd /ludu/maven/build/ludu-job-admin/
|
||||||
|
- chmod +x ./run.sh # 更改为可执行脚本
|
||||||
|
- ./run.sh || echo "ludu-job-admin build failed" # 运行脚本打包应用镜像并运行
|
||||||
|
|
||||||
volumes: # 定义流水线挂载目录,用于共享数据
|
volumes: # 定义流水线挂载目录,用于共享数据
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.datacenter.controller.app.weather;
|
|||||||
import cn.iocoder.yudao.module.datacenter.controller.app.weather.vo.WeatherInfoVO;
|
import cn.iocoder.yudao.module.datacenter.controller.app.weather.vo.WeatherInfoVO;
|
||||||
import cn.iocoder.yudao.module.datacenter.utlis.GoodWeatherUtil;
|
import cn.iocoder.yudao.module.datacenter.utlis.GoodWeatherUtil;
|
||||||
import cn.iocoder.yudao.module.datacenter.utlis.ResponseVO;
|
import cn.iocoder.yudao.module.datacenter.utlis.ResponseVO;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -20,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RequestMapping("/h5/weather")
|
@RequestMapping("/h5/weather")
|
||||||
@Validated
|
@Validated
|
||||||
public class WeatherApi {
|
public class WeatherApi {
|
||||||
|
|
||||||
@GetMapping(value = "/getWeather")
|
@GetMapping(value = "/getWeather")
|
||||||
@Operation(summary = "获得输入城市的天气")
|
@Operation(summary = "获得输入城市的天气")
|
||||||
public ResponseVO getWeather(String cityCode) {
|
public ResponseVO getWeather(String cityCode) {
|
||||||
@ -28,18 +25,4 @@ public class WeatherApi {
|
|||||||
WeatherInfoVO weatherInfo = GoodWeatherUtil.GetWeather(weatherData);
|
WeatherInfoVO weatherInfo = GoodWeatherUtil.GetWeather(weatherData);
|
||||||
return new ResponseVO(200,"",weatherInfo,0);
|
return new ResponseVO(200,"",weatherInfo,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取未来三天天气预报
|
|
||||||
* @param cityCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/getFutureWeather")
|
|
||||||
public ResponseVO getFutureWeather(String cityCode) {
|
|
||||||
String weatherData = GoodWeatherUtil.getFutureWeather(cityCode);
|
|
||||||
JSONObject dataOfJson = JSONObject.parseObject(weatherData);
|
|
||||||
JSONArray forecasts = dataOfJson.getJSONArray("forecasts");
|
|
||||||
return new ResponseVO(200,"",forecasts,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,28 +26,19 @@ public class AssetServiceImpl implements AssetService {
|
|||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> countAsset() {
|
public List<Map<String, String>> countAsset() {
|
||||||
List<Asset> assetList = assetRepository.findAll();
|
List<Asset> assetList = assetRepository.findAll();
|
||||||
int[] assetTypeCounts = new int[6];
|
int[] assetTypeCounts = new int[3];
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
for (Asset asset : assetList) {
|
for (Asset asset : assetList) {
|
||||||
String assettype = asset.getAssettype();
|
String assettype = asset.getAssettype();
|
||||||
switch (assettype) {
|
switch (assettype) {
|
||||||
case "C":
|
case "C":
|
||||||
assetTypeCounts[0]++;
|
assetTypeCounts[0]++;
|
||||||
if ("1".equals(asset.getIsOnline())){
|
|
||||||
assetTypeCounts[3]++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "D":
|
case "D":
|
||||||
assetTypeCounts[1]++;
|
assetTypeCounts[1]++;
|
||||||
if ("1".equals(asset.getIsOnline())){
|
|
||||||
assetTypeCounts[4]++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "F":
|
case "F":
|
||||||
assetTypeCounts[2]++;
|
assetTypeCounts[2]++;
|
||||||
if ("1".equals(asset.getIsOnline())){
|
|
||||||
assetTypeCounts[5]++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -61,15 +52,6 @@ public class AssetServiceImpl implements AssetService {
|
|||||||
Map<String, String> map1=new LinkedHashMap<>();
|
Map<String, String> map1=new LinkedHashMap<>();
|
||||||
map1.put("assettype",stringStringEntry.getKey());
|
map1.put("assettype",stringStringEntry.getKey());
|
||||||
map1.put("count",stringStringEntry.getValue());
|
map1.put("count",stringStringEntry.getValue());
|
||||||
if ("其他电子设备".equals(stringStringEntry.getKey())){
|
|
||||||
map1.put("onlineCount",String.valueOf(assetTypeCounts[3]));
|
|
||||||
}
|
|
||||||
if ("运输设备".equals(stringStringEntry.getKey())){
|
|
||||||
map1.put("onlineCount",String.valueOf(assetTypeCounts[4]));
|
|
||||||
}
|
|
||||||
if ("手持机".equals(stringStringEntry.getKey())){
|
|
||||||
map1.put("onlineCount",String.valueOf(assetTypeCounts[5]));
|
|
||||||
}
|
|
||||||
mapList.add(map1);
|
mapList.add(map1);
|
||||||
}
|
}
|
||||||
return mapList;
|
return mapList;
|
||||||
|
@ -18,14 +18,15 @@ public class GoodWeatherUtil {
|
|||||||
//高德地图
|
//高德地图
|
||||||
private static final String WEATHER_SERVICES_URL = "https://restapi.amap.com/v3/weather/weatherInfo?city=";
|
private static final String WEATHER_SERVICES_URL = "https://restapi.amap.com/v3/weather/weatherInfo?city=";
|
||||||
private static final String WEATHER_KEY = "&key=172993e9541be0a4f824feedeb210b7e";
|
private static final String WEATHER_KEY = "&key=172993e9541be0a4f824feedeb210b7e";
|
||||||
private static final String WEATHER_TYPE = "&extensions=all";
|
|
||||||
|
//和风天气
|
||||||
|
private static final String WEATHER_SERVICES_URL2 = "https://geoapi.qweather.com/v2/city/lookup?";
|
||||||
|
private static final String LOCATION = "location="; //区县名称
|
||||||
|
private static final String ADM = "&adm="; //城市名称
|
||||||
|
private static final String PRIVATE_KEY = "&key=1c0db79d181441258030a633197fb429";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 今日实况天气
|
|
||||||
* @param cityCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getWeatherData(String cityCode){
|
public static String getWeatherData(String cityCode){
|
||||||
int codelength = cityCode.length();
|
int codelength = cityCode.length();
|
||||||
if (6 != codelength){
|
if (6 != codelength){
|
||||||
@ -52,39 +53,6 @@ public class GoodWeatherUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取未来三天天气预报
|
|
||||||
* @param cityCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getFutureWeather(String cityCode){
|
|
||||||
int codelength = cityCode.length();
|
|
||||||
if (6 != codelength){
|
|
||||||
return "500";
|
|
||||||
}
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
try {
|
|
||||||
String weather_url = WEATHER_SERVICES_URL + cityCode + WEATHER_KEY + WEATHER_TYPE;
|
|
||||||
URL url = new URL(weather_url);
|
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
|
||||||
connection.setRequestProperty("Charset", "utf-8");
|
|
||||||
connection.connect();
|
|
||||||
//读取URL的响应
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
|
|
||||||
String line = null;
|
|
||||||
while ((line = reader.readLine()) != null)
|
|
||||||
sb.append(line + " ");
|
|
||||||
reader.close();
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 将JSON格式数据进行解析 ,返回一个weather对象
|
* 将JSON格式数据进行解析 ,返回一个weather对象
|
||||||
*/
|
*/
|
||||||
@ -92,6 +60,7 @@ public class GoodWeatherUtil {
|
|||||||
if ("500".equals(weatherInfobyJson)){
|
if ("500".equals(weatherInfobyJson)){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject dataOfJson = JSONObject.parseObject(weatherInfobyJson);
|
JSONObject dataOfJson = JSONObject.parseObject(weatherInfobyJson);
|
||||||
System.out.println(dataOfJson);
|
System.out.println(dataOfJson);
|
||||||
//创建WeatherInfo对象,提取所需的天气信息
|
//创建WeatherInfo对象,提取所需的天气信息
|
||||||
@ -119,4 +88,76 @@ public class GoodWeatherUtil {
|
|||||||
return weatherInfoVO;
|
return weatherInfoVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// public static String getWeatherDataHF(String areaName,String cityName){
|
||||||
|
// if (areaName == null && cityName == null){
|
||||||
|
// return "500";
|
||||||
|
// }
|
||||||
|
// StringBuffer sb = new StringBuffer();
|
||||||
|
// try {
|
||||||
|
// String weather_url = WEATHER_SERVICES_URL2+LOCATION+areaName+ADM+cityName+PRIVATE_KEY;
|
||||||
|
// URL url = new URL(weather_url);
|
||||||
|
// HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
// connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
// connection.setRequestProperty("Charset", "utf-8");
|
||||||
|
// connection.connect();
|
||||||
|
// //读取URL的响应
|
||||||
|
// BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
|
||||||
|
// String line = null;
|
||||||
|
// while ((line = reader.readLine()) != null)
|
||||||
|
// sb.append(line + " ");
|
||||||
|
// reader.close();
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// return sb.toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 将JSON格式数据进行解析 ,返回一个weather对象
|
||||||
|
*/
|
||||||
|
// public static String GetWeatherHF(String weatherInfobyJson) {
|
||||||
|
// if ("500".equals(weatherInfobyJson)){
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// JSONObject dataOfJson = JSONObject.parseObject(weatherInfobyJson);
|
||||||
|
// System.out.println(dataOfJson);
|
||||||
|
// //创建WeatherInfo对象,提取所需的天气信息
|
||||||
|
// WeatherInfoVO weatherInfoVO = new WeatherInfoVO();
|
||||||
|
//
|
||||||
|
// //从json数据中提取数据
|
||||||
|
// JSONArray location = dataOfJson.getJSONArray("location");
|
||||||
|
// JSONObject weather = location.getJSONObject(0);
|
||||||
|
//
|
||||||
|
// // 取得当天的天气信息
|
||||||
|
// weatherInfoVO.setWeatherInfo(weather.getString("weather"));
|
||||||
|
//
|
||||||
|
// // 设置气温
|
||||||
|
// String temperature = weather.getString("temperature");
|
||||||
|
// weatherInfoVO.setTemperature(Integer.parseInt(temperature));
|
||||||
|
//
|
||||||
|
// //设置风力信息
|
||||||
|
// String windPower = weather.getString("windpower");
|
||||||
|
// weatherInfoVO.setWindPower(windPower);
|
||||||
|
//
|
||||||
|
// //设置风向信息
|
||||||
|
// String windDirection = weather.getString("winddirection");
|
||||||
|
// weatherInfoVO.setWindDirection(windDirection);
|
||||||
|
//
|
||||||
|
// return weatherInfoVO;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String [] args) {
|
||||||
|
String weatherData = GoodWeatherUtil.getWeatherData("360730");
|
||||||
|
|
||||||
|
|
||||||
|
WeatherInfoVO weatherInfoVO = GoodWeatherUtil.GetWeather(weatherData);
|
||||||
|
|
||||||
|
System.out.println(weatherInfoVO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ spring:
|
|||||||
name: ticket-server
|
name: ticket-server
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 48088
|
port: 48088
|
||||||
|
@ -3,7 +3,7 @@ spring:
|
|||||||
name: gateway-server
|
name: gateway-server
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 48080
|
port: 48080
|
||||||
|
@ -66,7 +66,7 @@ spring:
|
|||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
ticketing:
|
ticketing:
|
||||||
url: jdbc:mysql://120.46.37.243:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://101.43.112.107:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: xpower1234
|
password: xpower1234
|
||||||
|
|
||||||
@ -97,9 +97,16 @@ spring:
|
|||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
enabled: false # 是否开启调度中心,默认为 true 开启
|
|
||||||
admin:
|
admin:
|
||||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
addresses: http://127.0.0.1:9090/xxl-job-admin
|
||||||
|
executor:
|
||||||
|
appname: ${spring.application.name} # 执行器 AppName
|
||||||
|
address:
|
||||||
|
ip: # 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
|
||||||
|
port: 0 # ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
|
||||||
|
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
|
||||||
|
logretentiondays: 30 # 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;
|
||||||
|
accessToken: # 执行器通讯TOKEN
|
||||||
|
|
||||||
--- #################### 服务保障相关配置 ####################
|
--- #################### 服务保障相关配置 ####################
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ spring:
|
|||||||
name: infra-server
|
name: infra-server
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 48082
|
port: 48082
|
||||||
|
@ -3,7 +3,7 @@ spring:
|
|||||||
name: system-server
|
name: system-server
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 48081
|
port: 48081
|
||||||
|
Loading…
Reference in New Issue
Block a user