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