接口执行时间
领取过慢
This commit is contained in:
@@ -31,7 +31,7 @@ public class AppApiMethodAspect {
|
|||||||
@Around("pkg()")
|
@Around("pkg()")
|
||||||
// @SuppressWarnings("unchecked")
|
// @SuppressWarnings("unchecked")
|
||||||
public Object around(ProceedingJoinPoint pjp) throws Throwable {
|
public Object around(ProceedingJoinPoint pjp) throws Throwable {
|
||||||
String start = DateUtils.format(new Date());
|
long start = System.currentTimeMillis();
|
||||||
// 执行被拦截的方法
|
// 执行被拦截的方法
|
||||||
Object result = pjp.proceed();
|
Object result = pjp.proceed();
|
||||||
//请求的参数
|
//请求的参数
|
||||||
@@ -40,9 +40,10 @@ public class AppApiMethodAspect {
|
|||||||
String resultJson = new Gson().toJson(result);
|
String resultJson = new Gson().toJson(result);
|
||||||
//获取request
|
//获取request
|
||||||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
||||||
String end = DateUtils.format(new Date());
|
long end = System.currentTimeMillis();
|
||||||
log.info("\n>>>>>> 开始时间:{} 结束时间:{} \n>>>>>> {} {}\n>>>>>> {}\n>>>>>> Request: {}\n>>>>>> Response: {}",
|
|
||||||
start,end,request.getMethod(), request.getRequestURL(), IPUtils.getIpAddr(request),
|
log.info("\n>>>>>> {} {}\n>>>>>> IP: {} \n>>>>>> execute time:{}\n>>>>>> Request: {}\n>>>>>> Response: {}",
|
||||||
|
request.getMethod(), request.getRequestURL(), IPUtils.getIpAddr(request),end-start,
|
||||||
params,
|
params,
|
||||||
resultJson
|
resultJson
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import io.swagger.annotations.*;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -160,8 +161,14 @@ public class DiscSpinningController {
|
|||||||
|
|
||||||
@PostMapping("/app/discSpinning/receive")
|
@PostMapping("/app/discSpinning/receive")
|
||||||
@ApiOperation("大转盘奖项领取")
|
@ApiOperation("大转盘奖项领取")
|
||||||
@Transactional
|
|
||||||
public Result receive(@RequestBody DiscSpinningRecord receive) {
|
public Result receive(@RequestBody DiscSpinningRecord receive) {
|
||||||
|
receiveAsync(receive);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
@Transactional
|
||||||
|
public void receiveAsync(DiscSpinningRecord receive) {
|
||||||
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
||||||
if (StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
if (StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
||||||
receive.setTarget("1");
|
receive.setTarget("1");
|
||||||
@@ -170,11 +177,13 @@ public class DiscSpinningController {
|
|||||||
recordService.updateById(receive);
|
recordService.updateById(receive);
|
||||||
|
|
||||||
if (StringUtils.isBlank(result)) {
|
if (StringUtils.isBlank(result)) {
|
||||||
return Result.success();
|
// return Result.success();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("提现成功,将在三个工作日内到账,请耐心等待!".equals(result)) {
|
if ("提现成功,将在三个工作日内到账,请耐心等待!".equals(result)) {
|
||||||
return Result.success(result);
|
// return Result.success(result);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,9 +204,10 @@ public class DiscSpinningController {
|
|||||||
receive.setTargetId(userMoneyDetails.getId());
|
receive.setTargetId(userMoneyDetails.getId());
|
||||||
|
|
||||||
recordService.updateById(receive);
|
recordService.updateById(receive);
|
||||||
return Result.success();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public String withdraw(DiscSpinningRecord record, Long userId, Double money) {
|
public String withdraw(DiscSpinningRecord record, Long userId, Double money) {
|
||||||
UserEntity userInfo = userService.queryByUserId(userId);
|
UserEntity userInfo = userService.queryByUserId(userId);
|
||||||
//最高提现金额
|
//最高提现金额
|
||||||
|
|||||||
Reference in New Issue
Block a user