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

Commit 94a8a1ac authored by 胡佳晨's avatar 胡佳晨

提交 sku搜索接口

parent dbd81a91
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
@ApiModel(value = "GoblinStoreMgtGoodsFilterParam", description = "商品管理:商品列表筛选条件")
@Data
public class GoblinStoreMgtGoodsSkuFilterParam implements Serializable {
private static final long serialVersionUID = -4698854628491039006L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID[64]")
@NotBlank(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 21, required = true, value = "SpuId")
@NotBlank(message = "SPUID不能为空")
private String spuId;
@ApiModelProperty(position = 11, required = true, value = "当前记录起始索引", example = "1")
@Min(value = 1, message = "起始索引无效")
@NotNull(message = "起始索引无效")
private Integer pageNum;
@ApiModelProperty(position = 13, required = false, value = "搜索关键字[128]")
private String keyword;
@ApiModelProperty(position = 14, required = false, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架]", allowableValues = "0,1,2,3")
private String shelvesStatus;
}
package com.liquidnet.service.goblin.dto.manage.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ApiModel(value = "GoblinStoreMgtGoodsSkuListVo", description = "商品管理:商品款式信息")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinStoreMgtGoodsSkuListVo implements Serializable, Cloneable {
private static final long serialVersionUID = -5926827517337445529L;
@ApiModelProperty(position = 10, value = "店铺ID[64]")
private String storeId;
@ApiModelProperty(position = 11, value = "商品ID[64]")
private String spuId;
@ApiModelProperty(position = 12, value = "商品编码[45]")
private String skuId;
@ApiModelProperty(position = 14, value = "商品名称[100]")
private String name;
@ApiModelProperty(position = 20, value = "审核状态[0-编辑中|1-审核中|2-审核不通过|3-审核通过]")
private String status;
@ApiModelProperty(position = 22, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架]")
private String shelvesStatus;
@ApiModelProperty(position = 23, value = "总库存")
private Integer totalStock;
@ApiModelProperty(position = 24, value = "剩余库存")
private Integer surplusStock;
@ApiModelProperty(position = 27, value = "开售时间")
private String saleStartTime;
@ApiModelProperty(position = 27, value = "停售时间")
private String saleStopTime;
}
......@@ -4,6 +4,7 @@ import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
......@@ -19,6 +20,8 @@ public interface IGoblinstoreMgtGoodsService {
*/
PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam mgtGoodsFilterParam);
PagedResult<GoblinStoreMgtGoodsSkuListVo> skusList(GoblinStoreMgtGoodsSkuFilterParam mgtGoodsSkuFilterParam);
/**
* 商品管理:SPU添加
*
......
......@@ -18,6 +18,7 @@ import com.liquidnet.service.goblin.dto.GoblinStoreMgtGoodsListVoExcel;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuListVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
import com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService;
......@@ -79,6 +80,22 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.success(goblinstoreMgtGoodsService.goodsList(storeMgtGoodsFilterParam));
}
@ApiOperationSupport(order = 10)
@ApiOperation(value = "SKU搜索列表")
@PostMapping("edit_sku/search")
public ResponseDto<PagedResult<GoblinStoreMgtGoodsSkuListVo>> skuSearch(@Valid @RequestBody GoblinStoreMgtGoodsSkuFilterParam goblinStoreMgtGoodsSkuFilterParam) {
String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, goblinStoreMgtGoodsSkuFilterParam.getStoreId())) {
log.warn("商品管理:SKU搜索列表:无权操作该店铺,请核实[UID={},GoblinStoreMgtGoodsFilterParam={}]", currentUid, JsonUtils.toJson(goblinStoreMgtGoodsSkuFilterParam));
return ResponseDto.success();
}
if (log.isDebugEnabled()) {
log.debug("商品管理:SKU搜索列表:[GoblinStoreMgtGoodsFilterParam={}]", JsonUtils.toJson(goblinStoreMgtGoodsSkuFilterParam));
}
return ResponseDto.success(goblinstoreMgtGoodsService.skusList(goblinStoreMgtGoodsSkuFilterParam));
}
@ApiOperationSupport(order = 2)
@ApiOperation(value = "SPU导出")
@PostMapping("export")
......@@ -488,7 +505,8 @@ public class GoblinStoreMgtGoodsController {
if (StringUtils.isNotBlank(cateTid) && selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品三级分类无效");
}
if (goblinMongoUtils.countMgtGoodsInfoVo(mgtDigitalGoodsAddParam.getName()) > 0) return ResponseDto.failure(ErrorMapping.get("149007"));
if (goblinMongoUtils.countMgtGoodsInfoVo(mgtDigitalGoodsAddParam.getName()) > 0)
return ResponseDto.failure(ErrorMapping.get("149007"));
GoblinGoodsInfoVo initGoodsInfoVo = mgtDigitalGoodsAddParam.initGoodsInfoVo();
{// 标签处理
......@@ -748,7 +766,8 @@ public class GoblinStoreMgtGoodsController {
String paramSkuSpecDtoSpecName = paramSkuSpecDto.getSpecName();
String paramSkuSpecDtoSpecVname = paramSkuSpecDto.getSpecVname();
if (!befSkuSpecNameSet.contains(paramSkuSpecDtoSpecName)) return ResponseDto.failure(ErrorMapping.get("149014"));
if (!befSkuSpecNameSet.contains(paramSkuSpecDtoSpecName))
return ResponseDto.failure(ErrorMapping.get("149014"));
paramSkuSpecMap.put(paramSkuSpecDtoSpecName, paramSkuSpecDtoSpecVname);
if (!befSkuSpecNameVnameMap.get(paramSkuSpecDtoSpecName).equals(paramSkuSpecDtoSpecVname)) {
paramUpdateSkuSpecMap.put(paramSkuSpecDtoSpecName, paramSkuSpecDtoSpecVname);
......@@ -881,7 +900,8 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "限购数量不能为空");
}
String buyFactor = mgtDigitalGoodsEditSkuParam.getBuyFactor();
if (StringUtils.isEmpty(buyFactor)) return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定藏品购买条件");
if (StringUtils.isEmpty(buyFactor))
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定藏品购买条件");
// if (buyFactor.equals("2")) {// 购买条件:指定用户时
// if (StringUtils.isEmpty(mgtDigitalGoodsEditSkuParam.getBuyRosterType())) {
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "请指定购买限制人员名单操作类型");
......
......@@ -11,6 +11,7 @@ import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuListVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
......@@ -95,6 +96,12 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
return goodsListVoPagedResult;
}
@Override
public PagedResult<GoblinStoreMgtGoodsSkuListVo> skusList(GoblinStoreMgtGoodsSkuFilterParam mgtGoodsSkuFilterParam) {
PagedResult<GoblinStoreMgtGoodsSkuListVo> voList = goblinMongoUtils.getSkuSearch(mgtGoodsSkuFilterParam);
return voList;
}
@Override
public void goodsAdd(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList) {
goblinMongoUtils.setGoodsInfoVo(goodsInfoVo);
......
......@@ -6,10 +6,7 @@ import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.*;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
......@@ -60,9 +57,9 @@ public class GoblinMongoUtils {
/**
* 分页查询
*/
public HashMap<String,Object> getGoblinGoodsAnticipateValueVos(GoblinGoodsAnticipateValueParam goblinGoodsAnticipateValueParam) {
HashMap<String,Object> info = CollectionUtil.mapStringObject();
Pageable pageable = PageRequest.of(goblinGoodsAnticipateValueParam.getPageNum() - 1, goblinGoodsAnticipateValueParam.getPageSize(), Sort.by(Sort.Direction.DESC,"createdDate"));
public HashMap<String, Object> getGoblinGoodsAnticipateValueVos(GoblinGoodsAnticipateValueParam goblinGoodsAnticipateValueParam) {
HashMap<String, Object> info = CollectionUtil.mapStringObject();
Pageable pageable = PageRequest.of(goblinGoodsAnticipateValueParam.getPageNum() - 1, goblinGoodsAnticipateValueParam.getPageSize(), Sort.by(Sort.Direction.DESC, "createdDate"));
Criteria criteria = Criteria.where("delTag").is(0);
if (StringUtils.isNotBlank(goblinGoodsAnticipateValueParam.getName())) {
criteria = criteria.and("skuName").is(goblinGoodsAnticipateValueParam.getName());
......@@ -79,13 +76,12 @@ public class GoblinMongoUtils {
long count = mongoTemplate.count(query, GoblinGoodsAnticipateValueVo.class, GoblinGoodsAnticipateValueVo.class.getSimpleName());
query.with(pageable);
List<GoblinGoodsAnticipateValueVo> voList = mongoTemplate.find(query, GoblinGoodsAnticipateValueVo.class, GoblinGoodsAnticipateValueVo.class.getSimpleName());
info.put("total",count);
info.put("data",voList);
info.put("total", count);
info.put("data", voList);
return info;
}
/**
* 根据名称查询预约
*/
......@@ -131,14 +127,14 @@ public class GoblinMongoUtils {
*/
public void updateGoblinGoodsAnticipateVo(GoblinGoodsAnticipateUpdateParam goodsAnticipateUpdateParam) {
Query query = Query.query(Criteria.where("antId").is(goodsAnticipateUpdateParam.getAntId()));
Update update = new Update().set("name", goodsAnticipateUpdateParam.getName()).set("rule", goodsAnticipateUpdateParam.getRule()).set("updateDate",LocalDateTime.now());
Update update = new Update().set("name", goodsAnticipateUpdateParam.getName()).set("rule", goodsAnticipateUpdateParam.getRule()).set("updateDate", LocalDateTime.now());
mongoTemplate.updateFirst(query, update, GoblinGoodsAnticipateVo.class.getSimpleName());
}
/**
* 根据活动id查询关联
*/
public List<GoblinGoodsAnticipateValueVo> getGoodsAnticipateValues(String antId){
public List<GoblinGoodsAnticipateValueVo> getGoodsAnticipateValues(String antId) {
Criteria criteria = Criteria.where("antId").is(antId).and("delTag").is(0);
Query query = Query.query(criteria);
return mongoTemplate.find(query, GoblinGoodsAnticipateValueVo.class, GoblinGoodsAnticipateValueVo.class.getSimpleName());
......@@ -147,7 +143,7 @@ public class GoblinMongoUtils {
/**
* 根据用户预约
*/
public void delGoodsAnticipateUserVo(String uid,String skuId) {
public void delGoodsAnticipateUserVo(String uid, String skuId) {
Query query = Query.query(Criteria.where("uid").is(uid).and("skuId").is(skuId));
mongoTemplate.remove(query, GoblinGoodsAnticipateVo.class.getSimpleName()).getDeletedCount();
}
......@@ -155,11 +151,11 @@ public class GoblinMongoUtils {
public void delUserBySkuId(String skuId) {
Query query = Query.query(Criteria.where("skuId").is(skuId));
List<GoblinGoodAnticipateUserVo> goblinGoodAnticipateUserVos = mongoTemplate.find(query, GoblinGoodAnticipateUserVo.class, GoblinGoodAnticipateUserVo.class.getSimpleName());
if (goblinGoodAnticipateUserVos.size()>0){
goblinGoodAnticipateUserVos.forEach(goblinGoodAnticipateUserVo ->{
if (goblinGoodAnticipateUserVos.size() > 0) {
goblinGoodAnticipateUserVos.forEach(goblinGoodAnticipateUserVo -> {
redisUtils.del(GoblinRedisConst.USER_ANTICIPATE_STATE.concat(goblinGoodAnticipateUserVo.getSkuId()).concat(goblinGoodAnticipateUserVo.getUid()));
});
mongoTemplate.remove(query,GoblinGoodAnticipateUserVo.class.getSimpleName()).getDeletedCount();
mongoTemplate.remove(query, GoblinGoodAnticipateUserVo.class.getSimpleName()).getDeletedCount();
}
}
......@@ -189,13 +185,13 @@ public class GoblinMongoUtils {
/**
* 根据预约id删除sku关联信息
*/
public void delAnticipateValues(String antId){
public void delAnticipateValues(String antId) {
Query query = Query.query(Criteria.where("antId").is(antId));
//查询处所有的sku关联信息
List<GoblinGoodsAnticipateValueVo> goodsAnticipateValues = getGoodsAnticipateValues(antId);
if (goodsAnticipateValues != null && goodsAnticipateValues.size()>0){
if (goodsAnticipateValues != null && goodsAnticipateValues.size() > 0) {
goodsAnticipateValues.forEach(item -> {
redisUtils.delAnticipateValue(item.getSkuId());
redisUtils.delAnticipateValue(item.getSkuId());
});
}
mongoTemplate.remove(query, GoblinGoodsAnticipateValueVo.class.getSimpleName()).getDeletedCount();
......@@ -206,7 +202,7 @@ public class GoblinMongoUtils {
*/
public void updateAnticipateValueVo(GoblinGoodsAnticipateValueVo goodsAnticipateValueVo) {
Query query = Query.query(Criteria.where("antId").is(goodsAnticipateValueVo.getAntId()).and("skuId").is(goodsAnticipateValueVo.getSkuId()));
Update update = new Update().set("aboutStartDate", goodsAnticipateValueVo.getAboutStartDate()).set("aboutEndDate", goodsAnticipateValueVo.getAboutEndDate()).set("updateDate",LocalDateTime.now());
Update update = new Update().set("aboutStartDate", goodsAnticipateValueVo.getAboutStartDate()).set("aboutEndDate", goodsAnticipateValueVo.getAboutEndDate()).set("updateDate", LocalDateTime.now());
mongoTemplate.updateFirst(query, update, GoblinGoodsAnticipateValueVo.class.getSimpleName());
}
......@@ -1080,7 +1076,7 @@ public class GoblinMongoUtils {
//查询聚合数据
Aggregation aggregation = Aggregation.newAggregation(
Aggregation.match(criteria),
Aggregation.project("spuId", "skuPriceActual","orderType"),
Aggregation.project("spuId", "skuPriceActual", "orderType"),
Aggregation.group("spuId")
.first("spuId").as("spuId")
.first("orderType").as("orderType")
......@@ -1477,6 +1473,32 @@ public class GoblinMongoUtils {
return CollectionUtils.isEmpty(list) ? null : list.stream().map(GoblinUserDigitalArtworkVo::getArtworkId).collect(Collectors.toList());
}
public PagedResult<GoblinStoreMgtGoodsSkuListVo> getSkuSearch(GoblinStoreMgtGoodsSkuFilterParam filterParam) {
Criteria criteria = Criteria.where("storeId").is(filterParam.getStoreId()).and("SpuId").is(filterParam.getSpuId()).and("delFlg").is("0");
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.and("name").regex(pattern);
}
if (StringUtils.isNotBlank(filterParam.getShelvesStatus())) {
criteria.and("shelvesStatus").is(filterParam.getShelvesStatus());
}
Query query = Query.query(criteria);
long count = mongoTemplate.count(query, GoblinGoodsSkuInfoVo.class.getSimpleName());
PagedResult<GoblinStoreMgtGoodsSkuListVo> pagedResult = ObjectUtil.goblinStoreMgtGoodsSkuListVo();
if (count <= 0) return pagedResult;
query.with(PageRequest.of(filterParam.getPageNum() - 1, 20));
query.with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinStoreMgtGoodsSkuListVo> voList = mongoTemplate.find(query, GoblinStoreMgtGoodsSkuListVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
for (GoblinStoreMgtGoodsSkuListVo vo : voList) {
vo.setSurplusStock(redisUtils.getSkuStock(null, vo.getSkuId()));
}
return pagedResult.setList(voList).setTotal(count, 20);
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -5,10 +5,7 @@ import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMgtCouponListVoExcel;
import com.liquidnet.service.goblin.dto.GoblinStoreMgtGoodsListVoExcel;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponSpuListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtThumbVo;
import com.liquidnet.service.goblin.dto.manage.vo.*;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinOrderAttr;
......@@ -84,6 +81,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinPosGoodsVo> goblinPosGoodsVoArrayList = new ArrayList<>();
private static final ArrayList<TempCouponVo> tempCouponVo = new ArrayList<>();
private static final ArrayList<GoblinUserDigitalArtworkListVo> GOBLIN_USER_DIGITAL_ARTWORK_LIST_VO_ARRAY_LIST = new ArrayList<>();
private static final PagedResult<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVo = new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject();
private static final ArrayList<WriteModel<Document>> writeModelDocumentArrayList = new ArrayList<>();
......@@ -96,6 +94,10 @@ public class ObjectUtil {
return goblinStoreNoticeVoPagedResult.clone();
}
public static PagedResult<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVo() {
return goblinStoreMgtGoodsSkuListVo.clone();
}
public static PagedResult<GoblinStoreMgtCouponListVo> getGoblinStoreMgtCouponListVoPagedResult() {
return goblinStoreMgtCouponListVoPagedResult.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