diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/index/indexController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/index/indexController.java index ab3e1621e..33fbaf89a 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/index/indexController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/index/indexController.java @@ -185,16 +185,29 @@ public class indexController extends BaseController { () -> pileBasicInfoService.aggregateReportByMerchantIds(midList), threadPoolTaskExecutor); totalPilesFuture = CompletableFuture.supplyAsync( () -> pileBasicInfoService.countTotalPilesByMerchantIds(midList), threadPoolTaskExecutor); - } else { + } else if (!CollectionUtils.isEmpty(finalStationIdList)) { // 站点管理员:按stationId查 final List sidList = finalStationIdList; situationFuture = CompletableFuture.supplyAsync( () -> pileBasicInfoService.aggregateReportByStationIds(sidList), threadPoolTaskExecutor); totalPilesFuture = CompletableFuture.supplyAsync( () -> pileBasicInfoService.countTotalPilesByStationIds(sidList), threadPoolTaskExecutor); + } else { + // 非平台管理员但未解析出任何可查维度(商户未绑定/部门下无站点): + // 返回空数据,避免空列表退化为无过滤的全量查询导致越权 + logger.warn("大数据平台总览数据查询:当前账号无任何可查的商户/站点维度,返回空数据"); + situationFuture = CompletableFuture.completedFuture(emptySituationVO()); + totalPilesFuture = CompletableFuture.completedFuture(0L); } - // 不需要权限过滤的全局查询(日期在代码中生成,不在数据库中运算) + // 数据范围:平台管理员不限制(null),下级账号按各自的merchantIdList/stationIdList过滤 + final boolean hasDataScope = isPlatformAdmin + || !CollectionUtils.isEmpty(finalMerchantIdList) + || !CollectionUtils.isEmpty(finalStationIdList); + final List scopeMerchantIds = isPlatformAdmin ? null : finalMerchantIdList; + final List scopeStationIds = isPlatformAdmin ? null : finalStationIdList; + + // 其余指标查询(与累计字段同一数据范围;日期在代码中生成,不在数据库中运算) java.time.LocalDate today = java.time.LocalDate.now(); String todayStart = today.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00"; String todayEnd = today.plusDays(1).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00"; @@ -205,26 +218,46 @@ public class indexController extends BaseController { final String fMonthStart = monthStart; final String fMonthEnd = monthEnd; - CompletableFuture totalUsersFuture = CompletableFuture.supplyAsync( - () -> memberBasicInfoService.countTotalMembers(), threadPoolTaskExecutor); - CompletableFuture totalStationsFuture = CompletableFuture.supplyAsync( - () -> pileStationInfoService.countTotalStations(), threadPoolTaskExecutor); - CompletableFuture dailyNewUsersFuture = CompletableFuture.supplyAsync( - () -> memberBasicInfoService.countTodayNewMembers(fTodayStart, fTodayEnd), threadPoolTaskExecutor); - CompletableFuture todayAmountFuture = CompletableFuture.supplyAsync( - () -> orderBasicInfoService.getTodayTransactionAmount(fTodayStart, fTodayEnd), threadPoolTaskExecutor); - CompletableFuture todayElecFuture = CompletableFuture.supplyAsync( - () -> orderBasicInfoService.getTodayElectricity(fTodayStart, fTodayEnd), threadPoolTaskExecutor); - CompletableFuture monthlyAvgFuture = CompletableFuture.supplyAsync( - () -> pileBasicInfoService.getMonthlyAvgElectricity(fMonthStart, fMonthEnd), threadPoolTaskExecutor); - CompletableFuture totalGunsFuture = CompletableFuture.supplyAsync( - () -> pileConnectorInfoService.countTotalConnectors(), threadPoolTaskExecutor); - CompletableFuture onlinePilesFuture = CompletableFuture.supplyAsync( - () -> pileConnectorInfoService.countOnlinePiles(), threadPoolTaskExecutor); - CompletableFuture dcPilesFuture = CompletableFuture.supplyAsync( - () -> pileConnectorInfoService.countDcPiles(), threadPoolTaskExecutor); - CompletableFuture acPilesFuture = CompletableFuture.supplyAsync( - () -> pileConnectorInfoService.countAcPiles(), threadPoolTaskExecutor); + CompletableFuture totalUsersFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> memberBasicInfoService.countTotalMembers(scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); + CompletableFuture totalStationsFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> pileStationInfoService.countTotalStations(scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); + CompletableFuture dailyNewUsersFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> memberBasicInfoService.countTodayNewMembers(fTodayStart, fTodayEnd, scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); + CompletableFuture todayAmountFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> orderBasicInfoService.getTodayTransactionAmount(fTodayStart, fTodayEnd, scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(java.math.BigDecimal.ZERO); + CompletableFuture todayElecFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> orderBasicInfoService.getTodayElectricity(fTodayStart, fTodayEnd, scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(java.math.BigDecimal.ZERO); + CompletableFuture monthlyAvgFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> pileBasicInfoService.getMonthlyAvgElectricity(fMonthStart, fMonthEnd, scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(java.math.BigDecimal.ZERO); + CompletableFuture totalGunsFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> pileConnectorInfoService.countTotalConnectors(scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); + CompletableFuture onlinePilesFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> pileConnectorInfoService.countOnlinePiles(scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); + CompletableFuture dcPilesFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> pileConnectorInfoService.countDcPiles(scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); + CompletableFuture acPilesFuture = hasDataScope + ? CompletableFuture.supplyAsync( + () -> pileConnectorInfoService.countAcPiles(scopeMerchantIds, scopeStationIds), threadPoolTaskExecutor) + : CompletableFuture.completedFuture(0L); // 等待所有异步查询完成 CompletableFuture.allOf( @@ -244,15 +277,6 @@ public class indexController extends BaseController { Long totalOrderCount = (totalOrderCountStr != null && !totalOrderCountStr.isEmpty()) ? Long.parseLong(totalOrderCountStr.replaceAll("[.](.*)", "")) : 0L; - // demo账号数据放大3倍 - if (isDemo) { - BigDecimal multiplier = new BigDecimal(Constants.THREE); - totalChargingAmount = new BigDecimal(situation.getTotalSettleAmount()).multiply(multiplier).toString(); - totalChargingDegree = new BigDecimal(totalChargingDegree).multiply(multiplier).toString(); - totalPileCount = totalPileCount != null ? totalPileCount * 3 : 0L; - totalOrderCount = totalOrderCount * 3; - } - overviewVO.setTotalUsers(totalUsersFuture.get()); overviewVO.setTotalOrders(totalOrderCount); overviewVO.setTotalTransactionAmount(totalChargingAmount); @@ -268,8 +292,8 @@ public class indexController extends BaseController { overviewVO.setMonthlyAvgElectricity(monthlyAvg != null ? monthlyAvg.toPlainString() : "0"); overviewVO.setTotalGuns(totalGunsFuture.get()); overviewVO.setOnlinePiles(onlinePilesFuture.get()); - overviewVO.setOnlineStations(dcPilesFuture.get()); - overviewVO.setOnlineGuns(acPilesFuture.get()); + overviewVO.setDcPileCount(dcPilesFuture.get()); + overviewVO.setAcPileCount(acPilesFuture.get()); // 节能减排计算 BigDecimal totalElecKwh = new BigDecimal(totalChargingDegree); @@ -289,6 +313,11 @@ public class indexController extends BaseController { .setScale(2, RoundingMode.HALF_UP); overviewVO.setStandardCoalSaved(coalSaved.toPlainString()); + // demo账号:全部指标同步放大3倍(节能减排基于放大后的电量/订单数重算) + if (isDemo) { + amplifyDemoData(overviewVO); + } + response = new RestApiResponse<>(overviewVO); } catch (Exception e) { logger.error("大数据平台总览数据查询错误", e); @@ -343,6 +372,68 @@ public class indexController extends BaseController { return params; } + /** + * 空权限维度时的占位汇总数据(全为0,避免下游NPE) + */ + private static IndexGeneralSituationVO emptySituationVO() { + IndexGeneralSituationVO vo = new IndexGeneralSituationVO(); + vo.setTotalChargingAmount("0"); + vo.setTotalSettleAmount("0"); + vo.setTotalChargingDegree("0"); + vo.setTotalChargingQuantity("0"); + return vo; + } + + /** + * demo账号数据放大3倍 + * 所有总量类指标(用户、订单、金额、电量、站点、桩、枪等)同步放大,保证各维度数据比例一致; + * 节能减排基于放大后的累计电量/订单数重算,其中"单次充电平均减碳量"为比值型指标,放大后保持不变 + */ + private static void amplifyDemoData(BigDataOverviewVO vo) { + BigDecimal multiplier = new BigDecimal(Constants.THREE); + vo.setTotalUsers(multiply(vo.getTotalUsers(), multiplier)); + vo.setTotalOrders(multiply(vo.getTotalOrders(), multiplier)); + vo.setTotalTransactionAmount(multiply(vo.getTotalTransactionAmount(), multiplier)); + vo.setTotalElectricity(multiply(vo.getTotalElectricity(), multiplier)); + vo.setTotalPiles(multiply(vo.getTotalPiles(), multiplier)); + vo.setTotalStations(multiply(vo.getTotalStations(), multiplier)); + vo.setDailyNewUsers(multiply(vo.getDailyNewUsers(), multiplier)); + vo.setTodayTransactionAmount(multiply(vo.getTodayTransactionAmount(), multiplier)); + vo.setTodayElectricity(multiply(vo.getTodayElectricity(), multiplier)); + vo.setMonthlyAvgElectricity(multiply(vo.getMonthlyAvgElectricity(), multiplier)); + vo.setTotalGuns(multiply(vo.getTotalGuns(), multiplier)); + vo.setOnlinePiles(multiply(vo.getOnlinePiles(), multiplier)); + vo.setDcPileCount(multiply(vo.getDcPileCount(), multiplier)); + vo.setAcPileCount(multiply(vo.getAcPileCount(), multiplier)); + + // 节能减排按放大后的累计电量/订单数重算 + BigDecimal totalElecKwh = new BigDecimal(vo.getTotalElectricity()); + BigDecimal carbonKg = totalElecKwh.multiply(new BigDecimal("0.5306")); + BigDecimal carbonTon = carbonKg.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP); + vo.setCarbonReduction(carbonTon.toPlainString()); + Long totalOrderCount = vo.getTotalOrders(); + if (totalOrderCount != null && totalOrderCount > 0) { + BigDecimal avgCarbon = carbonKg.divide(new BigDecimal(totalOrderCount), 2, RoundingMode.HALF_UP); + vo.setAvgCarbonPerOrder(avgCarbon.toPlainString()); + } else { + vo.setAvgCarbonPerOrder("0"); + } + BigDecimal fuelSaved = totalElecKwh.multiply(new BigDecimal("8")) + .divide(new BigDecimal("15"), 2, RoundingMode.HALF_UP); + vo.setFuelSaved(fuelSaved.toPlainString()); + BigDecimal coalSaved = totalElecKwh.multiply(new BigDecimal("0.000404")) + .setScale(2, RoundingMode.HALF_UP); + vo.setStandardCoalSaved(coalSaved.toPlainString()); + } + + private static Long multiply(Long value, BigDecimal multiplier) { + return value == null ? null : new BigDecimal(value).multiply(multiplier).longValue(); + } + + private static String multiply(String value, BigDecimal multiplier) { + return value == null ? null : new BigDecimal(value).multiply(multiplier).toString(); + } + /** * 大数据平台-充电站地图数据 */ diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberBasicInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberBasicInfoMapper.java index c3612ad16..672021aa4 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberBasicInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberBasicInfoMapper.java @@ -146,12 +146,13 @@ public interface MemberBasicInfoMapper { * * @return 会员总数 */ - Long countTotalMembers(); + Long countTotalMembers(@Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 统计今日新增会员数,日期由代码传入 * * @return 今日新增会员数 */ - Long countTodayNewMembers(@Param("startTime") String startTime, @Param("endTime") String endTime); + Long countTodayNewMembers(@Param("startTime") String startTime, @Param("endTime") String endTime, + @Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java index ab44805da..f51858ed3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java @@ -494,10 +494,12 @@ public interface OrderBasicInfoMapper { /** * 大数据平台-今日订单金额明细(Java汇总),日期由代码传入 */ - List getTodayOrderAmountRows(@Param("startTime") String startTime, @Param("endTime") String endTime); + List getTodayOrderAmountRows(@Param("startTime") String startTime, @Param("endTime") String endTime, + @Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 大数据平台-今日充电电量明细(Java汇总),日期由代码传入 */ - List getTodayElectricityRows(@Param("startTime") String startTime, @Param("endTime") String endTime); + List getTodayElectricityRows(@Param("startTime") String startTime, @Param("endTime") String endTime, + @Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java index 6cdf3caaa..35160d38f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java @@ -190,7 +190,8 @@ public interface PileBasicInfoMapper { * * @return 月均充电电量 */ - List getMonthlyAvgElectricity(@Param("monthStartDate") String monthStartDate, @Param("monthEndDate") String monthEndDate); + List getMonthlyAvgElectricity(@Param("monthStartDate") String monthStartDate, @Param("monthEndDate") String monthEndDate, + @Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 根据站点ID列表统计充电桩总数 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java index 464d42ae2..c92ed86c2 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java @@ -156,26 +156,26 @@ public interface PileConnectorInfoMapper { * * @return 充电枪总数 */ - Long countTotalConnectors(); + Long countTotalConnectors(@Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 统计在线充电桩数量(枪口状态不为离网和故障的桩) * * @return 在线充电桩数量 */ - Long countOnlinePiles(); + Long countOnlinePiles(@Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 统计直流充电桩数量(快充) * * @return 直流充电桩数量 */ - Long countDcPiles(); + Long countDcPiles(@Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 统计交流充电桩数量(慢充) * * @return 交流充电桩数量 */ - Long countAcPiles(); + Long countAcPiles(@Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java index cbaf4c590..a1543bf7f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java @@ -148,7 +148,7 @@ public interface PileStationInfoMapper { * * @return 充电站总数 */ - Long countTotalStations(); + Long countTotalStations(@Param("merchantIdList") List merchantIdList, @Param("stationIdList") List stationIdList); /** * 查询所有充电站坐标(用于地图展示) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberBasicInfoService.java index b6ed5203e..6898d068e 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberBasicInfoService.java @@ -188,12 +188,12 @@ public interface MemberBasicInfoService { * * @return 会员总数 */ - Long countTotalMembers(); + Long countTotalMembers(List merchantIdList, List stationIdList); /** * 统计今日新增会员数,日期由代码传入 * * @return 今日新增会员数 */ - Long countTodayNewMembers(String startTime, String endTime); + Long countTodayNewMembers(String startTime, String endTime, List merchantIdList, List stationIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java index 4d924a481..d9094e890 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java @@ -722,12 +722,14 @@ public interface OrderBasicInfoService{ * * @return 今日已完成订单的交易金额合计 */ - java.math.BigDecimal getTodayTransactionAmount(String startTime, String endTime); + java.math.BigDecimal getTodayTransactionAmount(String startTime, String endTime, + List merchantIdList, List stationIdList); /** * 大数据平台-今日充电电量(Java汇总) * * @return 今日已完成订单的充电电量合计(kWh) */ - java.math.BigDecimal getTodayElectricity(String startTime, String endTime); + java.math.BigDecimal getTodayElectricity(String startTime, String endTime, + List merchantIdList, List stationIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java index 8952a6c33..9ddff84d3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java @@ -281,7 +281,8 @@ public interface PileBasicInfoService { * * @return 月均充电电量 */ - java.math.BigDecimal getMonthlyAvgElectricity(String monthStartDate, String monthEndDate); + java.math.BigDecimal getMonthlyAvgElectricity(String monthStartDate, String monthEndDate, + List merchantIdList, List stationIdList); /** * 根据站点ID列表统计充电桩总数 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java index 26b4f1f43..1f239620f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java @@ -197,26 +197,26 @@ public interface PileConnectorInfoService { * * @return 充电枪总数 */ - Long countTotalConnectors(); + Long countTotalConnectors(List merchantIdList, List stationIdList); /** * 统计在线充电桩数量 * * @return 在线充电桩数量 */ - Long countOnlinePiles(); + Long countOnlinePiles(List merchantIdList, List stationIdList); /** * 统计直流充电桩数量(快充) * * @return 直流充电桩数量 */ - Long countDcPiles(); + Long countDcPiles(List merchantIdList, List stationIdList); /** * 统计交流充电桩数量(慢充) * * @return 交流充电桩数量 */ - Long countAcPiles(); + Long countAcPiles(List merchantIdList, List stationIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java index 37c057da0..9d85b68e5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java @@ -237,7 +237,7 @@ public interface PileStationInfoService { * * @return 充电站总数 */ - Long countTotalStations(); + Long countTotalStations(List merchantIdList, List stationIdList); /** * 查询所有充电站坐标(用于地图展示) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java index 7c5c876d4..cbf97f838 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java @@ -919,13 +919,13 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService { } @Override - public Long countTotalMembers() { - return memberBasicInfoMapper.countTotalMembers(); + public Long countTotalMembers(List merchantIdList, List stationIdList) { + return memberBasicInfoMapper.countTotalMembers(merchantIdList, stationIdList); } @Override - public Long countTodayNewMembers(String startTime, String endTime) { - return memberBasicInfoMapper.countTodayNewMembers(startTime, endTime); + public Long countTodayNewMembers(String startTime, String endTime, List merchantIdList, List stationIdList) { + return memberBasicInfoMapper.countTodayNewMembers(startTime, endTime, merchantIdList, stationIdList); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 164848e2a..f0b45db1d 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -6896,8 +6896,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { } @Override - public java.math.BigDecimal getTodayTransactionAmount(String startTime, String endTime) { - List rows = orderBasicInfoMapper.getTodayOrderAmountRows(startTime, endTime); + public java.math.BigDecimal getTodayTransactionAmount(String startTime, String endTime, + List merchantIdList, List stationIdList) { + List rows = orderBasicInfoMapper.getTodayOrderAmountRows(startTime, endTime, merchantIdList, stationIdList); java.math.BigDecimal total = java.math.BigDecimal.ZERO; if (rows != null) { for (java.math.BigDecimal amount : rows) { @@ -6910,8 +6911,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { } @Override - public java.math.BigDecimal getTodayElectricity(String startTime, String endTime) { - List rows = orderBasicInfoMapper.getTodayElectricityRows(startTime, endTime); + public java.math.BigDecimal getTodayElectricity(String startTime, String endTime, + List merchantIdList, List stationIdList) { + List rows = orderBasicInfoMapper.getTodayElectricityRows(startTime, endTime, merchantIdList, stationIdList); java.math.BigDecimal total = java.math.BigDecimal.ZERO; if (rows != null) { for (java.math.BigDecimal elec : rows) { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 4407dec4e..caf7365e7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -1775,8 +1775,9 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { } @Override - public java.math.BigDecimal getMonthlyAvgElectricity(String monthStartDate, String monthEndDate) { - List rows = pileBasicInfoMapper.getMonthlyAvgElectricity(monthStartDate, monthEndDate); + public java.math.BigDecimal getMonthlyAvgElectricity(String monthStartDate, String monthEndDate, + List merchantIdList, List stationIdList) { + List rows = pileBasicInfoMapper.getMonthlyAvgElectricity(monthStartDate, monthEndDate, merchantIdList, stationIdList); if (rows == null || rows.isEmpty()) { return java.math.BigDecimal.ZERO; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 866587397..72cf4aca5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -1310,22 +1310,22 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { } @Override - public Long countTotalConnectors() { - return pileConnectorInfoMapper.countTotalConnectors(); + public Long countTotalConnectors(List merchantIdList, List stationIdList) { + return pileConnectorInfoMapper.countTotalConnectors(merchantIdList, stationIdList); } @Override - public Long countOnlinePiles() { - return pileConnectorInfoMapper.countOnlinePiles(); + public Long countOnlinePiles(List merchantIdList, List stationIdList) { + return pileConnectorInfoMapper.countOnlinePiles(merchantIdList, stationIdList); } @Override - public Long countDcPiles() { - return pileConnectorInfoMapper.countDcPiles(); + public Long countDcPiles(List merchantIdList, List stationIdList) { + return pileConnectorInfoMapper.countDcPiles(merchantIdList, stationIdList); } @Override - public Long countAcPiles() { - return pileConnectorInfoMapper.countAcPiles(); + public Long countAcPiles(List merchantIdList, List stationIdList) { + return pileConnectorInfoMapper.countAcPiles(merchantIdList, stationIdList); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index f1d009eef..8bfd347aa 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -1691,8 +1691,8 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { } @Override - public Long countTotalStations() { - return pileStationInfoMapper.countTotalStations(); + public Long countTotalStations(List merchantIdList, List stationIdList) { + return pileStationInfoMapper.countTotalStations(merchantIdList, stationIdList); } @Override diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BigDataOverviewVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BigDataOverviewVO.java index 50d385df2..c7a9ed1f3 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BigDataOverviewVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/BigDataOverviewVO.java @@ -72,12 +72,12 @@ public class BigDataOverviewVO { /** * 直流充电桩数量 */ - private Long onlineStations; + private Long dcPileCount; /** * 交流充电桩数量 */ - private Long onlineGuns; + private Long acPileCount; /** * 累计碳减排量(吨) diff --git a/jsowell-pile/src/main/resources/mapper/pile/MemberBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/MemberBasicInfoMapper.xml index 175d65e14..64aab659b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/MemberBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/MemberBasicInfoMapper.xml @@ -346,12 +346,42 @@ diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 86f269137..4affb2d03 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -3712,6 +3712,18 @@ and t1.order_status = '6' and t1.create_time = ]]> #{startTime} and t1.create_time #{endTime} + + and t1.merchant_id in + + #{item} + + + + and t1.station_id in + + #{item} + + @@ -3723,5 +3735,17 @@ and t1.order_status = '6' and t1.create_time = ]]> #{startTime} and t1.create_time #{endTime} + + and t1.merchant_id in + + #{item} + + + + and t1.station_id in + + #{item} + + diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml index fffd3ba40..57b59e03b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml @@ -512,12 +512,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - \ No newline at end of file + diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml index a18e68837..be826b584 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml @@ -759,7 +759,19 @@