mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
统计方法耗时
This commit is contained in:
@@ -4,6 +4,7 @@ import com.jsowell.netty.handler.yunkuaichongV2.AbstractYkcHandlerV2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -16,6 +17,15 @@ public class YKCOperateFactoryV2 {
|
||||
@Autowired
|
||||
private Map<String, AbstractYkcHandlerV2> strategyMap;
|
||||
|
||||
private static Map<String, String> operationMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
//初始化实现类
|
||||
operationMap.put("0x01", "loginRequestHandlerV2");
|
||||
operationMap.put("0x05", "billingTemplateValidateRequestHandlerV2");
|
||||
// more operators
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param str
|
||||
@@ -30,10 +40,9 @@ public class YKCOperateFactoryV2 {
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public AbstractYkcHandlerV2 getInvokeStrategy(String name) {
|
||||
return strategyMap.get(name);
|
||||
public AbstractYkcHandlerV2 getInvokeStrategy(String frameType) {
|
||||
String s = operationMap.get(frameType);
|
||||
return strategyMap.get(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.netty.handler.yunkuaichongV2;
|
||||
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.annotation.CostTime;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
@@ -19,6 +20,7 @@ public interface AbstractYkcHandlerV2 {
|
||||
|
||||
String REQUEST_PREFIX = "Request_";
|
||||
|
||||
|
||||
byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.netty.handler.yunkuaichongV2;
|
||||
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.annotation.CostTime;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
@@ -35,7 +36,7 @@ public class BillingTemplateValidateRequestHandlerV2 implements AbstractYkcHandl
|
||||
// public void afterPropertiesSet() throws Exception {
|
||||
// YKCOperateFactory.register(type, this);
|
||||
// }
|
||||
|
||||
@CostTime
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
// log.info("[===执行计费模板验证请求逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||
|
||||
@@ -46,7 +46,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
||||
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
||||
// 获取业务处理handler
|
||||
AbstractYkcHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
||||
// AbstractYkcHandlerV2 invokeStrategy = ykcOperateFactoryV2.getInvokeStrategy("loginRequestHandlerV2");
|
||||
// AbstractYkcHandlerV2 invokeStrategy = ykcOperateFactoryV2.getInvokeStrategy(frameType);
|
||||
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user