mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
新增新电途推送接口
This commit is contained in:
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.enums.lianlian.StationPaymentEnum;
|
||||
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum;
|
||||
@@ -20,15 +21,18 @@ import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.pile.thirdparty.ConnectorInfo;
|
||||
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||
import com.jsowell.pile.util.MerchantUtils;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileMerchantInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatsInfo;
|
||||
@@ -36,6 +40,7 @@ import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.EquipmentStatsInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationStatsInfo;
|
||||
import com.jsowell.thirdparty.lianlian.vo.*;
|
||||
import com.jsowell.thirdparty.platform.common.StationInfo;
|
||||
import com.jsowell.thirdparty.platform.domain.ChargeOrderInfo;
|
||||
import com.jsowell.thirdparty.platform.domain.SupChargeDetails;
|
||||
import com.jsowell.thirdparty.platform.domain.SupEquipChargeStatusInfo;
|
||||
@@ -94,6 +99,9 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService {
|
||||
@Autowired
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
@Autowired
|
||||
private PileModelInfoService pileModelInfoService;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
ThirdPartyPlatformFactory.register(thirdPlatformType, this);
|
||||
@@ -160,67 +168,110 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService {
|
||||
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
|
||||
dto.setThirdPlatformType(thirdPlatformType);
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto);
|
||||
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.selectStationInfosByThirdParty(dto);
|
||||
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
// ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinDiantuPlatformSecretInfo();
|
||||
|
||||
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<SupStationInfo> resultList = new ArrayList<>();
|
||||
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||
SupStationInfo stationInfo = new SupStationInfo();
|
||||
String stationId = String.valueOf(pileStationInfo.getId());
|
||||
stationInfo.setStationID(stationId);
|
||||
// MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId()));
|
||||
stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码
|
||||
stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId()));
|
||||
stationInfo.setStationID(String.valueOf(pileStationInfo.getId()));
|
||||
stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码
|
||||
String organizationCode = pileStationInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
stationInfo.setEquipmentOwnerID(equipmentOwnerId);
|
||||
}else {
|
||||
stationInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU);
|
||||
}
|
||||
stationInfo.setStationName(pileStationInfo.getStationName());
|
||||
stationInfo.setIsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()));
|
||||
stationInfo.setIsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()));
|
||||
stationInfo.setCountryCode(pileStationInfo.getCountryCode());
|
||||
stationInfo.setAreaCode(pileStationInfo.getAreaCode());
|
||||
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
|
||||
// 根据逗号分组
|
||||
String[] split = StringUtils.split(areaCode, ",");
|
||||
// 只取最后一部分 330213
|
||||
String subAreaCode = split[split.length - 1];
|
||||
stationInfo.setAreaCode(subAreaCode);
|
||||
stationInfo.setAddress(pileStationInfo.getAddress());
|
||||
stationInfo.setServiceTel(pileStationInfo.getStationTel());
|
||||
stationInfo.setStationType(Integer.valueOf(pileStationInfo.getStationType()));
|
||||
stationInfo.setParkNums(Integer.valueOf(pileStationInfo.getParkNums()));
|
||||
stationInfo.setStationType(Integer.parseInt(pileStationInfo.getStationType()));
|
||||
stationInfo.setStationStatus(Integer.parseInt(pileStationInfo.getStationStatus()));
|
||||
stationInfo.setParkNums(Integer.parseInt(pileStationInfo.getParkNums()));
|
||||
stationInfo.setStationLng(new BigDecimal(pileStationInfo.getStationLng()));
|
||||
stationInfo.setStationLat(new BigDecimal(pileStationInfo.getStationLat()));
|
||||
stationInfo.setConstruction(Integer.valueOf(pileStationInfo.getConstruction()));
|
||||
stationInfo.setOpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()));
|
||||
// stationInfo.setMinElectricityPrice(pileStationInfo); // 最低充电电费率
|
||||
// stationInfo.setElectricityFee(); // 电费 xx元/度
|
||||
// stationInfo.setServiceFee(); // 服务费 xx元/度
|
||||
stationInfo.setParkFree(Integer.valueOf(pileStationInfo.getParkFree()));
|
||||
stationInfo.setPayment(pileStationInfo.getPayment());
|
||||
stationInfo.setSupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()));
|
||||
// stationInfo.setParkFeeType(pileStationInfo); // 停车收费类型
|
||||
stationInfo.setToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()));
|
||||
stationInfo.setStoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag()));
|
||||
stationInfo.setRestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()));
|
||||
stationInfo.setLoungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()));
|
||||
stationInfo.setCanopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()));
|
||||
stationInfo.setPrinterFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()));
|
||||
stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()));
|
||||
stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()));
|
||||
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
|
||||
stationInfo.setConstruction(Integer.parseInt(pileStationInfo.getConstruction()));
|
||||
|
||||
// 停车费率描述
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getParkFeeDescribe())) {
|
||||
stationInfo.setParkFee(pileStationInfo.getParkFeeDescribe());
|
||||
}
|
||||
// 站点图片
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getPictures())) {
|
||||
stationInfo.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(",")));
|
||||
}
|
||||
|
||||
List<EquipmentInfo> pileList = getPileList(pileStationInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||
}
|
||||
|
||||
resultList.add(stationInfo);
|
||||
}
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("PageNo", pageInfo.getPageNum());
|
||||
map.put("ItemSize", resultList.size());
|
||||
map.put("PageCount", pageInfo.getPages());
|
||||
map.put("ItemSize", pageInfo.getTotal());
|
||||
map.put("PageNo", pageInfo.getPageNum());
|
||||
map.put("StationInfos", resultList);
|
||||
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 充电站信息变化推送 notification_stationInfo
|
||||
* 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台
|
||||
*
|
||||
* @param stationId 充电站id
|
||||
* @throws UnsupportedOperationException 未实现异常
|
||||
*/
|
||||
@Override
|
||||
public String notificationStationInfo(String stationId) {
|
||||
// 通过id查询站点相关信息
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
|
||||
// 通过第三方配置类型查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = new ThirdPartySettingInfo();
|
||||
settingInfo.setType(thirdPlatformType);
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinDiantuPlatformSecretInfo();
|
||||
|
||||
String operatorId = thirdPartySecretInfoVO.getOurOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 调用联联平台接口
|
||||
String url = urlAddress + "notification_station_detail";
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("StationID", stationId);
|
||||
|
||||
String jsonString = JSON.toJSONString(data);
|
||||
|
||||
// 获取令牌
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
return HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询统计信息 query_station_stats
|
||||
*
|
||||
@@ -932,4 +983,76 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取桩列表信息
|
||||
*
|
||||
* @param pileStationInfo
|
||||
* @return
|
||||
*/
|
||||
private List<EquipmentInfo> getPileList(PileStationInfo pileStationInfo) {
|
||||
List<EquipmentInfo> resultList = new ArrayList<>();
|
||||
// 通过站点id查询桩基本信息
|
||||
List<PileBasicInfo> list = pileBasicInfoService.getPileListByStationId(String.valueOf(pileStationInfo.getId()));
|
||||
// 封装成中电联平台对象
|
||||
for (PileBasicInfo pileBasicInfo : list) {
|
||||
EquipmentInfo equipmentInfo = new EquipmentInfo();
|
||||
String pileSn = pileBasicInfo.getSn();
|
||||
|
||||
equipmentInfo.setEquipmentID(pileSn);
|
||||
|
||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||
equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType()));
|
||||
equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
List<ConnectorInfo> connectorList = getConnectorList(pileBasicInfo);
|
||||
equipmentInfo.setConnectorInfos(connectorList);
|
||||
|
||||
resultList.add(equipmentInfo);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取枪口列表
|
||||
*
|
||||
* @param pileBasicInfo
|
||||
* @return
|
||||
*/
|
||||
private List<ConnectorInfo> getConnectorList(PileBasicInfo pileBasicInfo) {
|
||||
List<ConnectorInfo> resultList = new ArrayList<>();
|
||||
|
||||
List<PileConnectorInfo> list = pileConnectorInfoService.selectPileConnectorInfoList(pileBasicInfo.getSn());
|
||||
for (PileConnectorInfo pileConnectorInfo : list) {
|
||||
ConnectorInfo connectorInfo = new ConnectorInfo();
|
||||
|
||||
connectorInfo.setConnectorID(pileConnectorInfo.getPileConnectorCode());
|
||||
String pileSn = pileConnectorInfo.getPileSn();
|
||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||
int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3;
|
||||
|
||||
connectorInfo.setConnectorType(connectorType);
|
||||
// 车位号
|
||||
if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) {
|
||||
connectorInfo.setParkNo(pileConnectorInfo.getParkNo());
|
||||
}
|
||||
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||
connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent()));
|
||||
connectorInfo.setNationalStandard(2);
|
||||
// if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) {
|
||||
// // 如果不是单枪,则枪口功率需要除以枪口数量
|
||||
// String ratedPowerStr = modelInfo.getRatedPower();
|
||||
// BigDecimal ratedPower = new BigDecimal(ratedPowerStr);
|
||||
// connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP));
|
||||
// }else {
|
||||
// }
|
||||
connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
resultList.add(connectorInfo);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user