mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
统计方法耗时
This commit is contained in:
@@ -14,6 +14,7 @@ import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
|
|||||||
import com.jsowell.adapay.service.AdapayService;
|
import com.jsowell.adapay.service.AdapayService;
|
||||||
import com.jsowell.adapay.vo.OrderSplitResult;
|
import com.jsowell.adapay.vo.OrderSplitResult;
|
||||||
import com.jsowell.adapay.vo.PaymentInfo;
|
import com.jsowell.adapay.vo.PaymentInfo;
|
||||||
|
import com.jsowell.common.annotation.CostTime;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
||||||
import com.jsowell.common.enums.ykc.*;
|
import com.jsowell.common.enums.ykc.*;
|
||||||
@@ -592,6 +593,7 @@ public class TempService {
|
|||||||
/**
|
/**
|
||||||
* 校验是否为并充订单
|
* 校验是否为并充订单
|
||||||
*/
|
*/
|
||||||
|
@CostTime
|
||||||
public Map<String, List<String>> checkCombinedChargingOrder(List<String> orderCodeList) throws BaseAdaPayException {
|
public Map<String, List<String>> checkCombinedChargingOrder(List<String> orderCodeList) throws BaseAdaPayException {
|
||||||
Map<String, List<String>> resultMap = Maps.newHashMap();
|
Map<String, List<String>> resultMap = Maps.newHashMap();
|
||||||
List<String> combinedChargingOrderList = Lists.newArrayList();
|
List<String> combinedChargingOrderList = Lists.newArrayList();
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.jsowell.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计函数执行耗时
|
||||||
|
*/
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface CostTime {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -68,6 +68,10 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.jsowell.framework.aspectj;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Aspect
|
||||||
|
@Component// 使用spring容器进行管理
|
||||||
|
@Slf4j
|
||||||
|
public class CostTimeAspect {
|
||||||
|
/**
|
||||||
|
* 首先定义一个切点
|
||||||
|
*/
|
||||||
|
// @org.aspectj.lang.annotation.Pointcut("@annotation(com.counttime.annotation.entity.CostTime)")
|
||||||
|
@org.aspectj.lang.annotation.Pointcut("@annotation(com.jsowell.common.annotation.CostTime)")
|
||||||
|
public void countTime() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Around("countTime()")
|
||||||
|
public Object doAround(ProceedingJoinPoint joinPoint) {
|
||||||
|
Object obj = null;
|
||||||
|
try {
|
||||||
|
long beginTime = System.currentTimeMillis();
|
||||||
|
obj = joinPoint.proceed();
|
||||||
|
// 获取方法名称
|
||||||
|
String methodName = joinPoint.getSignature().getName();
|
||||||
|
// 获取类名称
|
||||||
|
String className = joinPoint.getSignature().getDeclaringTypeName();
|
||||||
|
log.info("统计方法耗时, 类:[{}], 方法:[{}], 耗时时间为:[{}]", className, methodName, (System.currentTimeMillis() - beginTime) / 1000 + "秒");
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user