国网上送代码调整

This commit is contained in:
cdf
2024-03-21 19:59:33 +08:00
parent e781ff082e
commit 0bc9186375
7 changed files with 113 additions and 169 deletions

View File

@@ -68,7 +68,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
@Override
public String sendType(MonitorParam.Info param) {
SysDicTreePO dicTree = null;
SysDicTreePO dicTree;
List<String> objTypeIds=new ArrayList<>();
LambdaQueryWrapper<Monitor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(param.getObjType().equals("987654321")){

View File

@@ -1,36 +0,0 @@
//package com.njcn.prepare.harmonic.api.line;
//
//import com.njcn.common.pojo.constant.ServerInfo;
//import com.njcn.common.pojo.response.HttpResult;
//import com.njcn.prepare.harmonic.api.line.fallback.ThsSuperviseClientFallbackFactory;
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//
//@FeignClient(
// value = ServerInfo.PREPARE_BOOT,//对应模块名
// path = "/thsSupervise",//对应controller请求类
// fallbackFactory = ThsSuperviseClientFallbackFactory.class//服务降级处理类
//)
//public interface ThsSuperviseClient {
// /**
// * 预警/告警事务的初始化
// *
// * @param superviseParam
// * @return
// */
// @PostMapping("/initSupervise")
// HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
//
//
// /**
// * 预警/告警事务的生成
// *
// * @param superviseParam
// * @return
// */
// @PostMapping("/creatSupervise")
// HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam);
//}

View File

@@ -14,6 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
* @version V1.0.0
*/
@Mapper
@Deprecated
public interface ROperatingIndexDPOMapper extends MppBaseMapper<ROperatingIndexDPO> {
}

View File

@@ -10,15 +10,15 @@
city_name cityName,
county_id countyId,
county_name countyName,
round(avg(run_terminal_num)) runTerminalNum,
round(avg(online_monitor_num)) onlineMonitorNum,
round(avg(run_monitor_num)) runMonitorNum,
case when avg(online_monitor_num) = 0 then 0 else round(avg(run_monitor_num)/avg(online_monitor_num)*100,8) end onlineMonitorRate,
round(max(run_terminal_num)) runTerminalNum,
round(max(online_monitor_num)) onlineMonitorNum,
round(max(run_monitor_num)) runMonitorNum,
case when max(run_monitor_num) = 0 then 0 else round(max(online_monitor_num)/max(run_monitor_num)*100,8) end onlineMonitorRate,
sum(expect_collect_num) expectCollectNum,
sum(actual_collect_num) actualCollectNum,
case when sum(expect_collect_num) = 0 then 0 else round(sum(actual_collect_num)/sum(expect_collect_num)*100,8) end dataFullRate,
station_type stationType,
round(avg(station_monitor_num)) stationMonitorNum,
round(max(station_monitor_num)) stationMonitorNum,
#{monthDate} statisticalDate,
statistical_level statisticalLevel,
#{type} statisticalType,

View File

@@ -20,6 +20,7 @@ import java.util.List;
* @version V1.0.0
*/
@Service
@Deprecated
public class ROperatingIndexDPOServiceImpl extends MppServiceImpl<ROperatingIndexDPOMapper, ROperatingIndexDPO> implements ROperatingIndexDPOService{
@@ -27,7 +28,6 @@ public class ROperatingIndexDPOServiceImpl extends MppServiceImpl<ROperatingInde
ROperatingIndexDPOMapper rOperatingIndexDPOMapper;
/**
* @param orgid
* @param dataDate
* @Description: 查询day表一个月的数据数据生成月表数据
* @Param: [orgid, dataDate]
* @return: java.util.List<com.njcn.harmonic.pojo.po.ROperatingIndexDPO>

View File

@@ -124,21 +124,16 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
}
List<LineDevGetDTO> newList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(Collectors.toList());
item.setLineBaseList(newList);
List<LineDevGetDTO> newBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(Collectors.toList());
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me->!otherIds.contains(me.getObjType())).collect(Collectors.toList());
List<LineDevGetDTO> temBaseList = item.getLineBaseList();
long monitorCount = temBaseList.stream().map(LineDevGetDTO::getPointId).distinct().count();
long devCount = temBaseList.stream().map(LineDevGetDTO::getDevId).distinct().count();
List<String> upMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
List<String> upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(Collectors.toList());
mapKey.forEach((key, val) -> {
List<LineDevGetDTO> keyItem = temBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(Collectors.toList());
List<LineDevGetDTO> keyItem = newBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(Collectors.toList());
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
switch (key) {
case "2100":
@@ -177,21 +172,23 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
//fixme over
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
long pointCount = keyItem.stream().map(LineDevGetDTO::getPointId).distinct().count();
//long devCount = keyItem.stream().map(LineDevGetDTO::getDevId).distinct().count();
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
rUploadPointStatisticalDataD.setOnlineMonitorRate(monitorCount == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
rUploadPointStatisticalDataD.setRunTerminalNum(upDevIds.size());
rUploadPointStatisticalDataD.setRunMonitorNum(upMonitorIds.size());
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> temBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> upMonitorIds.contains(it.getLineIndex())).collect(Collectors.toList());
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
rUploadPointStatisticalDataD.setExpectCollectNum(due);
rUploadPointStatisticalDataD.setActualCollectNum(real);
long onlineCount = l3.stream().filter(me -> me.getRealTime() > 0).count();
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) onlineCount);
rUploadPointStatisticalDataD.setOnlineMonitorRate(upMonitorIds.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
if (due == 0 || real == 0) {
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
} else {
@@ -199,11 +196,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
}
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
result.add(rUploadPointStatisticalDataD);
});
@@ -223,21 +216,21 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
//fixme over
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
List<LineDevGetDTO> otherMonitor = newBaseList.stream().filter(me -> !otherIds.contains(me.getObjType())).collect(Collectors.toList());
long pointCount = otherMonitor.stream().map(LineDevGetDTO::getPointId).distinct().count();
//long devCount = otherMonitor.stream().map(LineDevGetDTO::getDevId).distinct().count();
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
rUploadPointStatisticalDataD.setOnlineMonitorRate(monitorCount == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
rUploadPointStatisticalDataD.setRunTerminalNum(upDevIds.size());
rUploadPointStatisticalDataD.setRunMonitorNum(upMonitorIds.size());
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> temBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> newBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
rUploadPointStatisticalDataD.setExpectCollectNum(due);
rUploadPointStatisticalDataD.setActualCollectNum(real);
long onlineCount = l3.stream().filter(me -> me.getRealTime() > 0).count();
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) onlineCount);
rUploadPointStatisticalDataD.setOnlineMonitorRate(upMonitorIds.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
if (due == 0 || real == 0) {
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
} else {
@@ -248,8 +241,6 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
result.add(rUploadPointStatisticalDataD);
});
if (CollectionUtil.isNotEmpty(result)) {
@@ -260,16 +251,6 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
if (CollectionUtil.isNotEmpty(oldData)) {
result.forEach(it -> it.setId(null));
}
//fixme 数据完成率先造假,后期删除
// result.forEach(item->{
// if (item.getExpectCollectNum() > 0){
// Random random = new Random();
// double randomValue = 99 + random.nextDouble() * (100 - 99);
// item.setDataFullRate(randomValue);
// item.setActualCollectNum((int) Math.ceil(randomValue * item.getExpectCollectNum() / 100));
// }
// });
//fixme over
this.saveOrUpdateBatchByMultiId(result);
}
}
@@ -301,13 +282,12 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
}
/**
*
* @param calculatedParam
* @param list 数据处理
*/
private void dataProcessing(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam, List<RUploadPointStatisticalDataD> list) {
//数据分组
/* //数据分组
Map<String, List<RUploadPointStatisticalDataD>> listMap = list.stream().collect(Collectors.groupingBy(x -> x.getProvinceId() + x.getCityId() + x.getCountyId()));
//获取省级单位id
Dept root = deptFeignClient.getRootDept().getData();
@@ -358,7 +338,6 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
long monitorCount = temBaseList.stream().map(LineDevGetDTO::getPointId).distinct().count();
long devCount = temBaseList.stream().map(LineDevGetDTO::getDevId).distinct().count();
//其他类型
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me->!otherIds.contains(me.getObjType())).collect(Collectors.toList());
data = new RUploadPointStatisticalDataD();
data.setProvinceId(dept.getCode());
data.setProvinceName(dept.getName());
@@ -397,18 +376,14 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
if (stationTypeMap.containsKey(stationType)) {
long pointCount = keyItem.stream().map(LineDevGetDTO::getPointId).distinct().count();
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = stationTypeMap.get(stationType);
if(ObjectUtil.isNull(devCount)){
System.out.println();
}
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
}
});
//其他类型
if (stationTypeMap.containsKey(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId())) {
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me -> !otherIds.contains(me.getObjType())).collect(Collectors.toList());
long pointCount = otherMonitor.stream().map(LineDevGetDTO::getPointId).distinct().count();
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = stationTypeMap.get(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId());
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
@@ -418,20 +393,21 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
}
}
}
}*/
if (CollUtil.isNotEmpty(list)) {
list.forEach(item -> {
item.setId(IdUtil.simpleUUID());
item.setComputeDate(calculatedParam.getDataDate());
if(item.getOnlineMonitorNum()>item.getRunMonitorNum()){
item.setOnlineMonitorRate(100.0);
item.setOnlineMonitorNum(item.getRunMonitorNum());
}
});
this.saveOrUpdateBatchByMultiId(list, 1000);
}
}
/**
* r_stat_integrity_d表中获取数据应收数、实收数
*/

View File

@@ -40,7 +40,10 @@ spring:
max-request-size: 100MB
flowable:
#关闭定时任务JOB
database-schema-update: false
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
check-process-definitions: false # 设置为 false禁用 /resources/processes 自动部署 BPMN XML 流程
history-level: full # full保存历史数据的最高级别可保存全部流程相关细节包括流程流转各节点参数
async-executor-activate: false
#项目日志的配置