任务已达标次数
获取大转盘次数
This commit is contained in:
@@ -63,7 +63,7 @@ public class DiscSpinningController {
|
||||
discSpinning.setNumber(discSpinning.getOdds());
|
||||
discSpinningService.save(discSpinning);
|
||||
|
||||
List<DiscSpinning> prizes = discSpinningService.list(new QueryWrapper<DiscSpinning>().eq("disc_type",discSpinning.getDiscType()).orderByAsc("type", "id"));
|
||||
List<DiscSpinning> prizes = discSpinningService.list(new QueryWrapper<DiscSpinning>().eq("disc_type", discSpinning.getDiscType()).orderByAsc("type", "id"));
|
||||
BigDecimal number = BigDecimal.ZERO;
|
||||
for (DiscSpinning prize : prizes) {
|
||||
number = number.add(prize.getOdds());
|
||||
@@ -91,7 +91,7 @@ public class DiscSpinningController {
|
||||
public Result updateDiscSpinning(@RequestBody DiscSpinning discSpinning) {
|
||||
discSpinningService.updateById(discSpinning);
|
||||
|
||||
List<DiscSpinning> prizes = discSpinningService.list(new QueryWrapper<DiscSpinning>().eq("disc_type",discSpinning.getDiscType()).orderByAsc("type", "id"));
|
||||
List<DiscSpinning> prizes = discSpinningService.list(new QueryWrapper<DiscSpinning>().eq("disc_type", discSpinning.getDiscType()).orderByAsc("type", "id"));
|
||||
BigDecimal number = BigDecimal.ZERO;
|
||||
for (DiscSpinning prize : prizes) {
|
||||
number = number.add(prize.getOdds());
|
||||
@@ -130,18 +130,18 @@ public class DiscSpinningController {
|
||||
@GetMapping("/app/discSpinning/drawCount")
|
||||
@ApiOperation("获取大转盘抽奖次数")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "source", value = "`1` 订单拉起抽奖 `2` 周任务拉起抽奖 `3` 月任务拉起抽奖", dataTypeClass = String.class, paramType = "body"),
|
||||
@ApiImplicitParam(name = "source", value = "`1` 订单拉起抽奖 `2` 周任务拉起抽奖 `3` 月任务拉起抽奖", dataTypeClass = Integer.class),
|
||||
})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 200, message = "{\"sum\":\"总抽奖次数\",\"count\":\"剩余抽奖次数\"}"),
|
||||
})
|
||||
public Result drawCount(@ApiIgnore @RequestAttribute("userId") Long userId, @Nullable @ApiIgnore @RequestBody Map maps) {
|
||||
public Result drawCount(@ApiIgnore @RequestAttribute("userId") Long userId, @RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
|
||||
map.put("sum", drawCount);
|
||||
if (maps != null && maps.containsKey("source") && !"1".equals(maps.get("source"))) {
|
||||
if (source != null && !source.equals(1)) {
|
||||
//任务可抽奖次数
|
||||
map.put("count", taskCenterService.countTaskDisc(userId,maps.get("source").toString()));
|
||||
map.put("count", taskCenterService.countTaskDisc(userId, source.toString()));
|
||||
} else {
|
||||
int i = recordService.countDraw(userId);
|
||||
if (drawCount - i > 0) {
|
||||
@@ -156,15 +156,14 @@ public class DiscSpinningController {
|
||||
@Login
|
||||
@GetMapping("/app/discSpinning/draw")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "source", value = "1 普通转盘 2 周任务转盘 3 月任务转盘", dataTypeClass = String.class, paramType = "body"),
|
||||
@ApiImplicitParam(name = "source", value = "1 普通转盘 2 周任务转盘 3 月任务转盘", dataTypeClass = Integer.class),
|
||||
})
|
||||
@ApiOperation("抽取大转盘")
|
||||
public Result draw(@ApiIgnore @RequestAttribute("userId") Long userId, @Nullable @ApiIgnore @RequestBody Map maps) {
|
||||
public Result draw(@ApiIgnore @RequestAttribute("userId") Long userId, @RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||
double amount = 0;
|
||||
int discType = 1;
|
||||
Long orderId = null;
|
||||
Integer i = recordService.countDraw(userId);
|
||||
if (maps == null || !maps.containsKey("source") || !"1".equals(maps.get("source"))) {
|
||||
if (source != null && source.equals(1)) {
|
||||
//任务抽奖
|
||||
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
|
||||
if (i != null && i >= drawCount) {
|
||||
@@ -176,13 +175,11 @@ public class DiscSpinningController {
|
||||
}
|
||||
amount = orders.getPayMoney().doubleValue();
|
||||
orderId = orders.getOrdersId();
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(maps) && maps.containsKey("source")) {
|
||||
discType = Integer.parseInt(maps.get("source").toString());
|
||||
|
||||
} else if (source == null) {
|
||||
source = 1;
|
||||
}
|
||||
return new Result().put("data",
|
||||
discSpinningService.draws(i == null ? 1 : i + 1, amount, orderId, userId, discType));
|
||||
discSpinningService.draws(i == null ? 1 : i + 1, amount, orderId, userId, source));
|
||||
}
|
||||
|
||||
@ApiOperation("大转盘奖项领取")
|
||||
|
||||
@@ -80,7 +80,7 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
||||
} else {
|
||||
if (todaySign) {
|
||||
if ((signCount < (s.getNumber().intValue() - 1))) {
|
||||
s.setDiscNumber(s.getNumber() - signCount);
|
||||
s.setDiscNumber(signCount);
|
||||
s.setNumber(null);
|
||||
s.setDisabled(false);
|
||||
} else if (recordService.countTaskNum(userId, s.getId(), DateUtil.beginOfMonth(new Date()).toString()) > 0) {
|
||||
@@ -90,7 +90,7 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
||||
}
|
||||
} else {
|
||||
if ((signCount < s.getNumber().intValue())) {
|
||||
s.setDiscNumber(s.getNumber() - signCount);
|
||||
s.setDiscNumber(signCount);
|
||||
s.setDisabled(false);
|
||||
s.setNumber(null);
|
||||
} else if (recordService.countTaskNum(userId, s.getId(), DateUtil.beginOfMonth(new Date()).toString()) > 0) {
|
||||
|
||||
Reference in New Issue
Block a user