1.技术监督:国网上送接口修改

This commit is contained in:
wr
2023-07-10 18:52:30 +08:00
parent bd8d416bb0
commit 0a3e91aaca
2 changed files with 43 additions and 13 deletions

View File

@@ -108,10 +108,19 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
return Collections.emptyList(); return Collections.emptyList();
} }
for (RStatOrgVO rStatOrgVO : result) { for (RStatOrgVO rStatOrgVO : result) {
rStatOrgVO.setEventMeasurementRatioAverage(String.valueOf(Double.parseDouble( if(rStatOrgVO.getEventMeasurementAverage()!=0&&rStatOrgVO.getEffectiveMeasurementAverage()!=0){
df.format(((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0)) * 100)))); rStatOrgVO.setEventMeasurementRatioAverage(String.valueOf(Double.parseDouble(
rStatOrgVO.setEventMeasurementRatioAccrued(String.valueOf(Double.parseDouble( df.format(((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0)) * 100))));
df.format(((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0)) * 100)))); }else{
rStatOrgVO.setEventMeasurementRatioAverage("0");
}
if(rStatOrgVO.getEventMeasurementAccrued()!=0&&rStatOrgVO.getEffectiveMeasurementAccrued()!=0){
rStatOrgVO.setEventMeasurementRatioAccrued(String.valueOf(Double.parseDouble(
df.format(((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0)) * 100))));
}else{
rStatOrgVO.setEventMeasurementRatioAccrued("0");
}
} }
// 匹配单位名称 // 匹配单位名称
Map<String, DeptDTO> deptDTOMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, DeptDTO -> DeptDTO)); Map<String, DeptDTO> deptDTOMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, DeptDTO -> DeptDTO));
@@ -186,8 +195,17 @@ public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOf
rStatEventOrgVO.setEffectiveMeasurementAccrued(pos.get(0).getEffectiveMeasurementAccrued()); rStatEventOrgVO.setEffectiveMeasurementAccrued(pos.get(0).getEffectiveMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementAverage(pos.get(0).getEventMeasurementAverage()); rStatEventOrgVO.setEventMeasurementAverage(pos.get(0).getEventMeasurementAverage());
rStatEventOrgVO.setEventMeasurementAccrued(pos.get(0).getEventMeasurementAccrued()); rStatEventOrgVO.setEventMeasurementAccrued(pos.get(0).getEventMeasurementAccrued());
rStatEventOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAverage() * 1.0) / (pos.get(0).getEffectiveMeasurementAverage() * 1.0))) * 100);
rStatEventOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAccrued() * 1.0) / (pos.get(0).getEffectiveMeasurementAccrued() * 1.0))) * 100); if(rStatEventOrgVO.getEventMeasurementAverage()!=0&&rStatEventOrgVO.getEffectiveMeasurementAverage()!=0){
rStatEventOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAverage() * 1.0) / (pos.get(0).getEffectiveMeasurementAverage() * 1.0))) * 100);
}else{
rStatEventOrgVO.setEventMeasurementRatioAverage(0.0);
}
if(rStatEventOrgVO.getEventMeasurementAccrued()!=0&&rStatEventOrgVO.getEffectiveMeasurementAccrued()!=0){
rStatEventOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((pos.get(0).getEventMeasurementAccrued() * 1.0) / (pos.get(0).getEffectiveMeasurementAccrued() * 1.0))) * 100);
}else{
rStatEventOrgVO.setEventMeasurementRatioAccrued(0.0);
}
rStatEventOrgVO.setDataType(pos.get(0).getDataType()); rStatEventOrgVO.setDataType(pos.get(0).getDataType());
} }
// 暂态指标赋值 // 暂态指标赋值

View File

@@ -3,6 +3,7 @@ package com.njcn.process.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
@@ -177,7 +178,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//TODO 调用国网接口 //TODO 调用国网接口
// Map map = postStatsUrl(getUrl(1), null, supvPlanList); // Map map = postStatsUrl(getUrl(1), null, supvPlanList);
JSONArray objects = new JSONArray(Collections.singletonList(supvPlanList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督工作计划:" + s + "结束----");
for(SupvPlan supvPlan: supvPlanList){ for(SupvPlan supvPlan: supvPlanList){
SupvPlan supvPlanPO = new SupvPlan(); SupvPlan supvPlanPO = new SupvPlan();
supvPlanPO.setPlanId(supvPlan.getPlanId()); supvPlanPO.setPlanId(supvPlan.getPlanId());
@@ -231,7 +234,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
// 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口 // 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口
// Map map = postStatsUrl(getUrl(2), null, supvProblemList); // Map map = postStatsUrl(getUrl(2), null, supvProblemList);
// Map map = postStatsUrl(getUrl(3), null, supvProblemList); // Map map = postStatsUrl(getUrl(3), null, supvProblemList);
JSONArray objects = new JSONArray(Collections.singletonList(supvProblemList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督实施问题:" + s + "结束----");
for(SupvProblem supvProblem:supvProblemList){ for(SupvProblem supvProblem:supvProblemList){
SupvProblem supvProblemPO = new SupvProblem(); SupvProblem supvProblemPO = new SupvProblem();
supvProblemPO.setProblemId(supvProblem.getProblemId()); supvProblemPO.setProblemId(supvProblem.getProblemId());
@@ -244,11 +249,14 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
@Override @Override
public boolean pushFile(List<String> busIds) throws IOException { public boolean pushFile(List<String> busIds) throws IOException {
LambdaQueryWrapper<SupvFile> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvFile::getBusiId,busIds); lambdaQueryWrapper.in(SupvFile::getBusiId,busIds);
List<SupvFile> supvFiles = supvFileMapper.selectList(lambdaQueryWrapper); List<SupvFile> supvFiles = supvFileMapper.selectList(lambdaQueryWrapper);
if(supvFiles.size()>100){ if(supvFiles.size()>100){
throw new BusinessException("一次最多上送100条数据"); throw new BusinessException("一次最多上送100条数据");
} }
JSONArray objects = new JSONArray(Collections.singletonList(supvFiles));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送附件接口:" + s + "结束----");
//TODO 调用上送接口 //TODO 调用上送接口
// for (SupvFile supvFile : supvFiles) { // for (SupvFile supvFile : supvFiles) {
// Map map = postFileUrl(getUrl(4), null, supvFile); // Map map = postFileUrl(getUrl(4), null, supvFile);
@@ -259,7 +267,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
@Override @Override
public boolean pushMonthReportStatistic(List<String> monthReportId) { public boolean pushMonthReportStatistic(List<String> monthReportId) {
LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupvReportM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvReportM::getMonthReportId,monthReportId); lambdaQueryWrapper.in(SupvReportM::getMonthReportId,monthReportId);
List<SupvReportM> supvReportMList = supvReportMMapper.selectList(lambdaQueryWrapper); List<SupvReportM> supvReportMList = supvReportMMapper.selectList(lambdaQueryWrapper);
if(supvReportMList.size()>100){ if(supvReportMList.size()>100){
@@ -267,7 +275,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
} }
//TODO 调用上送接口 //TODO 调用上送接口
// Map map = postStatsUrl(getUrl(5), null, supvReportMList); // Map map = postStatsUrl(getUrl(5), null, supvReportMList);
JSONArray objects = new JSONArray(Collections.singletonList(supvReportMList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督月报统计数据接口:" + s + "结束----");
for(SupvReportM supvReportM : supvReportMList){ for(SupvReportM supvReportM : supvReportMList){
SupvReportM supvReportMPO = new SupvReportM(); SupvReportM supvReportMPO = new SupvReportM();
supvReportMPO.setMonthReportId(supvReportM.getMonthReportId()); supvReportMPO.setMonthReportId(supvReportM.getMonthReportId());
@@ -297,7 +307,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//TODO //TODO
// Map map = postStatsUrl(getUrl(6), null, supvPlanList); // Map map = postStatsUrl(getUrl(6), null, supvPlanList);
JSONArray objects = new JSONArray(Collections.singletonList(supvPlanList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口:" + s + "结束----");
for(SupvPlan supvPlan : supvPlanList) { for(SupvPlan supvPlan : supvPlanList) {
supvPlan.setIsUploadHead(2); supvPlan.setIsUploadHead(2);
supvPlanMapper.updateById(supvPlan); supvPlanMapper.updateById(supvPlan);
@@ -396,7 +408,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
* @return * @return
*/ */
public static String getUrl(Integer type){ public static String getUrl(Integer type){
String url="http://ip:port"; String url="http://25.36.214.86:32234";
switch (type){ switch (type){
case 1: case 1: