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

@@ -23,6 +23,8 @@ public enum PvDeviceResponseEnum {
DVE_CODE_REPEAT("A0355","终端编号重复"), DVE_CODE_REPEAT("A0355","终端编号重复"),
USER_CODE_REPEAT("A0356","用户编号重复"), USER_CODE_REPEAT("A0356","用户编号重复"),
SUB_AREA_EMPTY("A0357","台区不能为空"), SUB_AREA_EMPTY("A0357","台区不能为空"),
VOLTAGE_PARAM_EMPTY("A0358","所属母线不可为空"),
VOLTAGE_PARAM_EMPTY_MUST("A0359","所属母线必须为空"),
TEN_VOLTAGE_NULL("A0360","未查询到指定10kV线路"), TEN_VOLTAGE_NULL("A0360","未查询到指定10kV线路"),
@@ -34,7 +36,7 @@ public enum PvDeviceResponseEnum {
DEV_NUM_NULL("A0366","当前装置监测点序号已存在"), DEV_NUM_NULL("A0366","当前装置监测点序号已存在"),
ONE_SUB_VOLTAGE_EMPTY("A0367","I类监测点变电站母线不可为空"), ONE_SUB_VOLTAGE_EMPTY("A0367","I类监测点变电站母线不可为空"),
TWO_SUB_VOLTAGE_EMPTY_MUST("A0368","II类监测点变电站母线必须为空"), TWO_SUB_VOLTAGE_EMPTY_MUST("A0368","II类监测点变电站母线必须为空"),
LINE_DEVICE_NO_MATCH("A0369","监测点所属装置型号不匹配"),
; ;

View File

@@ -52,12 +52,7 @@ public class PvVoltageParam implements Serializable {
@NotBlank(message = "电压等级不可为空") @NotBlank(message = "电压等级不可为空")
private String scale; private String scale;
/**
* 母线模型0虚拟母线1实际母线默认是实际母线
*/
@ApiModelProperty(value = "母线模型0虚拟母线1实际母线默认是实际母线",required = true)
@NotNull(message = "母线模型不可为空")
private Integer model;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@@ -43,10 +43,7 @@ public class PvVoltage {
*/ */
private String scale; private String scale;
/**
* 母线模型0虚拟母线1实际母线默认是实际母线
*/
private Integer model;
} }

View File

@@ -39,12 +39,12 @@ public class PvUnitController extends BaseController {
private final IPvUnitService iPvUnitService; private final IPvUnitService iPvUnitService;
/** /* *//**
* 新增单位 * 新增单位
* @param pvUnitParam 单位实体 * @param pvUnitParam 单位实体
* @author cdf * @author cdf
* @date 2022/7/5 * @date 2022/7/5
*/ *//*
@PostMapping("addUnit") @PostMapping("addUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增单位") @ApiOperation("新增单位")
@@ -58,11 +58,11 @@ public class PvUnitController extends BaseController {
} }
/** *//**
* 修改单位 * 修改单位
* @author cdf * @author cdf
* @date 2022/7/5 * @date 2022/7/5
*/ *//*
@PostMapping("updateUnit") @PostMapping("updateUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改单位") @ApiOperation("修改单位")
@@ -76,13 +76,13 @@ public class PvUnitController extends BaseController {
} }
/** *//**
* 查询所有单位 * 查询所有单位
* @param baseParam 查询实体 * @param baseParam 查询实体
* @author cdf * @author cdf
* @date 2022/7/5 * @date 2022/7/5
* @return Page<PvUnit> * @return Page<PvUnit>
*/ *//*
@PostMapping("getPvUnitList") @PostMapping("getPvUnitList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有单位") @ApiOperation("查询所有单位")
@@ -95,13 +95,13 @@ public class PvUnitController extends BaseController {
} }
/** *//**
* 根据单位id查询单位 * 根据单位id查询单位
* @param id 单位id * @param id 单位id
* @author cdf * @author cdf
* @date 2022/7/5 * @date 2022/7/5
* @return PvUnit * @return PvUnit
*/ *//*
@GetMapping("getPvUnitById") @GetMapping("getPvUnitById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据单位id查询单位") @ApiOperation("根据单位id查询单位")
@@ -113,13 +113,13 @@ public class PvUnitController extends BaseController {
} }
/** *//**
* 删除单位 * 删除单位
* @param id 单位id * @param id 单位id
* @author cdf * @author cdf
* @date 2022/7/5 * @date 2022/7/5
* @return boolean * @return boolean
*/ *//*
@DeleteMapping("delPvUnit") @DeleteMapping("delPvUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除单位") @ApiOperation("删除单位")
@@ -129,6 +129,6 @@ public class PvUnitController extends BaseController {
iPvUnitService.delPvUnit(id); iPvUnitService.delPvUnit(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); 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.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.LineDetailQueryParam; import com.njcn.device.pojo.param.pv.LineDetailQueryParam;
import com.njcn.device.pojo.param.pv.PvLineDetailParam; 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.po.pv.PvLineDetail; import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.device.pojo.vo.pv.PvLineAllDetailVO; import com.njcn.device.pojo.vo.pv.PvLineAllDetailVO;
@@ -30,7 +31,7 @@ import java.util.Objects;
/** /**
* <p> * <p>
* 监测点实现类 * 监测点实现类
* </p> * </p>
* *
* @author cdf * @author cdf
@@ -55,7 +56,7 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
public boolean addLineDetail(PvLineDetailParam pvLineDetailParam) { public boolean addLineDetail(PvLineDetailParam pvLineDetailParam) {
checkNameAndParam(pvLineDetailParam); checkNameAndParam(pvLineDetailParam);
//判断同一台装置是否出现监测点序号重复或超过x路序号 //判断同一台装置是否出现监测点序号重复或超过x路序号
lineNumIsExit(pvLineDetailParam,false); lineNumIsExit(pvLineDetailParam, false);
PvLineDetail pvLineDetail = commMonit(pvLineDetailParam); PvLineDetail pvLineDetail = commMonit(pvLineDetailParam);
return this.save(pvLineDetail); return this.save(pvLineDetail);
} }
@@ -63,7 +64,7 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
@Override @Override
public boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam) { public boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam) {
checkNameAndParam(updatePvLineDetailParam); checkNameAndParam(updatePvLineDetailParam);
lineNumIsExit(updatePvLineDetailParam,true); lineNumIsExit(updatePvLineDetailParam, true);
PvLineDetail pvLineDetail = commMonit(updatePvLineDetailParam); PvLineDetail pvLineDetail = commMonit(updatePvLineDetailParam);
return this.updateById(pvLineDetail); 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(); PvLineDetail pvLineDetail = new PvLineDetail();
BeanUtils.copyProperties(pvLineDetailParam,pvLineDetail); BeanUtils.copyProperties(pvLineDetailParam, pvLineDetail);
pvLineDetail.setState(DataStateEnum.ENABLE.getCode()); pvLineDetail.setState(DataStateEnum.ENABLE.getCode());
if(StrUtil.isNotBlank(pvLineDetailParam.getAccess())){ if (StrUtil.isNotBlank(pvLineDetailParam.getAccess())) {
pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getAccess())); pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getAccess()));
} }
if(StrUtil.isNotBlank(pvLineDetailParam.getPutIn())){ if (StrUtil.isNotBlank(pvLineDetailParam.getPutIn())) {
pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getPutIn())); pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getPutIn()));
} }
return pvLineDetail; return pvLineDetail;
@@ -88,17 +89,18 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
/** /**
* 监测点序号是否重复判断 * 监测点序号是否重复判断
*
* @author cdf * @author cdf
* @date 2022/7/11 * @date 2022/7/11
*/ */
private void lineNumIsExit(PvLineDetailParam pvLineDetailParam,Boolean isUpdate){ private void lineNumIsExit(PvLineDetailParam pvLineDetailParam, Boolean isUpdate) {
LambdaQueryWrapper<PvLineDetail> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PvLineDetail> query = new LambdaQueryWrapper<>();
query.eq(PvLineDetail::getDevId,pvLineDetailParam.getDevId()) query.eq(PvLineDetail::getDevId, pvLineDetailParam.getDevId())
.eq(PvLineDetail::getNum,pvLineDetailParam.getNum()) .eq(PvLineDetail::getNum, pvLineDetailParam.getNum())
.eq(PvLineDetail::getState,DataStateEnum.ENABLE.getCode()); .eq(PvLineDetail::getState, DataStateEnum.ENABLE.getCode());
if(isUpdate){ if (isUpdate) {
if(pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam){ if (pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam) {
query.ne(PvLineDetail::getId,((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId()); query.ne(PvLineDetail::getId, ((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId());
} }
} }
int count = this.count(query); int count = this.count(query);
@@ -110,9 +112,9 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
@Override @Override
public Page<PvLineDetail> getPvLineDetailList(LineDetailQueryParam subsAreaQueryParam) { 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<>(); LambdaQueryWrapper<PvLineDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
return this.page(page,lambdaQueryWrapper); return this.page(page, lambdaQueryWrapper);
} }
@Override @Override
@@ -131,11 +133,11 @@ public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvL
} }
@Override @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) { 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); throw new BusinessException(PvDeviceResponseEnum.DEV_NULL);
} }
DictData devType = dicDataFeignClient.getDicDataById(pvDevice.getType()).getData();
/*校验监测类型*/ /*校验监测类型*/
DictData lineType = dicDataFeignClient.getDicDataById(pvLineDetailParam.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); 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 (!pvDevice.getType().equals(lineType.getId())) {
if(StrUtil.isBlank(pvLineDetailParam.getSubAreaId())){ throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
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(StrUtil.isNotBlank(pvLineDetailParam.getSubstationId())) { if (StrUtil.isNotBlank(pvLineDetailParam.getSubstationId())) {
if (Objects.isNull(iPvSubstationService.getPvSubstationById(pvLineDetailParam.getSubstationId()))) { if (Objects.isNull(iPvSubstationService.getPvSubstationById(pvLineDetailParam.getSubstationId()))) {
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_NULL); 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()))) { if (Objects.isNull(iPvSubAreaService.getPvSubAreaById(pvLineDetailParam.getSubAreaId()))) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_NULL); 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.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum; import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -44,6 +45,8 @@ public class PvSubAreaServiceImpl extends ServiceImpl<PvSubAreaMapper, PvSubArea
private final IPvUnitService iPvUnitService; private final IPvUnitService iPvUnitService;
private final DeptFeignClient deptFeignClient;
@Override @Override
public boolean addSubArea(PvSubAreaParam pvSubAreaParam) { public boolean addSubArea(PvSubAreaParam pvSubAreaParam) {
checkNameAndParam(pvSubAreaParam,false); checkNameAndParam(pvSubAreaParam,false);
@@ -92,7 +95,7 @@ public class PvSubAreaServiceImpl extends ServiceImpl<PvSubAreaMapper, PvSubArea
if(Objects.isNull(iPvTenVoltageService.getPvTenVoltageById(pvSubAreaParam.getTenVoltageId()))){ if(Objects.isNull(iPvTenVoltageService.getPvTenVoltageById(pvSubAreaParam.getTenVoltageId()))){
throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_NULL); 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); 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.DicDataTypeEnum;
import com.njcn.system.enums.SystemResponseEnum; import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -47,6 +48,8 @@ public class PvSubstationServiceImpl extends ServiceImpl<PvSubstationMapper, PvS
private final IPvUnitService iPvUnitService; private final IPvUnitService iPvUnitService;
private final DeptFeignClient deptFeignClient;
@Override @Override
public boolean addSubstation(PvSubstationParam pvSubstationParam) { public boolean addSubstation(PvSubstationParam pvSubstationParam) {
@@ -111,10 +114,11 @@ public class PvSubstationServiceImpl extends ServiceImpl<PvSubstationMapper, PvS
if(Objects.isNull(dictData)){ if(Objects.isNull(dictData)){
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); 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); 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.system.api.DicDataFeignClient;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -59,16 +60,13 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
List<PvTerminalTreeVO> subAreaTreeList = pvSubAreaMapper.getSubAreaTreeList(); List<PvTerminalTreeVO> subAreaTreeList = pvSubAreaMapper.getSubAreaTreeList();
unitTreeList.addAll(subTreeList); unitTreeList.addAll(subTreeList);
unitTreeList.addAll(subAreaTreeList); 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 unitTreeList.stream().filter(item->item.getPid().equals("0")).peek(tem->tem.setChildren(getChildren(tem,unitTreeList))).collect(Collectors.toList());
return newUnit;
} }
@Override @Override
public Page<PvLineAllDetailVO> lineDetailBySubId(PvTerminalBaseQuery pvTerminalBaseQuery) { public Page<PvLineAllDetailVO> lineDetailBySubId(PvTerminalBaseQuery pvTerminalBaseQuery) {
List<String> ids = pvTerminalBaseQuery.getId(); List<String> ids = pvTerminalBaseQuery.getId();
Integer level = pvTerminalBaseQuery.getLevel(); Integer level = pvTerminalBaseQuery.getLevel();
if(level.equals(LineBaseEnum.PV_UNIT_LEVEL.getCode())){ if(level.equals(LineBaseEnum.PV_UNIT_LEVEL.getCode())){
//点击的是单位节点 //点击的是单位节点
LambdaQueryWrapper<PvSubstation> subQuery= new LambdaQueryWrapper<>(); LambdaQueryWrapper<PvSubstation> subQuery= new LambdaQueryWrapper<>();
@@ -80,20 +78,17 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
areaQuery.in(PvSubArea::getUnitId,ids); areaQuery.in(PvSubArea::getUnitId,ids);
List<PvSubArea> subAreaList = iPvSubAreaService.list(areaQuery); List<PvSubArea> subAreaList = iPvSubAreaService.list(areaQuery);
List<String> subAreaIds = subAreaList.stream().map(PvSubArea::getId).collect(Collectors.toList()); 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())){ }else if(level.equals(LineBaseEnum.PV_SUB_LEVEL.getCode())){
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery), ids,null);
return iPvLineDetailService.getPvLineAllDetailMain(1,10, ids,null);
}else if(level.equals(LineBaseEnum.PV_SUB_AREA_LEVEL.getCode())){ }else if(level.equals(LineBaseEnum.PV_SUB_AREA_LEVEL.getCode())){
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),null,ids);
return iPvLineDetailService.getPvLineAllDetailMain(1,10,null,ids);
} }
throw new BusinessException(CommonResponseEnum.FAIL); 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) { for (PvTerminalTreeVO unit : unitTreeList) {
if (CollUtil.isNotEmpty(unit.getChildren())) { if (CollUtil.isNotEmpty(unit.getChildren())) {
diGui(unit.getChildren(),subTreeList,subAreaTreeList); diGui(unit.getChildren(),subTreeList,subAreaTreeList);
@@ -102,7 +97,7 @@ public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
unit.setChildren(getChildren(unit, subAreaTreeList)); unit.setChildren(getChildren(unit, subAreaTreeList));
} }
} }
} }*/
private List<PvTerminalTreeVO> getChildren(PvTerminalTreeVO tem, List<PvTerminalTreeVO> children) { 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()); lambdaQueryWrapper.eq(PvVoltage::getNum, pvVoltageParam.getNum());
if (isUpdate) { if (isUpdate) {
//更新操作 //更新操作
@@ -119,6 +119,6 @@ public class PvVoltageServiceImpl extends ServiceImpl<PvVoltageMapper, PvVoltage
int countNum = this.count(lambdaQueryWrapper); int countNum = this.count(lambdaQueryWrapper);
if (countNum > 0) { if (countNum > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_NUM_REPEAT); throw new BusinessException(PvDeviceResponseEnum.SUB_NUM_REPEAT);
} }*/
} }
} }

View File

@@ -31,8 +31,14 @@ public enum DicDataEnum {
*/ */
ONE_LINE("I类监测点","One_Line"), ONE_LINE("I类监测点","One_Line"),
TWO_LINE("II类监测点","Two_Line"), TWO_LINE("II类监测点","Two_Line"),
THREE_LINE("III类监测点","Three_Line") THREE_LINE("III类监测点","Three_Line"),
/**
* 终端类型
*/
DEV_QUALITY("电能质量监测终端","Dev_Quality"),
DEV_SMART("智能电表","Dev_Smart"),
DEV_MIX("智能融合终端","Dev_Mix"),
; ;
private final String name; private final String name;

View File

@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.user.api.fallback.DeptFeignClientFallbackFactory; import com.njcn.user.api.fallback.DeptFeignClientFallbackFactory;
import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -53,4 +54,10 @@ public interface DeptFeignClient {
@GetMapping("/allDeptList") @GetMapping("/allDeptList")
HttpResult<List<PvTerminalTreeVO>> allDeptList(); HttpResult<List<PvTerminalTreeVO>> allDeptList();
/**
* 获取所有部门
*/
@GetMapping("/getDeptById")
HttpResult<Dept> getDeptById(@RequestParam("deptId") String deptId);
} }

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.user.utils.UserEnumUtil; import com.njcn.user.utils.UserEnumUtil;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
@@ -62,6 +63,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
log.error("{}异常,降级处理,异常为:{}","查询所有部门异常",cause.toString()); log.error("{}异常,降级处理,异常为:{}","查询所有部门异常",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<Dept> getDeptById(String deptId) {
log.error("{}异常,降级处理,异常为:{}","查询所部门异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -13,6 +13,7 @@ import com.njcn.common.utils.LogUtil;
import com.njcn.system.pojo.dto.AreaTreeDTO; import com.njcn.system.pojo.dto.AreaTreeDTO;
import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.user.pojo.param.DeptParam; import com.njcn.user.pojo.param.DeptParam;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.vo.DeptAllTreeVO; import com.njcn.user.pojo.vo.DeptAllTreeVO;
import com.njcn.user.pojo.vo.DeptTreeVO; import com.njcn.user.pojo.vo.DeptTreeVO;
import com.njcn.user.pojo.vo.DeptVO; import com.njcn.user.pojo.vo.DeptVO;
@@ -269,5 +270,20 @@ public class DeptController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
/**
* 根据部门获取部门信息
* @author cdf
* @date 2022/7/12
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/getDeptById")
@ApiOperation("获取所有单位")
public HttpResult<Dept> getDeptById(@RequestParam("deptId")String deptId) {
String methodDescribe = getMethodDescribe("getDeptById");
Dept result = deptService.getDeptById(deptId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
} }

View File

@@ -138,4 +138,13 @@ public interface IDeptService extends IService<Dept> {
* @date 2022/7/12 * @date 2022/7/12
*/ */
List<PvTerminalTreeVO> allDeptList(); List<PvTerminalTreeVO> allDeptList();
/**
* 根据部门id获取部门详情
* @author cdf
* @date 2022/7/13
*/
Dept getDeptById(String id);
} }

View File

@@ -256,6 +256,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
return this.baseMapper.allDeptList(); return this.baseMapper.allDeptList();
} }
@Override
public Dept getDeptById(String id){
return this.baseMapper.selectById(id);
}
/** /**
* 校验参数,检查是否存在相同编码的部门 * 校验参数,检查是否存在相同编码的部门
*/ */