|
|
@@ -2,6 +2,7 @@ package com.kym.service.miniapp.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.kym.common.config.EnPlusConfig;
|
|
|
import com.kym.common.constant.ResponseEnum;
|
|
|
import com.kym.common.exception.BusinessException;
|
|
|
import com.kym.common.utils.OrderUtils;
|
|
|
@@ -15,7 +16,6 @@ import com.kym.service.miniapp.ChargeService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Map;
|
|
|
@@ -42,8 +42,8 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
@Autowired
|
|
|
private EnPlusService enPlusService;
|
|
|
|
|
|
- @Value("${en-plus.operatorId}")
|
|
|
- private String operatorId;
|
|
|
+ @Autowired
|
|
|
+ private EnPlusConfig enPlusConfig;
|
|
|
|
|
|
/**
|
|
|
* 启动充电
|
|
|
@@ -74,7 +74,7 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
var amount = account.getBalance() - 50;
|
|
|
|
|
|
// 充电订单号/设备认证号
|
|
|
- String startChargeSeq = OrderUtils.getOrderNo(operatorId);
|
|
|
+ String startChargeSeq = OrderUtils.getOrderNo(enPlusConfig.getOperatorId());
|
|
|
|
|
|
// 请求设备认证
|
|
|
var equipAuth = enPlusService.queryEquipAuth(connectorId, startChargeSeq);
|
|
|
@@ -126,7 +126,7 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
*/
|
|
|
@Override
|
|
|
public ChargeOrder queryEquipChargeStatus(String startChargeSeq) {
|
|
|
- var userId = StpUtil.getSession().getLong("userId");
|
|
|
+ var userId = StpUtil.getLoginIdAsLong();
|
|
|
var chargeOrder = chargeOrderService.getChargingOrderByUserId(userId);
|
|
|
if (chargeOrder != null) {
|
|
|
// 查询充电
|
|
|
@@ -205,7 +205,7 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
*/
|
|
|
@Override
|
|
|
public EnBusinessPolicy queryEquipBusinessPolicy(String connectorId) {
|
|
|
- var equipBizSeq = OrderUtils.getOrderNo(operatorId);
|
|
|
+ var equipBizSeq = OrderUtils.getOrderNo(enPlusConfig.getOperatorId());
|
|
|
var data = enPlusService.queryEquipBusinessPolicy(equipBizSeq, connectorId);
|
|
|
return data.toJavaObject(EnBusinessPolicy.class);
|
|
|
}
|