This commit is contained in:
Lemon
2024-08-05 14:10:04 +08:00
parent a93d86bfff
commit 7b4b657faa
4 changed files with 71 additions and 36 deletions

View File

@@ -3,18 +3,19 @@
# 查询站点的数据统计 # 查询站点的数据统计
```TEXT ```TEXT
接口地址: 接口地址:http://localhost:8080/business/pile/station/getStationStatisticsInfos
请求方式:GET 请求方式:POST
``` ```
### 入参 ### 入参
| 字段名 | 类型 | 是否必传 | 备注 | | 字段名 | 类型 | 是否必传 | 备注 |
| ---------- | ------ | -------- | -------- | | ---------- | ------------ | -------- | ---------- |
| merchantId | String | N | 运营商id | | merchantId | String | N | 运营商id |
| startTime | String | N | 开始时间 | | stationIds | List<String> | N | 站点id列表 |
| endTime | String | N | 结束时间 | | startTime | String | N | 开始时间 |
| endTime | String | N | 结束时间 |
### 反参 ### 反参
@@ -49,27 +50,55 @@
请求方式: 请求方式:
入参 ### 入参
| 字段名 | 类型 | 是否必传 | 备注 | | 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | ---- | | ---------- | ------------ | -------- | ------------------------------------------------------ |
| | | | | | dateTime | String | N | 不传时默认查周期列表数据,传入时为用户选中某一天的日期 |
| type | String | Y | 日期类型1-近7天2-近30天 |
| stationIds | List<String> | Y | 站点id列表 |
反参 ### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | ----------------------------- |
| | | Y | 日期 | | 字段名 | 类型 | 是否必传 | 备注 |
| | | Y | 尖用电量费(元) | | ----------------------------- | ------------------------------- | -------- | ------------------------ |
| | | Y | 峰用电量费(元) | | electricityGrowthRate | String | Y | 充电量增长率 |
| | | Y | 平用电量费(元) | | orderAmountGrowthRate | String | Y | 订单金额增长率 |
| | | Y | 谷用电量费(元) | | serviceAmountGrowthRate | String | Y | 服务费增长率 |
| | | Y | 当天充电量(度) | | businessOrderDetailInfoVOList | List<BusinessOrderDetailInfoVO> | N | 运营端小程序订单详情List |
| | | Y | 当天订单总额(元) | | settleOrderReportList | List<SettleOrderReport> | N | 结算订单报表List |
| | | Y | 当天充电服务费(元) |
| | | Y | 当天充电量同比增长率(% | #### businessOrderDetailInfoVO
| | | Y | 当天订单总额同比增长率(% |
| | | Y | 当天充电服务费同比增长率(% | | 字段名 | 类型 | 是否必传 | 备注 |
| ---------------------- | ---------- | -------- | -------------------- |
| tradeDate | String | Y | 交易日期(yyyy-MM-dd) |
| sharpUsedElectricity | BigDecimal | Y | 尖时段用电量 |
| sharpAmount | BigDecimal | Y | 尖时段总金额 |
| sharpElectricityPrice | BigDecimal | Y | 尖时段电费 |
| peakUsedElectricity | BigDecimal | Y | 峰时段用电量 |
| peakAmount | BigDecimal | Y | 峰时段总金额 |
| peakElectricityPrice | BigDecimal | Y | 峰时段电费 |
| flatUsedElectricity | BigDecimal | Y | 平时段用电量 |
| flatAmount | BigDecimal | Y | 平时段总金额 |
| flatElectricityPrice | BigDecimal | Y | 平时段电费 |
| valleyUsedElectricity | BigDecimal | Y | 谷时段用电量 |
| valleyAmount | BigDecimal | Y | 谷时段总金额 |
| valleyElectricityPrice | BigDecimal | Y | 谷时段电费 |
| totalServiceAmount | BigDecimal | Y | 总服务费 |
| settleAmount | BigDecimal | Y | 结算金额 |
| totalUsedElectricity | BigDecimal | Y | 总充电量 |
#### SettleOrderReport
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ---------- | -------- | ---------- |
| useElectricity | BigDecimal | Y | 用电度数 |
| totalAmount | BigDecimal | Y | 收入金额 |
| electricityAmount | BigDecimal | Y | 电费金额 |
| serviceAmount | BigDecimal | Y | 服务费金额 |
# 站点充点分布统计图 # 站点充点分布统计图

View File

@@ -781,9 +781,9 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 获取type类型 // 获取type类型
String type = dto.getType(); String type = dto.getType();
// 获取站点id如果为空则默认查询该账号下所有站点 // 获取站点id如果为空则默认查询该账号下所有站点
String stationId = dto.getStationId(); // String stationId = dto.getStationId();
List<String> stationIds = new ArrayList<>(); List<String> stationIds = dto.getStationIds();
if (stationId == null) { if (CollectionUtils.isNotEmpty(stationIds)) {
List<MerchantInfoVO> merchantInfoVOList = UserUtils.getMerchantInfoVOList(); List<MerchantInfoVO> merchantInfoVOList = UserUtils.getMerchantInfoVOList();
List<String> merchantIds = merchantInfoVOList.stream() List<String> merchantIds = merchantInfoVOList.stream()
.map(MerchantInfoVO::getMerchantId) .map(MerchantInfoVO::getMerchantId)
@@ -797,8 +797,6 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 未查到该运营商下的站点 // 未查到该运营商下的站点
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
} }
} else {
stationIds.add(stationId);
} }
// 日期区间 // 日期区间
String startTime = null; String startTime = null;
@@ -824,7 +822,9 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 根据站点ids和日期区间查询订单详情 // 根据站点ids和日期区间查询订单详情
List<BusinessOrderDetailInfoVO> orderDetails = orderBasicInfoService.getOrderDetailByStationIds(stationIds, startTime, endTime); List<BusinessOrderDetailInfoVO> orderDetails = orderBasicInfoService.getOrderDetailByStationIds(stationIds, startTime, endTime);
if (CollectionUtils.isEmpty(orderDetails)) {
return new StationBusinessAnalyzeInfoVO();
}
for (BusinessOrderDetailInfoVO orderDetail : orderDetails) { for (BusinessOrderDetailInfoVO orderDetail : orderDetails) {
if (orderDetail.getSharpAmount() == null) { if (orderDetail.getSharpAmount() == null) {
orderDetail.setSharpAmount(BigDecimal.ZERO); orderDetail.setSharpAmount(BigDecimal.ZERO);
@@ -961,12 +961,13 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 获取目标日期(年-月) // 获取目标日期(年-月)
String dateTime = dto.getDateTime(); String dateTime = dto.getDateTime();
// 设置开始时间、结束时间 // 设置开始时间、结束时间
String stationId = dto.getStationId(); // String stationId = dto.getStationId();
List<String> stationIds = dto.getStationIds();
String startTime = DateUtils.getLastDayOfCurrentMonth(); // 去年月份第一天 String startTime = DateUtils.getLastDayOfCurrentMonth(); // 去年月份第一天
String endTime = DateUtils.getFirstDayOfLastYearMonth(); // 当前月份最后一天 String endTime = DateUtils.getFirstDayOfLastYearMonth(); // 当前月份最后一天
// 查询订单日报表过去一年的数据 // 查询订单日报表过去一年的数据
List<SettleOrderReport> list = settleOrderReportService.queryOrderReport(Lists.newArrayList(stationId), startTime, endTime); List<SettleOrderReport> list = settleOrderReportService.queryOrderReport(stationIds, startTime, endTime);
// 按照日期汇总数据 // 按照日期汇总数据
Map<String, SettleOrderReport> collect = list.stream() Map<String, SettleOrderReport> collect = list.stream()
.peek(report -> { .peek(report -> {
@@ -1035,4 +1036,3 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
return vo; return vo;
} }
} }

View File

@@ -35,7 +35,13 @@ public class StationBusinessAnalyzeInfoVO {
*/ */
private String serviceAmountGrowthRate; private String serviceAmountGrowthRate;
/**
* 运营端小程序订单详情VO
*/
private List<BusinessOrderDetailInfoVO> businessOrderDetailInfoVOList; private List<BusinessOrderDetailInfoVO> businessOrderDetailInfoVOList;
/**
* 结算订单报表
*/
private List<SettleOrderReport> settleOrderReportList; private List<SettleOrderReport> settleOrderReportList;
} }

View File

@@ -2958,7 +2958,7 @@
SELECT SELECT
DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) AS tradeDate, DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) AS tradeDate,
<!-- t1.order_code AS orderCode,--> <!-- t1.order_code AS orderCode,-->
t1.station_id AS stationId, <!-- t1.station_id AS stationId,-->
t2.sharp_used_electricity AS sharpUsedElectricity, t2.sharp_used_electricity AS sharpUsedElectricity,
t2.sharp_amount AS sharpAmount, t2.sharp_amount AS sharpAmount,
t2.sharp_electricity_price AS sharpElectricityPrice, t2.sharp_electricity_price AS sharpElectricityPrice,