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

Commit f33a0d5d authored by GaoHu's avatar GaoHu

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

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