1.添加终端周期检测功能

This commit is contained in:
2026-07-07 10:21:55 +08:00
parent 0d3dd0748c
commit 6ddbdbb5be
14 changed files with 204 additions and 24 deletions

View File

@@ -383,31 +383,31 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
.eq(Line::getState, DataStateEnum.ENABLE.getCode())
.in(Line::getName, subvNameList);
List<Line> subvRes = this.list(lineLambdaQueryWrapper);
if (!subvRes.isEmpty()) {
/* if (!subvRes.isEmpty()) {
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)) {
/* if (CollectionUtil.isNotEmpty(voltageName)) {
List<Line> voltageList = this.baseMapper.getVoltageListBySubId(subIndex, voltageName);
if (CollectionUtil.isNotEmpty(voltageList)) {
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, voltageList.stream().map(Line::getName).collect(Collectors.joining(";")));
}
}
}*/
//校验同一变电站下只能有唯一母线名称
List<String> addVoltage = deviceParam.getSubVoltageParam().stream().filter(item -> StrUtil.isBlank(item.getSubvIndex())).map(SubVoltageParam::getName).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(addVoltage)) {
/* if (CollectionUtil.isNotEmpty(addVoltage)) {
List<Line> voltageListBySubId = this.baseMapper.getVoltageListBySubId(subIndex, addVoltage);
if (CollectionUtil.isNotEmpty(voltageListBySubId)) {
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
@@ -751,10 +751,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
.notIn(Line::getId, subVIndexList)
.eq(Line::getPid, voltage.getPid());
List<Line> subVoltageList = this.list(lambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(subVoltageList)) {
/* if (CollectionUtil.isNotEmpty(subVoltageList)) {
List<String> repeatSubVNames = subVoltageList.stream().map(Line::getName).collect(Collectors.toList());
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, "已存在母线名称:" + String.join(";", repeatSubVNames));
}
}*/
}
}

View File

@@ -210,7 +210,10 @@
<select id="getDeviceByIdOnOrOff" resultType="com.njcn.device.pq.pojo.vo.TerminalBaseVO">
SELECT
t1.id devId,t1.name devName,t2.ip,t2.dev_type,t2.update_time,sub.name subName,gd.name gdName
case when
t3.obj_id is not null and t3.obj_id !='' then t3.obj_name
else sub.name end subName,
t1.id devId,t1.name devName,t2.ip,t2.dev_type,t2.update_time,gd.name gdName
FROM
pq_line t1,
pq_device t2,

View File

@@ -17,8 +17,10 @@ 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.LineDetailMapper;
import com.njcn.device.line.mapper.LineMapper;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.po.LineDetail;
import com.njcn.device.substation.mapper.SubstationMapper;
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
import com.njcn.device.userledger.mapper.UserReportPOMapper;
@@ -47,6 +49,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.regex.Matcher;
@@ -71,6 +74,7 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
private final UserReportSensitivePOService userReportSensitivePOService;
private final UserFeignClient userFeignClient;
private final LineMapper substationMapper;
private final LineDetailMapper lineDetailMapper;
@Override
public List<UserLedgerVO> selectUserList(UserReportParam userReportParam) {
@@ -300,6 +304,7 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
}
@Override
@Transactional(rollbackFor = Exception.class)
public String addUserReport(UserReportParam userReportParam) {
UserReportPO userReportPO = new UserReportPO();
BeanUtils.copyProperties(userReportParam, userReportPO);
@@ -328,6 +333,19 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
userReportPO.setDataType(0);
}
this.saveOrUpdate(userReportPO);
//需要同步更新pq_line_detail 表里的obj_name字段
if(Objects.nonNull(userReportParam.getDataType()) && userReportParam.getDataType() == 1){
if(StrUtil.isNotBlank(userReportPO.getId())){
List<LineDetail> lineDetailList = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().eq(LineDetail::getId, userReportPO.getId()));
if(CollUtil.isNotEmpty(lineDetailList)){
List<String> ids = lineDetailList.stream().map(LineDetail::getId).collect(Collectors.toList());
LineDetail lineDetail = new LineDetail();
lineDetail.setObjName(userReportPO.getProjectName());
lineDetailMapper.update(lineDetail,new LambdaUpdateWrapper<LineDetail>().in(LineDetail::getId,ids));
}
}
}
userReportPO = this.getById(userReportPO.getId());
if (
CollectionUtil.newArrayList(