mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-12 19:29:52 +08:00
新增 运营端小程序 站点枪口利用率趋势统计接口
This commit is contained in:
@@ -10,7 +10,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 宁波电刑平台
|
* 宁波点行平台
|
||||||
*
|
*
|
||||||
* @author Lemon
|
* @author Lemon
|
||||||
* @Date 2024/5/10 9:21:59
|
* @Date 2024/5/10 9:21:59
|
||||||
|
|||||||
@@ -2402,7 +2402,9 @@ public class SpringBootTestController {
|
|||||||
|
|
||||||
GetStationInfoDTO dto = new GetStationInfoDTO();
|
GetStationInfoDTO dto = new GetStationInfoDTO();
|
||||||
dto.setType("page");
|
dto.setType("page");
|
||||||
dto.setIdList(Lists.newArrayList("395"));
|
dto.setCurrentPage(12);
|
||||||
|
dto.setPageSize(10);
|
||||||
|
// dto.setIdList(Lists.newArrayList("395"));
|
||||||
aMapService.getStationInfosV2(dto);
|
aMapService.getStationInfosV2(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
|
|||||||
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
|
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
|
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
|
||||||
|
import com.jsowell.pile.vo.web.OrderDetailInfoVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.web.PileStationVO;
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
import com.jsowell.system.service.SysDeptService;
|
import com.jsowell.system.service.SysDeptService;
|
||||||
import com.jsowell.system.service.SysUserService;
|
import com.jsowell.system.service.SysUserService;
|
||||||
@@ -1183,6 +1185,8 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public StationBusinessAnalyzeInfoVO getStationConnectorUsedInfo(StationBusinessAnalyzeInfoDTO dto) {
|
public StationBusinessAnalyzeInfoVO getStationConnectorUsedInfo(StationBusinessAnalyzeInfoDTO dto) {
|
||||||
|
StationBusinessAnalyzeInfoVO vo = new StationBusinessAnalyzeInfoVO();
|
||||||
|
List<BusinessOrderDetailInfoVO> list = new ArrayList<>();
|
||||||
List<String> stationIds = dto.getStationIds();
|
List<String> stationIds = dto.getStationIds();
|
||||||
String type = dto.getType();
|
String type = dto.getType();
|
||||||
String dateTime = dto.getDateTime();
|
String dateTime = dto.getDateTime();
|
||||||
@@ -1202,8 +1206,53 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
|||||||
if (CollectionUtils.isEmpty(orderDetailByStationIds)) {
|
if (CollectionUtils.isEmpty(orderDetailByStationIds)) {
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||||
}
|
}
|
||||||
|
// 统计每天有多少把充电枪口有过充电记录
|
||||||
|
// (key:日期,value:有充电记录的枪口数量)
|
||||||
|
Map<String, Integer> collect = orderDetailByStationIds.stream()
|
||||||
|
.sorted(Comparator.comparing(BusinessOrderDetailInfoVO::getTradeDate))
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
BusinessOrderDetailInfoVO::getTradeDate, // 按日期分组
|
||||||
|
Collectors.mapping(
|
||||||
|
BusinessOrderDetailInfoVO::getPileConnectorCode, // 提取充电枪口编号
|
||||||
|
Collectors.collectingAndThen(
|
||||||
|
Collectors.toSet(), // 使用Set去重
|
||||||
|
Set::size // 计算不同枪口编号的数量
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
TreeMap<String, Integer> map = new TreeMap<>(collect);
|
||||||
|
List<Integer> values = new ArrayList<>(map.values());
|
||||||
|
|
||||||
// 分组出来key为日期,value为订单信息
|
Integer lastDayNum = Constants.zero;
|
||||||
return null;
|
Integer yesterdayNum = Constants.zero;
|
||||||
|
int riseRate = Constants.zero;
|
||||||
|
if (dateTime == null) {
|
||||||
|
// 默认最后一天对比前一天
|
||||||
|
lastDayNum = values.get(values.size() - 1);
|
||||||
|
yesterdayNum = values.get(values.size() - 2);
|
||||||
|
}else {
|
||||||
|
// 目标日期对比目标日期前一天
|
||||||
|
String yesterday = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.addDays(DateUtils.parseDate(dateTime), -1));
|
||||||
|
lastDayNum = map.get(dateTime);
|
||||||
|
yesterdayNum = map.get(yesterday);
|
||||||
|
}
|
||||||
|
// 计算增长率
|
||||||
|
if (yesterdayNum != Constants.zero){
|
||||||
|
riseRate = (lastDayNum - yesterdayNum) / yesterdayNum * 100;
|
||||||
|
}
|
||||||
|
String connectorUsedRiseRate = String.valueOf(riseRate);
|
||||||
|
vo.setConnectorUsedRiseRate(connectorUsedRiseRate);
|
||||||
|
|
||||||
|
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||||
|
String tradeDate = entry.getKey();
|
||||||
|
Integer chargeNum = entry.getValue();
|
||||||
|
BusinessOrderDetailInfoVO orderDetailInfoVO = new BusinessOrderDetailInfoVO();
|
||||||
|
orderDetailInfoVO.setTradeDate(tradeDate);
|
||||||
|
orderDetailInfoVO.setChargeNum(chargeNum);
|
||||||
|
|
||||||
|
list.add(orderDetailInfoVO);
|
||||||
|
}
|
||||||
|
vo.setBusinessOrderDetailInfoVOList(list);
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,13 @@ public class BusinessOrderDetailInfoVO {
|
|||||||
*/
|
*/
|
||||||
private String tradeDate;
|
private String tradeDate;
|
||||||
|
|
||||||
|
private String pileConnectorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电次数
|
||||||
|
*/
|
||||||
|
private Integer chargeNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单号
|
* 订单号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.pile.vo.uniapp.business;
|
package com.jsowell.pile.vo.uniapp.business;
|
||||||
|
|
||||||
import com.jsowell.pile.domain.SettleOrderReport;
|
import com.jsowell.pile.domain.SettleOrderReport;
|
||||||
|
import com.jsowell.pile.vo.web.OrderDetailInfoVO;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -40,6 +41,11 @@ public class StationBusinessAnalyzeInfoVO {
|
|||||||
*/
|
*/
|
||||||
private String orderNumRateGrowthRate;
|
private String orderNumRateGrowthRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枪口利用增长率
|
||||||
|
*/
|
||||||
|
private String connectorUsedRiseRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营端小程序订单详情VO
|
* 运营端小程序订单详情VO
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2959,6 +2959,7 @@
|
|||||||
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,-->
|
||||||
|
t1.pile_connector_code as pileConnectorCode,
|
||||||
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user