update 高德

This commit is contained in:
2023-06-26 14:23:21 +08:00
parent e7aec156e8
commit e10e54ffb2
12 changed files with 109 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ 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.constant.Constants;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
@@ -15,6 +16,7 @@ import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.PileInfoVO;
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
import com.jsowell.pile.vo.web.BillingDetailVO;
@@ -430,7 +432,58 @@ public class AMapServiceImpl implements AMapService {
*/
private Map<String, List<AMapEquipmentInfo>> getPileListByStationIdList(List<String> stationIdList) {
Map<String, List<AMapEquipmentInfo>> resultMap = Maps.newHashMap();
// List<PileDetailVO> pileDetailVOS = pileBasicInfoService.selectPileListByStationIds(stationIdList);
List<PileInfoVO> pileInfoVOS = pileBasicInfoService.queryPileDetailList(stationIdList);
if (CollectionUtils.isEmpty(pileInfoVOS)) {
return resultMap;
}
// 根据站点id分组
Map<String, List<PileInfoVO>> stationMap = pileInfoVOS.stream().collect(Collectors.groupingBy(PileInfoVO::getStationId));
// 处理结果集
List<AMapEquipmentInfo> pileList;
AMapEquipmentInfo info;
List<AMapConnectorInfo> connectorInfos;
AMapConnectorInfo connectorInfo;
for (Map.Entry<String, List<PileInfoVO>> entry : stationMap.entrySet()) {
String stationId = entry.getKey();
// 枪口维度的数据
List<PileInfoVO> pileInfoList = entry.getValue();
if (CollectionUtils.isEmpty(pileInfoList)) {
continue;
}
pileList = Lists.newArrayList();
Map<String, List<PileInfoVO>> pileMap = pileInfoList.stream().collect(Collectors.groupingBy(PileInfoVO::getPileSn));
info = new AMapEquipmentInfo();
for (Map.Entry<String, List<PileInfoVO>> pile : pileMap.entrySet()) {
String pileSn = pile.getKey();
List<PileInfoVO> value = pile.getValue();
PileInfoVO pileInfoVO = value.get(0);
info.setEquipmentID(pileSn);
info.setManufacturerName(Constants.JSOWELL);
info.setEquipmentType(Integer.valueOf(pileInfoVO.getSpeedType()));
info.setPower(new BigDecimal(pileInfoVO.getRatedPower()));
connectorInfos = Lists.newArrayList();
for (PileInfoVO infoVO : value) {
connectorInfo = new AMapConnectorInfo();
connectorInfo.setConnectorID(infoVO.getPileConnectorCode());
Integer connectorType = Integer.parseInt(infoVO.getSpeedType()) == 1 ? 4 : 3;
connectorInfo.setConnectorType(connectorType);
connectorInfo.setPower(new BigDecimal(infoVO.getRatedPower()).setScale(1, RoundingMode.HALF_UP));
connectorInfo.setCurrent(Integer.parseInt(infoVO.getRatedCurrent()));
connectorInfo.setBrandDesc(Constants.JSOWELL);
connectorInfo.setNationalStandard(2);
connectorInfo.setVoltageLowerLimits(0);
connectorInfo.setVoltageUpperLimits(Integer.parseInt(infoVO.getRatedVoltage()));
connectorInfos.add(connectorInfo);
}
info.setConnectorInfos(connectorInfos);
}
pileList.add(info);
resultMap.put(stationId, pileList);
}
return resultMap;
}