mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update
This commit is contained in:
@@ -8,6 +8,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.ThirdPartyOperatorIdEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
@@ -19,10 +20,7 @@ import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.OrderDetail;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryEquipChargeStatusDTO;
|
||||
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
|
||||
@@ -44,6 +42,7 @@ import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||
import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO;
|
||||
import com.jsowell.thirdparty.platform.common.StationInfo;
|
||||
import com.jsowell.thirdparty.platform.domain.*;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
@@ -780,4 +779,124 @@ public class NinaXiaPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 充电站信息变化推送 notification_stationInfo
|
||||
* 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台
|
||||
*
|
||||
* @param stationId 充电站id
|
||||
* @throws UnsupportedOperationException 未实现异常
|
||||
*/
|
||||
@Override
|
||||
public String notificationStationInfo(String stationId) {
|
||||
// 通过id查询站点相关信息
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
|
||||
|
||||
// 查询第三方平台配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException("", "无此平台配置信息");
|
||||
}
|
||||
String operatorId = thirdPartySecretInfoVO.getOurOperatorId();
|
||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 组装联联平台所需要的数据格式
|
||||
StationInfo info = StationInfo.builder()
|
||||
.stationID(stationId)
|
||||
.operatorID(operatorId)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
|
||||
.isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
|
||||
.countryCode(pileStationInfo.getCountryCode())
|
||||
.address(pileStationInfo.getAddress())
|
||||
.serviceTel(pileStationInfo.getStationTel())
|
||||
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
|
||||
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
||||
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
||||
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
|
||||
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||
.construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
||||
.openAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
|
||||
.minElectricityPrice(new BigDecimal(Constants.ZERO))
|
||||
.electricityFee(Constants.ZERO)
|
||||
.serviceFee(Constants.ZERO)
|
||||
.parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
|
||||
.supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
|
||||
.parkFeeType(0)
|
||||
.toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
|
||||
.storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
|
||||
.restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
|
||||
.loungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()))
|
||||
.canopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()))
|
||||
.printerFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()))
|
||||
.barrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()))
|
||||
.parkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()))
|
||||
.build();
|
||||
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
|
||||
// 根据逗号分组
|
||||
String[] split = StringUtils.split(areaCode, ",");
|
||||
// 只取最后一部分 330213
|
||||
String subAreaCode = split[split.length - 1];
|
||||
info.setAreaCode(subAreaCode);
|
||||
// 截取运营商组织机构代码(去除最后一位后的最后九位)
|
||||
String organizationCode = "";
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPlatformType)) {
|
||||
// 联联平台先使用自己运营商的组织机构代码
|
||||
organizationCode = Constants.OPERATORID_LIANLIAN;
|
||||
info.setEquipmentOwnerID(organizationCode);
|
||||
} else {
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
|
||||
organizationCode = merchantInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
info.setEquipmentOwnerID(equipmentOwnerId);
|
||||
}
|
||||
}
|
||||
if (StringUtils.equals("36", String.valueOf(pileStationInfo.getMerchantId()))) {
|
||||
// 远大
|
||||
info.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA);
|
||||
}
|
||||
if (MerchantUtils.isXiXiaoMerchant(String.valueOf(pileStationInfo.getMerchantId()))) {
|
||||
// 如果是希晓运营商,则把equipmentOwnerID换成希晓
|
||||
info.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
|
||||
}
|
||||
String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment());
|
||||
info.setPayment(payment);
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) {
|
||||
info.setIsPublicParkingLot(1);
|
||||
info.setParkingLotNumber(pileStationInfo.getParkingNumber());
|
||||
}
|
||||
// 户号
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getAccountNumber())) {
|
||||
info.setAccountNumber(pileStationInfo.getAccountNumber());
|
||||
}
|
||||
|
||||
// 容量
|
||||
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
|
||||
info.setCapacity(pileStationInfo.getCapacity().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
|
||||
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||
info.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||
}
|
||||
|
||||
// 调用联联平台接口
|
||||
String url = urlAddress + "supervise_notification_station_info";
|
||||
|
||||
String jsonStr = JSON.toJSONString(info);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("StationInfo", jsonStr);
|
||||
|
||||
String jsonString = JSON.toJSONString(data);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
||||
, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user