Merge remote-tracking branch 'origin/guoshengxiong' into guoshengxiong
This commit is contained in:
commit
463b1e69cf
@ -0,0 +1,120 @@
|
||||
package com.zhgd.xmgl.modules.environment.controller;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainAlarm;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainAlarmService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 雨量监测报警记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/rainAlarm")
|
||||
@Slf4j
|
||||
@Api(tags = "雨量监测报警记录相关Api")
|
||||
public class RainAlarmController {
|
||||
@Autowired
|
||||
private IRainAlarmService rainAlarmService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表查询雨量监测报警记录信息", notes = "分页列表查询雨量监测报警记录信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<RainAlarm>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(rainAlarmService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "列表查询雨量监测报警记录信息", notes = "列表查询雨量监测报警记录信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<RainAlarm>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(rainAlarmService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param rainAlarm
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加雨量监测报警记录信息", notes = "添加雨量监测报警记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<RainAlarm> add(@RequestBody @Validate RainAlarm rainAlarm) {
|
||||
rainAlarmService.add(rainAlarm);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param rainAlarm
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "编辑雨量监测报警记录信息", notes = "编辑雨量监测报警记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<RainAlarm> edit(@RequestBody RainAlarm rainAlarm) {
|
||||
rainAlarmService.edit(rainAlarm);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除雨量监测报警记录信息", notes = "删除雨量监测报警记录信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "雨量监测报警记录ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<RainAlarm> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
rainAlarmService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询雨量监测报警记录信息", notes = "通过id查询雨量监测报警记录信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "雨量监测报警记录ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<RainAlarm> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(rainAlarmService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
package com.zhgd.xmgl.modules.environment.controller;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainDev;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainDevService;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 雨量监测设备
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/rainDev")
|
||||
@Slf4j
|
||||
@Api(tags = "雨量监测设备相关Api")
|
||||
public class RainDevController {
|
||||
@Autowired
|
||||
private IRainDevService rainDevService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表查询雨量监测设备信息", notes = "分页列表查询雨量监测设备信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<RainDev>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(rainDevService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "列表查询雨量监测设备信息", notes = "列表查询雨量监测设备信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<RainDev>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(rainDevService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param rainDev
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加雨量监测设备信息", notes = "添加雨量监测设备信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<RainDev> add(@RequestBody @Validate RainDev rainDev) {
|
||||
rainDevService.add(rainDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param rainDev
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "编辑雨量监测设备信息", notes = "编辑雨量监测设备信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<RainDev> edit(@RequestBody RainDev rainDev) {
|
||||
rainDevService.edit(rainDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除雨量监测设备信息", notes = "删除雨量监测设备信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "雨量监测设备ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<RainDev> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
rainDevService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询雨量监测设备信息", notes = "通过id查询雨量监测设备信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "雨量监测设备ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<RainDev> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(rainDevService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
package com.zhgd.xmgl.modules.environment.controller;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainRecord;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainRecordService;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 雨量监测记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/rainRecord")
|
||||
@Slf4j
|
||||
@Api(tags = "雨量监测记录相关Api")
|
||||
public class RainRecordController {
|
||||
@Autowired
|
||||
private IRainRecordService rainRecordService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表查询雨量监测记录信息", notes = "分页列表查询雨量监测记录信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<RainRecord>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(rainRecordService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "列表查询雨量监测记录信息", notes = "列表查询雨量监测记录信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<RainRecord>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(rainRecordService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param rainRecord
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加雨量监测记录信息", notes = "添加雨量监测记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<RainRecord> add(@RequestBody @Validate RainRecord rainRecord) {
|
||||
rainRecordService.add(rainRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param rainRecord
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "编辑雨量监测记录信息", notes = "编辑雨量监测记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<RainRecord> edit(@RequestBody RainRecord rainRecord) {
|
||||
rainRecordService.edit(rainRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除雨量监测记录信息", notes = "删除雨量监测记录信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "雨量监测记录ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<RainRecord> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
rainRecordService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询雨量监测记录信息", notes = "通过id查询雨量监测记录信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "雨量监测记录ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<RainRecord> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(rainRecordService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.zhgd.xmgl.modules.environment.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测报警记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("rain_alarm")
|
||||
@ApiModel(value = "RainAlarm实体类", description = "RainAlarm")
|
||||
public class RainAlarm implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 报警内容
|
||||
*/
|
||||
@Excel(name = "报警内容", width = 15)
|
||||
@ApiModelProperty(value = "报警内容")
|
||||
private java.lang.String alarmContent;
|
||||
/**
|
||||
* 报警值
|
||||
*/
|
||||
@Excel(name = "报警值", width = 15)
|
||||
@ApiModelProperty(value = "报警值")
|
||||
private java.lang.Double alarmVal;
|
||||
/**
|
||||
* 所属项目SN
|
||||
*/
|
||||
@Excel(name = "所属项目SN", width = 15)
|
||||
@ApiModelProperty(value = "所属项目SN")
|
||||
private java.lang.String projectSn;
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date alarmTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createDate;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate;
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.zhgd.xmgl.modules.environment.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测设备
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("rain_dev")
|
||||
@ApiModel(value = "RainDev实体类", description = "RainDev")
|
||||
public class RainDev implements Serializable {
|
||||
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 devSn;
|
||||
/**
|
||||
* 设备名字
|
||||
*/
|
||||
@Excel(name = "设备名字", width = 15)
|
||||
@ApiModelProperty(value = "设备名字")
|
||||
private java.lang.String devName;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 设备所在经度
|
||||
*/
|
||||
@Excel(name = "设备所在经度", width = 15)
|
||||
@ApiModelProperty(value = "设备所在经度")
|
||||
private java.lang.String lng;
|
||||
/**
|
||||
* 设备所在纬度
|
||||
*/
|
||||
@Excel(name = "设备所在纬度", width = 15)
|
||||
@ApiModelProperty(value = "设备所在纬度")
|
||||
private java.lang.String lat;
|
||||
/**
|
||||
* 报警推送人,多个逗号分割
|
||||
*/
|
||||
@Excel(name = "报警推送人,多个逗号分割", width = 15)
|
||||
@ApiModelProperty(value = "报警推送人,多个逗号分割")
|
||||
private java.lang.String alarmPushWorkerId;
|
||||
/**
|
||||
* 在线状态(0.离线 1.在线)
|
||||
*/
|
||||
@Excel(name = "在线状态(0.离线 1.在线)", width = 15)
|
||||
@ApiModelProperty(value = "在线状态(0.离线 1.在线)")
|
||||
private java.lang.Integer online;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createDate;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateDate;
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
package com.zhgd.xmgl.modules.environment.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("rain_record")
|
||||
@ApiModel(value = "RainRecord实体类", description = "RainRecord")
|
||||
public class RainRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 风力/级
|
||||
*/
|
||||
@Excel(name = "风力/级", width = 15)
|
||||
@ApiModelProperty(value = "风力/级")
|
||||
private java.lang.Double windForce;
|
||||
/**
|
||||
* 风速m/s
|
||||
*/
|
||||
@Excel(name = "风速m/s", width = 15)
|
||||
@ApiModelProperty(value = "风速m/s")
|
||||
private java.lang.Double windSpeed;
|
||||
/**
|
||||
* 风向
|
||||
*/
|
||||
@Excel(name = "风向", width = 15)
|
||||
@ApiModelProperty(value = "风向")
|
||||
private java.lang.String windDirection;
|
||||
/**
|
||||
* 累计雨量mm
|
||||
*/
|
||||
@Excel(name = "累计雨量mm", width = 15)
|
||||
@ApiModelProperty(value = "累计雨量mm")
|
||||
private java.lang.Double accumulatedRainfall;
|
||||
/**
|
||||
* 瞬时雨量mm
|
||||
*/
|
||||
@Excel(name = "瞬时雨量mm", width = 15)
|
||||
@ApiModelProperty(value = "瞬时雨量mm")
|
||||
private java.lang.Double instantaneousRainfall;
|
||||
/**
|
||||
* 当前雨量(今日雨量)mm
|
||||
*/
|
||||
@Excel(name = "当前雨量(今日雨量)mm", width = 15)
|
||||
@ApiModelProperty(value = "当前雨量(今日雨量)mm")
|
||||
private java.lang.Double currentRainfall;
|
||||
/**
|
||||
* 日雨量(昨日雨量)mm
|
||||
*/
|
||||
@Excel(name = "日雨量(昨日雨量)mm", width = 15)
|
||||
@ApiModelProperty(value = "日雨量(昨日雨量)mm")
|
||||
private java.lang.Double dailyRainfall;
|
||||
/**
|
||||
* 空气温度℃
|
||||
*/
|
||||
@Excel(name = "空气温度℃", width = 15)
|
||||
@ApiModelProperty(value = "空气温度℃")
|
||||
private java.lang.Double airTemperature;
|
||||
/**
|
||||
* 空气湿度%
|
||||
*/
|
||||
@Excel(name = "空气湿度%", width = 15)
|
||||
@ApiModelProperty(value = "空气湿度%")
|
||||
private java.lang.Double airHumidity;
|
||||
/**
|
||||
* 大气压Kpa
|
||||
*/
|
||||
@Excel(name = "大气压Kpa", width = 15)
|
||||
@ApiModelProperty(value = "大气压Kpa")
|
||||
private java.lang.Double atmosphericPressure;
|
||||
/**
|
||||
* 设备SN
|
||||
*/
|
||||
@Excel(name = "设备SN", width = 15)
|
||||
@ApiModelProperty(value = "设备SN")
|
||||
private java.lang.String devSn;
|
||||
/**
|
||||
* 所属项目SN
|
||||
*/
|
||||
@Excel(name = "所属项目SN", width = 15)
|
||||
@ApiModelProperty(value = "所属项目SN")
|
||||
private java.lang.String projectSn;
|
||||
@ApiModelProperty(value = "记录时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date recordTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createDate;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.zhgd.xmgl.modules.environment.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainAlarm;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测报警记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RainAlarmMapper extends BaseMapper<RainAlarm> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.zhgd.xmgl.modules.environment.mapper;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainDev;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测设备
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RainDevMapper extends BaseMapper<RainDev> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.zhgd.xmgl.modules.environment.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RainRecordMapper extends BaseMapper<RainRecord> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.environment.mapper.RainAlarmMapper">
|
||||
</mapper>
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.environment.mapper.RainDevMapper">
|
||||
</mapper>
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.environment.mapper.RainRecordMapper">
|
||||
</mapper>
|
||||
@ -0,0 +1,30 @@
|
||||
package com.zhgd.xmgl.modules.environment.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainAlarm;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测报警记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IRainAlarmService extends IService<RainAlarm> {
|
||||
|
||||
IPage<RainAlarm> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
List<RainAlarm> queryList(HashMap<String, Object> param);
|
||||
|
||||
void add(RainAlarm rainAlarm);
|
||||
|
||||
void edit(RainAlarm rainAlarm);
|
||||
|
||||
void delete(String id);
|
||||
|
||||
RainAlarm queryById(String id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.zhgd.xmgl.modules.environment.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainDev;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测设备
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IRainDevService extends IService<RainDev> {
|
||||
|
||||
IPage<RainDev> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
List<RainDev> queryList(HashMap<String, Object> param);
|
||||
|
||||
void add(RainDev rainDev);
|
||||
|
||||
void edit(RainDev rainDev);
|
||||
|
||||
void delete(String id);
|
||||
|
||||
RainDev queryById(String id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.zhgd.xmgl.modules.environment.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IRainRecordService extends IService<RainRecord> {
|
||||
|
||||
IPage<RainRecord> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
List<RainRecord> queryList(HashMap<String, Object> param);
|
||||
|
||||
void add(RainRecord rainRecord);
|
||||
|
||||
void edit(RainRecord rainRecord);
|
||||
|
||||
void delete(String id);
|
||||
|
||||
RainRecord queryById(String id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.zhgd.xmgl.modules.environment.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.environment.mapper.RainAlarmMapper;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainAlarmService;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainAlarm;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测报警记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RainAlarmServiceImpl extends ServiceImpl<RainAlarmMapper, RainAlarm> implements IRainAlarmService {
|
||||
@Autowired
|
||||
private RainAlarmMapper rainAlarmMapper;
|
||||
|
||||
@Override
|
||||
public IPage<RainAlarm> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RainAlarm> queryWrapper = getQueryWrapper(param);
|
||||
Page<RainAlarm> page = PageUtil.getPage(param);
|
||||
IPage<RainAlarm> pageList = this.page(page, queryWrapper);
|
||||
pageList.setRecords(dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RainAlarm> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RainAlarm> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<RainAlarm> getQueryWrapper(HashMap<String, Object> param) {
|
||||
String alias = "";
|
||||
QueryWrapper<RainAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(RainAlarm.class, param, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(RainAlarm::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<RainAlarm> dealList(List<RainAlarm> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RainAlarm rainAlarm) {
|
||||
rainAlarm.setId(null);
|
||||
baseMapper.insert(rainAlarm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(RainAlarm rainAlarm) {
|
||||
RainAlarm oldRainAlarm = baseMapper.selectById(rainAlarm.getId());
|
||||
if (oldRainAlarm == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(rainAlarm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
RainAlarm rainAlarm = baseMapper.selectById(id);
|
||||
if (rainAlarm == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RainAlarm queryById(String id) {
|
||||
RainAlarm entity = getById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.zhgd.xmgl.modules.environment.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainDev;
|
||||
import com.zhgd.xmgl.modules.environment.mapper.RainDevMapper;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainDevService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测设备
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RainDevServiceImpl extends ServiceImpl<RainDevMapper, RainDev> implements IRainDevService {
|
||||
@Autowired
|
||||
private RainDevMapper rainDevMapper;
|
||||
|
||||
@Override
|
||||
public IPage<RainDev> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RainDev> queryWrapper = getQueryWrapper(param);
|
||||
Page<RainDev> page = PageUtil.getPage(param);
|
||||
IPage<RainDev> pageList = this.page(page, queryWrapper);
|
||||
pageList.setRecords(dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RainDev> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RainDev> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<RainDev> getQueryWrapper(HashMap<String, Object> param) {
|
||||
String alias = "";
|
||||
QueryWrapper<RainDev> queryWrapper = QueryGenerator.initPageQueryWrapper(RainDev.class, param, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(RainDev::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<RainDev> dealList(List<RainDev> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RainDev rainDev) {
|
||||
rainDev.setId(null);
|
||||
baseMapper.insert(rainDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(RainDev rainDev) {
|
||||
RainDev oldRainDev = baseMapper.selectById(rainDev.getId());
|
||||
if (oldRainDev == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(rainDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
RainDev rainDev = baseMapper.selectById(id);
|
||||
if (rainDev == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RainDev queryById(String id) {
|
||||
RainDev entity = getById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.zhgd.xmgl.modules.environment.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainRecord;
|
||||
import com.zhgd.xmgl.modules.environment.mapper.RainRecordMapper;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 雨量监测记录
|
||||
* @author: pds
|
||||
* @date: 2024-06-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RainRecordServiceImpl extends ServiceImpl<RainRecordMapper, RainRecord> implements IRainRecordService {
|
||||
@Autowired
|
||||
private RainRecordMapper rainRecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<RainRecord> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RainRecord> queryWrapper = getQueryWrapper(param);
|
||||
Page<RainRecord> page = PageUtil.getPage(param);
|
||||
IPage<RainRecord> pageList = this.page(page, queryWrapper);
|
||||
pageList.setRecords(dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RainRecord> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<RainRecord> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<RainRecord> getQueryWrapper(HashMap<String, Object> param) {
|
||||
String alias = "";
|
||||
QueryWrapper<RainRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(RainRecord.class, param, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(RainRecord::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<RainRecord> dealList(List<RainRecord> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RainRecord rainRecord) {
|
||||
rainRecord.setId(null);
|
||||
baseMapper.insert(rainRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(RainRecord rainRecord) {
|
||||
RainRecord oldRainRecord = baseMapper.selectById(rainRecord.getId());
|
||||
if (oldRainRecord == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(rainRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
RainRecord rainRecord = baseMapper.selectById(id);
|
||||
if (rainRecord == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RainRecord queryById(String id) {
|
||||
RainRecord entity = getById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
237
src/main/java/com/zhgd/xmgl/task/RainTask.java
Normal file
237
src/main/java/com/zhgd/xmgl/task/RainTask.java
Normal file
@ -0,0 +1,237 @@
|
||||
package com.zhgd.xmgl.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.redis.lock.RedisRepository;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainAlarm;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainDev;
|
||||
import com.zhgd.xmgl.modules.environment.entity.RainRecord;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainAlarmService;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainDevService;
|
||||
import com.zhgd.xmgl.modules.environment.service.IRainRecordService;
|
||||
import com.zhgd.xmgl.util.RenZhiUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("xmgl/task")
|
||||
public class RainTask {
|
||||
public static final String REDIS_RAIN_ALARM_TASK_START_TIME = "getRainAlarmTaskStartTime";
|
||||
@Resource
|
||||
@Lazy
|
||||
private IRainRecordService rainRecordService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private IRainAlarmService rainAlarmService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private IRainDevService rainDevService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private RedisRepository redisRepository;
|
||||
|
||||
/**
|
||||
* 获取实时数据
|
||||
*/
|
||||
@Scheduled(cron = "0 */2 * * * ?")
|
||||
@SchedulerLock(name = "getRainRecordTask", lockAtMostFor = 1000 * 60, lockAtLeastFor = 1000 * 60)
|
||||
@RequestMapping("getRainRecordTask")
|
||||
public void getRainRecordTask() {
|
||||
List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.ne(Project::getJnrzckAccount, "")
|
||||
.ne(Project::getJnrzckPw, "")
|
||||
);
|
||||
for (Project project : projectList) {
|
||||
try {
|
||||
saveAllRecord(project);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveAllRecord(Project project) {
|
||||
List<RainDev> devs = rainDevService.list(new LambdaQueryWrapper<RainDev>().eq(RainDev::getProjectSn, project.getProjectSn()));
|
||||
if (CollUtil.isEmpty(devs)) {
|
||||
return;
|
||||
}
|
||||
Map<String, RainDev> devSnMap = devs.stream().collect(Collectors.toMap(RainDev::getDevSn, Function.identity()));
|
||||
JSONArray datas = RenZhiUtil.getRealTimeDataByDeviceAddr(StrUtil.join(",", devs.stream().map(RainDev::getDevSn).collect(Collectors.toList())), project.getJnrzckAccount(), project.getJnrzckPw());
|
||||
if (CollUtil.isEmpty(datas)) {
|
||||
log.info("获取实时数据为空,项目名称:{}", project.getProjectName());
|
||||
return;
|
||||
}
|
||||
List<RainRecord> records = new ArrayList<>();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject dataJo = datas.getJSONObject(i);
|
||||
JSONArray dataItemJa = dataJo.getJSONArray("dataItem");
|
||||
String deviceAddr = dataJo.getString("deviceAddr");
|
||||
RainRecord record = new RainRecord();
|
||||
for (int j = 0; j < dataItemJa.size(); j++) {
|
||||
JSONObject itemJo = dataItemJa.getJSONObject(j);
|
||||
Integer nodeId = itemJo.getInteger("nodeId");
|
||||
JSONArray registerItemJa = itemJo.getJSONArray("registerItem");
|
||||
if (nodeId == 1) {
|
||||
//风力、风速
|
||||
record.setWindForce(getDouble(registerItemJa, 0));
|
||||
record.setWindSpeed(getDouble(registerItemJa, 1));
|
||||
} else if (nodeId == 2) {
|
||||
record.setWindDirection(getString(registerItemJa, 0));
|
||||
} else if (nodeId == 20) {
|
||||
record.setAccumulatedRainfall(getDouble(registerItemJa, 0));
|
||||
} else if (nodeId == 21) {
|
||||
record.setInstantaneousRainfall(getDouble(registerItemJa, 0));
|
||||
record.setCurrentRainfall(getDouble(registerItemJa, 1));
|
||||
} else if (nodeId == 22) {
|
||||
record.setDailyRainfall(getDouble(registerItemJa, 0));
|
||||
} else if (nodeId == 11) {
|
||||
record.setAirTemperature(getDouble(registerItemJa, 0));
|
||||
record.setAirHumidity(getDouble(registerItemJa, 1));
|
||||
} else if (nodeId == 14) {
|
||||
record.setAtmosphericPressure(getDouble(registerItemJa, 0));
|
||||
}
|
||||
}
|
||||
record.setRecordTime(new Date(dataJo.getLong("timeStamp")));
|
||||
record.setDevSn(deviceAddr);
|
||||
record.setProjectSn(devSnMap.get(deviceAddr).getProjectSn());
|
||||
records.add(record);
|
||||
}
|
||||
rainRecordService.saveBatch(records);
|
||||
}
|
||||
|
||||
private String getString(JSONArray registerItemJa, int index) {
|
||||
return Optional.ofNullable(registerItemJa.getJSONObject(index)).map(o -> o.getString("data")).orElse(null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Double getDouble(JSONArray registerItemJa, int index) {
|
||||
return Optional.ofNullable(registerItemJa.getJSONObject(index)).map(o -> o.getDouble("data")).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报警数据
|
||||
*/
|
||||
@Scheduled(cron = "0 */6 * * * ?")
|
||||
@SchedulerLock(name = "getRainAlarmTask", lockAtMostFor = 1000 * 60 * 5, lockAtLeastFor = 1000 * 60 * 3)
|
||||
@RequestMapping("getRainAlarmTask")
|
||||
public void getRainAlarmTask() {
|
||||
List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.ne(Project::getJnrzckAccount, "")
|
||||
.ne(Project::getJnrzckPw, "")
|
||||
);
|
||||
String start;
|
||||
Object o = redisRepository.get(REDIS_RAIN_ALARM_TASK_START_TIME);
|
||||
if (o != null) {
|
||||
start = o.toString();
|
||||
} else {
|
||||
start = DateUtil.format(DateUtil.offsetMinute(new Date(), -5), "yyyy-MM-dd HH:mm");
|
||||
}
|
||||
String end = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm");
|
||||
redisRepository.set(REDIS_RAIN_ALARM_TASK_START_TIME, end);
|
||||
for (Project project : projectList) {
|
||||
try {
|
||||
saveAllAlarm(project, start, end);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveAllAlarm(Project project, String start, String end) {
|
||||
List<RainDev> devs = rainDevService.list(new LambdaQueryWrapper<RainDev>().eq(RainDev::getProjectSn, project.getProjectSn()));
|
||||
if (CollUtil.isEmpty(devs)) {
|
||||
return;
|
||||
}
|
||||
Map<String, RainDev> devSnMap = devs.stream().collect(Collectors.toMap(RainDev::getDevSn, Function.identity()));
|
||||
ArrayList<RainAlarm> alarms = new ArrayList<>();
|
||||
String token = RenZhiUtil.getToken(project.getJnrzckAccount(), project.getJnrzckPw());
|
||||
for (RainDev dev : devs) {
|
||||
for (Integer nodeId : Arrays.asList(1, 2, 20, 21, 22, 11, 14)) {
|
||||
JSONArray dataJa = RenZhiUtil.getAlarmRecordList(dev.getDevSn(), token, nodeId, start, end);
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (CollUtil.isEmpty(dataJa)) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < dataJa.size(); j++) {
|
||||
JSONObject jo = dataJa.getJSONObject(j);
|
||||
RainAlarm alarm = new RainAlarm();
|
||||
alarm.setAlarmContent(getAlarmContent(jo));
|
||||
alarm.setAlarmVal(jo.getDouble("dataValue"));
|
||||
alarm.setProjectSn(dev.getProjectSn());
|
||||
alarm.setAlarmTime(new Date(jo.getLong("recordTime")));
|
||||
alarms.add(alarm);
|
||||
}
|
||||
}
|
||||
}
|
||||
rainAlarmService.saveBatch(alarms);
|
||||
}
|
||||
|
||||
private String getAlarmContent(JSONObject jo) {
|
||||
/*
|
||||
alarmLevel int 报警级别:
|
||||
25
|
||||
1: 报警(超报警上限)
|
||||
2: 预警(超预警上限)
|
||||
3: 预警(超预警下限)
|
||||
4:报警(超报警下限)
|
||||
-1: 离线报警
|
||||
-2:遥调(开关量)报警
|
||||
dataValue Double 报警值
|
||||
alarmRange String 报警限值
|
||||
*/
|
||||
String factorName = jo.getString("factorName");
|
||||
Integer alarmLevel = jo.getInteger("alarmLevel");
|
||||
if (Objects.equals(alarmLevel, 1) || Objects.equals(alarmLevel, 2) || Objects.equals(alarmLevel, 3) || Objects.equals(alarmLevel, 4)) {
|
||||
return StrUtil.format("{} {},报警值:{},报警限值:{}", factorName, getAlarmLevelStr(alarmLevel), jo.getDouble("dataValue"), jo.getString("alarmRange"));
|
||||
} else {
|
||||
return StrUtil.format("{} {},报警值:{}", factorName, getAlarmLevelStr(alarmLevel), jo.getString("dataValue"));
|
||||
}
|
||||
}
|
||||
|
||||
private String getAlarmLevelStr(Integer alarmLevel) {
|
||||
String s = "";
|
||||
switch (alarmLevel) {
|
||||
case 1:
|
||||
s = "报警(超报警上限)";
|
||||
case 2:
|
||||
s = "预警(超预警上限)";
|
||||
case 3:
|
||||
s = "预警(超预警下限)";
|
||||
case 4:
|
||||
s = "报警(超报警下限)";
|
||||
case -1:
|
||||
s = "离线报警";
|
||||
case -2:
|
||||
s = "遥调(开关量)报警";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
83
src/main/java/com/zhgd/xmgl/util/RenZhiUtil.java
Normal file
83
src/main/java/com/zhgd/xmgl/util/RenZhiUtil.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class RenZhiUtil {
|
||||
public static final String host = "http://www.0531yun.com";
|
||||
|
||||
/**
|
||||
* 根据设备地址查询实时数据
|
||||
*
|
||||
* @param devSns
|
||||
* @param jnrzckAccount
|
||||
* @param jnrzckPw
|
||||
* @return
|
||||
*/
|
||||
public static JSONArray getRealTimeDataByDeviceAddr(String devSns, String jnrzckAccount, String jnrzckPw) {
|
||||
String token = getToken(jnrzckAccount, jnrzckPw);
|
||||
String url = StrUtil.format("{}/api/data/getRealTimeDataByDeviceAddr?deviceAddrs={}", host, devSns);
|
||||
log.info("url:{},authorization:{}", url, token);
|
||||
String rsp = HttpRequest.get(url)
|
||||
.header("authorization", token)
|
||||
.timeout(5000)//超时,毫秒
|
||||
.execute().body();
|
||||
JSONObject rspJo = JSONObject.parseObject(rsp);
|
||||
log.info("rs:{}", rspJo.toJSONString());
|
||||
try {
|
||||
return rspJo.getJSONArray("data");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("根据设备地址查询实时数据失败:", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报警数据列表
|
||||
*
|
||||
* @param devSn
|
||||
* @param nodeId
|
||||
* @return
|
||||
*/
|
||||
public static JSONArray getAlarmRecordList(String devSn, String token, Integer nodeId, String startTime, String endTime) {
|
||||
String url = StrUtil.format("{}/api/data/alarmRecordList?deviceAddr={}&nodeId={}&startTime={}&endTime={}", host, devSn, nodeId, startTime, endTime);
|
||||
log.info("url:{},authorization:{}", url, token);
|
||||
String rsp = HttpRequest.get(url)
|
||||
.header("authorization", token)
|
||||
.timeout(5000)//超时,毫秒
|
||||
.execute().body();
|
||||
JSONObject rspJo = JSONObject.parseObject(rsp);
|
||||
log.info("rs:{}", rspJo.toJSONString());
|
||||
try {
|
||||
return rspJo.getJSONArray("data");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("获取报警数据列表失败:", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名和密码获取 token
|
||||
*
|
||||
* @param jnrzckAccount
|
||||
* @param jnrzckPw
|
||||
* @return
|
||||
*/
|
||||
public static String getToken(String jnrzckAccount, String jnrzckPw) {
|
||||
String url = StrUtil.format("{}/api/getToken?loginName={}&password={}", host, jnrzckAccount, jnrzckPw);
|
||||
log.info("url:{}", url);
|
||||
String rsp = HttpUtil.get(url);
|
||||
JSONObject rspJo = JSONObject.parseObject(rsp);
|
||||
log.info("rs:{}", rspJo.toJSONString());
|
||||
try {
|
||||
return rspJo.getJSONObject("data").getString("token");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("获取token失败:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user