mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 03:39:55 +08:00
新增 南瑞相关接口
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package com.jsowell.thirdparty.nanrui.domain;
|
package com.jsowell.thirdparty.nanrui.domain;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -12,6 +15,9 @@ import java.util.List;
|
|||||||
* @Date 2023/9/25 14:32
|
* @Date 2023/9/25 14:32
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
public class NRStationStatusInfo {
|
public class NRStationStatusInfo {
|
||||||
|
|
||||||
@JSONField(name = "StationID")
|
@JSONField(name = "StationID")
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package com.jsowell.thirdparty.nanrui.service;
|
|||||||
|
|
||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
|
import com.jsowell.thirdparty.nanrui.domain.NRStationStatusInfo;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,4 +48,12 @@ public interface NRService {
|
|||||||
* 充电过程中运营商平台应 每分钟 上报充电包含电流、电压在内的监测数据。
|
* 充电过程中运营商平台应 每分钟 上报充电包含电流、电压在内的监测数据。
|
||||||
*/
|
*/
|
||||||
String notification_stationStatus(RealTimeMonitorData realTimeMonitorData);
|
String notification_stationStatus(RealTimeMonitorData realTimeMonitorData);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备接口状态
|
||||||
|
* @param stationIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String query_station_status(List<String> stationIds);
|
||||||
}
|
}
|
||||||
@@ -11,9 +11,12 @@ import com.jsowell.common.util.DateUtils;
|
|||||||
import com.jsowell.common.util.PageUtils;
|
import com.jsowell.common.util.PageUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.*;
|
import com.jsowell.pile.domain.*;
|
||||||
|
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
import com.jsowell.pile.service.*;
|
import com.jsowell.pile.service.*;
|
||||||
|
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||||||
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||||
import com.jsowell.pile.vo.web.PileStationVO;
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorInfo;
|
import com.jsowell.thirdparty.lianlian.domain.ConnectorInfo;
|
||||||
@@ -26,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
@@ -261,6 +265,80 @@ public class NRServiceImpl implements NRService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String query_station_status(List<String> stationIds) {
|
||||||
|
List<NRStationStatusInfo> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 将 stationIdList 转换成 List<Long>
|
||||||
|
List<Long> stationLongList = stationIds.stream()
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
QueryConnectorListDTO dto = QueryConnectorListDTO.builder()
|
||||||
|
.stationIdList(stationLongList)
|
||||||
|
.build();
|
||||||
|
List<PileConnectorInfoVO> connectorInfoVOS = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||||
|
if (CollectionUtils.isEmpty(connectorInfoVOS)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 根据stationId分组
|
||||||
|
Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOS.stream()
|
||||||
|
.collect(Collectors.groupingBy(PileConnectorInfoVO::getStationId));
|
||||||
|
// 遍历 map
|
||||||
|
for (Map.Entry<String, List<PileConnectorInfoVO>> entry : collect.entrySet()) {
|
||||||
|
String stationId = entry.getKey();
|
||||||
|
List<PileConnectorInfoVO> connectorList = entry.getValue();
|
||||||
|
List<NRConnectorStatusInfo> connectorStatusInfoList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (PileConnectorInfoVO connectorInfoVO : connectorList) {
|
||||||
|
NRConnectorStatusInfo nrConnectorStatusInfo = NRConnectorStatusInfo.builder()
|
||||||
|
.connectorID(connectorInfoVO.getPileConnectorCode())
|
||||||
|
.status(connectorInfoVO.getStatus())
|
||||||
|
.currentA(0)
|
||||||
|
.voltageA(0)
|
||||||
|
.soc(BigDecimal.ZERO)
|
||||||
|
.beginTime(null)
|
||||||
|
.currentKwh(BigDecimal.ZERO)
|
||||||
|
.timeStamp((int) (System.currentTimeMillis() / 1000))
|
||||||
|
|
||||||
|
.build();
|
||||||
|
if (StringUtils.equals(String.valueOf(connectorInfoVO.getStatus()), "3")) {
|
||||||
|
// 充电中
|
||||||
|
nrConnectorStatusInfo.setCurrentA(connectorInfoVO.getCurrent().intValue());
|
||||||
|
nrConnectorStatusInfo.setVoltageA(connectorInfoVO.getVoltage().intValue());
|
||||||
|
nrConnectorStatusInfo.setSoc(new BigDecimal(connectorInfoVO.getSOC()));
|
||||||
|
String chargingTime = connectorInfoVO.getChargingTime();
|
||||||
|
Date beginTime = DateUtils.addMinute(new Date(), -Integer.parseInt(chargingTime));
|
||||||
|
nrConnectorStatusInfo.setBeginTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, beginTime));
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(String.valueOf(connectorInfoVO.getStatus()), "255")) {
|
||||||
|
// 故障
|
||||||
|
nrConnectorStatusInfo.setStatus(255);
|
||||||
|
}
|
||||||
|
connectorStatusInfoList.add(nrConnectorStatusInfo);
|
||||||
|
}
|
||||||
|
// 封装参数
|
||||||
|
NRStationStatusInfo stationStatusInfo = NRStationStatusInfo.builder()
|
||||||
|
.stationId(stationId)
|
||||||
|
.connectorStatusInfos(connectorStatusInfoList)
|
||||||
|
.build();
|
||||||
|
resultList.add(stationStatusInfo);
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("StationStatusInfos", resultList);
|
||||||
|
|
||||||
|
// TODO 发送请求
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String chargingTime = "30";
|
||||||
|
Date beginTime = DateUtils.addMinute(new Date(), -Integer.parseInt(chargingTime));
|
||||||
|
String s = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, beginTime);
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备信息
|
* 获取设备信息
|
||||||
* @param stationId
|
* @param stationId
|
||||||
|
|||||||
Reference in New Issue
Block a user