bug修复

This commit is contained in:
guo 2023-12-16 11:32:44 +08:00
parent 232c6507d9
commit 67ee1959a1
22 changed files with 313 additions and 220 deletions

View File

@ -11,21 +11,23 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import com.gexin.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Title: Controller * @Title: Controller
* @Description: 空气质量分析 * @Description: 空气质量分析
* @author pds * @author pds
* @date 2020-09-27 * @date 2020-09-27
* @version V1.0 * @version V1.0
*/ */
@RestController @RestController
@ -33,68 +35,78 @@ import java.util.Map;
@Slf4j @Slf4j
@Api(tags = "空气质量分析") @Api(tags = "空气质量分析")
public class AirQualityAnalysisController { public class AirQualityAnalysisController {
@Autowired @Autowired
private IAirQualityAnalysisService airQualityAnalysisService; private IAirQualityAnalysisService airQualityAnalysisService;
/**
/** * 添加
* 添加 *
* @param airQualityAnalysis * @param airQualityAnalysis
* @return * @return
*/ */
@OperLog(operModul = "空气质量分析", operType = "添加空气质量分析信息", operDesc = "添加空气质量分析信息") @OperLog(operModul = "空气质量分析", operType = "添加空气质量分析信息", operDesc = "添加空气质量分析信息")
@ApiOperation(value = "添加空气质量分析信息", notes = "添加空气质量分析信息", httpMethod = "POST") @ApiOperation(value = "添加空气质量分析信息", notes = "添加空气质量分析信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<AirQualityAnalysis> add(@RequestBody AirQualityAnalysis airQualityAnalysis) { public Result<AirQualityAnalysis> add(@RequestBody AirQualityAnalysis airQualityAnalysis) {
Result<AirQualityAnalysis> result = new Result<>(); Result<AirQualityAnalysis> result = new Result<>();
try { try {
airQualityAnalysisService.save(airQualityAnalysis); airQualityAnalysisService.save(airQualityAnalysis);
result.successMsg("添加成功!"); result.successMsg("添加成功!");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.info(e.getMessage()); log.info(e.getMessage());
result.error500("操作失败"); result.error500("操作失败");
} }
return result; return result;
} }
/** /**
* 通过id查询 * 通过id查询
* @param *
* @return * @param
*/ * @return
@ApiOperation(value = "查询当天空气质量", notes = "查询当天空气质量" , httpMethod="POST") */
@ApiImplicitParams({ @ApiOperation(value = "查询当天空气质量", notes = "查询当天空气质量", httpMethod = "POST")
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParams({
}) @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@PostMapping(value = "/getCurrentDayAirQuality") })
public Result<AirQualityAnalysis> getCurrentDayAirQuality(@RequestBody Map<String,Object> map) { @PostMapping(value = "/getCurrentDayAirQuality")
AirQualityAnalysis airQualityAnalysis = airQualityAnalysisService.getCurrentDayAirQuality(map); public Result<AirQualityAnalysis> getCurrentDayAirQuality(@RequestBody Map<String, Object> map) {
return Result.success(airQualityAnalysis); AirQualityAnalysis airQualityAnalysis = airQualityAnalysisService.getCurrentDayAirQuality(map);
} return Result.success(airQualityAnalysis);
}
@ApiOperation(value = "当天空气质量统计", notes = "当天空气质量统计", httpMethod = "POST") @ApiOperation(value = "当天空气质量统计", notes = "当天空气质量统计", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "type", value = "类型1最近30天2最近一年", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "type", value = "类型1最近30天2最近一年", paramType = "query", required = true, dataType = "String"),
}) })
@PostMapping(value = "/getAirQualityStatistics") @PostMapping(value = "/getAirQualityStatistics")
public Result<List<AirQualityStatisticsVo>> getAirQualityStatistics(@RequestBody Map<String, Object> map) { public Result<List<AirQualityStatisticsVo>> getAirQualityStatistics(@RequestBody Map<String, Object> map) {
List<AirQualityStatisticsVo> list = airQualityAnalysisService.getAirQualityStatistics(map); List<AirQualityStatisticsVo> list = airQualityAnalysisService.getAirQualityStatistics(map);
return Result.success(list); return Result.success(list);
} }
@ApiOperation(value = "查询天气", notes = "查询天气" , httpMethod="POST") @ApiOperation(value = "查询天气-周", notes = "查询天气-周", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "cityid", value = "市区编码", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "cityid", value = "市区编码", paramType = "query", required = false, dataType = "String"),
}) })
@PostMapping(value = "/getWeatherData") @PostMapping(value = "/getWeatherData")
public Result<String> getWeatherData(@RequestBody Map<String,Object> map) { public Result<String> getWeatherData(@RequestBody Map<String, Object> map) {
return Result.success(airQualityAnalysisService.getWeatherData(MapUtils.getString(map,"cityid"))); 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<Object> getWeatherLiveData(@RequestBody Map<String, Object> map) {
return Result.success(airQualityAnalysisService.getWeatherLiveData(MapUtils.getString(map, "cityid")));
}
} }

View File

@ -3,7 +3,9 @@ package com.zhgd.xmgl.modules.environment.service;
import com.zhgd.xmgl.modules.environment.entity.AirQualityAnalysis; import com.zhgd.xmgl.modules.environment.entity.AirQualityAnalysis;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.environment.entity.vo.AirQualityStatisticsVo; 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.List;
import java.util.Map; import java.util.Map;
@ -22,4 +24,6 @@ public interface IAirQualityAnalysisService extends IService<AirQualityAnalysis>
void deleteProjectAirQualityAnalysis(String projectSn); void deleteProjectAirQualityAnalysis(String projectSn);
String getWeatherData(String cityid); String getWeatherData(String cityid);
Object getWeatherLiveData(String cityid);
} }

View File

@ -1,4 +1,5 @@
package com.zhgd.xmgl.modules.environment.service.impl; package com.zhgd.xmgl.modules.environment.service.impl;
import com.gexin.fastjson.JSONObject;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
@ -106,4 +107,11 @@ public class AirQualityAnalysisServiceImpl extends ServiceImpl<AirQualityAnalysi
} }
return AqiUtil.getWeatherData(weathercityid); return AqiUtil.getWeatherData(weathercityid);
} }
@Override
public Object getWeatherLiveData(String cityid) {
QueryWrapper<SystemCities> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SystemCities::getCityid, cityid);
return AqiUtil.getLiveWeatherInfo(cityid);
}
} }

View File

@ -12,10 +12,12 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -42,7 +44,7 @@ public class HighSlopeEngineeringController {
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", 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<IPage<HighSlopeEngineering>> queryPageList(@RequestBody Map<String, Object> map) { public Result<IPage<HighSlopeEngineering>> queryPageList(@RequestBody Map<String, Object> map) {
return Result.success(highSlopeEngineeringService.selectHighSlopeEngineeringPage(map)); return Result.success(highSlopeEngineeringService.selectHighSlopeEngineeringPage(map));
} }
@ -54,7 +56,7 @@ public class HighSlopeEngineeringController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
}) })
@PostMapping(value = "/selectHighSlopeList") @PostMapping(value = "/list")
public Result<List<HighSlopeEngineering>> selectHighSlopeList(@RequestBody Map<String, Object> map) { public Result<List<HighSlopeEngineering>> selectHighSlopeList(@RequestBody Map<String, Object> map) {
return Result.success(highSlopeEngineeringService.selectHighSlopeList(map)); return Result.success(highSlopeEngineeringService.selectHighSlopeList(map));
} }
@ -67,7 +69,7 @@ public class HighSlopeEngineeringController {
*/ */
@ApiOperation(value = "添加高边坡-工程信息", notes = "添加高边坡-工程信息", httpMethod = "POST") @ApiOperation(value = "添加高边坡-工程信息", notes = "添加高边坡-工程信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<HighSlopeEngineering> add(@RequestBody HighSlopeEngineering highSlopeEngineering) { public Result<HighSlopeEngineering> add(@RequestBody @Validated HighSlopeEngineering highSlopeEngineering) {
highSlopeEngineeringService.saveHighSlopeEngineering(highSlopeEngineering); highSlopeEngineeringService.saveHighSlopeEngineering(highSlopeEngineering);
return Result.ok(); return Result.ok();
} }
@ -93,7 +95,7 @@ public class HighSlopeEngineeringController {
@ApiOperation(value = "删除高边坡-工程信息", notes = "删除高边坡-工程信息", httpMethod = "POST") @ApiOperation(value = "删除高边坡-工程信息", notes = "删除高边坡-工程信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "高边坡-工程ID", paramType = "body", required = true, dataType = "Integer") @ApiImplicitParam(name = "id", value = "高边坡-工程ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public Result<HighSlopeEngineering> delete(@RequestBody Map<String, Object> map) { public Result<HighSlopeEngineering> delete(@ApiIgnore @RequestBody Map<String, Object> map) {
highSlopeEngineeringService.deleteHighSlopeEngineering(MapUtils.getLong(map, "id")); highSlopeEngineeringService.deleteHighSlopeEngineering(MapUtils.getLong(map, "id"));
return Result.ok(); return Result.ok();
} }

View File

@ -123,7 +123,7 @@ public class HighSlopeCurrentData implements Serializable {
@Excel(name = "高边坡名称", width = 15) @Excel(name = "高边坡名称", width = 15)
@ApiModelProperty(value = "高边坡名称") @ApiModelProperty(value = "高边坡名称")
@TableField(exist = false) @TableField(exist = false)
private String engineeringName; private String slopeName;
/** /**

View File

@ -1,24 +1,23 @@
package com.zhgd.xmgl.modules.highslope.entity; package com.zhgd.xmgl.modules.highslope.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/** /**
* @Description: 高边坡-工程 * @Description: 高边坡-工程
* 基坑<a>检测内容 * 基坑<a>检测内容
* a>测点>传感器 * a>测点>传感器>实时数据
* a>实时数据 * a>实时数据
* 基坑>平面图<b>测点 * 基坑>平面图<b>测点
* @author pds * @author pds
@ -29,115 +28,116 @@ import org.springframework.format.annotation.DateTimeFormat;
@TableName("high_slope_engineering") @TableName("high_slope_engineering")
@ApiModel(value = "HighSlopeEngineering实体类", description = "HighSlopeEngineering") @ApiModel(value = "HighSlopeEngineering实体类", description = "HighSlopeEngineering")
public class HighSlopeEngineering implements Serializable { public class HighSlopeEngineering implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private java.lang.Long id; private java.lang.Long id;
/** /**
* 项目sn * 项目sn
*/ */
@Excel(name = "项目sn", width = 15) @Excel(name = "项目sn", width = 15)
@ApiModelProperty(value = "项目sn") @ApiModelProperty(value = "项目sn")
private java.lang.String projectSn; private java.lang.String projectSn;
/** /**
* 边坡名称 * 边坡名称
*/ */
@Excel(name = "边坡名称", width = 15) @Excel(name = "边坡名称", width = 15)
@ApiModelProperty(value = "边坡名称") @ApiModelProperty(value = "边坡名称")
private java.lang.String slopeName; private java.lang.String slopeName;
/** /**
* 开工日期 * 开工日期
*/ */
@Excel(name = "开工日期", width = 20, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "开工日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开工日期") @ApiModelProperty(value = "开工日期")
private java.util.Date startDate; private java.util.Date startDate;
/** /**
* 完工日期 * 完工日期
*/ */
@Excel(name = "完工日期", width = 20, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "完工日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "完工日期") @ApiModelProperty(value = "完工日期")
private java.util.Date endDate; private java.util.Date endDate;
/** /**
* 监测负责人id * 监测负责人id
*/ */
@Excel(name = "监测负责人id", width = 15) @Excel(name = "监测负责人id", width = 15)
@ApiModelProperty(value = "监测负责人id") @ApiModelProperty(value = "监测负责人id")
private java.lang.Long surveyDirectorId; private java.lang.Long surveyDirectorId;
/** /**
* 监测负责人名称 * 监测负责人名称
*/ */
@Excel(name = "监测负责人名称", width = 15) @Excel(name = "监测负责人名称", width = 15)
@ApiModelProperty(value = "监测负责人名称") @ApiModelProperty(value = "监测负责人名称")
private java.lang.String surveyDirectorName; private java.lang.String surveyDirectorName;
/** /**
* 监测人员id * 监测人员id
*/ */
@Excel(name = "监测人员id", width = 15) @Excel(name = "监测人员id", width = 15)
@ApiModelProperty(value = "监测人员id") @ApiModelProperty(value = "监测人员id")
private java.lang.Long surveyPersonnelId; private java.lang.Long surveyPersonnelId;
/** /**
* 监测人员名称 * 监测人员名称
*/ */
@Excel(name = "监测人员名称", width = 15) @Excel(name = "监测人员名称", width = 15)
@ApiModelProperty(value = "监测人员名称") @ApiModelProperty(value = "监测人员名称")
private java.lang.String surveyPersonnelName; private java.lang.String surveyPersonnelName;
/** /**
* 监测方案 * 监测方案
*/ */
@Excel(name = "监测方案", width = 15) @Excel(name = "监测方案", width = 15)
@ApiModelProperty(value = "监测方案") @ApiModelProperty(value = "监测方案")
private java.lang.Object surveyScheme; private String surveyScheme;
/** /**
* 地勘报告 * 地勘报告
*/ */
@Excel(name = "地勘报告", width = 15) @Excel(name = "地勘报告", width = 15)
@ApiModelProperty(value = "地勘报告") @ApiModelProperty(value = "地勘报告")
private java.lang.Object prospectingReport; private String prospectingReport;
/** /**
* 设计图纸 * 设计图纸
*/ */
@Excel(name = "设计图纸", width = 15) @Excel(name = "设计图纸", width = 15)
@ApiModelProperty(value = "设计图纸") @ApiModelProperty(value = "设计图纸")
private java.lang.Object deviseDrawing; private String deviseDrawing;
/** /**
* 安全等级 * 安全等级
*/ */
@Excel(name = "安全等级", width = 15) @Excel(name = "安全等级", width = 15)
@ApiModelProperty(value = "安全等级") @ApiModelProperty(value = "安全等级")
private java.lang.String safetyLevel; private java.lang.String safetyLevel;
/** /**
* 状态1进行中2已完成 * 状态1进行中2已完成
*/ */
@Excel(name = "状态1进行中2已完成", width = 15) @Excel(name = "状态1进行中2已完成", width = 15)
@ApiModelProperty(value = "状态1进行中2已完成") @ApiModelProperty(value = "状态1进行中2已完成")
private java.lang.Integer status; private java.lang.Integer status;
/** /**
* 创建时间 yyyy-MM-dd HH:mm:ss * 创建时间 yyyy-MM-dd HH:mm:ss
*/ */
@Excel(name = "创建时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "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") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime; private java.util.Date createTime;
/** /**
* 更新时间 yyyy-MM-dd HH:mm:ss * 更新时间 yyyy-MM-dd HH:mm:ss
*/ */
@Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "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") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime; private java.util.Date updateTime;
@ApiModelProperty(value = "默认监测内容ID") @ApiModelProperty(value = "高边坡-监测类型表id多个,分隔)")
@TableField(exist = false) @TableField(exist = false)
private String monitorTypeIds; @NotBlank
private String highSlopeMonitorTypeIds;
} }

View File

@ -13,13 +13,6 @@ import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/**
* @ClassName HighSlopeMonitorType
* @author 邱平毅
* @date 2022/8/19 11:25
* @Version 1.0
*/
/** /**
* 高边坡-监测类型表 * 高边坡-监测类型表
*/ */

View File

@ -144,7 +144,7 @@ public class HighSlopeSensor implements Serializable {
*/ */
@ApiModelProperty(value = "高边坡名称") @ApiModelProperty(value = "高边坡名称")
@TableField(exist = false) @TableField(exist = false)
private String engineeringName; private String slopeName;
/** /**
* 测点名称 * 测点名称
@ -175,8 +175,8 @@ public class HighSlopeSensor implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String unit; private String unit;
@TableField(exist = false)
@ApiModelProperty(value = "传感器编码") @ApiModelProperty(value = "传感器编码")
@TableField(exist = false)
private String sensorTypeCode; private String sensorTypeCode;

View File

@ -3,7 +3,7 @@
<mapper namespace="com.zhgd.xmgl.modules.highslope.mapper.HighSlopeCurrentDataMapper"> <mapper namespace="com.zhgd.xmgl.modules.highslope.mapper.HighSlopeCurrentDataMapper">
<select id="selectPageByProjectSn" <select id="selectPageByProjectSn"
resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeCurrentData"> resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeCurrentData">
SELECT dee.engineering_name engineeringName, SELECT dee.slope_name slopeName,
demp.measure_point_name measurePointName, demp.measure_point_name measurePointName,
dest.sensor_type_name sensorTypeName, dest.sensor_type_name sensorTypeName,
des.sensor_sn, des.sensor_sn,
@ -23,8 +23,8 @@
inner join high_slope_sensor des on decd.sensor_sn = des.sensor_sn inner join high_slope_sensor des on decd.sensor_sn = des.sensor_sn
inner join high_slope_measure_point demp inner join high_slope_measure_point demp
on des.measure_point_number = demp.measure_point_number on des.measure_point_number = demp.measure_point_number
inner join high_slope_engineering dee on demp.high_slope_id = dee.id inner join high_slope_engineering dee on demp.high_slope_engineering_id = dee.id
inner join high_slope_sensor_type dest on dest.id = des.sensor_type_id inner join high_slope_sensor_type dest on dest.id = des.high_slope_sensor_type_id
where dee.project_sn = #{projectSn} where dee.project_sn = #{projectSn}
<if test="sensorTypeId != null"> <if test="sensorTypeId != null">
and dest.id = #{sensorTypeId} and dest.id = #{sensorTypeId}
@ -81,7 +81,7 @@
<select id="selectHighSlopeCurrentDataList" <select id="selectHighSlopeCurrentDataList"
resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeCurrentData"> resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeCurrentData">
select dee.engineering_name engineeringName, select dee.slope_name slopeName,
demp.measure_point_name measurePointName, demp.measure_point_name measurePointName,
demp.measure_point_number measurePointNumber, demp.measure_point_number measurePointNumber,
dest.sensor_type_name sensorTypeName, dest.sensor_type_name sensorTypeName,

View File

@ -6,13 +6,13 @@
SELECT * SELECT *
from high_slope_engineering from high_slope_engineering
WHERE project_sn=#{param.projectSn} WHERE project_sn=#{param.projectSn}
order by start_time order by id desc
</select> </select>
<select id="selectHighSlopeList" <select id="selectHighSlopeList"
resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeEngineering"> resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeEngineering">
SELECT * SELECT *
from high_slope_engineering from high_slope_engineering
WHERE project_sn=#{projectSn} WHERE project_sn=#{projectSn}
order by start_time order by id desc
</select> </select>
</mapper> </mapper>

View File

@ -5,10 +5,10 @@
resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeMeasurePoint"> resultType="com.zhgd.xmgl.modules.highslope.entity.HighSlopeMeasurePoint">
select a.* select a.*
from high_slope_measure_point a from high_slope_measure_point a
INNER JOIN high_slope_monitor_type_rela b ON a.rela_id = b.id INNER JOIN high_slope_engineering_to_monitor_type b ON a.high_slope_engineering_to_monitor_type_id = b.id
where b.high_slope_id = #{highSlopeId} where b.high_slope_engineering_id = #{highSlopeId}
<if test="relaId != null and relaId != ''"> <if test="relaId != null and relaId != ''">
and a.rela_id = #{relaId} and a.high_slope_engineering_to_monitor_type_id = #{relaId}
</if> </if>
</select> </select>
@ -22,19 +22,19 @@
</resultMap> </resultMap>
<select id="getDetailsByMeasurePointNumber" resultMap="measurePointAndSensor"> <select id="getDetailsByMeasurePointNumber" resultMap="measurePointAndSensor">
select demp.id, select demp.id,
demp.high_slope_id, demp.high_slope_engineering_id,
demp.rela_id, demp.high_slope_engineering_to_monitor_type_id,
demp.measure_point_name, demp.measure_point_name,
demp.measure_point_number, demp.measure_point_number,
demp.measure_point_addr, demp.measure_point_addr,
demp.alarm_state, demp.alarm_state,
demp.alarm_type, demp.alarm_type,
demp.alarm_data_id, demp.high_slope_current_data_id,
demp.alarm_date, demp.alarm_date,
des.id sId, des.id sId,
des.sensor_sn, des.sensor_sn,
des.sensor_name, des.sensor_name,
des.sensor_type_id, des.high_slope_sensor_type_id,
des.status, des.status,
des.early_warning_value, des.early_warning_value,
des.alarm_value, des.alarm_value,

View File

@ -139,7 +139,7 @@ public class HighSlopeCurrentDataServiceImpl extends ServiceImpl<HighSlopeCurren
currentData.setAlarmStateStr(DataStatusEnum.getStatusNameById(currentData.getAlarmState())); currentData.setAlarmStateStr(DataStatusEnum.getStatusNameById(currentData.getAlarmState()));
} }
String[] heads = {"高边坡名称", "测点名称", "传感器类型", "传感器名称", "传感器编号", "初始值", "采集时间", "上次值", "本次值", "本次变化量", "累计值", "累计值预警值", "变化速率", "变化速率预警值", "报警状态"}; String[] heads = {"高边坡名称", "测点名称", "传感器类型", "传感器名称", "传感器编号", "初始值", "采集时间", "上次值", "本次值", "本次变化量", "累计值", "累计值预警值", "变化速率", "变化速率预警值", "报警状态"};
String[] headsStr = {"engineeringName", "measurePointName", "sensorTypeName", "sensorName", "sensorSn", "fiducialValue", "receiveTime", "lastTimeData", "data", "dataThis", "dataTotal", "alarmValue", "dataRate", "rateAlarmValue", "alarmStateStr"}; String[] headsStr = {"slopeName", "measurePointName", "sensorTypeName", "sensorName", "sensorSn", "fiducialValue", "receiveTime", "lastTimeData", "data", "dataThis", "dataTotal", "alarmValue", "dataRate", "rateAlarmValue", "alarmStateStr"};
JxlExcelUtils.excelExport("高边坡实时数据列表", heads, headsStr, list, response); JxlExcelUtils.excelExport("高边坡实时数据列表", heads, headsStr, list, response);
} catch (Exception e) { } catch (Exception e) {
log.error("导出培训记录数据异常" + e); log.error("导出培训记录数据异常" + e);

View File

@ -62,10 +62,10 @@ public class HighSlopeEngineeringServiceImpl extends ServiceImpl<HighSlopeEngine
public void saveHighSlopeEngineering(HighSlopeEngineering highSlopeEngineering) { public void saveHighSlopeEngineering(HighSlopeEngineering highSlopeEngineering) {
checkParams(highSlopeEngineering); checkParams(highSlopeEngineering);
setStatus(highSlopeEngineering); setStatus(highSlopeEngineering);
highSlopeEngineering.setId(null);
highSlopeEngineeringMapper.insert(highSlopeEngineering); highSlopeEngineeringMapper.insert(highSlopeEngineering);
if (StringUtils.isNotEmpty(highSlopeEngineering.getMonitorTypeIds())) { if (StringUtils.isNotEmpty(highSlopeEngineering.getHighSlopeMonitorTypeIds())) {
String date = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); List<HighSlopeEngineeringToMonitorType> relaList = Arrays.stream(highSlopeEngineering.getHighSlopeMonitorTypeIds().split(","))
List<HighSlopeEngineeringToMonitorType> relaList = Arrays.stream(highSlopeEngineering.getMonitorTypeIds().split(","))
.map(item -> new HighSlopeEngineeringToMonitorType(null, highSlopeEngineering.getId(), Long.valueOf(item), null, null)).collect(Collectors.toList()); .map(item -> new HighSlopeEngineeringToMonitorType(null, highSlopeEngineering.getId(), Long.valueOf(item), null, null)).collect(Collectors.toList());
highSlopeEngineeringToMonitorTypeService.saveBatch(relaList); highSlopeEngineeringToMonitorTypeService.saveBatch(relaList);
} }
@ -74,7 +74,7 @@ public class HighSlopeEngineeringServiceImpl extends ServiceImpl<HighSlopeEngine
@Override @Override
public void deleteHighSlopeEngineering(Long id) { public void deleteHighSlopeEngineering(Long id) {
highSlopeEngineeringToMonitorTypeService.deleteByExcavationId(id); highSlopeEngineeringToMonitorTypeService.deleteByExcavationId(id);
highSlopeEngineeringMapper.delete(Wrappers.<HighSlopeEngineering>lambdaQuery().eq(HighSlopeEngineering::getId, id)); highSlopeEngineeringMapper.deleteById(id);
} }
@Override @Override

View File

@ -28,7 +28,6 @@ public class HighSlopeEngineeringToEngineeringToMonitorTypeServiceImpl extends S
@Override @Override
public void deleteByExcavationId(Long id) { public void deleteByExcavationId(Long id) {
LambdaQueryWrapper<HighSlopeEngineeringToMonitorType> queryWrapper = Wrappers.<HighSlopeEngineeringToMonitorType>lambdaQuery().eq(HighSlopeEngineeringToMonitorType::getHighSlopeEngineeringId, id); LambdaQueryWrapper<HighSlopeEngineeringToMonitorType> queryWrapper = Wrappers.<HighSlopeEngineeringToMonitorType>lambdaQuery().eq(HighSlopeEngineeringToMonitorType::getHighSlopeEngineeringId, id);
List<Long> relaIdList = highSlopeEngineeringToMonitorTypeMapper.selectList(queryWrapper).stream().map(HighSlopeEngineeringToMonitorType::getId).collect(Collectors.toList()); List<Long> relaIdList = highSlopeEngineeringToMonitorTypeMapper.selectList(queryWrapper).stream().map(HighSlopeEngineeringToMonitorType::getId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(relaIdList)) { if (CollUtil.isNotEmpty(relaIdList)) {
highSlopeMeasurePointService.deleteByRelaIdList(relaIdList); highSlopeMeasurePointService.deleteByRelaIdList(relaIdList);

View File

@ -51,7 +51,6 @@ public class HighSlopeMeasurePointServiceImpl extends ServiceImpl<HighSlopeMeasu
// 验证测点编号是否存在 // 验证测点编号是否存在
QueryWrapper<HighSlopeMeasurePoint> queryWrapper = new QueryWrapper<>(); QueryWrapper<HighSlopeMeasurePoint> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HighSlopeMeasurePoint::getMeasurePointNumber, measurePointNumber); queryWrapper.lambda().eq(HighSlopeMeasurePoint::getMeasurePointNumber, measurePointNumber);
// queryWrapper.lambda().eq(HighSlopeMeasurePoint::getMeasurePointNumber, measurePointNumber).eq(HighSlopeMeasurePoint::getRelaId, highSlopeMeasurePoint.getRelaId());
int count = highSlopeMeasurePointMapper.selectCount(queryWrapper); int count = highSlopeMeasurePointMapper.selectCount(queryWrapper);
if (count > 0) { if (count > 0) {
log.warn("当前监测类型,测点编号 {} 已存在!", measurePointNumber); log.warn("当前监测类型,测点编号 {} 已存在!", measurePointNumber);
@ -60,9 +59,8 @@ public class HighSlopeMeasurePointServiceImpl extends ServiceImpl<HighSlopeMeasu
// 验证是否存在 // 验证是否存在
List<HighSlopeSensor> sensorList = highSlopeMeasurePoint.getSensorList(); List<HighSlopeSensor> sensorList = highSlopeMeasurePoint.getSensorList();
verifySensorData(sensorList); verifySensorData(sensorList);
highSlopeMeasurePoint.setAlarmState(1); highSlopeMeasurePoint.setAlarmState(1);
highSlopeMeasurePoint.setId(null);
highSlopeMeasurePointMapper.insert(highSlopeMeasurePoint); highSlopeMeasurePointMapper.insert(highSlopeMeasurePoint);
for (HighSlopeSensor highSlopeSensor : sensorList) { for (HighSlopeSensor highSlopeSensor : sensorList) {

View File

@ -285,6 +285,8 @@ public class Project implements Serializable {
private String extend2; private String extend2;
@ApiModelProperty(value = "中建四局指挥中心BIM") @ApiModelProperty(value = "中建四局指挥中心BIM")
private String bimCommandCenterUrl; private String bimCommandCenterUrl;
@ApiModelProperty(value = "天气信息")
private String weatherInfo;
/** /**
* runde平台token * runde平台token

View File

@ -132,6 +132,20 @@ public class SmartBeamFieldBeamController {
return result; return result;
} }
@ApiOperation(value = "开始生产", notes = "开始生产", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "智慧梁场-梁ID", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/beginProduce")
public Result beginProduce(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
Long id = MapUtils.getLong(paramMap, "id");
SmartBeamFieldBeam entity = new SmartBeamFieldBeam();
entity.setId(id);
entity.setBeamMakeStatus(2);
smartBeamFieldBeamService.updateById(entity);
return Result.ok();
}
@ApiOperation(value = "给梁绑定生产线", notes = "给梁绑定生产线", httpMethod = "POST") @ApiOperation(value = "给梁绑定生产线", notes = "给梁绑定生产线", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "smartBeamFieldBeamId", value = "智慧梁场-梁ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "smartBeamFieldBeamId", value = "智慧梁场-梁ID", paramType = "body", required = true, dataType = "String"),

View File

@ -26,12 +26,12 @@
<select id="countSmartBeamFieldBeam" <select id="countSmartBeamFieldBeam"
resultType="com.zhgd.xmgl.modules.smartbeamfield.entity.vo.CountSmartBeamFieldBeamVo"> resultType="com.zhgd.xmgl.modules.smartbeamfield.entity.vo.CountSmartBeamFieldBeamVo">
select t.*, ifnull(round(makeBeamPedestalOccupyCount / makeBeamPedestalCount, 2), 0) as select t.*, ifnull(round(makeBeamPedestalOccupyCount / makeBeamPedestalCount*100, 2), 0) as
makeBeamPedestalOccupyRate, makeBeamPedestalOccupyRate,
makeBeamPedestalCount-makeBeamPedestalOccupyCount as makeBeamPedestalNotOccupyCount makeBeamPedestalCount-makeBeamPedestalOccupyCount as makeBeamPedestalNotOccupyCount
from ( from (
select count(*) makeBeamPedestalCount, 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 from smart_beam_field_make_beam_pedestal sbfmbp
left join (SELECT * left join (SELECT *
FROM smart_beam_field_beam_to_process FROM smart_beam_field_beam_to_process

View File

@ -20,6 +20,7 @@ import com.zhgd.xmgl.modules.smartbeamfield.service.ISmartBeamFieldProductionLin
import com.zhgd.xmgl.util.PageUtil; import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil; import com.zhgd.xmgl.util.RefUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -81,7 +82,14 @@ public class SmartBeamFieldProductionLineServiceImpl extends ServiceImpl<SmartBe
throw new OpenAlertException("productionLineMakeBeamPedestalList[i].smartBeamFieldMakeBeamPedestalId智慧梁场-制梁台座id不能为空"); throw new OpenAlertException("productionLineMakeBeamPedestalList[i].smartBeamFieldMakeBeamPedestalId智慧梁场-制梁台座id不能为空");
} }
pedestal.setProjectSn(smartBeamFieldProductionLine.getProjectSn()); pedestal.setProjectSn(smartBeamFieldProductionLine.getProjectSn());
smartBeamFieldProductionLineToMakeBeamPedestalMapper.insert(pedestal); try {
smartBeamFieldProductionLineToMakeBeamPedestalMapper.insert(pedestal);
} catch (Exception e) {
e.printStackTrace();
if (e instanceof DuplicateKeyException) {
throw new OpenAlertException("制梁台座已被绑定,请刷新重试");
}
}
} }
} }
} }

View File

@ -116,7 +116,6 @@ public class StableWaterMixStationTask {
//请求成功 //请求成功
//第10步处理请求结果第三方系统自行处理 //第10步处理请求结果第三方系统自行处理
String stringContent = restResponseInfo.getStringContent(); String stringContent = restResponseInfo.getStringContent();
System.out.println(stringContent);
JSONObject scjo = JSON.parseObject(stringContent); JSONObject scjo = JSON.parseObject(stringContent);
if (scjo.getBoolean("success")) { if (scjo.getBoolean("success")) {
saveData(scjo.getJSONObject("data"), project); saveData(scjo.getJSONObject("data"), project);

View File

@ -3,8 +3,8 @@ package com.zhgd.xmgl.util;
import cn.hutool.http.HttpException; import cn.hutool.http.HttpException;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gexin.fastjson.JSON; import com.gexin.fastjson.JSON;
import com.gexin.fastjson.JSONObject;
import com.zhgd.redis.lock.RedisRepository; import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.modules.basicdata.entity.SystemCities; import com.zhgd.xmgl.modules.basicdata.entity.SystemCities;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemCitiesMapper; import com.zhgd.xmgl.modules.basicdata.mapper.SystemCitiesMapper;
@ -36,16 +36,29 @@ public class AqiUtil {
public static String SYSTEM_CITIES_KEY = "SYSTEM_CITIES"; public static String SYSTEM_CITIES_KEY = "SYSTEM_CITIES";
public static String WEATHER_DATA = "WEATHER_DATA:"; public static String WEATHER_DATA = "WEATHER_DATA:";
private static String tianqiUrl; private static String tianqiUrl;
private static String tianqiAppid;
private static String tianqiAppsecret;
/** /**
* 天气质量 * 天气质量
*/ */
public static String WEATHER_QUALITY = "WEATHER_QUALITY:"; public static String WEATHER_QUALITY = "WEATHER_QUALITY:";
public static String WEATHER_LIVE = "WEATHER_LIVE:";
@Value("${tianqiUrl}") @Value("${tianqiUrl}")
public void setTianqiUrl(String tianqiUrl) { public void setTianqiUrl(String tianqiUrl) {
AqiUtil.tianqiUrl = tianqiUrl; AqiUtil.tianqiUrl = tianqiUrl;
} }
@Value("${tianqiAppid}")
public void setTianqiAppid(String tianqiAppid) {
AqiUtil.tianqiAppid = tianqiAppid;
}
@Value("${tianqiAppsecret}")
public void setTianqiAppsecret(String tianqiAppsecret) {
AqiUtil.tianqiAppsecret = tianqiAppsecret;
}
@Autowired @Autowired
public void setSystemCitiesMapper(SystemCitiesMapper systemCitiesMapper) { public void setSystemCitiesMapper(SystemCitiesMapper systemCitiesMapper) {
AqiUtil.systemCitiesMapper = systemCitiesMapper; AqiUtil.systemCitiesMapper = systemCitiesMapper;
@ -184,13 +197,16 @@ public class AqiUtil {
Double air = null; Double air = null;
try { try {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("appid", "41289558"); param.put("appid", tianqiAppid);
param.put("appsecret", "45CS7niV"); param.put("appsecret", tianqiAppsecret);
String cityId = Optional.ofNullable(cityIdMap.get(cityCode)).map(e -> e.getWeathercityid()).orElse(null); String cityId = Optional.ofNullable(cityIdMap.get(cityCode)).map(e -> e.getWeathercityid()).orElse(null);
if (StringUtils.isNotBlank(cityId)) { if (StringUtils.isNotBlank(cityId)) {
param.put("cityid", 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) { if (result != null && result.length() > 0) {
JSONObject obj = JSONObject.parseObject(result); JSONObject obj = JSONObject.parseObject(result);
if (obj != null && obj.getString("air") != null) { if (obj != null && obj.getString("air") != null) {
@ -207,22 +223,56 @@ public class AqiUtil {
return air; return air;
} }
/**
* 实况天气
*
* @param cityCode cityid
* @return
*/
public static Object getLiveWeatherInfo(String cityCode) {
List<SystemCities> 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<String, SystemCities> cityIdMap = systemCities.stream().collect(Collectors.toMap(e -> e.getCityid(), Function.identity(), (o, o2) -> o));
HashMap result = null;
try {
Map<String, Object> 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) { public static String getWeatherData(String cityid) {
String result = ""; String result = "";
try { try {
result = redisRepository.getOrSet(WEATHER_DATA + cityid, () -> { result = redisRepository.getOrSet(WEATHER_DATA + cityid, () -> {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("unescape", "1"); param.put("unescape", "1");
//param.put("appid", "79112751"); param.put("appid", tianqiAppid);
//param.put("appsecret", "EBqjU987"); param.put("appsecret", tianqiAppsecret);
param.put("appid", "41289558");
param.put("appsecret", "45CS7niV");
if (StringUtils.isNotEmpty(cityid)) { if (StringUtils.isNotEmpty(cityid)) {
param.put("cityid", cityid); param.put("cityid", cityid);
} }
String r = HttpUtil.get(tianqiUrl, param); String r = HttpUtil.get(tianqiUrl + "/free/week", param);
JSONObject jsonObject = JSONObject.parseObject(r); JSONObject jsonObject = JSONObject.parseObject(r);
JSONArray sevenDataArr = jsonObject.getJSONArray("data"); com.gexin.fastjson.JSONArray sevenDataArr = jsonObject.getJSONArray("data");
for (Object o : sevenDataArr) { for (Object o : sevenDataArr) {
JSONObject jo = (JSONObject) o; JSONObject jo = (JSONObject) o;
jo.put("cityid", jsonObject.get("cityid")); jo.put("cityid", jsonObject.get("cityid"));

View File

@ -154,6 +154,10 @@ koyoe.nowData=${koyoe.base-url}/third-party/api/nowData?sn=%s
# 是否证书验证 # 是否证书验证
is-license=false is-license=false
#天气url #天气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.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8