1.添加终端周期检测功能
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.njcn.device.pq.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-07-06
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class TerminalCheckParam extends BaseParam {
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,6 +23,7 @@ public class LineDetail{
|
||||
/**
|
||||
* 监测点序号
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.device.pq.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-07-06
|
||||
* @Description: 终端检测
|
||||
*/
|
||||
@Data
|
||||
public class TerminalCheckVO {
|
||||
|
||||
private String devId;
|
||||
|
||||
private String areaName;
|
||||
|
||||
private String bdName;
|
||||
|
||||
private String devName;
|
||||
|
||||
private String objName;
|
||||
|
||||
private LocalDate thisCheckTime;
|
||||
|
||||
private LocalDate nextCheckTime;
|
||||
|
||||
private LocalDate loginDate;
|
||||
|
||||
/**
|
||||
* 0.未逾期
|
||||
* 1.逾期
|
||||
*/
|
||||
private Integer checkStatus;
|
||||
|
||||
/**
|
||||
* 逾期时间
|
||||
*/
|
||||
private Integer overdueDay;
|
||||
|
||||
|
||||
}
|
||||
@@ -80,6 +80,7 @@ public class DeviceOnlineRate {
|
||||
private String comFlag;
|
||||
|
||||
@ApiModelProperty("最新数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime timeID;
|
||||
|
||||
@ApiModelProperty("在线率")
|
||||
|
||||
@@ -8,7 +8,9 @@ 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.pq.pojo.param.AlarmParam;
|
||||
import com.njcn.device.pq.pojo.param.TerminalCheckParam;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalAlarmVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalCheckVO;
|
||||
import com.njcn.device.pq.service.TerminalAlarmService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -87,4 +89,19 @@ public class TerminalAlarmController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 终端周期检测告警
|
||||
* @author cdf
|
||||
* @date 2022/5/23
|
||||
*/
|
||||
@PostMapping("/terminalCheckPage")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("终端检测告警")
|
||||
@ApiImplicitParam(name = "alarmParam", value = "告警类型")
|
||||
public HttpResult<Page<TerminalCheckVO>> terminalCheckPage(@RequestBody @Validated TerminalCheckParam terminalCheckParam){
|
||||
String methodDescribe = getMethodDescribe("alarmInfoList");
|
||||
Page<TerminalCheckVO> res = terminalAlarmService.terminalCheckPage(terminalCheckParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.po.Alarm;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalAlarmVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalCheckVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -41,4 +42,8 @@ public interface AlarmMapper extends BaseMapper<Alarm> {
|
||||
* @date 2022/5/23
|
||||
*/
|
||||
boolean updateAlarmInfo(@Param("type")String type,@Param("devLineId")String devLineId,@Param("processTime")LocalDateTime processTime,@Param("userIndex")String userIndex);
|
||||
|
||||
|
||||
Page<TerminalCheckVO> terminalCheckPage(Page<TerminalCheckVO> page);
|
||||
|
||||
}
|
||||
|
||||
@@ -158,5 +158,41 @@ ORDER BY
|
||||
</update>
|
||||
|
||||
|
||||
<select id="terminalCheckPage" resultType="TerminalCheckVO">
|
||||
SELECT
|
||||
dev.id AS devId,
|
||||
dev.NAME AS devName,
|
||||
dept.NAME AS areaName,
|
||||
bd.name AS bdName,
|
||||
detail.obj_name AS objName,
|
||||
dev_detail.this_time_check AS thisCheckTime,
|
||||
dev_detail.next_time_check AS nextCheckTime,
|
||||
dev_detail.login_time AS loginDate,
|
||||
DATEDIFF(
|
||||
day,
|
||||
COALESCE(CAST(dev_detail.next_time_check AS DATE), CURRENT_DATE + INTERVAL '365' DAY),
|
||||
CURRENT_DATE
|
||||
) AS overdueDay,
|
||||
CASE
|
||||
WHEN DATEDIFF(
|
||||
day,
|
||||
COALESCE(CAST(dev_detail.next_time_check AS DATE), CURRENT_DATE + INTERVAL '365' DAY),
|
||||
CURRENT_DATE
|
||||
) > 0 THEN 1
|
||||
ELSE 0
|
||||
END AS checkStatus
|
||||
FROM
|
||||
pq_line line
|
||||
INNER JOIN pq_line_detail detail ON line.id = detail.id
|
||||
INNER JOIN pq_line bus ON line.pid = bus.id
|
||||
INNER JOIN pq_line dev ON bus.pid = dev.id
|
||||
INNER JOIN pq_device dev_detail ON dev.id = dev_detail.id
|
||||
INNER JOIN pq_line bd ON dev.pid = bd.id
|
||||
INNER JOIN pq_dept_line dept_line ON line.id = dept_line.line_id
|
||||
INNER JOIN sys_dept dept ON dept_line.id = dept.id AND dept.type = 0
|
||||
order by overdueDay desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.param.AlarmParam;
|
||||
import com.njcn.device.pq.pojo.param.TerminalCheckParam;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalAlarmVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalCheckVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,4 +37,7 @@ public interface TerminalAlarmService {
|
||||
* @date 2022/5/23
|
||||
*/
|
||||
boolean updateAlarmInfo(String type,String devLineId);
|
||||
|
||||
|
||||
Page<TerminalCheckVO> terminalCheckPage(TerminalCheckParam terminalCheckParam);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pq.mapper.AlarmMapper;
|
||||
import com.njcn.device.pq.pojo.param.AlarmParam;
|
||||
import com.njcn.device.pq.pojo.param.TerminalCheckParam;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalAlarmVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalCheckVO;
|
||||
import com.njcn.device.pq.service.TerminalAlarmService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -47,4 +53,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
|
||||
public boolean updateAlarmInfo(String type, String devLineId) {
|
||||
return alarmMapper.updateAlarmInfo(type,devLineId,LocalDateTime.now(),RequestUtil.getUserIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<TerminalCheckVO> terminalCheckPage(TerminalCheckParam terminalCheckParam) {
|
||||
Page<TerminalCheckVO> page = new Page<>(PageFactory.getPageNum(terminalCheckParam),PageFactory.getPageSize(terminalCheckParam));
|
||||
Page<TerminalCheckVO> pageResult = alarmMapper.terminalCheckPage(page);
|
||||
return pageResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user