1.添加终端周期检测功能
This commit is contained in:
@@ -2,6 +2,10 @@ package com.njcn.device.pq.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
@@ -10,4 +14,21 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class TerminalCheckParam extends BaseParam {
|
||||
|
||||
private String devId;
|
||||
|
||||
private String objId;
|
||||
|
||||
private String objName;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate thisCheckTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate nextCheckTime;
|
||||
|
||||
/**
|
||||
* 检测报告
|
||||
*/
|
||||
private String checkUrl;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-07-07
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 监测对象附件
|
||||
*/
|
||||
@Data
|
||||
@TableName("SUPERVISION_USER_REPORT_FILE")
|
||||
public class SupervisionUserReportFile {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测报告
|
||||
*/
|
||||
private String checkUrl;
|
||||
|
||||
/**
|
||||
* 历史检测报告
|
||||
*/
|
||||
private String checkHistoryUrl;
|
||||
|
||||
/**
|
||||
* 评估报告
|
||||
*/
|
||||
private String assessUrl;
|
||||
|
||||
/**
|
||||
* 其他附件
|
||||
*/
|
||||
private String otherUrl;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
//package com.njcn.device.pq.pojo.po;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
||||
//import lombok.Data;
|
||||
//import org.influxdb.annotation.Column;
|
||||
//import org.influxdb.annotation.Measurement;
|
||||
//
|
||||
//import java.time.Instant;
|
||||
//
|
||||
///**
|
||||
// * @version 1.0.0
|
||||
// * @author: chenchao
|
||||
// * @date: 2022/06/22 19:03
|
||||
// */
|
||||
//@Data
|
||||
//@Measurement(name = "pqs_terminal_logs")
|
||||
//public class TerminalLogs {
|
||||
//
|
||||
// @Column(name = "time")
|
||||
// private Instant timeId;
|
||||
//
|
||||
// @Column(name = "line_id")
|
||||
// private String lineId;
|
||||
//
|
||||
// @Column(name = "terminal_type")
|
||||
// private String terminalType;
|
||||
//
|
||||
// @Column(name = "update_by")
|
||||
// private String updateBy;
|
||||
//
|
||||
// @Column(name = "terminal_describe")
|
||||
// private String terminalDescribe;
|
||||
//
|
||||
//}
|
||||
@@ -21,6 +21,8 @@ public class TerminalCheckVO {
|
||||
|
||||
private String devName;
|
||||
|
||||
private String objId;
|
||||
|
||||
private String objName;
|
||||
|
||||
private LocalDate thisCheckTime;
|
||||
@@ -40,5 +42,10 @@ public class TerminalCheckVO {
|
||||
*/
|
||||
private Integer overdueDay;
|
||||
|
||||
/**
|
||||
* 检测报告
|
||||
*/
|
||||
private String checkUrl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -164,10 +164,12 @@ ORDER BY
|
||||
dev.NAME AS devName,
|
||||
dept.NAME AS areaName,
|
||||
bd.name AS bdName,
|
||||
detail.obj_id AS objId,
|
||||
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,
|
||||
files.CHECK_URL as checkUrl,
|
||||
DATEDIFF(
|
||||
day,
|
||||
COALESCE(CAST(dev_detail.next_time_check AS DATE), CURRENT_DATE + INTERVAL '365' DAY),
|
||||
@@ -190,6 +192,7 @@ ORDER BY
|
||||
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
|
||||
LEFT JOIN SUPERVISION_USER_REPORT_FILE files on detail.obj_id = files.id
|
||||
order by overdueDay desc
|
||||
</select>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.pq.pojo.param.TerminalCheckParam;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
@@ -19,6 +20,7 @@ import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jdk.nashorn.internal.ir.Terminal;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -147,4 +149,15 @@ public class UserLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping("/userCheckUpload")
|
||||
@ApiOperation("周期检测")
|
||||
@ApiImplicitParam(name = "userReportParam", value = "实体参数", required = true)
|
||||
public HttpResult<Boolean> userCheckUpload(@RequestBody @Validated TerminalCheckParam terminalCheckParam) {
|
||||
String methodDescribe = getMethodDescribe("addUserReport");
|
||||
Boolean f = userReportPOService.userCheckUpload(terminalCheckParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, f, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.SupervisionUserReportFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-07-07
|
||||
* @Description:
|
||||
*/
|
||||
@Mapper
|
||||
public interface SupervisionUserReportFileMapper extends BaseMapper<SupervisionUserReportFile> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.po.SupervisionUserReportFile;
|
||||
|
||||
public interface SupervisionUserReportFileService extends IService<SupervisionUserReportFile> {
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.param.TerminalCheckParam;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
@@ -90,4 +91,7 @@ public interface UserLedgerService extends IService<UserReportPO> {
|
||||
* @return
|
||||
*/
|
||||
UserReportVO getUserReportById(String id);
|
||||
|
||||
|
||||
Boolean userCheckUpload(TerminalCheckParam terminalCheckParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.SupervisionUserReportFileMapper;
|
||||
import com.njcn.device.pq.pojo.po.SupervisionUserReportFile;
|
||||
import com.njcn.device.userledger.service.SupervisionUserReportFileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-07-07
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
public class SupervisionUserReportFileServiceImpl extends ServiceImpl<SupervisionUserReportFileMapper, SupervisionUserReportFile>
|
||||
implements SupervisionUserReportFileService {
|
||||
|
||||
}
|
||||
@@ -17,17 +17,19 @@ 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.device.mapper.DeviceMapper;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.pojo.param.TerminalCheckParam;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.SupervisionUserReportFile;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.userledger.mapper.SupervisionUserReportFileMapper;
|
||||
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
|
||||
import com.njcn.device.userledger.mapper.UserReportPOMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.device.userledger.service.UserReportProjectPOService;
|
||||
import com.njcn.device.userledger.service.UserReportSensitivePOService;
|
||||
import com.njcn.device.userledger.service.UserReportSubstationPOService;
|
||||
import com.njcn.device.userledger.service.*;
|
||||
import com.njcn.supervision.enums.FlowStatusEnum;
|
||||
import com.njcn.supervision.enums.SupervisionResponseEnum;
|
||||
import com.njcn.supervision.enums.UserNatureEnum;
|
||||
@@ -52,6 +54,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -75,6 +78,8 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final LineMapper substationMapper;
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
private final SupervisionUserReportFileService supervisionUserReportFileService;
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
@Override
|
||||
public List<UserLedgerVO> selectUserList(UserReportParam userReportParam) {
|
||||
@@ -186,7 +191,10 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
List<Line> stationList = substationMapper.selectBatchIds(stationIds);
|
||||
stationList.forEach(line -> atationMap.put(line.getId(), line.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
List<String> ids = page.getRecords().stream().map(UserReportVO::getId).collect(Collectors.toList());
|
||||
List<SupervisionUserReportFile> supervisionUserReportFiles = supervisionUserReportFileService.lambdaQuery().in(SupervisionUserReportFile::getId,ids).list();
|
||||
Map<String,SupervisionUserReportFile> stringSupervisionUserReportFileMap = supervisionUserReportFiles.stream().collect(Collectors.toMap(SupervisionUserReportFile::getId, Function.identity()));
|
||||
page.getRecords().forEach(temp -> {
|
||||
temp.setStationId(atationMap.getOrDefault(temp.getStationId(),"/"));
|
||||
Integer needGovernance = 0;
|
||||
@@ -234,7 +242,16 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
}
|
||||
}
|
||||
temp.setType(type);
|
||||
if(stringSupervisionUserReportFileMap.containsKey(temp.getId())){
|
||||
SupervisionUserReportFile supervisionUserReportFile = stringSupervisionUserReportFileMap.get(temp.getId());
|
||||
temp.setCheckUrl(supervisionUserReportFile.getCheckUrl());
|
||||
//temp.setCheckHistoryUrl(supervisionUserReportFile.getCheckHistoryUrl());
|
||||
temp.setAssessUrl(supervisionUserReportFile.getAssessUrl());
|
||||
temp.setOtherUrl(supervisionUserReportFile.getOtherUrl());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -258,6 +275,13 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
userReportVO.setOrgName(dept.getName());
|
||||
}
|
||||
}
|
||||
|
||||
SupervisionUserReportFile supervisionUserReportFile = supervisionUserReportFileService.getOne(new LambdaQueryWrapper<SupervisionUserReportFile>().eq(SupervisionUserReportFile::getId,userReportPO.getId()));
|
||||
if(Objects.nonNull(supervisionUserReportFile)){
|
||||
userReportVO.setCheckUrl(supervisionUserReportFile.getCheckUrl());
|
||||
userReportVO.setAssessUrl(supervisionUserReportFile.getAssessUrl());
|
||||
userReportVO.setOtherUrl(supervisionUserReportFile.getOtherUrl());
|
||||
}
|
||||
/*
|
||||
根据用户性质获取自己特有的字段,此处需要特殊处理
|
||||
1、每个附件需要返回文件名称以及可以预览的url
|
||||
@@ -333,6 +357,7 @@ 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())){
|
||||
@@ -345,6 +370,13 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理需要上传的附件
|
||||
SupervisionUserReportFile supervisionUserReportFile = new SupervisionUserReportFile();
|
||||
supervisionUserReportFile.setId(userReportPO.getId());
|
||||
supervisionUserReportFile.setCheckUrl(userReportParam.getCheckUrl());
|
||||
supervisionUserReportFile.setAssessUrl(userReportParam.getAssessUrl());
|
||||
supervisionUserReportFile.setOtherUrl(userReportParam.getOtherUrl());
|
||||
supervisionUserReportFileService.saveOrUpdate(supervisionUserReportFile);
|
||||
|
||||
userReportPO = this.getById(userReportPO.getId());
|
||||
if (
|
||||
@@ -414,6 +446,21 @@ public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserR
|
||||
return this.baseMapper.getUserReportById(userReportVOQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean userCheckUpload(TerminalCheckParam terminalCheckParam) {
|
||||
SupervisionUserReportFile supervisionUserReportFile = new SupervisionUserReportFile();
|
||||
supervisionUserReportFile.setId(terminalCheckParam.getObjId());
|
||||
supervisionUserReportFile.setCheckUrl(terminalCheckParam.getCheckUrl());
|
||||
supervisionUserReportFileService.saveOrUpdate(supervisionUserReportFile);
|
||||
Device device = new Device();
|
||||
device.setId(terminalCheckParam.getDevId());
|
||||
device.setThisTimeCheck(terminalCheckParam.getThisCheckTime());
|
||||
device.setNextTimeCheck(terminalCheckParam.getNextCheckTime());
|
||||
deviceMapper.updateById(device);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断工程名称是否重复,如果重复则提示用户XXX已经创建该工程
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user