mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 海南平台对接
This commit is contained in:
@@ -3,12 +3,9 @@ package com.jsowell.thirdparty.platform.hainan.domain;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
@@ -20,12 +17,6 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class HNStationInfo extends ZDLStationInfo {
|
||||
|
||||
/**
|
||||
* 站点照片
|
||||
*/
|
||||
@JSONField(name = "Pictures")
|
||||
private List<String> pictures;
|
||||
|
||||
/**
|
||||
* 电费描述
|
||||
*/
|
||||
@@ -38,10 +29,4 @@ public class HNStationInfo extends ZDLStationInfo {
|
||||
@JSONField(name = "ServiceFee")
|
||||
private String serviceFee;
|
||||
|
||||
/**
|
||||
* 停车费描述
|
||||
*/
|
||||
@JSONField(name = "ParkFee")
|
||||
private String parkFee;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,21 +12,21 @@ import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.util.AdapayUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
|
||||
import com.jsowell.pile.domain.ykcCommond.StopChargingCommand;
|
||||
import com.jsowell.pile.dto.QueryEquipChargeStatusDTO;
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.EchoBillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
||||
@@ -41,8 +41,8 @@ import com.jsowell.thirdparty.lianlian.vo.QueryStartChargeVO;
|
||||
import com.jsowell.thirdparty.lianlian.vo.QueryStopChargeVO;
|
||||
import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic;
|
||||
import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory;
|
||||
import com.jsowell.thirdparty.platform.hainan.domain.HNStationInfo;
|
||||
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo;
|
||||
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -83,7 +83,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
}
|
||||
}
|
||||
|
||||
List<ZDLStationInfo> resultList = new ArrayList<>();
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
|
||||
@@ -98,15 +97,18 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
return null;
|
||||
}
|
||||
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<HNStationInfo> resultList = new ArrayList<>();
|
||||
HNStationInfo stationInfo = null;
|
||||
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||
ZDLStationInfo stationInfo = new ZDLStationInfo();
|
||||
stationInfo.setStationId(String.valueOf(pileStationInfo.getId()));
|
||||
stationInfo = new HNStationInfo();
|
||||
String stationId = String.valueOf(pileStationInfo.getId());
|
||||
stationInfo.setStationId(stationId);
|
||||
stationInfo.setOperatorId(Constants.OPERATORID_JIANG_SU); // 组织机构代码
|
||||
String organizationCode = pileStationInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
stationInfo.setEquipmentOwnerId(equipmentOwnerId);
|
||||
}else {
|
||||
} else {
|
||||
stationInfo.setEquipmentOwnerId(Constants.OPERATORID_JIANG_SU);
|
||||
}
|
||||
stationInfo.setStationName(pileStationInfo.getStationName());
|
||||
@@ -138,6 +140,13 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||
}
|
||||
|
||||
Map<String, String> priceDescription = getPriceDescription(stationId);
|
||||
// 充电费描述
|
||||
stationInfo.setElectricityFee(priceDescription.get("electricityFee"));
|
||||
// 服务费描述
|
||||
stationInfo.setServiceFee(priceDescription.get("serviceFee"));
|
||||
|
||||
resultList.add(stationInfo);
|
||||
}
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -160,6 +169,59 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private Map<String, String> getPriceDescription(String stationId) {
|
||||
Map<String, String> resultMap = Maps.newHashMap();
|
||||
StringBuilder electricityFee = new StringBuilder("电费:");
|
||||
StringBuilder serviceFee = new StringBuilder("服务费:");
|
||||
|
||||
// 查询站点当前使用的计费模板
|
||||
BillingTemplateVO billingTemplate = pileBillingTemplateService.queryUsedBillingTemplate(stationId);
|
||||
if (billingTemplate == null) {
|
||||
resultMap.put("electricityFee", electricityFee.toString());
|
||||
resultMap.put("serviceFee", serviceFee.toString());
|
||||
return resultMap;
|
||||
}
|
||||
EchoBillingTemplateVO echoBillingTemplateVO = pileBillingTemplateService.queryPileBillingTemplateById(Long.parseLong(billingTemplate.getTemplateId()));
|
||||
if (echoBillingTemplateVO == null) {
|
||||
resultMap.put("electricityFee", electricityFee.toString());
|
||||
resultMap.put("serviceFee", serviceFee.toString());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
List<BillingTimeDTO> timeArray = echoBillingTemplateVO.getTimeArray();
|
||||
for (BillingTimeDTO billingTimeDTO : timeArray) {
|
||||
String type = billingTimeDTO.getType();
|
||||
String startTime = billingTimeDTO.getStartTime();
|
||||
String endTime = billingTimeDTO.getEndTime();
|
||||
|
||||
BigDecimal electricityPrice;
|
||||
BigDecimal servicePrice;
|
||||
if (StringUtils.equals(type, "1")) {
|
||||
electricityPrice = echoBillingTemplateVO.getElectricityPriceA();
|
||||
servicePrice = echoBillingTemplateVO.getServicePriceA();
|
||||
} else if (StringUtils.equals(type, "2")) {
|
||||
electricityPrice = echoBillingTemplateVO.getElectricityPriceB();
|
||||
servicePrice = echoBillingTemplateVO.getServicePriceB();
|
||||
} else if (StringUtils.equals(type, "3")) {
|
||||
electricityPrice = echoBillingTemplateVO.getElectricityPriceC();
|
||||
servicePrice = echoBillingTemplateVO.getServicePriceC();
|
||||
} else {
|
||||
electricityPrice = echoBillingTemplateVO.getElectricityPriceD();
|
||||
servicePrice = echoBillingTemplateVO.getServicePriceD();
|
||||
}
|
||||
|
||||
electricityFee.append(startTime).append("~").append(endTime).append(":").append(AdapayUtil.formatAmount(electricityPrice, 4)).append(",");
|
||||
serviceFee.append(startTime).append("~").append(endTime).append(":").append(AdapayUtil.formatAmount(servicePrice, 4)).append(",");
|
||||
}
|
||||
|
||||
electricityFee.deleteCharAt(electricityFee.length() - 1);
|
||||
serviceFee.deleteCharAt(serviceFee.length() - 1);
|
||||
|
||||
resultMap.put("electricityFee", electricityFee.toString());
|
||||
resultMap.put("serviceFee", serviceFee.toString());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 6.3 设备状态变化推送
|
||||
*
|
||||
@@ -261,7 +323,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
}
|
||||
ConnectorStatusInfo connectorStatusInfo;
|
||||
for (String stationId : stationIds) {
|
||||
StationStatusInfo stationStatusInfo= new StationStatusInfo();
|
||||
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||
stationStatusInfo.setStationId(stationId);
|
||||
// 根据站点id查询
|
||||
List<ConnectorInfoVO> list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId));
|
||||
@@ -276,7 +338,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
continue;
|
||||
}
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
|
||||
if(CollectionUtils.isNotEmpty(chargingRealTimeData)) {
|
||||
if (CollectionUtils.isNotEmpty(chargingRealTimeData)) {
|
||||
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
|
||||
|
||||
info.setStartChargeSeq(orderBasicInfo.getOrderCode());
|
||||
@@ -612,6 +674,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
|
||||
/**
|
||||
* 请求开始充电
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@@ -707,7 +770,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) {
|
||||
// 充电中
|
||||
orderStatus = "2";
|
||||
}else if (StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) {
|
||||
} else if (StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) {
|
||||
// 充电完成
|
||||
orderStatus = "4";
|
||||
} else {
|
||||
@@ -720,7 +783,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
// 查询当前枪口状态
|
||||
PileConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
|
||||
connectorStatus = connectorInfoVO.getStatus();
|
||||
}else {
|
||||
} else {
|
||||
connectorStatus = Integer.parseInt(status);
|
||||
}
|
||||
BigDecimal totalElectricityAmount = orderDetail.getTotalElectricityAmount() == null ? BigDecimal.ZERO : orderDetail.getTotalElectricityAmount();
|
||||
@@ -957,7 +1020,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
|
||||
/**
|
||||
* 推送充电订单对账信息
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> checkChargeOrders() {
|
||||
|
||||
Reference in New Issue
Block a user