mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
update 代码重构
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.jsowell.netty.factory;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.netty.strategy.ykc.AbstractYkcStrategy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -19,24 +21,26 @@ public class YKCOperateFactoryV2 {
|
||||
|
||||
private static Map<String, String> operationMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
//初始化实现类
|
||||
operationMap.put("0x01", "loginRequestStrategy");
|
||||
operationMap.put("0x05", "billingTemplateValidateRequestStrategy");
|
||||
// more operators
|
||||
}
|
||||
// static {
|
||||
// //初始化实现类
|
||||
// operationMap.put("0x01", "loginRequestStrategy");
|
||||
// operationMap.put("0x05", "billingTemplateValidateRequestStrategy");
|
||||
// // more operators
|
||||
// }
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param str
|
||||
* @param handler
|
||||
* @param strategyName
|
||||
*/
|
||||
// public void register(String str, AbstractYkcHandlerV2 handler) {
|
||||
// if (StringUtils.isBlank(str) || Objects.isNull(handler)) {
|
||||
// return;
|
||||
// }
|
||||
// strategyMap.put(str, handler);
|
||||
// }
|
||||
public static void register(String str, String strategyName) {
|
||||
if (StringUtils.isBlank(str) || StringUtils.isBlank(strategyName)) {
|
||||
return;
|
||||
}
|
||||
// 获取首字母(类名首字母大写), 并将首字母变为小写
|
||||
strategyName = strategyName.substring(0, 1).toLowerCase() + strategyName.substring(1);
|
||||
operationMap.put(str, strategyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取
|
||||
@@ -45,4 +49,8 @@ public class YKCOperateFactoryV2 {
|
||||
String s = operationMap.get(frameType);
|
||||
return strategyMap.get(s);
|
||||
}
|
||||
|
||||
public static String getOperationMap() {
|
||||
return JSON.toJSONString(operationMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ import com.jsowell.common.enums.ykc.PileChannelEntity;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.netty.handler.yunkuaichong.AbstractYkcHandler;
|
||||
import com.jsowell.netty.service.yunkuaichong.YKCBusinessService;
|
||||
import com.jsowell.netty.strategy.ykc.AbstractYkcStrategy;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
||||
import com.jsowell.pile.service.PileMsgRecordService;
|
||||
@@ -45,8 +44,8 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
||||
// 获取帧类型
|
||||
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
||||
// 获取业务处理handler
|
||||
AbstractYkcHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
||||
// AbstractYkcHandlerV2 invokeStrategy = ykcOperateFactoryV2.getInvokeStrategy(frameType);
|
||||
// AbstractYkcHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
||||
AbstractYkcStrategy invokeStrategy = ykcOperateFactoryV2.getInvokeStrategy(frameType);
|
||||
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电阶段 BMS 中止Handler
|
||||
*
|
||||
@@ -20,10 +23,10 @@ import org.springframework.stereotype.Component;
|
||||
public class BMSAbortDuringChargingStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.BMS_ABORT_DURING_CHARGING_PHASE_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电过程 BMS 需求与充电机输出 0x23
|
||||
*
|
||||
@@ -20,10 +23,10 @@ import org.springframework.stereotype.Component;
|
||||
public class BMSDemandAndChargerOutputStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.CHARGING_PROCESS_BMS_DEMAND_AND_CHARGER_OUTPUT_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电过程 BMS 信息 0x25
|
||||
*
|
||||
@@ -20,10 +23,10 @@ import org.springframework.stereotype.Component;
|
||||
public class BMSInformationStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.CHARGING_PROCESS_BMS_INFORMATION_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.service.PileBillingTemplateService;
|
||||
import com.jsowell.pile.service.YKCPushCommandService;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
@@ -12,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 计费模板请求 Handler
|
||||
*
|
||||
@@ -30,10 +33,10 @@ public class BillingTemplateStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private YKCPushCommandService ykcPushCommandService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.service.PileBillingTemplateService;
|
||||
import com.jsowell.pile.service.YKCPushCommandService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -14,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 计费模板验证请求Handler
|
||||
*
|
||||
@@ -32,10 +35,11 @@ public class BillingTemplateValidateStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private YKCPushCommandService ykcPushCommandService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@CostTime
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -12,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -30,10 +32,10 @@ public class ChargeEndStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电阶段充电机中止Handler 0x21
|
||||
*
|
||||
@@ -20,10 +23,10 @@ import org.springframework.stereotype.Component;
|
||||
public class ChargerAbortedDuringChargingPhaseStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.THE_CHARGER_IS_ABORTED_DURING_THE_CHARGING_PHASE_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电握手
|
||||
*
|
||||
@@ -20,10 +23,10 @@ import org.springframework.stereotype.Component;
|
||||
public class ChargingHandshakeStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.CHARGING_HANDSHAKE_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
import com.jsowell.pile.dto.ConfirmStartChargingData;
|
||||
@@ -25,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -52,10 +54,10 @@ public class ConfirmStartChargingStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private PileMsgRecordService pileMsgRecordService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 错误报文Handler
|
||||
*
|
||||
@@ -20,10 +23,10 @@ import org.springframework.stereotype.Component;
|
||||
public class ErrorMessageStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.ERROR_MESSAGE_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -22,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -44,10 +46,10 @@ public class GroundLockDataUploadStrategy implements AbstractYkcStrategy {
|
||||
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.GROUND_LOCK_DATA_UPLOAD_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -6,12 +6,15 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电桩心跳包
|
||||
*/
|
||||
@@ -24,10 +27,10 @@ public class HeartbeatRequestStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.ykcCommond.IssueQRCodeCommand;
|
||||
import com.jsowell.pile.domain.ykcCommond.ProofreadTimeCommand;
|
||||
@@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -53,68 +55,70 @@ public class LoginStrategy implements AbstractYkcStrategy {
|
||||
// 引入线程池
|
||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
|
||||
public static void main(String[] args) {
|
||||
String msg = "8800000000009000020f56312e323035303000898604940121c138531304";
|
||||
byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||||
|
||||
int startIndex = 0;
|
||||
int length = 7;
|
||||
|
||||
// 桩编码
|
||||
byte[] pileSnByte = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
// log.info("桩号:{}", pileSn);
|
||||
|
||||
// 桩类型 0 表示直流桩, 1 表示交流桩
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] pileTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileType = BytesUtil.bcd2Str(pileTypeByteArr);
|
||||
|
||||
// 充电枪数量
|
||||
startIndex += length;
|
||||
byte[] connectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorNum = BytesUtil.bcd2Str(connectorNumByteArr);
|
||||
|
||||
// 通信协议版本 版本号乘 10,v1.0 表示 0x0A
|
||||
startIndex += length;
|
||||
byte[] communicationVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// int i = Integer.parseInt(BytesUtil.bcd2Str(communicationVersionByteArr)); // 0F --> 15
|
||||
BigDecimal bigDecimal = new BigDecimal(BytesUtil.bcd2Str(communicationVersionByteArr));
|
||||
BigDecimal communicationVersionTemp = bigDecimal.divide(new BigDecimal(10));
|
||||
String communicationVersion = "v" + communicationVersionTemp;
|
||||
|
||||
// 程序版本
|
||||
startIndex += length;
|
||||
length = 8;
|
||||
byte[] programVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String programVersion = BytesUtil.ascii2Str(programVersionByteArr);
|
||||
log.info("程序版本:{} length:{}", programVersion, programVersion.length());
|
||||
|
||||
// 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] internetConnectionTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String internetConnection = BytesUtil.bcd2Str(internetConnectionTypeByteArr);
|
||||
|
||||
// sim卡
|
||||
startIndex += length;
|
||||
length = 10;
|
||||
byte[] simCardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String iccid = BytesUtil.bin2HexStr(simCardNumByteArr);
|
||||
|
||||
// 运营商 0x00 移动 0x02 电信 0x03 联通 0x04 其他
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] businessTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
log.info("类名:{}", this.getClass().getSimpleName());
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
log.info("注册成功, operationMap:{}", YKCOperateFactoryV2.getOperationMap());
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String msg = "8800000000009000020f56312e323035303000898604940121c138531304";
|
||||
// byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||||
//
|
||||
// int startIndex = 0;
|
||||
// int length = 7;
|
||||
//
|
||||
// // 桩编码
|
||||
// byte[] pileSnByte = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
// // log.info("桩号:{}", pileSn);
|
||||
//
|
||||
// // 桩类型 0 表示直流桩, 1 表示交流桩
|
||||
// startIndex += length;
|
||||
// length = 1;
|
||||
// byte[] pileTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String pileType = BytesUtil.bcd2Str(pileTypeByteArr);
|
||||
//
|
||||
// // 充电枪数量
|
||||
// startIndex += length;
|
||||
// byte[] connectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String connectorNum = BytesUtil.bcd2Str(connectorNumByteArr);
|
||||
//
|
||||
// // 通信协议版本 版本号乘 10,v1.0 表示 0x0A
|
||||
// startIndex += length;
|
||||
// byte[] communicationVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// // int i = Integer.parseInt(BytesUtil.bcd2Str(communicationVersionByteArr)); // 0F --> 15
|
||||
// BigDecimal bigDecimal = new BigDecimal(BytesUtil.bcd2Str(communicationVersionByteArr));
|
||||
// BigDecimal communicationVersionTemp = bigDecimal.divide(new BigDecimal(10));
|
||||
// String communicationVersion = "v" + communicationVersionTemp;
|
||||
//
|
||||
// // 程序版本
|
||||
// startIndex += length;
|
||||
// length = 8;
|
||||
// byte[] programVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String programVersion = BytesUtil.ascii2Str(programVersionByteArr);
|
||||
// log.info("程序版本:{} length:{}", programVersion, programVersion.length());
|
||||
//
|
||||
// // 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他
|
||||
// startIndex += length;
|
||||
// length = 1;
|
||||
// byte[] internetConnectionTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String internetConnection = BytesUtil.bcd2Str(internetConnectionTypeByteArr);
|
||||
//
|
||||
// // sim卡
|
||||
// startIndex += length;
|
||||
// length = 10;
|
||||
// byte[] simCardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String iccid = BytesUtil.bin2HexStr(simCardNumByteArr);
|
||||
//
|
||||
// // 运营商 0x00 移动 0x02 电信 0x03 联通 0x04 其他
|
||||
// startIndex += length;
|
||||
// length = 1;
|
||||
// byte[] businessTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
||||
// }
|
||||
|
||||
@CostTime
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 离线卡数据清除应答
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class OfflineCardDataCleaningStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.OFFLINE_CARD_DATA_CLEANING_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 离线卡数据查询应答
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class OfflineCardDataQueryStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.OFFLINE_CARD_DATA_QUERY_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 离线卡数据同步应答
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class OfflineCardDataSyncStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.OFFLINE_CARD_DATA_SYNCHRONIZATION_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -11,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -28,10 +30,10 @@ public class ParameterConfigStrategy implements AbstractYkcStrategy {
|
||||
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.PARAMETER_CONFIGURATION_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 充电桩工作参数设置应答
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class PileWorkingParameterSettingStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.CHARGING_PILE_WORKING_PARAMETER_SETTING_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 0x27 充电桩査询工作参数回复
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class QueryPileWorkParamsStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.QUERY_PILE_WORK_PARAMS_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,12 +4,14 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@@ -27,10 +29,10 @@ public class RemoteControlGroundLockStrategy implements AbstractYkcStrategy {
|
||||
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_CONTROL_GROUND_LOCK_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 桩应答远程下发二维码前缀指令
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class RemoteIssuedQrCodeStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_ISSUE_QRCODE_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -5,12 +5,15 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.service.PileMsgRecordService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 远程重启应答
|
||||
*
|
||||
@@ -25,10 +28,10 @@ public class RemoteRestartStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private PileMsgRecordService pileMsgRecordService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
@@ -39,10 +41,10 @@ public class RemoteStartChargingStrategy implements AbstractYkcStrategy {
|
||||
// 引入线程池
|
||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.common.enums.ykc.StopChargingFailedReasonEnum;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -30,10 +32,10 @@ public class RemoteStopChargingStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 远程更新应答
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class RemoteUpdateStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_UPDATE_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.jsowell.common.enums.ykc.ChargingFailedReasonEnum;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.dto.ReservationChargingStartupResult;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -16,6 +17,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 0x65预约充电启动结果上送
|
||||
*/
|
||||
@@ -28,10 +31,10 @@ public class ReservationChargingStartupResultStrategy implements AbstractYkcStra
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 获取消息体
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
import com.jsowell.pile.service.PileReservationInfoService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -14,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 预约充电响应
|
||||
*/
|
||||
@@ -29,10 +32,10 @@ public class ReservationChargingStrategy implements AbstractYkcStrategy {
|
||||
@Autowired
|
||||
private PileReservationInfoService pileReservationInfoService;
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 0x29 平台设置工作参数回复
|
||||
*
|
||||
@@ -19,10 +22,10 @@ import org.springframework.stereotype.Component;
|
||||
public class SettingPileWorkParamsStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.SETTING_PILE_WORK_PARAMS_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -23,10 +25,10 @@ import java.util.Date;
|
||||
public class TimeCheckSettingStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.TIME_CHECK_SETTING_ANSWER_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.service.*;
|
||||
@@ -29,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -51,11 +53,11 @@ public class TransactionRecordsStrategy implements AbstractYkcStrategy {
|
||||
// 引入线程池
|
||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// YKCOperateFactory.register(oldVersionType, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
YKCOperateFactoryV2.register(oldVersionType, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactoryV2;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
@@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -41,11 +43,11 @@ public class UploadRealTimeMonitorStrategy implements AbstractYkcStrategy {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes());
|
||||
private final String oldVersionType = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes());
|
||||
|
||||
// @Override
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// YKCOperateFactory.register(oldVersionType, this);
|
||||
// }
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
YKCOperateFactoryV2.register(type, this.getClass().getSimpleName());
|
||||
YKCOperateFactoryV2.register(oldVersionType, this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
// 引入线程池
|
||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||
|
||||
Reference in New Issue
Block a user