release: 抽奖列表页,以及本人是否已参加(APP)

release-2024-08-08
huangyw 4 months ago
parent 7868441efe
commit 043f94071d

@ -37,6 +37,9 @@ public enum PointEnums {
MEMBERSHIP_LIFE(1, "永久会员"),
MEMBERSHIP_NOT_LIFE(2, "非永久会员"),
PARTICIPATED(1, "已参加"),
NOT_PARTICIPATED(2, "未参加"),
;
private final Integer code;
private final String description;

@ -229,8 +229,9 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.2.抽奖列表页(PC/APP)", notes = "admin/app")
@ApiOperation(value = "3.2.抽奖列表页(PC)", notes = "admin")
@PostMapping("/lottery/list/{page}/{size}")
@GlobalInterceptor(checkAdminLogin = true)
public Result<PageResult<Lottery>> lotteryList(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto,
@ -318,4 +319,16 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.9.抽奖列表页,以及本人是否已参加(APP)", notes = "APP")
@PostMapping("/lottery/list/{page}/{size}")
@GlobalInterceptor(checkAppUserLogin = true)
public Result<PageResult<Lottery>> findLotteryListForApp(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto,
@ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success(lotteryService.findLotteryListForApp(page, size, lotterySearchDto, token));
}
}

@ -150,4 +150,8 @@ public class Lottery {
@ApiModelProperty(value = "抽奖地区列表")
private List<LotteryRegion> lotteryRegionList;
@Transient
@ApiModelProperty(value = "本人是否参与抽奖 1-已参加 2-未参加")
private Integer isParticipate;
}

@ -386,6 +386,25 @@ public class LotteryService {
return new PageResult<>(totalElements, lotteryPage.getContent());
}
public PageResult<Lottery> findLotteryListForApp(Integer page, Integer size,
LotterySearchDto lotterySearchDto,
String token) {
PageResult<Lottery> lotteryPageResult = lotteryPageResult(page, size, lotterySearchDto);
lotteryPageResult.getRows().forEach(lottery -> {
if (StringUtils.isNotBlank(token)) {
UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);
List<LotteryUser> list = lotteryUserDao.findByLotteryIdAndUserId(lottery.getId(), userLoginDto.getUserId());
if (!list.isEmpty()) {
lottery.setIsParticipate(PointEnums.PARTICIPATED.getCode());
} else {
lottery.setIsParticipate(PointEnums.NOT_PARTICIPATED.getCode());
}
}
});
return lotteryPageResult;
}
private Specification<Lottery> getSpecification(LotterySearchDto lotterySearchDto) {
return (Root<Lottery> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) -> {
List<Predicate> predicateList = new ArrayList<>();

Loading…
Cancel
Save