将终端台账拆分为pq&pms两类

This commit is contained in:
2022-09-29 19:43:14 +08:00
parent 5385e7521b
commit ab8e86f257
530 changed files with 5060 additions and 1863 deletions

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pms-device</artifactId>
<groupId>com.njcn</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pms-device-boot</artifactId>
<packaging>jar</packaging>
<name>pms终端模块核心业务</name>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>pms-device-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>user-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>system-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>event-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-influxDB</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,160 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.DeviceQueryParam;
import com.njcn.device.pms.pojo.param.PvDeviceParam;
import com.njcn.device.pms.pojo.po.PvDevice;
import com.njcn.device.pms.pojo.vo.PvDeviceVO;
import com.njcn.device.pms.service.IPvDeviceService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 终端控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvDevice")
@Api(tags = "pv终端控制器")
@RequiredArgsConstructor
public class PvDeviceController extends BaseController {
private final IPvDeviceService iPvDeviceService;
/**
* 新增终端
* @param pvDeviceParam 终端实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addDevice")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增终端")
@ApiImplicitParam(name = "pvDeviceParam",value = "终端实体",required = true)
public HttpResult<Object> addDevice(@RequestBody @Validated PvDeviceParam pvDeviceParam){
String methodDescribe = getMethodDescribe("addDevice");
boolean res = iPvDeviceService.addDevice(pvDeviceParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 修改终端
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateDevice")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改终端")
@ApiImplicitParam(name = "updatePvDeviceParam",value = "终端实体",required = true)
public HttpResult<Object> updateDevice(@RequestBody @Validated PvDeviceParam.UpdatePvDeviceParam updatePvDeviceParam){
String methodDescribe = getMethodDescribe("updateDevice");
boolean res = iPvDeviceService.updateDevice(updatePvDeviceParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 分页查询终端
* @param deviceQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvDevice>
*/
@PostMapping("getPvDeviceList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询终端")
@ApiImplicitParam(name = "deviceQueryParam",value = "终端实体",required = true)
public HttpResult<Page<PvDeviceVO>> getPvDeviceList(@RequestBody DeviceQueryParam deviceQueryParam){
String methodDescribe = getMethodDescribe("getPvDeviceList");
Page<PvDeviceVO> page = iPvDeviceService.getPvDeviceList(deviceQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有终端
* @author cdf
* @date 2022/7/5
* @return Page<PvDevice>
*/
@PostMapping("getAllPvDeviceList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有终端")
public HttpResult<List<PvDeviceVO>> getAllPvDeviceList(){
String methodDescribe = getMethodDescribe("getAllPvDeviceList");
List<PvDeviceVO> list = iPvDeviceService.getAllPvDeviceList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据终端id查询终端
* @param id 终端id
* @author cdf
* @date 2022/7/5
* @return PvDevice
*/
@GetMapping("getPvDeviceById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据终端id查询终端")
@ApiImplicitParam(name = "id",value = "终端id",required = true)
public HttpResult<PvDevice> getPvDeviceById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvDeviceById");
PvDevice pvDevice = iPvDeviceService.getPvDeviceById(id);
if(Objects.nonNull(pvDevice)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvDevice, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 删除终端
* @param ids 终端id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@PostMapping("delPvDevice")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.DELETE)
@ApiOperation("删除终端")
@ApiImplicitParam(name = "ids",value = "终端id",required = true)
public HttpResult<PvDevice> delPvDevice(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delPvDevice");
boolean res = iPvDeviceService.delPvDevice(ids);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,48 @@
package com.njcn.device.pms.controller;
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.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.bo.DeviceRunExBO;
import com.njcn.device.pms.pojo.dto.DeviceRunExDTO;
import com.njcn.device.pms.service.IPvDeviceRunExService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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.RestController;
import java.util.List;
/**
* pv终端运行异常
*
* @author yangj
* @date 2022/09/08
*/
@RestController
@RequestMapping("/pvDeviceEx")
@Api(tags = "pv终端运行异常")
@RequiredArgsConstructor
public class PvDeviceRunExController extends BaseController {
private final IPvDeviceRunExService pvDeviceRunExService;
@PostMapping("getPvDeviceExList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页条件查询终端异常")
@ApiImplicitParam(name = "deviceRunExDTO",value = "终端异常",required = true)
public HttpResult<List<DeviceRunExBO>> getPvDeviceExList(@RequestBody DeviceRunExDTO deviceRunExDTO) {
String methodDescribe = getMethodDescribe("getPvDeviceExList");
List<DeviceRunExBO> pvDeviceExList = pvDeviceRunExService.getPvDeviceExList(deviceRunExDTO);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvDeviceExList, methodDescribe);
}
}

View File

@@ -0,0 +1,25 @@
package com.njcn.device.pms.controller;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvDispatch")
@Api(tags = "设备控制器")
@RequiredArgsConstructor
public class PvDispatchController extends BaseController {
}

View File

@@ -0,0 +1,159 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.DistributedQueryParam;
import com.njcn.device.pms.pojo.param.PvDistributedParam;
import com.njcn.device.pms.pojo.po.PvDistributed;
import com.njcn.device.pms.pojo.vo.PvDistributedVO;
import com.njcn.device.pms.service.IPvDistributedService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 分布式光伏控制器
* </p>
*
* @author cdf
* @since 2022-07-06
*/
@RestController
@RequestMapping("/pvDistributed")
@Api(tags = "pv分布式光伏控制器")
@RequiredArgsConstructor
public class PvDistributedController extends BaseController {
private final IPvDistributedService iPvDistributedService;
/**
* 新增分布式光伏台账
* @param pvDistributedParam 分布式光伏台账实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addDistributed")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增分布式光伏台账")
@ApiImplicitParam(name = "pvDistributedParam",value = "分布式光伏台账实体",required = true)
public HttpResult<Object> addDistributed(@RequestBody @Validated PvDistributedParam pvDistributedParam){
String methodDescribe = getMethodDescribe("addDistributed");
boolean res = iPvDistributedService.addDistributed(pvDistributedParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 修改分布式光伏台账
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateDistributed")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改分布式光伏台账")
@ApiImplicitParam(name = "updatePvDistributedParam",value = "分布式光伏台账实体",required = true)
public HttpResult<Object> updateDistributed(@RequestBody @Validated PvDistributedParam.UpdatePvDistributedParam updatePvDistributedParam){
String methodDescribe = getMethodDescribe("updateDistributed");
boolean res = iPvDistributedService.updateDistributed(updatePvDistributedParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 分页查询分布式光伏台账
* @param distributedQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvDistributed>
*/
@PostMapping("getPvDistributedList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询分布式光伏台账")
@ApiImplicitParam(name = "distributedQueryParam",value = "分布式光伏台账实体",required = true)
public HttpResult<Page<PvDistributedVO>> getPvDistributedList(@RequestBody DistributedQueryParam distributedQueryParam){
String methodDescribe = getMethodDescribe("getPvDistributedList");
Page<PvDistributedVO> page = iPvDistributedService.getPvDistributedList(distributedQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有分布式光伏台账
* @author cdf
* @date 2022/7/5
* @return Page<PvDistributed>
*/
@PostMapping("getAllPvDistributedList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有分布式光伏台账")
public HttpResult<List<PvDistributed>> getAllPvDistributedList(){
String methodDescribe = getMethodDescribe("getAllPvDistributedList");
List<PvDistributed> list = iPvDistributedService.getAllPvDistributedList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据分布式光伏台账id查询分布式光伏台账
* @param id 分布式光伏台账id
* @author cdf
* @date 2022/7/5
* @return PvDistributed
*/
@GetMapping("getPvDistributedById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据分布式光伏台账id查询分布式光伏台账")
@ApiImplicitParam(name = "id",value = "分布式光伏台账id",required = true)
public HttpResult<PvDistributed> getPvDistributedById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvDistributedById");
PvDistributed pvDistributed = iPvDistributedService.getPvDistributedById(id);
if(Objects.nonNull(pvDistributed)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvDistributed, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 删除分布式光伏台账
* @param ids 分布式光伏台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@PostMapping("delPvDistributed")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除分布式光伏台账")
@ApiImplicitParam(name = "ids",value = "分布式光伏台账ids",required = true)
public HttpResult<PvDistributed> delPvDistributed(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delPvDistributed");
boolean res = iPvDistributedService.delPvDistributed(ids);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,160 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.LineDetailQueryParam;
import com.njcn.device.pms.pojo.param.PvLineDetailParam;
import com.njcn.device.pms.pojo.po.PvLineDetail;
import com.njcn.device.pms.service.IPvLineDetailService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 监测点控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvLineDetail")
@Api(tags = "pv监测点控制器")
@RequiredArgsConstructor
public class PvLineDetailController extends BaseController {
private final IPvLineDetailService iPvLineDetailService;
/**
* 新增监测点
* @param pvLineDetailParam 监测点实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addLineDetail")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增监测点")
@ApiImplicitParam(name = "pvLineDetailParam",value = "监测点实体",required = true)
public HttpResult<Object> addLineDetail(@RequestBody @Validated PvLineDetailParam pvLineDetailParam){
String methodDescribe = getMethodDescribe("addLineDetail");
boolean res = iPvLineDetailService.addLineDetail(pvLineDetailParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 修改监测点
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateLineDetail")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改监测点")
@ApiImplicitParam(name = "updatePvLineDetailParam",value = "监测点实体",required = true)
public HttpResult<Object> updateLineDetail(@RequestBody @Validated PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam){
String methodDescribe = getMethodDescribe("updateLineDetail");
boolean res = iPvLineDetailService.updateLineDetail(updatePvLineDetailParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 分页查询监测点
* @param lineDetailQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvLineDetail>
*/
@PostMapping("getPvLineDetailList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询监测点")
@ApiImplicitParam(name = "lineDetailQueryParam",value = "监测点实体",required = true)
public HttpResult<Page<PvLineDetail>> getPvLineDetailList(@RequestBody LineDetailQueryParam lineDetailQueryParam){
String methodDescribe = getMethodDescribe("getPvLineDetailList");
Page<PvLineDetail> page = iPvLineDetailService.getPvLineDetailList(lineDetailQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有监测点
* @author cdf
* @date 2022/7/5
* @return Page<PvLineDetail>
*/
@PostMapping("getAllPvLineDetailList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有监测点")
public HttpResult<List<PvLineDetail>> getAllPvLineDetailList(){
String methodDescribe = getMethodDescribe("getAllPvLineDetailList");
List<PvLineDetail> list = iPvLineDetailService.getAllPvLineDetailList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据监测点id查询监测点
* @param id 监测点id
* @author cdf
* @date 2022/7/5
* @return PvLineDetail
*/
@GetMapping("getPvLineDetailById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据监测点id查询监测点")
@ApiImplicitParam(name = "id",value = "监测点id",required = true)
public HttpResult<PvLineDetail> getPvLineDetailById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvLineDetailById");
PvLineDetail pvLineDetail = iPvLineDetailService.getPvLineDetailById(id);
if(Objects.nonNull(pvLineDetail)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvLineDetail, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 删除监测点
* @param ids 监测点id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@PostMapping("delPvLineDetail")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除监测点")
@ApiImplicitParam(name = "ids",value = "监测点id",required = true)
public HttpResult<PvLineDetail> delPvLineDetail(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delPvLineDetail");
boolean res = iPvLineDetailService.delPvLineDetail(ids);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,160 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.LvUserQueryParam;
import com.njcn.device.pms.pojo.param.PvLvUserParam;
import com.njcn.device.pms.pojo.po.PvLvUser;
import com.njcn.device.pms.pojo.vo.PvLvUserVO;
import com.njcn.device.pms.service.IPvLvUserService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 低压用户台账控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvLvUser")
@Api(tags = "pv低压用户台账控制器")
@RequiredArgsConstructor
public class PvLvUserController extends BaseController {
private final IPvLvUserService iPvLvUserService;
/**
* 新增低压用户台账
* @param pvLvUserParam 低压用户台账实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addLvUser")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增低压用户台账")
@ApiImplicitParam(name = "pvLvUserParam",value = "低压用户台账实体",required = true)
public HttpResult<Object> addLvUser(@RequestBody @Validated PvLvUserParam pvLvUserParam){
String methodDescribe = getMethodDescribe("addLvUser");
boolean res = iPvLvUserService.addLvUser(pvLvUserParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 修改低压用户台账
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateLvUser")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改低压用户台账")
@ApiImplicitParam(name = "updatePvLvUserParam",value = "低压用户台账实体",required = true)
public HttpResult<Object> updateLvUser(@RequestBody @Validated PvLvUserParam.UpdatePvLvUserParam updatePvLvUserParam){
String methodDescribe = getMethodDescribe("updateLvUser");
boolean res = iPvLvUserService.updateLvUser(updatePvLvUserParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 分页查询低压用户台账
* @param lvUserQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvLvUser>
*/
@PostMapping("getPvLvUserList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询低压用户台账")
@ApiImplicitParam(name = "lvUserQueryParam",value = "低压用户台账实体",required = true)
public HttpResult<Page<PvLvUserVO>> getPvLvUserList(@RequestBody LvUserQueryParam lvUserQueryParam){
String methodDescribe = getMethodDescribe("getPvLvUserList");
Page<PvLvUserVO> page = iPvLvUserService.getPvLvUserList(lvUserQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有低压用户台账
* @author cdf
* @date 2022/7/5
* @return Page<PvLvUser>
*/
@PostMapping("getAllPvLvUserList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有低压用户台账")
public HttpResult<List<PvLvUser>> getAllPvLvUserList(){
String methodDescribe = getMethodDescribe("getAllPvLvUserList");
List<PvLvUser> list = iPvLvUserService.getAllPvLvUserList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据低压用户台账id查询低压用户台账
* @param id 低压用户台账id
* @author cdf
* @date 2022/7/5
* @return PvLvUser
*/
@GetMapping("getPvLvUserById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据低压用户台账id查询低压用户台账")
@ApiImplicitParam(name = "id",value = "低压用户台账id",required = true)
public HttpResult<PvLvUser> getPvLvUserById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvLvUserById");
PvLvUser pvLvUser = iPvLvUserService.getPvLvUserById(id);
if(Objects.nonNull(pvLvUser)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvLvUser, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 删除低压用户台账
* @param ids 低压用户台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@PostMapping("delPvLvUser")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.DELETE)
@ApiOperation("删除低压用户台账")
@ApiImplicitParam(name = "ids",value = "低压用户台账id",required = true)
public HttpResult<PvLvUser> delPvLvUser(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delPvLvUser");
boolean res = iPvLvUserService.delPvLvUser(ids);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,160 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.PvSubAreaParam;
import com.njcn.device.pms.pojo.param.SubAreaQueryParam;
import com.njcn.device.pms.pojo.po.PvSubArea;
import com.njcn.device.pms.pojo.vo.PvSubAreaVO;
import com.njcn.device.pms.service.IPvSubAreaService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 台区控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvSubArea")
@Api(tags = "pv台区控制器")
@RequiredArgsConstructor
public class PvSubAreaController extends BaseController {
private final IPvSubAreaService iPvSubAreaService;
/**
* 新增台区
* @param pvSubAreaParam 台区实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addSubArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增台区")
@ApiImplicitParam(name = "pvSubAreaParam",value = "台区实体",required = true)
public HttpResult<Object> addSubArea(@RequestBody @Validated PvSubAreaParam pvSubAreaParam){
String methodDescribe = getMethodDescribe("addSubArea");
boolean res = iPvSubAreaService.addSubArea(pvSubAreaParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 修改台区
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateSubArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改台区")
@ApiImplicitParam(name = "updatePvSubAreaParam",value = "台区实体",required = true)
public HttpResult<Object> updateSubArea(@RequestBody @Validated PvSubAreaParam.UpdatePvSubAreaParam updatePvSubAreaParam){
String methodDescribe = getMethodDescribe("updateSubArea");
boolean res = iPvSubAreaService.updateSubArea(updatePvSubAreaParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 分页查询台区
* @param subAreaQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvSubArea>
*/
@PostMapping("getPvSubAreaList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询台区")
@ApiImplicitParam(name = "subAreaQueryParam",value = "台区实体",required = true)
public HttpResult<Page<PvSubAreaVO>> getPvSubAreaList(@RequestBody SubAreaQueryParam subAreaQueryParam){
String methodDescribe = getMethodDescribe("getPvSubAreaList");
Page<PvSubAreaVO> page = iPvSubAreaService.getPvSubAreaList(subAreaQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有台区
* @author cdf
* @date 2022/7/5
* @return Page<PvSubArea>
*/
@PostMapping("getAllPvSubAreaList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有台区")
public HttpResult<List<PvSubArea>> getAllPvSubAreaList(){
String methodDescribe = getMethodDescribe("getAllPvSubAreaList");
List<PvSubArea> list = iPvSubAreaService.getAllPvSubAreaList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据台区id查询台区
* @param id 台区id
* @author cdf
* @date 2022/7/5
* @return PvSubArea
*/
@GetMapping("getPvSubAreaById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据台区id查询台区")
@ApiImplicitParam(name = "id",value = "台区id",required = true)
public HttpResult<PvSubArea> getPvSubAreaById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvSubAreaById");
PvSubArea pvSubArea = iPvSubAreaService.getPvSubAreaById(id);
if(Objects.nonNull(pvSubArea)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvSubArea, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 删除台区
* @param ids 台区ids
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@PostMapping("delPvSubArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除台区")
@ApiImplicitParam(name = "ids",value = "台区ids",required = true)
public HttpResult<PvSubArea> delPvSubArea(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delPvSubArea");
boolean res = iPvSubAreaService.delPvSubArea(ids);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,150 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.PvSubstationParam;
import com.njcn.device.pms.pojo.param.SubstationQueryParam;
import com.njcn.device.pms.pojo.po.PvSubstation;
import com.njcn.device.pms.pojo.vo.PvSubstationVO;
import com.njcn.device.pms.service.IPvSubstationService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 变电站控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvSubstation")
@Api(tags = "pv变电站控制器")
@RequiredArgsConstructor
public class PvSubstationController extends BaseController {
private final IPvSubstationService iPvSubstationService;
/**
* 新增变电站
* @param pvSubstationParam 变电站实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addSubstation")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增变电站")
@ApiImplicitParam(name = "pvSubstationParam",value = "变电站实体",required = true)
public HttpResult<Object> addSubstation(@RequestBody @Validated PvSubstationParam pvSubstationParam){
String methodDescribe = getMethodDescribe("addSubstation");
iPvSubstationService.addSubstation(pvSubstationParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 修改变电站
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateSubstation")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改变电站")
@ApiImplicitParam(name = "updatePvSubstationParam",value = "变电站实体",required = true)
public HttpResult<Object> updateSubstation(@RequestBody @Validated PvSubstationParam.UpdatePvSubstationParam updatePvSubstationParam){
String methodDescribe = getMethodDescribe("updateSubstation");
iPvSubstationService.updateSubstation(updatePvSubstationParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 分页查询变电站
* @param substationQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvSubstation>
*/
@PostMapping("getPvSubstationList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询变电站")
@ApiImplicitParam(name = "substationQueryParam",value = "变电站实体",required = true)
public HttpResult<Page<PvSubstationVO>> getPvSubstationList(@RequestBody SubstationQueryParam substationQueryParam){
String methodDescribe = getMethodDescribe("getPvSubstationList");
Page<PvSubstationVO> page = iPvSubstationService.getPvSubstationList(substationQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有变电站
* @author cdf
* @date 2022/7/5
* @return Page<PvSubstation>
*/
@PostMapping("getAllPvSubstationList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有变电站")
public HttpResult<List<PvSubstation>> getAllPvSubstationList(){
String methodDescribe = getMethodDescribe("getAllPvSubstationList");
List<PvSubstation> list = iPvSubstationService.getAllPvSubstationList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据变电站id查询变电站
* @param id 变电站id
* @author cdf
* @date 2022/7/5
* @return PvSubstation
*/
@GetMapping("getPvSubstationById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据变电站id查询变电站")
@ApiImplicitParam(name = "id",value = "变电站id",required = true)
public HttpResult<PvSubstation> getPvSubstationById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvSubstationById");
PvSubstation pvSubstation = iPvSubstationService.getPvSubstationById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvSubstation, methodDescribe);
}
/**
* 删除变电站
* @param ids 变电站ids
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@PostMapping("delPvSubstation")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.DELETE)
@ApiOperation("删除变电站")
@ApiImplicitParam(name = "ids",value = "变电站ids",required = true)
public HttpResult<PvSubstation> delPvSubstation(@RequestBody List<String> ids){
String methodDescribe = getMethodDescribe("delPvSubstation");
iPvSubstationService.delPvSubstation(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,157 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.PvTenVoltageParam;
import com.njcn.device.pms.pojo.param.TenVoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvTenVoltage;
import com.njcn.device.pms.pojo.vo.PvTenVoltageVO;
import com.njcn.device.pms.service.IPvTenVoltageService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvTenVoltage")
@Api(tags = "pv十千伏线路控制器")
@RequiredArgsConstructor
public class PvTenVoltageController extends BaseController {
private final IPvTenVoltageService iPvTenVoltageService;
/**
* 新增10kV线路
*
* @param pvTenVoltageParam 10kV线路实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addTenVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增10kV线路")
@ApiImplicitParam(name = "pvTenVoltageParam", value = "10kV线路实体", required = true)
public HttpResult<Object> addTenVoltage(@RequestBody @Validated PvTenVoltageParam pvTenVoltageParam) {
String methodDescribe = getMethodDescribe("addTenVoltage");
boolean flag = iPvTenVoltageService.addTenVoltage(pvTenVoltageParam);
if (flag) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 修改10kV线路
*
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateTenVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
@ApiOperation("修改10kV线路")
@ApiImplicitParam(name = "updatePvTenVoltageParam", value = "10kV线路实体", required = true)
public HttpResult<Object> updateTenVoltage(@RequestBody @Validated PvTenVoltageParam.UpdatePvTenVoltageParam updatePvTenVoltageParam) {
String methodDescribe = getMethodDescribe("updateTenVoltage");
boolean flag = iPvTenVoltageService.updateTenVoltage(updatePvTenVoltageParam);
if (flag) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
/**
* 分页查询10kV线路
*
* @param tenVoltageQueryParam 查询实体
* @return Page<PvTenVoltage>
* @author cdf
* @date 2022/7/5
*/
@PostMapping("getPvTenVoltageList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询10kV线路")
@ApiImplicitParam(name = "tenVoltageQueryParam", value = "10kV线路实体", required = true)
public HttpResult<Page<PvTenVoltageVO>> getPvTenVoltageList(@RequestBody @Validated TenVoltageQueryParam tenVoltageQueryParam) {
String methodDescribe = getMethodDescribe("getPvTenVoltageList");
Page<PvTenVoltageVO> page = iPvTenVoltageService.getPvTenVoltageList(tenVoltageQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有10kV线路
* @author cdf
* @date 2022/7/5
* @return List<PvTenVoltage>
*/
@GetMapping("getAllPvTenVoltageList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有10kV线路")
public HttpResult<List<PvTenVoltage>> getAllPvTenVoltageList(){
String methodDescribe = getMethodDescribe("getAllPvTenVoltageList");
List<PvTenVoltage> res = iPvTenVoltageService.getAllPvTenVoltageList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
}
/**
* 根据10kV线路id查询10kV线路
*
* @param id 10kV线路id
* @return PvTenVoltage
* @author cdf
* @date 2022/7/5
*/
@GetMapping("getPvTenVoltageById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据10kV线路id查询10kV线路")
@ApiImplicitParam(name = "id", value = "10kV线路id", required = true)
public HttpResult<PvTenVoltage> getPvTenVoltageById(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getPvTenVoltageById");
PvTenVoltage pvTenVoltage = iPvTenVoltageService.getPvTenVoltageById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvTenVoltage, methodDescribe);
}
/**
* 删除10kV线路
*
* @param ids 10kV线路id
* @return boolean
* @author cdf
* @date 2022/7/5
*/
@PostMapping("delPvTenVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除10kV线路")
@ApiImplicitParam(name = "ids", value = "10kV线路id", required = true)
public HttpResult<PvTenVoltage> delPvTenVoltage(@RequestBody List<String> ids) {
String methodDescribe = getMethodDescribe("delPvTenVoltage");
boolean flag = iPvTenVoltageService.delPvTenVoltage(ids);
if (flag) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,92 @@
package com.njcn.device.pms.controller;
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;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.PvTerminalBaseQuery;
import com.njcn.device.pms.pojo.vo.DisOrLvVO;
import com.njcn.device.pms.pojo.vo.PvLineAllDetailVO;
import com.njcn.device.pms.service.PvTerminalBaseService;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* pqs
* 台账相关控制
*
* @author cdf
* @date 2022/7/11
*/
@RestController
@RequestMapping("/pvTerminalBase")
@Api(tags = "pv终端相关基础管理")
@RequiredArgsConstructor
public class PvTerminalBaseController extends BaseController {
private final PvTerminalBaseService pvTerminalBaseService;
/**
* 获取终端台账树
*
* @author cdf
* @date 2022/7/11
*/
@GetMapping("pvTree")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("获取终端台账树")
public HttpResult<List<PvTerminalTreeVO>> pvTerminalTree() {
String methodDescribe = getMethodDescribe("pvTerminalTree");
List<PvTerminalTreeVO> tree = pvTerminalBaseService.pvTerminalTree();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, tree, methodDescribe);
}
/**
* 点击变电站台区展示监测点详情
* @param pvTerminalBaseQuery 传参
* @author cdf
* @date 2022/7/11
*/
@PostMapping("pvLineDetail")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("点击树节点获取监测点详情")
@ApiImplicitParam(name = "pvTerminalBaseQuery",value = "参数",required = true)
public HttpResult<Page<PvLineAllDetailVO>> lineDetailBySubId(@RequestBody @Validated PvTerminalBaseQuery pvTerminalBaseQuery) {
String methodDescribe = getMethodDescribe("lineDetailBySubId");
Page<PvLineAllDetailVO> all = pvTerminalBaseService.lineDetailBySubId(pvTerminalBaseQuery);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, all, methodDescribe);
}
/**
* 根据userCode 和 userCodeType
* @author cdf
* @date 2022/7/28
*/
@GetMapping("pvDisOrLv")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据用户编号获取低压分布式详情")
@ApiImplicitParams({
@ApiImplicitParam(name = "userCode", value = "用户编号"),
@ApiImplicitParam(name = "userCodeType", value = "用户编号类型 0.光伏 1.低压"),
})
public HttpResult<DisOrLvVO> pvDisOrLv(@RequestParam("userCode")String userCode,@RequestParam("userCodeType")Integer userCodeType) {
String methodDescribe = getMethodDescribe("pvDisOrLv");
DisOrLvVO all = pvTerminalBaseService.pvDisOrLv(userCode,userCodeType);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, all, methodDescribe);
}
}

View File

@@ -0,0 +1,119 @@
package com.njcn.device.pms.controller;
import com.njcn.device.pms.service.IPvUnitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvUnit")
@Api(tags = "pv单位控制器")
@RequiredArgsConstructor
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("新增单位")
@ApiImplicitParam(name = "pvUnitParam",value = "单位实体",required = true)
public HttpResult<Object> addUnit(@RequestBody @Validated PvUnitParam pvUnitParam){
String methodDescribe = getMethodDescribe("addUnit");
iPvUnitService.addUnit(pvUnitParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
*//**
* 修改单位
* @author cdf
* @date 2022/7/5
*//*
@PostMapping("updateUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改单位")
@ApiImplicitParam(name = "updatePvUnitParam",value = "单位实体",required = true)
public HttpResult<Object> updateUnit(@RequestBody @Validated PvUnitParam.UpdatePvUnitParam updatePvUnitParam){
String methodDescribe = getMethodDescribe("updateUnit");
iPvUnitService.updateUnit(updatePvUnitParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
*//**
* 查询所有单位
* @param baseParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvUnit>
*//*
@PostMapping("getPvUnitList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有单位")
@ApiImplicitParam(name = "baseParam",value = "单位实体",required = true)
public HttpResult<List<UnitTreeVO>> getPvUnitList(@RequestBody BaseParam baseParam){
String methodDescribe = getMethodDescribe("getPvUnitList");
List<UnitTreeVO> res = iPvUnitService.getPvUnitList(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
}
*//**
* 根据单位id查询单位
* @param id 单位id
* @author cdf
* @date 2022/7/5
* @return PvUnit
*//*
@GetMapping("getPvUnitById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据单位id查询单位")
@ApiImplicitParam(name = "id",value = "单位id",required = true)
public HttpResult<PvUnit> getPvUnitById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvUnitById");
PvUnit pvUnit = iPvUnitService.getPvUnitById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvUnit, methodDescribe);
}
*//**
* 删除单位
* @param id 单位id
* @author cdf
* @date 2022/7/5
* @return boolean
*//*
@DeleteMapping("delPvUnit")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除单位")
@ApiImplicitParam(name = "id",value = "单位id",required = true)
public HttpResult<PvUnit> delPvUnit(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvUnit");
iPvUnitService.delPvUnit(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
*/
}

View File

@@ -0,0 +1,144 @@
package com.njcn.device.pms.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.PvVoltageParam;
import com.njcn.device.pms.pojo.param.VoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvVoltage;
import com.njcn.device.pms.service.IPvVoltageService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@RestController
@RequestMapping("/pvVoltage")
@Api(tags = "pv母线控制器")
@RequiredArgsConstructor
public class PvVoltageController extends BaseController {
private final IPvVoltageService iPvVoltageService;
/**
* 新增母线
* @param pvVoltageParam 母线实体
* @author cdf
* @date 2022/7/5
*/
@PostMapping("addVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增母线")
@ApiImplicitParam(name = "pvVoltageParam",value = "母线实体",required = true)
public HttpResult<Object> addVoltage(@RequestBody @Validated PvVoltageParam pvVoltageParam){
String methodDescribe = getMethodDescribe("addVoltage");
iPvVoltageService.addVoltage(pvVoltageParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 修改母线
* @author cdf
* @date 2022/7/5
*/
@PostMapping("updateVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE)
@ApiOperation("修改母线")
@ApiImplicitParam(name = "updatePvVoltageParam",value = "母线实体",required = true)
public HttpResult<Object> updateVoltage(@RequestBody @Validated PvVoltageParam.UpdatePvVoltageParam updatePvVoltageParam){
String methodDescribe = getMethodDescribe("updateVoltage");
iPvVoltageService.updateVoltage(updatePvVoltageParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
/**
* 分页查询母线
* @param voltageQueryParam 查询实体
* @author cdf
* @date 2022/7/5
* @return Page<PvVoltage>
*/
@PostMapping("getPvVoltageList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("分页查询母线")
@ApiImplicitParam(name = "voltageQueryParam",value = "母线实体",required = true)
public HttpResult<Page<PvVoltage>> getPvVoltageList(@RequestBody VoltageQueryParam voltageQueryParam){
String methodDescribe = getMethodDescribe("getPvVoltageList");
Page<PvVoltage> page = iPvVoltageService.getPvVoltageList(voltageQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
/**
* 查询所有母线
* @author cdf
* @date 2022/7/5
* @return Page<PvVoltage>
*/
@PostMapping("getAllPvVoltageList")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("查询所有母线")
public HttpResult<List<PvVoltage>> getAllPvVoltageList(){
String methodDescribe = getMethodDescribe("getAllPvVoltageList");
List<PvVoltage> list = iPvVoltageService.getAllPvVoltageList();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据母线id查询母线
* @param id 母线id
* @author cdf
* @date 2022/7/5
* @return PvVoltage
*/
@GetMapping("getPvVoltageById")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("根据母线id查询母线")
@ApiImplicitParam(name = "id",value = "母线id",required = true)
public HttpResult<PvVoltage> getPvVoltageById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getPvVoltageById");
PvVoltage pvVoltage = iPvVoltageService.getPvVoltageById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvVoltage, methodDescribe);
}
/**
* 删除母线
* @param id 母线id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除母线")
@ApiImplicitParam(name = "id",value = "母线id",required = true)
public HttpResult<PvVoltage> delPvVoltage(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvVoltage");
iPvVoltageService.delPvVoltage(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,36 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.DeviceQueryParam;
import com.njcn.device.pms.pojo.po.PvDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.PvDeviceVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvDeviceMapper extends BaseMapper<PvDevice> {
/**
* 获取所有终端台账
* @author cdf
* @date 2022/7/8
*/
Page<PvDeviceVO> getPvDeviceList(Page<PvDeviceVO> page, @Param("deviceQueryParam") DeviceQueryParam deviceQueryParam);
List<PvDeviceVO> getAllPvDeviceList();
}

View File

@@ -0,0 +1,22 @@
package com.njcn.device.pms.mapper;
import com.njcn.device.pms.pojo.bo.DeviceRunExBO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author yangj
* @date 2022/09/14
*/
public interface PvDeviceRunExMapper {
/**
* 查询pq_line表获取信息
* @param lineLevel 监测点等级
* @param pid 父级id
* @return List<DeviceRunExBO>
*/
List<DeviceRunExBO> findPQLineInfo(@Param("lineLevel") String lineLevel, @Param("pid") String pid);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.device.pms.mapper;
import com.njcn.device.pms.pojo.po.PvDispatch;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvDispatchMapper extends BaseMapper<PvDispatch> {
}

View File

@@ -0,0 +1,28 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.DistributedQueryParam;
import com.njcn.device.pms.pojo.po.PvDistributed;
import com.njcn.device.pms.pojo.vo.PvDistributedVO;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-06
*/
public interface PvDistributedMapper extends BaseMapper<PvDistributed> {
/**
* 查询索引分布式光伏
* @author cdf
* @date 2022/7/7
*/
Page<PvDistributedVO> getPvDistributedList(Page<PvDistributedVO> page, @Param("distributedQueryParam") DistributedQueryParam distributedQueryParam);
}

View File

@@ -0,0 +1,33 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.po.PvLineDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.PvLineAllDetailVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvLineDetailMapper extends BaseMapper<PvLineDetail> {
/**
* 分页查询监测点
* @param subIds 变电站ids
* @param subAreaIds 台区ids
* @author cdf
* @date 2022/7/5
* @return Page<PvLineDetail>
*/
Page<PvLineAllDetailVO> getPvLineAllDetailMain(Page<PvLineAllDetailVO> page,@Param("subIds") List<String> subIds, @Param("subAreaIds")List<String> subAreaIds,@Param("type")String type,@Param("lineStatus")Integer lineStatus);
}

View File

@@ -0,0 +1,27 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.LvUserQueryParam;
import com.njcn.device.pms.pojo.po.PvLvUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.PvLvUserVO;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvLvUserMapper extends BaseMapper<PvLvUser> {
/**
* 分页获取低压用户台账
* @author cdf
* @date 2022/7/8
*/
Page<PvLvUserVO> getPvLvUserList(Page<PvLvUserVO> page, @Param("lvUserQueryParam") LvUserQueryParam lvUserQueryParam);
}

View File

@@ -0,0 +1,41 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.SubAreaQueryParam;
import com.njcn.device.pms.pojo.po.PvSubArea;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.DisOrLvVO;
import com.njcn.device.pms.pojo.vo.PvSubAreaVO;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvSubAreaMapper extends BaseMapper<PvSubArea> {
/**
* 查询所有台区
* @author cdf
* @date 2022/7/7
*/
Page<PvSubAreaVO> getPvSubAreaList(Page<PvSubAreaVO> page, @Param("subsAreaQueryParam") SubAreaQueryParam subsAreaQueryParam);
/**
* 查询所有台区
* @author cdf
* @date 2022/7/11
*/
List<PvTerminalTreeVO> getSubAreaTreeList();
DisOrLvVO pvDisOrLv(String userCode, String userCodeType);
}

View File

@@ -0,0 +1,31 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.SubstationQueryParam;
import com.njcn.device.pms.pojo.po.PvSubstation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.PvSubstationVO;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvSubstationMapper extends BaseMapper<PvSubstation> {
Page<PvSubstationVO> getPvSubstationList(Page<PvSubstation> page, @Param("substationQueryParam") SubstationQueryParam substationQueryParam);
/**
* 终端树结构的变电站
* @author cdf
* @date 2022/7/11
*/
List<PvTerminalTreeVO> getSubstationTreeList();
}

View File

@@ -0,0 +1,27 @@
package com.njcn.device.pms.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.TenVoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvTenVoltage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.PvTenVoltageVO;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvTenVoltageMapper extends BaseMapper<PvTenVoltage> {
/**
* 获取所有10kV线路
* @author cdf
* @date 2022/7/7
*/
Page<PvTenVoltageVO> getPvTenVoltageList(Page<PvTenVoltageVO> page, @Param("tenVoltageQueryParam") TenVoltageQueryParam tenVoltageQueryParam);
}

View File

@@ -0,0 +1,32 @@
package com.njcn.device.pms.mapper;
import com.njcn.device.pms.pojo.po.PvUnit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pms.pojo.vo.UnitTreeVO;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvUnitMapper extends BaseMapper<PvUnit> {
/**
* 获取主列表单位树
* @author cdf
* @date 2022/7/7
*/
List<UnitTreeVO> getPvUnitList(@Param("orderBy")String orderBy,@Param("sortBy")String sortBy);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.device.pms.mapper;
import com.njcn.device.pms.pojo.po.PvVoltage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvVoltageMapper extends BaseMapper<PvVoltage> {
}

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvDeviceMapper">
<select id="getPvDeviceList" resultType="PvDeviceVO">
SELECT
dev.id,
dev.manufacturer,
dic.NAME manufacturerName,
dic2.NAME devTypeName,
dev.dev_Type,
dev.type,
dic3.name typeName,
dev.Dev_Code,
dev.name,
dev.ip,
dev.port,
dev.load_time,
dev.dev_status,
dev.communicate_Type,
dev.Series,
dev.Dev_Key,
dev.This_Time_Check,
dev.Next_Time_Check,
dic4.name devGradeName,
dev.dev_grade
FROM
pv_device dev
LEFT JOIN sys_dict_data dic ON dev.manufacturer = dic.id
LEFT JOIN sys_dict_data dic2 ON dev.Dev_Type = dic2.id
LEFT JOIN sys_dict_data dic3 ON dev.type = dic3.id
LEFT JOIN sys_dict_data dic4 ON dev.dev_grade = dic4.id
<where>
<if test="deviceQueryParam.searchValue!=null and deviceQueryParam.searchValue!=''">
and dev.dev_code like CONCAT('%',#{deviceQueryParam.searchValue},'%')
or dev.name like CONCAT('%',#{deviceQueryParam.searchValue},'%')
</if>
<if test="deviceQueryParam.manufacturer!=null and deviceQueryParam.manufacturer.size > 0">
and dev.manufacturer in
<foreach collection="deviceQueryParam.manufacturer" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="deviceQueryParam.type!=null and deviceQueryParam.type.size > 0">
and dev.type in
<foreach collection="deviceQueryParam.type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and dev.state = 1
</where>
order by dev.create_time asc
</select>
<select id="getAllPvDeviceList" resultType="PvDeviceVO">
SELECT
dev.id,
dev.manufacturer,
dic.NAME manufacturerName,
dic2.NAME devTypeName,
dev.dev_Type,
dev.type,
dic3.name typeName,
dic3.code typeCode,
dev.Dev_Code,
dev.name,
dev.ip,
dev.port,
dev.load_time,
dev.dev_status,
dev.communicate_Type,
dev.Series,
dev.Dev_Key,
dev.This_Time_Check,
dev.Next_Time_Check
FROM
pv_device dev
LEFT JOIN sys_dict_data dic ON dev.manufacturer = dic.id
LEFT JOIN sys_dict_data dic2 ON dev.Dev_Type = dic2.id
LEFT JOIN sys_dict_data dic3 ON dev.type = dic3.id
where dev.state = 1
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvDeviceRunExMapper">
<resultMap id="findPQLine" type="com.njcn.device.pms.pojo.bo.DeviceRunExBO">
<id column="Id" property="id"/>
<result column="Pid" property="pid"/>
<result column="Pids" property="pidS"/>
<result column="Name" property="name"/>
<result column="Level" property="level"/>
<result column="Sort" property="sort"/>
<result column="Remark" property="remark"/>
<result column="State" property="state"/>
<result column="Create_By" property="createBy"/>
<result column="Create_Time" property="createTime"/>
<result column="Update_By" property="updateBy"/>
<result column="Update_Time" property="updateTime"/>
<collection property="children" column="id" ofType="com.njcn.device.pms.pojo.bo.DeviceRunExBO"/>
</resultMap>
<select id="findPQLineInfo" resultMap="findPQLine">
select
t1.*
from pq_line t1
left join pq_line_detail t2
on t1.Id = t2.Id
where pid = #{pid}
and t2.Line_Grade = #{lineLevel}
and State = 1
</select>
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvDispatchMapper">
</mapper>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvDistributedMapper">
<select id="getPvDistributedList" resultType="PvDistributedVO">
SELECT
dis.id,
dic.NAME scaleName,
dis.scale,
dis.NAME,
dis.User_Code,
dis.Dev_Code,
dis.Machine_Capacity,
dis.Inte_Type,
dis.Phase,
dis.Energy_Capacity,
dis.code,
dis.Smart_Switch,
dis.install_time,
dis.run_time
FROM
pv_distributed dis
LEFT JOIN sys_dict_data dic ON dis.scale = dic.id
<where>
<if test="distributedQueryParam.searchValue!=null and distributedQueryParam.searchValue!=''">
and dis.name like CONCAT('%',#{distributedQueryParam.searchValue},'%')
</if>
<if test="distributedQueryParam.scale!=null and distributedQueryParam.scale.size > 0">
and dis.scale in
<foreach collection="distributedQueryParam.scale" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and dis.state = 1
</where>
order by dis.create_time asc
</select>
</mapper>

View File

@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvLineDetailMapper">
<select id="getPvLineAllDetailMain" resultType="PvLineAllDetailVO">
<if test="subIds!=null and subIds.size!=0">
SELECT
line.id,
line.NAME,
line.CODE,
line.user_Code,
line.user_Code_type,
line.dev_id,
dev.Dev_Code devName,
dev.dev_status lineStatus,
dic.NAME typeName,
line.type,
dic1.NAME scaleName,
line.scale,
line.Substation_Id,
sub.NAME substationName,
v.NAME voltageName,
line.voltage_id,
subArea.NAME subAreaName,
line.sub_area_id,
dis.NAME distributeName,
lv.NAME lvUserName,
line.num,
line.pt1,
line.pt2,
line.ct1,
line.ct2,
line.dev_capacity,
line.short_capacity,
line.standard_capacity,
line.deal_capacity,
line.pt_Type,
dic6.name ptTypeName,
line.time_Interval,
dic2.NAME loadType,
dic3.NAME businessType,
line.Monitor_Flag,
line.Power_Flag,
line.Monitor_Id,
line.Obj_Name,
line.small_name,
line.big_name,
line.Stat_flag,
line.Remark,
line.Tf_Type,
dic4.name tfTypeName,
line.Tf_Code,
line.Ground_Type,
dic5.name groundTypeName,
line.Put_In,
line.Access,
line.Power_Supply
FROM
pv_line_detail line
LEFT JOIN pv_device dev ON line.dev_id = dev.id
LEFT JOIN sys_dict_data dic ON line.type = dic.id
LEFT JOIN sys_dict_data dic1 ON line.scale = dic1.id
LEFT JOIN pv_substation sub ON line.Substation_Id = sub.id
LEFT JOIN pv_voltage v ON line.voltage_id = v.id
LEFT JOIN pv_sub_area subArea ON line.sub_area_id = subArea.id
LEFT JOIN Pv_Distributed dis ON line.user_code = dis.user_code
LEFT JOIN Pv_Lv_User lv ON line.user_code = lv.user_code
LEFT JOIN sys_dict_data dic2 ON line.load_type = dic2.id
LEFT JOIN sys_dict_data dic3 ON line.Business_Type = dic3.id
LEFT JOIN sys_dict_data dic4 ON line.Tf_Type = dic4.id
LEFT JOIN sys_dict_data dic5 ON line.Ground_Type = dic5.id
LEFT JOIN sys_dict_data dic6 ON line.pt_type = dic6.id
where line.state = 1
<if test="subIds!=null and subIds.size!=0">
and line.Substation_Id in
<foreach collection="subIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="type!=null and type!=''">
and line.type = #{type}
</if>
<if test="lineStatus!=null and type!=''">
and dev.dev_status = #{lineStatus}
</if>
</if>
<if test="subIds!=null and subIds.size!=0 and subAreaIds!=null and subAreaIds.size!=0">
UNION ALL
</if>
<if test="subAreaIds!=null and subAreaIds.size!=0">
SELECT
line.id,
line.NAME,
line.user_Code,
line.user_Code_type,
line.CODE,
line.dev_id,
dev.Dev_Code devName,
dev.dev_status lineStatus,
dic.NAME typeName,
line.type,
dic1.NAME scaleName,
line.scale,
line.Substation_Id,
sub.NAME substationName,
v.NAME voltageName,
line.voltage_id,
subArea.NAME subAreaName,
line.sub_area_id,
dis.NAME distributeName,
lv.NAME lvUserName,
line.num,
line.pt1,
line.pt2,
line.ct1,
line.ct2,
line.dev_capacity,
line.short_capacity,
line.standard_capacity,
line.deal_capacity,
line.pt_Type,
dic6.name ptTypeName,
line.time_Interval,
dic2.NAME loadType,
dic3.NAME businessType,
line.Monitor_Flag,
line.Power_Flag,
line.Monitor_Id,
line.Obj_Name,
line.small_name,
line.big_name,
line.Stat_flag,
line.Remark,
line.Tf_Type,
dic4.name tfTypeName,
line.Tf_Code,
line.Ground_Type,
dic5.name groundTypeName,
line.Put_In,
line.Access,
line.Power_Supply
FROM
pv_line_detail line
LEFT JOIN pv_device dev ON line.dev_id = dev.id
LEFT JOIN sys_dict_data dic ON line.type = dic.id
LEFT JOIN sys_dict_data dic1 ON line.scale = dic1.id
LEFT JOIN pv_substation sub ON line.Substation_Id = sub.id
LEFT JOIN pv_voltage v ON line.voltage_id = v.id
LEFT JOIN pv_sub_area subArea ON line.sub_area_id = subArea.id
LEFT JOIN Pv_Distributed dis ON line.user_code = dis.user_code
LEFT JOIN Pv_Lv_User lv ON line.user_code = lv.user_code
LEFT JOIN sys_dict_data dic2 ON line.load_type = dic2.id
LEFT JOIN sys_dict_data dic3 ON line.Business_Type = dic3.id
LEFT JOIN sys_dict_data dic4 ON line.Tf_Type = dic4.id
LEFT JOIN sys_dict_data dic5 ON line.Ground_Type = dic5.id
LEFT JOIN sys_dict_data dic6 ON line.pt_type = dic6.id
where line.state = 1
<if test="subAreaIds!=null and subAreaIds.size!=0">
and line.Sub_Area_Id in
<foreach collection="subAreaIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="type!=null and type!=''">
and line.type = #{type}
</if>
<if test="lineStatus!=null and type!=''">
and dev.dev_status = #{lineStatus}
</if>
</if>
</select>
</mapper>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvLvUserMapper">
<select id="getPvLvUserList" resultType="PvLvUserVO">
SELECT
lv.id,
dic.NAME scaleName,
lv.scale,
lv.NAME,
lv.User_Code,
lv.User_Capacity,
lv.Complain,
lv.Complain_Part,
lv.Corrective,
lv.Dev_Govern,
lv.Govern_Type,
lv.Govern_Capacity
FROM
pv_lv_user lv
LEFT JOIN sys_dict_data dic ON lv.scale = dic.id
<where>
<if test="lvUserQueryParam.searchValue!=null and lvUserQueryParam.searchValue!=''">
and lv.name like CONCAT('%',#{lvUserQueryParam.searchValue},'%')
</if>
<if test="lvUserQueryParam.scale!=null and lvUserQueryParam.scale.size > 0">
and lv.scale in
<foreach collection="lvUserQueryParam.scale" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and lv.state = 1
</where>
order by lv.create_time asc
</select>
</mapper>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvSubAreaMapper">
<select id="getPvSubAreaList" resultType="PvSubAreaVO">
SELECT
sub.id,
sub.unit_id,
dept.name unitName,
sub.ten_Voltage_Id,
ten.NAME tenVoltageName,
sub.NAME,
sub.Code,
sub.Cable_Length,
sub.Resistance,
sub.Reactance,
sub.Type,
sub.Capacity,
sub.Regulation_Mode,
sub.React_Capacity,
sub.Dev_Fusion,
sub.pv,
sub.Total_C,
sub.Pv_Users,
sub.Power_Power
FROM
pv_sub_area sub
INNER JOIN sys_dept dept ON sub.unit_id = dept.id
INNER JOIN pv_ten_voltage ten ON ten.id = sub.Ten_Voltage_Id
<where>
<if test="subsAreaQueryParam.searchValue!=null and subsAreaQueryParam.searchValue!=''">
and sub.name like CONCAT('%',#{subsAreaQueryParam.searchValue},'%')
</if>
<if test="subsAreaQueryParam.unitId!=null and subsAreaQueryParam.unitId.size > 0">
and sub.unit_id in
<foreach collection="subsAreaQueryParam.unitId" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="subsAreaQueryParam.tenVoltageId!=null and subsAreaQueryParam.tenVoltageId.size > 0">
and sub.Ten_Voltage_Id in
<foreach collection="subsAreaQueryParam.tenVoltageId" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
order by ten.create_time asc
</select>
<select id="getSubAreaTreeList" resultType="com.njcn.user.pojo.vo.PvTerminalTreeVO">
select id,name,unit_id pid,2 as level from pv_sub_area where state = 1
</select>
<select id="pvDisOrLv" resultType="DisOrLvVO">
</select>
</mapper>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvSubstationMapper">
<select id="getPvSubstationList" resultType="PvSubstationVO">
SELECT
sub.id,
sub.unit_id,
dept.NAME unitName,
dic.NAME scaleName,
sub.scale,
sub.sub_code,
sub.NAME,
sub.Total_Capacity,
sub.Team_Code
FROM
pv_substation sub
LEFT JOIN sys_dict_data dic ON sub.scale = dic.id
LEFT JOIN sys_dept dept ON sub.unit_id = dept.id
<where>
<if test="substationQueryParam.searchValue!=null and substationQueryParam.searchValue!=''">
and sub.name like CONCAT('%',#{substationQueryParam.searchValue},'%')
</if>
<if test="substationQueryParam.unitId!=null and substationQueryParam.unitId.size > 0">
and sub.unit_id in
<foreach collection="substationQueryParam.unitId" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="substationQueryParam.scale!=null and substationQueryParam.scale.size > 0">
and sub.scale in
<foreach collection="substationQueryParam.scale" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="substationQueryParam.sortBy!=null and substationQueryParam.sortBy!='' and substationQueryParam.orderBy!=null and substationQueryParam.orderBy!=''">
order by concat(#{substationQueryParam.sortBy},' ',#{substationQueryParam.orderBy})
</if>
</where>
</select>
<select id="getSubstationTreeList" resultType="com.njcn.user.pojo.vo.PvTerminalTreeVO">
select id,unit_id pid,name,1 as level from pv_substation
</select>
</mapper>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvTenVoltageMapper">
<select id="getPvTenVoltageList" resultType="PvTenVoltageVO">
SELECT
ten.id,
dic.NAME scaleName,
ten.scale,
dic2.NAME designScaleName,
ten.design_scale,
ten.NAME,
ten.dispatch_Id,
ten.code,
ten.Cr_Type,
ten.Dev_Status,
ten.Earthing,
ten.Quality,
ten.Master_Stroke,
ten.Major,
ten.Master,
ten.Start_Station,
ten.End_Station,
ten.Run_Load,
ten.Output_Power,
ten.Max_Current,
ten.Put_Into_Date,
ten.pv_Status,
ten.pv_Capacity,
ten.pv_Num
FROM
pv_ten_voltage ten
LEFT JOIN sys_dict_data dic ON ten.scale = dic.id
LEFT JOIN sys_dict_data dic2 ON ten.Design_Scale = dic2.id
<where>
<if test="tenVoltageQueryParam.pvStatus != null">
and ten.pv_status = #{tenVoltageQueryParam.pvStatus}
</if>
<if test="tenVoltageQueryParam.searchValue !=null and tenVoltageQueryParam.searchValue!=''">
and ten.name like CONCAT('%',#{tenVoltageQueryParam.searchValue},'%')
or ten.code like CONCAT('%',#{tenVoltageQueryParam.searchValue},'%')
</if>
<if test="tenVoltageQueryParam.scale!=null and tenVoltageQueryParam.scale.size > 0">
and ten.scale in
<foreach collection="tenVoltageQueryParam.scale" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="tenVoltageQueryParam.designScale!=null and tenVoltageQueryParam.designScale.size > 0">
and ten.design_Scale in
<foreach collection="tenVoltageQueryParam.designScale" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
order by ten.create_time asc
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvUnitMapper">
<select id="getPvUnitList" resultType="UnitTreeVO">
select * from pv_unit
<if test="orderBy!=null and orderBy!='' and sortBy!=null and sortBy!=''">
order by concat(#{sortBy},' ',#{orderBy})
</if>
</select>
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.PvVoltageMapper">
</mapper>

View File

@@ -0,0 +1,24 @@
package com.njcn.device.pms.service;
import com.njcn.device.pms.pojo.bo.DeviceRunExBO;
import com.njcn.device.pms.pojo.dto.DeviceRunExDTO;
import java.util.List;
/**
* 终端异常服务类
*
* @author yangj
* @date 2022/09/08
*/
public interface IPvDeviceRunExService {
/**
* 分页条件查询终端异常列表信息
* @param deviceRunExDTO 终端条件查询dto
* @return List<DeviceRunExBO>
*/
List<DeviceRunExBO> getPvDeviceExList(DeviceRunExDTO deviceRunExDTO);
}

View File

@@ -0,0 +1,72 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.DeviceQueryParam;
import com.njcn.device.pms.pojo.param.PvDeviceParam;
import com.njcn.device.pms.pojo.po.PvDevice;
import com.njcn.device.pms.pojo.vo.PvDeviceVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvDeviceService extends IService<PvDevice> {
/**
* 新增分布式台账
* @param pvDeviceParam 分布式台账实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addDevice(PvDeviceParam pvDeviceParam);
/**
* 修改分布式台账
* @param updatePvDeviceParam 分布式台账实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateDevice(PvDeviceParam.UpdatePvDeviceParam updatePvDeviceParam);
/**
* 分页查询分布式台账
* @param deviceQueryParam 分布式台账实体
* @author cdf
* @date 2022/7/5
* @return Page<PvDevice>
*/
Page<PvDeviceVO> getPvDeviceList(DeviceQueryParam deviceQueryParam);
List<PvDeviceVO> getAllPvDeviceList();
/**
* 根据分布式台账id查询分布式台账
* @param id 分布式台账id
* @author cdf
* @date 2022/7/5
* @return PvDevice
*/
PvDevice getPvDeviceById(String id);
/**
* 删除分布式台账
* @param ids 分布式台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvDevice(List<String> ids);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.po.PvDispatch;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvDispatchService extends IService<PvDispatch> {
}

View File

@@ -0,0 +1,74 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.DistributedQueryParam;
import com.njcn.device.pms.pojo.param.PvDistributedParam;
import com.njcn.device.pms.pojo.po.PvDistributed;
import com.njcn.device.pms.pojo.vo.PvDistributedVO;
import java.util.List;
/**
* <p>
* 分布式服务类
* </p>
*
* @author cdf
* @since 2022-07-06
*/
public interface IPvDistributedService extends IService<PvDistributed> {
/**
* 新增分布式台账
* @param pvDistributedParam 分布式台账实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addDistributed(PvDistributedParam pvDistributedParam);
/**
* 修改分布式台账
* @param updatePvDistributedParam 分布式台账实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateDistributed(PvDistributedParam.UpdatePvDistributedParam updatePvDistributedParam);
/**
* 分页查询分布式台账
* @param distributedQueryParam 分布式台账实体
* @author cdf
* @date 2022/7/5
* @return Page<PvDistributed>
*/
Page<PvDistributedVO> getPvDistributedList(DistributedQueryParam distributedQueryParam);
List<PvDistributed> getAllPvDistributedList();
/**
* 根据分布式台账id查询分布式台账
* @param id 分布式台账id
* @author cdf
* @date 2022/7/5
* @return PvDistributed
*/
PvDistributed getPvDistributedById(String id);
/**
* 删除分布式台账
* @param ids 分布式台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvDistributed(List<String> ids);
}

View File

@@ -0,0 +1,85 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.LineDetailQueryParam;
import com.njcn.device.pms.pojo.param.PvLineDetailParam;
import com.njcn.device.pms.pojo.po.PvLineDetail;
import com.njcn.device.pms.pojo.vo.PvLineAllDetailVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvLineDetailService extends IService<PvLineDetail> {
/**
* 新增监测点
* @param pvLineDetailParam 监测点实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addLineDetail(PvLineDetailParam pvLineDetailParam);
/**
* 修改监测点
* @param updatePvLineDetailParam 监测点实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam);
/**
* 分页查询监测点
* @param lineDetailQueryParam 监测点实体
* @author cdf
* @date 2022/7/5
* @return Page<PvLineDetail>
*/
Page<PvLineDetail> getPvLineDetailList(LineDetailQueryParam lineDetailQueryParam);
List<PvLineDetail> getAllPvLineDetailList();
/**
* 根据监测点id查询监测点
* @param id 监测点id
* @author cdf
* @date 2022/7/5
* @return PvLineDetail
*/
PvLineDetail getPvLineDetailById(String id);
/**
* 删除监测点
* @param ids 监测点id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvLineDetail(List<String> ids);
/**
* 分页查询监测点
* @param subIds 变电站ids
* @param subAreaIds 台区ids
* @author cdf
* @date 2022/7/5
* @return Page<PvLineDetail>
*/
Page<PvLineAllDetailVO> getPvLineAllDetailMain(Integer pageNum,Integer pageSize,List<String> subIds, List<String> subAreaIds,String type,Integer lineStatus);
}

View File

@@ -0,0 +1,71 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.LvUserQueryParam;
import com.njcn.device.pms.pojo.param.PvLvUserParam;
import com.njcn.device.pms.pojo.po.PvLvUser;
import com.njcn.device.pms.pojo.vo.PvLvUserVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvLvUserService extends IService<PvLvUser> {
/**
* 新增分低压用户台账
* @param pvLvUserParam 分低压用户台账实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addLvUser(PvLvUserParam pvLvUserParam);
/**
* 修改分低压用户台账
* @param updatePvLvUserParam 分低压用户台账实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateLvUser(PvLvUserParam.UpdatePvLvUserParam updatePvLvUserParam);
/**
* 分页查询分低压用户台账
* @param lvUserQueryParam 分低压用户台账实体
* @author cdf
* @date 2022/7/5
* @return Page<PvLvUser>
*/
Page<PvLvUserVO> getPvLvUserList(LvUserQueryParam lvUserQueryParam);
List<PvLvUser> getAllPvLvUserList();
/**
* 根据分低压用户台账id查询分低压用户台账
* @param id 分低压用户台账id
* @author cdf
* @date 2022/7/5
* @return PvLvUser
*/
PvLvUser getPvLvUserById(String id);
/**
* 删除分低压用户台账
* @param ids 分低压用户台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvLvUser(List<String> ids);
}

View File

@@ -0,0 +1,71 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PvSubAreaParam;
import com.njcn.device.pms.pojo.param.SubAreaQueryParam;
import com.njcn.device.pms.pojo.po.PvSubArea;
import com.njcn.device.pms.pojo.vo.PvSubAreaVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvSubAreaService extends IService<PvSubArea> {
/**
* 新增台区
* @param pvSubAreaParam 台区实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addSubArea(PvSubAreaParam pvSubAreaParam);
/**
* 修改台区
* @param updatePvSubAreaParam 台区实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateSubArea(PvSubAreaParam.UpdatePvSubAreaParam updatePvSubAreaParam);
/**
* 分页查询台区
* @param subAreaQueryParam 台区实体
* @author cdf
* @date 2022/7/5
* @return Page<PvSubArea>
*/
Page<PvSubAreaVO> getPvSubAreaList(SubAreaQueryParam subAreaQueryParam);
List<PvSubArea> getAllPvSubAreaList();
/**
* 根据台区id查询台区
* @param id 台区id
* @author cdf
* @date 2022/7/5
* @return PvSubArea
*/
PvSubArea getPvSubAreaById(String id);
/**
* 删除台区
* @param ids 台区id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvSubArea(List<String> ids);
}

View File

@@ -0,0 +1,71 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PvSubstationParam;
import com.njcn.device.pms.pojo.param.SubstationQueryParam;
import com.njcn.device.pms.pojo.po.PvSubstation;
import com.njcn.device.pms.pojo.vo.PvSubstationVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvSubstationService extends IService<PvSubstation> {
/**
* 新增变电站
* @param pvSubstationParam 变电站实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addSubstation(PvSubstationParam pvSubstationParam);
/**
* 修改变电站
* @param updatePvSubstationParam 变电站实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateSubstation(PvSubstationParam.UpdatePvSubstationParam updatePvSubstationParam);
/**
* 分页查询变电站
* @param substationQueryParam 变电站实体
* @author cdf
* @date 2022/7/5
* @return Page<PvSubstation>
*/
Page<PvSubstationVO> getPvSubstationList(SubstationQueryParam substationQueryParam);
List<PvSubstation> getAllPvSubstationList();
/**
* 根据变电站id查询变电站
* @param id 变电站id
* @author cdf
* @date 2022/7/5
* @return PvSubstation
*/
PvSubstation getPvSubstationById(String id);
/**
* 删除变电站
* @param ids 变电站id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvSubstation(List<String> ids);
}

View File

@@ -0,0 +1,78 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PvTenVoltageParam;
import com.njcn.device.pms.pojo.param.TenVoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvTenVoltage;
import com.njcn.device.pms.pojo.vo.PvTenVoltageVO;
import java.util.List;
/**
* <p>
* 十千伏线路服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvTenVoltageService extends IService<PvTenVoltage> {
/**
* 新增10kV线路
* @param pvTenVoltageParam 10kV线路实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addTenVoltage(PvTenVoltageParam pvTenVoltageParam);
/**
* 修改10kV线路
* @param updatePvTenVoltageParam 10kV线路实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateTenVoltage(PvTenVoltageParam.UpdatePvTenVoltageParam updatePvTenVoltageParam);
/**
* 分页查询10kV线路
* @param tenVoltageQueryParam 10kV线路实体
* @author cdf
* @date 2022/7/5
* @return Page<PvTenVoltage>
*/
Page<PvTenVoltageVO> getPvTenVoltageList(TenVoltageQueryParam tenVoltageQueryParam);
/**
* 分页查询10kV线路
* @author cdf
* @date 2022/7/5
* @return List<PvTenVoltage>
*/
List<PvTenVoltage> getAllPvTenVoltageList();
/**
* 根据10kV线路id查询10kV线路
* @param id 10kV线路id
* @author cdf
* @date 2022/7/5
* @return PvTenVoltage
*/
PvTenVoltage getPvTenVoltageById(String id);
/**
* 删除10kV线路
* @param ids 10kV线路id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvTenVoltage(List<String> ids);
}

View File

@@ -0,0 +1,70 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PvUnitParam;
import com.njcn.device.pms.pojo.po.PvUnit;
import com.njcn.device.pms.pojo.vo.UnitTreeVO;
import com.njcn.web.pojo.param.BaseParam;
import java.util.List;
/**
* <p>
* 单位服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvUnitService extends IService<PvUnit> {
/**
* 新增单位
* @param pvUnitParam 单位实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addUnit(PvUnitParam pvUnitParam);
/**
* 修改单位
* @param updatePvUnitParam 单位实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateUnit(PvUnitParam.UpdatePvUnitParam updatePvUnitParam);
/**
* 查询树形结构单位
* @param baseParam 单位实体
* @author cdf
* @date 2022/7/5
* @return Page<PvUnit>
*/
List<UnitTreeVO> getPvUnitList(BaseParam baseParam);
/**
* 根据单位id查询单位
* @param id 单位id
* @author cdf
* @date 2022/7/5
* @return PvUnit
*/
PvUnit getPvUnitById(String id);
/**
* 删除单位
* @param id 单位id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvUnit(String id);
}

View File

@@ -0,0 +1,70 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pms.pojo.param.PvVoltageParam;
import com.njcn.device.pms.pojo.param.VoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvVoltage;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface IPvVoltageService extends IService<PvVoltage> {
/**
* 新增母线
* @param pvVoltageParam 母线实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean addVoltage(PvVoltageParam pvVoltageParam);
/**
* 修改母线
* @param updatePvVoltageParam 母线实体
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean updateVoltage(PvVoltageParam.UpdatePvVoltageParam updatePvVoltageParam);
/**
* 分页查询母线
* @param voltageQueryParam 母线实体
* @author cdf
* @date 2022/7/5
* @return Page<PvVoltage>
*/
Page<PvVoltage> getPvVoltageList(VoltageQueryParam voltageQueryParam);
List<PvVoltage> getAllPvVoltageList();
/**
* 根据母线id查询母线
* @param id 母线id
* @author cdf
* @date 2022/7/5
* @return PvVoltage
*/
PvVoltage getPvVoltageById(String id);
/**
* 删除母线
* @param id 母线id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvVoltage(String id);
}

View File

@@ -0,0 +1,41 @@
package com.njcn.device.pms.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.PvTerminalBaseQuery;
import com.njcn.device.pms.pojo.vo.DisOrLvVO;
import com.njcn.device.pms.pojo.vo.PvLineAllDetailVO;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import java.util.List;
/**
* pqs
*
* @author cdf
* @date 2022/7/11
*/
public interface PvTerminalBaseService {
/**
* 获取设备树
* @author cdf
* @date 2022/7/11
*/
List<PvTerminalTreeVO> pvTerminalTree();
/**
* 点击变电站台区展示监测点详情
* @author cdf
* @date 2022/7/11
*/
Page<PvLineAllDetailVO> lineDetailBySubId(PvTerminalBaseQuery pvTerminalBaseQuery);
/**
*
* @author cdf
* @date 2022/7/28
*/
DisOrLvVO pvDisOrLv(String userCode,Integer userCodeType);
}

View File

@@ -0,0 +1,106 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njcn.device.pms.pojo.bo.DeviceRunExBO;
import com.njcn.device.pms.pojo.dto.DeviceRunExDTO;
import com.njcn.device.pms.pojo.vo.DeviceRunExVO;
import com.njcn.influxdb.param.InfluxDBPublicParam;
import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.device.pms.mapper.PvDeviceRunExMapper;
import com.njcn.device.pms.service.IPvDeviceRunExService;
import lombok.RequiredArgsConstructor;
import org.influxdb.dto.QueryResult;
import org.influxdb.impl.InfluxDBResultMapper;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 终端异常实现类
*
* @author yangj
* @date 2022/09/08
*/
@Service
@RequiredArgsConstructor
public class PvDeviceRunExServiceImpl implements IPvDeviceRunExService {
private final PvDeviceRunExMapper deviceRunExMapper;
private final InfluxDbUtils influxDbUtils;
@Override
public List<DeviceRunExBO> getPvDeviceExList(DeviceRunExDTO deviceRunExDTO) {
List<DeviceRunExBO> pqLineInfos = deviceRunExMapper.findPQLineInfo(deviceRunExDTO.getLineLevel(), "0");
if (CollectionUtil.isEmpty(pqLineInfos)) {
return null;
}
List<DeviceRunExVO> topDeviceExList = getTopDeviceExList(deviceRunExDTO);
if (CollectionUtil.isEmpty(topDeviceExList)) {
return pqLineInfos;
}
List<DeviceRunExVO> topDevices = new ArrayList<>();
Map<String, List<DeviceRunExVO>> map = topDeviceExList.parallelStream().collect(Collectors.groupingBy(DeviceRunExVO::getDevId));
map.forEach((k, v) -> {
DeviceRunExVO deviceRunExVO = map.get(k).parallelStream().reduce((t1, t2) -> {
t1.setAlarmNum(t1.getAlarmNum() + t2.getAlarmNum());
t1.setComOutNum(t1.getComOutNum() + t2.getComOutNum());
t1.setFlowNum(t1.getFlowNum() + t2.getFlowNum());
return t1;
}).orElse(null);
if (ObjectUtil.isNotNull(deviceRunExVO)) {
topDevices.add(deviceRunExVO);
}
});
getPvDevices(pqLineInfos, topDevices);
return pqLineInfos;
}
/**
* 导入influx统计数据
*
* @param deviceRunExBoS 展示数据
* @param deviceRunExVoS influx统计数据
*/
public void getPvDevices(List<DeviceRunExBO> deviceRunExBoS, List<DeviceRunExVO> deviceRunExVoS) {
for (DeviceRunExBO deviceRunExBO : deviceRunExBoS) {
if (CollectionUtil.isNotEmpty(deviceRunExBO.getChildren())) {
getPvDevices(deviceRunExBO.getChildren(), deviceRunExVoS);
}
deviceRunExVoS.parallelStream().forEach(deviceRunExVO -> {
if (deviceRunExBO.getId().equals(deviceRunExVO.getDevId())) {
BeanUtil.copyProperties(deviceRunExVO, deviceRunExBO);
}
});
}
}
/**
* @param deviceRunExDTO 终端运行异常dto
* @return List<DeviceRunExVO>
*/
private List<DeviceRunExVO> getTopDeviceExList(DeviceRunExDTO deviceRunExDTO) {
//组装sql语句
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append(InfluxDBPublicParam.TIME + " >= '")
.append(deviceRunExDTO.getStartTime())
.append("' and ")
.append(InfluxDBPublicParam.TIME)
.append(" <= '")
.append(deviceRunExDTO.getEndTime())
.append("'");
//sql语句
String sql = "SELECT * FROM pqs_top_msg WHERE " + sqlBuilder + InfluxDBPublicParam.TIME_ZONE;
QueryResult query = influxDbUtils.query(sql);
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
return resultMapper.toPOJO(query, DeviceRunExVO.class);
}
}

View File

@@ -0,0 +1,143 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.device.pms.pojo.param.DeviceQueryParam;
import com.njcn.device.pms.pojo.param.PvDeviceParam;
import com.njcn.device.pms.pojo.po.PvDevice;
import com.njcn.device.pms.pojo.vo.PvDeviceVO;
import com.njcn.device.pms.mapper.PvDeviceMapper;
import com.njcn.device.pms.service.IPvDeviceService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 终端台账实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvDeviceServiceImpl extends ServiceImpl<PvDeviceMapper, PvDevice> implements IPvDeviceService {
private final DicDataFeignClient dicDataFeignClient;
@Override
public boolean addDevice(PvDeviceParam pvDeviceParam) {
checkNameAndParam(pvDeviceParam, false);
PvDevice pvDevice = new PvDevice();
BeanUtils.copyProperties(pvDeviceParam, pvDevice);
pvDevice.setState(DataStateEnum.ENABLE.getCode());
pvDevice.setThisTimeCheck(PubUtils.localDateFormat(pvDeviceParam.getThisTimeCheck()));
pvDevice.setNextTimeCheck(PubUtils.localDateFormat(pvDeviceParam.getNextTimeCheck()));
return this.save(pvDevice);
}
@Override
public boolean updateDevice(PvDeviceParam.UpdatePvDeviceParam updatePvDeviceParam) {
checkNameAndParam(updatePvDeviceParam, true);
PvDevice pvDevice = new PvDevice();
BeanUtils.copyProperties(updatePvDeviceParam, pvDevice);
pvDevice.setState(DataStateEnum.ENABLE.getCode());
pvDevice.setThisTimeCheck(PubUtils.localDateFormat(updatePvDeviceParam.getThisTimeCheck()));
pvDevice.setNextTimeCheck(PubUtils.localDateFormat(updatePvDeviceParam.getNextTimeCheck()));
return this.updateById(pvDevice);
}
@Override
public Page<PvDeviceVO> getPvDeviceList(DeviceQueryParam subsAreaQueryParam) {
Page<PvDeviceVO> page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam), PageFactory.getPageSize(subsAreaQueryParam));
return this.baseMapper.getPvDeviceList(page,subsAreaQueryParam);
}
@Override
public List<PvDeviceVO> getAllPvDeviceList() {
return this.baseMapper.getAllPvDeviceList();
}
@Override
public PvDevice getPvDeviceById(String id) {
return this.getById(id);
}
@Override
public boolean delPvDevice(List<String> ids) {
return this.removeByIds(ids);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvDeviceParam pvDeviceParam, boolean isUpdate) {
LambdaQueryWrapper<PvDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvDevice::getName, pvDeviceParam.getName());
if (isUpdate) {
//更新操作
if (pvDeviceParam instanceof PvDeviceParam.UpdatePvDeviceParam) {
lambdaQueryWrapper.ne(PvDevice::getId, ((PvDeviceParam.UpdatePvDeviceParam) pvDeviceParam).getId());
}
}
int countName = this.count(lambdaQueryWrapper);
if (countName > 0) {
throw new BusinessException(PvDeviceResponseEnum.DVE_CODE_REPEAT);
}
lambdaQueryWrapper.clear();
lambdaQueryWrapper.eq(PvDevice::getDevCode, pvDeviceParam.getDevCode());
if (isUpdate) {
//更新操作
if (pvDeviceParam instanceof PvDeviceParam.UpdatePvDeviceParam) {
lambdaQueryWrapper.ne(PvDevice::getId, ((PvDeviceParam.UpdatePvDeviceParam) pvDeviceParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.DVE_CODE_REPEAT);
}
/*校验终端类型*/
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getType()).getData())) {
throw new BusinessException(SystemResponseEnum.DEV_VARIETY);
}
/*校验设备型号*/
if (StrUtil.isNotBlank(pvDeviceParam.getDevType())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getDevType()).getData())) {
throw new BusinessException(SystemResponseEnum.DEV_TYPE_EMPTY);
}
}
/*校验生产厂家*/
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getManufacturer()).getData())) {
throw new BusinessException(SystemResponseEnum.MANUFACTURER);
}
}
/**
* 校验参数是否违规
*/
private void checkParam(PvDeviceParam pvDeviceParam) {
}
}

View File

@@ -0,0 +1,20 @@
package com.njcn.device.pms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.pms.pojo.po.PvDispatch;
import com.njcn.device.pms.mapper.PvDispatchMapper;
import com.njcn.device.pms.service.IPvDispatchService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
public class PvDispatchServiceImpl extends ServiceImpl<PvDispatchMapper, PvDispatch> implements IPvDispatchService {
}

View File

@@ -0,0 +1,121 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.DistributedQueryParam;
import com.njcn.device.pms.pojo.param.PvDistributedParam;
import com.njcn.device.pms.pojo.po.PvDistributed;
import com.njcn.device.pms.pojo.vo.PvDistributedVO;
import com.njcn.device.pms.mapper.PvDistributedMapper;
import com.njcn.device.pms.service.IPvDistributedService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 服务实现类
* </p>
*
* @author cdf
* @since 2022-07-06
*/
@Service
@RequiredArgsConstructor
public class PvDistributedServiceImpl extends ServiceImpl<PvDistributedMapper, PvDistributed> implements IPvDistributedService {
private final DicDataFeignClient dicDataFeignClient;
@Override
public boolean addDistributed(PvDistributedParam pvDistributedParam) {
checkNameAndParam(pvDistributedParam,false);
PvDistributed pvDistributed = new PvDistributed();
BeanUtils.copyProperties(pvDistributedParam,pvDistributed);
pvDistributed.setState(DataStateEnum.ENABLE.getCode());
return this.save(pvDistributed);
}
@Override
public boolean updateDistributed(PvDistributedParam.UpdatePvDistributedParam updatePvDistributedParam) {
checkNameAndParam(updatePvDistributedParam,true);
PvDistributed pvDistributed = new PvDistributed();
BeanUtils.copyProperties(updatePvDistributedParam,pvDistributed);
pvDistributed.setState(DataStateEnum.ENABLE.getCode());
return this.updateById(pvDistributed);
}
@Override
public Page<PvDistributedVO> getPvDistributedList(DistributedQueryParam distributedQueryParam) {
Page<PvDistributedVO> page = new Page<>(PageFactory.getPageNum(distributedQueryParam),PageFactory.getPageSize(distributedQueryParam));
return this.baseMapper.getPvDistributedList(page,distributedQueryParam);
}
@Override
public List<PvDistributed> getAllPvDistributedList() {
return this.list();
}
@Override
public PvDistributed getPvDistributedById(String id) {
return this.getById(id);
}
@Override
public boolean delPvDistributed(List<String> ids) {
return this.removeByIds(ids);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvDistributedParam pvDistributedParam, boolean isUpdate) {
if(StrUtil.isNotBlank(pvDistributedParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDistributedParam.getScale()).getData())) {
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
}
LambdaQueryWrapper<PvDistributed> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvDistributed::getName, pvDistributedParam.getName());
if (isUpdate) {
//更新操作
if (pvDistributedParam instanceof PvDistributedParam.UpdatePvDistributedParam) {
lambdaQueryWrapper.ne(PvDistributed::getId, ((PvDistributedParam.UpdatePvDistributedParam) pvDistributedParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT);
}
lambdaQueryWrapper.clear();
lambdaQueryWrapper.eq(PvDistributed::getUserCode, pvDistributedParam.getUserCode());
if (isUpdate) {
//更新操作
if (pvDistributedParam instanceof PvDistributedParam.UpdatePvDistributedParam) {
lambdaQueryWrapper.ne(PvDistributed::getId, ((PvDistributedParam.UpdatePvDistributedParam) pvDistributedParam).getId());
}
}
int countUserCode = this.count(lambdaQueryWrapper);
if (countUserCode > 0) {
throw new BusinessException(PvDeviceResponseEnum.USER_CODE_REPEAT);
}
}
}

View File

@@ -0,0 +1,271 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.device.pms.service.*;
import com.njcn.device.pms.pojo.param.LineDetailQueryParam;
import com.njcn.device.pms.pojo.param.PvLineDetailParam;
import com.njcn.device.pms.pojo.po.PvDevice;
import com.njcn.device.pms.pojo.po.PvLineDetail;
import com.njcn.device.pms.pojo.vo.PvLineAllDetailVO;
import com.njcn.device.pms.mapper.PvLineDetailMapper;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 监测点实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvLineDetail> implements IPvLineDetailService {
private final DicDataFeignClient dicDataFeignClient;
private final IPvDeviceService iPvDeviceService;
private final IPvSubstationService iPvSubstationService;
private final IPvVoltageService iPvVoltageService;
private final IPvSubAreaService iPvSubAreaService;
@Override
public boolean addLineDetail(PvLineDetailParam pvLineDetailParam) {
checkNameAndParam(pvLineDetailParam);
//判断同一台装置是否出现监测点序号重复或超过x路序号
lineNumIsExit(pvLineDetailParam, false);
PvLineDetail pvLineDetail = commMonit(pvLineDetailParam);
return this.save(pvLineDetail);
}
@Override
public boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam) {
checkNameAndParam(updatePvLineDetailParam);
lineNumIsExit(updatePvLineDetailParam, true);
PvLineDetail pvLineDetail = commMonit(updatePvLineDetailParam);
return this.updateById(pvLineDetail);
}
/**
* 公共代码提取
*/
private PvLineDetail commMonit(PvLineDetailParam pvLineDetailParam) {
PvLineDetail pvLineDetail = new PvLineDetail();
BeanUtils.copyProperties(pvLineDetailParam, pvLineDetail);
pvLineDetail.setState(DataStateEnum.ENABLE.getCode());
if (StrUtil.isNotBlank(pvLineDetailParam.getAccess())) {
pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getAccess()));
}
if (StrUtil.isNotBlank(pvLineDetailParam.getPutIn())) {
pvLineDetail.setAccess(PubUtils.localDateFormat(pvLineDetailParam.getPutIn()));
}
return pvLineDetail;
}
/**
* 监测点序号是否重复判断
*
* @author cdf
* @date 2022/7/11
*/
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());
}
}
int count = this.count(query);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.DEV_NUM_NULL);
}
}
@Override
public Page<PvLineDetail> getPvLineDetailList(LineDetailQueryParam subsAreaQueryParam) {
Page<PvLineDetail> page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam), PageFactory.getPageSize(subsAreaQueryParam));
LambdaQueryWrapper<PvLineDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
return this.page(page, lambdaQueryWrapper);
}
@Override
public List<PvLineDetail> getAllPvLineDetailList() {
return this.list();
}
@Override
public PvLineDetail getPvLineDetailById(String id) {
return this.getById(id);
}
@Override
public boolean delPvLineDetail(List<String> ids) {
return this.removeByIds(ids);
}
@Override
public Page<PvLineAllDetailVO> getPvLineAllDetailMain(Integer pageNum, Integer pageSize, List<String> subIds, List<String> subAreaIds,String type,Integer lineStatus) {
Page<PvLineAllDetailVO> page = new Page<>(pageNum, pageSize);
return this.baseMapper.getPvLineAllDetailMain(page, subIds, subAreaIds,type,lineStatus);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvLineDetailParam pvLineDetailParam) {
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)) {
throw new BusinessException(SystemResponseEnum.LINE_TYPE_VARIETY_EMPTY);
}
/* if (!pvDevice.getType().equals(lineType.getId())) {
throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
}*/
/*监测点类型*/
if (DicDataEnum.ONE_LINE.getCode().equals(lineType.getCode())) {
/*校验变电站*/
if (StrUtil.isNotBlank(pvLineDetailParam.getSubstationId())) {
if (Objects.isNull(iPvSubstationService.getPvSubstationById(pvLineDetailParam.getSubstationId()))) {
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_NULL);
}
}else{
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_EMPTY);
}
//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_QUALITY.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_QUALITY.getCode().equals(devType.getCode())) {
throw new BusinessException(PvDeviceResponseEnum.LINE_DEVICE_NO_MATCH);
}
}
/*校验台区*/
if (StrUtil.isNotBlank(pvLineDetailParam.getSubAreaId())) {
if (Objects.isNull(iPvSubAreaService.getPvSubAreaById(pvLineDetailParam.getSubAreaId()))) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_NULL);
}
}
if (StrUtil.isNotBlank(pvLineDetailParam.getBusinessType())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getBusinessType()).getData())) {
throw new BusinessException(SystemResponseEnum.BUSINESS_EMPTY);
}
}
if (StrUtil.isNotBlank(pvLineDetailParam.getScale())) {
if (StrUtil.isNotBlank(pvLineDetailParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getScale()).getData())) {
throw new BusinessException(SystemResponseEnum.LINE_TYPE_VARIETY_EMPTY);
}
}
}
if (StrUtil.isNotBlank(pvLineDetailParam.getLoadType())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getLoadType()).getData())) {
throw new BusinessException(SystemResponseEnum.INTERFERENCE_EMPTY);
}
}
}
}

View File

@@ -0,0 +1,122 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.LvUserQueryParam;
import com.njcn.device.pms.pojo.param.PvLvUserParam;
import com.njcn.device.pms.pojo.po.PvLvUser;
import com.njcn.device.pms.pojo.vo.PvLvUserVO;
import com.njcn.device.pms.mapper.PvLvUserMapper;
import com.njcn.device.pms.service.IPvLvUserService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 分布式用户实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvLvUserServiceImpl extends ServiceImpl<PvLvUserMapper, PvLvUser> implements IPvLvUserService {
private final DicDataFeignClient dicDataFeignClient;
@Override
public boolean addLvUser(PvLvUserParam pvLvUserParam) {
checkNameAndParam(pvLvUserParam,false);
PvLvUser pvLvUser = new PvLvUser();
BeanUtils.copyProperties(pvLvUserParam,pvLvUser);
pvLvUser.setState(DataStateEnum.ENABLE.getCode());
return this.save(pvLvUser);
}
@Override
public boolean updateLvUser(PvLvUserParam.UpdatePvLvUserParam updatePvLvUserParam) {
checkNameAndParam(updatePvLvUserParam,true);
PvLvUser pvLvUser = new PvLvUser();
BeanUtils.copyProperties(updatePvLvUserParam,pvLvUser);
pvLvUser.setState(DataStateEnum.ENABLE.getCode());
return this.updateById(pvLvUser);
}
@Override
public Page<PvLvUserVO> getPvLvUserList(LvUserQueryParam lvUserQueryParam) {
Page<PvLvUserVO> page = new Page<>(PageFactory.getPageNum(lvUserQueryParam),PageFactory.getPageSize(lvUserQueryParam));
return this.baseMapper.getPvLvUserList(page,lvUserQueryParam);
}
@Override
public List<PvLvUser> getAllPvLvUserList() {
return this.list();
}
@Override
public PvLvUser getPvLvUserById(String id) {
return this.getById(id);
}
@Override
public boolean delPvLvUser(List<String> ids) {
return this.removeByIds(ids);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvLvUserParam pvLvUserParam, boolean isUpdate) {
if(StrUtil.isNotBlank(pvLvUserParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLvUserParam.getScale()).getData())) {
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
}
LambdaQueryWrapper<PvLvUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvLvUser::getName, pvLvUserParam.getName());
if (isUpdate) {
//更新操作
if (pvLvUserParam instanceof PvLvUserParam.UpdatePvLvUserParam) {
lambdaQueryWrapper.ne(PvLvUser::getId, ((PvLvUserParam.UpdatePvLvUserParam) pvLvUserParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.LV_USER_REPEAT);
}
lambdaQueryWrapper.clear();
lambdaQueryWrapper.eq(PvLvUser::getUserCode, pvLvUserParam.getUserCode());
if (isUpdate) {
//更新操作
if (pvLvUserParam instanceof PvLvUserParam.UpdatePvLvUserParam) {
lambdaQueryWrapper.ne(PvLvUser::getId, ((PvLvUserParam.UpdatePvLvUserParam) pvLvUserParam).getId());
}
}
int countUserCode = this.count(lambdaQueryWrapper);
if (countUserCode > 0) {
throw new BusinessException(PvDeviceResponseEnum.USER_CODE_REPEAT);
}
}
}

View File

@@ -0,0 +1,115 @@
package com.njcn.device.pms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.PvSubAreaParam;
import com.njcn.device.pms.pojo.param.SubAreaQueryParam;
import com.njcn.device.pms.pojo.po.PvSubArea;
import com.njcn.device.pms.pojo.vo.PvSubAreaVO;
import com.njcn.device.pms.mapper.PvSubAreaMapper;
import com.njcn.device.pms.service.IPvSubAreaService;
import com.njcn.device.pms.service.IPvTenVoltageService;
import com.njcn.device.pms.service.IPvUnitService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 服务实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvSubAreaServiceImpl extends ServiceImpl<PvSubAreaMapper, PvSubArea> implements IPvSubAreaService {
private final DicDataFeignClient dicDataFeignClient;
private final IPvTenVoltageService iPvTenVoltageService;
private final IPvUnitService iPvUnitService;
private final DeptFeignClient deptFeignClient;
@Override
public boolean addSubArea(PvSubAreaParam pvSubAreaParam) {
checkNameAndParam(pvSubAreaParam,false);
PvSubArea pvSubArea = new PvSubArea();
BeanUtils.copyProperties(pvSubAreaParam,pvSubArea);
pvSubArea.setState(DataStateEnum.ENABLE.getCode());
return this.save(pvSubArea);
}
@Override
public boolean updateSubArea(PvSubAreaParam.UpdatePvSubAreaParam updatePvSubAreaParam) {
checkNameAndParam(updatePvSubAreaParam,true);
PvSubArea pvSubArea = new PvSubArea();
BeanUtils.copyProperties(updatePvSubAreaParam,pvSubArea);
pvSubArea.setState(DataStateEnum.ENABLE.getCode());
return this.updateById(pvSubArea);
}
@Override
public Page<PvSubAreaVO> getPvSubAreaList(SubAreaQueryParam subsAreaQueryParam) {
Page<PvSubAreaVO> page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam),PageFactory.getPageSize(subsAreaQueryParam));
return this.baseMapper.getPvSubAreaList(page,subsAreaQueryParam);
}
@Override
public List<PvSubArea> getAllPvSubAreaList() {
return this.list();
}
@Override
public PvSubArea getPvSubAreaById(String id) {
return this.getById(id);
}
@Override
public boolean delPvSubArea(List<String> ids) {
return this.removeByIds(ids);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvSubAreaParam pvSubAreaParam, boolean isUpdate) {
if(Objects.isNull(iPvTenVoltageService.getPvTenVoltageById(pvSubAreaParam.getTenVoltageId()))){
throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_NULL);
}
if(Objects.isNull(deptFeignClient.getDeptById(pvSubAreaParam.getUnitId()))){
throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL);
}
LambdaQueryWrapper<PvSubArea> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvSubArea::getName, pvSubAreaParam.getName());
if (isUpdate) {
//更新操作
if (pvSubAreaParam instanceof PvSubAreaParam.UpdatePvSubAreaParam) {
lambdaQueryWrapper.ne(PvSubArea::getId, ((PvSubAreaParam.UpdatePvSubAreaParam) pvSubAreaParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT);
}
}
}

View File

@@ -0,0 +1,138 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.PvSubstationParam;
import com.njcn.device.pms.pojo.param.SubstationQueryParam;
import com.njcn.device.pms.pojo.po.PvSubstation;
import com.njcn.device.pms.pojo.vo.PvSubstationVO;
import com.njcn.device.pms.mapper.PvSubstationMapper;
import com.njcn.device.pms.service.IPvSubstationService;
import com.njcn.device.pms.service.IPvUnitService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
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;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 变电站管理实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvSubstationServiceImpl extends ServiceImpl<PvSubstationMapper, PvSubstation> implements IPvSubstationService {
private final DicDataFeignClient dicDataFeignClient;
private final IPvUnitService iPvUnitService;
private final DeptFeignClient deptFeignClient;
@Override
public boolean addSubstation(PvSubstationParam pvSubstationParam) {
checkNameAndParam(pvSubstationParam,false);
PvSubstation pvSubstation = new PvSubstation();
BeanUtils.copyProperties(pvSubstationParam,pvSubstation);
return this.save(pvSubstation);
}
@Override
public boolean updateSubstation(PvSubstationParam.UpdatePvSubstationParam updatePvSubstationParam) {
checkNameAndParam(updatePvSubstationParam,true);
PvSubstation pvSubstation = new PvSubstation();
BeanUtils.copyProperties(updatePvSubstationParam,pvSubstation);
return this.updateById(pvSubstation);
}
@Override
public Page<PvSubstationVO> getPvSubstationList(SubstationQueryParam substationQueryParam) {
Page<PvSubstation> page = new Page<>(PageFactory.getPageNum(substationQueryParam),PageFactory.getPageSize(substationQueryParam));
if(CollUtil.isNotEmpty(substationQueryParam.getUnitId())){
List<String> tem = deptFeignClient.getDepSonIdtByDeptId(substationQueryParam.getUnitId().get(0)).getData();
tem.add(substationQueryParam.getUnitId().get(0));
substationQueryParam.setUnitId(tem);
}
return this.baseMapper.getPvSubstationList(page,substationQueryParam);
}
@Override
public List<PvSubstation> getAllPvSubstationList() {
return this.list();
}
@Override
public PvSubstation getPvSubstationById(String id) {
return this.getById(id);
}
@Override
public boolean delPvSubstation(List<String> ids) {
return this.removeByIds(ids);
}
/**
* 校验单位名称是否重复
*
* @author cdf
* @date 2022/7/5
*/
private void checkNameAndParam(PvSubstationParam pvSubstationParam, boolean isUpdate) {
LambdaQueryWrapper<PvSubstation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvSubstation::getName, pvSubstationParam.getName());
if (isUpdate) {
//更新操作
if (pvSubstationParam instanceof PvSubstationParam.UpdatePvSubstationParam) {
lambdaQueryWrapper.ne(PvSubstation::getId, ((PvSubstationParam.UpdatePvSubstationParam) pvSubstationParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_REPEAT);
}
lambdaQueryWrapper.clear();
lambdaQueryWrapper.eq(PvSubstation::getSubCode, pvSubstationParam.getSubCode());
if (isUpdate) {
//更新操作
if (pvSubstationParam instanceof PvSubstationParam.UpdatePvSubstationParam) {
lambdaQueryWrapper.ne(PvSubstation::getId, ((PvSubstationParam.UpdatePvSubstationParam) pvSubstationParam).getId());
}
}
int countCode = this.count(lambdaQueryWrapper);
if (countCode > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_CODE_REPEAT);
}
DictData dictData = dicDataFeignClient.getDicDataById(pvSubstationParam.getScale()).getData();
if(Objects.isNull(dictData)){
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
if(Objects.isNull(deptFeignClient.getDeptById(pvSubstationParam.getUnitId()))){
throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL);
}
}
}

View File

@@ -0,0 +1,120 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.PvTenVoltageParam;
import com.njcn.device.pms.pojo.param.TenVoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvTenVoltage;
import com.njcn.device.pms.pojo.vo.PvTenVoltageVO;
import com.njcn.device.pms.mapper.PvTenVoltageMapper;
import com.njcn.device.pms.service.IPvTenVoltageService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 服务实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvTenVoltageServiceImpl extends ServiceImpl<PvTenVoltageMapper, PvTenVoltage> implements IPvTenVoltageService {
private final DicDataFeignClient dicDataFeignClient;
@Override
public boolean addTenVoltage(PvTenVoltageParam pvTenVoltageParam) {
checkNameAndParam(pvTenVoltageParam,false);
PvTenVoltage pvTenVoltage = new PvTenVoltage();
BeanUtils.copyProperties(pvTenVoltageParam,pvTenVoltage);
pvTenVoltage.setState(DataStateEnum.ENABLE.getCode());
return this.save(pvTenVoltage);
}
@Override
public boolean updateTenVoltage(PvTenVoltageParam.UpdatePvTenVoltageParam updatePvTenVoltageParam) {
checkNameAndParam(updatePvTenVoltageParam,true);
PvTenVoltage pvTenVoltage = new PvTenVoltage();
BeanUtils.copyProperties(updatePvTenVoltageParam,pvTenVoltage);
pvTenVoltage.setState(DataStateEnum.ENABLE.getCode());
return this.updateById(pvTenVoltage);
}
@Override
public Page<PvTenVoltageVO> getPvTenVoltageList(TenVoltageQueryParam tenVoltageQueryParam) {
Page<PvTenVoltageVO> page = new Page<>(PageFactory.getPageNum(tenVoltageQueryParam),PageFactory.getPageSize(tenVoltageQueryParam));
return this.baseMapper.getPvTenVoltageList(page,tenVoltageQueryParam);
}
@Override
public List<PvTenVoltage> getAllPvTenVoltageList(){
return this.list();
}
@Override
public PvTenVoltage getPvTenVoltageById(String id) {
return this.getById(id);
}
@Override
public boolean delPvTenVoltage(List<String> ids) {
return this.removeByIds(ids);
}
/**
* 校验单位名称是否重复
*
* @author cdf
* @date 2022/7/5
*/
private void checkNameAndParam(PvTenVoltageParam pvTenVoltageParam, boolean isUpdate) {
if(StrUtil.isNotBlank(pvTenVoltageParam.getScale())) {
DictData dictData = dicDataFeignClient.getDicDataById(pvTenVoltageParam.getScale()).getData();
if (Objects.isNull(dictData)) {
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
}
if(StrUtil.isNotBlank(pvTenVoltageParam.getDesignScale())) {
DictData dictDesignScale = dicDataFeignClient.getDicDataById(pvTenVoltageParam.getDesignScale()).getData();
if (Objects.isNull(dictDesignScale)) {
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
}
LambdaQueryWrapper<PvTenVoltage> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvTenVoltage::getName, pvTenVoltageParam.getName());
if (isUpdate) {
//更新操作
if (pvTenVoltageParam instanceof PvTenVoltageParam.UpdatePvTenVoltageParam) {
lambdaQueryWrapper.ne(PvTenVoltage::getId, ((PvTenVoltageParam.UpdatePvTenVoltageParam) pvTenVoltageParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_REPEAT);
}
}
}

View File

@@ -0,0 +1,139 @@
package com.njcn.device.pms.service.impl;
import cn.hutool.core.collection.CollUtil;
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.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.mapper.PvDistributedMapper;
import com.njcn.device.pms.mapper.PvLvUserMapper;
import com.njcn.device.pms.mapper.PvSubAreaMapper;
import com.njcn.device.pms.mapper.PvSubstationMapper;
import com.njcn.device.pms.service.IPvLineDetailService;
import com.njcn.device.pms.service.IPvSubAreaService;
import com.njcn.device.pms.service.IPvSubstationService;
import com.njcn.device.pms.service.PvTerminalBaseService;
import com.njcn.device.pms.pojo.param.PvTerminalBaseQuery;
import com.njcn.device.pms.pojo.po.PvDistributed;
import com.njcn.device.pms.pojo.po.PvLvUser;
import com.njcn.device.pms.pojo.po.PvSubArea;
import com.njcn.device.pms.pojo.po.PvSubstation;
import com.njcn.device.pms.pojo.vo.DisOrLvVO;
import com.njcn.device.pms.pojo.vo.PvLineAllDetailVO;
import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* pqs
*
* @author cdf
* @date 2022/7/11
*/
@Service
@RequiredArgsConstructor
public class PvTerminalBaseServiceImpl implements PvTerminalBaseService {
private final IPvSubstationService iPvSubstationService;
private final IPvSubAreaService iPvSubAreaService;
private final IPvLineDetailService iPvLineDetailService;
private final PvSubstationMapper pvSubstationMapper;
private final PvSubAreaMapper pvSubAreaMapper;
private final PvLvUserMapper pvLvUserMapper;
private final PvDistributedMapper pvDistributedMapper;
private final DeptFeignClient deptFeignClient;
@Override
public List<PvTerminalTreeVO> pvTerminalTree() {
List<PvTerminalTreeVO> unitTreeList = deptFeignClient.allDeptList().getData();
List<PvTerminalTreeVO> subTreeList = pvSubstationMapper.getSubstationTreeList();
List<PvTerminalTreeVO> subAreaTreeList = pvSubAreaMapper.getSubAreaTreeList();
unitTreeList.addAll(subTreeList);
unitTreeList.addAll(subAreaTreeList);
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) {
String id = pvTerminalBaseQuery.getId();
Integer level = pvTerminalBaseQuery.getLevel();
if(level.equals(LineBaseEnum.PV_UNIT_LEVEL.getCode())){
//点击的是单位节点
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(id).getData();
if(CollUtil.isEmpty(deptIds)){
deptIds.add(id);
}
LambdaQueryWrapper<PvSubstation> subQuery= new LambdaQueryWrapper<>();
subQuery.in(PvSubstation::getUnitId,deptIds);
List<PvSubstation> substationList = iPvSubstationService.list(subQuery);
List<String> subIds = substationList.stream().map(PvSubstation::getId).collect(Collectors.toList());
LambdaQueryWrapper<PvSubArea> areaQuery= new LambdaQueryWrapper<>();
areaQuery.in(PvSubArea::getUnitId,deptIds);
List<PvSubArea> subAreaList = iPvSubAreaService.list(areaQuery);
List<String> subAreaIds = subAreaList.stream().map(PvSubArea::getId).collect(Collectors.toList());
if(CollUtil.isEmpty(subAreaIds) && CollUtil.isEmpty(subIds)){
throw new BusinessException(PvDeviceResponseEnum.NO_SUB);
}
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),subIds,subAreaIds,pvTerminalBaseQuery.getType(),pvTerminalBaseQuery.getLineStatus());
}else if(level.equals(LineBaseEnum.PV_SUB_LEVEL.getCode())){
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery), Stream.of(pvTerminalBaseQuery.getId()).collect(Collectors.toList()), null,pvTerminalBaseQuery.getType(),pvTerminalBaseQuery.getLineStatus());
}else if(level.equals(LineBaseEnum.PV_SUB_AREA_LEVEL.getCode())){
return iPvLineDetailService.getPvLineAllDetailMain(PageFactory.getPageNum(pvTerminalBaseQuery),PageFactory.getPageSize(pvTerminalBaseQuery),null,Stream.of(pvTerminalBaseQuery.getId()).collect(Collectors.toList()),pvTerminalBaseQuery.getType(),pvTerminalBaseQuery.getLineStatus());
}
throw new BusinessException(CommonResponseEnum.FAIL);
}
@Override
public DisOrLvVO pvDisOrLv(String userCode, Integer userCodeType){
DisOrLvVO disOrLvVO = new DisOrLvVO();
if(userCodeType == 1){
//低压
LambdaQueryWrapper<PvLvUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvLvUser::getUserCode,userCode).eq(PvLvUser::getState, DataStateEnum.ENABLE.getCode());
PvLvUser pvLvUser = pvLvUserMapper.selectOne(lambdaQueryWrapper);
if(Objects.nonNull(pvLvUser)){
BeanUtils.copyProperties(pvLvUser,disOrLvVO);
}
}else {
//分布式
LambdaQueryWrapper<PvDistributed> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvDistributed::getUserCode,userCode).eq(PvDistributed::getState, DataStateEnum.ENABLE.getCode());
PvDistributed pvDistributed = pvDistributedMapper.selectOne(lambdaQueryWrapper);
if(Objects.nonNull(pvDistributed)){
BeanUtils.copyProperties(pvDistributed,disOrLvVO);
}
}
return disOrLvVO;
}
private List<PvTerminalTreeVO> getChildren(PvTerminalTreeVO tem, List<PvTerminalTreeVO> children) {
return children.stream().filter(item -> item.getPid().equals(tem.getId())).peek(t->t.setChildren(getChildren(t,children))).collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,108 @@
package com.njcn.device.pms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.PvUnitParam;
import com.njcn.device.pms.pojo.po.PvUnit;
import com.njcn.device.pms.pojo.vo.UnitTreeVO;
import com.njcn.device.pms.mapper.PvUnitMapper;
import com.njcn.device.pms.service.IPvUnitService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.pojo.param.BaseParam;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
public class PvUnitServiceImpl extends ServiceImpl<PvUnitMapper, PvUnit> implements IPvUnitService {
@Override
public boolean addUnit(PvUnitParam pvUnitParam) {
checkName(pvUnitParam, false);
PvUnit pvUnit = new PvUnit();
BeanUtils.copyProperties(pvUnitParam, pvUnit);
return this.save(pvUnit);
}
@Override
public boolean updateUnit(PvUnitParam.UpdatePvUnitParam updatePvUnitParam) {
checkName(updatePvUnitParam, true);
PvUnit pvUnit = new PvUnit();
BeanUtils.copyProperties(updatePvUnitParam, pvUnit);
return this.updateById(pvUnit);
}
@Override
public List<UnitTreeVO> getPvUnitList(BaseParam baseParam) {
List<UnitTreeVO> list = this.baseMapper.getPvUnitList(baseParam.getOrderBy(), baseParam.getSortBy());
List<UnitTreeVO> parentList = list.stream().filter(item -> item.getPid().equals("0")).collect(Collectors.toList());
parentList.forEach(item -> item.setChildren(getChildren(item,list)));
return parentList;
}
/**
* 递归查询子节点
* @param root 根节点
* @param all 所有节点
* @return 根节点信息
*/
private List<UnitTreeVO> getChildren(UnitTreeVO root, List<UnitTreeVO> all) {
return all.stream().filter(m -> Objects.equals(m.getPid(), root.getId()))
.peek(m -> m.setChildren(getChildren(m, all))).collect(Collectors.toList());
}
private List<PvTerminalTreeVO> getChildrens(PvTerminalTreeVO root, List<PvTerminalTreeVO> all) {
return all.stream().filter(m -> Objects.equals(m.getPid(), root.getId()))
.peek(m -> m.setChildren(getChildrens(m, all))).collect(Collectors.toList());
}
@Override
public PvUnit getPvUnitById(String id) {
return this.getById(id);
}
@Override
public boolean delPvUnit(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*
* @author cdf
* @date 2022/7/5
*/
private void checkName(PvUnitParam pvUnitParam, boolean isUpdate) {
LambdaQueryWrapper<PvUnit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvUnit::getName, pvUnitParam.getName());
if (isUpdate) {
//更新操作
if (pvUnitParam instanceof PvUnitParam.UpdatePvUnitParam) {
lambdaQueryWrapper.eq(PvUnit::getId, ((PvUnitParam.UpdatePvUnitParam) pvUnitParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.UNIT_REPEAT);
}
}
}

View File

@@ -0,0 +1,121 @@
package com.njcn.device.pms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.param.PvVoltageParam;
import com.njcn.device.pms.pojo.param.VoltageQueryParam;
import com.njcn.device.pms.pojo.po.PvVoltage;
import com.njcn.device.pms.mapper.PvVoltageMapper;
import com.njcn.device.pms.service.IPvVoltageService;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* <p>
* 母线实现类
* </p>
*
* @author cdf
* @since 2022-07-05
*/
@Service
@RequiredArgsConstructor
public class PvVoltageServiceImpl extends ServiceImpl<PvVoltageMapper, PvVoltage> implements IPvVoltageService {
private final DicDataFeignClient dicDataFeignClient;
@Override
public boolean addVoltage(PvVoltageParam pvVoltageParam) {
DictData dictData = dicDataFeignClient.getDicDataById(pvVoltageParam.getScale()).getData();
if(Objects.isNull(dictData)){
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
checkName(pvVoltageParam,false);
PvVoltage pvVoltage = new PvVoltage();
BeanUtils.copyProperties(pvVoltageParam,pvVoltage);
return this.save(pvVoltage);
}
@Override
public boolean updateVoltage(PvVoltageParam.UpdatePvVoltageParam updatePvVoltageParam) {
DictData dictData = dicDataFeignClient.getDicDataById(updatePvVoltageParam.getScale()).getData();
if(Objects.isNull(dictData)){
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
checkName(updatePvVoltageParam,true);
PvVoltage pvVoltage = new PvVoltage();
BeanUtils.copyProperties(updatePvVoltageParam,pvVoltage);
return this.updateById(pvVoltage);
}
@Override
public Page<PvVoltage> getPvVoltageList(VoltageQueryParam voltageQueryParam) {
Page<PvVoltage> page = new Page<>(PageFactory.getPageNum(voltageQueryParam),PageFactory.getPageSize(voltageQueryParam));
LambdaQueryWrapper<PvVoltage> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvVoltage::getName,voltageQueryParam.getSearchValue())
.eq(PvVoltage::getScale,voltageQueryParam.getScale());
return this.page(page,lambdaQueryWrapper);
}
@Override
public List<PvVoltage> getAllPvVoltageList() {
return this.list();
}
@Override
public PvVoltage getPvVoltageById(String id) {
return this.getById(id);
}
@Override
public boolean delPvVoltage(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*
* @author cdf
* @date 2022/7/5
*/
private void checkName(PvVoltageParam pvVoltageParam, boolean isUpdate) {
LambdaQueryWrapper<PvVoltage> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvVoltage::getName, pvVoltageParam.getName());
if (isUpdate) {
//更新操作
if (pvVoltageParam instanceof PvVoltageParam.UpdatePvVoltageParam) {
lambdaQueryWrapper.ne(PvVoltage::getId, ((PvVoltageParam.UpdatePvVoltageParam) pvVoltageParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.VOLTAGE_REPEAT);
}
//校验序号
/* lambdaQueryWrapper.clear();
lambdaQueryWrapper.eq(PvVoltage::getNum, pvVoltageParam.getNum());
if (isUpdate) {
//更新操作
if (pvVoltageParam instanceof PvVoltageParam.UpdatePvVoltageParam) {
lambdaQueryWrapper.eq(PvVoltage::getId, ((PvVoltageParam.UpdatePvVoltageParam) pvVoltageParam).getId());
}
}
int countNum = this.count(lambdaQueryWrapper);
if (countNum > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_NUM_REPEAT);
}*/
}
}