mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-16 15:58:41 +08:00
统计方法耗时
This commit is contained in:
@@ -4,9 +4,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Aspect
|
@Aspect
|
||||||
|
@Order(1)
|
||||||
@Component// 使用spring容器进行管理
|
@Component// 使用spring容器进行管理
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CostTimeAspect {
|
public class CostTimeAspect {
|
||||||
@@ -29,7 +31,7 @@ public class CostTimeAspect {
|
|||||||
String methodName = joinPoint.getSignature().getName();
|
String methodName = joinPoint.getSignature().getName();
|
||||||
// 获取类名称
|
// 获取类名称
|
||||||
String className = joinPoint.getSignature().getDeclaringTypeName();
|
String className = joinPoint.getSignature().getDeclaringTypeName();
|
||||||
log.info("统计方法耗时, 类:[{}], 方法:[{}], 耗时时间为:[{}]", className, methodName, (System.currentTimeMillis() - beginTime) / 1000 + "秒");
|
log.info("统计方法耗时, 类:[{}], 方法:[{}], 耗时时间为:[{}ms]", className, methodName, (System.currentTimeMillis() - beginTime));
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.netty.handler.yunkuaichong;
|
package com.jsowell.netty.handler.yunkuaichong;
|
||||||
|
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
|
import com.jsowell.common.annotation.CostTime;
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||||
@@ -32,6 +33,7 @@ public abstract class AbstractYkcHandler implements InitializingBean {
|
|||||||
// throw new UnsupportedOperationException();
|
// throw new UnsupportedOperationException();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
@@ -91,6 +93,7 @@ public abstract class AbstractYkcHandler implements InitializingBean {
|
|||||||
* 阻止重复帧
|
* 阻止重复帧
|
||||||
* @return true 重复
|
* @return true 重复
|
||||||
*/
|
*/
|
||||||
|
@CostTime
|
||||||
protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// 获取序列号域
|
// 获取序列号域
|
||||||
int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber());
|
int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber());
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ public class LoginRequestHandler extends AbstractYkcHandler {
|
|||||||
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
if (verifyTheDuplicateRequest(ykcDataProtocol, ctx)) {
|
if (verifyTheDuplicateRequest(ykcDataProtocol, ctx)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user