1.字典表 终端类型改为型号 2.分布式光伏台账

This commit is contained in:
2022-07-08 13:50:34 +08:00
parent 18a6c2637a
commit 632b6275c6
97 changed files with 6290 additions and 55 deletions

View File

@@ -2,6 +2,7 @@ package com.njcn.device.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
@@ -67,6 +68,7 @@ public class TerminalBaseController extends BaseController {
public HttpResult<Object> addTerminal(@Valid @RequestBody AddTerminalParam addTerminalParam) {
String methodDescribe = getMethodDescribe("addTerminal");
//装置母线监测点相关检验
List<String> voltageName = new ArrayList<>();
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam())) {
//校验装置是否存在重名
List<DeviceParam> listDev = addTerminalParam.getDeviceParam();
@@ -87,10 +89,7 @@ public class TerminalBaseController extends BaseController {
if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) {
List<SubVoltageParam> subvList = deviceParam.getSubVoltageParam();
List<String> subVName = subvList.stream().map(SubVoltageParam::getName).collect(Collectors.toList());
long countSubV = subVName.stream().distinct().count();
if (countSubV != subVName.size()) {
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_REPETITION);
}
voltageName.addAll(subVName);
//校验监测点名称
for (SubVoltageParam subVoltageParam : subvList) {
if (CollectionUtil.isNotEmpty(subVoltageParam.getLineParam())) {
@@ -109,6 +108,11 @@ public class TerminalBaseController extends BaseController {
}
}
}
long countSubV = voltageName.stream().distinct().count();
if (countSubV != voltageName.size()) {
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_REPETITION);
}
}
terminalBaseService.addTerminal(addTerminalParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
@@ -124,7 +128,7 @@ public class TerminalBaseController extends BaseController {
@ApiOperation("终端修改操作")
@OperateInfo(operateType = OperateType.UPDATE, info = LogEnum.BUSINESS_MEDIUM)
@PutMapping("updateTerminal")
public HttpResult updateTerminal(@Valid @RequestBody UpdateTerminalParam updateTerminalParam) {
public HttpResult<Object> updateTerminal(@Valid @RequestBody UpdateTerminalParam updateTerminalParam) {
String methodDescribe = getMethodDescribe("updateTerminal");
terminalBaseService.updateTerminal(updateTerminalParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
@@ -155,7 +159,7 @@ public class TerminalBaseController extends BaseController {
@ApiOperation("终端删除操作")
@OperateInfo(operateType = OperateType.DELETE, info = LogEnum.BUSINESS_SERIOUS)
@DeleteMapping("delTerminal")
public HttpResult delTerminal(@RequestParam("id") String id) {
public HttpResult<Object> delTerminal(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("delTerminal");
terminalBaseService.delTerminal(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
@@ -246,12 +250,7 @@ public class TerminalBaseController extends BaseController {
@ApiOperation("导出台账模板")
@GetMapping(value = "downTerminalTemplate")
public void downTerminalTemplate(HttpServletResponse response) {
ExportParams exportExcel = new ExportParams("批量导入模板(请严格按照模板标准填入数据)","台账信息");
Workbook workbook = ExcelExportUtil.exportExcel(exportExcel,TerminalBaseExcel.class,new ArrayList<TerminalBaseExcel>());
//这里是自己加的 带下拉框的代码
ExcelUtil.selectList(workbook, 4, 4, new String[]{"","","","",""});
ExcelUtil.selectList(workbook, 0, 0, new String[]{"蔬菜","水果","主食","熟食","调料"});
PoiUtil.exportFileByWorkbook(workbook, "菜品管理", response);
terminalBaseService.downTerminalTemplate(response);
}
/**

View File

@@ -54,6 +54,13 @@ public interface LineMapper extends BaseMapper<Line> {
*/
List<LineDetail> getLineDetailByDeviceId(@Param("devId") String devId);
/**
* 查询装置下的母线信息
* @param devId 设备id
* @date 2022/7/1
*/
List<Voltage> getVoltageByDevId(@Param("devId") String devId);
/**
* 通过监测点id获取母线详情
@@ -297,4 +304,15 @@ public interface LineMapper extends BaseMapper<Line> {
*/
String getDevIndex(@Param("lineId")String lineId);
/**
* 获取变电站下母线
* @param subId 变电站id
* @author cdf
* @date 2022/7/4
* @return 结果
*/
List<Line> getVoltageListBySubId(@Param("subId")String subId,@Param("voltageName")List<String> voltageName);
}

View File

@@ -48,6 +48,14 @@
and a.state = 1
</select>
<select id="getVoltageByDevId" resultType="Voltage">
select a.id,a.name,b.num
from pq_line a
inner join pq_voltage b on a.id = b.id
where a.pid = #{devId}
and a.state = 1
</select>
<select id="getVoltageByLineId" resultType="Voltage">
select *
@@ -830,7 +838,7 @@
<foreach item="item" collection="list" separator="," open="(" close=")">
#{item}
</foreach>
)t
)t
</select>
<select id="getLineList" resultType="string">
@@ -849,8 +857,6 @@
</select>
<select id="getTerminalBaseExcel" resultType="TerminalBaseExcel">
SELECT
pj.NAME projectName,
@@ -928,4 +934,18 @@ FROM
where vo.id = line.pid
and line.id = #{lineId}
</select>
<select id="getVoltageListBySubId" resultType="Line">
select * from pq_line voltage
inner join pq_line dev on voltage.pid = dev.id
inner join pq_line sub on dev.pid = sub.id
where sub.id = #{subId}
and voltage.state = 1
<if test="voltageName!=null">
and voltage.name in
<foreach collection="voltageName" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>

View File

@@ -173,6 +173,13 @@ public interface TerminalBaseService {
*/
List<TerminalBaseExcel> exportTerminalBase();
/**
* 导出台账模板
* @author cdf
* @date 2022/5/17
*/
void downTerminalTemplate(HttpServletResponse response);
/**
* 将台账数据导入终端相关表
* @param file 原始数据信息

View File

@@ -1,6 +1,8 @@
package com.njcn.device.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import cn.hutool.core.collection.CollectionUtil;
@@ -32,6 +34,7 @@ import com.njcn.device.service.INodeService;
import com.njcn.device.service.LineBakService;
import com.njcn.device.service.TerminalBaseService;
import com.njcn.device.utils.DeviceUtil;
import com.njcn.device.utils.ExcelStyleUtil;
import com.njcn.poi.excel.ExcelUtil;
import com.njcn.poi.util.PoiUtil;
import com.njcn.system.api.AreaFeignClient;
@@ -42,6 +45,8 @@ import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -188,7 +193,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
LambdaQueryWrapper<Line> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) {
//校验变电站下的装置名称ip是否重复
checkDev(addTerminalParam, subIndex,lineLambdaQueryWrapper);
checkDevNameAndIp(addTerminalParam, subIndex, lineLambdaQueryWrapper);
for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) {
@@ -200,21 +205,28 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
List<Integer> listVoltageNum = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList());
//标识当前装置下的监测点数量
int lineNum = 0, voltageNum = 0;
//校验监测点总数不超过6
if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) {
for (SubVoltageParam subVoltage : deviceParam.getSubVoltageParam()) {
if (CollectionUtil.isNotEmpty(subVoltage.getLineParam())) {
for (LineParam lineValid : subVoltage.getLineParam()) {
if (StrUtil.isNotBlank(lineValid.getName())) {
if (StrUtil.isBlank(lineValid.getLineIndex())) {
lineNum++;
}
}
}
//一台装置母线最多6路
if (StrUtil.isBlank(subVoltage.getSubvIndex())) {
voltageNum++;
}
}
}
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
Line device = assembleLine(deviceParam.getName(), LineBaseEnum.DEVICE_LEVEL.getCode(), subIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex, deviceParam.getSort());
this.baseMapper.insert(device);
devIdIndex = device.getId();
@@ -241,7 +253,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
List<DevFuction> insertFunList = new ArrayList<>();
for (DictData dicData : funList) {
DevFuction devFunction = new DevFuction();
devFunction.setLineId(device.getId());
devFunction.setFucName(dicData.getId());
devFunction.setId(IdUtil.simpleUUID());
@@ -260,43 +271,84 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
listLineNum.removeIf(integer -> sline.getNum().equals(integer));
}
}
//母线
List<Voltage> voltageList = lineMapper.getVoltageByDevId(devIdIndex);
if (CollectionUtil.isNotEmpty(voltageList)) {
voltageNum = voltageNum + voltageList.size();
for (Voltage v : voltageList) {
listVoltageNum.removeIf(integer -> v.getNum().equals(integer));
}
}
}
if (lineNum > 6) {
throw new BusinessException(DeviceResponseEnum.DEVICE_LINE_BIG);
}
if (voltageNum > 6) {
throw new BusinessException(DeviceResponseEnum.DEVICE_VOLTAGE_BIG);
}
//判断设备下是否存在母线
if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) {
//当通过设备节点新增时候需要校验是否存在同名母线名称
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
List<String> subvNameList = deviceParam.getSubVoltageParam().stream()
.filter((subv) -> subv.getSubvIndex() == null)
.map(SubVoltageParam::getName).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(subvNameList)) {
lineLambdaQueryWrapper.clear();
lineLambdaQueryWrapper.eq(Line::getPid, devIdIndex)
.eq(Line::getState, DataStateEnum.ENABLE.getCode())
.in(Line::getName, subvNameList);
List<Line> subvRes = this.list(lineLambdaQueryWrapper);
if (subvRes.size() > 0) {
List<String> subvList = subvRes.stream().map(Line::getName).collect(Collectors.toList());
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";", subvList));
}
List<String> subvNameList = deviceParam.getSubVoltageParam().stream()
.filter((subv) -> subv.getSubvIndex() == null)
.map(SubVoltageParam::getName).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(subvNameList)) {
lineLambdaQueryWrapper.clear();
lineLambdaQueryWrapper.eq(Line::getPid, devIdIndex)
.eq(Line::getState, DataStateEnum.ENABLE.getCode())
.in(Line::getName, subvNameList);
List<Line> subvRes = this.list(lineLambdaQueryWrapper);
if (subvRes.size() > 0) {
List<String> subvList = subvRes.stream().map(Line::getName).collect(Collectors.toList());
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";", subvList));
}
}
//母线
List<String> voltageName = deviceParam.getSubVoltageParam().stream().filter(item -> StrUtil.isBlank(item.getSubvIndex())).map(SubVoltageParam::getName).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(voltageName)) {
List<Line> voltageList = this.baseMapper.getVoltageListBySubId(subIndex, voltageName);
if(CollectionUtil.isNotEmpty(voltageList)){
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";", voltageList.stream().map(Line::getName).collect(Collectors.toList())));
}
}
//校验同一变电站下只能有唯一母线名称
List<String> addVoltage = deviceParam.getSubVoltageParam().stream().filter(item->item.getSubvIndex() == null).map(SubVoltageParam::getName).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(addVoltage)) {
List<Line> voltageListBySubId = this.baseMapper.getVoltageListBySubId(subIndex, addVoltage);
if(CollectionUtil.isNotEmpty(voltageListBySubId)){
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";",voltageListBySubId.stream().map(Line::getName).collect(Collectors.toList())));
}
}
for (SubVoltageParam subVoltageParam : deviceParam.getSubVoltageParam()) {
//母线id
String subvIndex;
if (StrUtil.isBlank(subVoltageParam.getSubvIndex()) && StrUtil.isNotBlank(devIdIndex)) {
DictData scaleRes = dicDataFeignClient.getDicDataById(subVoltageParam.getScale()).getData();
if (Objects.isNull(scaleRes)) {
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
}
//校验母线
if (CollectionUtil.isNotEmpty(listVoltageNum)) {
if (!listVoltageNum.contains(subVoltageParam.getNum())) {
throw new BusinessException(DeviceResponseEnum.VOLTAGE_NUM_USE, "母线序号:" + subVoltageParam.getNum());
}
} else {
throw new BusinessException(DeviceResponseEnum.DEVICE_VOLTAGE_BIG);
}
Line subVoltage = assembleLine(subVoltageParam.getName(), LineBaseEnum.SUB_V_LEVEL.getCode(), devIdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex, subVoltageParam.getSort());
this.baseMapper.insert(subVoltage);
subvIndex = subVoltage.getId();
@@ -378,7 +430,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
/**
* 校验装置
*/
private void checkDev(AddTerminalParam addTerminalParam, String subIndex,LambdaQueryWrapper<Line> lineLambdaQueryWrapper) {
private void checkDevNameAndIp(AddTerminalParam addTerminalParam, String subIndex, LambdaQueryWrapper<Line> lineLambdaQueryWrapper) {
List<String> devNameList = addTerminalParam.getDeviceParam().stream().filter((dev -> dev.getDevIndex() == null)).map(DeviceParam::getName).collect(Collectors.toList());
@@ -648,6 +700,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
/**
* 终端查询操作
*
* @param id pq_line表 id
* @author cdf
* @date 2021/7/19
*/
@@ -890,6 +943,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
SubVoltageVO subVoltageVO = new SubVoltageVO();
BeanUtils.copyProperties(subVoltage, subVoltageVO);
Voltage voltage = voltageMapper.selectById(subVoltage.getId());
subVoltageVO.setSubvIndex(subVoltage.getId());
BeanUtils.copyProperties(voltage, subVoltageVO);
subVoltageVO.setLineVO(lineVOS);
subVoltageVOS.add(subVoltageVO);
@@ -1341,6 +1395,45 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
return this.baseMapper.getTerminalBaseExcel();
}
@Override
public void downTerminalTemplate(HttpServletResponse response) {
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "台账信息");
exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TerminalBaseExcel.class, new ArrayList<TerminalBaseExcel>());
List<DictData> businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData();
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData();
List<DictData> frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData();
List<DictData> scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE.getName()).getData();
List<Node> nodeList = nodeService.nodeAllList();
//这里是自己加的 带下拉框的代码
ExcelUtil.selectList(workbook, 8, 8, new String[]{"虚拟设备", "实际设备", "离线设备"});
ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"});
ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"});
ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"});
ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
/*母线序号*/
ExcelUtil.selectList(workbook, 23, 23, new String[]{"1", "2", "3", "3", "4", "5", "6"});
ExcelUtil.selectList(workbook, 24, 24, scaleList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 25, 25, new String[]{"虚拟母线", "实际母线"});
ExcelUtil.selectList(workbook, 27, 27, new String[]{"1", "2", "3", "3", "4", "5", "6"});
ExcelUtil.selectList(workbook, 28, 28, new String[]{"极重要", "重要", "普通", "不重要"});
ExcelUtil.selectList(workbook, 35, 35, new String[]{"星型接法", "三角型接法", "开口三角型接法"});
ExcelUtil.selectList(workbook, 36, 36, new String[]{"3", "5", "10"});
ExcelUtil.selectList(workbook, 37, 37, loadTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 38, 38, businessList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"});
ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"});
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void importTerminalBase(MultipartFile file, HttpServletResponse response) {

View File

@@ -0,0 +1,159 @@
package com.njcn.device.utils;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams;
import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
/**
* pqs
*
* @author cdf
* @date 2022/7/4
*/
public class ExcelStyleUtil implements IExcelExportStyler {
// 数据行类型
private static final String DATA_STYLES = "dataStyles";
// 标题类型
private static final String TITLE_STYLES = "titleStyles";
//头样式
private static final String HEADER_STYLES = "headerStyles";
//数据行样式
private CellStyle styles;
// 标题样式
private CellStyle titleStyle;
// 标题样式
private CellStyle headerStyle;
public ExcelStyleUtil(Workbook workbook) {
this.init(workbook);
}
private void init(Workbook workbook) {
this.styles = initStyles(workbook);
this.titleStyle = initTitleStyle(workbook);
this.headerStyle = initTitleStyle(workbook);
}
@Override
public CellStyle getHeaderStyle(short headerColor) {
return headerStyle;
}
/**
* 标题样式
*/
@Override
public CellStyle getTitleStyle(short i) {
return titleStyle;
}
@Override
public CellStyle getStyles(boolean parity, ExcelExportEntity entity) {
return styles;
}
/**
* 获取样式方法
*
* @param dataRow 数据行
* @param obj 对象
* @param data 数据
*/
@Override
public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) {
return getStyles(true, entity);
}
@Override
public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) {
return null;
}
/**
* 初始化--标题行样式
* @param workbook
* @return
*/
private CellStyle initTitleStyle(Workbook workbook) {
return buildCellStyle(workbook,TITLE_STYLES);
}
/**
* 头样式
* @author cdf
* @date 2022/7/4
*/
private CellStyle initHeaderStyle(Workbook workbook) {
return buildCellStyle(workbook,HEADER_STYLES);
}
/**
* 初始化--数据行样式
* @param workbook
* @return
*/
private CellStyle initStyles(Workbook workbook) {
return buildCellStyle(workbook,DATA_STYLES);
}
/**
* 设置单元格样式
* @param workbook
* @param type 类型 用来区分是数据行样式还是标题样式
* @return
*/
private CellStyle buildCellStyle(Workbook workbook,String type) {
CellStyle style = workbook.createCellStyle();
// 字体样式
Font font = workbook.createFont();
if(TITLE_STYLES.equals(type)){
font.setFontHeightInPoints((short)12);
font.setBold(true);
// 设置水平对齐的样式为居中对齐;
style.setAlignment(HorizontalAlignment.CENTER);
}
if(HEADER_STYLES.equals(type)){
font.setFontHeightInPoints((short)12);
font.setBold(true);
// 设置水平对齐的样式为居中对齐;
style.setAlignment(HorizontalAlignment.LEFT);
}
if(DATA_STYLES.equals(type)){
font.setFontHeightInPoints((short)10);
// 设置水平对齐的样式为居中对齐;
style.setAlignment(HorizontalAlignment.CENTER);
}
font.setFontName("Courier New");
style.setFont(font);
// 设置底边框
style.setBorderBottom(BorderStyle.THIN);
// 设置左边框
style.setBorderLeft(BorderStyle.THIN);
// 设置右边框;
style.setBorderRight(BorderStyle.THIN);
// 设置顶边框;
style.setBorderTop(BorderStyle.THIN);
// 设置底边颜色
style.setBottomBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
// 设置左边框颜色;
style.setLeftBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
// 设置右边框颜色;
style.setRightBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
// 设置顶边框颜色;
style.setTopBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
// 设置自动换行;
style.setWrapText(false);
// 设置垂直对齐的样式为居中对齐;
style.setVerticalAlignment(VerticalAlignment.CENTER);
return style;
}
}

View File

@@ -0,0 +1,160 @@
package com.njcn.pvdevice.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.pojo.param.pv.DeviceQueryParam;
import com.njcn.device.pojo.param.pv.PvDeviceParam;
import com.njcn.device.pojo.po.pv.PvDevice;
import com.njcn.pvdevice.service.IPvDeviceService;
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 com.njcn.web.controller.BaseController;
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<PvDevice>> getPvDeviceList(@RequestBody DeviceQueryParam deviceQueryParam){
String methodDescribe = getMethodDescribe("getPvDeviceList");
Page<PvDevice> 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<PvDevice>> getAllPvDeviceList(){
String methodDescribe = getMethodDescribe("getAllPvDeviceList");
List<PvDevice> 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 id 终端id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvDevice")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除终端")
@ApiImplicitParam(name = "id",value = "终端id",required = true)
public HttpResult<PvDevice> delPvDevice(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvDevice");
boolean res = iPvDeviceService.delPvDevice(id);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,26 @@
package com.njcn.pvdevice.controller;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
/**
* <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.pvdevice.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.pojo.param.pv.PvDistributedParam;
import com.njcn.device.pojo.param.pv.DistributedQueryParam;
import com.njcn.device.pojo.po.pv.PvDistributed;
import com.njcn.pvdevice.service.IPvDistributedService;
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 com.njcn.web.controller.BaseController;
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<PvDistributed>> getPvDistributedList(@RequestBody DistributedQueryParam distributedQueryParam){
String methodDescribe = getMethodDescribe("getPvDistributedList");
Page<PvDistributed> 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 id 分布式光伏台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvDistributed")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除分布式光伏台账")
@ApiImplicitParam(name = "id",value = "分布式光伏台账id",required = true)
public HttpResult<PvDistributed> delPvDistributed(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvDistributed");
boolean res = iPvDistributedService.delPvDistributed(id);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,161 @@
package com.njcn.pvdevice.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.pojo.param.pv.LineDetailQueryParam;
import com.njcn.device.pojo.param.pv.PvLineDetailParam;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.pvdevice.service.IPvLineDetailService;
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 com.njcn.web.controller.BaseController;
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 id 监测点id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvLineDetail")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除监测点")
@ApiImplicitParam(name = "id",value = "监测点id",required = true)
public HttpResult<PvLineDetail> delPvLineDetail(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvLineDetail");
boolean res = iPvLineDetailService.delPvLineDetail(id);
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.pvdevice.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.pojo.param.pv.LvUserQueryParam;
import com.njcn.device.pojo.param.pv.PvLvUserParam;
import com.njcn.device.pojo.po.pv.PvLvUser;
import com.njcn.pvdevice.service.IPvLvUserService;
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 com.njcn.web.controller.BaseController;
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<PvLvUser>> getPvLvUserList(@RequestBody LvUserQueryParam lvUserQueryParam){
String methodDescribe = getMethodDescribe("getPvLvUserList");
Page<PvLvUser> 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 id 低压用户台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvLvUser")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除低压用户台账")
@ApiImplicitParam(name = "id",value = "低压用户台账id",required = true)
public HttpResult<PvLvUser> delPvLvUser(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvLvUser");
boolean res = iPvLvUserService.delPvLvUser(id);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,161 @@
package com.njcn.pvdevice.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.pojo.param.pv.PvSubAreaParam;
import com.njcn.device.pojo.param.pv.SubAreaQueryParam;
import com.njcn.device.pojo.po.pv.PvSubArea;
import com.njcn.pvdevice.service.IPvSubAreaService;
import com.sun.el.parser.BooleanNode;
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 com.njcn.web.controller.BaseController;
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<PvSubArea>> getPvSubAreaList(@RequestBody SubAreaQueryParam subAreaQueryParam){
String methodDescribe = getMethodDescribe("getPvSubAreaList");
Page<PvSubArea> 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 id 台区id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvSubArea")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除台区")
@ApiImplicitParam(name = "id",value = "台区id",required = true)
public HttpResult<PvSubArea> delPvSubArea(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvSubArea");
boolean res = iPvSubAreaService.delPvSubArea(id);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,151 @@
package com.njcn.pvdevice.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.pojo.param.pv.PvSubstationParam;
import com.njcn.device.pojo.param.pv.SubstationQueryParam;
import com.njcn.device.pojo.po.pv.PvSubstation;
import com.njcn.pvdevice.service.IPvSubstationService;
import com.njcn.web.pojo.param.BaseParam;
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 com.njcn.web.controller.BaseController;
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<PvSubstation>> getPvSubstationList(@RequestBody SubstationQueryParam substationQueryParam){
String methodDescribe = getMethodDescribe("getPvSubstationList");
Page<PvSubstation> 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 id 变电站id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
@DeleteMapping("delPvSubstation")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除变电站")
@ApiImplicitParam(name = "id",value = "变电站id",required = true)
public HttpResult<PvSubstation> delPvSubstation(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("delPvSubstation");
iPvSubstationService.delPvSubstation(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,141 @@
package com.njcn.pvdevice.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.pojo.param.pv.PvTenVoltageParam;
import com.njcn.device.pojo.param.pv.TenVoltageQueryParam;
import com.njcn.device.pojo.po.pv.PvTenVoltage;
import com.njcn.pvdevice.service.IPvTenVoltageService;
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 com.njcn.web.controller.BaseController;
/**
* <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<PvTenVoltage>> getPvTenVoltageList(@RequestBody @Validated TenVoltageQueryParam tenVoltageQueryParam) {
String methodDescribe = getMethodDescribe("getPvTenVoltageList");
Page<PvTenVoltage> page = iPvTenVoltageService.getPvTenVoltageList(tenVoltageQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, 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 id 10kV线路id
* @return boolean
* @author cdf
* @date 2022/7/5
*/
@DeleteMapping("delPvTenVoltage")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("删除10kV线路")
@ApiImplicitParam(name = "id", value = "10kV线路id", required = true)
public HttpResult<PvTenVoltage> delPvTenVoltage(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("delPvTenVoltage");
boolean flag = iPvTenVoltageService.delPvTenVoltage(id);
if (flag) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}

View File

@@ -0,0 +1,134 @@
package com.njcn.pvdevice.controller;
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.pojo.param.pv.PvUnitParam;
import com.njcn.device.pojo.po.pv.PvUnit;
import com.njcn.device.pojo.vo.pv.UnitTreeVO;
import com.njcn.pvdevice.service.IPvUnitService;
import com.njcn.web.pojo.param.BaseParam;
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 com.njcn.web.controller.BaseController;
import java.util.List;
/**
* <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,147 @@
package com.njcn.pvdevice.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.pojo.param.pv.PvVoltageParam;
import com.njcn.device.pojo.param.pv.VoltageQueryParam;
import com.njcn.device.pojo.po.pv.PvVoltage;
import com.njcn.pvdevice.service.IPvTenVoltageService;
import com.njcn.pvdevice.service.IPvVoltageService;
import com.njcn.web.pojo.param.BaseParam;
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 com.njcn.web.controller.BaseController;
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,30 @@
package com.njcn.pvdevice.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.DeviceQueryParam;
import com.njcn.device.pojo.po.pv.PvDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvDeviceMapper extends BaseMapper<PvDevice> {
/**
* 获取所有终端台账
* @author cdf
* @date 2022/7/8
*/
Page<PvDevice> getPvDeviceList(Page<PvDevice> page,@Param("deviceQueryParam") DeviceQueryParam deviceQueryParam);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.pvdevice.mapper;
import com.njcn.device.pojo.po.pv.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,27 @@
package com.njcn.pvdevice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.DistributedQueryParam;
import com.njcn.device.pojo.po.pv.PvDistributed;
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<PvDistributed> getPvDistributedList(Page<PvDistributed> page,@Param("distributedQueryParam") DistributedQueryParam distributedQueryParam);
}

View File

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

View File

@@ -0,0 +1,26 @@
package com.njcn.pvdevice.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.LvUserQueryParam;
import com.njcn.device.pojo.po.pv.PvLvUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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<PvLvUser> getPvLvUserList(Page<PvLvUser> page,@Param("lvUserQueryParam") LvUserQueryParam lvUserQueryParam);
}

View File

@@ -0,0 +1,27 @@
package com.njcn.pvdevice.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.SubAreaQueryParam;
import com.njcn.device.pojo.po.pv.PvSubArea;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvSubAreaMapper extends BaseMapper<PvSubArea> {
/**
* 查询所有台区
* @author cdf
* @date 2022/7/7
*/
Page<PvSubArea> getPvSubAreaList(Page<PvSubArea> page,@Param("subsAreaQueryParam") SubAreaQueryParam subsAreaQueryParam);
}

View File

@@ -0,0 +1,21 @@
package com.njcn.pvdevice.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.SubstationQueryParam;
import com.njcn.device.pojo.po.pv.PvSubstation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-07-05
*/
public interface PvSubstationMapper extends BaseMapper<PvSubstation> {
Page<PvSubstation> getPvSubstationList(Page<PvSubstation> page,@Param("substationQueryParam") SubstationQueryParam substationQueryParam);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.pvdevice.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.TenVoltageQueryParam;
import com.njcn.device.pojo.po.pv.PvTenVoltage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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<PvTenVoltage> getPvTenVoltageList(Page<PvTenVoltage> page,@Param("tenVoltageQueryParam") TenVoltageQueryParam tenVoltageQueryParam);
}

View File

@@ -0,0 +1,28 @@
package com.njcn.pvdevice.mapper;
import com.njcn.device.pojo.po.pv.PvUnit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pojo.vo.pv.UnitTreeVO;
import com.njcn.web.pojo.param.BaseParam;
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.pvdevice.mapper;
import com.njcn.device.pojo.po.pv.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,44 @@
<?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.pvdevice.mapper.PvDeviceMapper">
<select id="getPvDeviceList" resultType="PvDevice">
SELECT
dev.id,
dic.NAME manufacturer,
dic2.NAME devType,
dev.type,
dev.Dev_Code,
dev.ip,
dev.port,
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
<where>
<if test="deviceQueryParam.searchValue!=null and deviceQueryParam.searchValue!=''">
and dev.dev_code like CONCAT('%',#{deviceQueryParam.searchValue},'%')
</if>
<if test="deviceQueryParam.manufacturer!=null and deviceQueryParam.manufacturer.size > 0">
and dev.manufacturer in
<foreach collection="lvUserQueryParam.manufacturer" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="deviceQueryParam.devType!=null and deviceQueryParam.devType.size > 0">
and dev.dev_Type in
<foreach collection="lvUserQueryParam.devType" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and dev.state = 1
</where>
order by dev.create_time asc
</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.pvdevice.mapper.PvDispatchMapper">
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.pvdevice.mapper.PvDistributedMapper">
<select id="getPvDistributedList" resultType="PvDistributed">
SELECT
dis.id,
dic.NAME scale,
dis.NAME,
dis.User_Code,
dis.Dev_Code,
dis.Machine_Capacity,
dis.Inte_Type,
dis.Phase,
dis.Energy_Capacity
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,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.pvdevice.mapper.PvLineDetailMapper">
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.pvdevice.mapper.PvLvUserMapper">
<select id="getPvLvUserList" resultType="PvLvUser">
SELECT
lv.id,
dic.NAME 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,49 @@
<?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.pvdevice.mapper.PvSubAreaMapper">
<select id="getPvSubAreaList" resultType="PvSubArea">
SELECT
sub.id,
unit.name unitId,
ten.NAME tenVoltageId,
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 pv_unit unit ON sub.unit_id = unit.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>
</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.pvdevice.mapper.PvSubstationMapper">
<select id="getPvSubstationList" resultType="PvSubstation">
SELECT
sub.id,
unit.NAME unitId,
dic.NAME scale,
sub.NAME,
sub.Total_Capacity,
sub.Team_Code
FROM
pv_substation sub
LEFT JOIN pv_unit unit ON sub.unit_id = unit.id
LEFT JOIN sys_dict_data dic ON sub.scale = dic.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>
</mapper>

View File

@@ -0,0 +1,49 @@
<?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.pvdevice.mapper.PvTenVoltageMapper">
<select id="getPvTenVoltageList" resultType="PvTenVoltage">
SELECT
ten.id,
dic.NAME scale,
dic2.NAME designScale,
ten.NAME,
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
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.searchValue!=null and tenVoltageQueryParam.searchValue!=''">
and ten.name 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,12 @@
<?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.pvdevice.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.pvdevice.mapper.PvVoltageMapper">
</mapper>

View File

@@ -0,0 +1,72 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.DeviceQueryParam;
import com.njcn.device.pojo.param.pv.PvDeviceParam;
import com.njcn.device.pojo.po.pv.PvDevice;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pojo.po.pv.PvDevice;
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<PvDevice> getPvDeviceList(DeviceQueryParam deviceQueryParam);
List<PvDevice> getAllPvDeviceList();
/**
* 根据分布式台账id查询分布式台账
* @param id 分布式台账id
* @author cdf
* @date 2022/7/5
* @return PvDevice
*/
PvDevice getPvDeviceById(String id);
/**
* 删除分布式台账
* @param id 分布式台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvDevice(String id);
}

View File

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

View File

@@ -0,0 +1,74 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pojo.param.pv.PvDistributedParam;
import com.njcn.device.pojo.param.pv.DistributedQueryParam;
import com.njcn.device.pojo.po.pv.PvDistributed;
import com.njcn.device.pojo.po.pv.PvDistributed;
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<PvDistributed> getPvDistributedList(DistributedQueryParam distributedQueryParam);
List<PvDistributed> getAllPvDistributedList();
/**
* 根据分布式台账id查询分布式台账
* @param id 分布式台账id
* @author cdf
* @date 2022/7/5
* @return PvDistributed
*/
PvDistributed getPvDistributedById(String id);
/**
* 删除分布式台账
* @param id 分布式台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvDistributed(String id);
}

View File

@@ -0,0 +1,72 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.LineDetailQueryParam;
import com.njcn.device.pojo.param.pv.PvLineDetailParam;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.baomidou.mybatisplus.extension.service.IService;
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 id 监测点id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvLineDetail(String id);
}

View File

@@ -0,0 +1,71 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.LvUserQueryParam;
import com.njcn.device.pojo.param.pv.PvLvUserParam;
import com.njcn.device.pojo.po.pv.PvLvUser;
import com.njcn.device.pojo.po.pv.PvLvUser;
import com.baomidou.mybatisplus.extension.service.IService;
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<PvLvUser> getPvLvUserList(LvUserQueryParam lvUserQueryParam);
List<PvLvUser> getAllPvLvUserList();
/**
* 根据分低压用户台账id查询分低压用户台账
* @param id 分低压用户台账id
* @author cdf
* @date 2022/7/5
* @return PvLvUser
*/
PvLvUser getPvLvUserById(String id);
/**
* 删除分低压用户台账
* @param id 分低压用户台账id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvLvUser(String id);
}

View File

@@ -0,0 +1,71 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.PvSubAreaParam;
import com.njcn.device.pojo.param.pv.SubAreaQueryParam;
import com.njcn.device.pojo.po.pv.PvSubArea;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pojo.po.pv.PvSubArea;
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<PvSubArea> getPvSubAreaList(SubAreaQueryParam subAreaQueryParam);
List<PvSubArea> getAllPvSubAreaList();
/**
* 根据台区id查询台区
* @param id 台区id
* @author cdf
* @date 2022/7/5
* @return PvSubArea
*/
PvSubArea getPvSubAreaById(String id);
/**
* 删除台区
* @param id 台区id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvSubArea(String id);
}

View File

@@ -0,0 +1,72 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.PvSubstationParam;
import com.njcn.device.pojo.param.pv.SubstationQueryParam;
import com.njcn.device.pojo.po.pv.PvSubstation;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pojo.po.pv.PvSubstation;
import com.njcn.web.pojo.param.BaseParam;
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<PvSubstation> getPvSubstationList(SubstationQueryParam substationQueryParam);
List<PvSubstation> getAllPvSubstationList();
/**
* 根据变电站id查询变电站
* @param id 变电站id
* @author cdf
* @date 2022/7/5
* @return PvSubstation
*/
PvSubstation getPvSubstationById(String id);
/**
* 删除变电站
* @param id 变电站id
* @author cdf
* @date 2022/7/5
* @return boolean
*/
boolean delPvSubstation(String id);
}

View File

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

View File

@@ -0,0 +1,68 @@
package com.njcn.pvdevice.service;
import com.njcn.device.pojo.param.pv.PvUnitParam;
import com.njcn.device.pojo.po.pv.PvUnit;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pojo.vo.pv.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,72 @@
package com.njcn.pvdevice.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pojo.param.pv.PvVoltageParam;
import com.njcn.device.pojo.param.pv.VoltageQueryParam;
import com.njcn.device.pojo.po.pv.PvVoltage;
import com.njcn.device.pojo.po.pv.PvVoltage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.web.pojo.param.BaseParam;
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,127 @@
package com.njcn.pvdevice.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.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.DeviceQueryParam;
import com.njcn.device.pojo.param.pv.PvDeviceParam;
import com.njcn.device.pojo.po.pv.PvDevice;
import com.njcn.device.pojo.po.pv.PvDevice;
import com.njcn.pvdevice.mapper.PvDeviceMapper;
import com.njcn.pvdevice.service.IPvDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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<PvDevice> getPvDeviceList(DeviceQueryParam subsAreaQueryParam) {
Page<PvDevice> page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam), PageFactory.getPageSize(subsAreaQueryParam));
return this.baseMapper.getPvDeviceList(page,subsAreaQueryParam);
}
@Override
public List<PvDevice> getAllPvDeviceList() {
return this.list();
}
@Override
public PvDevice getPvDeviceById(String id) {
return this.getById(id);
}
@Override
public boolean delPvDevice(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvDeviceParam pvDeviceParam, boolean isUpdate) {
LambdaQueryWrapper<PvDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvDevice::getDevCode, pvDeviceParam.getDevCode());
if (isUpdate) {
//更新操作
if (pvDeviceParam instanceof PvDeviceParam.UpdatePvDeviceParam) {
lambdaQueryWrapper.eq(PvDevice::getId, ((PvDeviceParam.UpdatePvDeviceParam) pvDeviceParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT);
}
/*校验设备型号*/
if (StrUtil.isNotBlank(pvDeviceParam.getDevType())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getDevType()))) {
throw new BusinessException(SystemResponseEnum.DEV_TYPE_EMPTY);
}
}
/*校验生产厂家*/
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getManufacturer()))) {
throw new BusinessException(SystemResponseEnum.MANUFACTURER);
}
}
/**
* 校验参数是否违规
*/
private void checkParam(PvDeviceParam pvDeviceParam) {
}
}

View File

@@ -0,0 +1,20 @@
package com.njcn.pvdevice.service.impl;
import com.njcn.device.pojo.po.pv.PvDispatch;
import com.njcn.pvdevice.mapper.PvDispatchMapper;
import com.njcn.pvdevice.service.IPvDispatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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,110 @@
package com.njcn.pvdevice.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.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.PvDistributedParam;
import com.njcn.device.pojo.param.pv.DistributedQueryParam;
import com.njcn.device.pojo.po.pv.PvDistributed;
import com.njcn.device.pojo.po.pv.PvDistributed;
import com.njcn.pvdevice.mapper.PvDistributedMapper;
import com.njcn.pvdevice.service.IPvDistributedService;
import com.njcn.pvdevice.service.IPvSubAreaService;
import com.njcn.pvdevice.service.IPvUnitService;
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<PvDistributed> getPvDistributedList(DistributedQueryParam distributedQueryParam) {
Page<PvDistributed> 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(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvDistributedParam pvDistributedParam, boolean isUpdate) {
if(StrUtil.isNotBlank(pvDistributedParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDistributedParam.getScale()))) {
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.eq(PvDistributed::getId, ((PvDistributedParam.UpdatePvDistributedParam) pvDistributedParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT);
}
}
}

View File

@@ -0,0 +1,113 @@
package com.njcn.pvdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.LineDetailQueryParam;
import com.njcn.device.pojo.param.pv.PvLineDetailParam;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.device.pojo.po.pv.PvLineDetail;
import com.njcn.pvdevice.mapper.PvLineDetailMapper;
import com.njcn.pvdevice.service.IPvDeviceService;
import com.njcn.pvdevice.service.IPvLineDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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 PvLineDetailServiceImpl extends ServiceImpl<PvLineDetailMapper, PvLineDetail> implements IPvLineDetailService {
private final DicDataFeignClient dicDataFeignClient;
private final IPvDeviceService iPvDeviceService;
@Override
public boolean addLineDetail(PvLineDetailParam pvLineDetailParam) {
checkName(pvLineDetailParam,false);
checkParam(pvLineDetailParam);
PvLineDetail pvLineDetail = new PvLineDetail();
BeanUtils.copyProperties(pvLineDetailParam,pvLineDetail);
return this.save(pvLineDetail);
}
@Override
public boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam) {
checkName(updatePvLineDetailParam,true);
checkParam(updatePvLineDetailParam);
PvLineDetail pvLineDetail = new PvLineDetail();
BeanUtils.copyProperties(updatePvLineDetailParam,pvLineDetail);
return this.updateById(pvLineDetail);
}
@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(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*/
private void checkName(PvLineDetailParam pvLineDetailParam, boolean isUpdate) {
LambdaQueryWrapper<PvLineDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvLineDetail::getNum, pvLineDetailParam.getNum());
if (isUpdate) {
//更新操作
if (pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam) {
lambdaQueryWrapper.eq(PvLineDetail::getId, ((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT);
}
}
/**
* 校验参数是否违规
*/
private void checkParam(PvLineDetailParam pvLineDetailParam){
if(Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getLoadType()))){
throw new BusinessException(SystemResponseEnum.INTERFERENCE_EMPTY);
}
if(Objects.isNull(iPvDeviceService.getPvDeviceById(pvLineDetailParam.getDevId()))){
throw new BusinessException(PvDeviceResponseEnum.DEV_NULL);
}
}
}

View File

@@ -0,0 +1,109 @@
package com.njcn.pvdevice.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.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.LvUserQueryParam;
import com.njcn.device.pojo.param.pv.PvLvUserParam;
import com.njcn.device.pojo.po.pv.PvLvUser;
import com.njcn.device.pojo.po.pv.PvLvUser;
import com.njcn.pvdevice.mapper.PvLvUserMapper;
import com.njcn.pvdevice.service.IPvLvUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.pvdevice.service.IPvSubAreaService;
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<PvLvUser> getPvLvUserList(LvUserQueryParam lvUserQueryParam) {
Page<PvLvUser> 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(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvLvUserParam pvLvUserParam, boolean isUpdate) {
if(StrUtil.isNotBlank(pvLvUserParam.getScale())) {
if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLvUserParam.getScale()))) {
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.eq(PvLvUser::getId, ((PvLvUserParam.UpdatePvLvUserParam) pvLvUserParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT);
}
}
}

View File

@@ -0,0 +1,114 @@
package com.njcn.pvdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.PvSubAreaParam;
import com.njcn.device.pojo.param.pv.SubAreaQueryParam;
import com.njcn.device.pojo.po.pv.PvSubArea;
import com.njcn.device.pojo.po.pv.PvSubArea;
import com.njcn.pvdevice.mapper.PvSubAreaMapper;
import com.njcn.pvdevice.service.IPvSubAreaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.pvdevice.service.IPvTenVoltageService;
import com.njcn.pvdevice.service.IPvUnitService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.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;
@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<PvSubArea> getPvSubAreaList(SubAreaQueryParam subsAreaQueryParam) {
Page<PvSubArea> 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(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*/
private void checkNameAndParam(PvSubAreaParam pvSubAreaParam, boolean isUpdate) {
if(Objects.isNull(iPvTenVoltageService.getPvTenVoltageById(pvSubAreaParam.getTenVoltageId()))){
throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_NULL);
}
if(Objects.isNull(iPvUnitService.getPvUnitById(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.eq(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,121 @@
package com.njcn.pvdevice.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.db.constant.DbConstant;
import com.njcn.device.enums.DeviceResponseEnum;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.PvSubstationParam;
import com.njcn.device.pojo.param.pv.SubstationQueryParam;
import com.njcn.device.pojo.po.Node;
import com.njcn.device.pojo.po.pv.PvSubstation;
import com.njcn.device.pojo.po.pv.PvSubstation;
import com.njcn.pvdevice.mapper.PvSubstationMapper;
import com.njcn.pvdevice.service.IPvSubstationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.pvdevice.service.IPvUnitService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.enums.SystemResponseEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
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;
@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<PvSubstation> getPvSubstationList(SubstationQueryParam substationQueryParam) {
Page<PvSubstation> page = new Page<>(PageFactory.getPageNum(substationQueryParam),PageFactory.getPageSize(substationQueryParam));
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(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*
* @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.eq(PvSubstation::getId, ((PvSubstationParam.UpdatePvSubstationParam) pvSubstationParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_REPEAT);
}
DictData dictData = dicDataFeignClient.getDicDataById(pvSubstationParam.getScale()).getData();
if(Objects.isNull(dictData)){
throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY);
}
if(Objects.isNull(iPvUnitService.getPvUnitById(pvSubstationParam.getUnitId()))){
throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL);
}
}
}

View File

@@ -0,0 +1,114 @@
package com.njcn.pvdevice.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.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.PvTenVoltageParam;
import com.njcn.device.pojo.param.pv.TenVoltageQueryParam;
import com.njcn.device.pojo.po.pv.PvTenVoltage;
import com.njcn.device.pojo.po.pv.PvTenVoltage;
import com.njcn.pvdevice.mapper.PvTenVoltageMapper;
import com.njcn.pvdevice.service.IPvTenVoltageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.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<PvTenVoltage> getPvTenVoltageList(TenVoltageQueryParam tenVoltageQueryParam) {
Page<PvTenVoltage> page = new Page<>(PageFactory.getPageNum(tenVoltageQueryParam),PageFactory.getPageSize(tenVoltageQueryParam));
return this.baseMapper.getPvTenVoltageList(page,tenVoltageQueryParam);
}
@Override
public PvTenVoltage getPvTenVoltageById(String id) {
return this.getById(id);
}
@Override
public boolean delPvTenVoltage(String id) {
return this.removeById(id);
}
/**
* 校验单位名称是否重复
*
* @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.eq(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,100 @@
package com.njcn.pvdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.PvUnitParam;
import com.njcn.device.pojo.po.pv.PvUnit;
import com.njcn.device.pojo.vo.pv.UnitTreeVO;
import com.njcn.pvdevice.mapper.PvUnitMapper;
import com.njcn.pvdevice.service.IPvUnitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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());
}
@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,124 @@
package com.njcn.pvdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.enums.PvDeviceResponseEnum;
import com.njcn.device.pojo.param.pv.PvVoltageParam;
import com.njcn.device.pojo.param.pv.VoltageQueryParam;
import com.njcn.device.pojo.po.pv.PvTenVoltage;
import com.njcn.device.pojo.po.pv.PvVoltage;
import com.njcn.device.pojo.po.pv.PvVoltage;
import com.njcn.pvdevice.mapper.PvVoltageMapper;
import com.njcn.pvdevice.service.IPvVoltageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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 com.njcn.web.pojo.param.BaseParam;
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.eq(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);
}
}
}