mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
add 新增联联 查询累计数据接口
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.jsowell.thirdparty.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -12,6 +15,9 @@ import java.util.List;
|
||||
* @date 2023/4/15 9:29
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class StationStatsInfo {
|
||||
/**
|
||||
* 充电站 ID
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.jsowell.thirdparty.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询站点信息dto
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/8 10:02
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryStationInfoDTO {
|
||||
/**
|
||||
* 上次查询时间
|
||||
* 格式“yyyy-MM-dd HH:mm:ss”,可以为空,如果
|
||||
* 不填写,则查询所有的充电站信息
|
||||
*/
|
||||
private String LastQueryTime;
|
||||
|
||||
/**
|
||||
* 查询页码
|
||||
* 不填写默认为 1
|
||||
*/
|
||||
private Integer PageNo;
|
||||
|
||||
/**
|
||||
* 每页数量
|
||||
* 不填写默认为 10
|
||||
*/
|
||||
private Integer PageSize;
|
||||
|
||||
|
||||
/**
|
||||
* 充电站 ID
|
||||
*/
|
||||
private String StationID;
|
||||
|
||||
/**
|
||||
* 统计开始时间
|
||||
* 格式“yyyy-MM-dd”
|
||||
*/
|
||||
private String StartTime;
|
||||
|
||||
/**
|
||||
* 统计结束时间
|
||||
* 格式“yyyy-MM-dd”
|
||||
*/
|
||||
private String EndTime;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.jsowell.thirdparty.service;
|
||||
|
||||
import com.jsowell.thirdparty.domain.StationInfo;
|
||||
import com.jsowell.thirdparty.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,5 +31,5 @@ public interface LianLianService {
|
||||
LianLianPageResponse query_station_status(List<String> StationIDs);
|
||||
|
||||
|
||||
LianLianPageResponse query_station_stats(QueryStationInfoDTO dto);
|
||||
StationStatsInfo query_station_stats(QueryStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@ import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.thirdparty.domain.*;
|
||||
import com.jsowell.thirdparty.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.service.LianLianService;
|
||||
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -26,7 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -210,9 +211,52 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LianLianPageResponse query_station_stats(QueryStationInfoDTO dto) {
|
||||
|
||||
return null;
|
||||
public StationStatsInfo query_station_stats(QueryStationInfoDTO dto) {
|
||||
List<EquipmentStatsInfo> equipmentStatsInfoList = new ArrayList<>();
|
||||
List<ConnectorStatsInfo> connectorStatsInfos = new ArrayList<>();
|
||||
BigDecimal stationElectricity = new BigDecimal("0");
|
||||
|
||||
// 根据站点id 查出这段时间的充电量
|
||||
List<AccumulativeInfoVO> accumulativeInfoForLianLian = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
|
||||
|
||||
// 查出站点下所有枪口的充电量
|
||||
Map<String, String> connectorElectricityMap = accumulativeInfoForLianLian.stream()
|
||||
.collect(Collectors.toMap(AccumulativeInfoVO::getPileConnectorCode, AccumulativeInfoVO::getConnectorElectricity));
|
||||
|
||||
// 查出设备列表下所有设备列表的充电量
|
||||
Map<String, String> pileElectricityMap = accumulativeInfoForLianLian.stream()
|
||||
.collect(Collectors.toMap(AccumulativeInfoVO::getPileSn, AccumulativeInfoVO::getConnectorElectricity));
|
||||
|
||||
// 组装数据并返回
|
||||
// 枪口累计数据
|
||||
for (Map.Entry<String, String> entry : connectorElectricityMap.entrySet()) {
|
||||
ConnectorStatsInfo connectorStatsInfo = ConnectorStatsInfo.builder()
|
||||
.ConnectorID(entry.getKey())
|
||||
.ConnectorElectricity(new BigDecimal(entry.getValue()))
|
||||
.build();
|
||||
connectorStatsInfos.add(connectorStatsInfo);
|
||||
}
|
||||
// 桩累计数据
|
||||
for (Map.Entry<String, String> pileEntry : pileElectricityMap.entrySet()) {
|
||||
BigDecimal pileElectricity = new BigDecimal(pileEntry.getValue());
|
||||
EquipmentStatsInfo equipmentStatsInfo = EquipmentStatsInfo.builder()
|
||||
.EquipmentID(pileEntry.getKey())
|
||||
.EquipmentElectricity(new BigDecimal(pileEntry.getValue()))
|
||||
.ConnectorStatsInfos(connectorStatsInfos)
|
||||
.build();
|
||||
equipmentStatsInfoList.add(equipmentStatsInfo);
|
||||
stationElectricity = stationElectricity.add(pileElectricity);
|
||||
}
|
||||
|
||||
StationStatsInfo stationStatsInfo = StationStatsInfo.builder()
|
||||
.StationID(dto.getStationID())
|
||||
.StartTime(dto.getStartTime())
|
||||
.EndTime(dto.getEndTime())
|
||||
.StationElectricity(stationElectricity)
|
||||
.equipmentStatsInfos(equipmentStatsInfoList) // 设备列表
|
||||
.build();
|
||||
|
||||
return stationStatsInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user