代码bug修改

This commit is contained in:
2023-07-12 14:44:51 +08:00
parent 025ceb209d
commit c7e0da8d1a
14 changed files with 181 additions and 70 deletions

View File

@@ -1,5 +1,6 @@
package com.njcn.web.config; package com.njcn.web.config;
import cn.hutool.core.util.StrUtil;
import com.njcn.web.pojo.annotation.DateTimeStrValid; import com.njcn.web.pojo.annotation.DateTimeStrValid;
import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidator;
@@ -21,7 +22,7 @@ public class DateTimeValidator implements ConstraintValidator<DateTimeStrValid,
@Override @Override
public boolean isValid(String value, ConstraintValidatorContext context) { public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null) { if (StrUtil.isBlank(value)) {
return true; return true;
} }
String format = dateTime.format(); String format = dateTime.format();

View File

@@ -3,6 +3,7 @@ package com.njcn.device.biz.pojo.dto;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* pqs * pqs
@@ -22,6 +23,11 @@ public class LineDevGetDTO {
*/ */
private String pointId; private String pointId;
/**
* 装置监测点索引集合
*/
private List<String> monitorIds;
/** /**
* 监测点电压等级 * 监测点电压等级
*/ */

View File

@@ -0,0 +1,23 @@
package com.njcn.device.pms.pojo.dto;
import lombok.Data;
import java.time.LocalDateTime;
/**
* pqs
*
* @author cdf
* @date 2023/7/10
*/
@Data
public class MonitorDevInfoDTO {
private String monitorId;
private String terminalId;
private LocalDateTime updateTime;
}

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pms.pojo.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* @author hongawen * @author hongawen
@@ -42,6 +43,8 @@ public class PmsMonitorBaseDTO implements Serializable {
*/ */
private String terminalId; private String terminalId;
private LocalDateTime updateTime;
/*** /***
* 监测线路名称 * 监测线路名称

View File

@@ -135,7 +135,23 @@ public class CommTerminalController extends BaseController {
public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) { public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval(); TimeInterval timer = new TimeInterval();
String methodDescribe = getMethodDescribe("deptGetDevice"); String methodDescribe = getMethodDescribe("deptGetDevice");
List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam); List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam,0);
log.info("运行时长" + timer.intervalRestart());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 根据单位获取单位下的装置以及装置下的监测点
* @author cdf
* @date 2023/5/10
*/
@PostMapping("deptGetDeviceAndMonitor")
@ApiOperation("根据单位获取装置以及监测点")
@ApiImplicitParam(name = "deptGetDeviceAndMonitor", value = "请求体", required = true)
public HttpResult<List<DeptGetDeviceDTO>> deptGetDeviceAndMonitor(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
String methodDescribe = getMethodDescribe("deptGetDeviceAndMonitor");
List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam,1);
log.info("运行时长" + timer.intervalRestart()); log.info("运行时长" + timer.intervalRestart());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }

View File

@@ -75,4 +75,11 @@ public interface MonitorMapper extends BaseMapper<Monitor> {
* @return MonitorVO * @return MonitorVO
*/ */
MonitorVO getPwMonitorTerminal(@Param("id")String id); MonitorVO getPwMonitorTerminal(@Param("id")String id);
/**
* 获取主网监测点装置信息
* @author cdf
* @date 2023/7/10
*/
} }

View File

@@ -268,7 +268,7 @@
<select id="getDisMonitorAllList" resultType="com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO"> <select id="getDisMonitorAllList" resultType="com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO">
SELECT SELECT
t.org_id orgId,t.id monitorId,b.Terminal_Id terminalId,t.Voltage_Level voltageLevel,t.powerrId,t.Line_Id,t.lineType t.Update_Time,t.org_id orgId,t.id monitorId,b.Terminal_Id terminalId,t.Voltage_Level voltageLevel,t.powerrId,t.Line_Id,t.lineType
FROM FROM
( (
( (
@@ -291,6 +291,7 @@
WHERE STATUS = 1 ) WHERE STATUS = 1 )
) t ) t
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
left join pms_terminal ter on b.Terminal_Id = ter.id
<where> <where>
<if test="type == 1"> <if test="type == 1">
powerrId = #{subId} powerrId = #{subId}

View File

@@ -57,7 +57,7 @@ public interface CommTerminalService {
* @author cdf * @author cdf
* @date 2023/5/10 * @date 2023/5/10
*/ */
List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam); List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type);
/** /**
* 根据单位获取所有装置 * 根据单位获取所有装置

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pms.service.ledgerManger.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.common.ServerEnum; import com.njcn.common.pojo.enums.common.ServerEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
@@ -29,9 +30,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -76,12 +75,9 @@ public class CommTerminalServiceImpl implements CommTerminalService {
private final PowerGenerationUserMapper powerGenerationUserMapper; private final PowerGenerationUserMapper powerGenerationUserMapper;
/** /**
* 基础获取单位信息 * 基础获取单位信息
*
* @author cdf * @author cdf
* @date 2023/5/10 * @date 2023/5/10
*/ */
@@ -242,17 +238,36 @@ public class CommTerminalServiceImpl implements CommTerminalService {
} }
@Override @Override
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam) { public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam, Integer type) {
List<DeptGetDeviceDTO> result = new ArrayList<>(); List<DeptGetDeviceDTO> result = new ArrayList<>();
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam); List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
List<PmsTerminal> pmsTerminalList = terminalMapper.selectList(new LambdaQueryWrapper<PmsTerminal>().eq(PmsTerminal::getStatus,1)); List<Monitor> monitorList = monitorMapper.selectList(new LambdaQueryWrapper<Monitor>().select(Monitor::getId, Monitor::getTerminalId, Monitor::getOrgId).eq(Monitor::getStatus, 1));
Map<String, List<PmsTerminal>> map = pmsTerminalList.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId)); List<String> terminalIds = monitorList.stream().map(Monitor::getTerminalId).distinct().collect(Collectors.toList());
LambdaQueryWrapper<PmsTerminal> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(PmsTerminal::getId, terminalIds);
List<PmsTerminal> pmsTerminals = terminalMapper.selectList(lambdaQueryWrapper);
Map<String, List<PmsTerminal>> map = pmsTerminals.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId));
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0); List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0);
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId)); List<String> pwTerminalIds = pmsMonitorBaseDTOList.stream().map(PmsMonitorBaseDTO::getTerminalId).distinct().collect(Collectors.toList());
lambdaQueryWrapper.clear();
lambdaQueryWrapper.in(PmsTerminal::getId, pwTerminalIds);
List<PmsTerminal> pwPmsTerminals = terminalMapper.selectList(lambdaQueryWrapper);
Map<String, List<PmsTerminal>> mapPms = pwPmsTerminals.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId));
Map<String, List<Monitor>> monitorMap = new HashMap<>();
Map<String, List<PmsMonitorBaseDTO>> pwMonitorMap = new HashMap<>();
if (type == 1) {
//获取装置接入的监测点
monitorMap = monitorList.stream().collect(Collectors.groupingBy(Monitor::getTerminalId));
pwMonitorMap = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getTerminalId));
}
Map<String, List<Monitor>> finalMonitorMap = monitorMap;
Map<String, List<PmsMonitorBaseDTO>> finalPwMonitorMap = pwMonitorMap;
temDept.forEach(item -> { temDept.forEach(item -> {
DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO(); DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO();
deptGetDeviceDTO.setUnitId(item.getUnitId()); deptGetDeviceDTO.setUnitId(item.getUnitId());
@@ -267,8 +282,13 @@ public class CommTerminalServiceImpl implements CommTerminalService {
map.get(i).forEach(dev -> { map.get(i).forEach(dev -> {
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO(); LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
lineDevGetDTO.setDevId(dev.getId()); lineDevGetDTO.setDevId(dev.getId());
lineDevGetDTO.setType(1); lineDevGetDTO.setType(0);
lineDevGetDTO.setUpdateTime(dev.getUpdateTime()); lineDevGetDTO.setUpdateTime(dev.getUpdateTime());
if(type == 1) {
if (finalMonitorMap.containsKey(dev.getId())) {
lineDevGetDTO.setMonitorIds(finalMonitorMap.get(dev.getId()).stream().map(Monitor::getId).distinct().collect(Collectors.toList()));
}
}
devGetDTOList.add(lineDevGetDTO); devGetDTOList.add(lineDevGetDTO);
}); });
} }
@@ -276,9 +296,14 @@ public class CommTerminalServiceImpl implements CommTerminalService {
if (mapPms.containsKey(i)) { if (mapPms.containsKey(i)) {
mapPms.get(i).forEach(dev -> { mapPms.get(i).forEach(dev -> {
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO(); LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
lineDevGetDTO.setDevId(dev.getTerminalId()); lineDevGetDTO.setDevId(dev.getId());
lineDevGetDTO.setType(1); lineDevGetDTO.setType(1);
lineDevGetDTO.setUpdateTime(dev.getUpdateTime());
if(type == 1) {
if (finalPwMonitorMap.containsKey(dev.getId())) {
lineDevGetDTO.setMonitorIds(finalMonitorMap.get(dev.getId()).stream().map(Monitor::getId).distinct().collect(Collectors.toList()));
}
}
devGetDTOListPw.add(lineDevGetDTO); devGetDTOListPw.add(lineDevGetDTO);
}); });
} }
@@ -418,7 +443,6 @@ public class CommTerminalServiceImpl implements CommTerminalService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String updatePmsOverLimit() { public String updatePmsOverLimit() {

View File

@@ -131,11 +131,26 @@ public class CommTerminalController extends BaseController {
public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) { public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval(); TimeInterval timer = new TimeInterval();
String methodDescribe = getMethodDescribe("deptGetDevice"); String methodDescribe = getMethodDescribe("deptGetDevice");
List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam); List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam,0);
log.info("运行时长" + timer.intervalRestart()); log.info("运行时长" + timer.intervalRestart());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
/**
* 根据单位获取单位下的装置以及装置下的监测点
* @author cdf
* @date 2023/5/10
*/
@PostMapping("deptGetDeviceAndMonitor")
@ApiOperation("根据单位获取装置以及监测点")
@ApiImplicitParam(name = "deptGetDeviceAndMonitor", value = "请求体", required = true)
public HttpResult<List<DeptGetDeviceDTO>> deptGetDeviceAndMonitor(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval();
String methodDescribe = getMethodDescribe("deptGetDeviceAndMonitor");
List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam,1);
log.info("运行时长" + timer.intervalRestart());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/** /**
* 根据单站id获取监测点信息 * 根据单站id获取监测点信息

View File

@@ -57,7 +57,7 @@ public interface CommTerminalService {
* @author cdf * @author cdf
* @date 2023/5/10 * @date 2023/5/10
*/ */
List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam); List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type);
/** /**
* 根据电站和母线id获取监测点信息 * 根据电站和母线id获取监测点信息

View File

@@ -153,7 +153,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
} }
@Override @Override
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam) { public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type) {
List<DeptGetDeviceDTO> result = new ArrayList<>(); List<DeptGetDeviceDTO> result = new ArrayList<>();
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam); List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),3); Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),3);

View File

@@ -108,7 +108,6 @@ public class SupvPlanParam extends BaseParam {
* 计划执行开始时间 * 计划执行开始时间
*/ */
@ApiModelProperty(value = "计划执行开始时间",required = true) @ApiModelProperty(value = "计划执行开始时间",required = true)
@NotNull(message = "计划执行开始时间不可为空")
@DateTimeStrValid(message = "计划执行开始时间格式有误") @DateTimeStrValid(message = "计划执行开始时间格式有误")
private String effectStartTime; private String effectStartTime;
@@ -116,7 +115,6 @@ public class SupvPlanParam extends BaseParam {
* 计划执行结束时间 * 计划执行结束时间
*/ */
@ApiModelProperty(value = "计划执行结束时间",required = true) @ApiModelProperty(value = "计划执行结束时间",required = true)
@NotNull(message = "计划执行结束时间不可为空")
@DateTimeStrValid(message = "计划执行结束时间格式有误") @DateTimeStrValid(message = "计划执行结束时间格式有误")
private String effectEndTime; private String effectEndTime;
@@ -132,7 +130,6 @@ public class SupvPlanParam extends BaseParam {
*/ */
@ApiModelProperty(value = "电能质量问题发生时间",required = true) @ApiModelProperty(value = "电能质量问题发生时间",required = true)
@DateTimeStrValid(message = "电能质量问题发生时间格式有误",format = "yyyy-MM-dd HH:mm:ss") @DateTimeStrValid(message = "电能质量问题发生时间格式有误",format = "yyyy-MM-dd HH:mm:ss")
@NotBlank(message = "电能质量问题发生时间不可为空")
private String problemOcTime; private String problemOcTime;
/** /**

View File

@@ -79,10 +79,20 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam, supvPlan); BeanUtil.copyProperties(supvPlanParam, supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())) {
supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime())); supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime()));
}
if(StrUtil.isNotBlank(supvPlanParam.getEffectStartTime())) {
supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime())); supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime()));
}
if(StrUtil.isNotBlank(supvPlanParam.getProblemOcTime())) {
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
}
if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())) {
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
}
supvPlan.setIsUploadHead(0); supvPlan.setIsUploadHead(0);
supvPlan.setPlanUserId(RequestUtil.getUserIndex()); supvPlan.setPlanUserId(RequestUtil.getUserIndex());
this.save(supvPlan); this.save(supvPlan);
@@ -95,10 +105,18 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam, supvPlan); BeanUtil.copyProperties(supvPlanParam, supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())) {
supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime())); supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime()));
}
if(StrUtil.isNotBlank(supvPlanParam.getEffectStartTime())) {
supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime())); supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime()));
}
if(StrUtil.isNotBlank(supvPlanParam.getProblemOcTime())) {
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
}
if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())) {
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
}
this.updateById(supvPlan); this.updateById(supvPlan);
return true; return true;
} }