mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
新增 南瑞平台 query_stations_info 接口
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.jsowell.thirdparty.nanrui.service;
|
||||
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 南瑞Service
|
||||
@@ -10,5 +13,19 @@ import java.text.ParseException;
|
||||
*/
|
||||
public interface NRService {
|
||||
|
||||
/**
|
||||
* 推送充电站信息
|
||||
* @param stationId
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public String notification_stationInfo(String stationId) throws ParseException;
|
||||
|
||||
|
||||
/**
|
||||
* 联联平台获取充电站信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, String> query_stations_info(QueryStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
package com.jsowell.thirdparty.nanrui.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.ykc.PileStatusEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileConnectorInfoService;
|
||||
import com.jsowell.pile.service.IPileModelInfoService;
|
||||
import com.jsowell.pile.service.IPileStationInfoService;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationInfo;
|
||||
import com.jsowell.thirdparty.nanrui.domain.NRConnectorInfo;
|
||||
import com.jsowell.thirdparty.nanrui.domain.NREquipmentInfo;
|
||||
import com.jsowell.thirdparty.nanrui.domain.NRStationInfo;
|
||||
@@ -23,10 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
@@ -48,6 +49,9 @@ public class NRServiceImpl implements NRService {
|
||||
@Autowired
|
||||
private IPileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
/**
|
||||
* 充电站信息变化推送
|
||||
* @param stationId
|
||||
@@ -91,12 +95,103 @@ public class NRServiceImpl implements NRService {
|
||||
nrStationInfo.setStationType(Integer.parseInt(stationType));
|
||||
nrStationInfo.setConstruction(255);
|
||||
|
||||
List<NREquipmentInfo> nrEquipmentInfos = getEquipmentInfo(stationId);
|
||||
nrStationInfo.setEquipmentInfos(nrEquipmentInfos);
|
||||
|
||||
// TODO 推送到平台
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> query_stations_info(QueryStationInfoDTO dto) {
|
||||
List<NRStationInfo> resultList = new ArrayList<>();
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
|
||||
// 查询密钥等配置
|
||||
// ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
// if (configInfo == null) {
|
||||
// return null;
|
||||
// }
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
List<PileStationInfo> stationInfos = pileStationInfoService.getStationInfosByThirdParty();
|
||||
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
PageInfo<PileStationInfo> pageInfo = new PageInfo<>(stationInfos);
|
||||
for (PileStationInfo pileStationInfo : pageInfo.getList()) {
|
||||
// 拼装参数
|
||||
NRStationInfo nrStationInfo = NRStationInfo.builder()
|
||||
.stationId("NR" + pileStationInfo.getId())
|
||||
.operatorID(Constants.OPERATORID_LIANLIAN)
|
||||
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
.countryCode(pileStationInfo.getCountryCode())
|
||||
.areaCode(pileStationInfo.getAreaCode())
|
||||
.address(pileStationInfo.getAddress())
|
||||
.serviceTel(pileStationInfo.getStationTel())
|
||||
.stationStatus(Integer.parseInt(pileStationInfo.getStationStatus()))
|
||||
.parkNums(0)
|
||||
.stationLng(new BigDecimal(pileStationInfo.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP))
|
||||
.stationLat(new BigDecimal(pileStationInfo.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP))
|
||||
.openForBusinessDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.parseDate(pileStationInfo.getCreateTime())))
|
||||
.openAllDay(Integer.parseInt(pileStationInfo.getOpenAllDay()))
|
||||
.busineHours(pileStationInfo.getBusinessHours())
|
||||
// .minElectricityPrice(pileStationInfo.getElectricityPrice().add(pileStationInfo.getServicePrice()))
|
||||
// .equipmentInfos()
|
||||
.build();
|
||||
// 站点费率
|
||||
// 查计费模板
|
||||
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(String.valueOf(pileStationInfo.getId()));
|
||||
if (currentTimePriceDetails == null) {
|
||||
// 未设置计费模板
|
||||
continue;
|
||||
}
|
||||
String electricityPrice = currentTimePriceDetails.getElectricityPrice();
|
||||
electricityPrice = StringUtils.isBlank(electricityPrice) ? "0" : electricityPrice;
|
||||
|
||||
String servicePrice = currentTimePriceDetails.getServicePrice();
|
||||
servicePrice = StringUtils.isBlank(servicePrice) ? "0" : servicePrice;
|
||||
|
||||
BigDecimal price = new BigDecimal(electricityPrice).add(new BigDecimal(servicePrice));
|
||||
nrStationInfo.setMinElectricityPrice(price);
|
||||
|
||||
// 站点图片
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getPictures())) {
|
||||
nrStationInfo.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(",")));
|
||||
}
|
||||
// 站点类型
|
||||
String stationType = pileStationInfo.getStationType();
|
||||
if (!StringUtils.equals("1", stationType) && !StringUtils.equals("255", stationType)) {
|
||||
// 不为1-公共并且不为255-其他,都为专用
|
||||
stationType = "2";
|
||||
}
|
||||
nrStationInfo.setStationType(Integer.parseInt(stationType));
|
||||
nrStationInfo.setConstruction(255);
|
||||
|
||||
List<NREquipmentInfo> nrEquipmentInfos = getEquipmentInfo(String.valueOf(pileStationInfo.getId()));
|
||||
nrStationInfo.setEquipmentInfos(nrEquipmentInfos);
|
||||
|
||||
resultList.add(nrStationInfo);
|
||||
}
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("PageNo", pageInfo.getPageNum());
|
||||
map.put("PageCount", pageInfo.getPages());
|
||||
map.put("ItemSize", resultList.size());
|
||||
map.put("StationInfos", resultList);
|
||||
|
||||
// TODO 发送数据
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备信息
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
private List<NREquipmentInfo> getEquipmentInfo(String stationId) {
|
||||
List<NREquipmentInfo> resultList = new ArrayList<>();
|
||||
List<PileBasicInfo> list = pileBasicInfoService.getPileListByStationId(stationId);
|
||||
@@ -136,6 +231,11 @@ public class NRServiceImpl implements NRService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取枪口信息
|
||||
* @param pileSn
|
||||
* @return
|
||||
*/
|
||||
private List<NRConnectorInfo> getConnectorInfo(String pileSn) {
|
||||
List<NRConnectorInfo> resultList = new ArrayList<>();
|
||||
List<PileConnectorInfo> list = pileConnectorInfoService.selectPileConnectorInfoList(pileSn);
|
||||
|
||||
Reference in New Issue
Block a user