站点数据总量统计调整
This commit is contained in:
parent
d18226e13d
commit
36d3ccce3a
|
|
@ -49,8 +49,6 @@ public class SurvStationInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISurvStationInfoService survStationInfoService;
|
private ISurvStationInfoService survStationInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISurvDeviceInfoService survDeviceInfoService;
|
|
||||||
@Autowired
|
|
||||||
private ISurvDeviceDeployService survDeviceDeployService;
|
private ISurvDeviceDeployService survDeviceDeployService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IScEquZhibiaoService zhibiaoService;
|
private IScEquZhibiaoService zhibiaoService;
|
||||||
|
|
@ -156,36 +154,39 @@ public class SurvStationInfoController {
|
||||||
|
|
||||||
Integer finalDataCounts = 0;
|
Integer finalDataCounts = 0;
|
||||||
//水实时
|
//水实时
|
||||||
if(!orientList.isEmpty()) {
|
// if(!orientList.isEmpty()) {
|
||||||
//计算历史数据量
|
// //计算历史数据量
|
||||||
Integer dataCounts = hisdataOrientwaterService.getHisDataCount(orientList);
|
// Integer dataCounts = hisdataOrientwaterService.getHisDataCount(orientList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
// }
|
||||||
// //畜禽
|
//// //畜禽
|
||||||
if(!liveList.isEmpty()) {
|
// if(!liveList.isEmpty()) {
|
||||||
//计算历史数据量
|
// //计算历史数据量
|
||||||
Integer dataCounts = hisdataLivestockwaterService.getHisDataCount(liveList);
|
// Integer dataCounts = hisdataLivestockwaterService.getHisDataCount(liveList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
// }
|
||||||
//气实时
|
// //气实时
|
||||||
if(!airList.isEmpty()) {
|
// if(!airList.isEmpty()) {
|
||||||
|
//
|
||||||
|
// //计算历史数据量
|
||||||
|
// Integer dataCounts = hisdataAirService.getHisDataCount(airList);
|
||||||
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
|
// }
|
||||||
|
// //土壤实时
|
||||||
|
// if(!soilList.isEmpty()){
|
||||||
|
// //计算历史数据量
|
||||||
|
// Integer dataCounts = hisdataSoilService.getHisDataCount(soilList);
|
||||||
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
|
// }
|
||||||
|
// //水质实时
|
||||||
|
// if(!waterList.isEmpty()){
|
||||||
|
// //计算历史数据量
|
||||||
|
// Integer dataCounts = hisdataSoilService.getHisDataCount(waterList);
|
||||||
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
|
// }
|
||||||
|
|
||||||
|
finalDataCounts = survStationInfoService.countStationData(record.getStationCode());
|
||||||
|
|
||||||
//计算历史数据量
|
|
||||||
Integer dataCounts = hisdataAirService.getHisDataCount(airList);
|
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
|
||||||
}
|
|
||||||
//土壤实时
|
|
||||||
if(!soilList.isEmpty()){
|
|
||||||
//计算历史数据量
|
|
||||||
Integer dataCounts = hisdataSoilService.getHisDataCount(soilList);
|
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
|
||||||
}
|
|
||||||
//水质实时
|
|
||||||
if(!waterList.isEmpty()){
|
|
||||||
//计算历史数据量
|
|
||||||
Integer dataCounts = hisdataSoilService.getHisDataCount(waterList);
|
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
|
||||||
}
|
|
||||||
//获取数据量
|
//获取数据量
|
||||||
record.setSurvDataCount(finalDataCounts);
|
record.setSurvDataCount(finalDataCounts);
|
||||||
//补充设备在线状态
|
//补充设备在线状态
|
||||||
|
|
@ -313,8 +314,8 @@ public class SurvStationInfoController {
|
||||||
constructOrient.setTransdataOrientwaterVo(survTransdataOrientwaterVo);
|
constructOrient.setTransdataOrientwaterVo(survTransdataOrientwaterVo);
|
||||||
orientData.addAll(zhAdminFeignClient.constructOrient(constructOrient));
|
orientData.addAll(zhAdminFeignClient.constructOrient(constructOrient));
|
||||||
//计算历史数据量
|
//计算历史数据量
|
||||||
Integer dataCounts = hisdataOrientwaterService.getHisDataCount(orientList);
|
// Integer dataCounts = hisdataOrientwaterService.getHisDataCount(orientList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
}
|
||||||
// //畜禽
|
// //畜禽
|
||||||
if(!liveList.isEmpty()) {
|
if(!liveList.isEmpty()) {
|
||||||
|
|
@ -324,8 +325,8 @@ public class SurvStationInfoController {
|
||||||
constructLive.setTransdataLivestockwaterVo(survTransdataLivestockwaterVo);
|
constructLive.setTransdataLivestockwaterVo(survTransdataLivestockwaterVo);
|
||||||
LiveData.addAll(zhAdminFeignClient.constructLive(constructLive));
|
LiveData.addAll(zhAdminFeignClient.constructLive(constructLive));
|
||||||
//计算历史数据量
|
//计算历史数据量
|
||||||
Integer dataCounts = hisdataLivestockwaterService.getHisDataCount(liveList);
|
// Integer dataCounts = hisdataLivestockwaterService.getHisDataCount(liveList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
}
|
||||||
// //气实时
|
// //气实时
|
||||||
if(!airList.isEmpty()) {
|
if(!airList.isEmpty()) {
|
||||||
|
|
@ -337,8 +338,8 @@ public class SurvStationInfoController {
|
||||||
constructAir.setDeploy(deployMap.get(survTransdataAirVo.getDeployCode()));
|
constructAir.setDeploy(deployMap.get(survTransdataAirVo.getDeployCode()));
|
||||||
airData.addAll(zhAdminFeignClient.constructAir(constructAir));
|
airData.addAll(zhAdminFeignClient.constructAir(constructAir));
|
||||||
//计算历史数据量
|
//计算历史数据量
|
||||||
Integer dataCounts = hisdataAirService.getHisDataCount(airList);
|
// Integer dataCounts = hisdataAirService.getHisDataCount(airList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
}
|
||||||
//土壤实时
|
//土壤实时
|
||||||
if(!soilList.isEmpty()){
|
if(!soilList.isEmpty()){
|
||||||
|
|
@ -350,8 +351,8 @@ public class SurvStationInfoController {
|
||||||
constructSoil.setDeploy(deployMap.get(survTransdataSoilVo.getDeployCode()));
|
constructSoil.setDeploy(deployMap.get(survTransdataSoilVo.getDeployCode()));
|
||||||
soilData.addAll(zhAdminFeignClient.constructSoil(constructSoil));
|
soilData.addAll(zhAdminFeignClient.constructSoil(constructSoil));
|
||||||
//计算历史数据量
|
//计算历史数据量
|
||||||
Integer dataCounts = hisdataSoilService.getHisDataCount(soilList);
|
// Integer dataCounts = hisdataSoilService.getHisDataCount(soilList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
}
|
||||||
//水质实时
|
//水质实时
|
||||||
if(!waterList.isEmpty()){
|
if(!waterList.isEmpty()){
|
||||||
|
|
@ -363,8 +364,8 @@ public class SurvStationInfoController {
|
||||||
constructSoil.setDeploy(deployMap.get(survTransdataSoilVo.getDeployCode()));
|
constructSoil.setDeploy(deployMap.get(survTransdataSoilVo.getDeployCode()));
|
||||||
waterData.addAll(zhAdminFeignClient.constructSoil(constructSoil));
|
waterData.addAll(zhAdminFeignClient.constructSoil(constructSoil));
|
||||||
//计算历史数据量
|
//计算历史数据量
|
||||||
Integer dataCounts = hisdataSoilService.getHisDataCount(waterList);
|
// Integer dataCounts = hisdataSoilService.getHisDataCount(waterList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
}
|
||||||
// //恶臭实时
|
// //恶臭实时
|
||||||
if(!stinkList.isEmpty()){
|
if(!stinkList.isEmpty()){
|
||||||
|
|
@ -373,10 +374,11 @@ public class SurvStationInfoController {
|
||||||
constructStink.setTransdataStinkVo(survTransdataStinkVo);
|
constructStink.setTransdataStinkVo(survTransdataStinkVo);
|
||||||
stinkData.addAll(zhAdminFeignClient.constructStink(constructStink));
|
stinkData.addAll(zhAdminFeignClient.constructStink(constructStink));
|
||||||
//计算历史数据量
|
//计算历史数据量
|
||||||
Integer dataCounts = survHisdataVocsService.getHisDataCount(stinkList);
|
// Integer dataCounts = survHisdataVocsService.getHisDataCount(stinkList);
|
||||||
finalDataCounts=finalDataCounts+dataCounts;
|
// finalDataCounts=finalDataCounts+dataCounts;
|
||||||
}
|
}
|
||||||
//获取数据量
|
//获取数据量
|
||||||
|
finalDataCounts = survStationInfoService.countStationData(curStation.getStationCode());
|
||||||
curStation.setSurvDataCount(finalDataCounts);
|
curStation.setSurvDataCount(finalDataCounts);
|
||||||
//重新计算设备数
|
//重新计算设备数
|
||||||
// int counts = curStation.getDeviceList().size();
|
// int counts = curStation.getDeviceList().size();
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,6 @@ public interface SurvStationInfoMapper extends BaseMapper<SurvStationInfo> {
|
||||||
List<SurvStationInfo> getAllStationAndDevice(@Param("stationCode") String stationCode,@Param("camera") String camera, @Param("token")String token,@Param("tenantId")String tenantId);
|
List<SurvStationInfo> getAllStationAndDevice(@Param("stationCode") String stationCode,@Param("camera") String camera, @Param("token")String token,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
Integer getCountOfAllData();
|
Integer getCountOfAllData();
|
||||||
|
|
||||||
|
Integer countStationData(String stationCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,4 +118,19 @@
|
||||||
<select id="getCountOfAllData" resultType="java.lang.Integer">
|
<select id="getCountOfAllData" resultType="java.lang.Integer">
|
||||||
SELECT SUM(table_rows) FROM information_schema.tables where TABLE_NAME in ('surv_hisdata_air','surv_hisdata_soil','surv_hisdata_dad','surv_hisdata_flowmeter','surv_hisdata_livestockwater','surv_hisdata_orientwater')
|
SELECT SUM(table_rows) FROM information_schema.tables where TABLE_NAME in ('surv_hisdata_air','surv_hisdata_soil','surv_hisdata_dad','surv_hisdata_flowmeter','surv_hisdata_livestockwater','surv_hisdata_orientwater')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countStationData" resultType="java.lang.Integer">
|
||||||
|
SELECT SUM(row_count) AS total_count
|
||||||
|
FROM (
|
||||||
|
SELECT COUNT(*) AS row_count FROM surv_hisdata_soil WHERE STATION_CODE = #{stationCode}
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) AS row_count FROM surv_hisdata_air WHERE STATION_CODE = #{stationCode}
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) AS row_count FROM surv_hisdata_livestockwater WHERE STATION_CODE = #{stationCode}
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) AS row_count FROM surv_hisdata_orientwater WHERE STATION_CODE = #{stationCode}
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) AS row_count FROM surv_hisdata_vocs WHERE STATION_CODE = #{stationCode}
|
||||||
|
) AS stats
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -25,4 +25,6 @@ public interface ISurvStationInfoService extends IService<SurvStationInfo> {
|
||||||
Integer getCountOfAllData();
|
Integer getCountOfAllData();
|
||||||
|
|
||||||
Integer getStationDataCounts(SurvStationInfo survStationInfo,String tenantId);
|
Integer getStationDataCounts(SurvStationInfo survStationInfo,String tenantId);
|
||||||
|
|
||||||
|
Integer countStationData(String stationCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,5 +108,10 @@ public class SurvStationInfoServiceImpl extends ServiceImpl<SurvStationInfoMappe
|
||||||
return dataCounts;
|
return dataCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countStationData(String stationCode) {
|
||||||
|
return baseMapper.countStationData(stationCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue