src/main/java/com/whyc/dto/InfoDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/BattInfChangeMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/PowerInfChangeMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/StationInfChangeMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/db_station/BattInfChange.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/db_station/PowerInfChange.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/db_station/StationInfChange.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/BattInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/InfoChangeService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/dto/InfoDto.java
@@ -3,10 +3,15 @@ import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.whyc.pojo.db_station.BattInf; import com.whyc.pojo.db_station.BattInfChange; import com.whyc.pojo.db_station.PowerInfChange; import com.whyc.pojo.db_station.StationInfChange; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; import java.util.List; @Data public class InfoDto { @@ -41,6 +46,8 @@ @ApiModelProperty(value = "站点类型[0-非节点站,1-节点站]") private Integer nodeStation; private List<StationInfChange> sinfChangeList; @ApiModelProperty(value = "电源id") private Integer powerId; @@ -72,6 +79,7 @@ @ApiModelProperty(value = "整流器使能[bit0-模块1 bit15-模块16]【1-可用 0-不可以】") private Long modelCfg; private List<PowerInfChange> pinfChangeList; @ApiModelProperty(value = "设备id") @@ -124,4 +132,9 @@ @ApiModelProperty(value = "标识是否加入电池组1:添加,0不添加") private Integer addBinfFlag; private List<BattInfChange> binfChangeList; @ApiModelProperty(value = "变更原因") private String updateReason; } src/main/java/com/whyc/mapper/BattInfChangeMapper.java
New file @@ -0,0 +1,6 @@ package com.whyc.mapper; import com.whyc.pojo.db_station.BattInfChange; public interface BattInfChangeMapper extends CustomMapper<BattInfChange>{ } src/main/java/com/whyc/mapper/PowerInfChangeMapper.java
New file @@ -0,0 +1,6 @@ package com.whyc.mapper; import com.whyc.pojo.db_station.PowerInfChange; public interface PowerInfChangeMapper extends CustomMapper<PowerInfChange>{ } src/main/java/com/whyc/mapper/StationInfChangeMapper.java
New file @@ -0,0 +1,6 @@ package com.whyc.mapper; import com.whyc.pojo.db_station.StationInfChange; public interface StationInfChangeMapper extends CustomMapper<StationInfChange>{ } src/main/java/com/whyc/pojo/db_station/BattInfChange.java
New file @@ -0,0 +1,93 @@ package com.whyc.pojo.db_station; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; /** * <p> * 电池信息变更记录表 * </p> * * @author lxw * @since 2025-06-21 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName(schema = "db_station",value = "tb_batt_inf_change") @ApiModel(value="BattInfChange对象", description="电池信息变更记录表") public class BattInfChange implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") @TableId(value = "num", type = IdType.AUTO) private Integer num; @ApiModelProperty(value = "机房Id") private Integer stationId; @ApiModelProperty(value = "电源id") private Integer powerId; @ApiModelProperty(value = "设备id") private Integer devId; @ApiModelProperty(value = "设备ip") private String devIp; @ApiModelProperty(value = "设备名称") private String devName; @ApiModelProperty(value = "电池组id") private Integer battgroupId; @ApiModelProperty(value = "电池组名称") private String battgroupName; @ApiModelProperty(value = "电池组编号") private Integer battgroupNum; @ApiModelProperty(value = "标称电压") private Float monvolstd; @ApiModelProperty(value = "标称容量") private Float moncapstd; @ApiModelProperty(value = "标称内阻") private Float monresstd; @ApiModelProperty(value = "品牌") private String product; @ApiModelProperty(value = "型号") private String battModel; @ApiModelProperty(value = "一组单体个数") private Integer moncount; @ApiModelProperty(value = "设备编号") private Integer devNum; @ApiModelProperty(value = "设备类型") private String devType; @ApiModelProperty(value = "投入使用时间") private Date inuseTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") private Date updateTime; @ApiModelProperty(value = "变更原因") private String updateReason; } src/main/java/com/whyc/pojo/db_station/PowerInfChange.java
New file @@ -0,0 +1,75 @@ package com.whyc.pojo.db_station; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; /** * <p> * 电源信息变更记录表 * </p> * * @author lxw * @since 2025-06-21 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName(schema = "db_station",value = "tb_power_inf_change") @ApiModel(value="PowerInfChange对象", description="电源信息变更记录表") public class PowerInfChange implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") @TableId(value = "num", type = IdType.AUTO) private Integer num; @ApiModelProperty(value = "机房Id") private Integer stationId; @ApiModelProperty(value = "电源id") private Integer powerId; @ApiModelProperty(value = "电源编号") private Integer powerNum; @ApiModelProperty(value = "电源名称") private String powerName; @ApiModelProperty(value = "厂家") private String company; @ApiModelProperty(value = "型号") private String powerModel; @ApiModelProperty(value = "协议") private String protocol; @ApiModelProperty(value = "电源ip") private String powerIp; @ApiModelProperty(value = "1:直流,2:通讯,3配网") private Integer powerType; @ApiModelProperty(value = "电源投入使用时间") private Date powerInuseTime; @ApiModelProperty(value = "整流器使能[bit0-模块1 bit15-模块16]【1-在用 0-不在用】") private Long modelCfg; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") private Date updateTime; @ApiModelProperty(value = "变更原因") private String updateReason; } src/main/java/com/whyc/pojo/db_station/StationInfChange.java
New file @@ -0,0 +1,75 @@ package com.whyc.pojo.db_station; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; /** * <p> * 机房信息变更记录表 * </p> * * @author lxw * @since 2025-06-21 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName(schema = "db_station",value = "tb_station_inf_change") @ApiModel(value="StationInfChange对象", description="机房信息变更记录表") public class StationInfChange implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") @TableId(value = "num", type = IdType.AUTO) private Integer num; @ApiModelProperty(value = "机房Id") private Integer stationId; @ApiModelProperty(value = "站点名称") private String stationName; @ApiModelProperty(value = "省") private String provice; @ApiModelProperty(value = "市") private String city; @ApiModelProperty(value = "区县") private String country; @ApiModelProperty(value = "站点电压等级[(35kv/110kv/220kv 字符串类型)]") private String stationType; @ApiModelProperty(value = "机房名称[拼接后的]") private String fullName; @ApiModelProperty(value = "经度") private Double longitude; @ApiModelProperty(value = "纬度") private Double latitude; @ApiModelProperty(value = "机房详细地址") private String stationAddr; @ApiModelProperty(value = "站点类型[0-非节点站,1-节点站]") private Integer nodeStation; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") private Date updateTime; @ApiModelProperty(value = "变更原因") private String updateReason; } src/main/java/com/whyc/service/BattInfService.java
@@ -15,9 +15,7 @@ import com.whyc.mapper.BattInfMapper; import com.whyc.mapper.PowerInfMapper; import com.whyc.mapper.StationInfMapper; import com.whyc.pojo.db_station.BattInf; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; import com.whyc.pojo.db_station.*; import com.whyc.pojo.db_user.User; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -43,6 +41,8 @@ @Autowired(required = false) private BaojigroupService bjService; @Autowired(required = false) private InfoChangeService changeService; /*新建电池组(新的设备新的电池组) * @param binf * 1.在电源下新建设备,记录设备编号,devNum,设备名称为设备类型+devNum @@ -310,6 +310,11 @@ } sinfMapper.update((StationInf) ActionUtil.objeNull,wrapper1); pinfMapper.update((PowerInf) ActionUtil.objeNull,wrapper2); //存入变更信息记录 pinf.setStationId(sinf.getStationId()); binf.setStationId(sinf.getStationId()); binf.setPowerId(pinf.getPowerId()); changeService.addInfoChange(sinf,pinf,binf,info.getUpdateReason()); return new Response().set(1,true,"修改信息成功"); } /*//修改电池组 @@ -363,6 +368,15 @@ dto.setUid(user.getId()); PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); List<InfoDto> list=mapper.getInfo(dto); for (InfoDto infoDto:list) { //获取机房,电源,电池组变更记录 List<StationInfChange> sinfChangeList=changeService.getSinfChange(infoDto.getStationId()); infoDto.setSinfChangeList(sinfChangeList); List<PowerInfChange> pinfChangeList=changeService.getPinfChange(infoDto.getPowerId()); infoDto.setPinfChangeList(pinfChangeList); List<BattInfChange> binfChangeList=changeService.getBinfChange(infoDto.getBattgroupId()); infoDto.setBinfChangeList(binfChangeList); } PageInfo pageInfo=new PageInfo(list); return new Response().setII(1,list!=null,pageInfo,"查询电池"); } src/main/java/com/whyc/service/InfoChangeService.java
New file @@ -0,0 +1,78 @@ package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.whyc.mapper.BattInfChangeMapper; import com.whyc.mapper.PowerInfChangeMapper; import com.whyc.mapper.StationInfChangeMapper; import com.whyc.pojo.db_station.*; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; @Service public class InfoChangeService { @Autowired(required = false) private StationInfChangeMapper sinfChangeMapper; @Autowired(required = false) private PowerInfChangeMapper pinfChangeMapper; @Autowired(required = false) private BattInfChangeMapper binfChangeMapper; //存入变更信息记录 public void addInfoChange(StationInf sinf, PowerInf pinf, BattInf binf,String updateReason) { StationInfChange sinfChange = new StationInfChange(); PowerInfChange pinfChange = new PowerInfChange(); BattInfChange binfChange = new BattInfChange(); Date updateTime = new Date(); //将信息拷贝至对应的变更信息表 BeanUtils.copyProperties(sinf,sinfChange); String fullName=sinf.getProvice()+"_"+sinf.getCity()+"_"+sinf.getCountry()+"_"+sinf.getStationName(); sinfChange.setFullName(fullName); sinfChange.setUpdateTime(updateTime); sinfChange.setUpdateReason(updateReason); BeanUtils.copyProperties(pinf,pinfChange); pinfChange.setUpdateTime(updateTime); pinfChange.setUpdateReason(updateReason); BeanUtils.copyProperties(binf,binfChange); binfChange.setUpdateTime(updateTime); binfChange.setUpdateReason(updateReason); //将变更记录存入变更表 sinfChangeMapper.insert(sinfChange); pinfChangeMapper.insert(pinfChange); binfChangeMapper.insert(binfChange); } //获取机房,电源,电池组变更记录 public List<StationInfChange> getSinfChange(Integer stationId) { QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("station_id",stationId); wrapper.last("limit 0,2"); wrapper.orderByDesc("update_time"); List<StationInfChange> list=sinfChangeMapper.selectList(wrapper); return list; } public List<PowerInfChange> getPinfChange(Integer powerId) { QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("power_id",powerId); wrapper.last("limit 0,2"); wrapper.orderByDesc("update_time"); List<PowerInfChange> list=pinfChangeMapper.selectList(wrapper); return list; } public List<BattInfChange> getBinfChange(Integer battgroupId) { QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("battgroup_id",battgroupId); wrapper.last("limit 0,2"); wrapper.orderByDesc("update_time"); List<BattInfChange> list=binfChangeMapper.selectList(wrapper); return list; } }