mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-13 14:30:08 +08:00
新增 深圳平台 查询充电站列表接口
This commit is contained in:
@@ -1122,6 +1122,8 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||||
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||||
connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent()));
|
connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent()));
|
||||||
|
connectorInfo.setConnectorName(pileConnectorInfo.getPileConnectorCode());
|
||||||
|
|
||||||
if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) {
|
if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) {
|
||||||
// 如果不是单枪,则枪口功率需要除以枪口数量
|
// 如果不是单枪,则枪口功率需要除以枪口数量
|
||||||
String ratedPowerStr = modelInfo.getRatedPower();
|
String ratedPowerStr = modelInfo.getRatedPower();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsowell.thirdparty.platform.service.impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
@@ -10,31 +11,37 @@ import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
|||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.JWTUtils;
|
import com.jsowell.common.util.JWTUtils;
|
||||||
|
import com.jsowell.common.util.PageUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||||
|
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
||||||
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
import com.jsowell.pile.service.PileBasicInfoService;
|
import com.jsowell.pile.service.PileBasicInfoService;
|
||||||
import com.jsowell.pile.service.PileStationInfoService;
|
import com.jsowell.pile.service.PileStationInfoService;
|
||||||
|
import com.jsowell.pile.service.ThirdPartyStationRelationService;
|
||||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||||
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||||
|
import com.jsowell.pile.thirdparty.ZDLStationInfo;
|
||||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||||
import com.jsowell.pile.vo.web.PileStationVO;
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||||
import com.jsowell.thirdparty.platform.common.StationInfo;
|
import com.jsowell.thirdparty.platform.common.StationInfo;
|
||||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
import com.jsowell.thirdparty.platform.util.*;
|
||||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
|
||||||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
|
||||||
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
|
|
||||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 深圳平台 Service
|
* 深圳平台 Service
|
||||||
@@ -51,6 +58,9 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PileBasicInfoService pileBasicInfoService;
|
private PileBasicInfoService pileBasicInfoService;
|
||||||
|
|
||||||
@@ -133,9 +143,6 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
String operatorId = dto.getOperatorID();
|
String operatorId = dto.getOperatorID();
|
||||||
// 通过operatorId 查出 相关配置信息
|
// 通过operatorId 查出 相关配置信息
|
||||||
ThirdPartySecretInfoVO secretInfoVO = getShenZhenSecretInfo();
|
ThirdPartySecretInfoVO secretInfoVO = getShenZhenSecretInfo();
|
||||||
if (secretInfoVO == null) {
|
|
||||||
throw new BusinessException("1", "无此对接平台");
|
|
||||||
}
|
|
||||||
|
|
||||||
String operatorSecret = secretInfoVO.getOurOperatorSecret();
|
String operatorSecret = secretInfoVO.getOurOperatorSecret();
|
||||||
String dataSecret = secretInfoVO.getOurDataSecret();
|
String dataSecret = secretInfoVO.getOurDataSecret();
|
||||||
@@ -167,22 +174,86 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
vo.setFailReason(0);
|
vo.setFailReason(0);
|
||||||
vo.setSuccStat(0);
|
vo.setSuccStat(0);
|
||||||
|
|
||||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, secretInfoVO);
|
||||||
// 加密数据
|
|
||||||
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
|
||||||
dataSecret.getBytes(), dataSecretIv.getBytes());
|
|
||||||
String encryptData = Encodes.encodeBase64(encryptText); // data
|
|
||||||
resultMap.put("Ret", "0");
|
|
||||||
resultMap.put("Msg", "请求令牌成功!");
|
|
||||||
resultMap.put("Data", encryptData);
|
|
||||||
// 生成sig
|
|
||||||
String resultSign = GBSignUtils.sign(resultMap, signSecret);
|
|
||||||
resultMap.put("Sig", resultSign);
|
|
||||||
|
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询充电站信息 query_stations_info
|
||||||
|
* @param dto 查询站点信息dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
|
||||||
|
List<StationInfo> resultList = new ArrayList<>();
|
||||||
|
// 查询出要查询的充电站id并set进 dto 的stationIds
|
||||||
|
if (StringUtils.isNotBlank(dto.getThirdPlatformType())) {
|
||||||
|
List<ThirdPartyStationRelation> relationList = thirdPartyStationRelationService.selectThirdPartyStationRelationList(dto.getThirdPlatformType());
|
||||||
|
if (CollectionUtils.isNotEmpty(relationList)) {
|
||||||
|
List<String> stationList = relationList.stream()
|
||||||
|
.map(x -> String.valueOf(x.getStationId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
dto.setStationIds(stationList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置分页参数
|
||||||
|
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||||
|
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||||
|
|
||||||
|
PageUtils.startPage(pageNo, pageSize);
|
||||||
|
// 查询站点信息数据
|
||||||
|
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto);
|
||||||
|
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||||
|
// 未查到数据
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||||
|
StationInfo stationInfo = null;
|
||||||
|
for (ThirdPartyStationInfoVO stationVO : pageInfo.getList()) {
|
||||||
|
Long stationId = stationVO.getId();
|
||||||
|
stationInfo = StationInfo.builder()
|
||||||
|
.stationID(String.valueOf(stationVO.getId()))
|
||||||
|
.operatorID(Constants.OPERATORID_JIANG_SU)
|
||||||
|
// .equipmentOwnerID()
|
||||||
|
.stationName(stationVO.getStationName())
|
||||||
|
.countryCode(stationVO.getCountryCode())
|
||||||
|
.areaCode(stationVO.getAreaCode())
|
||||||
|
.address(stationVO.getAddress())
|
||||||
|
.stationType(Integer.parseInt(stationVO.getStationType()))
|
||||||
|
.stationStatus(Integer.parseInt(stationVO.getStationStatus()))
|
||||||
|
.parkNums(0) // 默认 0:未知
|
||||||
|
.stationLng(new BigDecimal(stationVO.getStationLng()))
|
||||||
|
.stationLat(new BigDecimal(stationVO.getStationLat()))
|
||||||
|
.construction(Integer.parseInt(stationVO.getConstruction()))
|
||||||
|
|
||||||
|
.build();
|
||||||
|
String stationTel = stationVO.getStationTel();
|
||||||
|
if (StringUtils.isNotBlank(stationTel)) {
|
||||||
|
stationInfo.setStationTel(stationTel);
|
||||||
|
stationInfo.setServiceTel(stationTel);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(stationVO.getPictures())) {
|
||||||
|
stationInfo.setPictures(Lists.newArrayList(stationVO.getPictures().split(",")));
|
||||||
|
}
|
||||||
|
// 设备信息列表
|
||||||
|
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(String.valueOf(stationId));
|
||||||
|
stationInfo.setEquipmentInfos(pileList);
|
||||||
|
|
||||||
|
resultList.add(stationInfo);
|
||||||
|
}
|
||||||
|
ThirdPartySecretInfoVO shenZhenSecretInfo = getShenZhenSecretInfo();
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("PageNo", pageInfo.getPageNum());
|
||||||
|
jsonObject.put("PageCount", pageInfo.getPages());
|
||||||
|
jsonObject.put("ItemSize", resultList.size());
|
||||||
|
jsonObject.put("StationInfos", resultList);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(jsonObject, shenZhenSecretInfo);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取深圳平台相关密钥信息
|
* 获取深圳平台相关密钥信息
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
Reference in New Issue
Block a user