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

Commit 97bcc914 authored by 胡佳晨's avatar 胡佳晨

提交 vo方法

parent 07da175c
......@@ -9,6 +9,8 @@ import java.time.LocalDateTime;
@Data
public class GoblinListCollectVo implements Serializable, Cloneable{
@ApiModelProperty(value = "listId")
private String listId;
@ApiModelProperty(value = "spuId")
private String spuId;
@ApiModelProperty(value = "skuId")
......
......@@ -91,6 +91,8 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable {
private String arUrlIos;
@ApiModelProperty(position = 66, value = "单品AR文件URL-Android版")
private String arUrlAndroid;
@ApiModelProperty(position = 67, value = "标签[0-提前购买|1-分段购买]")
private Integer tagType;
private static final GoblinNftGoodsSkuInfoVo obj = new GoblinNftGoodsSkuInfoVo();
......
......@@ -50,6 +50,8 @@ public class GoblinNftGoodsSkuListVo implements Serializable, Cloneable {
private String aboutEndDate;
@ApiModelProperty(position = 61, value = "预约状态(0:未开始,1:可预约,3:已结束)")
private Integer state;
@ApiModelProperty(position = 62, value = "标签[0-提前购买|1-分段购买]")
private Integer tagType;
private static final GoblinNftGoodsSkuListVo obj = new GoblinNftGoodsSkuListVo();
......
......@@ -49,6 +49,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
@Override
public ResponseDto<PagedResult<GoblinNftGoodsSkuListVo>> goodsList(int page) {
LocalDateTime now = LocalDateTime.now();
List<String> startSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("1");
List<String> notStartSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("2");
List<String> soldOutSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("3");
......@@ -68,7 +69,10 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
for (int i = finalCount; i < initCount; i++) {
String skuId = allIdList.get(i);
// sku信息
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
HashMap<String,Object> map = goblinRedisUtils.getGoodsSkuInfoVo(now,skuId);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Integer tagType = (Integer) map.get("tagType");
String listId = (String) map.get("listId");
GoblinNftGoodsSkuListVo goblinNftGoodsSkuListVo = GoblinNftGoodsSkuListVo.getNew().copy(skuInfoVo);
// spu信息
Object spuInfoMap = spuInfoList.get(skuInfoVo.getSpuId());
......@@ -89,6 +93,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 0);
goblinNftGoodsSkuListVo.setAnticipateValueVo(anticipateValueVo);
}
goblinNftGoodsSkuListVo.setTagType(tagType);
// 写入列表
skuList.add(goblinNftGoodsSkuListVo);
}
......@@ -100,7 +105,11 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
@Override
public GoblinNftGoodsSkuInfoVo goodsDetail(String skuId) {
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
LocalDateTime now = LocalDateTime.now();
HashMap<String,Object> map = goblinRedisUtils.getGoodsSkuInfoVo(now,skuId);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Integer tagType = (Integer) map.get("tagType");
String listId = (String) map.get("listId");
if (goblinRedisUtils.getSkuAllStatusShow(skuInfoVo)) {
//获取预约相关
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 1);
......@@ -128,6 +137,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
}
// 系统时间
nftGoodsSkuInfoVo.setSystime(LocalDateTime.now());
nftGoodsSkuInfoVo.setTagType(tagType);
return nftGoodsSkuInfoVo;
} else {
return null;
......
......@@ -197,6 +197,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
collectVo.setTimeStart(st);
collectVo.setTimeEnd(et);
collectVo.setTagType(vo.getTagType());
collectVo.setListId(vo.getListId());
collectVos.add(collectVo);
redisUtils.setGoblinListCollect(itemVo.getSkuId(), collectVos);
// 白名单
......
......@@ -26,6 +26,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -703,6 +704,41 @@ public class GoblinRedisUtils {
}
}
/**
* 获取 包含分段购的sku详情 HASHMAP
*
* @param now 当前时间
* @param skuId skuId
* @return
*/
public HashMap<String, Object> getGoodsSkuInfoVo(LocalDateTime now, String skuId) {
GoblinGoodsSkuInfoVo vo = getGoodsSkuInfoVo(skuId);
List<GoblinListCollectVo> collectVos = getGoblinListCollect(skuId);
GoblinListCollectVo collectVo = null;
for (GoblinListCollectVo collectVoItem : collectVos) {
if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) {
collectVo = collectVoItem;
break;
}
}
HashMap<String, Object> map = CollectionUtil.mapStringObject();
Integer tagType = null;
String listId = null;
if (collectVo != null) {
vo.setPrice(collectVo.getPrice());
vo.setPriceV(collectVo.getPriceV());
vo.setProductId(collectVo.getProductId());
vo.setSaleStartTime(collectVo.getTimeStart());
vo.setSaleStopTime(collectVo.getTimeEnd());
tagType = collectVo.getTagType();
listId = collectVo.getListId();
}
map.put("vo", vo);
map.put("tagType", tagType);
map.put("listId", listId);
return map;
}
public GoblinGoodsSkuInfoVo getGoodsSkuInfoVoByUnShelves(String skuId) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(skuId);
if (pre != null && pre.equals(GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue())) {
......@@ -1727,7 +1763,7 @@ public class GoblinRedisUtils {
redisUtil.set(GoblinRedisConst.LIST_DETAILS.concat(vo.getListId()), vo);
}
public void delGoblinListDetailsVo(String listId){
public void delGoblinListDetailsVo(String listId) {
redisUtil.del(GoblinRedisConst.LIST_DETAILS.concat(listId));
}
......@@ -1743,15 +1779,15 @@ public class GoblinRedisUtils {
/**
* 设置 分批购数据
*/
public void setGoblinListCollect(String skuId,List<GoblinListCollectVo> vo) {
public void setGoblinListCollect(String skuId, List<GoblinListCollectVo> vo) {
redisUtil.set(GoblinRedisConst.LIST_COLLECT.concat(skuId), vo);
}
public List<GoblinListCollectVo> getGoblinListCollect(String skuId) {
Object obj = redisUtil.get(GoblinRedisConst.LIST_COLLECT.concat(skuId));
if(obj==null){
if (obj == null) {
return ObjectUtil.getGoblinListCollectVo();
}else{
} else {
return (List<GoblinListCollectVo>) obj;
}
}
......
......@@ -14,6 +14,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
@Component
......@@ -161,6 +162,55 @@ public class GoblinRedisUtils {
}
}
/**
* 获取 包含分段购的sku详情 HASHMAP
*
* @param now 当前时间
* @param skuId skuId
* @return
*/
public HashMap<String, Object> getGoodsSkuInfoVo(LocalDateTime now, String skuId) {
GoblinGoodsSkuInfoVo vo = getGoodsSkuInfoVo(skuId);
List<GoblinListCollectVo> collectVos = getGoblinListCollect(skuId);
GoblinListCollectVo collectVo = null;
for (GoblinListCollectVo collectVoItem : collectVos) {
if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) {
collectVo = collectVoItem;
break;
}
}
HashMap<String, Object> map = CollectionUtil.mapStringObject();
Integer tagType = null;
String listId = null;
if (collectVo != null) {
vo.setPrice(collectVo.getPrice());
vo.setPriceV(collectVo.getPriceV());
vo.setProductId(collectVo.getProductId());
vo.setSaleStartTime(collectVo.getTimeStart());
vo.setSaleStopTime(collectVo.getTimeEnd());
tagType = collectVo.getTagType();
listId = collectVo.getListId();
}
map.put("vo", vo);
map.put("tagType", tagType);
map.put("listId", listId);
return map;
}
/**
* 分段购获取
* @param skuId
* @return
*/
public List<GoblinListCollectVo> getGoblinListCollect(String skuId) {
Object obj = redisUtil.get(GoblinRedisConst.LIST_COLLECT.concat(skuId));
if (obj == null) {
return ObjectUtil.getGoblinListCollectVo();
} else {
return (List<GoblinListCollectVo>) obj;
}
}
//获取 用户sku购买个数
public Integer getSkuCountByUid(String uid, String skuId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_BUY_COUNT.concat(uid + ":skuId:" + skuId);
......
......@@ -50,11 +50,16 @@ public class ObjectUtil {
private static final ArrayList<WriteModel<Document>> writeModelDocumentArrayList = new ArrayList<>();
private static final ArrayList<GoblinUserCouponVo> goblinUserCouponVo = new ArrayList<>();
private static final ArrayList<GoblinBackOrderSkuVo> goblinBackOrderSkuVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinListCollectVo> goblinListCollectVo = new ArrayList<>();
public static Object[] objectsArray;
public static final Integer[] integerArray2 = new Integer[2];
public static ArrayList<GoblinListCollectVo> getGoblinListCollectVo() {
return (ArrayList<GoblinListCollectVo>) goblinListCollectVo.clone();
}
public static ArrayList<GoblinBackOrderSkuVo> goblinBackOrderSkuVoArrayList() {
return (ArrayList<GoblinBackOrderSkuVo>) goblinBackOrderSkuVoArrayList.clone();
}
......
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