|
@@ -16,9 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
-import java.util.Comparator;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -99,23 +97,34 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
validatePageParam(reqDTO);
|
|
validatePageParam(reqDTO);
|
|
|
|
|
|
|
|
// 安全校验从主表获取
|
|
// 安全校验从主表获取
|
|
|
- FhzgReconResult result = reconResultMapper.selectById(reqDTO.getResultId());
|
|
|
|
|
|
|
+ FhzgReconResult result = reconResultMapper.selectById(reqDTO.getId());
|
|
|
Boolean safetyCheckPassed = Objects.nonNull(result) ? result.getFinalCheckIsSafe() : null;
|
|
Boolean safetyCheckPassed = Objects.nonNull(result) ? result.getFinalCheckIsSafe() : null;
|
|
|
|
|
|
|
|
- Page<FhzgReconSwitchSeq> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
|
|
|
- Page<FhzgReconSwitchSeq> resultPage = reconSwitchSeqMapper.selectPage(page,
|
|
|
|
|
|
|
+ Page<FhzgReconSwitchOp> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
|
|
|
+ Page<FhzgReconSwitchOp> resultPage = reconSwitchOpMapper.selectPage(page,
|
|
|
|
|
+ new LambdaQueryWrapper<FhzgReconSwitchOp>()
|
|
|
|
|
+ .eq(FhzgReconSwitchOp::getResultId, reqDTO.getId())
|
|
|
|
|
+ .orderByAsc(FhzgReconSwitchOp::getOpNo));
|
|
|
|
|
+
|
|
|
|
|
+ List<FhzgReconSwitchSeq> switchSeqList = reconSwitchSeqMapper.selectList(
|
|
|
new LambdaQueryWrapper<FhzgReconSwitchSeq>()
|
|
new LambdaQueryWrapper<FhzgReconSwitchSeq>()
|
|
|
- .eq(FhzgReconSwitchSeq::getResultId, reqDTO.getResultId())
|
|
|
|
|
- .orderByAsc(FhzgReconSwitchSeq::getSeqNo)
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ .eq(FhzgReconSwitchSeq::getResultId, reqDTO.getId()));
|
|
|
|
|
+ Map<String, Boolean> hotCheckMap = new HashMap<>();
|
|
|
|
|
+ switchSeqList.forEach(i -> {
|
|
|
|
|
+ hotCheckMap.put(i.getOpenBreakerId(), i.getHotCheckIsSafe());
|
|
|
|
|
+ hotCheckMap.put(i.getCloseBreakerId(), i.getHotCheckIsSafe());
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
PageVO<ReconSwitchSeqVO> voPage = new PageVO<>();
|
|
PageVO<ReconSwitchSeqVO> voPage = new PageVO<>();
|
|
|
voPage.setTotal(resultPage.getTotal());
|
|
voPage.setTotal(resultPage.getTotal());
|
|
|
voPage.setPageNum(resultPage.getCurrent());
|
|
voPage.setPageNum(resultPage.getCurrent());
|
|
|
voPage.setPageSize(resultPage.getSize());
|
|
voPage.setPageSize(resultPage.getSize());
|
|
|
- voPage.setRecords(resultPage.getRecords().stream()
|
|
|
|
|
- .map(seq -> buildSwitchSeqVO(seq, safetyCheckPassed))
|
|
|
|
|
- .collect(Collectors.toList()));
|
|
|
|
|
|
|
+ List<ReconSwitchSeqVO> collect = resultPage.getRecords().stream().map(this::buildSwitchSeqVO).collect(Collectors.toList());
|
|
|
|
|
+ collect.forEach(i -> {
|
|
|
|
|
+ i.setSafetyCheckPassed(safetyCheckPassed);
|
|
|
|
|
+ i.setHotCheckPassed(hotCheckMap.get(i.getSwitchId()));
|
|
|
|
|
+ });
|
|
|
|
|
+ voPage.setRecords(collect);
|
|
|
return voPage;
|
|
return voPage;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -126,7 +135,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
Page<FhzgReconFeederResult> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
Page<FhzgReconFeederResult> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
|
Page<FhzgReconFeederResult> resultPage = reconFeederResultMapper.selectPage(page,
|
|
Page<FhzgReconFeederResult> resultPage = reconFeederResultMapper.selectPage(page,
|
|
|
new LambdaQueryWrapper<FhzgReconFeederResult>()
|
|
new LambdaQueryWrapper<FhzgReconFeederResult>()
|
|
|
- .eq(FhzgReconFeederResult::getResultId, reqDTO.getResultId())
|
|
|
|
|
|
|
+ .eq(FhzgReconFeederResult::getResultId, reqDTO.getId())
|
|
|
.orderByAsc(FhzgReconFeederResult::getFeederNo)
|
|
.orderByAsc(FhzgReconFeederResult::getFeederNo)
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -145,7 +154,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
Page<FhzgReconVolDetail> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
Page<FhzgReconVolDetail> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
|
Page<FhzgReconVolDetail> resultPage = reconVolDetailMapper.selectPage(page,
|
|
Page<FhzgReconVolDetail> resultPage = reconVolDetailMapper.selectPage(page,
|
|
|
new LambdaQueryWrapper<FhzgReconVolDetail>()
|
|
new LambdaQueryWrapper<FhzgReconVolDetail>()
|
|
|
- .eq(FhzgReconVolDetail::getResultId, reqDTO.getResultId())
|
|
|
|
|
|
|
+ .eq(FhzgReconVolDetail::getResultId, reqDTO.getId())
|
|
|
.orderByAsc(FhzgReconVolDetail::getDetailNo)
|
|
.orderByAsc(FhzgReconVolDetail::getDetailNo)
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -164,7 +173,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
Page<FhzgReconSwitchResultDetail> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
Page<FhzgReconSwitchResultDetail> page = new Page<>(reqDTO.getPageNum(), reqDTO.getPageSize());
|
|
|
Page<FhzgReconSwitchResultDetail> resultPage = reconSwitchResultDetailMapper.selectPage(page,
|
|
Page<FhzgReconSwitchResultDetail> resultPage = reconSwitchResultDetailMapper.selectPage(page,
|
|
|
new LambdaQueryWrapper<FhzgReconSwitchResultDetail>()
|
|
new LambdaQueryWrapper<FhzgReconSwitchResultDetail>()
|
|
|
- .eq(FhzgReconSwitchResultDetail::getResultId, reqDTO.getResultId())
|
|
|
|
|
|
|
+ .eq(FhzgReconSwitchResultDetail::getResultId, reqDTO.getId())
|
|
|
.orderByAsc(FhzgReconSwitchResultDetail::getDetailNo)
|
|
.orderByAsc(FhzgReconSwitchResultDetail::getDetailNo)
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -184,6 +193,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
private ReconSchemeVO buildSchemeVO(FhzgReconResult result) {
|
|
private ReconSchemeVO buildSchemeVO(FhzgReconResult result) {
|
|
|
ReconSchemeVO vo = new ReconSchemeVO();
|
|
ReconSchemeVO vo = new ReconSchemeVO();
|
|
|
vo.setId(result.getId());
|
|
vo.setId(result.getId());
|
|
|
|
|
+ vo.setSchemeName(result.getSchemeName());
|
|
|
vo.setEventId(result.getEventId());
|
|
vo.setEventId(result.getEventId());
|
|
|
vo.setIsRecommend(false);
|
|
vo.setIsRecommend(false);
|
|
|
vo.setSafetyCheckPassed(result.getFinalCheckIsSafe());
|
|
vo.setSafetyCheckPassed(result.getFinalCheckIsSafe());
|
|
@@ -258,16 +268,12 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private ReconSwitchSeqVO buildSwitchSeqVO(FhzgReconSwitchSeq seq, Boolean safetyCheckPassed) {
|
|
|
|
|
|
|
+ private ReconSwitchSeqVO buildSwitchSeqVO(FhzgReconSwitchOp seq) {
|
|
|
ReconSwitchSeqVO vo = new ReconSwitchSeqVO();
|
|
ReconSwitchSeqVO vo = new ReconSwitchSeqVO();
|
|
|
- vo.setSeqNo(seq.getSeqNo());
|
|
|
|
|
- vo.setCloseName(seq.getCloseName());
|
|
|
|
|
- vo.setCloseOperation(convertOperationType(seq.getCloseOperationType()));
|
|
|
|
|
- vo.setOpenName(seq.getOpenName());
|
|
|
|
|
- vo.setOpenOperation(convertOperationType(seq.getOpenOperationType()));
|
|
|
|
|
- vo.setIsThreeRemotely(isThreeRemotely(seq.getCloseAutoType()));
|
|
|
|
|
- vo.setHotCheckPassed(seq.getHotCheckIsSafe());
|
|
|
|
|
- vo.setSafetyCheckPassed(safetyCheckPassed);
|
|
|
|
|
|
|
+ vo.setSeqNo(seq.getOpNo());
|
|
|
|
|
+ vo.setSwitchId(seq.getBreakerId());
|
|
|
|
|
+ vo.setSwitchName(seq.getName());
|
|
|
|
|
+ vo.setIsThreeRemotely(isThreeRemotely(seq.getAutoType()));
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -291,7 +297,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
ReconLoadpointCompareVO vo = new ReconLoadpointCompareVO();
|
|
ReconLoadpointCompareVO vo = new ReconLoadpointCompareVO();
|
|
|
vo.setDetailNo(detail.getDetailNo());
|
|
vo.setDetailNo(detail.getDetailNo());
|
|
|
vo.setLoadPointName(detail.getName());
|
|
vo.setLoadPointName(detail.getName());
|
|
|
- vo.setLoadType(detail.getLoadType());
|
|
|
|
|
|
|
+ vo.setLoadType(convertLoadType(detail.getLoadType()));
|
|
|
vo.setVoltageBefore(detail.getBeforeU());
|
|
vo.setVoltageBefore(detail.getBeforeU());
|
|
|
vo.setVoltageAfter(detail.getAfterU());
|
|
vo.setVoltageAfter(detail.getAfterU());
|
|
|
vo.setLowVoltageBefore(detail.getBeforeUlv());
|
|
vo.setLowVoltageBefore(detail.getBeforeUlv());
|
|
@@ -305,6 +311,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
ReconSwitchCompareVO vo = new ReconSwitchCompareVO();
|
|
ReconSwitchCompareVO vo = new ReconSwitchCompareVO();
|
|
|
vo.setDetailNo(detail.getDetailNo());
|
|
vo.setDetailNo(detail.getDetailNo());
|
|
|
vo.setSwitchName(detail.getPsrId());
|
|
vo.setSwitchName(detail.getPsrId());
|
|
|
|
|
+ vo.setAutoType(convertAutoType(detail.getAutoType()));
|
|
|
vo.setStateChange(buildStateChange(detail.getBeforeState(), detail.getAfterState()));
|
|
vo.setStateChange(buildStateChange(detail.getBeforeState(), detail.getAfterState()));
|
|
|
vo.setCurrentBefore(detail.getBeforeI());
|
|
vo.setCurrentBefore(detail.getBeforeI());
|
|
|
vo.setCurrentAfter(detail.getAfterI());
|
|
vo.setCurrentAfter(detail.getAfterI());
|
|
@@ -314,7 +321,7 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void validatePageParam(ReconPageReqDTO reqDTO) {
|
|
private void validatePageParam(ReconPageReqDTO reqDTO) {
|
|
|
- if (Objects.isNull(reqDTO.getResultId())) {
|
|
|
|
|
|
|
+ if (Objects.isNull(reqDTO.getId())) {
|
|
|
throw new BusinessException("方案ID为空");
|
|
throw new BusinessException("方案ID为空");
|
|
|
}
|
|
}
|
|
|
if (Objects.isNull(reqDTO.getPageNum())) {
|
|
if (Objects.isNull(reqDTO.getPageNum())) {
|
|
@@ -336,9 +343,35 @@ public class ReconQueryServiceImpl implements ReconQueryService {
|
|
|
return operationType;
|
|
return operationType;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * close→合, open→分
|
|
|
|
|
+ */
|
|
|
|
|
+ private String convertAutoType(String operationType) {
|
|
|
|
|
+ if ("auto".equals(operationType)) {
|
|
|
|
|
+ return "自动";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("manual".equals(operationType)) {
|
|
|
|
|
+ return "手动";
|
|
|
|
|
+ }
|
|
|
|
|
+ return operationType;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * close→合, open→分
|
|
|
|
|
+ */
|
|
|
|
|
+ private String convertLoadType(String LoadType) {
|
|
|
|
|
+ if ("MV_CUSTOMER".equals(LoadType)) {
|
|
|
|
|
+ return "专变";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("MV_TRAN".equals(LoadType)) {
|
|
|
|
|
+ return "公变";
|
|
|
|
|
+ }
|
|
|
|
|
+ return LoadType;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/** 判断是否三遥开关 */
|
|
/** 判断是否三遥开关 */
|
|
|
private Boolean isThreeRemotely(String autoType) {
|
|
private Boolean isThreeRemotely(String autoType) {
|
|
|
- return "three_remotely".equals(autoType);
|
|
|
|
|
|
|
+ return "auto".equals(autoType);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 计算负载率(%) = 电流 / 额定电流 * 100 */
|
|
/** 计算负载率(%) = 电流 / 额定电流 * 100 */
|