冀北拓扑图代码提交

This commit is contained in:
wr
2023-06-15 16:28:45 +08:00
parent e0c4e4b88f
commit e249670056
16 changed files with 464 additions and 87 deletions

View File

@@ -0,0 +1,33 @@
package com.njcn.device.pms.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 冀北分布式概览
* </p>
*
* @author wr
* @since 2023-06-12
*/
@Data
public class SubstationExpendParam extends BaseParam {
/**
* 获取部门id
*/
@ApiModelProperty("部门id")
private String orgId;
@Data
public static class Relation{
@ApiModelProperty("起点变电站id")
private String startStationId;
@ApiModelProperty("终点变电站id")
private String endStationId;
}
}

View File

@@ -160,6 +160,9 @@ public class PowerDistributionarea extends BaseEntity {
*/
private Integer status;
/**
* 数据状态0-手动录入1-gw台账录入
*/
private Integer inputStatus;
}

View File

@@ -1,11 +1,13 @@
package com.njcn.device.pms.pojo.po;
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 java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
@@ -17,8 +19,6 @@ import lombok.*;
* @since 2023-05-08
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("pms_substation_expend")
public class SubstationExpend implements Serializable {
@@ -27,63 +27,53 @@ public class SubstationExpend implements Serializable {
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 变电站名称
*/
@ApiModelProperty(name = "name",value = "变电站名称")
private String name;
/**
* 变电站类型:Sys_dict_data表主键
*/
@ApiModelProperty(name = "type",value = "变电站类型")
private String type;
private String typeName;
/**
* 电压等级
*/
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
private String voltageLevel;
/**
* 经度
*/
@ApiModelProperty(name = "lng",value = "经度")
private BigDecimal lng;
/**
* 纬度
*/
@ApiModelProperty(name = "lat",value = "纬度")
private BigDecimal lat;
/**
* 所属单位
*/
@ApiModelProperty(name = "deptId",value = "所属单位")
private String deptId;
/**
* 所属单位
*/
@TableField(value = "dept_Name", exist = false)
private String deptName;
private String area;
/**
* 关联台账变电站pq_substation表主键
*/
private String substationId;
private String breakSite;
/**
* 连接回路Sys_dict_data表主键双回路、单回路
*/
private String connectType;
private List<PmsSimpleDTO> sites;
public SubstationExpend(String name, String type, BigDecimal lng, BigDecimal lat, String deptId) {
this.name = name;
this.type = type;
this.lng = lng;
this.lat = lat;
this.deptId = deptId;
}
}

View File

@@ -1,9 +1,12 @@
package com.njcn.device.pms.pojo.po;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -18,30 +21,39 @@ import lombok.Setter;
* @since 2023-05-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("pms_substation_relation")
public class SubstationRelation extends BaseEntity {
public class SubstationRelation {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
@ApiModelProperty(name = "id", value = "主键")
private String id;
/**
* 起点变电站idpms_substation_jb主键
*/
@ApiModelProperty(name = "startStationId", value = "起点变电站id")
private String startStationId;
/**
* 终点变电站idpms_substation_jb主键
*/
@ApiModelProperty(name = "endStationId", value = "终点变电站id")
private String endStationId;
/**
* 连接回路Sys_dict_data表主键双回路、单回路
*/
@ApiModelProperty(name = "connectType", value = "连接回路类型")
private String connectType;
/**
* 折点经纬度:[[0,0],[x,y]]
*/
@ApiModelProperty(name = "breakSite", value = "折点经纬度")
private String breakSite;

View File

@@ -0,0 +1,85 @@
package com.njcn.device.pms.pojo.vo;
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author wr
* @since 2023-06-12
*/
@Data
public class SubstationExpendVO implements Serializable {
/**
* 主键
*/
private String id;
/**
* 变电站名称
*/
private String name;
/**
* 变电站类型:Sys_dict_data表主键
*/
private String type;
private String typeName;
/**
* 电压等级
*/
private String voltageLevel;
/**
* 经度
*/
private BigDecimal lng;
/**
* 纬度
*/
private BigDecimal lat;
/**
* 所属单位
*/
private String deptId;
private String deptName;
private String area;
/**
* 关联台账变电站pq_substation表主键
*/
private String substationId;
private String breakSite;
/**
* 连接回路Sys_dict_data表主键双回路、单回路
*/
private String connectType;
private List<PmsSimpleDTO> sites;
// public SubstationExpendParam(String name, String type, BigDecimal lng, BigDecimal lat, String deptId) {
// this.name = name;
// this.type = type;
// this.lng = lng;
// this.lat = lat;
// this.deptId = deptId;
// }
}

View File

@@ -0,0 +1,48 @@
package com.njcn.device.pms.pojo.vo;
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author wr
* @since 2023-06-12
*/
@Data
public class SubstationRelationVO implements Serializable {
/**
* 主键id
*/
private String id;
/**
* 起点变电站idpms_substation_jb主键
*/
private SubstationExpend startStation;
/**
* 终点变电站idpms_substation_jb主键
*/
private SubstationExpend endStation;
/**
* 连接回路Sys_dict_data表主键双回路、单回路
*/
private String connectType;
/**
* 折点经纬度:[[0,0],[x,y]]
*/
private String breakSite;
}

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pms.controller.ledgerManger;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -8,6 +9,8 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.dto.PmsLedgerStaticDTO;
import com.njcn.device.pms.pojo.param.SubstationExpendParam;
import com.njcn.device.pms.pojo.vo.SubstationExpendVO;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import com.njcn.device.pms.service.ISubstationExpendService;
import com.njcn.device.pq.pojo.param.CommunicateParam;
@@ -24,8 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -51,9 +52,9 @@ public class SubstationExpendController extends BaseController {
@PostMapping("/getSubstationExpendInfo")
@ApiOperation("冀北变电站地图信息")
@ApiImplicitParam(name = "param", value = "冀北变电站地图信息参数", required = true)
public HttpResult<Map<String, List<SubstationExpend>>> getSubstationExpendInfo(@RequestBody StatisticsBizBaseParam param) {
public HttpResult<Map<String, List<SubstationExpendVO>>> getSubstationExpendInfo(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getSubstationExpendInfo");
Map<String, List<SubstationExpend>> result = substationExpendService.getSubstationExpendInfo(param);
Map<String, List<SubstationExpendVO>> result = substationExpendService.getSubstationExpendInfo(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@@ -78,29 +79,68 @@ public class SubstationExpendController extends BaseController {
}
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
// @PostMapping("/insert")
// @ApiOperation("变电站信息")
// @ApiImplicitParam(name = "insert", value = "变电站信息", required = true)
// public HttpResult<Boolean> insert(@RequestBody StatisticsBizBaseParam insert) {
// String methodDescribe = getMethodDescribe("insert");
// List<SubstationExpend> list = Arrays.asList(
// new SubstationExpend("500kV天马变电站", "1fa650685c77db1656c70f9db4a2edc6",new BigDecimal(119.292327),new BigDecimal(40.215015),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("500kV昌黎变电站", "1fa650685c77db1656c70f9db4a2edc6",new BigDecimal(118.990809),new BigDecimal(40.016014),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV陈官屯变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.998356),new BigDecimal(39.990971),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV小营变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.298044),new BigDecimal(39.814401),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV深河变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.453054),new BigDecimal(39.940208),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV杜庄变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.540182),new BigDecimal(40.026883),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV平方变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.173903),new BigDecimal(39.730601),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV肖营子变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.866099),new BigDecimal(40.279209),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV丰钢变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.913885),new BigDecimal(39.663569),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV碣石变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.191153),new BigDecimal(39.723464),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV龙家店变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.062243),new BigDecimal(39.719279),"17439407bfee299b7e38f2e54a8f6d28"),
// new SubstationExpend("220kV仙螺岛变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.446926),new BigDecimal(39.792502),"17439407bfee299b7e38f2e54a8f6d28")
// );
//
// boolean b = substationExpendService.saveBatch(list);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
// }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/list")
@ApiOperation("查询变电站信息")
public HttpResult< Page<SubstationExpend>> list(@RequestBody SubstationExpendParam param) {
String methodDescribe = getMethodDescribe("list");
Page<SubstationExpend> page = substationExpendService.getSubstationExpend(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/insert")
@ApiOperation("变电站信息")
@ApiImplicitParam(name = "insert", value = "变电站信息", required = true)
public HttpResult<Boolean> insert(@RequestBody StatisticsBizBaseParam insert) {
String methodDescribe = getMethodDescribe("insert");
List<SubstationExpend> list = Arrays.asList(
new SubstationExpend("500kV天马变电站", "1fa650685c77db1656c70f9db4a2edc6",new BigDecimal(119.292327),new BigDecimal(40.215015),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("500kV昌黎变电站", "1fa650685c77db1656c70f9db4a2edc6",new BigDecimal(118.990809),new BigDecimal(40.016014),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV陈官屯变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.998356),new BigDecimal(39.990971),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV小营变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.298044),new BigDecimal(39.814401),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV深河变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.453054),new BigDecimal(39.940208),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV杜庄变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.540182),new BigDecimal(40.026883),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV平方变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.173903),new BigDecimal(39.730601),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV肖营子变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.866099),new BigDecimal(40.279209),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV丰钢变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.913885),new BigDecimal(39.663569),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV碣石变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.191153),new BigDecimal(39.723464),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV龙家店变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.062243),new BigDecimal(39.719279),"17439407bfee299b7e38f2e54a8f6d28"),
new SubstationExpend("220kV仙螺岛变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.446926),new BigDecimal(39.792502),"17439407bfee299b7e38f2e54a8f6d28")
);
@ApiOperation("添加变电站信息")
public HttpResult<Boolean> addSubstation(@RequestBody SubstationExpend param) {
String methodDescribe = getMethodDescribe("addSubstation");
boolean save = substationExpendService.addSubstation(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,save, methodDescribe);
}
boolean b = substationExpendService.saveBatch(list);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/update")
@ApiOperation("修改变电站信息")
public HttpResult<Boolean> updateSubstation(@RequestBody SubstationExpend param) {
String methodDescribe = getMethodDescribe("updateSubstation");
boolean save = substationExpendService.updateSubstation(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,save, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/delete")
@ApiOperation("删除变电站信息")
public HttpResult<Boolean> removeSubstation(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("removeSubstation");
boolean save = substationExpendService.removeByIds(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,save, methodDescribe);
}
}

View File

@@ -4,26 +4,22 @@ package com.njcn.device.pms.controller.ledgerManger;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import com.njcn.device.pms.pojo.param.SubstationExpendParam;
import com.njcn.device.pms.pojo.po.SubstationRelation;
import com.njcn.device.pms.pojo.vo.SubstationExpendVO;
import com.njcn.device.pms.pojo.vo.SubstationRelationVO;
import com.njcn.device.pms.service.ISubstationRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -51,5 +47,25 @@ public class SubstationRelationController extends BaseController {
Boolean result = substationRelationService.saveSubstationRelation(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getRelation")
@ApiOperation("查询变电站拓扑图")
@ApiImplicitParam(name = "param", value = "查询变电站拓扑图", required = true)
public HttpResult<SubstationRelationVO> getRelation(@RequestBody SubstationExpendParam.Relation param) {
String methodDescribe = getMethodDescribe("getRelation");
SubstationRelationVO relation = substationRelationService.getRelation(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, relation, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/removeRelation")
@ApiOperation("删除变电站拓扑图")
@ApiImplicitParam(name = "id", value = "删除变电站拓扑图", required = true)
public HttpResult<Boolean> removeRelation(@RequestParam String id) {
String methodDescribe = getMethodDescribe("removeRelation");
boolean b = substationRelationService.removeById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
}
}

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.pojo.vo.SubstationExpendVO;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import org.apache.ibatis.annotations.Param;
@@ -18,5 +19,5 @@ import java.util.List;
*/
public interface SubstationExpendMapper extends BaseMapper<SubstationExpend> {
List<SubstationExpend> getSubList(@Param("list") List<String> list, @Param("param") StatisticsBizBaseParam param);
List<SubstationExpendVO> getSubList(@Param("list") List<String> list, @Param("param") StatisticsBizBaseParam param);
}

View File

@@ -3,7 +3,7 @@
<mapper namespace="com.njcn.device.pms.mapper.SubstationExpendMapper">
<select id="getSubList" resultType="com.njcn.device.pms.pojo.po.SubstationExpend">
<select id="getSubList" resultType="com.njcn.device.pms.pojo.vo.SubstationExpendVO">
SELECT pse.*,
psr.Break_site,
psr.connect_type

View File

@@ -1,10 +1,12 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.pojo.dto.PmsLedgerStaticDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.SubstationExpendParam;
import com.njcn.device.pms.pojo.vo.SubstationExpendVO;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import com.njcn.device.pq.pojo.param.CommunicateParam;
import com.njcn.device.pq.pojo.vo.CommunicateVO;
@@ -23,10 +25,28 @@ import java.util.Map;
public interface ISubstationExpendService extends IService<SubstationExpend> {
Map<String, List<SubstationExpend>> getSubstationExpendInfo(StatisticsBizBaseParam param);
Map<String, List<SubstationExpendVO>> getSubstationExpendInfo(StatisticsBizBaseParam param);
PmsLedgerStaticDTO getLedgerStatistics(StatisticsBizBaseParam param);
List<CommunicateVO.PVCommunicateVO> getCommunicationStatus(CommunicateParam param);
/**
* 分页获取变电站信息
* @return
*/
Page<SubstationExpend> getSubstationExpend(SubstationExpendParam param);
/**
* 添加变电站
* @return
*/
Boolean addSubstation(SubstationExpend param);
/**
* 分页获取变电站信息
* @return
*/
Boolean updateSubstation(SubstationExpend param);
}

View File

@@ -2,7 +2,9 @@ package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.SubstationExpendParam;
import com.njcn.device.pms.pojo.po.SubstationRelation;
import com.njcn.device.pms.pojo.vo.SubstationRelationVO;
/**
* <p>
@@ -15,4 +17,10 @@ import com.njcn.device.pms.pojo.po.SubstationRelation;
public interface ISubstationRelationService extends IService<SubstationRelation> {
Boolean saveSubstationRelation(SubstationRelation param);
/**
* 查询拓补图
* @param param
*/
SubstationRelationVO getRelation(SubstationExpendParam.Relation param);
}

View File

@@ -5,16 +5,23 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
import com.njcn.device.pms.mapper.SubstationExpendMapper;
import com.njcn.device.pms.mapper.majornetwork.DistributionMonitorMapper;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsLedgerStaticDTO;
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.SubstationExpendParam;
import com.njcn.device.pms.pojo.vo.SubstationExpendVO;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import com.njcn.device.pms.service.ISubstationExpendService;
@@ -31,6 +38,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.user.pojo.po.Dept;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.influxdb.dto.QueryResult;
@@ -68,8 +76,8 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
private final ITerminalService iTerminalService;
@Override
public Map<String, List<SubstationExpend>> getSubstationExpendInfo(StatisticsBizBaseParam param) {
Map<String, List<SubstationExpend>> map = new HashMap<>();
public Map<String, List<SubstationExpendVO>> getSubstationExpendInfo(StatisticsBizBaseParam param) {
Map<String, List<SubstationExpendVO>> map = new HashMap<>();
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
Map<String, List<DeptDTO>> deptMap = deptInfos.stream().collect(Collectors.groupingBy(DeptDTO::getCode));
if (CollectionUtil.isNotEmpty(deptInfos)) {
@@ -77,7 +85,7 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
.map(DeptDTO::getCode)
.collect(Collectors.toList());
// 获取部门所属变电站
List<SubstationExpend> subList=substationExpendMapper.getSubList(list, param);
List<SubstationExpendVO> subList=substationExpendMapper.getSubList(list, param);
if (CollUtil.isNotEmpty(subList)) {
subList.forEach (
t -> {
@@ -102,7 +110,7 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
}
}
);
map = subList.stream().collect(Collectors.groupingBy(SubstationExpend::getArea));
map = subList.stream().collect(Collectors.groupingBy(SubstationExpendVO::getArea));
}
}
return map;
@@ -284,4 +292,71 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
return info;
}
@Override
public Page<SubstationExpend> getSubstationExpend(SubstationExpendParam param) {
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getOrgId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
Map<String, DeptDTO> deptMap = deptInfos.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
List<String> deptIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
if(CollUtil.isNotEmpty(deptIDs)){
Page<SubstationExpend> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), new LambdaQueryWrapper<SubstationExpend>()
.in(SubstationExpend::getDeptId, deptIDs)
.like(StrUtil.isNotBlank(param.getSearchValue()),SubstationExpend::getName,param.getSearchValue())
);
List<SubstationExpend> records = page.getRecords();
if(CollUtil.isNotEmpty(records)){
for (SubstationExpend record : records) {
if(deptMap.containsKey(record.getDeptId())){
record.setDeptName(deptMap.get(record.getDeptId()).getName());
record.setDeptId(deptMap.get(record.getDeptId()).getId());
}
}
}
return page;
}
return new Page<>();
}
@Override
public Boolean addSubstation(SubstationExpend param) {
checkName(param,true);
Dept data = deptFeignClient.getDeptById(param.getDeptId()).getData();
if(ObjectUtil.isNull(data)){
throw new BusinessException(PmsDeviceResponseEnum.ORG_ITEM_EMPTY);
}
param.setDeptId(data.getCode());
boolean save = this.save(param);
return save;
}
@Override
public Boolean updateSubstation(SubstationExpend param) {
checkName(param,false);
Dept data = deptFeignClient.getDeptById(param.getDeptId()).getData();
if(ObjectUtil.isNull(data)){
throw new BusinessException(PmsDeviceResponseEnum.ORG_ITEM_EMPTY);
}
param.setDeptId(data.getCode());
boolean b = this.updateById(param);
return b;
}
/**
* 名称重复校验
*/
private void checkName(SubstationExpend param, boolean flag){
LambdaQueryWrapper<SubstationExpend> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SubstationExpend::getName,param.getName());
//修改
if(!flag){
lambdaQueryWrapper.ne(SubstationExpend::getId,param.getId());
}
int result = this.count(lambdaQueryWrapper);
//大于等于1个则表示重复
if (result >= 1) {
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
}
}
}

View File

@@ -1,12 +1,22 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.device.pms.mapper.SubstationRelationMapper;
import com.njcn.device.pms.pojo.param.SubstationExpendParam;
import com.njcn.device.pms.pojo.po.SubstationExpend;
import com.njcn.device.pms.pojo.po.SubstationRelation;
import com.njcn.device.pms.pojo.vo.SubstationRelationVO;
import com.njcn.device.pms.service.ISubstationExpendService;
import com.njcn.device.pms.service.ISubstationRelationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* <p>
* 2.电网拓扑图关系表 服务实现类
@@ -16,10 +26,42 @@ import org.springframework.stereotype.Service;
* @since 2023-05-08
*/
@Service
@RequiredArgsConstructor
public class SubstationRelationServiceImpl extends ServiceImpl<SubstationRelationMapper, SubstationRelation> implements ISubstationRelationService {
private final ISubstationExpendService substationExpendService;
@Override
public Boolean saveSubstationRelation(SubstationRelation param) {
if(StrUtil.isNotBlank(param.getId())){
return this.updateById(param);
}
return this.save(param);
}
@Override
public SubstationRelationVO getRelation(SubstationExpendParam.Relation param) {
SubstationRelationVO relationVO=new SubstationRelationVO();
SubstationRelation one = this.getOne(new LambdaQueryWrapper<SubstationRelation>()
.and(w->w
.eq(SubstationRelation::getStartStationId, param.getStartStationId())
.eq(SubstationRelation::getEndStationId, param.getEndStationId())
)
.or(w -> w
.eq(SubstationRelation::getStartStationId, param.getEndStationId())
.eq(SubstationRelation::getEndStationId, param.getStartStationId())
)
);
if(ObjectUtil.isNotNull(one)){
BeanUtil.copyProperties(one, relationVO);
relationVO.setStartStation(getSubstationExpend(param.getStartStationId()));
relationVO.setEndStation(getSubstationExpend(param.getEndStationId()));
}
return relationVO;
}
public SubstationExpend getSubstationExpend(String id){
return substationExpendService.getOne(new LambdaQueryWrapper<SubstationExpend>()
.eq(SubstationExpend::getSubstationId, id)
);
}
}

View File

@@ -78,7 +78,6 @@ public class LineIntegrityDataController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getIntegrityByLineIds")
@ApiOperation("通过监测点集合查询监测点数据完整性")
@ApiImplicitParam(name = "lineIds", value = "监测点集合", required = true)
@ApiIgnore
public HttpResult<List<RStatIntegrityD>> getIntegrityByLineIds(@RequestBody List<String> lineIds, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime) {
String methodDescribe = getMethodDescribe("getIntegrityByLineIds");

View File

@@ -1,5 +1,6 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -70,7 +71,7 @@ public class LogManageServiceImpl implements LogManageService {
//待分页数据总量
page.setTotal(terminalLogs.size());
//分页总页数
int pages = (int)Math.ceil(terminalLogs.size()*1.0/deviceLogParam.getPageSize());
int pages = (int) Math.ceil(terminalLogs.size() * 1.0 / deviceLogParam.getPageSize());
page.setPages(pages);
if (!CollectionUtils.isEmpty(terminalLogs)) {
@@ -78,7 +79,7 @@ public class LogManageServiceImpl implements LogManageService {
List<TerminalLogs> pageLogs = partition.get(deviceLogParam.getPageNum() - 1);
if (!CollectionUtils.isEmpty(pageLogs)) {
for (TerminalLogs logs: pageLogs) {
for (TerminalLogs logs : pageLogs) {
DeviceLogVO deviceLogVO = logManageMapper.getDeviceLogData(logs.getLineId(), logs.getTerminalType(), logs.getUpdateBy());
if (Objects.isNull(deviceLogVO)) {
continue;
@@ -103,7 +104,9 @@ public class LogManageServiceImpl implements LogManageService {
//查询全部时间
List<String> lineByIDs = lineMapper.getLineByIDs(eventLogParam.getSearchValue());
if (CollUtil.isEmpty(lineByIDs)) {
return new Page<>();
}
Page<EventLogVO> page = new Page<>();
page.setSize(eventLogParam.getPageSize());
page.setCurrent(eventLogParam.getPageNum());
@@ -113,9 +116,9 @@ public class LogManageServiceImpl implements LogManageService {
p.setSize(eventLogParam.getPageSize());
p.setCurrent(eventLogParam.getPageNum());
QueryWrapper<EventPushLogs> wrapper = new QueryWrapper<>();
wrapper.between("start_time",DateUtil.beginOfDay(DateUtil.parse(eventLogParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
wrapper.eq(eventLogParam.getResult()!=null,"Result",eventLogParam.getResult());
wrapper.in("measurement_point_id",lineByIDs);
wrapper.between("start_time", DateUtil.beginOfDay(DateUtil.parse(eventLogParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
wrapper.eq(eventLogParam.getResult() != null, "Result", eventLogParam.getResult());
wrapper.in("measurement_point_id", lineByIDs);
if (ObjectUtil.isAllNotEmpty(eventLogParam.getSortBy(), eventLogParam.getOrderBy())) {
wrapper.orderBy(true, eventLogParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(eventLogParam.getSortBy()));
} else {
@@ -145,16 +148,16 @@ public class LogManageServiceImpl implements LogManageService {
eventLogVO.setLine(areaMap.get(rawLog.getMeasurementPointId()).get(0).getLineName());
eventLogVO.setSubstation(areaMap.get(rawLog.getMeasurementPointId()).get(0).getSubName());
eventLogVO.setPowerCompany(areaMap.get(rawLog.getMeasurementPointId()).get(0).getGdName());
Double e=eventDetailMap.get(rawLog.getMeasurementPointId()).get(0).getFeatureAmplitude();
Double e = eventDetailMap.get(rawLog.getMeasurementPointId()).get(0).getFeatureAmplitude();
BigDecimal bd = new BigDecimal(e);
e= bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
eventLogVO.setEventValue(String.valueOf(e*100));
e = bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
eventLogVO.setEventValue(String.valueOf(e * 100));
double i = eventDetailMap.get(rawLog.getMeasurementPointId()).get(0).getDuration();
eventLogVO.setPersistTime(String.valueOf(i));
eventLogVO.setCreatTime(dateTimeFormatter.format(rawLog.getCreateTime()));
eventLogVO.setCreatTimed(dateTimeFormatter.format(rawLog.getCreateTime()));
eventLogVO.setPushFailed(rawLog.getPushFailed());
if (rawLog.getResult()==0) {
if (rawLog.getResult() == 0) {
eventLogVO.setResult("失败");
eventLogVO.setState("未推送");
} else {
@@ -178,7 +181,7 @@ public class LogManageServiceImpl implements LogManageService {
String evenDetailTime = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
for (EventPushLogs log : eventPushLogs) {
String logTime = log.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
if (log.getMeasurementPointId().equals(eventDetail.getLineId())&& log.getEventId().equals(eventDetail.getEventId())&& evenDetailTime.equals(logTime)) {
if (log.getMeasurementPointId().equals(eventDetail.getLineId()) && log.getEventId().equals(eventDetail.getEventId()) && evenDetailTime.equals(logTime)) {
flag = true;
}
}
@@ -187,6 +190,7 @@ public class LogManageServiceImpl implements LogManageService {
/**
* influxDB查询终端运维日志相关信息
*
* @param startTime
* @param endTime
* @param type
@@ -197,11 +201,11 @@ public class LogManageServiceImpl implements LogManageService {
StringBuilder string = new StringBuilder();
string.append(InfluxDBPublicParam.TIME + " >= '" + startTime + InfluxDBPublicParam.START_TIME + "' and " + InfluxDBPublicParam.TIME + " <= '" + endTime + InfluxDBPublicParam.END_TIME + "'");
if (!type.isEmpty()) {
string.append(" and terminal_type = '" + type +"'");
string.append(" and terminal_type = '" + type + "'");
}
//sql语句
String sql = "SELECT * FROM "+InfluxDBPublicParam.PQS_TERMINAL_LOGS+" WHERE " + string + InfluxDBPublicParam.TIME_ZONE;
System.out.println("sql==========="+sql);
String sql = "SELECT * FROM " + InfluxDBPublicParam.PQS_TERMINAL_LOGS + " WHERE " + string + InfluxDBPublicParam.TIME_ZONE;
System.out.println("sql===========" + sql);
//结果集
QueryResult results = influxDbUtils.query(sql);
//结果集映射到对象中
@@ -213,6 +217,7 @@ public class LogManageServiceImpl implements LogManageService {
/**
* influxDB查询暂降事件相关信息
*
* @param startTime
* @param endTime
* @param result
@@ -222,12 +227,12 @@ public class LogManageServiceImpl implements LogManageService {
//组装sql语句
StringBuilder string = new StringBuilder();
string.append(DeviceValidMessage.TIME + " >= '" + startTime + DeviceValidMessage.START_TIME + "' and " + DeviceValidMessage.TIME + " <= '" + endTime + DeviceValidMessage.END_TIME + "'");
if (result==1 || result==2) {
if (result == 1 || result == 2) {
string.append(" and result=" + result);
}
//sql语句
String sql = "SELECT * FROM pqs_event_push_logs WHERE " + string +InfluxDBPublicParam.TIME_ZONE;
System.out.println("sql==========="+sql);
String sql = "SELECT * FROM pqs_event_push_logs WHERE " + string + InfluxDBPublicParam.TIME_ZONE;
System.out.println("sql===========" + sql);
//结果集
QueryResult results = influxDbUtils.query(sql);
//结果集映射到对象中