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:
@@ -317,7 +317,7 @@ public interface ThirdPartyPlatformService {
|
||||
*
|
||||
* @throws UnsupportedOperationException 未实现异常
|
||||
*/
|
||||
default String notificationChargeOrderInfoHistory(String stationId) {
|
||||
default String notificationChargeOrderInfoHistory(String orderCode) {
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.jsowell.thirdparty.platform.neimenggu.domain;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -11,6 +11,9 @@ import java.util.List;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ChargeOrderInfo {
|
||||
/**
|
||||
* 平台运营商ID
|
||||
@@ -151,7 +154,7 @@ public class ChargeOrderInfo {
|
||||
* 浮点数≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "TotalPower")
|
||||
private String totalPower;
|
||||
private BigDecimal totalPower;
|
||||
|
||||
/**
|
||||
* 尖阶段电量
|
||||
@@ -162,7 +165,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "CuspElect")
|
||||
private String cuspElect;
|
||||
private BigDecimal cuspElect;
|
||||
|
||||
/**
|
||||
* 峰阶段电量
|
||||
@@ -173,7 +176,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "PeakElect")
|
||||
private String peakElect;
|
||||
private BigDecimal peakElect;
|
||||
|
||||
/**
|
||||
* 平阶段电量
|
||||
@@ -184,7 +187,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符
|
||||
*/
|
||||
@JSONField(name = "FlatElect")
|
||||
private String flatElect;
|
||||
private BigDecimal flatElect;
|
||||
|
||||
/**
|
||||
* 谷阶段电量
|
||||
@@ -195,7 +198,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "ValleyElect")
|
||||
private String valleyElect;
|
||||
private BigDecimal valleyElect;
|
||||
|
||||
/**
|
||||
* 推送时间
|
||||
@@ -217,7 +220,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "TotalElecMoney")
|
||||
private String totalElecMoney;
|
||||
private BigDecimal totalElecMoney;
|
||||
|
||||
/**
|
||||
* 总服务费
|
||||
@@ -228,7 +231,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "TotalSeviceMoney")
|
||||
private String totalSeviceMoney;
|
||||
private BigDecimal totalSeviceMoney;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
@@ -239,7 +242,7 @@ public class ChargeOrderInfo {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "TotalMoney")
|
||||
private String totalMoney;
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
/**
|
||||
* 充电结束原因
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 时段充电明细
|
||||
*/
|
||||
@@ -41,7 +43,7 @@ public class SupChargeDetails {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "DetailPower")
|
||||
private String detailPower;
|
||||
private BigDecimal detailPower;
|
||||
|
||||
/**
|
||||
* 时段电价
|
||||
@@ -52,7 +54,7 @@ public class SupChargeDetails {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "ElecPrice")
|
||||
private String elecPrice;
|
||||
private BigDecimal elecPrice;
|
||||
|
||||
/**
|
||||
* 时段服务费价格
|
||||
@@ -63,7 +65,7 @@ public class SupChargeDetails {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "SevicePrice")
|
||||
private String sevicePrice;
|
||||
private BigDecimal sevicePrice;
|
||||
|
||||
/**
|
||||
* 时段电费
|
||||
@@ -74,7 +76,7 @@ public class SupChargeDetails {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "DetailElecMoney")
|
||||
private String detailElecMoney;
|
||||
private BigDecimal detailElecMoney;
|
||||
|
||||
/**
|
||||
* 时段服务费
|
||||
@@ -85,5 +87,5 @@ public class SupChargeDetails {
|
||||
* ≤8字符,小数点后4位
|
||||
*/
|
||||
@JSONField(name = "DetailSeviceMoney")
|
||||
private String detailSeviceMoney;
|
||||
private BigDecimal detailSeviceMoney;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ import cn.hutool.core.util.PageUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
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.PayChannelEnum;
|
||||
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
@@ -32,13 +32,15 @@ import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.*;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
|
||||
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.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.common.ChargeDetail;
|
||||
import com.jsowell.thirdparty.platform.common.OrderInfo;
|
||||
import com.jsowell.thirdparty.platform.common.StationInfo;
|
||||
import com.jsowell.thirdparty.platform.neimenggu.domain.ChargeOrderInfo;
|
||||
import com.jsowell.thirdparty.platform.neimenggu.domain.SupChargeDetails;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
||||
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
|
||||
@@ -376,13 +378,16 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public String notificationChargeOrderInfo(String orderCode) {
|
||||
// 根据订单号查询出信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
if (orderBasicInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
|
||||
if (relationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
@@ -390,91 +395,31 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
|
||||
// 根据订单号查询订单详情
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
if (orderDetail == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 推送地址
|
||||
String url = urlAddress + "notification_orderInfo";
|
||||
|
||||
// 拼装成联联平台所需格式对象
|
||||
OrderInfo orderInfo = OrderInfo.builder()
|
||||
.operatorID(operatorId)
|
||||
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.stationID("LC" + orderBasicInfo.getStationId())
|
||||
.equipmentID(orderBasicInfo.getPileSn())
|
||||
.connectorID(orderBasicInfo.getPileConnectorCode())
|
||||
.startChargeSeq(orderCode)
|
||||
.userChargeType(Constants.one)
|
||||
.money(new BigDecimal(String.valueOf(orderBasicInfo.getOrderAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||
.electMoney(new BigDecimal(String.valueOf(orderDetail.getTotalElectricityAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||
.serviceMoney(new BigDecimal(String.valueOf(orderDetail.getTotalServiceAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||
.elect(new BigDecimal(String.valueOf(orderDetail.getTotalUsedElectricity())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
|
||||
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()))
|
||||
.paymentAmount(orderBasicInfo.getPayAmount())
|
||||
// .payChannel()
|
||||
.stopReason(0)
|
||||
// .chargeDetails()
|
||||
.build();
|
||||
// 拼装成内蒙古平台所需格式对象
|
||||
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
|
||||
orderInfo.setOperatorID(operatorId);
|
||||
String equipmentOwnerID;
|
||||
if (StringUtils.equals("35", orderBasicInfo.getMerchantId())) {
|
||||
orderInfo.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
|
||||
}
|
||||
// 支付方式
|
||||
if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||
// 微信支付
|
||||
orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.WEXIN_PAY.getCode()));
|
||||
} else if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) {
|
||||
// 支付宝支付
|
||||
orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.ALI_PAY.getCode()));
|
||||
equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
|
||||
} else {
|
||||
// 其他
|
||||
orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.OTHER.getCode()));
|
||||
equipmentOwnerID = Constants.OPERATORID_LIANLIAN;
|
||||
}
|
||||
// 订单详情
|
||||
ChargeDetail detail;
|
||||
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<ChargeDetail> chargeDetails = new ArrayList<>();
|
||||
for (BillingPriceVO billingPriceVO : billingList) {
|
||||
detail = new ChargeDetail();
|
||||
if (StringUtils.equals(billingPriceVO.getTimeType(), "1")) {
|
||||
// 尖时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getSharpUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice());
|
||||
} else if (StringUtils.equals(billingPriceVO.getTimeType(), "2")) {
|
||||
// 峰时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getPeakUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice());
|
||||
} else if (StringUtils.equals(billingPriceVO.getTimeType(), "3")) {
|
||||
// 平时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getFlatUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice());
|
||||
} else if (StringUtils.equals(billingPriceVO.getTimeType(), "4")) {
|
||||
// 谷时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getValleyUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice());
|
||||
}
|
||||
chargeDetails.add(detail);
|
||||
}
|
||||
List<SupChargeDetails> chargeDetails = transformSupChargeDetails(orderDetail, billingList);
|
||||
orderInfo.setChargeDetails(chargeDetails);
|
||||
|
||||
// 获取令牌
|
||||
@@ -484,7 +429,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
// 调用联联平台接口
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("OrderInfo", orderInfo);
|
||||
json.put("ChargeOrderInfo", orderInfo);
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
return result;
|
||||
@@ -560,11 +505,145 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
/**
|
||||
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
|
||||
*
|
||||
* @param stationId
|
||||
* @param orderCode
|
||||
* @throws UnsupportedOperationException 未实现异常
|
||||
*/
|
||||
@Override
|
||||
public String notificationChargeOrderInfoHistory(String stationId) {
|
||||
return ThirdPartyPlatformService.super.notificationChargeOrderInfoHistory(stationId);
|
||||
public String notificationChargeOrderInfoHistory(String orderCode) {
|
||||
// 根据订单号查询出信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
|
||||
if (relationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
String dataSecret = relationInfo.getDataSecret();
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
|
||||
String url = urlAddress + "supervise_notification_charge_order_info_history";
|
||||
|
||||
// 拼装成内蒙古平台所需格式对象
|
||||
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
|
||||
orderInfo.setOperatorID(operatorId);
|
||||
String equipmentOwnerID;
|
||||
if (StringUtils.equals("35", orderBasicInfo.getMerchantId())) {
|
||||
equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
|
||||
} else {
|
||||
equipmentOwnerID = Constants.OPERATORID_LIANLIAN;
|
||||
}
|
||||
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);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
// 调用联联平台接口
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("ChargeOrderInfo", orderInfo);
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换充电站充电订单信息
|
||||
* @param orderBasicInfo
|
||||
* @param orderDetail
|
||||
* @return
|
||||
*/
|
||||
private ChargeOrderInfo transformChargeOrderInfo(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) {
|
||||
ChargeOrderInfo chargeOrderInfo = ChargeOrderInfo.builder()
|
||||
.stationID(orderBasicInfo.getStationId())
|
||||
.equipmentID(orderBasicInfo.getPileSn())
|
||||
.orderNo(orderBasicInfo.getOrderCode())
|
||||
.connectorID(orderBasicInfo.getPileConnectorCode())
|
||||
.licensePlate(orderBasicInfo.getPlateNumber())
|
||||
.vin(orderBasicInfo.getVinCode())
|
||||
.startSOC(orderBasicInfo.getStartSoc())
|
||||
.endSOC(orderBasicInfo.getEndSoc())
|
||||
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
|
||||
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()))
|
||||
.totalPower(orderDetail.getTotalUsedElectricity())
|
||||
.cuspElect(orderDetail.getSharpUsedElectricity())
|
||||
.peakElect(orderDetail.getSharpUsedElectricity())
|
||||
.flatElect(orderDetail.getFlatUsedElectricity())
|
||||
.valleyElect(orderDetail.getValleyUsedElectricity())
|
||||
.pushTimeStamp(DateUtils.getDateTime())
|
||||
.totalElecMoney(orderDetail.getTotalElectricityAmount())
|
||||
.totalSeviceMoney(orderDetail.getTotalServiceAmount())
|
||||
.totalMoney(orderDetail.getTotalOrderAmount())
|
||||
.stopReason(0)
|
||||
.stopDesc(orderBasicInfo.getReason()) // TODO 停止原因
|
||||
.sumPeriod(0)
|
||||
.build();
|
||||
return chargeOrderInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换时段充电明细
|
||||
* @param orderDetail
|
||||
* @param billingList
|
||||
* @return
|
||||
*/
|
||||
private List<SupChargeDetails> transformSupChargeDetails(OrderDetail orderDetail, List<BillingPriceVO> billingList) {
|
||||
List<SupChargeDetails> resultList = Lists.newArrayList();
|
||||
SupChargeDetails detail;
|
||||
for (BillingPriceVO billingPriceVO : billingList) {
|
||||
detail = new SupChargeDetails();
|
||||
if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.SHARP.getValue())) {
|
||||
// 尖时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getSharpUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice());
|
||||
} else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.PEAK.getValue())) {
|
||||
// 峰时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getPeakUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice());
|
||||
} else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.FLAT.getValue())) {
|
||||
// 平时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getFlatUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice());
|
||||
} else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.VALLEY.getValue())) {
|
||||
// 谷时段
|
||||
detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||
detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||
detail.setDetailPower(orderDetail.getValleyUsedElectricity());
|
||||
detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice());
|
||||
detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice());
|
||||
}
|
||||
resultList.add(detail);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user