diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/domain/ConnectorStatusInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/domain/ConnectorStatusInfo.java index 791d6acca..041cb7c86 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/domain/ConnectorStatusInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/domain/ConnectorStatusInfo.java @@ -6,6 +6,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.math.BigDecimal; + /** * 充电设备接口状态信息 */ @@ -69,6 +71,66 @@ public class ConnectorStatusInfo { @JSONField(name = "EquipmentID") private String equipmentId; + /** + * A相电流 + */ + @JSONField(name = "CurrentA") + private Integer currentA; + + /** + * B相电流 + */ + @JSONField(name = "CurrentB") + private Integer currentB; + + /** + * C相电流 + */ + @JSONField(name = "CurrentC") + private Integer currentC; + + /** + * A相电压 + */ + @JSONField(name = "VoltageA") + private Integer voltageA; + + /** + * B相电压 + */ + @JSONField(name = "VoltageB") + private Integer voltageB; + + /** + * C相电压 + */ + @JSONField(name = "VoltageC") + private Integer voltageC; + + /** + * soc + */ + @JSONField(name = "SOC") + private Integer soc; + + /** + * 已充电电能 + */ + @JSONField(name = "ChargeElectricity") + private BigDecimal chargeElectricity; + + /** + * 已放电电能 + */ + @JSONField(name = "DischargeElectricity") + private BigDecimal dischargeElectricity; + + /** + * 采集时间 + */ + @JSONField(name = "AcquireDateTime") + private String acquireDateTime; + /** * 状态更新时间 * 本次状态变化的时间,格式“yyyy-MM-dd HH:mm:ss” diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/common/StationInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/common/StationInfo.java index 8feb6c8c4..795901c60 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/common/StationInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/common/StationInfo.java @@ -408,6 +408,79 @@ public class StationInfo extends BaseStationInfo { @JSONField(name = "ParkingLockFlag") private Integer parkingLockFlag; + /** + * 投入运营日期 + */ + @JSONField(name = "OfficialRunTime") + private String officialRunTime; + + /** + * 站点类别 + * 1:充电站 + * 2:换电站 + * 3:充换电一体站 + */ + @JSONField(name = "StationClassification") + private Integer stationClassification; + + /** + * 站点类别子分类 + * 1:集中式:专营充电业务的场站 + * 2:分散式:充电和停车功能复合的场站 + */ + @JSONField(name = "SubStationClassification") + private Integer subStationClassification; + + /** + * 充电接口标准支持 + * 0:国标 + * 1:欧标 + */ + @JSONField(name = "SupportStandard") + private String supportStandard; + + /** + * 土地所有权 + * 1: 国有临时用地 + * 2: 国有建设用地 + * 3: 集体土地 + */ + @JSONField(name = "OwnershipOfLand") + private Integer ownershipOfLand; + + /** + * 城市用地分类 + * 1: 居住用地 + * 2: 商业服务用地 + * 3: 公共管理与服务设施用地 + * 4: 工业用地 + * 5: 物流仓储用地 + * 6: 交通设施用地 + * 7: 绿地与广场用地 + * 8:公用设施用地 + * 255: 其它用地 + */ + @JSONField(name = "LandProperty") + private Integer landProperty; + + /** + * 服务车辆类型 + * 1:公交车 + * 2:出租车 + * 3:物流车 + * 4:通勤车 + * 5:大巴车 + * 6:私家车 + * 7:环卫车 + * 8:泥头、重卡车 + * 9:公务车 + * 10:网约车 + * 11:港口码头作业车 + * 255:其它 + */ + @JSONField(name = "ServiceCarTypes") + private String serviceCarTypes; + /** * 充电计费信息 */ diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java index 303844f68..911286fd1 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ShenZhenPlatformServiceImpl.java @@ -7,12 +7,14 @@ import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; +import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; +import com.jsowell.pile.domain.AreaCodeInfo; import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.dto.PushRealTimeInfoDTO; @@ -24,6 +26,7 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO; +import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO; import com.jsowell.pile.vo.web.OrderListVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileStationVO; @@ -34,12 +37,15 @@ import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; import com.jsowell.thirdparty.platform.common.StationInfo; import com.jsowell.thirdparty.platform.domain.BMSInfo; import com.jsowell.thirdparty.platform.domain.StationChargeStatsInfo; +import com.jsowell.thirdparty.platform.domain.SupStationInfo; import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils; import com.jsowell.thirdparty.service.ThirdpartySecretInfoService; +import com.yi.business.geo.GeoCodeInfo; +import com.yi.business.geo.TermRelationTreeCoordinate; import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,6 +57,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -75,11 +82,17 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { private OrderBasicInfoService orderBasicInfoService; @Autowired - private ThirdPartyStationRelationService thirdPartyStationRelationService; + private IAreaCodeInfoService areaCodeInfoService; @Autowired private PileBasicInfoService pileBasicInfoService; + @Autowired + private PileBillingTemplateService pileBillingTemplateService; + + @Autowired + private RedisCache redisCache; + Logger logger = LoggerFactory.getLogger(this.getClass()); // 平台类型 @@ -106,24 +119,69 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { StationInfo stationInfo = StationInfo.builder() .stationID(stationVO.getId()) .operatorID(Constants.OPERATORID_JIANG_SU) - // .equipmentOwnerID() + .equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationVO.getOrganizationCode())) .stationName(stationVO.getStationName()) .countryCode(stationVO.getCountryCode()) .areaCode(stationVO.getAreaCode()) .address(stationVO.getAddress()) + .stationTel(stationVO.getStationTel()) + .serviceTel(stationVO.getStationTel()) + .buildDate(stationVO.getCreateTime()) + .officialRunTime(stationVO.getCreateTime()) .stationType(Integer.parseInt(stationVO.getStationType())) + .stationClassification(1) // 1-充电站 + .subStationClassification(2) + .supportStandard("0") .stationStatus(stationVO.getStationStatus()) .parkNums(0) // 默认 0:未知 .stationLng(new BigDecimal(stationVO.getStationLng())) .stationLat(new BigDecimal(stationVO.getStationLat())) + // .ownershipOfLand() + // .landProperty() .construction(Integer.parseInt(stationVO.getConstruction())) - .supportOrder(0) + .busineHours("00:00~24:00") .build(); - String stationTel = stationVO.getStationTel(); - if (StringUtils.isNotBlank(stationTel)) { - stationInfo.setStationTel(stationTel); - stationInfo.setServiceTel(stationTel); + + // electricityFee、serviceFee + StringBuilder electricityFee = new StringBuilder(); + StringBuilder serviceFee = new StringBuilder(); + // 查询计费模板 + List priceList = pileBillingTemplateService.queryBillingPrice(String.valueOf(stationVO.getId())); + for (BillingPriceVO billingPriceVO : priceList) { + electricityFee.append(billingPriceVO.getStartTime()) + .append("~").append(billingPriceVO.getEndTime()) + .append(",").append(billingPriceVO.getElectricityPrice()) + .append(";"); + serviceFee.append(billingPriceVO.getStartTime()) + .append("~").append(billingPriceVO.getEndTime()) + .append(",").append(billingPriceVO.getServicePrice()) + .append(";"); } + // // 去除最后一位的分号 + // electricityFee.deleteCharAt(electricityFee.length() - 1); + // serviceFee.deleteCharAt(serviceFee.length() - 1); + + stationInfo.setElectricityFee(electricityFee.toString()); + stationInfo.setServiceFee(serviceFee.toString()); + + // streetCode + GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(stationVO.getAddress()); + if (geoCode == null) { + // String areaCodeCountryside = geoCode.getCounty_code(); + stationInfo.setStreetCode("123456789101"); + } else { + AreaCodeInfo areaCodeInfo = new AreaCodeInfo(); + if (StringUtils.isNotBlank(geoCode.getTownName())) { + String townName = geoCode.getTownName(); + areaCodeInfo.setName(townName); + } else { + String countyName = geoCode.getCountyName(); + areaCodeInfo.setName(countyName); + } + List areaCodeInfoList = areaCodeInfoService.selectAreaCodeInfoList(areaCodeInfo); + stationInfo.setStreetCode(String.valueOf(areaCodeInfoList.get(0).getAreaCode())); + } + if (StringUtils.isNotBlank(stationVO.getPictures())) { stationInfo.setPictures(Lists.newArrayList(stationVO.getPictures().split(","))); } @@ -156,41 +214,56 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public Map queryToken(CommonParamsDTO dto) { + AccessTokenVO vo = new AccessTokenVO(); + // 0:成功;1:失败 + int succStat = 0; + // 0:无;1:无此对接平台;2:密钥错误; 3~99:自定义 + int failReason = 0; + String operatorId = dto.getOperatorID(); - // 通过operatorId 查出 相关配置信息 - ThirdPartySecretInfoVO secretInfoVO = getShenZhenSecretInfo(); - - String operatorSecret = secretInfoVO.getOurOperatorSecret(); - String dataSecret = secretInfoVO.getOurDataSecret(); - String dataSecretIv = secretInfoVO.getOurDataSecretIv(); - String signSecret = secretInfoVO.getOurSigSecret(); - - // 解密data 获取参数中的OperatorSecret - try { + // token缓存key值 + String redisKey = operatorId + "_token:"; + // 通过operatorId 查出 operatorSecret + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getShenZhenSecretInfo(); + if (thirdPartySecretInfoVO == null) { + failReason = 1; + succStat = 1; + } else { + String ourOperatorSecret = thirdPartySecretInfoVO.getOurOperatorSecret(); + String dataSecret = thirdPartySecretInfoVO.getOurDataSecret(); + String dataSecretIv = thirdPartySecretInfoVO.getOurDataSecretIv(); + // 解密data 获取参数中的OperatorSecret String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv); String inputOperatorSecret = null; if (StringUtils.isNotBlank(decrypt)) { inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret"); } - if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) { - throw new RuntimeException("密钥不一致"); + // 对比密钥 + if (!StringUtils.equals(ourOperatorSecret, inputOperatorSecret)) { + failReason = 1; + succStat = 1; + } else { + // 先查缓存中是否有已生成的token + String token = redisCache.getCacheObject(redisKey); + int expiredTime = (int) redisCache.getExpire(redisKey); + if (StringUtils.isBlank(token)){ + // 生成token + token = JWTUtils.createToken(operatorId, ourOperatorSecret, JWTUtils.ttlMillis); + expiredTime = (int) (JWTUtils.ttlMillis / 1000); + } + vo.setAccessToken(token); + vo.setTokenAvailableTime(expiredTime); + // 设置缓存 + redisCache.setCacheObject(redisKey, token, expiredTime, TimeUnit.SECONDS); } - } catch (RuntimeException e) { - throw new BusinessException("2", "密钥错误"); } - - // 生成token - String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis); - // 组装返回参数 - AccessTokenVO vo = new AccessTokenVO(); - vo.setAccessToken(token); vo.setOperatorID(operatorId); - vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000)); - vo.setFailReason(0); - vo.setSuccStat(0); + vo.setFailReason(failReason); + vo.setSuccStat(succStat); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, secretInfoVO); + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(vo, thirdPartySecretInfoVO.getOurDataSecret() + , thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getOurSigSecret()); return resultMap; } @@ -203,53 +276,86 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { @Override public Map queryStationsInfo(QueryStationInfoDTO dto) { List resultList = new ArrayList<>(); - // 查询出要查询的充电站id并set进 dto 的stationIds - if (StringUtils.isNotBlank(dto.getThirdPlatformType())) { - List relationList = thirdPartyStationRelationService.selectThirdPartyStationRelationList(dto.getThirdPlatformType()); - if (CollectionUtils.isNotEmpty(relationList)) { - List 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(); + dto.setThirdPlatformType(thirdPlatformType); PageUtils.startPage(pageNo, pageSize); - // 查询站点信息数据 - List stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto); + List stationInfos = pileStationInfoService.selectStationInfosByThirdParty(dto); if (CollectionUtils.isEmpty(stationInfos)) { // 未查到数据 return null; } PageInfo pageInfo = new PageInfo<>(stationInfos); - StationInfo stationInfo = null; for (ThirdPartyStationInfoVO stationVO : pageInfo.getList()) { Long stationId = stationVO.getId(); - stationInfo = StationInfo.builder() - .stationID(String.valueOf(stationVO.getId())) + StationInfo stationInfo = StationInfo.builder() + .stationID(String.valueOf(stationId)) .operatorID(Constants.OPERATORID_JIANG_SU) - // .equipmentOwnerID() + .equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationVO.getOrganizationCode())) .stationName(stationVO.getStationName()) .countryCode(stationVO.getCountryCode()) .areaCode(stationVO.getAreaCode()) .address(stationVO.getAddress()) + .stationTel(stationVO.getStationTel()) + .serviceTel(stationVO.getStationTel()) + .buildDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, stationVO.getCreateTime())) + .officialRunTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, stationVO.getCreateTime())) .stationType(Integer.parseInt(stationVO.getStationType())) + .stationClassification(1) // 1-充电站 + .subStationClassification(2) + .supportStandard("0") .stationStatus(Integer.parseInt(stationVO.getStationStatus())) .parkNums(0) // 默认 0:未知 .stationLng(new BigDecimal(stationVO.getStationLng())) .stationLat(new BigDecimal(stationVO.getStationLat())) + // .ownershipOfLand() + // .landProperty() .construction(Integer.parseInt(stationVO.getConstruction())) - + .busineHours("00:00~24:00") .build(); - String stationTel = stationVO.getStationTel(); - if (StringUtils.isNotBlank(stationTel)) { - stationInfo.setStationTel(stationTel); - stationInfo.setServiceTel(stationTel); + + // electricityFee、serviceFee + StringBuilder electricityFee = new StringBuilder(); + StringBuilder serviceFee = new StringBuilder(); + // 查询计费模板 + List priceList = pileBillingTemplateService.queryBillingPrice(String.valueOf(stationVO.getId())); + for (BillingPriceVO billingPriceVO : priceList) { + electricityFee.append(billingPriceVO.getStartTime()) + .append("~").append(billingPriceVO.getEndTime()) + .append(",").append(billingPriceVO.getElectricityPrice()) + .append(";"); + serviceFee.append(billingPriceVO.getStartTime()) + .append("~").append(billingPriceVO.getEndTime()) + .append(",").append(billingPriceVO.getServicePrice()) + .append(";"); } + // // 去除最后一位的分号 + // electricityFee.deleteCharAt(electricityFee.length() - 1); + // serviceFee.deleteCharAt(serviceFee.length() - 1); + + stationInfo.setElectricityFee(electricityFee.toString()); + stationInfo.setServiceFee(serviceFee.toString()); + + // streetCode + GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(stationVO.getAddress()); + if (geoCode == null) { + // String areaCodeCountryside = geoCode.getCounty_code(); + stationInfo.setStreetCode("123456789101"); + } else { + AreaCodeInfo areaCodeInfo = new AreaCodeInfo(); + if (StringUtils.isNotBlank(geoCode.getTownName())) { + String townName = geoCode.getTownName(); + areaCodeInfo.setName(townName); + } else { + String countyName = geoCode.getCountyName(); + areaCodeInfo.setName(countyName); + } + List areaCodeInfoList = areaCodeInfoService.selectAreaCodeInfoList(areaCodeInfo); + stationInfo.setStreetCode(String.valueOf(areaCodeInfoList.get(0).getAreaCode())); + } + if (StringUtils.isNotBlank(stationVO.getPictures())) { stationInfo.setPictures(Lists.newArrayList(stationVO.getPictures().split(","))); } @@ -266,7 +372,9 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { jsonObject.put("ItemSize", resultList.size()); jsonObject.put("StationInfos", resultList); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(jsonObject, shenZhenSecretInfo); + // 加密数据 + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(jsonObject, shenZhenSecretInfo.getOurDataSecret(), + shenZhenSecretInfo.getOurDataSecretIv(), shenZhenSecretInfo.getTheirSigSecret()); return resultMap; } @@ -277,25 +385,64 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { * @return */ @Override - public String notificationStationStatus(PushRealTimeInfoDTO dto) { - String thirdPartyType = dto.getThirdPartyType(); - String status = dto.getStatus(); - String pileConnectorCode = dto.getPileConnectorCode(); + public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) { + List connectorStatusInfos = new ArrayList<>(); + String operatorId = Constants.OPERATORID_LIANLIAN; + String operatorSecret = secretInfoVO.getTheirOperatorSecret(); + String signSecret = secretInfoVO.getTheirSigSecret(); + String dataSecret = secretInfoVO.getTheirDataSecret(); + String dataSecretIv = secretInfoVO.getTheirDataSecretIv(); + String urlAddress = secretInfoVO.getTheirUrlPrefix(); - ThirdPartySecretInfoVO shenZhenSecretInfo = getShenZhenSecretInfo(); - String operatorId = shenZhenSecretInfo.getTheirOperatorId(); - String operatorSecret = shenZhenSecretInfo.getTheirOperatorSecret(); - String signSecret = shenZhenSecretInfo.getTheirSigSecret(); - String dataSecret = shenZhenSecretInfo.getTheirDataSecret(); - String dataSecretIv = shenZhenSecretInfo.getTheirDataSecretIv(); - String urlAddress = shenZhenSecretInfo.getTheirUrlPrefix(); String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue(); + + ConnectorStatusInfo info = ConnectorStatusInfo.builder() .connectorID(pileConnectorCode) .status(Integer.parseInt(status)) .build(); + + StationStatusInfo stationStatusInfo = StationStatusInfo.builder() + .stationId(stationId) + // .connectorStatusInfos() + .build(); + int currentA = Constants.zero; + int voltageA = Constants.zero; + int soc = Constants.zero; + BigDecimal chargeElectricity = BigDecimal.ZERO; + if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), status)) { + // 充电中,查出对应的实时数据信息 + OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode); + if (orderBasicInfo == null) { + throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); + } + List chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode()); + if (CollectionUtils.isEmpty(chargingRealTimeData)) { + throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); + } + RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0); + currentA = new BigDecimal(realTimeMonitorData.getOutputCurrent()).intValue(); + voltageA = new BigDecimal(realTimeMonitorData.getOutputVoltage()).intValue(); + soc = new BigDecimal(realTimeMonitorData.getSOC()).intValue(); + chargeElectricity = new BigDecimal(realTimeMonitorData.getChargingDegree()); + } + info.setCurrentA(currentA); + info.setCurrentB(0); + info.setCurrentC(0); + info.setVoltageA(voltageA); + info.setVoltageB(0); + info.setVoltageC(0); + info.setSoc(soc); + info.setChargeElectricity(chargeElectricity); + info.setDischargeElectricity(BigDecimal.ZERO); + info.setAcquireDateTime(DateUtils.dateTimeNow()); + + connectorStatusInfos.add(info); + + stationStatusInfo.setConnectorStatusInfos(connectorStatusInfos); + // 调用平台接口 - String jsonString = JSON.toJSONString(info); + String jsonString = JSON.toJSONString(stationStatusInfo); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); @@ -313,7 +460,7 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { List stationIds = dto.getStationIds(); List StationStatusInfos = new ArrayList<>(); List ConnectorStatusInfos = new ArrayList<>(); - ThirdPartySecretInfoVO shenZhenSecretInfo = getShenZhenSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getShenZhenSecretInfo(); ConnectorStatusInfo connectorStatusInfo; for (String stationId : stationIds) { @@ -377,7 +524,8 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { map.put("Total", total); map.put("StationStatusInfos", collect); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, shenZhenSecretInfo); + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(), + thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret()); return resultMap; } @@ -618,6 +766,7 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService { if (thirdPartySecretInfoVO == null) { throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); } + thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU); return thirdPartySecretInfoVO; } }