Compare commits

...

12 Commits

Author SHA1 Message Date
7f1b578c5f 构建修改 2024-08-22 10:15:44 +08:00
95efec4fb2 Merge pull request 'sjy' (#24) from sjy into master
Reviewed-on: #24
2024-08-22 10:09:18 +08:00
7da4af075c 大屏未来三天天气预报 2024-08-22 10:06:59 +08:00
decde473dd 大屏未来三天天气接口 2024-08-22 09:59:39 +08:00
2318a8ade5 Merge pull request '大屏设备数据接口bug修复' (#23) from zzw-one into master
Reviewed-on: #23
2024-08-22 09:58:12 +08:00
d99be5cd18 大屏设备数据接口bug修复 2024-08-22 09:55:11 +08:00
68ce8594fe Merge pull request '调度中心跳转修改' (#22) from xinwei into master
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #22
2024-08-22 09:50:51 +08:00
e415f5a362 Merge pull request 'xinwei' (#21) from xinwei into master
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #21
2024-08-21 18:10:17 +08:00
0a04073e48 Merge pull request '构建修改' (#20) from xinwei into master
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #20
2024-08-21 16:46:52 +08:00
69f78414de Merge pull request 'xinwei' (#19) from xinwei into master
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #19
2024-08-21 16:29:41 +08:00
c0415da552 Merge pull request '构建修改' (#18) from xinwei into master
Some checks failed
continuous-integration/drone Build is failing
Reviewed-on: #18
2024-08-21 11:02:54 +08:00
7cb8b64830 Merge pull request 'xinwei' (#17) from xinwei into master
All checks were successful
continuous-integration/drone Build is passing
Reviewed-on: #17
2024-08-20 19:33:41 +08:00
9 changed files with 167 additions and 180 deletions

View File

@ -25,35 +25,35 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
- mvn package -Dmaven.test.skip=true # 应用打包命令
- mkdir -p /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/run.sh /app/build/yudao-gateway
- 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/Dockerfile /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
- 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/run.sh /app/build/yudao-module-infra
- 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/Dockerfile /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
- 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/run.sh /app/build/ludu-module-ticketing
- 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/Dockerfile /app/build/ludu-module-parking
- cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
# - mkdir -p /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/run.sh /app/build/yudao-gateway
#
# - 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/Dockerfile /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
# - 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/run.sh /app/build/yudao-module-infra
#
# - 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/Dockerfile /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
# - 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/run.sh /app/build/ludu-module-ticketing
#
# - 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/Dockerfile /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
- 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:
- echo "start copy"
- cd /ludu/maven
- tar -cf ludu-build.tar ./build
- scp ludu-build.tar root@121.36.203.133:/ludu/maven
# - cd /ludu/maven
# - tar -cf ludu-build.tar ./build
# - 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
# - echo "gateway done"
# - scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
@ -96,78 +96,78 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
# - echo "infra done"
# - scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
# - echo "job done"
# - scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
# - echo "system done"
- scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
- echo "datacenter done"
# - 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
- name: build-other-service
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 121.36.203.133 # 远程连接地址
host: 120.46.37.243 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password3 # 从Secret中读取SSH密码
from_secret: ssh_password2 # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 20m # 远程执行命令超时时间
command_timeout: 5m # 远程执行命令超时时间
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/
- cd /ludu/maven/build/ludu-module-datacenter/
- 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" # 运行脚本打包应用镜像并运行
# - name: object-build
#
# image: appleboy/drone-ssh # SSH工具镜像
#
# settings:
#
# host: 121.36.203.133 # 远程连接地址
#
# username: root # 远程连接账号
#
# password:
#
# from_secret: ssh_password3 # 从Secret中读取SSH密码
#
# port: 22 # 远程连接端口
#
# 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: # 定义流水线挂载目录,用于共享数据

View File

@ -3,6 +3,8 @@ 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.utlis.GoodWeatherUtil;
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.tags.Tag;
import org.springframework.validation.annotation.Validated;
@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/h5/weather")
@Validated
public class WeatherApi {
@GetMapping(value = "/getWeather")
@Operation(summary = "获得输入城市的天气")
public ResponseVO getWeather(String cityCode) {
@ -25,4 +28,18 @@ public class WeatherApi {
WeatherInfoVO weatherInfo = GoodWeatherUtil.GetWeather(weatherData);
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);
}
}

View File

@ -26,19 +26,28 @@ public class AssetServiceImpl implements AssetService {
@Override
public List<Map<String, String>> countAsset() {
List<Asset> assetList = assetRepository.findAll();
int[] assetTypeCounts = new int[3];
int[] assetTypeCounts = new int[6];
Map<String, String> map = new LinkedHashMap<>();
for (Asset asset : assetList) {
String assettype = asset.getAssettype();
switch (assettype) {
case "C":
assetTypeCounts[0]++;
if ("1".equals(asset.getIsOnline())){
assetTypeCounts[3]++;
}
break;
case "D":
assetTypeCounts[1]++;
if ("1".equals(asset.getIsOnline())){
assetTypeCounts[4]++;
}
break;
case "F":
assetTypeCounts[2]++;
if ("1".equals(asset.getIsOnline())){
assetTypeCounts[5]++;
}
break;
default:
break;
@ -52,6 +61,15 @@ public class AssetServiceImpl implements AssetService {
Map<String, String> map1=new LinkedHashMap<>();
map1.put("assettype",stringStringEntry.getKey());
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);
}
return mapList;

View File

@ -18,15 +18,14 @@ public class GoodWeatherUtil {
//高德地图
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_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";
private static final String WEATHER_TYPE = "&extensions=all";
/**
* 今日实况天气
* @param cityCode
* @return
*/
public static String getWeatherData(String cityCode){
int codelength = cityCode.length();
if (6 != codelength){
@ -53,6 +52,39 @@ 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对象
*/
@ -60,7 +92,6 @@ public class GoodWeatherUtil {
if ("500".equals(weatherInfobyJson)){
return null;
}
JSONObject dataOfJson = JSONObject.parseObject(weatherInfobyJson);
System.out.println(dataOfJson);
//创建WeatherInfo对象提取所需的天气信息
@ -88,76 +119,4 @@ public class GoodWeatherUtil {
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);
}
}

View File

@ -3,7 +3,7 @@ spring:
name: ticket-server
profiles:
active: dev
active: local
server:
port: 48088

View File

@ -3,7 +3,7 @@ spring:
name: gateway-server
profiles:
active: dev
active: local
server:
port: 48080

View File

@ -66,7 +66,7 @@ spring:
username: root
password: 123456
ticketing:
url: jdbc:mysql://101.43.112.107:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://120.46.37.243:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
username: root
password: xpower1234
@ -97,16 +97,9 @@ spring:
--- #################### 定时任务相关配置 ####################
xxl:
job:
enabled: false # 是否开启调度中心,默认为 true 开启
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
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
--- #################### 服务保障相关配置 ####################

View File

@ -3,7 +3,7 @@ spring:
name: infra-server
profiles:
active: dev
active: local
server:
port: 48082

View File

@ -3,7 +3,7 @@ spring:
name: system-server
profiles:
active: dev
active: local
server:
port: 48081