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

Commit e976b519 authored by 张国柄's avatar 张国柄

+商品、单品信息存储更新;

parent c14cac55
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtGoodsAddParam", description = "商品管理:添加商品入参")
......@@ -38,45 +43,100 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
@ApiModelProperty(position = 18, required = true, value = "商品图片列表")
private List<String> imageList;
@ApiModelProperty(position = 19, required = false, value = "商品视频地址")
private String coverPic;
@ApiModelProperty(position = 20, required = false, value = "商品视频地址")
private String video;
/** ---------------------------- 价格库存 ---------------------------- **/
@ApiModelProperty(position = 20, required = true, value = "规格展现方式[1-常规|2-组合]", allowableValues = "1,2", example = "1")
@ApiModelProperty(position = 21, required = true, value = "规格展现方式[1-常规|2-组合]", allowableValues = "1,2", example = "1")
private String specMode;
@ApiModelProperty(position = 21, required = true, value = "SKU规格信息")
@ApiModelProperty(position = 22, required = true, value = "SKU规格信息")
private List<GoblinStoreMgtGoodsAddSkuParam> skuParamList;
@ApiModelProperty(position = 22, required = true, value = "物流模版", example = "松鼠德邦")
@ApiModelProperty(position = 23, required = true, value = "物流模版", example = "松鼠德邦")
private String logisticsTemplate;
@ApiModelProperty(position = 23, required = false, value = "商品编码[默认为系统编码,也可手动输入商家自己的编码]")
@ApiModelProperty(position = 24, required = false, value = "商品编码[默认为系统编码,也可手动输入商家自己的编码]")
private String spuNo;
/** ---------------------------- 商品介绍 ---------------------------- **/
@ApiModelProperty(position = 24, required = true, value = "商品详情", example = "商品详情...")
@ApiModelProperty(position = 25, required = true, value = "商品详情", example = "商品详情...")
private String details;
/** ---------------------------- 销售属性 ---------------------------- **/
@ApiModelProperty(position = 25, required = true, value = "上架处理方式[1-等待手动上架|2-直接上架售卖|3-预约定时上架]", example = "1")
@ApiModelProperty(position = 26, required = true, value = "上架处理方式[1-等待手动上架|2-直接上架售卖|3-预约定时上架]", example = "1")
private String shelvesHandle;
@ApiModelProperty(position = 26, required = false, value = "预约上架时间[上架处理方式为3-预约定时上架时需要指定]")
@ApiModelProperty(position = 27, required = false, value = "预约上架时间[上架处理方式为3-预约定时上架时需要指定]")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "预约上架时间格式有误")
private String shelvesTime;
@ApiModelProperty(position = 27, required = false, value = "商品有效期[YYYY-MM-DD]")
@ApiModelProperty(position = 28, required = false, value = "商品有效期[YYYY-MM-DD]")
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "商品有效期格式有误")
private String spuValidity;
@ApiModelProperty(position = 28, required = true, value = "是否虚拟商品[0-否|1-是]", allowableValues = "0,1", example = "0")
@ApiModelProperty(position = 29, required = true, value = "是否虚拟商品[0-否|1-是]", allowableValues = "0,1", example = "0")
@Pattern(regexp = "\\b(0|1)\\b", message = "是否虚拟商品参数无效")
private String virtualFlg;
/** ---------------------------- 服务保障 ---------------------------- **/
@ApiModelProperty(position = 29, required = false, value = "商品服务支持ID列表")
@ApiModelProperty(position = 30, required = false, value = "商品服务支持ID列表")
private List<String> ssidList;
/** ---------------------------- 专属标签 ---------------------------- **/
@ApiModelProperty(position = 30, required = true, value = "商品关联音乐人、艺术家、IP列表")
@ApiModelProperty(position = 31, required = true, value = "商品关联音乐人、艺术家、IP列表")
private List<String> extagList;
public GoblinGoodsInfoVo initGoodsInfoVo() {
GoblinGoodsInfoVo vo = GoblinGoodsInfoVo.getNew();
vo.setStoreId(this.getStoreId());
vo.setSpuId(IDGenerator.nextMilliId2());
vo.setSpuNo(IDGenerator.nextTimeId2());
vo.setName(this.getName());
// vo.setSubtitle(null);
// vo.setSellPrice(BigDecimal.ZERO);
// vo.setPriceGe(BigDecimal.ZERO);
// vo.setPriceLe(BigDecimal.ZERO);
vo.setIntro(this.getIntro());
vo.setDetails(this.getDetails());
vo.setCoverPic(this.getCoverPic());
vo.setVideo(this.getVideo());
vo.setSpecMode(this.getSpecMode());
vo.setCateFid(this.getCateFid());
vo.setCateSid(this.getCateSid());
vo.setCateTid(this.getCateTid());
// vo.setStoreCateFid(null);
// vo.setStoreCateSid(null);
// vo.setStoreCateTid(null);
// vo.setBrandId(null);
vo.setShelvesHandle(this.getShelvesHandle());
vo.setShelvesTime(this.getShelvesTime());
vo.setSpuValidity(this.getSpuValidity());
vo.setVirtualFlg(this.getVirtualFlg());
vo.setStatus("1");
// vo.setReason(null);
vo.setShelvesStatus("0");
// vo.setSpuAppear(null);
// vo.setShelvesAt(null);
vo.setImageList(this.getImageList());
vo.setLogisticsTemplate(this.getLogisticsTemplate());
// vo.setCreatedBy();
// vo.setCreatedAt();
// vo.setUpdatedBy();
// vo.setUpdatedAt();
// vo.setSpecVoList();
// vo.setTagVoList();
// vo.setServiceSupportVoList();
// vo.setExtagVoList();
return vo;
}
public void initGoodsSkuInfoVo(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> vos) {
for (GoblinStoreMgtGoodsAddSkuParam goodsAddSkuParam : this.getSkuParamList()) {
GoblinGoodsSkuInfoVo vo = GoblinGoodsSkuInfoVo.getNew();
vo.setSkuId(goodsInfoVo.getSpuId().concat(StringUtils.right(String.valueOf(System.nanoTime()), 5)));
vo.setSpuId(goodsInfoVo.getSpuId());
// vo.setSkuNo();
}
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -16,7 +15,7 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable {
private static final long serialVersionUID = -4712015317981742851L;
@ApiModelProperty(position = 10, value = "店铺ID")
private String storeId;
@ApiModelProperty(position = 11, value = "商品ID")
@ApiModelProperty(position = 11, value = "商品ID[64]")
private String spuId;
@ApiModelProperty(position = 12, value = "商品编码[默认为系统编码,也可手动输入商家自己的编码]")
private String spuNo;
......
......@@ -7,7 +7,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
@ApiModel(value = "GoblinGoodsSpecModelVo", description = "商品规格信息")
@ApiModel(value = "GoblinGoodsSpecVo", description = "商品规格信息")
@Data
public class GoblinGoodsSpecVo implements Serializable, Cloneable {
private static final long serialVersionUID = 2353354057235207501L;
......
......@@ -18,7 +18,6 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
......@@ -31,14 +30,44 @@ public class GoblinMongoUtils {
/* ---------------------------------------- 商品数据源 ---------------------------------------- */
// SPU信息
public GoblinGoodsInfoVo setGoodsInfoVo(GoblinGoodsInfoVo vo) {
return mongoTemplate.insert(vo, GoblinGoodsInfoVo.class.getSimpleName());
}
// SPU信息
public GoblinGoodsInfoVo getGoodsInfoVo(String spuId) {
return null;
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("shelvesStatus").is("3")),
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
}
// SPU信息
public boolean updateGoodsInfoVo(GoblinGoodsInfoVo vo) {
return mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName())
.updateOne(
Query.query(Criteria.where("spuId").is(vo.getSpuId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0;
}
// SPU信息
public GoblinGoodsSkuInfoVo setGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) {
return mongoTemplate.insert(vo, GoblinGoodsSkuInfoVo.class.getSimpleName());
}
// SKU信息
public GoblinGoodsSkuInfoVo getGoodsSkuInfoVo(String skuId) {
return null;
return mongoTemplate.findOne(Query.query(Criteria.where("skuId").is(skuId).and("shelvesStatus").is("3")),
GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
}
// SPU信息
public boolean updateGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) {
return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName())
.updateOne(
Query.query(Criteria.where("skuId").is(vo.getSpuId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0;
}
/* ---------------------------------------- ---------------------------------------- */
......@@ -60,7 +89,7 @@ public class GoblinMongoUtils {
* @param data
* @return
*/
public UpdateResult updateStoreMarket(String marketId, String storeId,GoblinStoreMarketVo data) {
public UpdateResult updateStoreMarket(String marketId, String storeId, GoblinStoreMarketVo data) {
BasicDBObject object = ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(data));
return mongoTemplate.getCollection(GoblinStoreMarketVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("storeMarketId").is(marketId).and("storeId").is(storeId)).getQueryObject(),
......
......@@ -5,11 +5,8 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Component
public class GoblinRedisUtils {
......@@ -20,6 +17,16 @@ public class GoblinRedisUtils {
/* ---------------------------------------- 商品数据源 ---------------------------------------- */
/**
* 商品基础信息
*
* @param vo GoblinGoodsInfoVo
* @return boolean
*/
public boolean setGoodsInfoVo(GoblinGoodsInfoVo vo) {
return redisUtil.set(GoblinRedisConst.BASIC_GOODS.concat(vo.getSpuId()), vo);
}
/**
* 商品基础信息
*
......@@ -35,6 +42,16 @@ public class GoblinRedisUtils {
return vo;
}
/**
* 单品信息
*
* @param vo GoblinGoodsSkuInfoVo
* @return boolean
*/
public boolean setGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) {
return redisUtil.set(GoblinRedisConst.BASIC_GOODS_SKU.concat(vo.getSkuId()), vo);
}
/**
* 单品信息
*
......
......@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.util;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.mongodb.BasicDBObject;
......@@ -10,17 +11,17 @@ import java.util.ArrayList;
public class ObjectUtil {
private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>();
private static final ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList = new ArrayList<>();
private static final ArrayList<GoblinSelfMarketingVo> goblinSelfMarketingVoArrayList = new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject();
private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>();
public static BasicDBObject cloneBasicDBObject() {
return (BasicDBObject) basicDBObject.clone();
}
private static final BasicDBObject basicDBObject = new BasicDBObject();
public static PagedResult<GoblinStoreMgtGoodsListVo> getGoblinStoreMgtGoodsVoPagedResult() {
return goblinStoreMgtGoodsVoPagedResult.clone();
}
public static ArrayList<GoblinFrontBanner> getGoblinFrontBannerArrayList() {
return (ArrayList<GoblinFrontBanner>) goblinFrontBannerArrayList.clone();
}
......@@ -28,4 +29,12 @@ public class ObjectUtil {
public static ArrayList<GoblinSelfMarketingVo> getGoblinSelfMarketingVoList() {
return (ArrayList<GoblinSelfMarketingVo>) goblinSelfMarketingVoArrayList.clone();
}
public static ArrayList<GoblinGoodsSkuInfoVo> getGoblinGoodsSkuInfoVoArrayList() {
return (ArrayList<GoblinGoodsSkuInfoVo>) goblinGoodsSkuInfoVoArrayList.clone();
}
public static BasicDBObject cloneBasicDBObject() {
return (BasicDBObject) basicDBObject.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