|
@@ -2,7 +2,6 @@ package com.kym.service.enplus.impl;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
-import com.kym.common.utils.IDGenerator;
|
|
|
|
|
import com.kym.entity.miniapp.ChargeOrder;
|
|
import com.kym.entity.miniapp.ChargeOrder;
|
|
|
import com.kym.entity.miniapp.WalletDetail;
|
|
import com.kym.entity.miniapp.WalletDetail;
|
|
|
import com.kym.service.enplus.EnNotifyService;
|
|
import com.kym.service.enplus.EnNotifyService;
|
|
@@ -10,6 +9,8 @@ import com.kym.service.enplus.EnPlusService;
|
|
|
import com.kym.service.miniapp.AccountService;
|
|
import com.kym.service.miniapp.AccountService;
|
|
|
import com.kym.service.miniapp.ChargeOrderService;
|
|
import com.kym.service.miniapp.ChargeOrderService;
|
|
|
import com.kym.service.miniapp.WalletDetailService;
|
|
import com.kym.service.miniapp.WalletDetailService;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -25,6 +26,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class EnNotifyServiceImpl implements EnNotifyService {
|
|
public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(EnNotifyServiceImpl.class);
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private EnPlusService enPlusService;
|
|
private EnPlusService enPlusService;
|
|
@@ -35,9 +37,6 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AccountService accountService;
|
|
private AccountService accountService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IDGenerator idGenerator;
|
|
|
|
|
-
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WalletDetailService walletDetailService;
|
|
private WalletDetailService walletDetailService;
|
|
|
|
|
|
|
@@ -63,6 +62,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String handleNotificationStartChargeResult(JSONObject json) {
|
|
public String handleNotificationStartChargeResult(JSONObject json) {
|
|
|
|
|
+ LOGGER.info("【EN+推送】收到启动充电结果通知:{}", json);
|
|
|
var data = enPlusService.signValidation(json);
|
|
var data = enPlusService.signValidation(json);
|
|
|
var obj = JSONObject.parseObject(data);
|
|
var obj = JSONObject.parseObject(data);
|
|
|
var startChargeSeq = obj.getString("StartChargeSeq");
|
|
var startChargeSeq = obj.getString("StartChargeSeq");
|
|
@@ -79,7 +79,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
chargeOrderService.update(updateWrapper);
|
|
chargeOrderService.update(updateWrapper);
|
|
|
return """
|
|
return """
|
|
|
{
|
|
{
|
|
|
- "StartChargeSeq":%s,
|
|
|
|
|
|
|
+ "StartChargeSeq":"%s",
|
|
|
"SuccStat":%d,
|
|
"SuccStat":%d,
|
|
|
"FailReason":%d
|
|
"FailReason":%d
|
|
|
}
|
|
}
|
|
@@ -95,6 +95,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String handleNotificationEquipChargeStatus(JSONObject json) {
|
|
public String handleNotificationEquipChargeStatus(JSONObject json) {
|
|
|
|
|
+ LOGGER.info("【EN+推送】收到启动充电状态通知:{}", json);
|
|
|
var dataStr = enPlusService.signValidation(json);
|
|
var dataStr = enPlusService.signValidation(json);
|
|
|
var data = JSONObject.parseObject(dataStr);
|
|
var data = JSONObject.parseObject(dataStr);
|
|
|
var startChargeSeq = data.getString("StartChargeSeq");
|
|
var startChargeSeq = data.getString("StartChargeSeq");
|
|
@@ -111,7 +112,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
chargeOrderService.updateById(chargeOrder);
|
|
chargeOrderService.updateById(chargeOrder);
|
|
|
return """
|
|
return """
|
|
|
{
|
|
{
|
|
|
- "StartChargeSeq":%s,
|
|
|
|
|
|
|
+ "StartChargeSeq":"%s",
|
|
|
"SuccStat":%d
|
|
"SuccStat":%d
|
|
|
}
|
|
}
|
|
|
""".formatted(startChargeSeq, 0);
|
|
""".formatted(startChargeSeq, 0);
|
|
@@ -127,6 +128,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String handleNotificationStopChargeResult(JSONObject json) {
|
|
public String handleNotificationStopChargeResult(JSONObject json) {
|
|
|
|
|
+ LOGGER.info("【EN+推送】收到停止充电结果通知:{}", json);
|
|
|
var dataStr = enPlusService.signValidation(json);
|
|
var dataStr = enPlusService.signValidation(json);
|
|
|
var data = JSONObject.parseObject(dataStr);
|
|
var data = JSONObject.parseObject(dataStr);
|
|
|
var startChargeSeq = data.getString("StartChargeSeq");
|
|
var startChargeSeq = data.getString("StartChargeSeq");
|
|
@@ -137,7 +139,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
}
|
|
}
|
|
|
return """
|
|
return """
|
|
|
{
|
|
{
|
|
|
- "StartChargeSeq":%s,
|
|
|
|
|
|
|
+ "StartChargeSeq":"%s",
|
|
|
"SuccStat":%d,
|
|
"SuccStat":%d,
|
|
|
"FailReason":%d
|
|
"FailReason":%d
|
|
|
}
|
|
}
|
|
@@ -154,6 +156,7 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String handleNotificationChargeOrderInfo(JSONObject json) {
|
|
public String handleNotificationChargeOrderInfo(JSONObject json) {
|
|
|
|
|
+ LOGGER.info("【EN+推送】收到充电订单信息通知:{}", json);
|
|
|
var dataStr = enPlusService.signValidation(json);
|
|
var dataStr = enPlusService.signValidation(json);
|
|
|
var data = JSONObject.parseObject(dataStr);
|
|
var data = JSONObject.parseObject(dataStr);
|
|
|
var startChargeSeq = data.getString("StartChargeSeq");
|
|
var startChargeSeq = data.getString("StartChargeSeq");
|
|
@@ -190,8 +193,8 @@ public class EnNotifyServiceImpl implements EnNotifyService {
|
|
|
}
|
|
}
|
|
|
return """
|
|
return """
|
|
|
{
|
|
{
|
|
|
- "StartChargeSeq":%s,
|
|
|
|
|
- "ConnectorID":%s,
|
|
|
|
|
|
|
+ "StartChargeSeq":"%s",
|
|
|
|
|
+ "ConnectorID":"%s",
|
|
|
"ConfirmResult":%d
|
|
"ConfirmResult":%d
|
|
|
}
|
|
}
|
|
|
""".formatted(startChargeSeq, chargeOrder.getConnectorId(), 0);
|
|
""".formatted(startChargeSeq, chargeOrder.getConnectorId(), 0);
|