pv终端台账

This commit is contained in:
2022-07-20 09:11:34 +08:00
parent 2a619ec235
commit b3e70554d1
15 changed files with 200 additions and 111 deletions

View File

@@ -39,12 +39,12 @@ public class PvUnitController extends BaseController {
private final IPvUnitService iPvUnitService;
/**
/* *//**
* 新增单位
* @param pvUnitParam 单位实体
* @author cdf
* @date 2022/7/5
*/
*//*
@PostMapping("addUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增单位")
@@ -58,11 +58,11 @@ public class PvUnitController extends BaseController {
}
/**
*//**
* 修改单位
* @author cdf
* @date 2022/7/5
*/
*//*
@PostMapping("updateUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改单位")
@@ -76,13 +76,13 @@ public class PvUnitController extends BaseController {
}
/**
*//**
* 查询所有单位
* @param baseParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvUnit>
*/
*//*
@PostMapping("getPvUnitList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有单位")
@@ -95,13 +95,13 @@ public class PvUnitController extends BaseController {
}
/**
*//**
* 根据单位id查询单位
* @param id 单位id
* @author cdf
* @date 2022/7/5
* @return PvUnit
*/
*//*
@GetMapping("getPvUnitById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据单位id查询单位")
@@ -113,13 +113,13 @@ public class PvUnitController extends BaseController {
}
/**
*//**
* 删除单位
* @param id 单位id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
*//*
@DeleteMapping("delPvUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除单位")
@@ -129,6 +129,6 @@ public class PvUnitController extends BaseController {
iPvUnitService.delPvUnit(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
*/
}

View File

@@ -9,6 +9,7 @@ import com.njcn.common.utils.PubUtils;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.LineDetailQueryParam;
import com.njcn.device.pojo.param.pv.PvLineDetailParam;
import com.njcn.device.pojo.po.pv.PvDevice;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.device.pojo.vo.pv.PvLineAllDetailVO;
@@ -30,7 +31,7 @@ import java.util.Objects;
/**
* <p>
* 监测点实现类
* 监测点实现类
* </p>
*
* @author cdf
@@ -55,7 +56,7 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
public boolean addLineDetail(PvLineDetailParam pvLineDetailParam) {
checkNameAndParam(pvLineDetailParam);
//判断同一台装置是否出现监测点序号重复或超过x路序号
lineNumIsExit(pvLineDetailParam,false);
lineNumIsExit(pvLineDetailParam, false);
PvLineDetail pvLineDetail = commMonit(pvLineDetailParam);
return this.save(pvLineDetail);
}
@@ -63,7 +64,7 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
@Override
public boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam) {
checkNameAndParam(updatePvLineDetailParam);
lineNumIsExit(updatePvLineDetailParam,true);
lineNumIsExit(updatePvLineDetailParam, true);
PvLineDetail pvLineDetail = commMonit(updatePvLineDetailParam);
return this.updateById(pvLineDetail);
}
@@ -72,14 +73,14 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
/**
* 公共代码提取
*/
private PvLineDetail commMonit(PvLineDetailParam pvLineDetailParam){
private PvLineDetail commMonit(PvLineDetailParam pvLineDetailParam) {
PvLineDetail pvLineDetail = new PvLineDetail();
BeanUtils.copyProperties(pvLineDetailParam,pvLineDetail);
BeanUtils.copyProperties(pvLineDetailParam, pvLineDetail);
pvLineDetail.setState(DataStateEnum.ENABLE.getCode());
if(StrUtil.isNotBlank(pvLineDetailParam.getAccess())){
if (StrUtil.isNotBlank(pvLineDetailParam.getAccess())) {
pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getAccess()));
}
if(StrUtil.isNotBlank(pvLineDetailParam.getPutIn())){
if (StrUtil.isNotBlank(pvLineDetailParam.getPutIn())) {
pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getPutIn()));
}
return pvLineDetail;
@@ -88,17 +89,18 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
/**
* 监测点序号是否重复判断
*
* @author cdf
* @date 2022/7/11
*/
private void lineNumIsExit(PvLineDetailParam pvLineDetailParam,Boolean isUpdate){
private void lineNumIsExit(PvLineDetailParam pvLineDetailParam, Boolean isUpdate) {
LambdaQueryWrapper<PvLineDetail> query = new LambdaQueryWrapper<>();
query.eq(PvLineDetail::getDevId,pvLineDetailParam.getDevId())
.eq(PvLineDetail::getNum,pvLineDetailParam.getNum())
.eq(PvLineDetail::getState,DataStateEnum.ENABLE.getCode());
if(isUpdate){
if(pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam){
query.ne(PvLineDetail::getId,((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId());
query.eq(PvLineDetail::getDevId, pvLineDetailParam.getDevId())
.eq(PvLineDetail::getNum, pvLineDetailParam.getNum())
.eq(PvLineDetail::getState, DataStateEnum.ENABLE.getCode());
if (isUpdate) {
if (pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam) {
query.ne(PvLineDetail::getId, ((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId());
}
}
int count = this.count(query);
@@ -110,9 +112,9 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
@Override
public Page<PvLineDetail> getPvLineDetailList(LineDetailQueryParam subsAreaQueryParam) {
Page<PvLineDetail> page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam),PageFactory.getPageSize(subsAreaQueryParam));
Page<PvLineDetail> page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam), PageFactory.getPageSize(subsAreaQueryParam));
LambdaQueryWrapper<PvLineDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
return this.page(page,lambdaQueryWrapper);
return this.page(page, lambdaQueryWrapper);
}
@Override
@@ -131,11 +133,11 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
}
@Override
public Page<PvLineAllDetailVO> getPvLineAllDetailMain(Integer pageNum,Integer pageSize,List<String> subIds, List<String> subAreaIds) {
public Page<PvLineAllDetailVO> getPvLineAllDetailMain(Integer pageNum, Integer pageSize, List<String> subIds, List<String> subAreaIds) {
Page<PvLineAllDetailVO> page = new Page<>(pageNum,pageSize);
Page<PvLineAllDetailVO> page = new Page<>(pageNum, pageSize);
return this.baseMapper.getPvLineAllDetailMain(page,subIds,subAreaIds);
return this.baseMapper.getPvLineAllDetailMain(page, subIds, subAreaIds);
}
@@ -146,81 +148,120 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
*/
private void checkNameAndParam(PvLineDetailParam pvLineDetailParam) {
if(Objects.isNull(iPvDeviceService.getPvDeviceById(pvLineDetailParam.getDevId()))){
PvDevice pvDevice = iPvDeviceService.getPvDeviceById(pvLineDetailParam.getDevId());
if (Objects.isNull(pvDevice)) {
throw new BusinessException(PvDeviceResponseEnum.DEV_NULL);
}
DictData devType = dicDataFeignClient.getDicDataById(pvDevice.getType()).getData();
/*校验监测类型*/
DictData lineType = dicDataFeignClient.getDicDataById(pvLineDetailParam.getType()).getData();
if(Objects.isNull(lineType)){
if (Objects.isNull(lineType)) {
throw new BusinessException(SystemResponseEnum.LINE_TYPE_VARIETY_EMPTY);
}
if(DicDataEnum.ONE_LINE.getCode().equals(lineType.getCode())){
if(StrUtil.hasBlank(pvLineDetailParam.getSubstationId(),pvLineDetailParam.getVoltageId())){
throw new BusinessException(PvDeviceResponseEnum.ONE_SUB_VOLTAGE_EMPTY);
}
if(StrUtil.isNotBlank(pvLineDetailParam.getSubAreaId())){
pvLineDetailParam.setSubAreaId("");
}
}else if(DicDataEnum.TWO_LINE.getCode().equals(lineType.getCode())){
if(StrUtil.isNotBlank(pvLineDetailParam.getSubstationId()) ||StrUtil.isNotBlank(pvLineDetailParam.getVoltageId())){
throw new BusinessException(PvDeviceResponseEnum.TWO_SUB_VOLTAGE_EMPTY_MUST);
}
//2类3类监测点必须存在台区
if(StrUtil.isBlank(pvLineDetailParam.getSubAreaId())){
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_EMPTY);
}
}else if(DicDataEnum.THREE_LINE.getCode().equals(lineType.getCode())){
if(StrUtil.isNotBlank(pvLineDetailParam.getSubstationId()) ||StrUtil.isNotBlank(pvLineDetailParam.getVoltageId())){
throw new BusinessException(PvDeviceResponseEnum.TWO_SUB_VOLTAGE_EMPTY_MUST);
}
//2类3类监测点必须存在台区
if(StrUtil.isBlank(pvLineDetailParam.getSubAreaId())){
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_EMPTY);
}
}
if(Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getBusinessType()).getData())){
throw new BusinessException(SystemResponseEnum.BUSINESS_EMPTY);
}
if(StrUtil.isNotBlank(pvLineDetailParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getScale()).getData())) {
throw new BusinessException(SystemResponseEnum.LINE_TYPE_VARIETY_EMPTY);
}
}
if(Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getLoadType()).getData())){
throw new BusinessException(SystemResponseEnum.INTERFERENCE_EMPTY);
}
/* if (!pvDevice.getType().equals(lineType.getId())) {
throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
}*/
/*校验变电站*/
if(StrUtil.isNotBlank(pvLineDetailParam.getSubstationId())) {
if (StrUtil.isNotBlank(pvLineDetailParam.getSubstationId())) {
if (Objects.isNull(iPvSubstationService.getPvSubstationById(pvLineDetailParam.getSubstationId()))) {
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_NULL);
}
}
/*校验母线*/
if(StrUtil.isNotBlank(pvLineDetailParam.getVoltageId())) {
if (Objects.isNull(iPvVoltageService.getPvVoltageById(pvLineDetailParam.getVoltageId()))) {
throw new BusinessException(PvDeviceResponseEnum.VOLTAGE_NULL);
}
}
/*校验台区*/
if(StrUtil.isNotBlank(pvLineDetailParam.getSubAreaId())) {
if (StrUtil.isNotBlank(pvLineDetailParam.getSubAreaId())) {
if (Objects.isNull(iPvSubAreaService.getPvSubAreaById(pvLineDetailParam.getSubAreaId()))) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_NULL);
}
}
/*监测点类型*/
if (DicDataEnum.ONE_LINE.getCode().equals(lineType.getCode())) {
//I类监测点
if (StrUtil.hasBlank(pvLineDetailParam.getSubstationId(), pvLineDetailParam.getVoltageId())) {
throw new BusinessException(PvDeviceResponseEnum.ONE_SUB_VOLTAGE_EMPTY);
}
if (StrUtil.isNotBlank(pvLineDetailParam.getSubAreaId())) {
pvLineDetailParam.setSubAreaId("");
}
/*校验母线*/
if(StrUtil.isBlank(pvLineDetailParam.getVoltageId())){
throw new BusinessException(PvDeviceResponseEnum.VOLTAGE_PARAM_EMPTY);
}
if (Objects.isNull(iPvVoltageService.getPvVoltageById(pvLineDetailParam.getVoltageId()))) {
throw new BusinessException(PvDeviceResponseEnum.VOLTAGE_NULL);
}
/*I类监测点终端只能选电能质量监测终端*/
if(!DicDataEnum.DEV_QUALITY.getCode().equals(devType.getCode())){
throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
}
} else if (DicDataEnum.TWO_LINE.getCode().equals(lineType.getCode())) {
//II类监测点
if (StrUtil.isNotBlank(pvLineDetailParam.getSubstationId()) || StrUtil.isNotBlank(pvLineDetailParam.getVoltageId())) {
throw new BusinessException(PvDeviceResponseEnum.TWO_SUB_VOLTAGE_EMPTY_MUST);
}
//2类3类监测点必须存在台区
if (StrUtil.isBlank(pvLineDetailParam.getSubAreaId())) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_EMPTY);
}
//II III 类监测点所属母线id必须为空
if(StrUtil.isNotBlank(pvLineDetailParam.getVoltageId())){
throw new BusinessException(PvDeviceResponseEnum.VOLTAGE_PARAM_EMPTY_MUST);
}
/*II类监测点终端只能选融合终端*/
if(!DicDataEnum.DEV_MIX.getCode().equals(devType.getCode())){
throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
}
} else if (DicDataEnum.THREE_LINE.getCode().equals(lineType.getCode())) {
//III类监测点
if (StrUtil.isNotBlank(pvLineDetailParam.getSubstationId()) || StrUtil.isNotBlank(pvLineDetailParam.getVoltageId())) {
throw new BusinessException(PvDeviceResponseEnum.TWO_SUB_VOLTAGE_EMPTY_MUST);
}
//2类3类监测点必须存在台区
if (StrUtil.isBlank(pvLineDetailParam.getSubAreaId())) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_EMPTY);
}
/*III类监测点终端只能选智能电表终端*/
if(!DicDataEnum.DEV_SMART.getCode().equals(devType.getCode())){
throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
}
}
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getBusinessType()).getData())) {
throw new BusinessException(SystemResponseEnum.BUSINESS_EMPTY);
}
if (StrUtil.isNotBlank(pvLineDetailParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getScale()).getData())) {
throw new BusinessException(SystemResponseEnum.LINE_TYPE_VARIETY_EMPTY);
}
}
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getLoadType()).getData())) {
throw new BusinessException(SystemResponseEnum.INTERFERENCE_EMPTY);
}
}

View File

@@ -17,6 +17,7 @@ import com.njcn.pvdevice.service.IPvUnitService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
@@ -44,6 +45,8 @@ public class PvSubAreaServiceImpl extends ServiceImpl<PvSubAreaMapper, PvSubArea
private final IPvUnitService iPvUnitService;
private final DeptFeignClient deptFeignClient;
@Override
public boolean addSubArea(PvSubAreaParam pvSubAreaParam) {
checkNameAndParam(pvSubAreaParam,false);
@@ -92,7 +95,7 @@ public class PvSubAreaServiceImpl extends ServiceImpl<PvSubAreaMapper, PvSubArea
if(Objects.isNull(iPvTenVoltageService.getPvTenVoltageById(pvSubAreaParam.getTenVoltageId()))){
throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_NULL);
}
if(Objects.isNull(iPvUnitService.getPvUnitById(pvSubAreaParam.getUnitId()))){
if(Objects.isNull(deptFeignClient.getDeptById(pvSubAreaParam.getUnitId()))){
throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL);
}

View File

@@ -22,6 +22,7 @@ import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor;
@@ -47,6 +48,8 @@ public class PvSubstationServiceImpl extends ServiceImpl<PvSubstationMapper, PvS
private final IPvUnitService iPvUnitService;
private final DeptFeignClient deptFeignClient;
@Override
public boolean addSubstation(PvSubstationParam pvSubstationParam) {
@@ -111,10 +114,11 @@ public class PvSubstationServiceImpl extends ServiceImpl<PvSubstationMapper, PvS
if(Objects.isNull(dictData)){
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
if(Objects.isNull(iPvUnitService.getPvUnitById(pvSubstationParam.getUnitId()))){
if(Objects.isNull(deptFeignClient.getDeptById(pvSubstationParam.getUnitId()))){
throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL);
}
}

View File

@@ -17,6 +17,7 @@ import com.njcn.pvdevice.service.*;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -59,16 +60,13 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
List<PvTerminalTreeVO> subAreaTreeList = pvSubAreaMapper.getSubAreaTreeList();
unitTreeList.addAll(subTreeList);
unitTreeList.addAll(subAreaTreeList);
List<PvTerminalTreeVO> newUnit = unitTreeList.stream().filter(item->item.getPid().equals("0")).peek(tem->tem.setChildren(getChildren(tem,unitTreeList))).collect(Collectors.toList());
return newUnit;
return unitTreeList.stream().filter(item->item.getPid().equals("0")).peek(tem->tem.setChildren(getChildren(tem,unitTreeList))).collect(Collectors.toList());
}
@Override
public Page<PvLineAllDetailVO> lineDetailBySubId(PvTerminalBaseQuery pvTerminalBaseQuery) {
List<String> ids = pvTerminalBaseQuery.getId();
Integer level = pvTerminalBaseQuery.getLevel();
if(level.equals(LineBaseEnum.PV_UNIT_LEVEL.getCode())){
//点击的是单位节点
LambdaQueryWrapper<PvSubstation> subQuery= new LambdaQueryWrapper<>();
@@ -80,20 +78,17 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
areaQuery.in(PvSubArea::getUnitId,ids);
List<PvSubArea> subAreaList = iPvSubAreaService.list(areaQuery);
List<String> subAreaIds = subAreaList.stream().map(PvSubArea::getId).collect(Collectors.toList());
return iPvLineDetailService.getPvLineAllDetailMain(1,10,subIds,subAreaIds);
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),subIds,subAreaIds);
}else if(level.equals(LineBaseEnum.PV_SUB_LEVEL.getCode())){
return iPvLineDetailService.getPvLineAllDetailMain(1,10, ids,null);
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery), ids,null);
}else if(level.equals(LineBaseEnum.PV_SUB_AREA_LEVEL.getCode())){
return iPvLineDetailService.getPvLineAllDetailMain(1,10,null,ids);
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),null,ids);
}
throw new BusinessException(CommonResponseEnum.FAIL);
}
private void diGui(List<PvTerminalTreeVO> unitTreeList,List<PvTerminalTreeVO> subTreeList,List<PvTerminalTreeVO> subAreaTreeList) {
/* private void diGui(List<PvTerminalTreeVO> unitTreeList,List<PvTerminalTreeVO> subTreeList,List<PvTerminalTreeVO> subAreaTreeList) {
for (PvTerminalTreeVO unit : unitTreeList) {
if (CollUtil.isNotEmpty(unit.getChildren())) {
diGui(unit.getChildren(),subTreeList,subAreaTreeList);
@@ -102,7 +97,7 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
unit.setChildren(getChildren(unit, subAreaTreeList));
}
}
}
}*/
private List<PvTerminalTreeVO> getChildren(PvTerminalTreeVO tem, List<PvTerminalTreeVO> children) {

View File

@@ -108,7 +108,7 @@ public class PvVoltageServiceImpl extends ServiceImpl<PvVoltageMapper, PvVoltage
}
//校验序号
lambdaQueryWrapper.clear();
/* lambdaQueryWrapper.clear();
lambdaQueryWrapper.eq(PvVoltage::getNum, pvVoltageParam.getNum());
if (isUpdate) {
//更新操作
@@ -119,6 +119,6 @@ public class PvVoltageServiceImpl extends ServiceImpl<PvVoltageMapper, PvVoltage
int countNum = this.count(lambdaQueryWrapper);
if (countNum > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_NUM_REPEAT);
}
}*/
}
}