冀北拓扑图代码提交
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user