mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-20 07:16:00 +08:00
新增 高德查询充电站信息接口
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package com.jsowell.pile.dto.amap;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德地图查询充电站信息DTO
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2023/6/14 13:50
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GetStationInfoDTO {
|
||||||
|
// type=page表示分页查询
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
// 当前请求页数,从1开始
|
||||||
|
private Integer currentPage;
|
||||||
|
|
||||||
|
// 每页记录数,最大20
|
||||||
|
private Integer pageSize;
|
||||||
|
}
|
||||||
@@ -91,7 +91,7 @@ public interface IPileStationInfoService {
|
|||||||
|
|
||||||
PileStationVO getStationInfoByPileSn(String pileSn);
|
PileStationVO getStationInfoByPileSn(String pileSn);
|
||||||
|
|
||||||
List<PileStationInfo> getStationInfoForLianLian();
|
List<PileStationInfo> getStationInfosByThirdParty();
|
||||||
|
|
||||||
List<String> queryByStationDeptIds(List<String> stationIds);
|
List<String> queryByStationDeptIds(List<String> stationIds);
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PileStationInfo> getStationInfoForLianLian() {
|
public List<PileStationInfo> getStationInfosByThirdParty() {
|
||||||
// PageUtils.startPage(pageNum, pageSize);
|
// PageUtils.startPage(pageNum, pageSize);
|
||||||
return pileStationInfoMapper.getStationInfoForLianLian();
|
return pileStationInfoMapper.getStationInfoForLianLian();
|
||||||
}
|
}
|
||||||
|
|||||||
42
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/common/AMapCommonParams.java
vendored
Normal file
42
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/common/AMapCommonParams.java
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package com.jsowell.thirdparty.amap.common;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德地图通用入参
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2023/6/14 13:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AMapCommonParams {
|
||||||
|
// 时间戳(毫秒)
|
||||||
|
@JSONField(name = "utc_timestamp")
|
||||||
|
private String utcTimestamp;
|
||||||
|
|
||||||
|
// 版本号
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
// 字符串编码
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
// 接口全限定名
|
||||||
|
private String method;
|
||||||
|
|
||||||
|
// 签名
|
||||||
|
private String sign;
|
||||||
|
|
||||||
|
// 签名类型
|
||||||
|
@JSONField(name = "sign_type")
|
||||||
|
private String signType;
|
||||||
|
|
||||||
|
// 应用id
|
||||||
|
@JSONField(name = "app_id")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
// 请求业务体
|
||||||
|
@JSONField(name = "biz_content")
|
||||||
|
private String bizContent;
|
||||||
|
}
|
||||||
55
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/common/AMapCommonResult.java
vendored
Normal file
55
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/common/AMapCommonResult.java
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package com.jsowell.thirdparty.amap.common;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德地图通用返回类
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2023/6/14 13:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AMapCommonResult {
|
||||||
|
|
||||||
|
private Response response;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Response{
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
private Object data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AMapCommonResult(Response response) {
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AMapCommonResult() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功响应
|
||||||
|
* @param responseData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public AMapCommonResult successResponse(Object responseData) {
|
||||||
|
AMapCommonResult result = new AMapCommonResult();
|
||||||
|
result.response.setCode("1000");
|
||||||
|
result.response.setMsg("请求成功");
|
||||||
|
result.response.setData(responseData);
|
||||||
|
return new AMapCommonResult(result.response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AMapCommonResult failedResponse() {
|
||||||
|
AMapCommonResult result = new AMapCommonResult();
|
||||||
|
result.response.setCode("40004");
|
||||||
|
result.response.setMsg("接口异常");
|
||||||
|
return new AMapCommonResult(result.response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,7 +85,7 @@ public class AMapStationInfo {
|
|||||||
* 7:不对外开放
|
* 7:不对外开放
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "OpenType")
|
@JSONField(name = "OpenType")
|
||||||
private String openType;
|
private Integer openType;
|
||||||
|
|
||||||
// 车位数量 可停放进行充电的车位总数,默认:0 未知
|
// 车位数量 可停放进行充电的车位总数,默认:0 未知
|
||||||
@JSONField(name = "ParkNums")
|
@JSONField(name = "ParkNums")
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.jsowell.thirdparty.amap.service;
|
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
|
* 高德地图Service
|
||||||
*
|
*
|
||||||
@@ -7,4 +12,11 @@ package com.jsowell.thirdparty.amap.service;
|
|||||||
* @Date 2023/6/14 11:38
|
* @Date 2023/6/14 11:38
|
||||||
*/
|
*/
|
||||||
public interface AMapService {
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -227,7 +227,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||||
|
|
||||||
PageUtils.startPage(pageNo, pageSize);
|
PageUtils.startPage(pageNo, pageSize);
|
||||||
List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfoForLianLian();
|
List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfosByThirdParty();
|
||||||
if (CollectionUtils.isEmpty(stationInfos)) {
|
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||||
// 未查到数据
|
// 未查到数据
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user