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

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

~商品列表查取;

parent c2a2d26d
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
......@@ -175,6 +176,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
List<GoblinStoreMgtGoodsAddSkuParam> mgtGoodsAddSkuParamList = this.getSkuParamList();
int size = mgtGoodsAddSkuParamList.size();
ArrayList<String> skuIdList = CollectionUtil.arrayListString();
BigDecimal priceGe = BigDecimal.ZERO, priceLe = BigDecimal.ZERO;
for (int i = 0; i < size; i++) {
GoblinStoreMgtGoodsAddSkuParam addSkuParam = mgtGoodsAddSkuParamList.get(i);
......@@ -218,7 +220,9 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
List<GoblinGoodsSpecDto> skuSpecList = addSkuParam.getSkuSpecList();
vo.setSkuSpecList(skuSpecList);
vos.add(vo);
skuIdList.add(vo.getSkuId());
int specSize = skuSpecList.size();// SKU包含的规格数量
for (int j = 0; j < specSize; j++) {
......@@ -240,5 +244,6 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
goodsInfoVo.setPriceGe(priceGe);
goodsInfoVo.setPriceLe(priceLe);
goodsInfoVo.setSpecVoList(goodsSpecVos);
goodsInfoVo.setSkuIdList(skuIdList);
}
}
......@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -13,25 +15,29 @@ import java.math.BigDecimal;
@Data
public class GoblinStoreMgtGoodsFilterParam implements Serializable {
private static final long serialVersionUID = -4698854628491039006L;
@ApiModelProperty(position = 11, value = "当前记录起始索引", example = "1")
@ApiModelProperty(position = 10, required = false, value = "店铺ID[64]")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "当前记录起始索引", example = "1")
@Min(1)
private Integer pageNum;
@ApiModelProperty(position = 12, value = "每页显示记录数", example = "20")
@ApiModelProperty(position = 12, required = true, value = "每页显示记录数", example = "20")
@Max(100)
private Integer pageSize;
@ApiModelProperty(position = 13, value = "搜索关键字[128]")
@ApiModelProperty(position = 13, required = false, value = "搜索关键字[128]")
private String keyword;
@ApiModelProperty(position = 14, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架]", allowableValues = "0,1,2,3")
@ApiModelProperty(position = 14, required = false, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架]", allowableValues = "0,1,2,3")
private String shelvesStatus;
@ApiModelProperty(position = 15, value = "商品一级分类ID[30]")
@ApiModelProperty(position = 15, required = false, value = "商品一级分类ID[30]")
private String cateFid;
@ApiModelProperty(position = 16, value = "商品二级分类ID[30]")
@ApiModelProperty(position = 16, required = false, value = "商品二级分类ID[30]")
private String cateSid;
@ApiModelProperty(position = 17, value = "商品三级分类ID[30]")
@ApiModelProperty(position = 17, required = false, value = "商品三级分类ID[30]")
private String cateTid;
@ApiModelProperty(position = 18, value = "创建日期[YYYY-MM-DD]")
@ApiModelProperty(position = 18, required = false, value = "创建日期[YYYY-MM-DD]")
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "创建日期格式有误")
private String createdDt;
@ApiModelProperty(position = 19, value = "价格区间MIN")
private BigDecimal priceMin;
@ApiModelProperty(position = 20, value = "价格区间MAX")
private BigDecimal priceMax;
@ApiModelProperty(position = 19, required = false, value = "价格区间MIN")
private BigDecimal priceGe;
@ApiModelProperty(position = 20, required = false, value = "价格区间MAX")
private BigDecimal priceLe;
}
......@@ -85,11 +85,11 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 51, value = "规格信息")
private List<GoblinGoodsSpecVo> specVoList;
@ApiModelProperty(position = 52, value = "商品标签列表")
private List<GoblinGoodsTagVo> tagVoList;
private List<GoblinSelfGoodsTagVo> tagVoList;
@ApiModelProperty(position = 53, value = "商品服务支持列表")
private List<GoblinGoodsServiceSupportVo> serviceSupportVoList;
private List<GoblinServiceSupportVo> serviceSupportVoList;
@ApiModelProperty(position = 54, value = "音乐人、艺术家、IP列表")
private List<GoblinGoodsExtagVo> extagVoList;
private List<GoblinSelfExtagVo> extagVoList;
@ApiModelProperty(position = 55, value = "活动Id")
private String marketId;
......
......@@ -6,9 +6,9 @@ import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "GoblinGoodsExtagVo", description = "商品音乐人标签信息")
@ApiModel(value = "GoblinSelfExtagVo", description = "音乐人、艺人、IP信息")
@Data
public class GoblinGoodsExtagVo implements Serializable, Cloneable {
public class GoblinSelfExtagVo implements Serializable, Cloneable {
private static final long serialVersionUID = 367926424789690081L;
@ApiModelProperty(position = 10, value = "标签ID")
private String tagId;
......@@ -21,12 +21,12 @@ public class GoblinGoodsExtagVo implements Serializable, Cloneable {
@ApiModelProperty(position = 14, value = "标签图片")
private String tagPic;
private static final GoblinGoodsExtagVo obj = new GoblinGoodsExtagVo();
public static GoblinGoodsExtagVo getNew() {
private static final GoblinSelfExtagVo obj = new GoblinSelfExtagVo();
public static GoblinSelfExtagVo getNew() {
try {
return (GoblinGoodsExtagVo) obj.clone();
return (GoblinSelfExtagVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinGoodsExtagVo();
return new GoblinSelfExtagVo();
}
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "GoblinGoodsTagVo", description = "商品标签信息")
@ApiModel(value = "GoblinSelfGoodsTagVo", description = "标签信息")
@Data
public class GoblinGoodsTagVo implements Serializable, Cloneable {
public class GoblinSelfGoodsTagVo implements Serializable, Cloneable {
private static final long serialVersionUID = -2342407105969740471L;
@ApiModelProperty(position = 11, value = "标签ID")
private String tagId;
......@@ -18,12 +17,12 @@ public class GoblinGoodsTagVo implements Serializable, Cloneable {
@ApiModelProperty(position = 13, value = "排序[数值越小,排序越前]")
private Integer sort;
private static final GoblinGoodsTagVo obj = new GoblinGoodsTagVo();
public static GoblinGoodsTagVo getNew() {
private static final GoblinSelfGoodsTagVo obj = new GoblinSelfGoodsTagVo();
public static GoblinSelfGoodsTagVo getNew() {
try {
return (GoblinGoodsTagVo) obj.clone();
return (GoblinSelfGoodsTagVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinGoodsTagVo();
return new GoblinSelfGoodsTagVo();
}
}
}
......@@ -6,9 +6,9 @@ import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "GoblinGoodsServiceSupportVo", description = "商品服务保障信息")
@ApiModel(value = "GoblinServiceSupportVo", description = "服务保障信息")
@Data
public class GoblinGoodsServiceSupportVo implements Serializable, Cloneable {
public class GoblinServiceSupportVo implements Serializable, Cloneable {
private static final long serialVersionUID = -6408263563025607959L;
@ApiModelProperty(position = 10, value = "服务支持ID[30]")
private String ssid;
......@@ -19,12 +19,12 @@ public class GoblinGoodsServiceSupportVo implements Serializable, Cloneable {
@ApiModelProperty(position = 13, value = "服务支持图片地址[256]")
private String url;
private static final GoblinGoodsServiceSupportVo obj = new GoblinGoodsServiceSupportVo();
public static GoblinGoodsServiceSupportVo getNew() {
private static final GoblinServiceSupportVo obj = new GoblinServiceSupportVo();
public static GoblinServiceSupportVo getNew() {
try {
return (GoblinGoodsServiceSupportVo) obj.clone();
return (GoblinServiceSupportVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinGoodsServiceSupportVo();
return new GoblinServiceSupportVo();
}
}
}
package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsActionParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSpecVo;
import com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil;
import com.liquidnet.service.goblin.util.QueueUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Service
public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsService {
@Autowired
QueueUtils queueUtils;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
GoblinMongoUtils goblinMongoUtils;
@Override
public PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam storeMgtGoodsFilterParam) {
return null;// TODO: 2021/12/27 zhanggb
public PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam filterParam) {
return goblinMongoUtils.getGoodsInfoVo(filterParam);
}
@Override
public void goodsAdd(GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam) {
// TODO: 2021/12/27 zhanggb
String uid = CurrentUtil.getCurrentUid();
LocalDateTime now = LocalDateTime.now();
GoblinGoodsInfoVo vo = storeMgtGoodsAddParam.initGoodsInfoVo();
vo.setCreatedBy(uid);
vo.setCreatedAt(now);
ArrayList<GoblinGoodsSpecVo> goodsSpecVoList = ObjectUtil.getGoblinGoodsSpecVoArrayList();
List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList = ObjectUtil.getGoblinGoodsSkuInfoVoArrayList();
storeMgtGoodsAddParam.initGoodsSkuInfoVo(vo, goodsSkuInfoVoList, goodsSpecVoList);
// vo.setTagVoList();
// vo.setServiceSupportVoList();
// vo.setExtagVoList();
goblinMongoUtils.setGoodsInfoVo(vo);
goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList);
}
@Override
......
......@@ -2,12 +2,17 @@ package com.liquidnet.service.goblin.util;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfGoodsTagVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreMarketVo;
import com.mongodb.BasicDBObject;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
......@@ -18,8 +23,10 @@ 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;
import java.util.regex.Pattern;
@Component
public class GoblinMongoUtils {
......@@ -28,6 +35,18 @@ public class GoblinMongoUtils {
@Autowired
MongoConverter mongoConverter;
/* ---------------------------------------- 标签数据源 ---------------------------------------- */
//
public List<GoblinSelfGoodsTagVo> getGoodsTagVos(List<String> tagIds) {
return null;
}
/* ---------------------------------------- 服务保障数据源 ---------------------------------------- */
/* ---------------------------------------- 商品数据源 ---------------------------------------- */
// SPU信息
......@@ -39,6 +58,55 @@ public class GoblinMongoUtils {
mongoTemplate.remove(Query.query(Criteria.where("spuId").is(spuId)), GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
}
// SPU分页
public PagedResult<GoblinStoreMgtGoodsListVo> getGoodsInfoVo(GoblinStoreMgtGoodsFilterParam filterParam) {
Criteria criteria = new Criteria();
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.orOperator(
Criteria.where("name").regex(pattern)
);
}
if (StringUtils.isNotBlank(filterParam.getShelvesStatus())) {
criteria.andOperator(Criteria.where("shelvesStatus").is(filterParam.getShelvesStatus()));
}
if (StringUtils.isNotBlank(filterParam.getCateFid())) {
criteria.andOperator(Criteria.where("cateFid").is(filterParam.getCateFid()));
}
if (StringUtils.isNotBlank(filterParam.getCateSid())) {
criteria.andOperator(Criteria.where("cateSid").is(filterParam.getCateSid()));
}
if (StringUtils.isNotBlank(filterParam.getCateTid())) {
criteria.andOperator(Criteria.where("cateTid").is(filterParam.getCateTid()));
}
if (StringUtils.isNotBlank(filterParam.getCreatedDt())) {
LocalDateTime createDt = DateUtil.Formatter.yyyy_MM_dd.parse(filterParam.getCreatedDt());
LocalDateTime createdAtBegin = createDt.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime createdAtEnd = createDt.withHour(23).withMinute(59).withSecond(59).withNano(999);
criteria.andOperator(Criteria.where("createdAt").gte(createdAtBegin).lte(createdAtEnd));
}
if (null != filterParam.getPriceGe()) {
criteria.andOperator(Criteria.where("priceGe").gte(filterParam.getPriceGe()));
}
if (null != filterParam.getPriceLe()) {
criteria.andOperator(Criteria.where("priceGe").lte(filterParam.getPriceLe()));
}
Query query = Query.query(criteria);
long count = mongoTemplate.count(query, GoblinGoodsInfoVo.class.getSimpleName());
PagedResult<GoblinStoreMgtGoodsListVo> pagedResult = ObjectUtil.getGoblinStoreMgtGoodsVoPagedResult();
if (count <= 0) return pagedResult;
query.with(PageRequest.of(filterParam.getPageNum() - 1, filterParam.getPageSize()));
query.with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinStoreMgtGoodsListVo> goodsListVos = mongoTemplate.find(query, GoblinStoreMgtGoodsListVo.class, GoblinGoodsInfoVo.class.getSimpleName());
return pagedResult.setList(goodsListVos).setTotal(count, filterParam.getPageSize());
}
// SPU信息
public GoblinGoodsInfoVo getGoodsInfoVo(String spuId) {
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("shelvesStatus").is("3")),
......@@ -59,6 +127,11 @@ public class GoblinMongoUtils {
return mongoTemplate.insert(vo, GoblinGoodsSkuInfoVo.class.getSimpleName());
}
// SKU信息
public List<GoblinGoodsSkuInfoVo> setGoodsSkuInfoVos(List<GoblinGoodsSkuInfoVo> vos) {
return (List<GoblinGoodsSkuInfoVo>) mongoTemplate.insert(vos, GoblinGoodsSkuInfoVo.class.getSimpleName());
}
public void delGoodsSkuInfoVo(String skuId) {
mongoTemplate.remove(Query.query(Criteria.where("skuId").is(skuId)), GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
}
......
......@@ -19,9 +19,6 @@ public class ObjectUtil {
private static final ArrayList<GoblinSelfMarketingVo> goblinSelfMarketingVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsTagVo> goblinGoodsTagVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsServiceSupportVo> goblinGoodsServiceSupportVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsExtagVo> goblinGoodsExtagVoArrayList = new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject();
......@@ -48,18 +45,6 @@ public class ObjectUtil {
return (ArrayList<GoblinGoodsSpecVo>) goblinGoodsSpecVoArrayList.clone();
}
public static ArrayList<GoblinGoodsTagVo> getGoblinGoodsTagVoArrayList() {
return (ArrayList<GoblinGoodsTagVo>) goblinGoodsTagVoArrayList.clone();
}
public static ArrayList<GoblinGoodsServiceSupportVo> getGoblinGoodsServiceSupportVoArrayList() {
return (ArrayList<GoblinGoodsServiceSupportVo>) goblinGoodsServiceSupportVoArrayList.clone();
}
public static ArrayList<GoblinGoodsExtagVo> getGoblinGoodsExtagVoArrayList() {
return (ArrayList<GoblinGoodsExtagVo>) goblinGoodsExtagVoArrayList.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