yang_shj
6 months ago
12 changed files with 446 additions and 3 deletions
@ -0,0 +1,130 @@
|
||||
package com.hnac.hzims.operational.station.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
import okhttp3.internal.annotations.EverythingIsNonNull; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* 站点和霍山生态流量电站的关联关系表 |
||||
* @author tanghaihao |
||||
* @date 2023年10月08日 13:58 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@TableName("station_relation") |
||||
public class StationRelation implements Serializable { |
||||
private static final long serialVersionUID=1L; |
||||
|
||||
/** |
||||
* ID |
||||
*/ |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Long id; |
||||
|
||||
/** |
||||
* 站点编码 |
||||
*/ |
||||
@TableField("station_code") |
||||
private String stationCode; |
||||
|
||||
/** |
||||
* 站点名称 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String stationName; |
||||
|
||||
/** |
||||
* 设备编码 |
||||
*/ |
||||
@TableField("device_code") |
||||
private String deviceCode; |
||||
|
||||
/** |
||||
* 设备名称 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String deviceName; |
||||
|
||||
/** |
||||
* 核定流量 |
||||
*/ |
||||
@TableField("flow_value") |
||||
private String flowValue; |
||||
|
||||
/** |
||||
* 低级告警负责人id |
||||
*/ |
||||
@TableField("low_soe_user_id") |
||||
private String lowSoeUserId; |
||||
|
||||
/** |
||||
* 低级告警电话号码 |
||||
*/ |
||||
@TableField("low_soe_phone") |
||||
private String lowSoePhone; |
||||
|
||||
/** |
||||
* 中级告警负责人id |
||||
*/ |
||||
@TableField("middle_soe_user_id") |
||||
private String middleSoeUserId; |
||||
|
||||
/** |
||||
* 中级告警电话号码 |
||||
*/ |
||||
@TableField("middle_soe_phone") |
||||
private String middleSoePhone; |
||||
|
||||
/** |
||||
* 高级告警负责人id |
||||
*/ |
||||
@TableField("high_soe_user_id") |
||||
private String highSoeUserId; |
||||
|
||||
/** |
||||
* 高级告警电话号码 |
||||
*/ |
||||
@TableField("high_soe_phone") |
||||
private String highSoePhone; |
||||
|
||||
/** |
||||
* 当日是否发送预警 |
||||
*/ |
||||
@TableField("send_warning") |
||||
private Integer sendWarning; |
||||
|
||||
/** |
||||
* 当日是否发送告警 |
||||
*/ |
||||
@TableField("send_soe") |
||||
private Integer sendSoe; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
@TableField("create_time") |
||||
private LocalDateTime createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
@TableField("update_time") |
||||
private LocalDateTime updateTime; |
||||
|
||||
/** |
||||
* 逻辑删除 |
||||
*/ |
||||
@TableField("is_deleted") |
||||
private Integer isDeleted; |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.hnac.hzims.operational.station.vo; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy; |
||||
import com.baomidou.mybatisplus.annotation.SqlCondition; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||
import com.fasterxml.jackson.databind.ser.std.NullSerializer; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.support.QueryField; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
public class HomeMapStationVo { |
||||
|
||||
@ApiModelProperty("行政区划") |
||||
private String areaCode; |
||||
|
||||
@ApiModelProperty("编号") |
||||
private String code; |
||||
|
||||
@ApiModelProperty("名称") |
||||
private String name; |
||||
|
||||
@ApiModelProperty("经度(东经)") |
||||
@JsonSerialize(nullsUsing = NullSerializer.class) |
||||
private Float lgtd; |
||||
|
||||
@ApiModelProperty("纬度(北纬)") |
||||
@JsonSerialize(nullsUsing = NullSerializer.class) |
||||
private Float lttd; |
||||
|
||||
@ApiModelProperty("所属机构") |
||||
@JsonSerialize(nullsUsing = NullSerializer.class) |
||||
private Long refDept; |
||||
|
||||
@ApiModelProperty("站点是否为国外 1:是;0:否") |
||||
private Boolean isAbroad; |
||||
|
||||
@ApiModelProperty("所属国家") |
||||
private String refCountry; |
||||
} |
@ -0,0 +1,134 @@
|
||||
package com.hnac.hzims.operational.station.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.operational.station.RunReportConstant; |
||||
import com.hnac.hzims.operational.station.entity.StationRelation; |
||||
import com.hnac.hzims.operational.station.service.IStationRelationService; |
||||
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
||||
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiOperationSupport; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author tanghaihao |
||||
* @date 2023年10月08日 15:04 |
||||
*/ |
||||
|
||||
@RestController |
||||
@RequestMapping("/station/station-relation") |
||||
@AllArgsConstructor |
||||
@Api(value = "站点和霍山生态流量电站的关联关系管理",tags = "站点和霍山生态流量电站的关联关系管理") |
||||
public class StationRelationController { |
||||
private final IStationRelationService stationRelationService; |
||||
private final DeviceClient deviceClient; |
||||
|
||||
@GetMapping("/list") |
||||
@ApiOperation("查询列表") |
||||
@ApiOperationSupport(order = 1) |
||||
public R<List<StationRelation>> list(StationRelation stationRelation) { |
||||
|
||||
return R.data(stationRelationService.getStationRelationList(stationRelation)); |
||||
} |
||||
|
||||
@GetMapping("/page") |
||||
@ApiOperation("分页查询列表") |
||||
@ApiOperationSupport(order = 2) |
||||
public R<IPage<StationRelation>> page(StationRelation stationRelation, Query query) { |
||||
|
||||
return R.data(stationRelationService.getStationRelationPageList(stationRelation, query)); |
||||
} |
||||
|
||||
@PostMapping("/save") |
||||
@ApiOperation("保存") |
||||
@ApiOperationSupport(order = 3) |
||||
public R save(@RequestBody @Valid StationRelation stationRelation) { |
||||
if (Func.isEmpty(stationRelation.getStationCode())) { |
||||
return R.fail("站点编码不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getDeviceCode())) { |
||||
return R.fail("设备编码不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getLowSoeUserId())) { |
||||
return R.fail("低级告警负责人不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getLowSoePhone())) { |
||||
return R.fail("低级告警电话号码不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getMiddleSoeUserId())) { |
||||
return R.fail("中级告警负责人不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getMiddleSoePhone())) { |
||||
return R.fail("中级告警电话号码不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getHighSoeUserId())) { |
||||
return R.fail("高级告警负责人不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getHighSoePhone())) { |
||||
return R.fail("高级告警电话号码不能为空"); |
||||
} |
||||
if (Func.isEmpty(stationRelation.getFlowValue())) { |
||||
return R.fail("核定流量不能为空"); |
||||
} |
||||
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper(); |
||||
wrapper.and(item -> item.eq(StationRelation::getStationCode, stationRelation.getStationCode()) |
||||
.or().eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode())); |
||||
wrapper.eq(StationRelation::getIsDeleted, 0); |
||||
int count = stationRelationService.count(wrapper); |
||||
if (count > 0) { |
||||
return R.fail("站点关联关系已存在"); |
||||
} |
||||
return R.status(stationRelationService.save(stationRelation)); |
||||
} |
||||
|
||||
@PostMapping("/update") |
||||
@ApiOperation("编辑") |
||||
@ApiOperationSupport(order = 4) |
||||
public R update(@RequestBody @Valid StationRelation stationRelation) { |
||||
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper(); |
||||
wrapper.and(item -> item.eq(StationRelation::getStationCode, stationRelation.getStationCode()) |
||||
.or().eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode())); |
||||
wrapper.eq(StationRelation::getIsDeleted, 0); |
||||
wrapper.ne(StationRelation::getId, stationRelation.getId()); |
||||
int count = stationRelationService.count(wrapper); |
||||
if (count > 0) { |
||||
return R.fail("站点关联关系已存在"); |
||||
} |
||||
return R.status(stationRelationService.updateById(stationRelation)); |
||||
} |
||||
|
||||
@GetMapping("/remove") |
||||
@ApiOperation("删除") |
||||
@ApiOperationSupport(order = 5) |
||||
public R remove(Long id) { |
||||
LambdaUpdateWrapper<StationRelation> wrapper = new LambdaUpdateWrapper<>(); |
||||
wrapper.set(StationRelation::getIsDeleted, 1); |
||||
wrapper.eq(StationRelation::getId, id); |
||||
stationRelationService.update(wrapper); |
||||
return R.success("操作成功"); |
||||
} |
||||
|
||||
@GetMapping("/getDevice") |
||||
@ApiOperation("获取生态流量模型的设备信息") |
||||
@ApiOperationSupport(order = 6) |
||||
public R<List<DeviceInstanceVO>> getDevice() { |
||||
R<List<DeviceInstanceVO>> rData = deviceClient.getDeviceByModelSignage(RunReportConstant.HS_MODEL_SIGNAGE); |
||||
if (rData.getCode() == 200) { |
||||
List<DeviceInstanceVO> data = rData.getData(); |
||||
return R.data(data); |
||||
} else { |
||||
return R.fail("获取设备信息失败"); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.hnac.hzims.operational.station.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzims.operational.station.entity.StationRelation; |
||||
|
||||
public interface StationRelationMapper extends BaseMapper<StationRelation> { |
||||
|
||||
} |
@ -0,0 +1,5 @@
|
||||
<?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.hnac.hzims.operational.station.mapper.StationRelationMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,19 @@
|
||||
package com.hnac.hzims.operational.station.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.hnac.hzims.operational.station.entity.StationRelation; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author tanghaihao |
||||
* @date 2023年10月08日 15:04 |
||||
*/ |
||||
public interface IStationRelationService extends IService<StationRelation> { |
||||
|
||||
List<StationRelation> getStationRelationList(StationRelation stationRelation); |
||||
|
||||
IPage<StationRelation> getStationRelationPageList(StationRelation stationRelation, Query query); |
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.hnac.hzims.operational.station.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.operational.station.entity.StationRelation; |
||||
import com.hnac.hzims.operational.station.mapper.StationRelationMapper; |
||||
import com.hnac.hzims.operational.station.service.IStationRelationService; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author tanghaihao |
||||
* @date 2023年10月08日 14:37 |
||||
*/ |
||||
@Service |
||||
public class StationRelationServiceImpl extends ServiceImpl<StationRelationMapper, StationRelation> implements IStationRelationService { |
||||
@Override |
||||
public List<StationRelation> getStationRelationList(StationRelation stationRelation) { |
||||
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper(); |
||||
if (Func.isNotEmpty(stationRelation.getStationCode())) { |
||||
wrapper.eq(StationRelation::getStationCode, stationRelation.getStationCode()); |
||||
} |
||||
if (Func.isNotEmpty(stationRelation.getDeviceCode())) { |
||||
wrapper.eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode()); |
||||
} |
||||
wrapper.eq(StationRelation::getIsDeleted, 0); |
||||
return this.list(wrapper); |
||||
} |
||||
|
||||
@Override |
||||
public IPage<StationRelation> getStationRelationPageList(StationRelation stationRelation, Query query) { |
||||
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper(); |
||||
if (Func.isNotEmpty(stationRelation.getStationCode())) { |
||||
wrapper.eq(StationRelation::getStationCode, stationRelation.getStationCode()); |
||||
} |
||||
if (Func.isNotEmpty(stationRelation.getDeviceCode())) { |
||||
wrapper.eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode()); |
||||
} |
||||
wrapper.eq(StationRelation::getIsDeleted, 0); |
||||
return this.page(Condition.getPage(query), wrapper); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
DROP TABLE IF EXISTS `station_relation`; |
||||
CREATE TABLE `station_relation` ( |
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', |
||||
`station_code` varchar(200) DEFAULT NULL COMMENT '站点编码', |
||||
`device_code` varchar(128) DEFAULT NULL COMMENT '设备编码', |
||||
`send_warning` int(11) DEFAULT '0' COMMENT '当日是否发送预警', |
||||
`send_soe` int(11) DEFAULT '0' COMMENT '当日是否发送告警', |
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', |
||||
`is_deleted` tinyint(1) DEFAULT '0' COMMENT '逻辑删除', |
||||
`low_soe_user_id` varchar(20) DEFAULT NULL COMMENT '低级告警负责人id', |
||||
`low_soe_phone` varchar(20) DEFAULT NULL COMMENT '低级告警电话号码', |
||||
`middle_soe_user_id` varchar(20) DEFAULT NULL COMMENT '中级告警负责人id', |
||||
`middle_soe_phone` varchar(20) DEFAULT NULL COMMENT '中级告警电话号码', |
||||
`high_soe_user_id` varchar(20) DEFAULT NULL COMMENT '高级告警负责人id', |
||||
`high_soe_phone` varchar(20) DEFAULT NULL COMMENT '高级告警电话号码', |
||||
`flow_value` double(12,3) DEFAULT NULL COMMENT '核定流量', |
||||
PRIMARY KEY (`id`) USING BTREE |
||||
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='站点和霍山生态流量电站的关联关系表'; |
Loading…
Reference in new issue