mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
新增 高德查询充电站信息接口
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package com.jsowell.thirdparty.amap.service;
|
||||
|
||||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||||
import com.jsowell.thirdparty.amap.domain.AMapStationInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 高德地图Service
|
||||
*
|
||||
@@ -7,4 +12,11 @@ package com.jsowell.thirdparty.amap.service;
|
||||
* @Date 2023/6/14 11:38
|
||||
*/
|
||||
public interface AMapService {
|
||||
|
||||
/**
|
||||
* 高德拉取充电站静态数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<AMapStationInfo> getStationInfos(GetStationInfoDTO dto);
|
||||
}
|
||||
|
||||
107
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java
vendored
Normal file
107
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
package com.jsowell.thirdparty.amap.service.impl;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||||
import com.jsowell.pile.service.IPileConnectorInfoService;
|
||||
import com.jsowell.pile.service.IPileStationInfoService;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.thirdparty.amap.domain.AMapStationInfo;
|
||||
import com.jsowell.thirdparty.amap.service.AMapService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 高德地图Service
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/6/14 13:54
|
||||
*/
|
||||
@Service
|
||||
public class AMapServiceImpl implements AMapService {
|
||||
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
/**
|
||||
* 高德拉取充电站静态数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AMapStationInfo> getStationInfos(GetStationInfoDTO dto) {
|
||||
List<AMapStationInfo> resultList = new ArrayList<>();
|
||||
if (StringUtils.equals("page", dto.getType())) {
|
||||
int pageNo = dto.getCurrentPage() == null ? 1 : dto.getCurrentPage();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
// 设置分页参数
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
}
|
||||
// 查询站点信息
|
||||
List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfosByThirdParty();
|
||||
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
AMapStationInfo aMapInfo;
|
||||
// 拼装高德格式数据
|
||||
for (PileStationInfo stationInfo : stationInfos) {
|
||||
aMapInfo = new AMapStationInfo();
|
||||
|
||||
aMapInfo.setStationID(String.valueOf(stationInfo.getId()));
|
||||
aMapInfo.setOperatorID("");
|
||||
aMapInfo.setEquipmentOwnerID("");
|
||||
aMapInfo.setOperatorName("");
|
||||
aMapInfo.setStationName(stationInfo.getStationName());
|
||||
aMapInfo.setCountryCode(stationInfo.getCountryCode());
|
||||
aMapInfo.setAreaCode(stationInfo.getAreaCode());
|
||||
aMapInfo.setAddress(stationInfo.getAddress());
|
||||
aMapInfo.setServiceTel(stationInfo.getServiceTel());
|
||||
aMapInfo.setStationType(Integer.parseInt(stationInfo.getStationType()));
|
||||
aMapInfo.setStationStatus(Integer.parseInt(stationInfo.getStationStatus()));
|
||||
Integer openType = Integer.parseInt(stationInfo.getPublicFlag()) == 0 ? 7 : 0;
|
||||
aMapInfo.setOpenType(openType);
|
||||
aMapInfo.setParkNums(0);
|
||||
aMapInfo.setStationLng(new BigDecimal(stationInfo.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP));
|
||||
aMapInfo.setStationLat(new BigDecimal(stationInfo.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP));
|
||||
String construction = stationInfo.getConstruction();
|
||||
if (StringUtils.equals("12", construction) || StringUtils.equals("13", construction) ||
|
||||
StringUtils.equals("14", construction) || StringUtils.equals("15", construction)) {
|
||||
construction = "255";
|
||||
}
|
||||
aMapInfo.setConstruction(Integer.parseInt(construction));
|
||||
aMapInfo.setBusineHours(stationInfo.getBusinessHours());
|
||||
// aMapInfo.setAMapPriceChargingInfo();
|
||||
int fastTotal = 0;
|
||||
int slowTotal = 0;
|
||||
List<ConnectorInfoVO> connectorList = pileConnectorInfoService.getUniAppConnectorList(stationInfo.getId());
|
||||
for (ConnectorInfoVO connectorVO : connectorList) {
|
||||
if (StringUtils.equals(connectorVO.getChargingType(), Constants.ONE)) {
|
||||
// 快充
|
||||
fastTotal += 1;
|
||||
} else {
|
||||
// 慢充
|
||||
slowTotal += 1;
|
||||
}
|
||||
}
|
||||
aMapInfo.setFastEquipmentNum(fastTotal);
|
||||
aMapInfo.setSlowEquipmentNum(slowTotal);
|
||||
// aMapInfo.setAMapEquipmentInfos();
|
||||
|
||||
|
||||
|
||||
resultList.add(aMapInfo);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user