重构
This commit is contained in:
parent
5504a0b0de
commit
f1b70257a5
@ -7,6 +7,7 @@ public class ChargingStationDto {
|
|||||||
private Long stationId;
|
private Long stationId;
|
||||||
private Set<String> piles;
|
private Set<String> piles;
|
||||||
private Long rateModelId;
|
private Long rateModelId;
|
||||||
|
private String operatorId;
|
||||||
|
|
||||||
public Long getStationId() {
|
public Long getStationId() {
|
||||||
|
|
||||||
@ -38,4 +39,14 @@ public class ChargingStationDto {
|
|||||||
this.rateModelId = rateModelId;
|
this.rateModelId = rateModelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOperatorId() {
|
||||||
|
|
||||||
|
return operatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperatorId(String operatorId) {
|
||||||
|
|
||||||
|
this.operatorId = operatorId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.xhpc.common.data.up;
|
package com.xhpc.common.data.up;
|
||||||
|
|
||||||
//充电桩与 BMS 充电结束阶段报文
|
//充电桩与 BMS 充电结束阶段报文
|
||||||
public class ChargingCompletedData extends BaseData {
|
public class BmsChargingCompletedData extends BaseData {
|
||||||
|
|
||||||
private String orderNo; //交易流水号
|
private String orderNo; //交易流水号
|
||||||
private String pileNo; //桩号
|
private String pileNo; //桩号
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.xhpc.common.data.up;
|
package com.xhpc.common.data.up;
|
||||||
|
|
||||||
//充电桩与 BMS 参数配置阶段报文
|
//充电桩与 BMS 参数配置阶段报文
|
||||||
public class ChargingConfigData extends BaseData {
|
public class BmsChargingConfigData extends BaseData {
|
||||||
|
|
||||||
private String orderNo; //交易流水号
|
private String orderNo; //交易流水号
|
||||||
private String pileNo; //桩号
|
private String pileNo; //桩号
|
||||||
@ -10,31 +10,37 @@ import com.xhpc.common.core.web.domain.BaseEntity;
|
|||||||
public class XhpcMessage extends BaseEntity {
|
public class XhpcMessage extends BaseEntity {
|
||||||
|
|
||||||
private Long messageId;
|
private Long messageId;
|
||||||
private Long chargeOrderId;
|
private String chargeOrderNo;
|
||||||
private String content;
|
private String content;
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
public Long getMessageId() {
|
public Long getMessageId() {
|
||||||
|
|
||||||
return messageId;
|
return messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageId(Long messageId) {
|
public void setMessageId(Long messageId) {
|
||||||
|
|
||||||
this.messageId = messageId;
|
this.messageId = messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getChargeOrderId() {
|
public String getChargeOrderNo() {
|
||||||
return chargeOrderId;
|
|
||||||
|
return chargeOrderNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChargeOrderId(Long chargeOrderId) {
|
public void setChargeOrderNo(String chargeOrderNo) {
|
||||||
this.chargeOrderId = chargeOrderId;
|
|
||||||
|
this.chargeOrderNo = chargeOrderNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContent(String content) {
|
public void setContent(String content) {
|
||||||
|
|
||||||
this.content = content;
|
this.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,36 +1,35 @@
|
|||||||
package com.xhpc.pp.logic;
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
import com.xhpc.common.data.up.BmsChargerInterruptData;
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
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;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
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 java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component("BmsChargerInterruptDataLogic")
|
@Component("BmsChargerInterruptDataLogic")
|
||||||
public class BmsChargerInterruptDataLogic implements ServiceLogic {
|
public class BmsChargerInterruptDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
Map<String, Object> req = sp.getParameters();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
XhpcMessage msg = new XhpcMessage();
|
||||||
BmsChargerInterruptData bmsChargerInterruptData = objectMapper.convertValue(req, BmsChargerInterruptData.class);
|
msg.setContent((String) req.get("hex"));
|
||||||
String orderNo = bmsChargerInterruptData.getOrderNo();
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
String orderkey = "order:".concat(orderNo);
|
msg.setRemark("充电桩与 BMS 充电阶段充电机中止报文");
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
cacheOrder.put("bmsChargerInterrupt", bmsChargerInterruptData);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
|
import com.xhpc.pp.tx.ServiceParameter;
|
||||||
|
import com.xhpc.pp.tx.ServiceResult;
|
||||||
|
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Component("BmsChargingCompletedDataLogic")
|
||||||
|
public class BmsChargingCompletedDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(BmsChargingCompletedDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
|
Map<String, Object> req = sp.getParameters();
|
||||||
|
XhpcMessage msg = new XhpcMessage();
|
||||||
|
msg.setContent((String) req.get("hex"));
|
||||||
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
|
msg.setRemark("充电桩与 BMS 充电结束阶段报文");
|
||||||
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
|
return new ServiceResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
|
import com.xhpc.pp.tx.ServiceParameter;
|
||||||
|
import com.xhpc.pp.tx.ServiceResult;
|
||||||
|
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Component("BmsChargingConfigDataLogic")
|
||||||
|
public class BmsChargingConfigDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(BmsChargingConfigDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
|
Map<String, Object> req = sp.getParameters();
|
||||||
|
XhpcMessage msg = new XhpcMessage();
|
||||||
|
msg.setContent((String) req.get("hex"));
|
||||||
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
|
msg.setRemark("充电桩与 BMS 参数配置阶段报文");
|
||||||
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
|
return new ServiceResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,40 +1,35 @@
|
|||||||
package com.xhpc.pp.logic;
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
import com.xhpc.common.data.up.BmsChargingData;
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
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;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
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 java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component("BmsChargingDataLogic")
|
@Component("BmsChargingDataLogic")
|
||||||
public class BmsChargingDataLogic implements ServiceLogic {
|
public class BmsChargingDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(BmsChargingDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
Map<String, Object> req = sp.getParameters();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
XhpcMessage msg = new XhpcMessage();
|
||||||
BmsChargingData bmsChargingData = objectMapper.convertValue(req, BmsChargingData.class);
|
msg.setContent((String) req.get("hex"));
|
||||||
String orderNo = bmsChargingData.getOrderNo();
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
String orderkey = "order:".concat(orderNo);
|
msg.setRemark("充电桩与 BMS 充电过程 BMS 信息");
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
List<BmsChargingData> bmsChargingDataList = (List<BmsChargingData>) cacheOrder.getOrDefault("bmsChargingData", new ArrayList<>());
|
|
||||||
bmsChargingDataList.add(bmsChargingData);
|
|
||||||
cacheOrder.put("bmsChargingData", bmsChargingDataList);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
|
import com.xhpc.pp.tx.ServiceParameter;
|
||||||
|
import com.xhpc.pp.tx.ServiceResult;
|
||||||
|
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Component("BmsChargingHandshakeDataLogic")
|
||||||
|
public class BmsChargingHandshakeDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(BmsChargingHandshakeDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
|
Map<String, Object> req = sp.getParameters();
|
||||||
|
XhpcMessage msg = new XhpcMessage();
|
||||||
|
msg.setContent((String) req.get("hex"));
|
||||||
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
|
msg.setRemark("充电桩与 BMS 充电握手阶段报文");
|
||||||
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
|
return new ServiceResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,40 +1,35 @@
|
|||||||
package com.xhpc.pp.logic;
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
import com.xhpc.common.data.up.BmsErrorData;
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
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;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
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 java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component("BmsErrorDataLogic")
|
@Component("BmsErrorDataLogic")
|
||||||
public class BmsErrorDataLogic implements ServiceLogic {
|
public class BmsErrorDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
Map<String, Object> req = sp.getParameters();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
XhpcMessage msg = new XhpcMessage();
|
||||||
BmsErrorData bmsErrorData = objectMapper.convertValue(req, BmsErrorData.class);
|
msg.setContent((String) req.get("hex"));
|
||||||
String orderNo = bmsErrorData.getOrderNo();
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
String orderkey = "order:".concat(orderNo);
|
msg.setRemark("充电桩与 BMS 充电错误报文");
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
List<BmsErrorData> bmsErrorDataList = (List<BmsErrorData>) cacheOrder.getOrDefault("bmsErrors", new ArrayList<>());
|
|
||||||
bmsErrorDataList.add(bmsErrorData);
|
|
||||||
cacheOrder.put("bmsErrors", bmsErrorDataList);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,36 +1,35 @@
|
|||||||
package com.xhpc.pp.logic;
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
import com.xhpc.common.data.up.BmsInterruptData;
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
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;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
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 java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component("BmsInterruptDataLogic")
|
@Component("BmsInterruptDataLogic")
|
||||||
public class BmsInterruptDataLogic implements ServiceLogic {
|
public class BmsInterruptDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
Map<String, Object> req = sp.getParameters();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
XhpcMessage msg = new XhpcMessage();
|
||||||
BmsInterruptData bmsInterruptData = objectMapper.convertValue(req, BmsInterruptData.class);
|
msg.setContent((String) req.get("hex"));
|
||||||
String orderNo = bmsInterruptData.getOrderNo();
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
String orderkey = "order:".concat(orderNo);
|
msg.setRemark("充电桩与 BMS 充电阶段 BMS 中止报文");
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
cacheOrder.put("bmsInterrupt", bmsInterruptData);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,45 +1,35 @@
|
|||||||
package com.xhpc.pp.logic;
|
package com.xhpc.pp.logic;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.xhpc.pp.domain.XhpcMessage;
|
||||||
import com.xhpc.common.data.up.BmsReqChargerOutputData;
|
import com.xhpc.pp.mapper.XhpcMessageMapper;
|
||||||
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;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
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 java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component("BmsReqChargerOutputDataLogic")
|
@Component("BmsReqChargerOutputDataLogic")
|
||||||
public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(BmsReqChargerOutputDataLogic.class);
|
private static Logger log = LoggerFactory.getLogger(BmsReqChargerOutputDataLogic.class);
|
||||||
|
@Autowired
|
||||||
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
Map<String, Object> req = sp.getParameters();
|
||||||
log.debug("{}", req);
|
XhpcMessage msg = new XhpcMessage();
|
||||||
long start = Calendar.getInstance().getTimeInMillis();
|
msg.setContent((String) req.get("hex"));
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
BmsReqChargerOutputData bmsReqChargerOutputData = objectMapper.convertValue(req, BmsReqChargerOutputData.class);
|
msg.setRemark("充电桩与 BMS 充电过程 BMS 需求、充电机输出");
|
||||||
String orderNo = bmsReqChargerOutputData.getOrderNo();
|
xhpcMessageMapper.insertItemsBy(msg);
|
||||||
String orderkey = "order:".concat(orderNo);
|
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
|
||||||
List<BmsReqChargerOutputData> bmsReqChargerOutputDataList = (List<BmsReqChargerOutputData>) cacheOrder.getOrDefault(
|
|
||||||
"bmsErrors", new ArrayList<>());
|
|
||||||
bmsReqChargerOutputDataList.add(bmsReqChargerOutputData);
|
|
||||||
cacheOrder.put("bmsReqChargerOutputs", bmsReqChargerOutputDataList);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
log.debug("{} ms elapsed", Calendar.getInstance().getTimeInMillis() - start);
|
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
package com.xhpc.pp.logic;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.xhpc.common.data.up.ChargingCompletedData;
|
|
||||||
import com.xhpc.pp.tx.ServiceParameter;
|
|
||||||
import com.xhpc.pp.tx.ServiceResult;
|
|
||||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Component("BmsChargingCompletedDataLogic")
|
|
||||||
public class ChargingCompletedDataLogic implements ServiceLogic {
|
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(ChargingCompletedDataLogic.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
ChargingCompletedData chargingCompletedData = objectMapper.convertValue(req, ChargingCompletedData.class);
|
|
||||||
String orderNo = chargingCompletedData.getOrderNo();
|
|
||||||
String orderkey = "order:".concat(orderNo);
|
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
|
||||||
cacheOrder.put("completed", chargingCompletedData);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
package com.xhpc.pp.logic;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.xhpc.common.data.up.ChargingConfigData;
|
|
||||||
import com.xhpc.pp.tx.ServiceParameter;
|
|
||||||
import com.xhpc.pp.tx.ServiceResult;
|
|
||||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Component("BmsChargingConfigDataLogic")
|
|
||||||
public class ChargingConfigDataLogic implements ServiceLogic {
|
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(ChargingConfigDataLogic.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
ChargingConfigData chargingConfigData = objectMapper.convertValue(req, ChargingConfigData.class);
|
|
||||||
String orderNo = chargingConfigData.getOrderNo();
|
|
||||||
String orderkey = "order:".concat(orderNo);
|
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
|
||||||
cacheOrder.put("config", chargingConfigData);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
package com.xhpc.pp.logic;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.xhpc.common.data.up.ChargingHandshakeData;
|
|
||||||
import com.xhpc.pp.tx.ServiceParameter;
|
|
||||||
import com.xhpc.pp.tx.ServiceResult;
|
|
||||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Component("BmsChargingHandshakeDataLogic")
|
|
||||||
public class ChargingHandshakeDataLogic implements ServiceLogic {
|
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(ChargingHandshakeDataLogic.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
|
||||||
|
|
||||||
Map<String, Object> req = sp.getParameters();
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
ChargingHandshakeData chargingHandshakeData = objectMapper.convertValue(req, ChargingHandshakeData.class);
|
|
||||||
String orderNo = chargingHandshakeData.getOrderNo();
|
|
||||||
String orderkey = "order:".concat(orderNo);
|
|
||||||
Map<String, Object> cacheOrder = REDIS.getCacheMap(orderkey);
|
|
||||||
cacheOrder.put("handshake", chargingHandshakeData);
|
|
||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
|
||||||
return new ServiceResult(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user