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

Commit f33a0d5d authored by GaoHu's avatar GaoHu

exit备注:本能不能为本人助力 后期去掉注解

parent 08872f72
......@@ -54,4 +54,8 @@ public class GoblinGoodsAnticipateValueParam{
@ApiModelProperty(position = 18, required = false, value = "创建日期")
private String createdDate;
@ApiModelProperty(required = false, value = "预约类型(1:预约提醒,2:预约获得购买资格)")
private Integer type;
}
......@@ -49,6 +49,10 @@ public class HelpValueVo implements java.io.Serializable, Cloneable{
this.setType(shareVo.getType());
this.setPeopleType(shareVo.getPeopleType());
this.setSkuId(shareVo.getSkuId());
this.setHelpUserAvatar(shareVo.getAvatarImgList());
this.setNickname(shareVo.getNickname());
this.setAvatar(shareVo.getAvatar());
this.setHelpPeople(shareVo.getHelpPeople());
return this;
}
}
......@@ -8,6 +8,7 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -49,6 +50,12 @@ public class GoblinGoodsAnticipateShareVo implements Serializable,Cloneable{
*/
private String avatar;
/**
* 助力人数
*/
@ApiModelProperty(value = "目前有多少助力")
private Integer helpPeople;
/**
* 预约开始时间
*/
......@@ -68,6 +75,11 @@ public class GoblinGoodsAnticipateShareVo implements Serializable,Cloneable{
*/
private LocalDateTime createdDate;
/**
* 头像集合
*/
private List<String> avatarImgList;
private static final GoblinGoodsAnticipateShareVo obj = new GoblinGoodsAnticipateShareVo();
......
......@@ -142,7 +142,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//查询redis关联记录
String sid = goblinRedisUtils.getShare(skuId, uid);
if (sid!=null) {
return ResponseDto.failure("1","已开启助力",sid);
return ResponseDto.failure("0","已开启助力",sid);
} else {
//查询sku需要助力人数
//Integer skuIdPeople = goblinRedisUtils.getSharePeopleBySkuId(skuId);
......@@ -161,6 +161,8 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
goblinGoodsAnticipateShareVo.setCreatedDate(LocalDateTime.now());
goblinGoodsAnticipateShareVo.setAboutStartDate(valueBySkuId.getAboutStartDate());
goblinGoodsAnticipateShareVo.setAboutEndDate(valueBySkuId.getAboutEndDate());
goblinGoodsAnticipateShareVo.setHelpPeople(0);
goblinGoodsAnticipateShareVo.setAvatarImgList(CollectionUtil.arrayListString());
//开启助力
//mongodb缓存
//goblinMongoUtils.setGoblinGoodsAnticipateShareVo(goblinGoodsAnticipateShareVo);
......@@ -202,9 +204,9 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//获取uid
String uid = CurrentUtil.getCurrentUid();
if (shareVo.getUid().equals(uid)){
return ResponseDto.failure("助力失败,本人不能为本人助力!");
}
// if (shareVo.getUid().equals(uid)){
// return ResponseDto.failure("助力失败,本人不能为本人助力!");
// }
//查询mongodb 是否助力过该分享
// GoblinGoodsAnticipateHelpVo goodsAnticipateHelpVo = goblinMongoUtils.getHelpVo(sid, uid);
......@@ -251,18 +253,10 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
@Override
public ResponseDto<HelpValueVo> getHelpValue(String sid) {
//助力头像前六个
List<String> helpUserAvatar = goblinRedisUtils.getHelpUserAvatar(sid);
//目前有多少助力
Integer helpPeople = goblinRedisUtils.getHelpSidAddHelp(sid);
//获取分享助力信息
GoblinGoodsAnticipateShareVo shareVo = goblinRedisUtils.getShareVo(sid);
HelpValueVo helpValueVo = HelpValueVo.getNew();
helpValueVo.copy(shareVo);
helpValueVo.setHelpUserAvatar(helpUserAvatar);
helpValueVo.setHelpPeople(helpPeople);
helpValueVo.setAvatar(helpValueVo.getAvatar());
helpValueVo.setNickname(helpValueVo.getNickname());
return ResponseDto.success(helpValueVo);
}
......
......@@ -61,6 +61,9 @@ public class GoblinMongoUtils {
HashMap<String, Object> info = CollectionUtil.mapStringObject();
Pageable pageable = PageRequest.of(goblinGoodsAnticipateValueParam.getPageNum() - 1, 20, Sort.by(Sort.Direction.DESC, "createdDate"));
Criteria criteria = Criteria.where("delTag").is(0).and("uid").is(uid);
if (goblinGoodsAnticipateValueParam.getType()!=null){
criteria = criteria.and("type").is(goblinGoodsAnticipateValueParam.getType());
}
if (StringUtils.isNotBlank(goblinGoodsAnticipateValueParam.getName())) {
criteria = criteria.and("skuName").regex(".*?" + goblinGoodsAnticipateValueParam.getName() + ".*");
}
......
......@@ -185,22 +185,22 @@ public class GoblinRedisUtils {
* 保存用户头像
*/
public void setHelpUserAvatar(String sid, String avatar) {
Object list = redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_HELP_AVATAR.concat(sid));
List<String> urlList = list != null ? (List<String>) list : CollectionUtil.arrayListString();
urlList.add(avatar);
redisUtil.set(GoblinRedisConst.ANTICIPATE_SHARE_HELP_AVATAR.concat(sid), urlList);
GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid);
// Object list = redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_HELP_AVATAR.concat(sid));
shareVo.getAvatarImgList().add(avatar);
setShareVo(shareVo);
}
/**
* 获取用户预约头像
*/
public List<String> getHelpUserAvatar(String sid) {
String rdk = GoblinRedisConst.ANTICIPATE_SHARE_HELP_AVATAR.concat(sid);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return CollectionUtil.arrayListString();
GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid);
if (shareVo!=null){
return shareVo.getAvatarImgList();
} else {
return (List<String>) obj;
return CollectionUtil.arrayListString();
}
}
......@@ -236,16 +236,22 @@ public class GoblinRedisUtils {
* 助力id人数+1
*/
public void setHelpSidAddHelp(String sid) {
GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid);
Integer helpPeople = shareVo.getHelpPeople();
shareVo.setHelpPeople(helpPeople != null ? helpPeople += 1 : 1);
Integer helpByUidAndSid = getHelpSidAddHelp(sid);
int num = helpByUidAndSid != null ? helpByUidAndSid += 1 : 1;
redisUtil.set(GoblinRedisConst.ANTICIPATE_SHARE_SID.concat(sid), num);
setShareVo(shareVo);
}
/**
* 获取 助力id人数
*/
public Integer getHelpSidAddHelp(String sid){
Integer people = (Integer) redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_SID.concat(sid));
GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid);
Integer people = null;
if (shareVo!=null){
people = shareVo.getHelpPeople();
}
return people != null ? people : 0;
}
......
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