From 865cdc97d6bae1d624f119698afb58dd755eeace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E6=9C=A8c?= <857448963@qq.com> Date: Mon, 9 Jan 2023 11:46:47 +0800 Subject: [PATCH] =?UTF-8?q?pms=E5=8F=B0=E8=B4=A6=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pms/enums/PmsDeviceResponseEnum.java | 2 ++ .../pojo/param/DistributionMonitorParam.java | 3 ++ .../impl/StatationStatServiceImpl.java | 29 +++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java index d4eb824aa..dea579fcb 100644 --- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java +++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java @@ -33,6 +33,8 @@ public enum PmsDeviceResponseEnum { POWER_CODE_SAME("A00374","台区名称或编号重复"), POWER_CLIENT_DIS_EMPTY("A00375","发电用电用户参数不可为空"), DIS_ADD_REPEAT("A00376","当前配网中存在该监测点"), + STATION_REPEAT("A00377","已存在相同电站"), + DEPT_STATION_REPEAT("A00378","单位下存在同名电站"), POWER_CLIENT_NOT_FIND("A00380","查无此用电用户"), diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/param/DistributionMonitorParam.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/param/DistributionMonitorParam.java index 9ec244800..784ab42db 100644 --- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/param/DistributionMonitorParam.java +++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/param/DistributionMonitorParam.java @@ -38,4 +38,7 @@ public class DistributionMonitorParam { @ApiModelProperty(value = "III类监测点小类 0.用电用户 1.发电用户 默认用电") private Integer smallType; + + + } diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java index 4b1c7c4fa..28f694756 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java @@ -3,6 +3,8 @@ package com.njcn.device.pms.service.majornetwork.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.pms.enums.PmsDeviceResponseEnum; import com.njcn.device.pms.mapper.majornetwork.StatationStatMapper; import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO; import com.njcn.device.pms.pojo.param.StatationStatParam; @@ -18,6 +20,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Objects; /** *

@@ -46,6 +49,21 @@ public class StatationStatServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(StatationStat::getOrgId,statationStatParam.getOrgId()) + .eq(StatationStat::getPowerName,statationStatParam.getPowerName()); + int count = this.count(lambdaQueryWrapper); + if(count>0){ + throw new BusinessException(PmsDeviceResponseEnum.DEPT_STATION_REPEAT); + } + StatationStat statationStat = new StatationStat(); BeanUtils.copyProperties(statationStatParam, statationStat); statationStat.setStatus(DataStateEnum.ENABLE.getCode()); @@ -54,6 +72,17 @@ public class StatationStatServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(StatationStat::getOrgId,statationStatParam.getOrgId()) + .eq(StatationStat::getPowerName,statationStatParam.getPowerName()) + .ne(StatationStat::getPowerId,statationStatParam.getPowerId()); + int count = this.count(lambdaQueryWrapper); + if(count>0){ + throw new BusinessException(PmsDeviceResponseEnum.DEPT_STATION_REPEAT); + } + StatationStat statationStat = new StatationStat(); BeanUtils.copyProperties(statationStatParam, statationStat); return this.updateById(statationStat);