更新充电桩设备信息记录

This commit is contained in:
panshuling321 2021-12-30 11:18:53 +08:00 committed by ZZ
parent bb9f745640
commit 76c3f19f9b
20 changed files with 341 additions and 12 deletions

View File

@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.BalanceUpdateReplyData; import com.xhpc.common.data.up.BalanceUpdateReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,6 +22,9 @@ public class BalanceUpdateReplyDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BalanceUpdateReplyDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BalanceUpdateReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -25,6 +32,16 @@ public class BalanceUpdateReplyDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
BalanceUpdateReplyData balanceUpdateReplyData = objectMapper.convertValue(req, BalanceUpdateReplyData.class); BalanceUpdateReplyData balanceUpdateReplyData = objectMapper.convertValue(req, BalanceUpdateReplyData.class);
log.debug("balanceUpdateResult({}) [{}]", balanceUpdateReplyData.getPileNo(), balanceUpdateReplyData.getModifyResult()); log.debug("balanceUpdateResult({}) [{}]", balanceUpdateReplyData.getPileNo(), balanceUpdateReplyData.getModifyResult());
String remark = "充电桩余额更新";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,7 +1,10 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -20,16 +24,26 @@ public class BmsChargerInterruptDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class);
@Autowired @Autowired
private XhpcMessageMapper xhpcMessageMapper; private XhpcMessageMapper xhpcMessageMapper;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电阶段充电机中止报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage(); XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo")); msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark("充电桩与 BMS 充电阶段充电机中止报文"); msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg); xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,7 +1,10 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -21,15 +25,28 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
@Autowired @Autowired
private XhpcMessageMapper xhpcMessageMapper; private XhpcMessageMapper xhpcMessageMapper;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电结束阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage(); XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo")); msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark("充电桩与 BMS 充电结束阶段报文"); msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg); xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,7 +1,10 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -21,15 +25,28 @@ public class BmsChargingConfigDataLogic implements ServiceLogic {
@Autowired @Autowired
private XhpcMessageMapper xhpcMessageMapper; private XhpcMessageMapper xhpcMessageMapper;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 参数配置阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage(); XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo")); msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark("充电桩与 BMS 参数配置阶段报文"); msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg); xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,7 +1,10 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -21,15 +25,28 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic {
@Autowired @Autowired
private XhpcMessageMapper xhpcMessageMapper; private XhpcMessageMapper xhpcMessageMapper;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电握手阶段报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage(); XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo")); msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark("充电桩与 BMS 充电握手阶段报文"); msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg); xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,7 +1,10 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -20,16 +24,26 @@ public class BmsErrorDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class);
@Autowired @Autowired
private XhpcMessageMapper xhpcMessageMapper; private XhpcMessageMapper xhpcMessageMapper;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电错误报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage(); XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo")); msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark("充电桩与 BMS 充电错误报文"); msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg); xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,7 +1,10 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.mapper.XhpcMessageMapper; import com.xhpc.mapper.XhpcMessageMapper;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.domain.XhpcMessage; import com.xhpc.pp.domain.XhpcMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -20,16 +24,27 @@ public class BmsInterruptDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class); private static final Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class);
@Autowired @Autowired
private XhpcMessageMapper xhpcMessageMapper; private XhpcMessageMapper xhpcMessageMapper;
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
String remark = "充电桩与 BMS 充电阶段 BMS 中止报文";
Map<String, Object> req = sp.getParameters(); Map<String, Object> req = sp.getParameters();
XhpcMessage msg = new XhpcMessage(); XhpcMessage msg = new XhpcMessage();
msg.setContent((String) req.get("hex")); msg.setContent((String) req.get("hex"));
msg.setChargeOrderNo((String) req.get("orderNo")); msg.setChargeOrderNo((String) req.get("orderNo"));
msg.setRemark("充电桩与 BMS 充电阶段 BMS 中止报文"); msg.setRemark(remark);
xhpcMessageMapper.insertItemsBy(msg); xhpcMessageMapper.insertItemsBy(msg);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,5 +1,8 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -8,16 +11,30 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Lazy @Lazy
@Component("OfflineCardEraseReplyDataLogic") @Component("OfflineCardEraseReplyDataLogic")
public class OfflineCardEraseReplyDataLogic implements ServiceLogic { public class OfflineCardEraseReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(OfflineCardEraseReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(OfflineCardEraseReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
//todo //todo
String remark = "充电桩下发离线卡数据清除";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) sp.getParameters().get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,5 +1,8 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -8,16 +11,29 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Lazy @Lazy
@Component("OfflineCardInquiryReplyDataLogic") @Component("OfflineCardInquiryReplyDataLogic")
public class OfflineCardInquiryReplyDataLogic implements ServiceLogic { public class OfflineCardInquiryReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(OfflineCardInquiryReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(OfflineCardInquiryReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
//todo //todo
String remark = "充电桩下发离线卡数据查询";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) sp.getParameters().get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.OfflineCardSyncReplyData; import com.xhpc.common.data.up.OfflineCardSyncReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,6 +22,9 @@ public class OfflineCardSyncReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(OfflineCardSyncReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(OfflineCardSyncReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -25,6 +32,14 @@ public class OfflineCardSyncReplyDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
OfflineCardSyncReplyData offlineCardSyncReplyData = objectMapper.convertValue(req, OfflineCardSyncReplyData.class); OfflineCardSyncReplyData offlineCardSyncReplyData = objectMapper.convertValue(req, OfflineCardSyncReplyData.class);
//todo //todo
String remark = "充电桩下发离线卡数据同步";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.data.up.PileConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,6 +22,9 @@ public class PileConfigReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(PileConfigReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(PileConfigReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -25,6 +32,14 @@ public class PileConfigReplyDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
PileConfigReplyData pileConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class); PileConfigReplyData pileConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
//todo //todo
String remark = "充电桩工作参数设置";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileStartChargingData; import com.xhpc.common.data.up.PileStartChargingData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,6 +22,9 @@ public class PileStartChargingDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class); private static Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -25,6 +32,14 @@ public class PileStartChargingDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
PileStartChargingData pileStartChargingData = objectMapper.convertValue(req, PileStartChargingData.class); PileStartChargingData pileStartChargingData = objectMapper.convertValue(req, PileStartChargingData.class);
//todo //todo
String remark = "充电桩主动申请起动充电";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -3,6 +3,9 @@ package com.xhpc.pp.logic;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileTimeConfigReplyData; import com.xhpc.common.data.up.PileTimeConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT; import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
@ -23,6 +27,9 @@ public class PileTimeConfigReplyDataLogic implements ServiceLogic {
private static final Logger log = LoggerFactory.getLogger(PileTimeConfigReplyDataLogic.class); private static final Logger log = LoggerFactory.getLogger(PileTimeConfigReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -36,6 +43,15 @@ public class PileTimeConfigReplyDataLogic implements ServiceLogic {
cachePile.put("configTime", configTime); cachePile.put("configTime", configTime);
REDIS.setCacheMap(pk, cachePile); REDIS.setCacheMap(pk, cachePile);
log.debug("({}) set time success√: [{}]", pileNo, configTime); log.debug("({}) set time success√: [{}]", pileNo, configTime);
String remark = "充电桩同步时钟";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -3,6 +3,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.data.up.PileConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@ -22,6 +26,9 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(RateModelConfigReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(RateModelConfigReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -29,6 +36,8 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
PileConfigReplyData pileRateModelConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class); PileConfigReplyData pileRateModelConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
String configResult = pileRateModelConfigReplyData.getConfigResult(); String configResult = pileRateModelConfigReplyData.getConfigResult();
String result = FAIL;
if (HEX_01.equals(configResult)) { if (HEX_01.equals(configResult)) {
// 确定设置成功的rateModelId 可能涉及协议修改 // 确定设置成功的rateModelId 可能涉及协议修改
final String pkey = "pile:".concat(pileRateModelConfigReplyData.getPileNo()); final String pkey = "pile:".concat(pileRateModelConfigReplyData.getPileNo());
@ -36,9 +45,20 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString())); ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
cachePile.put("rateModelId", cacheStation.getRateModelId()); cachePile.put("rateModelId", cacheStation.getRateModelId());
REDIS.setCacheMap(pkey, cachePile); REDIS.setCacheMap(pkey, cachePile);
return new ServiceResult(OK); result = OK;
} }
return new ServiceResult(FAIL);
String remark = "充电桩收到计费模型应答";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setReplyContent(result);
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(result);
} }
} }

View File

@ -4,6 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.common.data.redis.CacheRateModel;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -14,6 +17,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@ -26,6 +30,9 @@ public class RateModelRequestLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(RateModelRequestLogic.class); private static Logger log = LoggerFactory.getLogger(RateModelRequestLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -42,6 +49,16 @@ public class RateModelRequestLogic implements ServiceLogic {
return new ServiceResult((byte[]) null, ServiceResult.FAIL, json); return new ServiceResult((byte[]) null, ServiceResult.FAIL, json);
} }
String resultStr = translate(pileNo, stationRateModelId, "000A"); String resultStr = translate(pileNo, stationRateModelId, "000A");
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(pileNo);
deviceMessage.setRemark("充电桩计费模型请求");
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setReplyContent(resultStr);
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK); return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);
} }

View File

@ -1,6 +1,9 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.api.dto.ChargingStationDto; import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import static cn.hutool.core.util.NumberUtil.isInteger; import static cn.hutool.core.util.NumberUtil.isInteger;
@ -23,6 +27,9 @@ public class RateModelValidateLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(RateModelValidateLogic.class); private static Logger log = LoggerFactory.getLogger(RateModelValidateLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -58,6 +65,16 @@ public class RateModelValidateLogic implements ServiceLogic {
String resultStr = String resultStr =
"680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode); "680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr)); resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(pileNo);
deviceMessage.setRemark("计费模型验证请求");
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setReplyContent(resultStr);
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(HexUtils.toBytes(resultStr), resultCode); return new ServiceResult(HexUtils.toBytes(resultStr), resultCode);
} }

View File

@ -1,6 +1,9 @@
package com.xhpc.pp.logic; package com.xhpc.pp.logic;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.evcs.dto.ConnectorStatusInfo; import com.xhpc.evcs.dto.ConnectorStatusInfo;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -27,6 +31,9 @@ public class RegisterLogic implements ServiceLogic {
public static final String REGISTERED = "已注册"; public static final String REGISTERED = "已注册";
private static final Logger log = LoggerFactory.getLogger(RegisterLogic.class); private static final Logger log = LoggerFactory.getLogger(RegisterLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -76,6 +83,17 @@ public class RegisterLogic implements ServiceLogic {
String seq = seqHex(skey); String seq = seqHex(skey);
String resultStr = "680C".concat(seq).concat("0002").concat(pileNo).concat(hexCode); String resultStr = "680C".concat(seq).concat("0002").concat(pileNo).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr)); resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
// 写入设备日志表数据
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(pileNo);
deviceMessage.setRemark("充电桩登录认证");
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessage.setReplyContent(resultStr);
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(HexUtils.toBytes(resultStr), resultCode); return new ServiceResult(HexUtils.toBytes(resultStr), resultCode);
} }

View File

@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.data.up.PileConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,6 +22,9 @@ public class RemoteRestartReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(RemoteRestartReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(RemoteRestartReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -25,6 +32,15 @@ public class RemoteRestartReplyDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
PileConfigReplyData pileConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class); PileConfigReplyData pileConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
//todo //todo
String remark = "充电桩收到远程重启应答";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.xhpc.common.data.up.PileConfigReplyData; import com.xhpc.common.data.up.PileConfigReplyData;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult; import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic; import com.xhpc.pp.tx.logic.ServiceLogic;
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
@Lazy @Lazy
@ -18,6 +22,9 @@ public class RemoteUpgradeReplyDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(RemoteUpgradeReplyDataLogic.class); private static Logger log = LoggerFactory.getLogger(RemoteUpgradeReplyDataLogic.class);
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Override @Override
public ServiceResult service(ServiceParameter sp) throws Exception { public ServiceResult service(ServiceParameter sp) throws Exception {
@ -25,6 +32,16 @@ public class RemoteUpgradeReplyDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
PileConfigReplyData pileRateModelConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class); PileConfigReplyData pileRateModelConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
//todo //todo
String remark = "充电桩收到远程更新应答";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
deviceMessage.setSerialNumber(sp.getPileNo());
deviceMessage.setRemark(remark);
deviceMessage.setStatus(0);
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
return new ServiceResult(false); return new ServiceResult(false);
} }

View File

@ -1,8 +1,14 @@
package com.xhpc.pp.server; package com.xhpc.pp.server;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -15,6 +21,9 @@ import static com.xhpc.pp.logic.RegisterLogic.DISCONNECTED;
@Component @Component
public class HBCheckTask { public class HBCheckTask {
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@Scheduled(fixedRate = 10000) @Scheduled(fixedRate = 10000)
protected void run() { protected void run() {
@ -29,6 +38,16 @@ public class HBCheckTask {
cacheGun.put("statusInt", OFF_LINE); cacheGun.put("statusInt", OFF_LINE);
cacheGun.put("status", DISCONNECTED); cacheGun.put("status", DISCONNECTED);
REDIS.setCacheMap(gunkey, cacheGun); REDIS.setCacheMap(gunkey, cacheGun);
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
String pileId= StrUtil.sub(gunkey.substring(gunkey.lastIndexOf(":") + 1), 0, -2);
deviceMessage.setSerialNumber(pileId);
deviceMessage.setContent(JSON.toJSONString(cacheGun));
deviceMessage.setStatus(0);
deviceMessage.setRemark("充电桩心跳掉线");
deviceMessageMapper.insertByDomain(deviceMessage);
} }
} }
} }