@@ -216,64 +216,64 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
PageInfo < ThirdPartyStationInfoVO > pageInfo = new PageInfo < > ( stationInfos ) ;
List < SupStationInfo > resultList = new ArrayList < > ( ) ;
for ( ThirdPartyStationInfoVO pileStationInfo : pageInfo . getList ( ) ) {
SupStationInfo stationI nfo = new SupStationInfo ( ) ;
String stationId = String . valueOf ( pileStationInfo . getId ( ) ) ;
stationInfo . setStationID ( stationId ) ;
stationInfo . setOperatorID ( Constants . OPERATORID_JIANG_SU ) ; // 组织机构代码
stationInfo . setEquipmentOwnerID ( String . valueOf ( pileStationInfo . getMerchantId ( ) ) ) ;
stationInfo . setStationNam e ( pileStationInfo . getStationNam e ( ) ) ;
stationInfo . setIsAloneApply ( Integer . valueOf ( pileStationInfo . getAloneApply ( ) ) ) ;
stationInfo . setIsPublicParkingLot ( Integer . valueOf ( pileStationInfo . getPublicParking ( ) ) ) ;
stationInfo . setCountryCode ( pileStationInfo . getCountryCode ( ) ) ;
stationInfo . setAreaCode ( pileStationInfo . getAreaCode ( ) ) ;
stationInfo . setAddress ( pileStationInfo . getAddress ( ) ) ;
stationInfo . setServiceTel ( pileStationInfo . getStationTel ( ) ) ;
stationInfo . setS tationType ( Integer . valueOf ( pileStationInfo . getStationType ( ) ) ) ;
stationInfo . setP arkNums( Integer . valueOf ( pileStationInfo . getParkNums ( ) ) ) ;
stationInfo . setS tationLng ( new BigDecimal ( pileStationInfo . getStationLng ( ) ) ) ;
stationInfo . setS tationLat ( new BigDecimal ( pileStationInfo . getStationLat ( ) ) ) ;
stationInfo . setC onstruction( Integer . valueOf ( pileStationInfo . getConstruction ( ) ) ) ;
stationInfo . setOpenAllDay ( Integer . valueOf ( pileStationInfo . getOpenAllDay ( ) ) ) ;
stationInfo . setPeriodFee ( 1 ) ;
// stationInfo.setMinElectricityPrice(pileStationInfo); // 最低充电电费率
// stationInfo.setElectricityFee(); // 电费 xx元/度
// stationInfo.setServiceFee(); // 服务费 xx元/度
stationInfo . setParkFree ( Integer . valueOf ( pileStationInfo . getParkFree ( ) ) ) ;
stationInfo . setPayment ( pileStationInfo . getPayment ( ) ) ;
stationInfo . setStationClassification ( 1 ) ;
stationInfo . setSupportOrder ( Integer . valueOf ( pileStationInfo . getSupportOrder ( ) ) ) ;
stationInfo . setStationStatus ( Integer . valueOf ( pileStationInfo . getStationStatus ( ) ) ) ;
stationInfo . setParkNums ( Integer . valueOf ( pileStationInfo . getParkNums ( ) ) ) ;
stationInfo . setRoundTheClock ( Constants . one ) ;
stationInfo . setParkType ( " 255 " ) ;
stationInfo . setElectricityType ( 1 ) ;
stationInfo . setCapacity ( pileStationInfo . getCapacity ( ) . setScale ( 2 , RoundingMode . HALF_UP ) ) ;
stationInfo . setRatedPower ( pileStationInfo . getRatedPower ( ) . setScale ( 1 , RoundingMode . HALF_UP ) ) ;
stationInfo . setOfficialRunTime ( DateUtils . dateTime ( pileStationInfo . getCreateTime ( ) ) ) ;
stationInfo . setVideoMonitor ( 0 ) ;
SupStationInfo i nfo = SupStationInfo . builder ()
. stationID ( String . valueOf ( pileStationInfo . getId ( ) ) )
. operatorID ( Constants . OPERATORID_JIANG_SU )
// .equipmentOwnerID()
. stationName ( pileStationInfo . getStationName ( ) )
. countryCod e ( pileStationInfo . getCountryCod e ( ) )
// .areaCode()
// .areaCodeCountryside()
. address ( pileStationInfo . getAddress ( ) )
. serviceTel ( pileStationInfo . getStationTel ( ) )
. stationClassification ( Constants . one )
. stationType ( Integer . parseInt ( pileStationInfo . getStationTyp e ( ) ) )
. stationStatus ( Integer . parseInt ( pileStationInfo . getStationStatus ( ) ) )
. p arkNums( Integer . parseInt ( pileStationInfo . getParkNums ( ) ) )
. stationLng ( new BigDecimal ( pileStationInfo . getStationLng ( ) ) )
. stationLat ( new BigDecimal ( pileStationInfo . getStationLat ( ) ) )
. c onstruction( Integer . parseInt ( pileStationInfo . getConstruction ( ) ) )
// stationInfo.setParkFeeType(pileStationInfo); // 停车收费类型
stationInfo . setBusinessExpandType ( Integer . parseInt ( pileStationInfo . getAloneApply ( ) ) ) ;
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 ) ;
if ( CollectionUtils . isNotEmpty ( pileList ) ) {
stationInfo . setEquipmentInfos ( pileList ) ; // 充电设备信息列表
. roundTheClock ( Constants . one )
. parkType ( " 255 " ) // 255-参考场地实际收费标准
. electricityType ( Constants . one ) // 用电类型 1-商业用电
. businessExpandType ( Constants . one ) //报装类型
// .capacity()
. periodFee ( Constants . one ) // 峰谷分时 0-否; 1-是
. officialRunTime ( DateUtils . parseDateToStr ( DateUtils . YYYY_MM_DD , pileStationInfo . getCreateTime ( ) ) ) //正式投运时间
. videoMonitor ( Constants . zero ) // 视频监控配套情况 0-无; 1-有
. build ( ) ;
String areaCode = pileStationInfo . getAreaCode ( ) ; // 330000,330200,330213
// 根据逗号分组
String [ ] split = StringUtils . split ( areaCode , " , " ) ;
// 只取最后一部分 330213
String subAreaCode = split [ split . length - 1 ] ;
info . setAreaCode ( subAreaCode ) ;
info . setEquipmentOwnerID ( Constants . OPERATORID_GUI_ZHOU ) ;
// 容量
if ( StringUtils . isNotBlank ( String . valueOf ( pileStationInfo . getCapacity ( ) ) ) ) {
info . setCapacity ( pileStationInfo . getCapacity ( ) . setScale ( 2 , RoundingMode . HALF_UP ) ) ;
}
resultList . add ( stationInfo ) ;
List < EquipmentInfo > pileList = pileBasicInfoService . getPileListForLianLian ( String . valueOf ( pileStationInfo . getId ( ) ) ) ;
if ( CollectionUtils . isNotEmpty ( pileList ) ) {
info . setEquipmentInfos ( pileList ) ; // 充电设备信息列表
}
// 额定功率
BigDecimal stationRatedPower = pileList . stream ( )
. map ( EquipmentInfo : : getEquipmentPower )
. reduce ( BigDecimal . ZERO , BigDecimal : : add ) ;
info . setRatedPower ( stationRatedPower ) ;
// areaCodeCountryside
GeoCodeInfo geoCode = TermRelationTreeCoordinate . completeGeoCode ( pileStationInfo . getAddress ( ) ) ;
if ( geoCode ! = null ) {
String areaCodeCountryside = geoCode. getCounty_code( ) ;
stationInfo . setAreaCodeCountryside ( areaCodeCountryside ) ;
// String areaCodeCountryside = geoCode. getCounty_code() ;
String areaCodeCountryside = " 123456789101 " ;
info . setAreaCodeCountryside ( areaCodeCountryside ) ;
}
resultList . add ( info ) ;
}
Map < String , Object > map = new LinkedHashMap < > ( ) ;
@@ -297,7 +297,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 查询第三方平台配置信息
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo ( ) ;
String operatorId = thirdPartySecretInfoVO . getOurOperatorId ( ) ;
String operatorId = Constants . OPERATORID_JIANG_SU ;
String operatorSecret = thirdPartySecretInfoVO . getTheirOperatorSecret ( ) ;
String signSecret = thirdPartySecretInfoVO . getTheirSigSecret ( ) ;
String dataSecret = thirdPartySecretInfoVO . getTheirDataSecret ( ) ;
@@ -328,7 +328,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
. electricityType ( Constants . one ) // 用电类型 1-商业用电
. businessExpandType ( Constants . one ) //报装类型
// .capacity()
. ratedPower ( new BigDecimal ( " 0.0 " ) )
. periodFee ( Constants . one ) // 峰谷分时 0-否; 1-是
. officialRunTime ( DateUtils . parseDateToStr ( DateUtils . YYYY_MM_DD , pileStationInfo . getCreateTime ( ) ) ) //正式投运时间
. videoMonitor ( Constants . zero ) // 视频监控配套情况 0-无; 1-有
@@ -351,7 +350,11 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
if ( CollectionUtils . isNotEmpty ( pileList ) ) {
info . setEquipmentInfos ( pileList ) ; // 充电设备信息列表
}
// 额定功率
BigDecimal stationRatedPower = pileList . stream ( )
. map ( EquipmentInfo : : getEquipmentPower )
. reduce ( BigDecimal . ZERO , BigDecimal : : add ) ;
info . setRatedPower ( stationRatedPower ) ;
// areaCodeCountryside
GeoCodeInfo geoCode = TermRelationTreeCoordinate . completeGeoCode ( pileStationInfo . getAddress ( ) ) ;
if ( geoCode ! = null ) {
@@ -383,50 +386,46 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
@Override
public Map < String , String > queryStationStatus ( QueryStationInfoDTO dto ) {
List < String > stationIds = dto . getStationIds ( ) ;
List < StationStatusInfo > S tationStatusInfos = new ArrayList < > ( ) ;
List < StationStatusInfo > s tationStatusInfos = new ArrayList < > ( ) ;
List < Object > connectorStatusInfos = new ArrayList < > ( ) ;
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService . queryByThirdPlatformType ( thirdPlatformType ) ;
if ( thirdPartySecretInfoVO = = null ) {
return null ;
}
ConnectorStatusInfo connectorStatusInfo ;
for ( String stationId : stationIds ) {
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService . queryMerchantInfoByStationId ( stationId ) ;
StationStatusInfo stationStatusInfo = new StationStatusInfo ( ) ;
stationStatusInfo . setStationId ( stationId ) ;
stationStatusInfo . setOperatorId ( Constants . OPERATORID_JIANG_SU ) ;
stationStatusInfo . setStationStatus ( 50 ) ;
String equipmentOwnerID = ThirdPartyPlatformUtils . extractEquipmentOwnerID ( pileMerchantInfoVO . getOrganizationCode ( ) ) ;
stationStatusInfo . setEquipmentOwnerId ( equipmentOwnerID ) ;
// 根据站点id查询
List < ConnectorInfoVO > list = pileConnectorInfoService . getConnectorListForLianLian ( Long . parseLong ( stationId ) ) ;
for ( ConnectorInfoVO connectorInfoVO : list ) {
connectorStatusInfo = new ConnectorStatusInfo ( ) ;
String connectorStatus = connectorInfoVO . getConnectorStatus ( ) ;
connectorStatusInfo . setEquipmentClassification ( 1 ) ;
connectorStatusInfo . setStationId ( stationId ) ;
connectorStatusInfo . setConnectorID ( connectorInfoVO . getPileConnectorCode ( ) ) ;
connectorStatusInfo . setEquipmentOwnerId ( equipmentOwnerID ) ;
connectorStatusInfo . setOperatorId ( Constants . OPERATORID_JIANG_SU ) ;
connectorStatusInfo . setEquipmentId ( connectorInfoVO . getPileSn ( ) ) ;
connectorStatusInfo . setStatus ( Integer . parseInt ( connectorStatus ) ) ;
connectorStatusInfo . setUpdateTime ( DateUtils . getDateTime ( ) ) ;
// 查询密钥信息
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo ( ) ;
// 根据站点idList查询枪口列表
List < ConnectorInfoVO > list = pileConnectorInfoService . batchSelectConnectorList ( stationIds ) ;
// 根据站点id分组
Map < String , List < ConnectorInfoVO > > collect = list . stream ( )
. collect ( Collectors . groupingBy ( ConnectorInfoVO : : getStationId ) ) ;
// 封装参数
for ( Map . Entry < String , List < ConnectorInfoVO > > entry : collect . entrySet ( ) ) {
String stationId = entry . getKey ( ) ;
List < ConnectorInfoVO > voList = entry . getValue ( ) ;
StationStatusInfo stationStatusInfo = new StationStatusInfo ( ) ;
stationStatusInfo . setOperatorId ( Constants . OPERATORID_JIANG_SU ) ;
stationStatusInfo . setEquipmentOwnerId ( Constants . OPERATORID_GUI_ZHOU ) ;
stationStatusInfo . setStationId ( stationId ) ;
ConnectorStatusInfo connectorStatusInfo ;
for ( ConnectorInfoVO connectorInfoVO : voList ) {
connectorStatusInfo = ConnectorStatusInfo . builder ( )
. operatorId ( Constants . OPERATORID_JIANG_SU )
. equipmentOwnerId ( Constants . OPERATORID_GUI_ZHOU ) // todo 测试
. stationId ( connectorInfoVO . getStationId ( ) )
. equipmentId ( connectorInfoVO . getPileSn ( ) )
. connectorID ( connectorInfoVO . getPileConnectorCode ( ) )
. equipmentClassification ( Constants . one )
. status ( Integer . parseInt ( connectorInfoVO . getConnectorStatus ( ) ) )
. updateTime ( DateUtils . getDateTime ( ) )
. build ( ) ;
connectorStatusInfos . add ( connectorStatusInfo ) ;
}
stationStatusInfo . setConnectorStatusInfos ( connectorStatusInfos ) ;
StationStatusInfos . add ( stationStatusInfo ) ;
}
// 将 StationStatusInfos 分页
int pageNum = 1 ;
int pageSize = 10 ;
List < StationStatusInfo > collect = StationStatusInfos . stream ( )
. skip ( ( pageNum - 1 ) * pageSize )
. limit ( pageSize )
. collect ( Collectors . toList ( ) ) ;
stationStatusInfos . add ( stationStatusInfo ) ;
}
Map < String , Object > map = new LinkedHashMap < > ( ) ;
map . put ( " StationStatusInfos " , collect ) ;
map . put ( " StationStatusInfos " , stationStatusInfos ) ;
Map < String , String > resultMap = ThirdPartyPlatformUtils . generateResultMap ( map , thirdPartySecretInfoVO ) ;
return resultMap ;
@@ -599,7 +598,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 拼装成平台所需格式对象
ChargeOrderInfo orderInfo = transformChargeOrderInfo ( orderBasicInfo , orderDetail ) ;
orderInfo . setEquipmentOwnerID ( Constants . OPERATORID_GUI_ZHOU ) ; // TODO
orderInfo . setEquipmentOwnerID ( Constants . OPERATORID_GUI_ZHOU ) ; // TODO 临时测试
List < BillingPriceVO > billingList = pileBillingTemplateService . queryBillingPrice ( orderBasicInfo . getStationId ( ) ) ;
// 先将list按照 尖、峰、平、谷 时段排序
@@ -644,7 +643,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String url = urlAddress + " supervise_notification_charge_order_info_history " ;
ChargeOrderInfo orderInfo = transformChargeOrderInfo ( orderBasicInfo , orderDetail ) ;
orderInfo . setEquipmentOwnerID ( Constants . OPERATORID_GUI_ZHOU ) ; // todo
orderInfo . setEquipmentOwnerID ( Constants . OPERATORID_GUI_ZHOU ) ; // todo 临时测试
List < BillingPriceVO > billingList = pileBillingTemplateService . queryBillingPrice ( orderBasicInfo . getStationId ( ) ) ;
// 先将list按照 尖、峰、平、谷 时段排序
@@ -788,9 +787,14 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
. stationTotalWarningNum ( 0 )
. equipmentStatsInfos ( equipmentStatsInfoList )
. build ( ) ;
supStationStatsInfo . setEquipmentOwnerId ( Constants . OPERATORID_GUI_ZHOU ) ;
JSONObject json = new JSONObject ( ) ;
json . put ( " StationStatsInfos " , supStationStatsInfo ) ;
List < Sup StationStatsInfo> supStationStatsInfoList = new ArrayList < > ( ) ;
supStationStatsInfoList . add ( supStationStatsInfo ) ;
json . put ( " StationStatsInfos " , supStationStatsInfoList ) ;
String jsonString = JSON . toJSONString ( json ) ;
// 发送推送请求
ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo ( ) ;
@@ -838,6 +842,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
if ( StringUtils . isNotBlank ( organizationCode ) & & organizationCode . length ( ) = = 18 ) {
supStationPowerInfo . setEquipmentOwnerID ( ThirdPartyPlatformUtils . extractEquipmentOwnerID ( organizationCode ) ) ;
}
supStationPowerInfo . setEquipmentOwnerID ( Constants . OPERATORID_GUI_ZHOU ) ; // todo 临时测试
// 根据站点id查询桩信息
List < PileBasicInfo > pileList = pileBasicInfoService . getPileListByStationId ( stationId ) ;
@@ -852,7 +857,9 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
. collect ( Collectors . toList ( ) ) ;
QueryConnectorListDTO dto = new QueryConnectorListDTO ( ) ;
dto . setPileIds ( pileIds ) ;
dto . setRequestSource ( " thirdPartyPlatform " ) ;
List < PileConnectorInfoVO > connectorList = pileConnectorInfoService . getConnectorInfoListByParams ( dto ) ;
if ( CollectionUtils . isEmpty ( connectorList ) ) {
logger . error ( " 推送充换电站实时功率 error, 查询枪口列表信息为空 " ) ;
throw new BusinessException ( ReturnCodeEnum . CODE_SELECT_INFO_IS_NULL ) ;
@@ -973,7 +980,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
. totalServiceMoney ( orderDetail . getTotalServiceAmount ( ) )
. totalMoney ( orderDetail . getTotalOrderAmount ( ) )
. stopReason ( 2 )
. stopDesc ( orderBasicInfo . getReason ( ) ) // TODO 停止原因
. stopDesc ( orderBasicInfo . getReason ( ) )
. sumPeriod ( 0 )
. build ( ) ;
if ( orderBasicInfo . getPlateNumber ( ) ! = null ) {