update 联联平台查询累计数据

This commit is contained in:
Lemon
2023-04-18 16:45:49 +08:00
parent 05988af02f
commit d2b2c518c9
3 changed files with 31 additions and 34 deletions

View File

@@ -5,6 +5,7 @@ import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.thirdparty.service.LianLianService; import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.thirdparty.vo.LianLianPageResponse; import com.jsowell.thirdparty.vo.LianLianPageResponse;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@@ -50,8 +51,8 @@ public class LianLianController extends BaseController {
} }
/** /**
* 查询充电站状态信息 * 联联平台查询充电站状态信息
* @param dto * @param StationIDs
* @return * @return
*/ */
@PostMapping("/query_station_status") @PostMapping("/query_station_status")
@@ -71,4 +72,24 @@ public class LianLianController extends BaseController {
logger.info("联联平台查询充电站状态信息 result:{}", response); logger.info("联联平台查询充电站状态信息 result:{}", response);
return response; return response;
} }
/**
* 查询统计信息
* @param dto
* @return
*/
@PostMapping("/query_station_stats")
public RestApiResponse<?> query_station_stats(@RequestBody QueryStationInfoDTO dto) {
logger.info("联联平台查询统计信息 params :{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response;
try {
StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto);
response = new RestApiResponse<>(stationStatsInfo);
} catch (Exception e) {
logger.error("联联平台查询统计信息 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台查询统计信息 result :{}", response);
return response;
}
} }

View File

@@ -1,5 +1,6 @@
package com.jsowell.pile.dto; package com.jsowell.pile.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@@ -23,35 +24,41 @@ public class QueryStationInfoDTO {
* 格式“yyyy-MM-dd HH:mm:ss”可以为空如果 * 格式“yyyy-MM-dd HH:mm:ss”可以为空如果
* 不填写,则查询所有的充电站信息 * 不填写,则查询所有的充电站信息
*/ */
@JsonProperty(value = "LastQueryTime")
private String LastQueryTime; private String LastQueryTime;
/** /**
* 查询页码 * 查询页码
* 不填写默认为 1 * 不填写默认为 1
*/ */
@JsonProperty(value = "PageNo")
private Integer PageNo; private Integer PageNo;
/** /**
* 每页数量 * 每页数量
* 不填写默认为 10 * 不填写默认为 10
*/ */
@JsonProperty(value = "PageSize")
private Integer PageSize; private Integer PageSize;
/** /**
* 充电站 ID * 充电站 ID
*/ */
@JsonProperty(value = "StationID")
private String StationID; private String StationID;
/** /**
* 统计开始时间 * 统计开始时间
* 格式“yyyy-MM-dd” * 格式“yyyy-MM-dd”
*/ */
@JsonProperty(value = "StartTime")
private String StartTime; private String StartTime;
/** /**
* 统计结束时间 * 统计结束时间
* 格式“yyyy-MM-dd” * 格式“yyyy-MM-dd”
*/ */
@JsonProperty(value = "EndTime")
private String EndTime; private String EndTime;
} }

View File

@@ -293,38 +293,7 @@ public class LianLianServiceImpl implements LianLianService {
// 所有充电桩用电量之和 // 所有充电桩用电量之和
stationElectricity = stationElectricity.add(pileElec); stationElectricity = stationElectricity.add(pileElec);
} }
// 查出站点下所有枪口的充电量
// Map<String, String> connectorElectricityMap = list.stream()
// .collect(Collectors.toMap(AccumulativeInfoVO::getPileConnectorCode, AccumulativeInfoVO::getConnectorElectricity));
//
// // 查出设备列表下所有设备列表的充电量
// Map<String, String> pileElectricityMap = list.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() StationStatsInfo stationStatsInfo = StationStatsInfo.builder()
.StationID(dto.getStationID()) .StationID(dto.getStationID())
.StartTime(dto.getStartTime()) .StartTime(dto.getStartTime())