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

Commit 668b7035 authored by jiangxiulong's avatar jiangxiulong

IntegralActivityDrawVo mongo

parent 01cbbb25
package com.liquidnet.service.sweet.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class IntegralActivityDrawVo implements Serializable, Cloneable {
private static final long serialVersionUID = -6777064807434774549L;
@ApiModelProperty(value = "抽奖id")
private String drawId;
@ApiModelProperty(value = "关联活动id")
private String integralActivityId;
@ApiModelProperty(value = "活动玩一次所需积分")
private Integer activityNum;
@ApiModelProperty(value = "关联奖品id")
private String prizeId;
@ApiModelProperty(value = "奖品名称")
private String prizeTitle;
@ApiModelProperty(value = "奖品类型 1谢谢惠顾 2积分 3优惠券 4实物")
private Integer prizeType;
@ApiModelProperty(value = "关联id 如商品id 券id")
private String relationId;
@ApiModelProperty(value = "单次奖励数量如积分 中奖给多少")
private Integer prizeTypeNum;
@ApiModelProperty(value = "关联用户id")
private String userId;
@ApiModelProperty(value = "关联用户昵称")
private String nickname;
@ApiModelProperty(value = "adam收货地址addresses_id")
private String receivingAddressesId;
@ApiModelProperty(value = "adam收货人姓名")
private String receivingName;
@ApiModelProperty(value = "adam收货人手机号")
private String receivingPhone;
@ApiModelProperty(value = "adam收货人完整地址 空格隔离省市区详细地址")
private String receivingAddress;
@ApiModelProperty(value = "收货状态 1中奖未发放 2已发放")
private Integer receivingStatus;
@ApiModelProperty(value = "创建时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt;
@ApiModelProperty(value = "更新时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt;
private static final IntegralActivityDrawVo obj = new IntegralActivityDrawVo();
public static IntegralActivityDrawVo getNew() {
try {
return (IntegralActivityDrawVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new IntegralActivityDrawVo();
}
}
public IntegralActivityDrawVo copy(SweetIntegralActivityDraw source) {
if (null == this) return this;
this.setDrawId(source.getIntegralActivityId());
this.setIntegralActivityId(source.getIntegralActivityId());
this.setActivityNum(source.getActivityNum());
this.setPrizeId(source.getPrizeId());
this.setPrizeTitle(source.getPrizeTitle());
this.setPrizeType(source.getPrizeType());
this.setPrizeTypeNum(source.getPrizeTypeNum());
this.setRelationId(source.getRelationId());
this.setUserId(source.getUserId());
this.setNickname(source.getNickname());
this.setReceivingAddressesId(source.getReceivingAddressesId());
this.setReceivingName(source.getReceivingName());
this.setReceivingPhone(source.getReceivingPhone());
this.setReceivingAddress(source.getReceivingAddress());
this.setReceivingStatus(source.getReceivingStatus());
this.setCreatedAt(source.getUpdatedAt());
this.setUpdatedAt(source.getUpdatedAt());
return this;
}
}
...@@ -2,6 +2,7 @@ package com.liquidnet.service.sweet.service; ...@@ -2,6 +2,7 @@ package com.liquidnet.service.sweet.service;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityDrawVo;
import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo; import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo;
import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw; import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
...@@ -20,9 +21,9 @@ public interface ISweetIntegralActivityDrawService extends IService<SweetIntegra ...@@ -20,9 +21,9 @@ public interface ISweetIntegralActivityDrawService extends IService<SweetIntegra
ResponseDto<SweetIntegralActivityPrizeVo> create(String integralActivityId); ResponseDto<SweetIntegralActivityPrizeVo> create(String integralActivityId);
ResponseDto<PagedResult<SweetIntegralActivityDraw>> drawList(Integer type, String integralActivityId, Integer pageNum); ResponseDto<PagedResult<IntegralActivityDrawVo>> drawList(Integer type, String integralActivityId, Integer pageNum);
ResponseDto<List<SweetIntegralActivityDraw>> winPrizeUser(String integralActivityId); ResponseDto<List<IntegralActivityDrawVo>> winPrizeUser(String integralActivityId);
ResponseDto perfectAddress(String drawId, String receivingAddressesId, String receivingName, String receivingPhone, String receivingAddress); ResponseDto perfectAddress(String drawId, String receivingAddressesId, String receivingName, String receivingPhone, String receivingAddress);
} }
package com.liquidnet.service.sweet.utils; package com.liquidnet.service.sweet.utils;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityDrawVo;
import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo; import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo;
import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw; import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
import com.liquidnet.service.sweet.entity.SweetIntegralActivityPrize; import com.liquidnet.service.sweet.entity.SweetIntegralActivityPrize;
...@@ -11,19 +12,19 @@ import java.util.LinkedList; ...@@ -11,19 +12,19 @@ import java.util.LinkedList;
public class SweetNewObjectUtil { public class SweetNewObjectUtil {
private static final ArrayList<SweetIntegralActivityPrizeVo> sweetIntegralActivityPrizeVoArrayList = new ArrayList<>(); private static final ArrayList<SweetIntegralActivityPrizeVo> sweetIntegralActivityPrizeVoArrayList = new ArrayList<>();
private static final ArrayList<SweetIntegralActivityPrize> sweetIntegralActivityPrizeArrayList = new ArrayList<>(); private static final ArrayList<SweetIntegralActivityPrize> sweetIntegralActivityPrizeArrayList = new ArrayList<>();
private static final LinkedList<SweetIntegralActivityDraw> sweetIntegralActivityDrawArrayList = new LinkedList<>(); private static final LinkedList<IntegralActivityDrawVo> sweetIntegralActivityDrawVoLinkedList = new LinkedList<>();
private static final PagedResult<SweetIntegralActivityDraw> sweetIntegralActivityDrawPagedResult = new PagedResult<>(); private static final PagedResult<IntegralActivityDrawVo> sweetIntegralActivityDrawVoPagedResult = new PagedResult<>();
public static ArrayList<SweetIntegralActivityPrizeVo> getSweetIntegralActivityPrizeVoArrayList() { public static ArrayList<SweetIntegralActivityPrizeVo> getSweetIntegralActivityPrizeVoArrayList() {
return (ArrayList<SweetIntegralActivityPrizeVo>) sweetIntegralActivityPrizeVoArrayList.clone(); return (ArrayList<SweetIntegralActivityPrizeVo>) sweetIntegralActivityPrizeVoArrayList.clone();
} }
public static LinkedList<SweetIntegralActivityDraw> getSweetIntegralActivityDrawLinkedList() { public static LinkedList<IntegralActivityDrawVo> getSweetIntegralActivityDrawVoLinkedList() {
return (LinkedList<SweetIntegralActivityDraw>) sweetIntegralActivityDrawArrayList.clone(); return (LinkedList<IntegralActivityDrawVo>) sweetIntegralActivityDrawVoLinkedList.clone();
} }
public static PagedResult<SweetIntegralActivityDraw> getSweetIntegralActivityDrawPagedResult() { public static PagedResult<IntegralActivityDrawVo> getSweetIntegralActivityDrawVoPagedResult() {
return (PagedResult<SweetIntegralActivityDraw>) sweetIntegralActivityDrawPagedResult.clone(); return (PagedResult<IntegralActivityDrawVo>) sweetIntegralActivityDrawVoPagedResult.clone();
} }
public static ArrayList<SweetIntegralActivityPrize> getSweetIntegralActivityPrizeArrayList() { public static ArrayList<SweetIntegralActivityPrize> getSweetIntegralActivityPrizeArrayList() {
......
...@@ -78,7 +78,22 @@ public class SweetIntegralActivityDraw implements Serializable, Cloneable { ...@@ -78,7 +78,22 @@ public class SweetIntegralActivityDraw implements Serializable, Cloneable {
private String nickname; private String nickname;
/** /**
* 收货地址 * adam收货地址addresses_id
*/
private String receivingAddressesId;
/**
* adam收货人姓名
*/
private String receivingName;
/**
* adam收货人手机号
*/
private String receivingPhone;
/**
* adam收货人完整地址 空格隔离省市区详细地址
*/ */
private String receivingAddress; private String receivingAddress;
......
...@@ -81,6 +81,10 @@ ...@@ -81,6 +81,10 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -3,6 +3,7 @@ package com.liquidnet.service.sweet.controller; ...@@ -3,6 +3,7 @@ package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityDrawVo;
import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo; import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo;
import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw; import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
import com.liquidnet.service.sweet.service.ISweetIntegralActivityDrawService; import com.liquidnet.service.sweet.service.ISweetIntegralActivityDrawService;
...@@ -48,7 +49,7 @@ public class SweetIntegralActivityDrawController { ...@@ -48,7 +49,7 @@ public class SweetIntegralActivityDrawController {
@ApiImplicitParam(type = "query", dataType = "String", name = "integralActivityId", value = "活动id", required = true), @ApiImplicitParam(type = "query", dataType = "String", name = "integralActivityId", value = "活动id", required = true),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "pageNum", value = "分页", required = true) @ApiImplicitParam(type = "query", dataType = "Integer", name = "pageNum", value = "分页", required = true)
}) })
public ResponseDto<PagedResult<SweetIntegralActivityDraw>> drawList( public ResponseDto<PagedResult<IntegralActivityDrawVo>> drawList(
@RequestParam("type") Integer type, @RequestParam("type") Integer type,
@RequestParam("integralActivityId") String integralActivityId, @RequestParam("integralActivityId") String integralActivityId,
@RequestParam("pageNum") Integer pageNum @RequestParam("pageNum") Integer pageNum
...@@ -61,7 +62,7 @@ public class SweetIntegralActivityDrawController { ...@@ -61,7 +62,7 @@ public class SweetIntegralActivityDrawController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "integralActivityId", value = "活动id", required = true) @ApiImplicitParam(type = "query", dataType = "String", name = "integralActivityId", value = "活动id", required = true)
}) })
public ResponseDto<List<SweetIntegralActivityDraw>> winPrizeUser( public ResponseDto<List<IntegralActivityDrawVo>> winPrizeUser(
@RequestParam("integralActivityId") String integralActivityId @RequestParam("integralActivityId") String integralActivityId
) { ) {
return activityDrawService.winPrizeUser(integralActivityId); return activityDrawService.winPrizeUser(integralActivityId);
......
...@@ -4,6 +4,8 @@ import com.liquidnet.commons.lang.util.CurrentUtil; ...@@ -4,6 +4,8 @@ import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityDrawVo;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityVo; import com.liquidnet.service.sweet.dto.vo.IntegralActivityVo;
import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo; import com.liquidnet.service.sweet.dto.vo.admin.SweetIntegralActivityPrizeVo;
import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw; import com.liquidnet.service.sweet.entity.SweetIntegralActivityDraw;
...@@ -15,6 +17,7 @@ import com.liquidnet.service.sweet.utils.RedisDataUtils; ...@@ -15,6 +17,7 @@ import com.liquidnet.service.sweet.utils.RedisDataUtils;
import com.liquidnet.service.sweet.utils.SweetNewObjectUtil; import com.liquidnet.service.sweet.utils.SweetNewObjectUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -36,6 +39,9 @@ public class SweetIntegralActivityDrawServiceImpl extends ServiceImpl<SweetInteg ...@@ -36,6 +39,9 @@ public class SweetIntegralActivityDrawServiceImpl extends ServiceImpl<SweetInteg
@Autowired @Autowired
private RedisDataUtils redisDataUtils; private RedisDataUtils redisDataUtils;
@Autowired
private MongoTemplate mongoTemplate;
@Override @Override
public ResponseDto<SweetIntegralActivityPrizeVo> create(String integralActivityId) { public ResponseDto<SweetIntegralActivityPrizeVo> create(String integralActivityId) {
// TODO: 2021/10/26 看情况是否加锁 一个用户整个逻辑单进程 // TODO: 2021/10/26 看情况是否加锁 一个用户整个逻辑单进程
...@@ -84,38 +90,39 @@ public class SweetIntegralActivityDrawServiceImpl extends ServiceImpl<SweetInteg ...@@ -84,38 +90,39 @@ public class SweetIntegralActivityDrawServiceImpl extends ServiceImpl<SweetInteg
if (activityPrizeNum < 0 || activityPrizeWinnersNum < 0) {// 库存不够了 if (activityPrizeNum < 0 || activityPrizeWinnersNum < 0) {// 库存不够了
return ResponseDto.failure("活动太火爆了,请稍后再试"); return ResponseDto.failure("活动太火爆了,请稍后再试");
} }
SweetIntegralActivityDraw sweetIntegralActivityDraw = SweetIntegralActivityDraw.getNew(); IntegralActivityDrawVo integralActivityDrawVo = IntegralActivityDrawVo.getNew();
sweetIntegralActivityDraw.setDrawId(IDGenerator.nextSnowId()); integralActivityDrawVo.setDrawId(IDGenerator.nextSnowId());
sweetIntegralActivityDraw.setIntegralActivityId(integralActivityId); integralActivityDrawVo.setIntegralActivityId(integralActivityId);
sweetIntegralActivityDraw.setActivityNum(integralActivity.getActivityNum()); integralActivityDrawVo.setActivityNum(integralActivity.getActivityNum());
sweetIntegralActivityDraw.setPrizeId(sweetIntegralActivityPrize.getPrizeId()); integralActivityDrawVo.setPrizeId(sweetIntegralActivityPrize.getPrizeId());
sweetIntegralActivityDraw.setPrizeTitle(sweetIntegralActivityPrize.getPrizeTitle()); integralActivityDrawVo.setPrizeTitle(sweetIntegralActivityPrize.getPrizeTitle());
sweetIntegralActivityDraw.setPrizeType(sweetIntegralActivityPrize.getPrizeType()); integralActivityDrawVo.setPrizeType(sweetIntegralActivityPrize.getPrizeType());
sweetIntegralActivityDraw.setPrizeTypeNum(sweetIntegralActivityPrize.getPrizeTypeNum()); integralActivityDrawVo.setPrizeTypeNum(sweetIntegralActivityPrize.getPrizeTypeNum());
sweetIntegralActivityDraw.setRelationId(sweetIntegralActivityPrize.getRelationId()); integralActivityDrawVo.setRelationId(sweetIntegralActivityPrize.getRelationId());
sweetIntegralActivityDraw.setUserId(userId); integralActivityDrawVo.setUserId(userId);
sweetIntegralActivityDraw.setNickname(nickname); integralActivityDrawVo.setNickname(nickname);
LocalDateTime nowTime = LocalDateTime.now(); LocalDateTime nowTime = LocalDateTime.now();
sweetIntegralActivityDraw.setCreatedAt(nowTime); integralActivityDrawVo.setCreatedAt(nowTime);
// redis // redis
redisDataUtils.setIntegralActivityDraw(sweetIntegralActivityDraw); redisDataUtils.setIntegralActivityDraw(integralActivityDrawVo);
// mongo // mongo
mongoTemplate.insert(integralActivityDrawVo, IntegralActivityDrawVo.class.getSimpleName());
return ResponseDto.success(sweetIntegralActivityPrizeVo); return ResponseDto.success(sweetIntegralActivityPrizeVo);
} }
@Override @Override
public ResponseDto<PagedResult<SweetIntegralActivityDraw>> drawList(Integer type, String integralActivityId, Integer pageNum) { public ResponseDto<PagedResult<IntegralActivityDrawVo>> drawList(Integer type, String integralActivityId, Integer pageNum) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
List<SweetIntegralActivityDraw> integralActivityDrawAll = redisDataUtils.getIntegralActivityDrawList(type, currentUid, integralActivityId, pageNum); List<IntegralActivityDrawVo> integralActivityDrawAll = redisDataUtils.getIntegralActivityDrawList(type, currentUid, integralActivityId, pageNum);
PagedResult<SweetIntegralActivityDraw> sweetIntegralActivityDrawPagedResult = SweetNewObjectUtil.getSweetIntegralActivityDrawPagedResult(); PagedResult<IntegralActivityDrawVo> sweetIntegralActivityDrawPagedResult = SweetNewObjectUtil.getSweetIntegralActivityDrawVoPagedResult();
sweetIntegralActivityDrawPagedResult.setList(integralActivityDrawAll).setTotal(100, 20).setPageSize(20).setCurrentPage(pageNum); sweetIntegralActivityDrawPagedResult.setList(integralActivityDrawAll).setTotal(100, 20).setPageSize(20).setCurrentPage(pageNum);
return ResponseDto.success(sweetIntegralActivityDrawPagedResult); return ResponseDto.success(sweetIntegralActivityDrawPagedResult);
} }
@Override @Override
public ResponseDto<List<SweetIntegralActivityDraw>> winPrizeUser(String integralActivityId) { public ResponseDto<List<IntegralActivityDrawVo>> winPrizeUser(String integralActivityId) {
List<SweetIntegralActivityDraw> integralActivityDrawAll = redisDataUtils.getIntegralActivityDrawAll(integralActivityId); List<IntegralActivityDrawVo> integralActivityDrawAll = redisDataUtils.getIntegralActivityDrawAll(integralActivityId);
return ResponseDto.success(integralActivityDrawAll); return ResponseDto.success(integralActivityDrawAll);
} }
......
...@@ -11,6 +11,7 @@ import com.liquidnet.service.sweet.dto.SweetManualAppletDto; ...@@ -11,6 +11,7 @@ import com.liquidnet.service.sweet.dto.SweetManualAppletDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto; import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto;
import com.liquidnet.service.sweet.dto.SweetManualArtistListDto; import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto; import com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityDrawVo;
import com.liquidnet.service.sweet.dto.vo.IntegralActivityVo; import com.liquidnet.service.sweet.dto.vo.IntegralActivityVo;
import com.liquidnet.service.sweet.entity.*; import com.liquidnet.service.sweet.entity.*;
import com.liquidnet.service.sweet.mapper.*; import com.liquidnet.service.sweet.mapper.*;
...@@ -631,12 +632,12 @@ public class RedisDataUtils { ...@@ -631,12 +632,12 @@ public class RedisDataUtils {
} }
} }
public void setIntegralActivityDraw(SweetIntegralActivityDraw sweetIntegralActivityDraw) { public void setIntegralActivityDraw(IntegralActivityDrawVo integralActivityDrawVo) {
Integer prizeType = sweetIntegralActivityDraw.getPrizeType(); Integer prizeType = integralActivityDrawVo.getPrizeType();
String redisKey = ""; String redisKey = "";
String userId = sweetIntegralActivityDraw.getUserId(); String userId = integralActivityDrawVo.getUserId();
String integralActivityId = sweetIntegralActivityDraw.getIntegralActivityId(); String integralActivityId = integralActivityDrawVo.getIntegralActivityId();
LinkedList<SweetIntegralActivityDraw> activityDrawArrayList = SweetNewObjectUtil.getSweetIntegralActivityDrawLinkedList(); LinkedList<IntegralActivityDrawVo> activityDrawArrayList = SweetNewObjectUtil.getSweetIntegralActivityDrawVoLinkedList();
if (prizeType == 1) {// 谢谢惠顾 写入抽奖列表 if (prizeType == 1) {// 谢谢惠顾 写入抽奖列表
redisKey = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER redisKey = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_USER
.concat(integralActivityId) .concat(integralActivityId)
...@@ -653,13 +654,13 @@ public class RedisDataUtils { ...@@ -653,13 +654,13 @@ public class RedisDataUtils {
// all用户中奖列表 // all用户中奖列表
String redisKeyAll = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST String redisKeyAll = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
.concat(integralActivityId); .concat(integralActivityId);
LinkedList<SweetIntegralActivityDraw> integralActivityDrawAll = this.getIntegralActivityDrawAll(integralActivityId); LinkedList<IntegralActivityDrawVo> integralActivityDrawAll = this.getIntegralActivityDrawAll(integralActivityId);
if (!CollectionUtil.isEmpty(integralActivityDrawAll)) { if (!CollectionUtil.isEmpty(integralActivityDrawAll)) {
if (integralActivityDrawAll.size() >= 20) { if (integralActivityDrawAll.size() >= 20) {
integralActivityDrawAll.remove(0); integralActivityDrawAll.remove(0);
} }
} }
integralActivityDrawAll.addFirst(sweetIntegralActivityDraw); integralActivityDrawAll.addFirst(integralActivityDrawVo);
redisUtil.set(redisKeyAll, integralActivityDrawAll); redisUtil.set(redisKeyAll, integralActivityDrawAll);
} }
// 先获取set到20条 // 先获取set到20条
...@@ -668,22 +669,22 @@ public class RedisDataUtils { ...@@ -668,22 +669,22 @@ public class RedisDataUtils {
activityDrawArrayList.remove(0); activityDrawArrayList.remove(0);
} }
} }
activityDrawArrayList.addFirst(sweetIntegralActivityDraw); activityDrawArrayList.addFirst(integralActivityDrawVo);
redisUtil.set(redisKey, activityDrawArrayList); redisUtil.set(redisKey, activityDrawArrayList);
} }
public LinkedList<SweetIntegralActivityDraw> getIntegralActivityDrawAll(String integralActivityId) { public LinkedList<IntegralActivityDrawVo> getIntegralActivityDrawAll(String integralActivityId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST String redisKey = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_ALL_LIST
.concat(integralActivityId); .concat(integralActivityId);
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
if (null == obj) { if (null == obj) {
return null; return null;
} else { } else {
return (LinkedList<SweetIntegralActivityDraw>) obj; return (LinkedList<IntegralActivityDrawVo>) obj;
} }
} }
public LinkedList<SweetIntegralActivityDraw> getIntegralActivityDrawList(Integer type, String uid, String integralActivityId, Integer pageNum) { public LinkedList<IntegralActivityDrawVo> getIntegralActivityDrawList(Integer type, String uid, String integralActivityId, Integer pageNum) {
String redisKey = ""; String redisKey = "";
if (type == 1) { if (type == 1) {
redisKey = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER redisKey = SweetConstant.REDIS_KEY_SWEET_INTEGRAL_ACTIVITY_DRAW_IN_USER
...@@ -700,7 +701,7 @@ public class RedisDataUtils { ...@@ -700,7 +701,7 @@ public class RedisDataUtils {
if (null == obj) { if (null == obj) {
return null; return null;
} else { } else {
return (LinkedList<SweetIntegralActivityDraw>) obj; return (LinkedList<IntegralActivityDrawVo>) obj;
} }
// TODO: 2021/10/27 page大于1 去mongo里面取 // TODO: 2021/10/27 page大于1 去mongo里面取
} }
......
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