mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 高德
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.jsowell.thirdparty.amap.service;
|
||||
|
||||
import com.jsowell.pile.dto.amap.ChargeDeviceDynamicsDTO;
|
||||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||||
import com.jsowell.thirdparty.amap.domain.AMapStationInfo;
|
||||
|
||||
@@ -36,4 +35,6 @@ public interface AMapService {
|
||||
* @return
|
||||
*/
|
||||
String pushChargingOrderInfo(String orderCode);
|
||||
|
||||
List<AMapStationInfo> getStationInfosV2(GetStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.jsowell.thirdparty.amap.service.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -15,6 +17,8 @@ import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
|
||||
import com.jsowell.pile.vo.web.BillingDetailVO;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.thirdparty.amap.domain.*;
|
||||
import com.jsowell.thirdparty.amap.service.AMapService;
|
||||
@@ -31,7 +35,10 @@ import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -116,6 +123,68 @@ public class AMapServiceImpl implements AMapService {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AMapStationInfo> getStationInfosV2(GetStationInfoDTO dto) {
|
||||
List<AMapStationInfo> resultList = Lists.newArrayList();
|
||||
// 设置分页参数
|
||||
int pageNo = dto.getCurrentPage() == null ? 1 : dto.getCurrentPage();
|
||||
int pageSize = dto.getPageSize() == null ? 20 : dto.getPageSize();
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
|
||||
// 第一次查询,得到站点
|
||||
List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfosByThirdParty();
|
||||
PageInfo<PileStationInfo> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<PileStationInfo> stationList = pageInfo.getList();
|
||||
if (CollectionUtils.isEmpty(stationList)) {
|
||||
return resultList;
|
||||
}
|
||||
// 站点id
|
||||
List<String> stationIdList = stationList.stream().map(x -> String.valueOf(x.getId())).collect(Collectors.toList());
|
||||
// 第二次查询,得到计费模板信息
|
||||
Map<String, List<AMapPriceChargingInfo>> priceInfoMap = getPriceInfoByStationIdList(stationIdList);
|
||||
|
||||
// 第三次查询,得到充电桩
|
||||
Map<String, List<AMapEquipmentInfo>> equipmentInfoMap = getPileListByStationIdList(stationIdList);
|
||||
|
||||
// 拼装数据
|
||||
AMapStationInfo aMapInfo = null;
|
||||
for (PileStationInfo stationInfo : stationList) {
|
||||
aMapInfo = new AMapStationInfo();
|
||||
String stationId = String.valueOf(stationInfo.getId());
|
||||
aMapInfo.setStationID(stationId);
|
||||
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, RoundingMode.HALF_UP));
|
||||
aMapInfo.setStationLat(new BigDecimal(stationInfo.getStationLat()).setScale(6, RoundingMode.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.setPriceChargingInfo(priceInfoMap.get(stationId));
|
||||
// 站点设备信息
|
||||
List<AMapEquipmentInfo> equipmentInfos = equipmentInfoMap.get(stationId);
|
||||
aMapInfo.setEquipmentInfos(equipmentInfos);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼装高德需要的格式数据
|
||||
* @param stationInfo 站点信息
|
||||
@@ -268,6 +337,7 @@ public class AMapServiceImpl implements AMapService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据站点id查询计费模板
|
||||
* @param StationId
|
||||
@@ -288,6 +358,37 @@ public class AMapServiceImpl implements AMapService {
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private Map<String, List<AMapPriceChargingInfo>> getPriceInfoByStationIdList(List<String> stationIdList) {
|
||||
Map<String, List<AMapPriceChargingInfo>> resultMap = Maps.newHashMap();
|
||||
|
||||
List<BillingTemplateVO> list = pileBillingTemplateService.selectBillingTemplateByStationIdList(stationIdList);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
List<AMapPriceChargingInfo> priceList;
|
||||
AMapPriceChargingInfo info;
|
||||
for (BillingTemplateVO billingTemplateVO : list) {
|
||||
// billingTemplateVO 站点计费模板
|
||||
priceList = Lists.newArrayList();
|
||||
List<BillingDetailVO> billingDetailList = billingTemplateVO.getBillingDetailList();
|
||||
for (BillingDetailVO billingDetailVO : billingDetailList) {
|
||||
// billingDetailVO 计费模板的尖峰平谷详细信息
|
||||
List<String> applyTime = billingDetailVO.getApplyTime();
|
||||
for (String s : applyTime) {
|
||||
info = new AMapPriceChargingInfo();
|
||||
info.setFeeTime(s);
|
||||
info.setElectricityFee(billingDetailVO.getElectricityPrice());
|
||||
info.setServiceFee(billingDetailVO.getServicePrice());
|
||||
priceList.add(info);
|
||||
}
|
||||
}
|
||||
resultMap.put(billingTemplateVO.getStationId(), priceList);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据站点查询站点下所有桩
|
||||
@@ -321,6 +422,11 @@ public class AMapServiceImpl implements AMapService {
|
||||
return pileList;
|
||||
}
|
||||
|
||||
private Map<String, List<AMapEquipmentInfo>> getPileListByStationIdList(List<String> stationIdList) {
|
||||
Map<String, List<AMapEquipmentInfo>> resultMap = Maps.newHashMap();
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据桩号查询枪口列表
|
||||
|
||||
Reference in New Issue
Block a user