1.台账增加默认排序
2.增加场站/用户监测规模接口
This commit is contained in:
@@ -19,14 +19,16 @@ public enum RunFlagEnum {
|
||||
QUIT(4, "退运"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
POWER_FLAG(0,"电网侧"),
|
||||
NO_POWER_FLAG(1,"非电网侧"),
|
||||
|
||||
|
||||
GW_FLAG(0,"主网"),
|
||||
PW_FLAG(1,"配网"),
|
||||
|
||||
I_SORT(1,"I类测点"),
|
||||
II_SORT(2,"II类测点"),
|
||||
III_SORT(3,"III类测点"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.device.biz.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.device.biz.utils.COverlimit;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -18,7 +18,8 @@ import java.util.Objects;
|
||||
*/
|
||||
public class COverlimitUtil {
|
||||
|
||||
|
||||
/** 配网占位默认值 */
|
||||
private static final float PLACEHOLDER = -3.14159f;
|
||||
/**
|
||||
* 谐波电流系数
|
||||
*/
|
||||
@@ -34,38 +35,76 @@ public class COverlimitUtil {
|
||||
|
||||
/**
|
||||
* 计算监测点限值
|
||||
* @param voltageLevel 电压等级(10kV = 10 220kV = 220 )
|
||||
* @param protocolCapacity 协议容量
|
||||
* @param devCapacity 设备容量
|
||||
* @param shortCapacity 短路容量
|
||||
* @param powerFlag 0.用户侧 1.电网侧
|
||||
* @param lineType 0.主网 1.配网 需要注意配网目前没有四种容量,谐波电流幅值限值,负序电流限值无法计算默认-3.14159
|
||||
* @param voltageLevel 电压等级(kV)
|
||||
* @param protocolCapacity 协议容量(MVA)
|
||||
* @param devCapacity 供电设备容量(MVA),为空/0自动取对应电压默认值
|
||||
* @param shortCapacity 实际最小短路容量(MVA)
|
||||
* @param powerFlag 0=电网侧(不执行两步计算) 1=非电网侧/用户侧(执行两步计算)
|
||||
* @param pointClass 配网点类型 0=Ⅱ类 1=Ⅲ类光伏;主网该字段传0即可
|
||||
*/
|
||||
public static Overlimit globalAssemble(Float voltageLevel, Float protocolCapacity, Float devCapacity,
|
||||
Float shortCapacity, Integer powerFlag, Integer lineType) {
|
||||
Float shortCapacity, Integer powerFlag,Integer pointClass) {
|
||||
Overlimit overlimit = new Overlimit();
|
||||
voltageDeviation(overlimit,voltageLevel);
|
||||
voltageDeviation(overlimit, voltageLevel);
|
||||
frequency(overlimit);
|
||||
voltageFluctuation(overlimit,voltageLevel);
|
||||
voltageFlicker(overlimit,voltageLevel);
|
||||
totalHarmonicDistortion(overlimit,voltageLevel);
|
||||
uHarm(overlimit,voltageLevel);
|
||||
voltageFluctuation(overlimit, voltageLevel);
|
||||
voltageFlicker(overlimit, voltageLevel);
|
||||
totalHarmonicDistortion(overlimit, voltageLevel);
|
||||
uHarm(overlimit, voltageLevel);
|
||||
threeVoltageUnbalance(overlimit);
|
||||
interharmonicCurrent(overlimit,voltageLevel);
|
||||
interharmonicCurrent(overlimit, voltageLevel);
|
||||
|
||||
if(Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
|
||||
//配网
|
||||
//谐波电流限值
|
||||
int lineType;
|
||||
if (voltageLevel >= DicDataEnum.KV220.getValue()) {
|
||||
lineType = 0; // 主网
|
||||
} else {
|
||||
lineType = 1; // 配网(110、66、35、10kV)
|
||||
}
|
||||
float sc = Objects.isNull(shortCapacity) ? 0f : shortCapacity;
|
||||
float pc = Objects.isNull(protocolCapacity) ? 0f : protocolCapacity;
|
||||
|
||||
float dc;
|
||||
if (Objects.isNull(devCapacity) || devCapacity <= 0) {
|
||||
dc = getDefaultDevCapacity(voltageLevel);
|
||||
} else {
|
||||
dc = devCapacity;
|
||||
}
|
||||
// 1. 配网 lineType = 1
|
||||
if (Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
|
||||
overlimit.setINeg(PLACEHOLDER);
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
//目前只处理了配网II类测点,III类测点暂未处理,III类测点参考主网
|
||||
iHarmTem[i] = getHarmTag(i+2,voltageLevel).floatValue();
|
||||
|
||||
// 配网-电网侧(powerFlag=0) / 配网Ⅱ类:直接基准限值,不折算
|
||||
if (Objects.equals(powerFlag,RunFlagEnum.POWER_FLAG.getStatus()) || Objects.equals(pointClass, 0)) {
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
iHarmTem[i] = getHarmTag(i + 2, voltageLevel).floatValue();
|
||||
}
|
||||
}
|
||||
// 配网-非电网侧 且 Ⅲ类光伏:两步计算,折算系数固定为1
|
||||
else {
|
||||
float calCap = 1.0f;
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
float inHarm = iHarmCalculate(i + 2, voltageLevel, pc, dc, calCap);
|
||||
iHarmTem[i] = inHarm;
|
||||
}
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
overlimit.setINeg(-3.14159f);
|
||||
}else {
|
||||
//主网
|
||||
iHarm(overlimit, voltageLevel, protocolCapacity, devCapacity, shortCapacity);
|
||||
negativeSequenceCurrent(overlimit, voltageLevel, shortCapacity);
|
||||
} else {
|
||||
// 主网-电网侧(powerFlag=0):直接基准限值
|
||||
if (Objects.equals(powerFlag, RunFlagEnum.POWER_FLAG.getStatus())) {
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
iHarmTem[i] = getHarmTag(i + 2, voltageLevel).floatValue();
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
}
|
||||
// 主网-非电网侧/用户侧(风光场站):完整两步计算
|
||||
else {
|
||||
iHarm(overlimit, voltageLevel, pc, dc, sc);
|
||||
}
|
||||
// 主网统一计算负序电流
|
||||
negativeSequenceCurrent(overlimit, voltageLevel, sc);
|
||||
}
|
||||
return overlimit;
|
||||
}
|
||||
@@ -304,6 +343,30 @@ public class COverlimitUtil {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据电压等级获取【默认公共连接点供电设备容量】St(MVA)
|
||||
* 无实际台账容量时兜底使用
|
||||
*/
|
||||
public static float getDefaultDevCapacity(Float voltageLevel) {
|
||||
if (voltageLevel < 0.4f) {
|
||||
return 1.0f;
|
||||
} else if (voltageLevel < 6f) {
|
||||
return 100f;
|
||||
} else if (voltageLevel < 20f) {
|
||||
return 200f;
|
||||
} else if (voltageLevel < 35f) {
|
||||
return 500f;
|
||||
} else if (voltageLevel < 66f) {
|
||||
return 800f;
|
||||
} else if (voltageLevel < 110f) {
|
||||
return 1000f;
|
||||
} else if (voltageLevel < 220f) {
|
||||
return 2000f;
|
||||
} else {
|
||||
return 3000f;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------谐波电流限值end-----------------------------------*/
|
||||
|
||||
|
||||
@@ -376,8 +439,9 @@ public class COverlimitUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("sss");
|
||||
float aa = iHarmCalculate(9,500f,10,10,0.002222222222f);
|
||||
Overlimit overlimit = new Overlimit();
|
||||
iHarm(overlimit, 220f, 100f, 100f, 2000f);
|
||||
|
||||
System.out.println(aa);
|
||||
System.out.println(overlimit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.device.utils.ExcelStyleUtil;
|
||||
import com.njcn.device.utils.LineSortHelper;
|
||||
import com.njcn.message.api.ProduceFeignClient;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
import com.njcn.message.constant.RedisKeyPrefix;
|
||||
@@ -144,6 +145,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
private final ProduceFeignClient produceFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
private final PqDevTypeService pqDevTypeService;
|
||||
private final LineSortHelper lineSortHelper;
|
||||
|
||||
@Value("${oracle.isSync}")
|
||||
private Boolean isSync;
|
||||
@@ -205,6 +207,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if (StrUtil.isBlank(projectIndex)) {
|
||||
checkName(addTerminalParam, PROJECT_LEVEL.getCode(), null);
|
||||
Line line = assembleLine(addTerminalParam.getProjectParam().getName(), PROJECT_LEVEL.getCode(), "0", "0", addTerminalParam.getProjectParam().getSort());
|
||||
lineSortHelper.handleSort(PROJECT_LEVEL.getCode(),addTerminalParam.getProjectParam().getSort(),line);
|
||||
this.baseMapper.insert(line);
|
||||
projectIndex = line.getId();
|
||||
}
|
||||
@@ -219,6 +222,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
LogUtil.njcnDebug(log, "获取区域信息:{}", result.toString());
|
||||
checkName(addTerminalParam, PROVINCE_LEVEL.getCode(), projectIndex);
|
||||
Line province = assembleLine(result.getId(), PROVINCE_LEVEL.getCode(), projectIndex, projectIndex, addTerminalParam.getProvinceParam().getSort());
|
||||
lineSortHelper.handleSort(PROVINCE_LEVEL.getCode(),addTerminalParam.getProvinceParam().getSort(),province);
|
||||
this.baseMapper.insert(province);
|
||||
provinceIndex = province.getId();
|
||||
}
|
||||
@@ -229,6 +233,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if (StrUtil.isBlank(gdIndex) && StrUtil.isNotBlank(provinceIndex)) {
|
||||
checkName(addTerminalParam, GD_LEVEL.getCode(), provinceIndex);
|
||||
Line gdInformation = assembleLine(addTerminalParam.getGdInformationParam().getName(), GD_LEVEL.getCode(), provinceIndex, projectIndex + StrUtil.COMMA + provinceIndex, addTerminalParam.getGdInformationParam().getSort());
|
||||
lineSortHelper.handleSort(GD_LEVEL.getCode(),addTerminalParam.getGdInformationParam().getSort(),gdInformation);
|
||||
this.baseMapper.insert(gdInformation);
|
||||
gdIndex = gdInformation.getId();
|
||||
}
|
||||
@@ -239,6 +244,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
|
||||
checkName(addTerminalParam, LineBaseEnum.SUB_LEVEL.getCode(), gdIndex);
|
||||
Line subStation = assembleLine(addTerminalParam.getSubStationParam().getName(), LineBaseEnum.SUB_LEVEL.getCode(), gdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex, addTerminalParam.getSubStationParam().getSort());
|
||||
lineSortHelper.handleSort(SUB_LEVEL.getCode(),addTerminalParam.getSubStationParam().getSort(),subStation);
|
||||
this.baseMapper.insert(subStation);
|
||||
subIndex = subStation.getId();
|
||||
|
||||
@@ -259,6 +265,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) {
|
||||
//校验变电站下的装置名称ip是否重复
|
||||
checkDevNameAndIp(addTerminalParam, subIndex, lineLambdaQueryWrapper);
|
||||
|
||||
Integer devSort = lineSortHelper.getNextSort(DEVICE_LEVEL.getCode());
|
||||
for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) {
|
||||
//用于记录装置id
|
||||
String devIdIndex;
|
||||
@@ -286,9 +294,16 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
if(Objects.isNull(deviceParam.getSort()) || deviceParam.getSort() == 0){
|
||||
device.setSort(devSort);
|
||||
}
|
||||
this.baseMapper.insert(device);
|
||||
if(Objects.isNull(deviceParam.getSort()) || deviceParam.getSort() == 0){
|
||||
devSort++;
|
||||
}
|
||||
devIdIndex = device.getId();
|
||||
|
||||
//装置详情
|
||||
@@ -393,7 +408,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, voltageListBySubId.stream().map(Line::getName).collect(Collectors.joining(";")));
|
||||
}
|
||||
}
|
||||
|
||||
Integer subvSort = lineSortHelper.getNextSort(SUB_V_LEVEL.getCode());
|
||||
for (SubVoltageParam subVoltageParam : deviceParam.getSubVoltageParam()) {
|
||||
//母线id
|
||||
String subvIndex;
|
||||
@@ -413,7 +428,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
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());
|
||||
if(Objects.isNull(subVoltageParam.getSort()) || subVoltageParam.getSort() == 0) {
|
||||
subVoltage.setSort(subvSort);
|
||||
}
|
||||
this.baseMapper.insert(subVoltage);
|
||||
if(Objects.isNull(subVoltageParam.getSort()) || subVoltageParam.getSort() == 0) {
|
||||
subvSort++;
|
||||
}
|
||||
subvIndex = subVoltage.getId();
|
||||
Voltage voltage = new Voltage();
|
||||
voltage.setId(subVoltage.getId());
|
||||
@@ -441,6 +462,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
}
|
||||
//通用新增监测点
|
||||
Integer lineSort = lineSortHelper.getNextSort(LineBaseEnum.LINE_LEVEL.getCode());
|
||||
for (LineParam lineParam : subVoltageParam.getLineParam()) {
|
||||
if (StrUtil.isBlank(lineParam.getLineIndex()) && StrUtil.isNotBlank(subvIndex)) {
|
||||
//判断监测点序号是否重复
|
||||
@@ -454,7 +476,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
//删除与当前线路号重复的项
|
||||
listLineNum.removeIf(lineNo -> lineNo.equals(lineParam.getNum()));
|
||||
Line line = assembleLine(lineParam.getName(), LineBaseEnum.LINE_LEVEL.getCode(), subvIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex + StrUtil.COMMA + subvIndex, lineParam.getSort());
|
||||
if(Objects.isNull(lineParam.getSort()) || lineParam.getSort() == 0) {
|
||||
line.setSort(lineSort);
|
||||
}
|
||||
this.baseMapper.insert(line);
|
||||
if(Objects.isNull(lineParam.getSort()) || lineParam.getSort() == 0) {
|
||||
lineSort++;
|
||||
}
|
||||
LineDetail lineDetail = new LineDetail();
|
||||
BeanUtils.copyProperties(lineParam, lineDetail);
|
||||
lineDetail.setId(line.getId());
|
||||
@@ -481,7 +509,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
//监测点限值
|
||||
DictData scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()).getData();
|
||||
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||
|
||||
if (Objects.isNull(lineParam.getVoltageDev())) {
|
||||
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
||||
@@ -752,7 +780,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
float voltageLevel = Float.parseFloat(dictData.getValue());
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
for (LineDetail lineDetail : lineList) {
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||
overlimit.setId(lineDetail.getId());
|
||||
overlimitMapper.deleteById(lineDetail.getId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
@@ -839,7 +867,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
||||
|
||||
//监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||
if (Objects.isNull(updateLineBO.getVoltageDev())) {
|
||||
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
||||
} else {
|
||||
@@ -1860,7 +1888,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
float voltageLevel = Float.parseFloat(scaleResult.getValue());
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||
overlimit.setId(lineDetail.getId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
count++;
|
||||
@@ -2193,7 +2221,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
//监测点限值
|
||||
DictData scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()).getData();
|
||||
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||
|
||||
if (Objects.isNull(lineParam.getVoltageDev())) {
|
||||
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
||||
@@ -2742,7 +2770,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
* @date 2022/5/18
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
private void saveTerminalBase(List<TerminalBaseExcel> terminalBaseExcels) {
|
||||
public void saveTerminalBase(List<TerminalBaseExcel> terminalBaseExcels) {
|
||||
List<TerminalBaseExcel.TerminalBaseExcelMsg> terminalBaseExcelMsgs = new ArrayList<>();
|
||||
//任意集合数据为空,不处理
|
||||
if (CollectionUtil.isNotEmpty(terminalBaseExcels)) {
|
||||
@@ -3006,7 +3034,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||
|
||||
lineDetailMapper.insert(lineDetail);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(Float.parseFloat(dictData.getValue()), terminalBaseExcel.getDealCapacity(), terminalBaseExcel.getDevCapacity(), terminalBaseExcel.getShortCapacity(), null, null);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(Float.parseFloat(dictData.getValue()), terminalBaseExcel.getDealCapacity(), terminalBaseExcel.getDevCapacity(), terminalBaseExcel.getShortCapacity(), terminalBaseExcel.getPowerFlag(), 0);
|
||||
overlimit.setId(temp.getId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
supervision_user_report.status,
|
||||
supervision_user_report.dev_id,
|
||||
supervision_user_report.line_id,
|
||||
supervision_user_report.station_id,
|
||||
supervision_user_report.second_assessment_id secondAssessmentId
|
||||
FROM supervision_user_report supervision_user_report
|
||||
WHERE ${ew.sqlSegment}
|
||||
|
||||
@@ -17,6 +17,9 @@ import com.njcn.bpm.enums.BpmTaskStatusEnum;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
|
||||
import com.njcn.device.userledger.mapper.UserReportPOMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
@@ -67,6 +70,7 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
private final UserReportNormalMapper userReportNormalMapper;
|
||||
private final UserReportSensitivePOService userReportSensitivePOService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final LineMapper substationMapper;
|
||||
|
||||
@Override
|
||||
public List<UserLedgerVO> selectUserList(UserReportParam userReportParam) {
|
||||
@@ -171,7 +175,16 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
Page<UserReportVO> page;
|
||||
page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
|
||||
Map<String,String> atationMap = new HashMap<>();
|
||||
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||
List<String> stationIds = page.getRecords().stream().map(UserReportVO::getStationId).filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(stationIds)){
|
||||
List<Line> stationList = substationMapper.selectBatchIds(stationIds);
|
||||
stationList.forEach(line -> atationMap.put(line.getId(), line.getName()));
|
||||
}
|
||||
}
|
||||
page.getRecords().forEach(temp -> {
|
||||
temp.setStationId(atationMap.getOrDefault(temp.getStationId(),"/"));
|
||||
Integer needGovernance = 0;
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.device.utils;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-06-13
|
||||
* @Description:
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class LineSortHelper {
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
/**
|
||||
* 获取同一父节点下的最大 sort 值 + 1
|
||||
* @param level 层级
|
||||
* @return 下一个可用的 sort 值
|
||||
*/
|
||||
public Integer getNextSort(Integer level) {
|
||||
LambdaQueryWrapper<Line> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Line::getState, DataStateEnum.ENABLE.getCode())
|
||||
.eq(Line::getLevel,level)
|
||||
.orderByDesc(Line::getSort)
|
||||
.last("limit 1");
|
||||
Line maxSortLine = lineMapper.selectOne(wrapper);
|
||||
|
||||
if (Objects.nonNull(maxSortLine) && Objects.nonNull(maxSortLine.getSort())) {
|
||||
return maxSortLine.getSort() + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public void handleSort(Integer level, Integer sort,Line line) {
|
||||
int lastSort;
|
||||
if (Objects.isNull(sort) || sort == 0) {
|
||||
lastSort = getNextSort(level);
|
||||
}else {
|
||||
lastSort = sort;
|
||||
}
|
||||
line.setSort(lastSort);
|
||||
}
|
||||
|
||||
|
||||
public Integer handleSortBatch(Integer currentSort, Line line) {
|
||||
line.setSort(currentSort);
|
||||
return currentSort + 1;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user