diff --git a/doc/运营小程序接口文档.md b/doc/运营小程序接口文档.md index 35353936e..d98199f12 100644 --- a/doc/运营小程序接口文档.md +++ b/doc/运营小程序接口文档.md @@ -3,18 +3,19 @@ # 查询站点的数据统计 ```TEXT -接口地址: +接口地址:http://localhost:8080/business/pile/station/getStationStatisticsInfos -请求方式:GET +请求方式:POST ``` ### 入参 -| 字段名 | 类型 | 是否必传 | 备注 | -| ---------- | ------ | -------- | -------- | -| merchantId | String | N | 运营商id | -| startTime | String | N | 开始时间 | -| endTime | String | N | 结束时间 | +| 字段名 | 类型 | 是否必传 | 备注 | +| ---------- | ------------ | -------- | ---------- | +| merchantId | String | N | 运营商id | +| stationIds | List | N | 站点id列表 | +| startTime | String | N | 开始时间 | +| endTime | String | N | 结束时间 | ### 反参 @@ -49,27 +50,55 @@ 请求方式: -入参 +### 入参 -| 字段名 | 类型 | 是否必传 | 备注 | -| ------ | ---- | -------- | ---- | -| | | | | +| 字段名 | 类型 | 是否必传 | 备注 | +| ---------- | ------------ | -------- | ------------------------------------------------------ | +| dateTime | String | N | 不传时默认查周期列表数据,传入时为用户选中某一天的日期 | +| type | String | Y | 日期类型(1-近7天;2-近30天) | +| stationIds | List | Y | 站点id列表 | -反参 +### 反参 -| 字段名 | 类型 | 是否必传 | 备注 | -| ------ | ---- | -------- | ----------------------------- | -| | | Y | 日期 | -| | | Y | 尖用电量费(元) | -| | | Y | 峰用电量费(元) | -| | | Y | 平用电量费(元) | -| | | Y | 谷用电量费(元) | -| | | Y | 当天充电量(度) | -| | | Y | 当天订单总额(元) | -| | | Y | 当天充电服务费(元) | -| | | Y | 当天充电量同比增长率(%) | -| | | Y | 当天订单总额同比增长率(%) | -| | | Y | 当天充电服务费同比增长率(%) | + + +| 字段名 | 类型 | 是否必传 | 备注 | +| ----------------------------- | ------------------------------- | -------- | ------------------------ | +| electricityGrowthRate | String | Y | 充电量增长率 | +| orderAmountGrowthRate | String | Y | 订单金额增长率 | +| serviceAmountGrowthRate | String | Y | 服务费增长率 | +| businessOrderDetailInfoVOList | List | N | 运营端小程序订单详情List | +| settleOrderReportList | List | N | 结算订单报表List | + +#### businessOrderDetailInfoVO + +| 字段名 | 类型 | 是否必传 | 备注 | +| ---------------------- | ---------- | -------- | -------------------- | +| 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 | 服务费金额 | # 站点充点分布统计图 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 4010341b2..9336043cb 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 @@ -781,9 +781,9 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { // 获取type类型 String type = dto.getType(); // 获取站点id,如果为空,则默认查询该账号下所有站点 - String stationId = dto.getStationId(); - List stationIds = new ArrayList<>(); - if (stationId == null) { + // String stationId = dto.getStationId(); + List stationIds = dto.getStationIds(); + if (CollectionUtils.isNotEmpty(stationIds)) { List merchantInfoVOList = UserUtils.getMerchantInfoVOList(); List merchantIds = merchantInfoVOList.stream() .map(MerchantInfoVO::getMerchantId) @@ -797,8 +797,6 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { // 未查到该运营商下的站点 throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); } - } else { - stationIds.add(stationId); } // 日期区间 String startTime = null; @@ -824,7 +822,9 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { // 根据站点ids和日期区间查询订单详情 List orderDetails = orderBasicInfoService.getOrderDetailByStationIds(stationIds, startTime, endTime); - + if (CollectionUtils.isEmpty(orderDetails)) { + return new StationBusinessAnalyzeInfoVO(); + } for (BusinessOrderDetailInfoVO orderDetail : orderDetails) { if (orderDetail.getSharpAmount() == null) { orderDetail.setSharpAmount(BigDecimal.ZERO); @@ -961,12 +961,13 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { // 获取目标日期(年-月) String dateTime = dto.getDateTime(); // 设置开始时间、结束时间 - String stationId = dto.getStationId(); + // String stationId = dto.getStationId(); + List stationIds = dto.getStationIds(); String startTime = DateUtils.getLastDayOfCurrentMonth(); // 去年月份第一天 String endTime = DateUtils.getFirstDayOfLastYearMonth(); // 当前月份最后一天 // 查询订单日报表过去一年的数据 - List list = settleOrderReportService.queryOrderReport(Lists.newArrayList(stationId), startTime, endTime); + List list = settleOrderReportService.queryOrderReport(stationIds, startTime, endTime); // 按照日期汇总数据 Map collect = list.stream() .peek(report -> { @@ -1034,5 +1035,4 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { return vo; } -} - +} \ No newline at end of file diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/StationBusinessAnalyzeInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/StationBusinessAnalyzeInfoVO.java index 069aa2737..46f9147d9 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/StationBusinessAnalyzeInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/StationBusinessAnalyzeInfoVO.java @@ -35,7 +35,13 @@ public class StationBusinessAnalyzeInfoVO { */ private String serviceAmountGrowthRate; + /** + * 运营端小程序订单详情VO + */ private List businessOrderDetailInfoVOList; + /** + * 结算订单报表 + */ private List settleOrderReportList; } diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 9379dbb0a..d4e29ea87 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -2958,7 +2958,7 @@ SELECT DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) AS tradeDate, - t1.station_id AS stationId, + t2.sharp_used_electricity AS sharpUsedElectricity, t2.sharp_amount AS sharpAmount, t2.sharp_electricity_price AS sharpElectricityPrice,