@@ -11,7 +11,6 @@ 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.lianlian.StationPaymentEnum ;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum ;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum ;
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum ;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum ;
@@ -19,7 +18,6 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException ;
import com.jsowell.common.util.* ;
import com.jsowell.pile.domain.* ;
import com.jsowell.pile.dto.PushRealTimeInfoDTO ;
import com.jsowell.pile.dto.QueryConnectorListDTO ;
import com.jsowell.pile.dto.QueryOperatorInfoDTO ;
import com.jsowell.pile.dto.QueryStationInfoDTO ;
@@ -32,10 +30,11 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ConnectorInfoVO ;
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.uniapp.customer.BillingPriceVO ;
import com.jsowell.pile.vo.uniapp.customer.OrderVO ;
import com.jsowell.pile.vo.web.PileConnectorInfoVO ;
import com.jsowell.pile.vo.web.PileMerchantInfoVO ;
import com.jsowell.pile.vo.web.PileStationVO ;
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo ;
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo ;
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo ;
@@ -297,13 +296,18 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
. stationID ( stationId )
. operatorID ( operatorId )
. stationName ( pileStationInfo . getStationName ( ) )
. equipmentClassification ( Constants . ONE )
. periodFee ( 1 ) // 峰谷分时 0-否; 1-是
. parkType ( " 255 " ) // 255-参考场地实际收费标准
. roundTheClock ( Constants . ONE )
. electricityType ( 1 ) // 用电类型 1-商业用电
. videoMonitor ( 0 ) // 视频监控配套情况 0-无; 1-有
. isAloneApply ( Integer . valueOf ( pileStationInfo . getAloneApply ( ) ) )
. isPublicParkingLot ( Integer . valueOf ( pileStationInfo . getPublicParking ( ) ) )
. countryCode ( pileStationInfo . getCountryCode ( ) )
. address ( pileStationInfo . getAddress ( ) )
. serviceTel ( pileStationInfo . getStationTel ( ) )
. swapMatchCars ( pileStationInfo . getSwapMatchCars ( ) )
. generalApplicationType ( pileStationInfo . getGeneralApplicationType ( ) )
. stationClassification ( 1 )
. stationType ( Integer . valueOf ( pileStationInfo . getStationType ( ) ) )
. stationStatus ( Integer . valueOf ( pileStationInfo . getStationStatus ( ) ) )
. parkNums ( Integer . valueOf ( pileStationInfo . getParkNums ( ) ) )
@@ -317,9 +321,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
. parkFree ( Integer . valueOf ( pileStationInfo . getParkFree ( ) ) )
. supportOrder ( Integer . valueOf ( pileStationInfo . getSupportOrder ( ) ) )
. parkFeeType ( 0 )
. periodFee ( 1 ) // 峰谷分时 0-否; 1-是
. equipmentClassification ( 1 )
. businessExpandType ( 0 )
. toiletFlag ( Integer . valueOf ( pileStationInfo . getToiletFlag ( ) ) )
. storeFlag ( Integer . valueOf ( pileStationInfo . getStoreFlag ( ) ) )
. restaurantFlag ( Integer . valueOf ( pileStationInfo . getRestaurantFlag ( ) ) )
@@ -367,7 +369,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
List < EquipmentInfo > pileList = pileBasicInfoService . getPileListForLianLian ( stationId ) ;
if ( CollectionUtils . isNotEmpty ( pileList ) ) {
info . setEquipmentInfos ( pileList ) ; // 充电设备信息列表
info . setEquipmentClassification ( 0 ) ;
}
// areaCodeCountryside
@@ -477,40 +478,47 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
}
/**
* 设备状态变化推送 notification_stationStatus
* 推送充电设备接口状态信息 supervise_notification_station _status
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
* 推送充电设备接口状态信息
* supervise_notification_connector _status
*/
@Override
public String notificationStationStatus ( PushRealTime InfoDT O dto ) {
String status = dto . getStatus ( ) ;
String pileC onnectorCode = dto . getPileConnectorCode ( ) ;
public String notificationStationStatus ( String stationId , String pileConnectorCode , String status , ThirdPartySecret InfoV O secretInfoVO ) {
// 查询充电枪口状态
PileConnectorInfoVO c onnectorInfo = pileConnectorInfoService . getPileConnectorInfoByConnectorCode ( pileConnectorCode ) ;
if ( Objects . isNull ( connectorInfo ) ) {
throw new BusinessException ( ReturnCodeEnum . CODE_CONNECTOR_INFO_NULL_ERROR ) ;
}
// 查出该桩所属哪个站点
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14) ;
String pileSn = YKCUtils . getPileSn ( pileConnectorCode ) ;
PileStationVO stationVO = pileStationInfoService . getStationInfoByPileSn ( pileSn ) ;
// 通过站点id查询相关配置信息
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo ( ) ;
String merchantId = connectorInfo . getMerchantId ( ) ;
MerchantInfoVO merchantInfoVO = pileMerchantInfoService . getMerchantInfoVO ( merchantId ) ;
if ( Objects . isNull ( merchantInfoVO ) ) {
throw new BusinessException ( ReturnCodeEnum . CODE_CONNECTOR_INFO_NULL_ERROR ) ;
}
String operatorId = thirdPartySecret InfoVO . getOurOperatorId ( ) ;
String operatorSecret = thirdPartySecretInfoVO . getTheirOperatorSecret ( ) ;
String signSecret = thirdPartySecretInfoVO . getTheirSigSecret ( ) ;
String dataSecret = thirdPartySecret InfoVO . getTheirDataSecret ( ) ;
String dataSecretIv = thirdPartySecret InfoVO . getTheirDataSecretIv ( ) ;
String urlAddress = thirdPartySecretInfoVO . getTheirUrlPrefix ( ) ;
String url = urlAddress + BusinessInformationExchangeEnum . NOTIFICATION_STATION_STATUS . getValue ( ) ;
ConnectorStatusInfo info = ConnectorStatusInfo . builder ( )
SupConnectorStatusInfo info = SupConnectorStatus Info . builder ( )
. operatorID ( Constants . OPERATORID_JIANG_SU )
. equipmentOwnerID ( MerchantUtils . getOperatorID ( merchantInfoVO . getOrganizationCode ( ) ) )
. stationID ( connector Info . getStationId ( ) )
. equipmentID ( connector Info . getPileSn ( ) )
. connectorID ( pileConnectorCode )
. status ( Integer . parseInt ( status ) )
. statusDesc ( PileConnectorDataBaseStatusEnum . getStatusDescription ( status ) )
. parkStatus ( Constants . zero )
. lockStatus ( Constants . zero )
. updateTime ( DateUtils . getDateTime ( ) )
. equipmentClassification ( Constants . ONE )
. build ( ) ;
// 调用联联平台接口
JSONObject json = new JSONObject ( ) ;
json . put ( " ConnectorStatusInfo " , info ) ;
String jsonString = JSON . toJSONString ( json ) ;
String operatorId = Constants . OPERATORID_JIANG_SU ;
String operatorSecret = secretInfoVO . getTheirOperatorSecret ( ) ;
String signSecret = secretInfoVO . getTheirSigSecret ( ) ;
String dataSecret = secretInfoVO . getTheirDataSecret ( ) ;
String dataSecretIv = secretInfoVO . getTheirDataSecretIv ( ) ;
String urlAddress = secretInfoVO . getTheirUrlPrefix ( ) ;
String url = urlAddress + " supervise_notification_connector_status " ;
String jsonString = JSON . toJSONString ( info ) ;
// 获取令牌
String token = getToken ( urlAddress , operatorId , operatorSecret , dataSecretIv , signSecret , dataSecret ) ;
String result = HttpRequestUtil . sendPost ( token , jsonString , url , dataSecret , dataSecretIv , operatorId , signSecret ) ;
@@ -589,64 +597,87 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
* supervise_notification_charge_order_info
*/
@Override
public String notificationChargeOrderInfo ( String orderCode , ThirdPartySecretInfoVO secretInfoVO ) {
// 根据 订单号查询出 信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService . getOrderInfoByOrderCode ( orderCode ) ;
if ( orderBasicInfo = = null ) {
return null ;
}
public String notificationChargeOrderInfo ( String orderCode ) {
// 通过 订单号查询订单 信息
OrderVO orderVO = orderBasicInfoService . getCharge OrderInfoByOrderCode ( orderCode ) ;
BigDecimal startSoc = orderVO . getStartSoc ( ) = = null ? BigDecimal . ZERO : new BigDecimal ( orderVO . getStartSoc ( ) ) ;
BigDecimal endSoc = orderVO . getEndSoc ( ) = = null ? BigDecimal . ZERO : new BigDecimal ( orderVO . getEndSoc ( ) ) ;
String operatorId = Constants . OPERATORID_JIANG_SU ;
String operatorSecret = secretInfoVO . getTheirOperatorSecret ( ) ;
String signSecret = secretInfoVO . getTheirSigSecret ( ) ;
String dataSecret = secretInfoVO . getTheirDataSecret ( ) ;
String dataSecretIv = secretInfoVO . getTheirDataSecretIv ( ) ;
String urlAddress = secretInfoVO . getTheirUrlPrefix ( ) ;
com . jsowell . thirdparty . platform . common . ChargeOrderInfo chargeOrderInfo = com . jsowell . thirdparty . platform . common . ChargeOrderInfo . builder ( )
. operatorId ( Constants . OPERATORID_JIANG_SU )
// .equipmentId()
. stationId ( orderVO . getStationId ( ) )
. equipmentId ( orderVO . getPileSn ( ) )
. equipmentClassification ( Constants . one )
. connectorId ( orderVO . getPileConnectorCode ( ) )
. startChargeSeq ( orderVO . getOrderCode ( ) )
. startSoc ( startSoc )
. endSoc ( endSoc )
. totalMoney ( orderVO . getOrderAmount ( ) )
. totalElecMoney ( orderVO . getTotalElectricityAmount ( ) )
. totalSeviceMoney ( orderVO . getTotalServiceAmount ( ) )
. totalPower ( new BigDecimal ( orderVO . getTotalPower ( ) ) )
. startTime ( orderVO . getStartTime ( ) )
. endTime ( orderVO . getEndTime ( ) )
. paymentAmount ( orderVO . getPayAmount ( ) )
. payTime ( orderVO . getPayTime ( ) )
// .payWay(orderVO.getPayMode())
. stopReason ( Constants . two ) // 2-BMS 停止充电
. startMeterNum ( BigDecimal . ZERO ) // 电表起止值(暂时给0)
. endMeterNum ( BigDecimal . ZERO )
// 根据订单号查询订单详情
OrderDetail orderDetail = orderBasicInfoService . getOrderDetailByOrderCode ( orderCode ) ;
if ( orderDetail = = null ) {
return null ;
}
// 推送地址
String url = urlAddress + " supervise_notification_charge_order_info " ;
// 拼装成平台所需格式对象
ChargeOrderInfo orderInfo = transformChargeOrderInfo ( orderBasicInfo , orderDetail ) ;
orderInfo . setOperatorID ( operatorId ) ;
String equipmentOwnerID ;
if ( MerchantUtils . isXiXiaoMerchant ( orderBasicInfo . getMerchantId ( ) ) ) {
equipmentOwnerID = Constants . OPERATORID_XI_XIAO ;
. build ( ) ;
// 设备产权所属单位ID
String organizationCode = orderVO . getOrganizationCode ( ) ;
if ( StringUtils . isNotBlank ( organizationCode ) & & organizationCode . length ( ) = = 18 ) {
String equipmentOwnerId = StringUtils . substring ( organizationCode , organizationCode . length ( ) - 10 , organizationCode . length ( ) - 1 ) ;
chargeOrderInfo . setEquipmentOwnerId ( equipmentOwnerId ) ;
} else {
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService . queryMerchantInfoByStationId ( orderInfo . getStationID ( ) ) ;
String organizationCode = pileMerchantInfoVO . getOrganizationCode ( ) ;
if ( StringUtils . isNotBlank ( organizationCode ) & & organizationCode . length ( ) = = 18 ) {
equipmentOwnerID = ThirdPartyPlatformUtils . extractEquipmentOwnerID ( pileMerchantInfoVO . getOrganizationC ode ( ) ) ;
} else {
equipmentOwnerID = Constants . OPERATORID_JIANG_SU ;
}
chargeOrderInfo . setEquipmentOwnerId ( Constants . OPERATORID_JIANG_SU ) ;
}
// 支付方式
String payMode = orderVO . getPayM ode ( ) ;
if ( StringUtils . equals ( " 4 " , payMode ) ) {
// 微信支付
chargeOrderInfo . setPayWay ( 2 ) ;
} else {
chargeOrderInfo . setPayWay ( 6 ) ;
}
orderInfo . setEquipmentOwnerID ( equipmentOwnerID ) ;
List < BillingPriceVO > billingList = pileBillingTemplateService . queryBillingPrice ( orderBasicInfo . getStationId ( ) ) ;
// 先将list按照 尖、峰、平、谷 时段排序
// List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
// 再循环该list, 拼装对应的充电价格、费率
List < SupChargeDetails > chargeDetails = transformSupChargeDetails ( orderDetail , billingList ) ;
orderInfo . setChargeDetails ( chargeDetails ) ;
// 获取推送配置密钥信息
ThirdPartyStationRelationVO settingInfo = getGuiZhouSettingInfo ( ) ;
if ( settingInfo = = null ) {
return null ;
}
String operatorId = settingInfo . getOperatorId ( ) ;
String operatorSecret = settingInfo . getOperatorSecret ( ) ;
String signSecret = settingInfo . getSignSecret ( ) ;
String dataSecret = settingInfo . getDataSecret ( ) ;
String dataSecretIv = settingInfo . getDataSecretIv ( ) ;
String urlAddress = settingInfo . getUrlAddress ( ) ;
String url = urlAddress + " notification_charge_order_info " ;
// 获取令牌
String token = getToken ( urlAddress , operatorId , operatorSecret , dataSecretIv , signSecret , dataSecret ) ;
if ( StringUtils . isBlank ( token ) ) {
return null ;
}
// 调用联联平台接口
String jsonString = JSON . toJSONString ( o rderInfo) ;
// 封装参数
String jsonString = JSON . toJSONString ( chargeO rderInfo) ;
// 发送请求
String result = HttpRequestUtil . sendPost ( token , jsonString , url , dataSecret , dataSecretIv , operatorId , signSecret ) ;
return result ;
}
// 获取青海平台配置密钥信息
private ThirdPartyStationRelationVO getGuiZhouSettingInfo ( ) {
// 通过第三方平台类型查询相关配置信息
ThirdPartyStationRelation relation = new ThirdPartyStationRelation ( ) ;
relation . setThirdPartyType ( ThirdPlatformTypeEnum . QING_HAI_PLATFORM . getTypeCode ( ) ) ;
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService . selectRelationInfo ( relation ) ;
return relationInfo ;
}
/**
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
*