From 67ee1959a1169467133282a1c8f39bcddd0c6557 Mon Sep 17 00:00:00 2001 From: guo Date: Sat, 16 Dec 2023 11:32:44 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirQualityAnalysisController.java | 120 +++++---- .../service/IAirQualityAnalysisService.java | 4 + .../impl/AirQualityAnalysisServiceImpl.java | 8 + .../HighSlopeEngineeringController.java | 10 +- .../entity/HighSlopeCurrentData.java | 2 +- .../entity/HighSlopeEngineering.java | 230 +++++++++--------- .../entity/HighSlopeMonitorType.java | 7 - .../highslope/entity/HighSlopeSensor.java | 4 +- .../mapper/xml/HighSlopeCurrentDataMapper.xml | 8 +- .../mapper/xml/HighSlopeEngineeringMapper.xml | 4 +- .../xml/HighSlopeMeasurePointMapper.xml | 14 +- .../impl/HighSlopeCurrentDataServiceImpl.java | 2 +- .../impl/HighSlopeEngineeringServiceImpl.java | 8 +- ...ToEngineeringToMonitorTypeServiceImpl.java | 1 - .../HighSlopeMeasurePointServiceImpl.java | 4 +- .../xmgl/modules/project/entity/Project.java | 2 + .../SmartBeamFieldBeamController.java | 14 ++ .../SmartBeamFieldMakeBeamPedestalMapper.xml | 4 +- ...artBeamFieldProductionLineServiceImpl.java | 10 +- .../xmgl/task/StableWaterMixStationTask.java | 1 - src/main/java/com/zhgd/xmgl/util/AqiUtil.java | 70 +++++- src/main/resources/application.properties | 6 +- 22 files changed, 313 insertions(+), 220 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/controller/AirQualityAnalysisController.java b/src/main/java/com/zhgd/xmgl/modules/environment/controller/AirQualityAnalysisController.java index bed9a4b24..c68de8dc7 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/controller/AirQualityAnalysisController.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/controller/AirQualityAnalysisController.java @@ -11,21 +11,23 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; +import com.gexin.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; 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; - /** +/** * @Title: Controller * @Description: 空气质量分析 * @author: pds - * @date: 2020-09-27 + * @date: 2020-09-27 * @version: V1.0 */ @RestController @@ -33,68 +35,78 @@ import java.util.Map; @Slf4j @Api(tags = "空气质量分析") public class AirQualityAnalysisController { - @Autowired - private IAirQualityAnalysisService airQualityAnalysisService; + @Autowired + private IAirQualityAnalysisService airQualityAnalysisService; - - /** - * 添加 - * @param airQualityAnalysis - * @return - */ + /** + * 添加 + * + * @param airQualityAnalysis + * @return + */ @OperLog(operModul = "空气质量分析", operType = "添加空气质量分析信息", operDesc = "添加空气质量分析信息") @ApiOperation(value = "添加空气质量分析信息", notes = "添加空气质量分析信息", httpMethod = "POST") @PostMapping(value = "/add") - public Result add(@RequestBody AirQualityAnalysis airQualityAnalysis) { - Result result = new Result<>(); - try { - airQualityAnalysisService.save(airQualityAnalysis); - result.successMsg("添加成功!"); - } catch (Exception e) { - e.printStackTrace(); - log.info(e.getMessage()); - result.error500("操作失败"); - } - return result; - } + public Result add(@RequestBody AirQualityAnalysis airQualityAnalysis) { + Result result = new Result<>(); + try { + airQualityAnalysisService.save(airQualityAnalysis); + result.successMsg("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } - /** - * 通过id查询 - * @param - * @return - */ - @ApiOperation(value = "查询当天空气质量", notes = "查询当天空气质量" , httpMethod="POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), - }) - @PostMapping(value = "/getCurrentDayAirQuality") - public Result getCurrentDayAirQuality(@RequestBody Map map) { - AirQualityAnalysis airQualityAnalysis = airQualityAnalysisService.getCurrentDayAirQuality(map); - return Result.success(airQualityAnalysis); - } + /** + * 通过id查询 + * + * @param + * @return + */ + @ApiOperation(value = "查询当天空气质量", notes = "查询当天空气质量", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), + }) + @PostMapping(value = "/getCurrentDayAirQuality") + public Result getCurrentDayAirQuality(@RequestBody Map map) { + AirQualityAnalysis airQualityAnalysis = airQualityAnalysisService.getCurrentDayAirQuality(map); + return Result.success(airQualityAnalysis); + } - @ApiOperation(value = "当天空气质量统计", notes = "当天空气质量统计", httpMethod = "POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), - @ApiImplicitParam(name = "type", value = "类型,1最近30天,2最近一年", paramType = "query", required = true, dataType = "String"), - }) - @PostMapping(value = "/getAirQualityStatistics") - public Result> getAirQualityStatistics(@RequestBody Map map) { - List list = airQualityAnalysisService.getAirQualityStatistics(map); - return Result.success(list); - } + @ApiOperation(value = "当天空气质量统计", notes = "当天空气质量统计", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "type", value = "类型,1最近30天,2最近一年", paramType = "query", required = true, dataType = "String"), + }) + @PostMapping(value = "/getAirQualityStatistics") + public Result> getAirQualityStatistics(@RequestBody Map map) { + List list = airQualityAnalysisService.getAirQualityStatistics(map); + return Result.success(list); + } - @ApiOperation(value = "查询天气", notes = "查询天气" , httpMethod="POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "cityid", value = "市区编码", paramType = "query", required = false, dataType = "String"), - }) - @PostMapping(value = "/getWeatherData") - public Result getWeatherData(@RequestBody Map map) { - return Result.success(airQualityAnalysisService.getWeatherData(MapUtils.getString(map,"cityid"))); - } + @ApiOperation(value = "查询天气-周", notes = "查询天气-周", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "cityid", value = "市区编码", paramType = "query", required = false, dataType = "String"), + }) + @PostMapping(value = "/getWeatherData") + public Result getWeatherData(@RequestBody Map map) { + return Result.success(airQualityAnalysisService.getWeatherData(MapUtils.getString(map, "cityid"))); + } + + @ApiOperation(value = "查询天气实况", notes = "查询天气实况", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "cityid", value = "市区编码", paramType = "body", required = false, dataType = "String"), + }) + @PostMapping(value = "/getWeatherLiveData") + public Result getWeatherLiveData(@RequestBody Map map) { + return Result.success(airQualityAnalysisService.getWeatherLiveData(MapUtils.getString(map, "cityid"))); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/service/IAirQualityAnalysisService.java b/src/main/java/com/zhgd/xmgl/modules/environment/service/IAirQualityAnalysisService.java index a2972ca45..0dc3f4754 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/service/IAirQualityAnalysisService.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/service/IAirQualityAnalysisService.java @@ -3,7 +3,9 @@ package com.zhgd.xmgl.modules.environment.service; import com.zhgd.xmgl.modules.environment.entity.AirQualityAnalysis; import com.baomidou.mybatisplus.extension.service.IService; import com.zhgd.xmgl.modules.environment.entity.vo.AirQualityStatisticsVo; +import com.gexin.fastjson.JSONObject; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -22,4 +24,6 @@ public interface IAirQualityAnalysisService extends IService void deleteProjectAirQualityAnalysis(String projectSn); String getWeatherData(String cityid); + + Object getWeatherLiveData(String cityid); } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/AirQualityAnalysisServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/AirQualityAnalysisServiceImpl.java index 31b0073a8..47552fdba 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/AirQualityAnalysisServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/AirQualityAnalysisServiceImpl.java @@ -1,4 +1,5 @@ package com.zhgd.xmgl.modules.environment.service.impl; +import com.gexin.fastjson.JSONObject; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; @@ -106,4 +107,11 @@ public class AirQualityAnalysisServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(SystemCities::getCityid, cityid); + return AqiUtil.getLiveWeatherInfo(cityid); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/controller/HighSlopeEngineeringController.java b/src/main/java/com/zhgd/xmgl/modules/highslope/controller/HighSlopeEngineeringController.java index 07843ef03..e3d909f32 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/controller/HighSlopeEngineeringController.java +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/controller/HighSlopeEngineeringController.java @@ -12,10 +12,12 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; import java.util.List; import java.util.Map; @@ -42,7 +44,7 @@ public class HighSlopeEngineeringController { @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), }) - @PostMapping(value = "/list") + @PostMapping(value = "/page") public Result> queryPageList(@RequestBody Map map) { return Result.success(highSlopeEngineeringService.selectHighSlopeEngineeringPage(map)); } @@ -54,7 +56,7 @@ public class HighSlopeEngineeringController { @ApiImplicitParams({ @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), }) - @PostMapping(value = "/selectHighSlopeList") + @PostMapping(value = "/list") public Result> selectHighSlopeList(@RequestBody Map map) { return Result.success(highSlopeEngineeringService.selectHighSlopeList(map)); } @@ -67,7 +69,7 @@ public class HighSlopeEngineeringController { */ @ApiOperation(value = "添加高边坡-工程信息", notes = "添加高边坡-工程信息", httpMethod = "POST") @PostMapping(value = "/add") - public Result add(@RequestBody HighSlopeEngineering highSlopeEngineering) { + public Result add(@RequestBody @Validated HighSlopeEngineering highSlopeEngineering) { highSlopeEngineeringService.saveHighSlopeEngineering(highSlopeEngineering); return Result.ok(); } @@ -93,7 +95,7 @@ public class HighSlopeEngineeringController { @ApiOperation(value = "删除高边坡-工程信息", notes = "删除高边坡-工程信息", httpMethod = "POST") @ApiImplicitParam(name = "id", value = "高边坡-工程ID", paramType = "body", required = true, dataType = "Integer") @PostMapping(value = "/delete") - public Result delete(@RequestBody Map map) { + public Result delete(@ApiIgnore @RequestBody Map map) { highSlopeEngineeringService.deleteHighSlopeEngineering(MapUtils.getLong(map, "id")); return Result.ok(); } diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeCurrentData.java b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeCurrentData.java index 59a645700..0dafdd678 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeCurrentData.java +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeCurrentData.java @@ -123,7 +123,7 @@ public class HighSlopeCurrentData implements Serializable { @Excel(name = "高边坡名称", width = 15) @ApiModelProperty(value = "高边坡名称") @TableField(exist = false) - private String engineeringName; + private String slopeName; /** diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeEngineering.java b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeEngineering.java index 61e18548a..87a61a671 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeEngineering.java +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeEngineering.java @@ -1,24 +1,23 @@ package com.zhgd.xmgl.modules.highslope.entity; -import java.io.Serializable; - import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; -import org.jeecgframework.poi.excel.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + /** * @Description: 高边坡-工程 * 基坑检测内容 - * a>测点>传感器 + * a>测点>传感器>实时数据 * a>实时数据 * 基坑>平面图测点 * @author: pds @@ -29,115 +28,116 @@ import org.springframework.format.annotation.DateTimeFormat; @TableName("high_slope_engineering") @ApiModel(value = "HighSlopeEngineering实体类", description = "HighSlopeEngineering") public class HighSlopeEngineering implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * id - */ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "id") - private java.lang.Long id; - /** - * 项目sn - */ - @Excel(name = "项目sn", width = 15) - @ApiModelProperty(value = "项目sn") - private java.lang.String projectSn; - /** - * 边坡名称 - */ - @Excel(name = "边坡名称", width = 15) - @ApiModelProperty(value = "边坡名称") - private java.lang.String slopeName; - /** - * 开工日期 - */ - @Excel(name = "开工日期", width = 20, format = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "开工日期") - private java.util.Date startDate; - /** - * 完工日期 - */ - @Excel(name = "完工日期", width = 20, format = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "完工日期") - private java.util.Date endDate; - /** - * 监测负责人id - */ - @Excel(name = "监测负责人id", width = 15) - @ApiModelProperty(value = "监测负责人id") - private java.lang.Long surveyDirectorId; - /** - * 监测负责人名称 - */ - @Excel(name = "监测负责人名称", width = 15) - @ApiModelProperty(value = "监测负责人名称") - private java.lang.String surveyDirectorName; - /** - * 监测人员id - */ - @Excel(name = "监测人员id", width = 15) - @ApiModelProperty(value = "监测人员id") - private java.lang.Long surveyPersonnelId; - /** - * 监测人员名称 - */ - @Excel(name = "监测人员名称", width = 15) - @ApiModelProperty(value = "监测人员名称") - private java.lang.String surveyPersonnelName; - /** - * 监测方案 - */ - @Excel(name = "监测方案", width = 15) - @ApiModelProperty(value = "监测方案") - private java.lang.Object surveyScheme; - /** - * 地勘报告 - */ - @Excel(name = "地勘报告", width = 15) - @ApiModelProperty(value = "地勘报告") - private java.lang.Object prospectingReport; - /** - * 设计图纸 - */ - @Excel(name = "设计图纸", width = 15) - @ApiModelProperty(value = "设计图纸") - private java.lang.Object deviseDrawing; - /** - * 安全等级 - */ - @Excel(name = "安全等级", width = 15) - @ApiModelProperty(value = "安全等级") - private java.lang.String safetyLevel; - /** - * 状态,1进行中,2已完成 - */ - @Excel(name = "状态,1进行中,2已完成", width = 15) - @ApiModelProperty(value = "状态,1进行中,2已完成") - private java.lang.Integer status; - /** - * 创建时间 yyyy-MM-dd HH:mm:ss - */ - @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") - private java.util.Date createTime; - /** - * 更新时间 yyyy-MM-dd HH:mm:ss - */ - @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") - private java.util.Date updateTime; + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.Long id; + /** + * 项目sn + */ + @Excel(name = "项目sn", width = 15) + @ApiModelProperty(value = "项目sn") + private java.lang.String projectSn; + /** + * 边坡名称 + */ + @Excel(name = "边坡名称", width = 15) + @ApiModelProperty(value = "边坡名称") + private java.lang.String slopeName; + /** + * 开工日期 + */ + @Excel(name = "开工日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "开工日期") + private java.util.Date startDate; + /** + * 完工日期 + */ + @Excel(name = "完工日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "完工日期") + private java.util.Date endDate; + /** + * 监测负责人id + */ + @Excel(name = "监测负责人id", width = 15) + @ApiModelProperty(value = "监测负责人id") + private java.lang.Long surveyDirectorId; + /** + * 监测负责人名称 + */ + @Excel(name = "监测负责人名称", width = 15) + @ApiModelProperty(value = "监测负责人名称") + private java.lang.String surveyDirectorName; + /** + * 监测人员id + */ + @Excel(name = "监测人员id", width = 15) + @ApiModelProperty(value = "监测人员id") + private java.lang.Long surveyPersonnelId; + /** + * 监测人员名称 + */ + @Excel(name = "监测人员名称", width = 15) + @ApiModelProperty(value = "监测人员名称") + private java.lang.String surveyPersonnelName; + /** + * 监测方案 + */ + @Excel(name = "监测方案", width = 15) + @ApiModelProperty(value = "监测方案") + private String surveyScheme; + /** + * 地勘报告 + */ + @Excel(name = "地勘报告", width = 15) + @ApiModelProperty(value = "地勘报告") + private String prospectingReport; + /** + * 设计图纸 + */ + @Excel(name = "设计图纸", width = 15) + @ApiModelProperty(value = "设计图纸") + private String deviseDrawing; + /** + * 安全等级 + */ + @Excel(name = "安全等级", width = 15) + @ApiModelProperty(value = "安全等级") + private java.lang.String safetyLevel; + /** + * 状态,1进行中,2已完成 + */ + @Excel(name = "状态,1进行中,2已完成", width = 15) + @ApiModelProperty(value = "状态,1进行中,2已完成") + private java.lang.Integer status; + /** + * 创建时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + /** + * 更新时间 yyyy-MM-dd HH:mm:ss + */ + @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; - @ApiModelProperty(value = "默认监测内容ID") - @TableField(exist = false) - private String monitorTypeIds; + @ApiModelProperty(value = "高边坡-监测类型表id(多个,分隔)") + @TableField(exist = false) + @NotBlank + private String highSlopeMonitorTypeIds; } diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeMonitorType.java b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeMonitorType.java index 756a8eb80..bbd3a608a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeMonitorType.java +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeMonitorType.java @@ -13,13 +13,6 @@ import lombok.experimental.Accessors; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; -/** - * @ClassName HighSlopeMonitorType - * @author 邱平毅 - * @date 2022/8/19 11:25 - * @Version 1.0 - */ - /** * 高边坡-监测类型表 */ diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeSensor.java b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeSensor.java index bbe4b310d..bd1c38715 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeSensor.java +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/entity/HighSlopeSensor.java @@ -144,7 +144,7 @@ public class HighSlopeSensor implements Serializable { */ @ApiModelProperty(value = "高边坡名称") @TableField(exist = false) - private String engineeringName; + private String slopeName; /** * 测点名称 @@ -175,8 +175,8 @@ public class HighSlopeSensor implements Serializable { @TableField(exist = false) private String unit; - @TableField(exist = false) @ApiModelProperty(value = "传感器编码") + @TableField(exist = false) private String sensorTypeCode; diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeCurrentDataMapper.xml b/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeCurrentDataMapper.xml index 6becc2afc..43ded6298 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeCurrentDataMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeCurrentDataMapper.xml @@ -3,7 +3,7 @@ - select dee.engineering_name engineeringName, + select dee.slope_name slopeName, demp.measure_point_name measurePointName, demp.measure_point_number measurePointNumber, dest.sensor_type_name sensorTypeName, diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeEngineeringMapper.xml b/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeEngineeringMapper.xml index 61a1867b3..adb58422f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeEngineeringMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeEngineeringMapper.xml @@ -6,13 +6,13 @@ SELECT * from high_slope_engineering WHERE project_sn=#{param.projectSn} - order by start_time + order by id desc diff --git a/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeMeasurePointMapper.xml b/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeMeasurePointMapper.xml index 26f928e2f..d6c2f6ac3 100644 --- a/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeMeasurePointMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/highslope/mapper/xml/HighSlopeMeasurePointMapper.xml @@ -5,10 +5,10 @@ resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeMeasurePoint"> select a.* from high_slope_measure_point a - INNER JOIN high_slope_monitor_type_rela b ON a.rela_id = b.id - where b.high_slope_id = #{highSlopeId} + INNER JOIN high_slope_engineering_to_monitor_type b ON a.high_slope_engineering_to_monitor_type_id = b.id + where b.high_slope_engineering_id = #{highSlopeId} - and a.rela_id = #{relaId} + and a.high_slope_engineering_to_monitor_type_id = #{relaId} @@ -22,19 +22,19 @@ - select t.*, ifnull(round(makeBeamPedestalOccupyCount / makeBeamPedestalCount, 2), 0) as + select t.*, ifnull(round(makeBeamPedestalOccupyCount / makeBeamPedestalCount*100, 2), 0) as makeBeamPedestalOccupyRate, makeBeamPedestalCount-makeBeamPedestalOccupyCount as makeBeamPedestalNotOccupyCount from ( select count(*) makeBeamPedestalCount, - ifnull(if(max(sbfbtp.id) is not null, 1, 0), 0) makeBeamPedestalOccupyCount + ifnull(sum(if(sbfbtp.id is not null, 1, 0)), 0) makeBeamPedestalOccupyCount from smart_beam_field_make_beam_pedestal sbfmbp left join (SELECT * FROM smart_beam_field_beam_to_process diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java index cac577f14..8bd9d774e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java @@ -20,6 +20,7 @@ import com.zhgd.xmgl.modules.smartbeamfield.service.ISmartBeamFieldProductionLin import com.zhgd.xmgl.util.PageUtil; import com.zhgd.xmgl.util.RefUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -81,7 +82,14 @@ public class SmartBeamFieldProductionLineServiceImpl extends ServiceImpl param = new HashMap<>(); - param.put("appid", "41289558"); - param.put("appsecret", "45CS7niV"); + param.put("appid", tianqiAppid); + param.put("appsecret", tianqiAppsecret); String cityId = Optional.ofNullable(cityIdMap.get(cityCode)).map(e -> e.getWeathercityid()).orElse(null); if (StringUtils.isNotBlank(cityId)) { param.put("cityid", cityId); } - String result = HttpUtil.get("https://v0.yiketianqi.com/free/day", param, 5000); + String urlString = tianqiUrl + "/free/day"; + log.info("tianqi:url:{},param:{}", urlString, JSON.toJSONString(param)); + String result = HttpUtil.get(urlString, param, 5000); + log.info("tianqi:rs:{}", result); if (result != null && result.length() > 0) { JSONObject obj = JSONObject.parseObject(result); if (obj != null && obj.getString("air") != null) { @@ -207,22 +223,56 @@ public class AqiUtil { return air; } + /** + * 实况天气 + * + * @param cityCode cityid + * @return + */ + public static Object getLiveWeatherInfo(String cityCode) { + List systemCities = redisRepository.getOrSet(SYSTEM_CITIES_KEY, () -> systemCitiesMapper.selectList(null), 60 * 60L); + String key = WEATHER_LIVE + cityCode; + Object ro = redisRepository.get(key); + if (ro != null) { + return (HashMap) ro; + } + Map cityIdMap = systemCities.stream().collect(Collectors.toMap(e -> e.getCityid(), Function.identity(), (o, o2) -> o)); + HashMap result = null; + try { + Map param = new HashMap<>(); + param.put("appid", tianqiAppid); + param.put("appsecret", tianqiAppsecret); + String cityId = Optional.ofNullable(cityIdMap.get(cityCode)).map(e -> e.getWeathercityid()).orElse(null); + if (StringUtils.isNotBlank(cityId)) { + param.put("cityid", cityId); + } + String urlString = tianqiUrl + "/free/day"; + log.info("tianqi:url:{},param:{}", urlString, JSON.toJSONString(param)); + String rs = HttpUtil.get(urlString, param, 5000); + log.info("tianqi:rs:{}", rs); + + result = JSON.parseObject(rs, HashMap.class); + } catch (Exception e) { + e.printStackTrace(); + } + redisRepository.set(key, result, 60 * 60L); + return result; + } + public static String getWeatherData(String cityid) { String result = ""; try { result = redisRepository.getOrSet(WEATHER_DATA + cityid, () -> { Map param = new HashMap<>(); param.put("unescape", "1"); - //param.put("appid", "79112751"); - //param.put("appsecret", "EBqjU987"); - param.put("appid", "41289558"); - param.put("appsecret", "45CS7niV"); + param.put("appid", tianqiAppid); + param.put("appsecret", tianqiAppsecret); if (StringUtils.isNotEmpty(cityid)) { param.put("cityid", cityid); } - String r = HttpUtil.get(tianqiUrl, param); + String r = HttpUtil.get(tianqiUrl + "/free/week", param); JSONObject jsonObject = JSONObject.parseObject(r); - JSONArray sevenDataArr = jsonObject.getJSONArray("data"); + com.gexin.fastjson.JSONArray sevenDataArr = jsonObject.getJSONArray("data"); for (Object o : sevenDataArr) { JSONObject jo = (JSONObject) o; jo.put("cityid", jsonObject.get("cityid")); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 96c154154..42c410939 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -154,6 +154,10 @@ koyoe.nowData=${koyoe.base-url}/third-party/api/nowData?sn=%s # 是否证书验证 is-license=false #天气url -tianqiUrl=http://v1.yiketianqi.com/free/week +tianqiUrl=http://v1.yiketianqi.com +#天气appid +tianqiAppid=41289558 +#天气appsecret +tianqiAppsecret=45CS7niV spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.time-zone=GMT+8