mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-09 00:18:07 +08:00
update 首页数据大屏
This commit is contained in:
@@ -20,6 +20,11 @@ public class IndexQueryDTO extends BaseEntity {
|
||||
|
||||
private List<String> stationIdList;
|
||||
|
||||
/**
|
||||
* 商户id列表(用于大数据平台按商户维度查询,避免展开为大量stationId)
|
||||
*/
|
||||
private List<String> merchantIdList;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
@@ -149,9 +149,9 @@ public interface MemberBasicInfoMapper {
|
||||
Long countTotalMembers();
|
||||
|
||||
/**
|
||||
* 统计今日新增会员数
|
||||
* 统计今日新增会员数,日期由代码传入
|
||||
*
|
||||
* @return 今日新增会员数
|
||||
*/
|
||||
Long countTodayNewMembers();
|
||||
Long countTodayNewMembers(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
}
|
||||
|
||||
@@ -490,4 +490,14 @@ public interface OrderBasicInfoMapper {
|
||||
* @return 时段分布数据
|
||||
*/
|
||||
List<TimeDistributionVO> getTimeDistribution(@Param("dto") IndexQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 大数据平台-今日订单金额明细(Java汇总),日期由代码传入
|
||||
*/
|
||||
List<java.math.BigDecimal> getTodayOrderAmountRows(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
/**
|
||||
* 大数据平台-今日充电电量明细(Java汇总),日期由代码传入
|
||||
*/
|
||||
List<java.math.BigDecimal> getTodayElectricityRows(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public interface PileBasicInfoMapper {
|
||||
* @param dto 站点Id
|
||||
* @return 首页基本信息
|
||||
*/
|
||||
public IndexGeneralSituationVO getGeneralSituationInfo(@Param("IndexQueryDTO")IndexQueryDTO dto);
|
||||
public List<IndexGeneralSituationVO> getGeneralSituationInfo(@Param("IndexQueryDTO")IndexQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 通过会员id查询个人桩列表
|
||||
@@ -181,23 +181,29 @@ public interface PileBasicInfoMapper {
|
||||
int movePile2AnotherStation(ReplaceMerchantStationDTO dto);
|
||||
|
||||
/**
|
||||
* 查询当日累计交易金额
|
||||
*
|
||||
* @return 当日交易金额
|
||||
*/
|
||||
java.math.BigDecimal getTodayTransactionAmount();
|
||||
|
||||
/**
|
||||
* 查询当日充电电量
|
||||
*
|
||||
* @return 当日充电电量
|
||||
*/
|
||||
java.math.BigDecimal getTodayElectricity();
|
||||
|
||||
/**
|
||||
* 查询本月日均充电电量
|
||||
* 查询本月日均充电电量,日期由代码传入
|
||||
*
|
||||
* @return 月均充电电量
|
||||
*/
|
||||
java.math.BigDecimal getMonthlyAvgElectricity();
|
||||
List<java.math.BigDecimal> getMonthlyAvgElectricity(@Param("monthStartDate") String monthStartDate, @Param("monthEndDate") String monthEndDate);
|
||||
|
||||
/**
|
||||
* 根据站点ID列表统计充电桩总数
|
||||
*/
|
||||
Long countTotalPilesByStationIds(@Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 根据商户ID列表统计充电桩总数
|
||||
*/
|
||||
Long countTotalPilesByMerchantIds(@Param("merchantIdList") List<String> merchantIdList);
|
||||
|
||||
/**
|
||||
* 按merchantId分组汇总settle_order_report(每个商户一行,Java再汇总)
|
||||
*/
|
||||
List<IndexGeneralSituationVO> getSettleReportGroupByMerchant(@Param("merchantIdList") List<String> merchantIdList);
|
||||
|
||||
/**
|
||||
* 按stationId分组汇总settle_order_report(每个站点一行,Java再汇总)
|
||||
*/
|
||||
List<IndexGeneralSituationVO> getSettleReportGroupByStation(@Param("stationIdList") List<String> stationIdList);
|
||||
}
|
||||
|
||||
@@ -191,9 +191,9 @@ public interface MemberBasicInfoService {
|
||||
Long countTotalMembers();
|
||||
|
||||
/**
|
||||
* 统计今日新增会员数
|
||||
* 统计今日新增会员数,日期由代码传入
|
||||
*
|
||||
* @return 今日新增会员数
|
||||
*/
|
||||
Long countTodayNewMembers();
|
||||
Long countTodayNewMembers(String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -704,4 +704,18 @@ public interface OrderBasicInfoService{
|
||||
* 大数据平台-充电时段分布
|
||||
*/
|
||||
List<TimeDistributionVO> getTimeDistribution(IndexQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 大数据平台-今日交易金额(Java汇总)
|
||||
*
|
||||
* @return 今日已完成订单的交易金额合计
|
||||
*/
|
||||
java.math.BigDecimal getTodayTransactionAmount(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 大数据平台-今日充电电量(Java汇总)
|
||||
*
|
||||
* @return 今日已完成订单的充电电量合计(kWh)
|
||||
*/
|
||||
java.math.BigDecimal getTodayElectricity(String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -260,23 +260,29 @@ public interface PileBasicInfoService {
|
||||
int movePile2AnotherStation(ReplaceMerchantStationDTO dto);
|
||||
|
||||
/**
|
||||
* 查询当日累计交易金额
|
||||
*
|
||||
* @return 当日交易金额
|
||||
*/
|
||||
java.math.BigDecimal getTodayTransactionAmount();
|
||||
|
||||
/**
|
||||
* 查询当日充电电量
|
||||
*
|
||||
* @return 当日充电电量
|
||||
*/
|
||||
java.math.BigDecimal getTodayElectricity();
|
||||
|
||||
/**
|
||||
* 查询本月日均充电电量
|
||||
* 查询本月日均充电电量,日期由代码传入
|
||||
*
|
||||
* @return 月均充电电量
|
||||
*/
|
||||
java.math.BigDecimal getMonthlyAvgElectricity();
|
||||
java.math.BigDecimal getMonthlyAvgElectricity(String monthStartDate, String monthEndDate);
|
||||
|
||||
/**
|
||||
* 根据站点ID列表统计充电桩总数
|
||||
*/
|
||||
Long countTotalPilesByStationIds(List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 根据商户ID列表统计充电桩总数
|
||||
*/
|
||||
Long countTotalPilesByMerchantIds(List<String> merchantIdList);
|
||||
|
||||
/**
|
||||
* 大数据平台专用:根据商户ID查settle_order_report GROUP BY merchant_id,Java汇总返回
|
||||
*/
|
||||
IndexGeneralSituationVO aggregateReportByMerchantIds(List<String> merchantIdList);
|
||||
|
||||
/**
|
||||
* 大数据平台专用:根据站点ID查settle_order_report GROUP BY station_id,Java汇总返回
|
||||
*/
|
||||
IndexGeneralSituationVO aggregateReportByStationIds(List<String> stationIdList);
|
||||
}
|
||||
|
||||
@@ -921,8 +921,8 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countTodayNewMembers() {
|
||||
return memberBasicInfoMapper.countTodayNewMembers();
|
||||
public Long countTodayNewMembers(String startTime, String endTime) {
|
||||
return memberBasicInfoMapper.countTodayNewMembers(startTime, endTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6706,5 +6706,33 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
public List<TimeDistributionVO> getTimeDistribution(IndexQueryDTO dto) {
|
||||
return orderBasicInfoMapper.getTimeDistribution(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.math.BigDecimal getTodayTransactionAmount(String startTime, String endTime) {
|
||||
List<java.math.BigDecimal> rows = orderBasicInfoMapper.getTodayOrderAmountRows(startTime, endTime);
|
||||
java.math.BigDecimal total = java.math.BigDecimal.ZERO;
|
||||
if (rows != null) {
|
||||
for (java.math.BigDecimal amount : rows) {
|
||||
if (amount != null) {
|
||||
total = total.add(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.math.BigDecimal getTodayElectricity(String startTime, String endTime) {
|
||||
List<java.math.BigDecimal> rows = orderBasicInfoMapper.getTodayElectricityRows(startTime, endTime);
|
||||
java.math.BigDecimal total = java.math.BigDecimal.ZERO;
|
||||
if (rows != null) {
|
||||
for (java.math.BigDecimal elec : rows) {
|
||||
if (elec != null) {
|
||||
total = total.add(elec);
|
||||
}
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -985,8 +985,9 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
}
|
||||
log.info("后管首页基本信息查询 authorizedMap:{}, dto:{}", JSON.toJSONString(authorizedMap), JSON.toJSONString(dto));
|
||||
dto.setStationIdList(stationIdList);
|
||||
// IndexGeneralSituationVO generalInfo = pileBasicInfoMapper.getGeneralSituation(dto);
|
||||
IndexGeneralSituationVO generalInfo = pileBasicInfoMapper.getGeneralSituationInfo(dto);
|
||||
// 查询settle_order_report原始行记录,Java汇总(不用SQL的SUM)
|
||||
List<IndexGeneralSituationVO> reportRows = pileBasicInfoMapper.getGeneralSituationInfo(dto);
|
||||
IndexGeneralSituationVO generalInfo = aggregateSituationRows(reportRows);
|
||||
|
||||
List<PileInfoVO> pileInfoVOS = queryPileDetailList(stationIdList);
|
||||
// 对集合根据pileSn进行去重
|
||||
@@ -1635,17 +1636,72 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.math.BigDecimal getTodayTransactionAmount() {
|
||||
return pileBasicInfoMapper.getTodayTransactionAmount();
|
||||
public java.math.BigDecimal getMonthlyAvgElectricity(String monthStartDate, String monthEndDate) {
|
||||
List<java.math.BigDecimal> rows = pileBasicInfoMapper.getMonthlyAvgElectricity(monthStartDate, monthEndDate);
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
return java.math.BigDecimal.ZERO;
|
||||
}
|
||||
java.math.BigDecimal total = java.math.BigDecimal.ZERO;
|
||||
for (java.math.BigDecimal val : rows) {
|
||||
if (val != null) {
|
||||
total = total.add(val);
|
||||
}
|
||||
}
|
||||
return total.divide(new java.math.BigDecimal(rows.size()), 2, java.math.RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.math.BigDecimal getTodayElectricity() {
|
||||
return pileBasicInfoMapper.getTodayElectricity();
|
||||
public Long countTotalPilesByStationIds(List<String> stationIdList) {
|
||||
return pileBasicInfoMapper.countTotalPilesByStationIds(stationIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.math.BigDecimal getMonthlyAvgElectricity() {
|
||||
return pileBasicInfoMapper.getMonthlyAvgElectricity();
|
||||
public Long countTotalPilesByMerchantIds(List<String> merchantIdList) {
|
||||
return pileBasicInfoMapper.countTotalPilesByMerchantIds(merchantIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexGeneralSituationVO aggregateReportByMerchantIds(List<String> merchantIdList) {
|
||||
List<IndexGeneralSituationVO> rows = pileBasicInfoMapper.getSettleReportGroupByMerchant(merchantIdList);
|
||||
return aggregateSituationRows(rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexGeneralSituationVO aggregateReportByStationIds(List<String> stationIdList) {
|
||||
List<IndexGeneralSituationVO> rows = pileBasicInfoMapper.getSettleReportGroupByStation(stationIdList);
|
||||
return aggregateSituationRows(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Java层汇总settle_order_report GROUP BY结果(每行是一个商户/站点的汇总)
|
||||
*/
|
||||
private IndexGeneralSituationVO aggregateSituationRows(List<IndexGeneralSituationVO> rows) {
|
||||
IndexGeneralSituationVO result = new IndexGeneralSituationVO();
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
BigDecimal settleAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalDegree = BigDecimal.ZERO;
|
||||
long totalQuantity = 0L;
|
||||
if (rows != null) {
|
||||
for (IndexGeneralSituationVO row : rows) {
|
||||
if (row.getTotalChargingAmount() != null) {
|
||||
totalAmount = totalAmount.add(new BigDecimal(row.getTotalChargingAmount()));
|
||||
}
|
||||
if (row.getTotalSettleAmount() != null) {
|
||||
settleAmount = settleAmount.add(new BigDecimal(row.getTotalSettleAmount()));
|
||||
}
|
||||
if (row.getTotalChargingDegree() != null) {
|
||||
totalDegree = totalDegree.add(new BigDecimal(row.getTotalChargingDegree()));
|
||||
}
|
||||
if (row.getTotalChargingQuantity() != null && !row.getTotalChargingQuantity().isEmpty()) {
|
||||
String qty = row.getTotalChargingQuantity().replaceAll("[.](.*)", "");
|
||||
totalQuantity += Long.parseLong(qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.setTotalChargingAmount(totalAmount.toPlainString());
|
||||
result.setTotalSettleAmount(settleAmount.toPlainString());
|
||||
result.setTotalChargingDegree(totalDegree.toPlainString());
|
||||
result.setTotalChargingQuantity(String.valueOf(totalQuantity));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user