diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 7de791f6a..f7b4ca69c 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -1111,6 +1111,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType())); equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + equipmentInfo.setEquipmentClassification(Constants.one); // 1-车辆充电设备 List connectorList = getConnectorListForZDL(pileSn); equipmentInfo.setConnectorInfos(connectorList); @@ -1135,11 +1136,13 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); } + connectorInfo.setEquipmentClassification(Constants.one); // 1-车辆充电设备接口 connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); connectorInfo.setNationalStandard(2); connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + connectorInfo.setAuxPower(3); // 辅助电源 3-兼容12V和24V resultList.add(connectorInfo); } return resultList; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index 73897262c..17b1c84ae 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -32,6 +32,7 @@ import com.jsowell.thirdparty.huawei.HuaweiServiceV2; import com.jsowell.thirdparty.platform.hainan.service.HaiNanPlatformServiceImpl; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.thirdparty.lianlian.service.LianLianService; +import com.jsowell.thirdparty.platform.qinghai.service.QingHaiPlatformServiceImpl; import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.lutongyunting.service.LTYTService; import com.jsowell.thirdparty.nanrui.service.NRService; @@ -106,6 +107,9 @@ public class CommonService { @Autowired private HaiNanPlatformServiceImpl haiNanChargeService; + @Autowired + private QingHaiPlatformServiceImpl qingHaiPlatformService; + @Autowired private RedisCache redisCache; @@ -308,6 +312,13 @@ public class CommonService { // log.info("推送甬城泊车充电订单状态 result:{}", result2); } } + if (StringUtils.equals(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode(), thirdPartyType)) { + // 青海省平台 + String result = qingHaiPlatformService.notificationStationStatus(pileConnectorCode, changedStatus); + log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}, result:{}" + , pileConnectorCode, changedStatus, result); + } + } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/qinghai/service/QingHaiPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/qinghai/service/QingHaiPlatformServiceImpl.java index a978d494a..fc193bc73 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/qinghai/service/QingHaiPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/qinghai/service/QingHaiPlatformServiceImpl.java @@ -1,18 +1,24 @@ package com.jsowell.thirdparty.platform.qinghai.service; import com.alibaba.fastjson2.JSONObject; +import com.github.pagehelper.PageInfo; import com.google.common.collect.Maps; +import com.jsowell.common.constant.Constants; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; 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.PileStationInfoService; import com.jsowell.pile.service.ThirdPartyPlatformConfigService; import com.jsowell.pile.service.ThirdPartyStationRelationService; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLStationInfo; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; +import com.jsowell.thirdparty.platform.hainan.domain.HNStationInfo; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.util.GBSignUtils; @@ -23,6 +29,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -42,6 +51,9 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileStationInfoService pileStationInfoService; + @Autowired + private PileBasicInfoService pileBasicInfoService; + @Autowired private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; @@ -58,6 +70,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public Map queryStationsInfo(QueryStationInfoDTO dto) { + List resultList = new ArrayList<>(); // 查询出要查询的充电站id并set进 dto 的stationIds if (StringUtils.isNotBlank(dto.getThirdPlatformType())) { List xdtList = thirdPartyStationRelationService.selectThirdPartyStationRelationList(dto.getThirdPlatformType()); @@ -79,12 +92,87 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService { // 未查到数据 return null; } + PageInfo pageInfo = new PageInfo<>(stationInfos); + ZDLStationInfo stationInfo = null; + for (ThirdPartyStationInfoVO stationInfoVO : pageInfo.getList()) { + Long stationId = stationInfoVO.getId(); + stationInfo = ZDLStationInfo.builder() + .stationId(String.valueOf(stationId)) + .operatorId(Constants.OPERATORID_JIANG_SU) + .stationName(stationInfoVO.getStationName()) + .countryCode(stationInfoVO.getCountryCode()) + .address(stationInfoVO.getAddress()) + .serviceTel(stationInfoVO.getServiceTel()) + .stationClassification(Constants.one) // 1-充电站 + .stationType(Integer.parseInt(stationInfoVO.getStationType())) + .stationStatus(Integer.parseInt(stationInfoVO.getStationStatus())) + .parkNums(Integer.parseInt(stationInfoVO.getParkNums())) + .stationLat(new BigDecimal(stationInfoVO.getStationLat())) + .stationLng(new BigDecimal(stationInfoVO.getStationLng())) + .construction(Integer.parseInt(stationInfoVO.getConstruction())) + .openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay())) + .parkFeeType(255) // 255-参考场地实际收费标准 + .electricityType(1) // 用电类型 1-商业用电 + .isAloneApply(Integer.parseInt(stationInfoVO.getAloneApply())) + // .ratedPower() // 站点额定总功率 + .periodFee(1) // 峰谷分时 0-否;1-是 + .runTime(String.valueOf(stationInfoVO.getCreateTime())) + .videoMonitor(0) // 视频监控配套情况 0-无;1-有 + .build(); - return null; + String organizationCode = stationInfoVO.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); + } + + String areaCode = stationInfoVO.getAreaCode(); // 330000,330200,330213 + // 根据逗号分组 + String[] split = StringUtils.split(areaCode, ","); + // 只取最后一部分 330213 + String subAreaCode = split[split.length - 1]; + stationInfo.setAreaCode(subAreaCode); + + // TODO areaCodeCountryside + + // 查询桩列表 + List pileList = pileBasicInfoService.getPileListForZDL(String.valueOf(stationId)); + stationInfo.setEquipmentInfos(pileList); + + // 汇总站点额定总功率 + BigDecimal sumPower = pileList.stream() + .map(ZDLEquipmentInfo::getPower) + .reduce(BigDecimal.ZERO, BigDecimal::add); + stationInfo.setRatedPower(sumPower); + + resultList.add(stationInfo); + + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("PageNo", pageInfo.getPageNum()); + jsonObject.put("PageCount", pageInfo.getPages()); + jsonObject.put("ItemSize", resultList.size()); + jsonObject.put("StationInfos", resultList); + + // 加密 + Map resultMap = getResultMap(jsonObject); + + return resultMap; } - + /** + * 设备状态变化推送(在0x13中调用统一推送接口) + * @param pileConnectorCode 充电枪口编号 + * @param status 枪口状态 + * @return + */ + @Override + public String notificationStationStatus(String pileConnectorCode, String status) { + return ThirdPartyPlatformService.super.notificationStationStatus(pileConnectorCode, status); + } /** * 将需要发送至对接平台的的返回参数加密返回