1.前置交互日志扩展模糊查询
2.解决暂态时间12小时制的问题 3.优化文件工具类
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: sjzx
|
||||
active: @spring.profiles.active@
|
||||
@@ -102,8 +102,11 @@ public class FileStorageUtil {
|
||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||
}
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
filePath = dir;
|
||||
aliYunOssUtils.uploadFile(dir, multipartFile);
|
||||
filePath = dir.endsWith("/")?dir+getFileNameWithoutPath(multipartFile):dir+"/"+getFileNameWithoutPath(multipartFile);
|
||||
if (filePath.charAt(0) == '/') {
|
||||
filePath= filePath.substring(1);
|
||||
}
|
||||
aliYunOssUtils.uploadFile(filePath, multipartFile);
|
||||
} else {
|
||||
try {
|
||||
// 构建完整目录:基准目录 + dir子目录
|
||||
|
||||
@@ -125,6 +125,8 @@ public class LineIntegrityDataVO implements Serializable {
|
||||
private Integer algoDescribe;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "devType",value = "终端型号")
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty(name = "loadType",value = "干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
pldsdd.id AS lineGrade,
|
||||
pldsdd.Algo_Describe AS algoDescribe,
|
||||
pld.Load_Type AS loadType,
|
||||
pd.Dev_Type AS devType,
|
||||
pld.obj_id as objId
|
||||
FROM
|
||||
pq_line AS line
|
||||
|
||||
@@ -235,4 +235,10 @@ public interface LineService extends IService<Line> {
|
||||
* 终端运行状态修改时,同时调整监测点的运行状态
|
||||
*/
|
||||
void updateLineRunFlag(String id, Integer status);
|
||||
|
||||
/**
|
||||
* 自动修改验证pids是否正确
|
||||
*/
|
||||
void updatePids();
|
||||
|
||||
}
|
||||
|
||||
@@ -83,10 +83,9 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
List<String> deptList = Arrays.asList("130700000000", "130300000000", "130800000000", "130200000000", "131000000000");
|
||||
Dept data = deptFeignClient.getDeptById(deptLineParam.getId()).getData();
|
||||
if (deptList.contains(data.getArea())) {
|
||||
List<String> lineIds = list.stream().map(LineDetail::getId).collect(Collectors.toList());
|
||||
detailMapper.update(null, new LambdaUpdateWrapper<LineDetail>()
|
||||
.set(LineDetail::getActualArea, data.getArea())
|
||||
.in(LineDetail::getId, lineIds));
|
||||
.in(LineDetail::getId, ids));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
@@ -840,6 +842,82 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePids() {
|
||||
List<Line> list = this.list();
|
||||
List<String> strings = this.checkPidsError(list);
|
||||
if(CollUtil.isNotEmpty(strings)){
|
||||
for (String msg : strings) {
|
||||
// 1. 按 | 分割成三部分
|
||||
String[] parts = msg.split(" \\| ");
|
||||
// 2. 提取节点 ID
|
||||
String id = parts[0].replace("节点ID:", "").trim();
|
||||
// 3. 提取正确 pids(去掉括号)
|
||||
String newPids = parts[2].replace("正确pids:[", "").replace("]", "").trim();
|
||||
this.update(new LambdaUpdateWrapper<Line>()
|
||||
.set(Line::getPids, newPids)
|
||||
.eq(Line::getId, id));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 校验所有节点 pids 是否正确
|
||||
* 正确规则:去掉开头0 + 去掉自身ID,只保留祖先链
|
||||
*/
|
||||
public List<String> checkPidsError(List<Line> allList) {
|
||||
List<String> errorList = new ArrayList<>();
|
||||
Map<String, Line> idMap = allList.stream().collect(Collectors.toMap(Line::getId,Function.identity()));
|
||||
for (Line node : allList) {
|
||||
// 1. 生成正确格式的 pids(你的规则)
|
||||
String correctPids = getCorrectPids(node.getId(), idMap);
|
||||
// 2. 数据库存储的 pids
|
||||
String dbPids = node.getPids() == null ? "" : node.getPids().trim();
|
||||
// 3. 对比,不一致就是错误
|
||||
if (!correctPids.equals(dbPids)) {
|
||||
errorList.add("节点ID:" + node.getId() +
|
||||
" | 数据库pids:[" + dbPids +
|
||||
"] | 正确pids:[" + correctPids + "]");
|
||||
}
|
||||
}
|
||||
return errorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核心:生成【你要求】的正确 pids
|
||||
* 规则:
|
||||
* 1. 向上遍历所有祖先
|
||||
* 2. 去掉开头 0
|
||||
* 3. 去掉最后一位自身ID
|
||||
* 4. 用逗号拼接
|
||||
*/
|
||||
private String getCorrectPids(String nodeId, Map<String, Line> idMap) {
|
||||
Deque<String> pathDeque = new LinkedList<>();
|
||||
String currentId = nodeId;
|
||||
// 向上收集所有节点(包含自身 + 所有祖先 + 0)
|
||||
while (currentId != null && !currentId.isEmpty()) {
|
||||
Line node = idMap.get(currentId);
|
||||
if (ObjectUtil.isNotNull(node)) {
|
||||
// 头插,保证顺序正确
|
||||
pathDeque.addFirst(currentId);
|
||||
currentId = node.getPid();
|
||||
}
|
||||
}
|
||||
// 转列表
|
||||
List<String> path = new ArrayList<>(pathDeque);
|
||||
|
||||
// 1. 去掉开头的 0
|
||||
if (!path.isEmpty() && "0".equals(path.get(0))) {
|
||||
path.remove(0);
|
||||
}
|
||||
// 2. 去掉最后一位(自身ID)
|
||||
if (!path.isEmpty()) {
|
||||
path.remove(path.size() - 1);
|
||||
}
|
||||
// 拼接成最终正确 pids
|
||||
return String.join(",", path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class AdvanceEventDetailVO {
|
||||
private String sagsource;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss.SSS")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS",timezone = "GMT+8")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@ApiModelProperty(value = "持续时间,单位秒")
|
||||
|
||||
@@ -1,29 +1,22 @@
|
||||
package com.njcn.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalAlarmVO;
|
||||
import com.njcn.system.mapper.PqFrontLogsMapper;
|
||||
import com.njcn.system.mapper.UserLogMapper;
|
||||
import com.njcn.system.pojo.dto.PqFrontLogsDTO;
|
||||
import com.njcn.system.pojo.param.PqFrontLogsChildParam;
|
||||
import com.njcn.system.pojo.param.PqFrontLogsParam;
|
||||
import com.njcn.system.pojo.po.PqDashboardPage;
|
||||
import com.njcn.system.pojo.po.PqFrontLogs;
|
||||
import com.njcn.system.pojo.po.PqFrontLogsChild;
|
||||
import com.njcn.system.pojo.po.UserLog;
|
||||
import com.njcn.system.pojo.vo.PqFrontLogsVO;
|
||||
import com.njcn.system.service.IUserLogService;
|
||||
import com.njcn.system.service.PqFrontLogsChildService;
|
||||
import com.njcn.system.service.PqFrontLogsService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -99,19 +92,38 @@ public class PqFrontLogsServiceImpl extends ServiceImpl<PqFrontLogsMapper, PqFro
|
||||
public Page<PqFrontLogsVO> queryPage(PqFrontLogsParam baseParam) {
|
||||
QueryWrapper<PqFrontLogs> queryWrapper = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(baseParam.getSearchBeginTime()) && StringUtils.isNotBlank(baseParam.getSearchEndTime())) {
|
||||
queryWrapper.between("A.update_Time", baseParam.getSearchBeginTime()+" 00:00:00", baseParam.getSearchEndTime()+" 23:59:59");
|
||||
queryWrapper.between("A.update_Time", baseParam.getSearchBeginTime() + " 00:00:00", baseParam.getSearchEndTime() + " 23:59:59");
|
||||
}
|
||||
String searchValue = baseParam.getSearchValue();
|
||||
String level;
|
||||
if (StrUtil.equals(searchValue, "设备")) {
|
||||
level = "terminal";
|
||||
} else if (StrUtil.equals(searchValue, "监测点")) {
|
||||
level = "measurepoint";
|
||||
} else if (StrUtil.equals(searchValue, "进程")) {
|
||||
level = "process";
|
||||
} else {
|
||||
level = null;
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(baseParam.getSearchValue())){
|
||||
queryWrapper.like("line.name", baseParam.getSearchValue());
|
||||
if (StringUtils.isNotBlank(baseParam.getSearchValue())) {
|
||||
queryWrapper.and(x -> {
|
||||
x.like("line.name", baseParam.getSearchValue())
|
||||
.or()
|
||||
.like(StrUtil.isNotBlank(level),"a.level", level)
|
||||
.or()
|
||||
.like("sys.name", baseParam.getSearchValue());
|
||||
}
|
||||
);
|
||||
}
|
||||
queryWrapper.eq(StringUtils.isNotBlank(baseParam.getCode()),"A.code",baseParam.getCode());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(baseParam.getFrontType()),"A.front_type",baseParam.getFrontType()) ;
|
||||
|
||||
queryWrapper.eq(StringUtils.isNotBlank(baseParam.getCode()), "A.code", baseParam.getCode());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(baseParam.getFrontType()), "A.front_type", baseParam.getFrontType());
|
||||
|
||||
queryWrapper.orderByDesc("A.update_Time");
|
||||
Page<PqFrontLogsVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), queryWrapper);
|
||||
page.getRecords().forEach(temp->{
|
||||
if(Objects.equals(temp.getLevel(),"terminal")){
|
||||
Page<PqFrontLogsVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), queryWrapper);
|
||||
page.getRecords().forEach(temp -> {
|
||||
if (Objects.equals(temp.getLevel(), "terminal")) {
|
||||
temp.setLevel("设备");
|
||||
}else if(Objects.equals(temp.getLevel(),"measurepoint")){
|
||||
temp.setLevel("监测点");
|
||||
|
||||
Reference in New Issue
Block a user