记得上下班打卡 | git大法好,push需谨慎

Commit aaed2a7b authored by wangyifan's avatar wangyifan

福袋补充需求-获取验码福袋列表功能

parent 398e38ee
...@@ -15,17 +15,11 @@ import java.time.LocalDateTime; ...@@ -15,17 +15,11 @@ import java.time.LocalDateTime;
@ApiModel(value = "福袋兑换码详情VO") @ApiModel(value = "福袋兑换码详情VO")
public class KylinLuckyBagCodeDetailVo { public class KylinLuckyBagCodeDetailVo {
@ApiModelProperty(value = "兑换码")
private String code;
@ApiModelProperty(value = "用户ID")
private String uid;
@ApiModelProperty(value = "福袋ID") @ApiModelProperty(value = "福袋ID")
private String luckyBagId; private String luckyBagId;
@ApiModelProperty(value = "关联订单ID") @ApiModelProperty(value = "兑换码")
private String orderId; private String code;
@ApiModelProperty(value = "状态 0:不可用 1:可用 2:已领取") @ApiModelProperty(value = "状态 0:不可用 1:可用 2:已领取")
private int state; private int state;
...@@ -41,4 +35,43 @@ public class KylinLuckyBagCodeDetailVo { ...@@ -41,4 +35,43 @@ public class KylinLuckyBagCodeDetailVo {
@JsonSerialize(using = LocalDateTimeSerializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
@ApiModelProperty(value = "领取人信息")
private UserInfo userInfo;
@ApiModelProperty(value = "关联订单订单")
private OrderInfo orderInfo;
@ApiModel(value = "用户信息")
public static class UserInfo {
@ApiModelProperty(value = "用户ID")
private String uid;
@ApiModelProperty(value = "用户昵称")
private String userName;
@ApiModelProperty(value = "用户手机号")
private String userMobile;
}
@ApiModel(value = "订单信息")
public static class OrderInfo {
@ApiModelProperty(value = "订单ID")
private String orderId;
@ApiModelProperty(position = 15, value = "订单号")
private String orderCode;
@ApiModelProperty(value = "演出名称")
private String performanceTitle;
@ApiModelProperty(value = "票种名称")
private String ticketTitle;
@ApiModelProperty(value = "数量")
private Integer number;
@ApiModelProperty(value = "订单生成时间")
private String createdAt;
@ApiModelProperty(value = "适用时间")
private String useStart;
}
} }
...@@ -4,32 +4,23 @@ import io.swagger.annotations.ApiModel; ...@@ -4,32 +4,23 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
@ApiModel(value = "福袋Scope VO") @ApiModel(value = "福袋Scope VO")
public class KylinLuckyBagScopeVo { public class KylinLuckyBagScopeVo {
@ApiModelProperty(value = "认证Token") @ApiModelProperty(value = "福袋ID")
private String authToken; private String luckyBagId;
@ApiModelProperty(value = "福袋信息列表")
private List<KylinLuckyBagInfo> kylinLuckyBagInfoList;
@Data @ApiModelProperty(value = "福袋名称")
@ApiModel(value = "福袋信息") private String name;
public static class KylinLuckyBagInfo{
@ApiModelProperty(value = "福袋ID")
private String luckyBagId;
@ApiModelProperty(value = "福袋名称") @ApiModelProperty(value = "福袋描述")
private String name; private String introduction;
@ApiModelProperty(value = "福袋描述") @ApiModelProperty(value = "关联演出ID")
private String introduction; private String performanceId;
@ApiModelProperty(value = "关联演出名称") @ApiModelProperty(value = "关联演出名称")
private String performanceName; private String performanceName;
}
} }
...@@ -53,15 +53,26 @@ public class KylinLuckyBagVo implements Serializable { ...@@ -53,15 +53,26 @@ public class KylinLuckyBagVo implements Serializable {
private String introduction; private String introduction;
@ApiModelProperty(value = "兑换码显示状态 1:兑换码 2:二维码") @ApiModelProperty(value = "兑换码显示状态 1:兑换码 2:二维码")
private int codeShowType; private Integer codeShowType;
@ApiModelProperty(value = "状态 0:未解锁 1:已解锁") @ApiModelProperty(value = "状态 0:未解锁 1:已解锁")
private int status; private Integer status;
@ApiModelProperty(value = "兑换码") @ApiModelProperty(value = "兑换码")
private Set<String> rewardCodeList; private List<RewardCodeVo> rewardCodeVoList;
} }
@Data
@ApiModel(value = "兑换码VO")
public static class RewardCodeVo {
@ApiModelProperty(value = "状态 0:不可用 1:可用 2:已领取")
private Integer state;
@ApiModelProperty(value = "兑换码")
private String code;
}
public static KylinLuckyBagVo of(List<LuckyBagVo> luckyBagVoList, public static KylinLuckyBagVo of(List<LuckyBagVo> luckyBagVoList,
LuckyBagActivityVo luckyBagActivityVo){ LuckyBagActivityVo luckyBagActivityVo){
KylinLuckyBagVo kylinLuckyBagVo = new KylinLuckyBagVo(); KylinLuckyBagVo kylinLuckyBagVo = new KylinLuckyBagVo();
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
public interface IKylinLuckyBagService { public interface IKylinLuckyBagService {
KylinLuckyBagVo getLuckyBagByOrderId(String orderId); KylinLuckyBagVo getLuckyBagByOrderId(String orderId);
List<KylinLuckyBagScopeVo> getLuckyBagListScope(String mobile, String performanceId); List<KylinLuckyBagScopeVo> getLuckyBagListScope(String mobile);
KylinLuckyBagCodeDetailVo getCodeDetail(String code, String luckyBagId); KylinLuckyBagCodeDetailVo getCodeDetail(String code, String luckyBagId);
......
...@@ -47,6 +47,10 @@ public class KylinLuckyBag implements Serializable, Cloneable{ ...@@ -47,6 +47,10 @@ public class KylinLuckyBag implements Serializable, Cloneable{
*/ */
private String performanceId; private String performanceId;
/**
* 所属演出名称
*/
private String performanceName;
/** /**
* 所属场次ID * 所属场次ID
......
package com.liquidnet.service.kylin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = false)
public class KylinLuckyBagScope implements Serializable, Cloneable{
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 手机号
*/
private String mobile;
/**
* 福袋ID
*/
private String luckyBagId;
/**
* 昵称
*/
private String nickName;
/**
* 真实姓名
*/
private String realName;
/**
* 身份证号码
*/
private String idCard;
/**
* 状态: 1-可用, 0-不可用
*/
private Integer state;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 修改时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.kylin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.kylin.entity.KylinLuckyBagScope;
public interface KylinLuckyBagScopeMapper extends BaseMapper<KylinLuckyBagScope> {
}
...@@ -32,24 +32,24 @@ public class KylinLuckyBagController { ...@@ -32,24 +32,24 @@ public class KylinLuckyBagController {
return ResponseDto.success(luckyBagService.getLuckyBagByOrderId(orderId)); return ResponseDto.success(luckyBagService.getLuckyBagByOrderId(orderId));
} }
@GetMapping("/scope") @GetMapping("/scope")
@ApiOperation("获取验码福袋列表") @ApiOperation("获取验码福袋列表")
public ResponseDto<List<KylinLuckyBagScopeVo>> getLuckyBagListScope(@RequestParam(value = "mobile") String mobile, public ResponseDto<List<KylinLuckyBagScopeVo>> getLuckyBagListScope(@RequestParam(value = "mobile") String mobile){
@RequestParam(value = "performanceId", required = false) String performanceId){ return ResponseDto.success(luckyBagService.getLuckyBagListScope(mobile));
return ResponseDto.success(luckyBagService.getLuckyBagListScope(mobile, performanceId));
} }
@ApiOperation("兑换码详情") @ApiOperation("兑换码详情")
@GetMapping("/code/detail") @GetMapping("/code/detail")
public ResponseDto<KylinLuckyBagCodeDetailVo> getCodeDetail(@RequestParam(value = "code") String code, public ResponseDto<KylinLuckyBagCodeDetailVo> getCodeDetail(@RequestParam(value = "authMobile") String authMobile,
@RequestParam(value = "code") String code,
@RequestParam(value = "luckyBagId") String luckyBagId){ @RequestParam(value = "luckyBagId") String luckyBagId){
return ResponseDto.success(luckyBagService.getCodeDetail(code, luckyBagId)); return ResponseDto.success(luckyBagService.getCodeDetail(code, luckyBagId));
} }
@GetMapping("/code/consume") @GetMapping("/code/consume")
@ApiOperation("兑换码核销") @ApiOperation("兑换码核销")
public ResponseDto<Boolean> consumeCode(@RequestParam(value = "code") String code, public ResponseDto<Boolean> consumeCode(@RequestParam(value = "authMobile") String authMobile,
@RequestParam(value = "code") String code,
@RequestParam(value = "luckyBagId") String luckyBagId){ @RequestParam(value = "luckyBagId") String luckyBagId){
return luckyBagService.consumeCode(code, luckyBagId); return luckyBagService.consumeCode(code, luckyBagId);
} }
......
...@@ -6,6 +6,7 @@ import com.liquidnet.common.cache.redis.util.RedisUtil; ...@@ -6,6 +6,7 @@ import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.common.exception.LiquidnetServiceException; import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.util.CurrentUtil; import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.constant.KylinRedisConst; import com.liquidnet.service.kylin.constant.KylinRedisConst;
...@@ -14,10 +15,8 @@ import com.liquidnet.service.kylin.dto.vo.KylinLuckyBagScopeVo; ...@@ -14,10 +15,8 @@ import com.liquidnet.service.kylin.dto.vo.KylinLuckyBagScopeVo;
import com.liquidnet.service.kylin.dto.vo.KylinLuckyBagVo; import com.liquidnet.service.kylin.dto.vo.KylinLuckyBagVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.returns.OrderDetailsVo; import com.liquidnet.service.kylin.dto.vo.returns.OrderDetailsVo;
import com.liquidnet.service.kylin.entity.KylinLuckyBag; import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.entity.KylinLuckyBagActivity; import com.liquidnet.service.kylin.mapper.KylinLuckyBagScopeMapper;
import com.liquidnet.service.kylin.entity.KylinRewardCode;
import com.liquidnet.service.kylin.entity.KylinRewardUser;
import com.liquidnet.service.kylin.mapper.KylinRewardCodeMapper; import com.liquidnet.service.kylin.mapper.KylinRewardCodeMapper;
import com.liquidnet.service.kylin.mapper.KylinRewardUserMapper; import com.liquidnet.service.kylin.mapper.KylinRewardUserMapper;
import com.liquidnet.service.kylin.service.IFeishuBotService; import com.liquidnet.service.kylin.service.IFeishuBotService;
...@@ -50,11 +49,15 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService { ...@@ -50,11 +49,15 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService {
IKylinOrderTicketsService orderTicketsService; IKylinOrderTicketsService orderTicketsService;
@Autowired @Autowired
private IFeishuBotService iFeishuBotService; private IFeishuBotService iFeishuBotService;
@Autowired
private KylinPerformancesServiceImpl kylinPerformancesService;
@Autowired @Autowired
private KylinRewardCodeMapper kylinRewardCodeMapper; private KylinRewardCodeMapper kylinRewardCodeMapper;
@Autowired @Autowired
private KylinRewardUserMapper kylinRewardUserMapper; private KylinRewardUserMapper kylinRewardUserMapper;
@Autowired
private KylinLuckyBagScopeMapper kylinLuckyBagScopeMapper;
@Override @Override
...@@ -113,8 +116,45 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService { ...@@ -113,8 +116,45 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService {
} }
@Override @Override
public List<KylinLuckyBagScopeVo> getLuckyBagListScope(String mobile, String performanceId) { public List<KylinLuckyBagScopeVo> getLuckyBagListScope(String mobile) {
return Collections.emptyList(); if(StringUtil.isBlank(mobile)){
log.info("手机号为空");
return Collections.emptyList();
}
LambdaQueryWrapper<KylinLuckyBagScope> queryWrapper = new QueryWrapper<KylinLuckyBagScope>()
.lambda()
.eq(KylinLuckyBagScope::getMobile, mobile)
.eq(KylinLuckyBagScope::getState, 1);
List<KylinLuckyBagScope> kylinLuckyBagScopes = kylinLuckyBagScopeMapper.selectList(queryWrapper);
if (kylinLuckyBagScopes.isEmpty()) {
log.info("[getLuckyBagListScope] 验码福袋列表为空, mobile: {}.", mobile);
return Collections.emptyList();
}
// 查询福袋列表
List<KylinLuckyBag> luckyBagList = dataUtils.getKylinLuckyBagList();
if (luckyBagList.isEmpty()) {
log.info("[getLuckyBagListScope] 获取福袋列表为空.");
return Collections.emptyList();
}
// 该手机号可以核验的福袋ID列表
Set<String> collected = kylinLuckyBagScopes.stream()
.map(KylinLuckyBagScope::getLuckyBagId)
.collect(Collectors.toSet());
return luckyBagList.stream()
.filter(l -> collected.contains(l.getLuckyBagId()))
.map(l -> {
KylinLuckyBagScopeVo vo = new KylinLuckyBagScopeVo();
vo.setLuckyBagId(l.getLuckyBagId());
vo.setName(l.getName());
vo.setIntroduction(l.getIntroduction());
vo.setPerformanceId(l.getPerformanceId());
vo.setPerformanceName(l.getPerformanceName());
return vo;
})
.collect(Collectors.toList());
} }
@Override @Override
...@@ -166,13 +206,19 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService { ...@@ -166,13 +206,19 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService {
log.info("[getLuckyBagVos] 福袋[{}]已到发放时间,但未给用户分配兑换码, uid: {}, orderId: {}.", l.getName(), uid, orderId); log.info("[getLuckyBagVos] 福袋[{}]已到发放时间,但未给用户分配兑换码, uid: {}, orderId: {}.", l.getName(), uid, orderId);
kylinRewardUserList = getRandomRewardCode(vo, l.getLuckyBagId()); kylinRewardUserList = getRandomRewardCode(vo, l.getLuckyBagId());
} }
Set<String> codeSet = kylinRewardUserList.stream().map(KylinRewardUser::getCode).collect(Collectors.toSet()); List<KylinLuckyBagVo.RewardCodeVo> codeSet = kylinRewardUserList.stream().map(k -> {
luckyBagVo.setRewardCodeList(codeSet); KylinLuckyBagVo.RewardCodeVo rewardCodeVo = new KylinLuckyBagVo.RewardCodeVo();
rewardCodeVo.setState(k.getState());
rewardCodeVo.setCode(k.getCode());
return rewardCodeVo;
}).collect(Collectors.toList());
luckyBagVo.setRewardCodeVoList(codeSet);
luckyBagVo.setStatus(kylinRewardUserList.isEmpty() ? 0 : 1); luckyBagVo.setStatus(kylinRewardUserList.isEmpty() ? 0 : 1);
} else { } else {
log.info("[getLuckyBagVos] 福袋[{}]未到发放时间.", l.getName()); log.info("[getLuckyBagVos] 福袋[{}]未到发放时间.", l.getName());
luckyBagVo.setStatus(0); luckyBagVo.setStatus(0);
luckyBagVo.setRewardCodeList(Collections.emptySet()); luckyBagVo.setRewardCodeVoList(Collections.emptyList());
} }
} }
activityVos.add(luckyBagVo); activityVos.add(luckyBagVo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment