mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 华为平台生成订单、结算订单方法
This commit is contained in:
@@ -507,7 +507,7 @@ public class CommonService {
|
||||
* @param pileConnectorCode
|
||||
* @return
|
||||
*/
|
||||
public String commonQueryStartCharge(String thirdPartyType, List<String> stationIds, String pileConnectorCode, BigDecimal chargeAmount) {
|
||||
public String commonQueryStartCharge(String thirdPartyType, List<String> stationIds, String pileConnectorCode, BigDecimal chargeAmount, String payMode) {
|
||||
// 判断平台类型
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) {
|
||||
// 华为平台
|
||||
@@ -528,6 +528,7 @@ public class CommonService {
|
||||
HWQueryStartChargeDTO dto = new HWQueryStartChargeDTO();
|
||||
dto.setConnectorID(pileConnectorCode);
|
||||
dto.setMoneyLimit(chargeAmount);
|
||||
dto.setPayMode(payMode);
|
||||
QueryStartChargeVO startChargeVO = huaweiServiceV2.queryStartCharge(dto);
|
||||
if (startChargeVO.getSuccStat() != Constants.zero) {
|
||||
log.error(thirdPartyType + "请求启动充电 error, {}", startChargeVO.getFailReason());
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
@@ -27,6 +28,8 @@ import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.huawei.*;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
||||
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
|
||||
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.vo.huawei.QueryChargeStatusVO;
|
||||
@@ -87,6 +90,9 @@ public class HuaweiServiceV2 {
|
||||
@Autowired
|
||||
private PileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@@ -493,13 +499,14 @@ public class HuaweiServiceV2 {
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* 只需传枪口号、充电金额即可
|
||||
* 只需传枪口号、充电金额、支付方式即可
|
||||
* @param dto
|
||||
* @return QueryStartChargeVO
|
||||
*/
|
||||
public QueryStartChargeVO queryStartCharge(HWQueryStartChargeDTO dto) {
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
BigDecimal chargeAmount = dto.getMoneyLimit();
|
||||
String payMode = dto.getPayMode();
|
||||
|
||||
String requestName = "query_start_charge";
|
||||
|
||||
@@ -511,6 +518,7 @@ public class HuaweiServiceV2 {
|
||||
startChargeDTO.setStartChargeSeq(startChargeSeq);
|
||||
startChargeDTO.setConnectorID(pileConnectorCode);
|
||||
startChargeDTO.setAccountBalance(chargeAmount);
|
||||
startChargeDTO.setPayMode(dto.getPayMode());
|
||||
Map<String, Object> map = orderBasicInfoService.generateOrderForThirdParty(startChargeDTO);
|
||||
|
||||
if (map == null) {
|
||||
@@ -741,17 +749,30 @@ public class HuaweiServiceV2 {
|
||||
|
||||
// 查出订单基本信息和详情
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(startChargeSeq);
|
||||
// OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(startChargeSeq);
|
||||
|
||||
orderBasicInfo.setChargeStartTime(DateUtils.parseDate(dto.getStartTime()));
|
||||
orderBasicInfo.setChargeEndTime(DateUtils.parseDate(dto.getEndTime()));
|
||||
orderBasicInfo.setOrderStatus(OrderStatusEnum.ORDER_COMPLETE.getValue()); // 订单状态改为订单完成
|
||||
orderBasicInfo.setReason(String.valueOf(dto.getStopReason())); // TODO 新建停止原因枚举
|
||||
// TODO 结算订单
|
||||
TransactionRecordsData data = TransactionRecordsData.builder()
|
||||
.consumptionAmount(String.valueOf(dto.getTotalMoney())) // 订单总金额
|
||||
.stopReasonMsg(String.valueOf(dto.getStopReason())) // 停止原因
|
||||
.totalElectricity(String.valueOf(dto.getTotalPower())) // 总用电量
|
||||
.totalElectricityAmount(String.valueOf(dto.getTotalElecMoney())) // 总电费
|
||||
.totalServiceAmount(String.valueOf(dto.getTotalSeviceMoney())) // 总服务费
|
||||
.build();
|
||||
String mode = pileMerchantInfoService.getDelayModeByMerchantId(orderBasicInfo.getMerchantId());
|
||||
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
||||
orderLogic.settleOrderForThirdParty(data, orderBasicInfo);
|
||||
|
||||
orderDetail.setTotalUsedElectricity(dto.getTotalPower());
|
||||
orderDetail.setTotalElectricityAmount(dto.getTotalElecMoney());
|
||||
orderDetail.setTotalServiceAmount(dto.getTotalSeviceMoney());
|
||||
orderDetail.setTotalOrderAmount(dto.getTotalMoney());
|
||||
|
||||
// orderBasicInfo.setChargeStartTime(DateUtils.parseDate(dto.getStartTime()));
|
||||
// orderBasicInfo.setChargeEndTime(DateUtils.parseDate(dto.getEndTime()));
|
||||
// orderBasicInfo.setOrderStatus(OrderStatusEnum.ORDER_COMPLETE.getValue()); // 订单状态改为订单完成
|
||||
// orderBasicInfo.setReason(String.valueOf(dto.getStopReason())); // TODO 新建停止原因枚举
|
||||
//
|
||||
// orderDetail.setTotalUsedElectricity(dto.getTotalPower());
|
||||
// orderDetail.setTotalElectricityAmount(dto.getTotalElecMoney());
|
||||
// orderDetail.setTotalServiceAmount(dto.getTotalSeviceMoney());
|
||||
// orderDetail.setTotalOrderAmount(dto.getTotalMoney());
|
||||
|
||||
// if (CollectionUtils.isNotEmpty(chargeDetails)) {
|
||||
// for (BillingPriceVO billingPriceVO : billingPriceVOList) {
|
||||
@@ -765,13 +786,12 @@ public class HuaweiServiceV2 {
|
||||
// }
|
||||
// }
|
||||
// 通过事务修改订单信息
|
||||
OrderTransactionDTO transactionDTO = OrderTransactionDTO.builder()
|
||||
.orderBasicInfo(orderBasicInfo)
|
||||
.orderDetail(orderDetail)
|
||||
.build();
|
||||
transactionService.doUpdateOrder(transactionDTO);
|
||||
// OrderTransactionDTO transactionDTO = OrderTransactionDTO.builder()
|
||||
// .orderBasicInfo(orderBasicInfo)
|
||||
// .orderDetail(orderDetail)
|
||||
// .build();
|
||||
// transactionService.doUpdateOrder(transactionDTO);
|
||||
|
||||
// TODO 订单退款
|
||||
|
||||
// 构建返回参数
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
Reference in New Issue
Block a user