异步领取 奖项
This commit is contained in:
@@ -12,7 +12,6 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* @author GYJ
|
* @author GYJ
|
||||||
*/
|
*/
|
||||||
@EnableAsync
|
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SqxApplication {
|
public class SqxApplication {
|
||||||
@@ -35,12 +34,12 @@ public class SqxApplication {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 短剧系统启动成功 ლ(´ڡ`ლ)゙ \n"+
|
System.out.println("(♥◠‿◠)ノ゙ 短剧系统启动成功 ლ(´ڡ`ლ)゙ \n"+
|
||||||
" _ \n" +
|
" _ \n" +
|
||||||
" | | \n" +
|
" | | \n" +
|
||||||
" ___ | | __\n" +
|
" ___ | | __\n" +
|
||||||
" / _ \\| |/ /\n" +
|
" / _ \\| |/ /\n" +
|
||||||
"| (_) | < \n" +
|
"| (_) | < \n" +
|
||||||
" \\___/|_|\\_\\");
|
" \\___/|_|\\_\\");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@@ -132,14 +133,14 @@ public class DiscSpinningController {
|
|||||||
public Result drawCount(@RequestAttribute("userId") Long userId) {
|
public Result drawCount(@RequestAttribute("userId") Long userId) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
|
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
|
||||||
map.put("sum",drawCount);
|
map.put("sum", drawCount);
|
||||||
int i = recordService.countDraw(userId);
|
int i = recordService.countDraw(userId);
|
||||||
if (drawCount - i > 0) {
|
if (drawCount - i > 0) {
|
||||||
map.put("count",ordersService.selectOrdersCountStatisticsByDay(userId, drawCount - i));
|
map.put("count", ordersService.selectOrdersCountStatisticsByDay(userId, drawCount - i));
|
||||||
return Result.success(map);
|
return Result.success(map);
|
||||||
} else {
|
} else {
|
||||||
map.put("count",0);
|
map.put("count", 0);
|
||||||
return Result.success(map);
|
return Result.success(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,11 +163,12 @@ public class DiscSpinningController {
|
|||||||
@PostMapping("/app/discSpinning/receive")
|
@PostMapping("/app/discSpinning/receive")
|
||||||
@ApiOperation("大转盘奖项领取")
|
@ApiOperation("大转盘奖项领取")
|
||||||
public Result receive(@RequestBody DiscSpinningRecord receive) {
|
public Result receive(@RequestBody DiscSpinningRecord receive) {
|
||||||
receiveAsync(receive);
|
CompletableFuture.runAsync(() -> {
|
||||||
|
receiveAsync(receive);
|
||||||
|
});
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void receiveAsync(DiscSpinningRecord receive) {
|
public void receiveAsync(DiscSpinningRecord receive) {
|
||||||
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
||||||
|
|||||||
Reference in New Issue
Block a user