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

Commit 69bc5a3a authored by 张国柄's avatar 张国柄

~API:商品管理:添加商品+规格入库;

parent dafba009
...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import java.io.Serializable; import java.io.Serializable;
...@@ -43,6 +44,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -43,6 +44,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
**/ **/
@ApiModelProperty(position = 12, required = true, value = "商品名称[128]") @ApiModelProperty(position = 12, required = true, value = "商品名称[128]")
@NotBlank(message = "商品名称不能为空")
private String name; private String name;
@ApiModelProperty(position = 13, required = false, value = "商品名称[128]") @ApiModelProperty(position = 13, required = false, value = "商品名称[128]")
private String subtitle; private String subtitle;
...@@ -50,6 +52,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -50,6 +52,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
private BigDecimal sellPrice; private BigDecimal sellPrice;
@ApiModelProperty(position = 15, required = true, value = "商品一级分类ID[30]") @ApiModelProperty(position = 15, required = true, value = "商品一级分类ID[30]")
@NotBlank(message = "商品分类ID不能为空")
private String cateFid; private String cateFid;
@ApiModelProperty(position = 16, required = true, value = "商品二级分类ID[30]") @ApiModelProperty(position = 16, required = true, value = "商品二级分类ID[30]")
private String cateSid; private String cateSid;
...@@ -219,11 +222,6 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -219,11 +222,6 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
public void initGoodsSkuInfoVo(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> vos, public void initGoodsSkuInfoVo(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> vos,
List<GoblinGoodsSpecVo> goodsSpecVos) { List<GoblinGoodsSpecVo> goodsSpecVos) {
List<GoblinStoreMgtGoodsAddSkuParam> mgtGoodsAddSkuParamList = this.getSkuParamList(); List<GoblinStoreMgtGoodsAddSkuParam> mgtGoodsAddSkuParamList = this.getSkuParamList();
if (CollectionUtils.isEmpty(mgtGoodsAddSkuParamList)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("149006");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
List<String> skuIdList = CollectionUtil.arrayListString(); List<String> skuIdList = CollectionUtil.arrayListString();
BigDecimal priceGe = BigDecimal.ZERO, priceLe = BigDecimal.ZERO; BigDecimal priceGe = BigDecimal.ZERO, priceLe = BigDecimal.ZERO;
int size = mgtGoodsAddSkuParamList.size(), skuSpecSize = 0; int size = mgtGoodsAddSkuParamList.size(), skuSpecSize = 0;
...@@ -304,8 +302,8 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -304,8 +302,8 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
List<String> skuSpecNListTmp = CollectionUtil.arrayListString();// 标记单个SKU的规格名称,用于校验 List<String> skuSpecNListTmp = CollectionUtil.arrayListString();// 标记单个SKU的规格名称,用于校验
for (int j = 0; j < specSize; j++) { for (int j = 0; j < specSize; j++) {
GoblinGoodsSpecDto specDto = skuSpecList.get(j); GoblinGoodsSpecDto specDto = skuSpecList.get(j);
String specName = specDto.getSpecName(); String specName = specDto.getSpecName().trim();
String specVname = specDto.getSpecVname(); String specVname = specDto.getSpecVname().trim();
skuname = skuname.concat(specVname); skuname = skuname.concat(specVname);
GoblinGoodsSpecValueVo specValueVo = GoblinGoodsSpecValueVo.getNew().setSpecVname(specVname).setSpecVsort(i); GoblinGoodsSpecValueVo specValueVo = GoblinGoodsSpecValueVo.getNew().setSpecVname(specVname).setSpecVsort(i);
......
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@ApiModel(value = "GoblinMgtCategorySpecVo", description = "分类关联的规格信息") @ApiModel(value = "GoblinMgtCategorySpecVo", description = "分类关联的规格信息")
@Data @Data
...@@ -12,12 +13,18 @@ public class GoblinMgtCategorySpecVo implements Serializable, Cloneable { ...@@ -12,12 +13,18 @@ public class GoblinMgtCategorySpecVo implements Serializable, Cloneable {
private static final long serialVersionUID = -1807588898644126000L; private static final long serialVersionUID = -1807588898644126000L;
@ApiModelProperty(position = 11, value = "分类ID") @ApiModelProperty(position = 11, value = "分类ID")
private String cateId; private String cateId;
@ApiModelProperty(position = 12, value = "规格ID") @ApiModelProperty(position = 13, value = "规格名称List")
private String specId; private List<String> specNameList;
@ApiModelProperty(position = 13, value = "规格名称")
private String specName; public GoblinMgtCategorySpecVo setCateId(String cateId) {
@ApiModelProperty(position = 14, value = "删除标记[0-未删除|1-删除") this.cateId = cateId;
private String delFlg; return this;
}
public GoblinMgtCategorySpecVo setSpecNameList(List<String> specNameList) {
this.specNameList = specNameList;
return this;
}
private static final GoblinMgtCategorySpecVo obj = new GoblinMgtCategorySpecVo(); private static final GoblinMgtCategorySpecVo obj = new GoblinMgtCategorySpecVo();
public static GoblinMgtCategorySpecVo getNew() { public static GoblinMgtCategorySpecVo getNew() {
......
...@@ -380,7 +380,7 @@ create table goblin_goods_spu_spec_value ...@@ -380,7 +380,7 @@ create table goblin_goods_spu_spec_value
comment varchar(255) comment varchar(255)
) engine = InnoDB comment '商品关联规格值'; ) engine = InnoDB comment '商品关联规格值';
create index idx_ggssv_spu_id on goblin_goods_spu_spec_value (spu_id); create unique index uidx_ggssv_spu_s_s on goblin_goods_spu_spec_value (spu_id, spec_name, spec_vname);
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
drop table if exists goblin_goods_sku_spec_value; drop table if exists goblin_goods_sku_spec_value;
create table goblin_goods_sku_spec_value create table goblin_goods_sku_spec_value
...@@ -395,7 +395,7 @@ create table goblin_goods_sku_spec_value ...@@ -395,7 +395,7 @@ create table goblin_goods_sku_spec_value
comment varchar(255) comment varchar(255)
) engine = InnoDB comment '单品关联规格值'; ) engine = InnoDB comment '单品关联规格值';
create index idx_ggssv_sku_id on goblin_goods_sku_spec_value (sku_id); create unique index uidx_ggssv_s_s_s on goblin_goods_sku_spec_value (sku_id, spec_name, spec_vname);
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
drop table if exists goblin_goods_spec_value; drop table if exists goblin_goods_spec_value;
......
...@@ -64,9 +64,9 @@ public class GoblinStoreMgtExtraController { ...@@ -64,9 +64,9 @@ public class GoblinStoreMgtExtraController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "cateId", value = "分类ID"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "cateId", value = "分类ID"),
}) })
@GetMapping("sg_catespecs") @GetMapping("sg_catespecs")
public ResponseDto<List<GoblinMgtCategorySpecVo>> categorySpecList(@RequestParam String cateId) { public ResponseDto<GoblinMgtCategorySpecVo> categorySpecList(@RequestParam String cateId) {
if (StringUtils.isBlank(cateId)) return ResponseDto.success(); if (StringUtils.isBlank(cateId)) return ResponseDto.success();
return ResponseDto.success(goblinMongoUtils.getCategorySpecVos(cateId)); return ResponseDto.success(goblinMongoUtils.getCategorySpecVo(cateId));
} }
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
......
...@@ -131,7 +131,9 @@ public class GoblinStoreMgtGoodsController { ...@@ -131,7 +131,9 @@ public class GoblinStoreMgtGoodsController {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("商品管理:SPU添加:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(storeMgtGoodsAddParam)); log.debug("商品管理:SPU添加:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(storeMgtGoodsAddParam));
} }
if (CollectionUtils.isEmpty(storeMgtGoodsAddParam.getSkuParamList())) {
return ResponseDto.failure(ErrorMapping.get("149006"));
}
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
GoblinGoodsInfoVo goodsInfoVo = storeMgtGoodsAddParam.initGoodsInfoVo(); GoblinGoodsInfoVo goodsInfoVo = storeMgtGoodsAddParam.initGoodsInfoVo();
goodsInfoVo.setCreatedBy(currentUid); goodsInfoVo.setCreatedBy(currentUid);
...@@ -170,6 +172,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -170,6 +172,7 @@ public class GoblinStoreMgtGoodsController {
goodsInfoVo.setServiceSupportVoList(goblinMongoUtils.getServiceSupportVos(storeMgtGoodsAddParam.getSsidList())); goodsInfoVo.setServiceSupportVoList(goblinMongoUtils.getServiceSupportVos(storeMgtGoodsAddParam.getSsidList()));
goblinstoreMgtGoodsService.goodsAdd(goodsInfoVo, goodsSkuInfoVoList); goblinstoreMgtGoodsService.goodsAdd(goodsInfoVo, goodsSkuInfoVoList);
return ResponseDto.success(goodsInfoVo.getSpuId()); return ResponseDto.success(goodsInfoVo.getSpuId());
} }
......
...@@ -52,11 +52,36 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -52,11 +52,36 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
goblinMongoUtils.setGoodsInfoVo(goodsInfoVo); goblinMongoUtils.setGoodsInfoVo(goodsInfoVo);
goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList); goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList);
// TODO: 2022/1/18 zhanggb== String createdBy = goodsInfoVo.getCreatedBy();
goodsSkuInfoVoList.forEach(r -> goblinRedisUtils.setSkuStock(null, r.getSkuId(), r.getSkuStock())); LocalDateTime createdAt = goodsInfoVo.getCreatedAt();
String spuId = goodsInfoVo.getSpuId(); String spuId = goodsInfoVo.getSpuId();
LinkedList<Object[]> initGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> initGoodsSkuSpecValueObjs = CollectionUtil.linkedListObjectArr();
// TODO: 2022/1/18 zhanggb==
int skuSize = goodsSkuInfoVoList.size();
for (int i = 0; i < skuSize; i++) {
GoblinGoodsSkuInfoVo skuInfoVo = goodsSkuInfoVoList.get(i);
String skuId = skuInfoVo.getSkuId();
goblinRedisUtils.setSkuStock(null, skuId, skuInfoVo.getSkuStock());
initGoodsSkuObjs.add(new Object[]{
skuId, skuInfoVo.getSpuId(), skuInfoVo.getSkuNo(), skuInfoVo.getName(), skuInfoVo.getSubtitle(),
skuInfoVo.getSellPrice(), skuInfoVo.getSkuPic(), skuInfoVo.getSkuIsbn(), skuInfoVo.getStock(), skuInfoVo.getSkuStock(),
skuInfoVo.getWarningStock(), skuInfoVo.getPrice(), skuInfoVo.getPriceMember(), skuInfoVo.getWeight(), skuInfoVo.getBuyFactor(),
skuInfoVo.getBuyRoster(), skuInfoVo.getBuyLimit(), skuInfoVo.getStoreId(), skuInfoVo.getSkuValidity(), skuInfoVo.getVirtualFlg(),
skuInfoVo.getStatus(), skuInfoVo.getShelvesStatus(), skuInfoVo.getSkuAppear(), skuInfoVo.getShelvesAt(), skuInfoVo.getCreatedBy(),
skuInfoVo.getCreatedAt(), skuInfoVo.getLogisticsTemplate()
});
skuInfoVo.getSkuSpecList().forEach(skuSpecDto -> initGoodsSkuSpecValueObjs.add(new Object[]{
spuId, skuId, skuSpecDto.getSpecName(), skuSpecDto.getSpecVname()
}));
}
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.insert")); toMqSqls.add(SqlMapping.get("goblin_goods.insert"));
LinkedList<Object[]> initGoodsObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initGoodsObjs = CollectionUtil.linkedListObjectArr();
...@@ -66,19 +91,18 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -66,19 +91,18 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
goodsInfoVo.getVideo(), goodsInfoVo.getSpecMode(), goodsInfoVo.getStoreId(), goodsInfoVo.getCateFid(), goodsInfoVo.getCateSid(), goodsInfoVo.getVideo(), goodsInfoVo.getSpecMode(), goodsInfoVo.getStoreId(), goodsInfoVo.getCateFid(), goodsInfoVo.getCateSid(),
goodsInfoVo.getCateTid(), goodsInfoVo.getStoreCateFid(), goodsInfoVo.getStoreCateSid(), goodsInfoVo.getStoreCateTid(), goodsInfoVo.getBrandId(), goodsInfoVo.getCateTid(), goodsInfoVo.getStoreCateFid(), goodsInfoVo.getStoreCateSid(), goodsInfoVo.getStoreCateTid(), goodsInfoVo.getBrandId(),
goodsInfoVo.getShelvesHandle(), goodsInfoVo.getShelvesTime(), goodsInfoVo.getSpuValidity(), goodsInfoVo.getVirtualFlg(), goodsInfoVo.getStatus(), goodsInfoVo.getShelvesHandle(), goodsInfoVo.getShelvesTime(), goodsInfoVo.getSpuValidity(), goodsInfoVo.getVirtualFlg(), goodsInfoVo.getStatus(),
goodsInfoVo.getShelvesStatus(), goodsInfoVo.getSpuAppear(), goodsInfoVo.getShelvesAt(), goodsInfoVo.getCreatedBy(), goodsInfoVo.getCreatedAt(), goodsInfoVo.getShelvesStatus(), goodsInfoVo.getSpuAppear(), goodsInfoVo.getShelvesAt(), goodsInfoVo.getCreatedBy(), createdAt,
goodsInfoVo.getLogisticsTemplate() goodsInfoVo.getLogisticsTemplate()
}); });
toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert")); toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert"));
LinkedList<Object[]> initGoodsSkuObjs = CollectionUtil.linkedListObjectArr(); // goodsSkuInfoVoList.forEach(skuInfoVo -> initGoodsSkuObjs.add(new Object[]{
goodsSkuInfoVoList.forEach(skuInfoVo -> initGoodsSkuObjs.add(new Object[]{ // skuInfoVo.getSkuId(), skuInfoVo.getSpuId(), skuInfoVo.getSkuNo(), skuInfoVo.getName(), skuInfoVo.getSubtitle(),
skuInfoVo.getSkuId(), skuInfoVo.getSpuId(), skuInfoVo.getSkuNo(), skuInfoVo.getName(), skuInfoVo.getSubtitle(), // skuInfoVo.getSellPrice(), skuInfoVo.getSkuPic(), skuInfoVo.getSkuIsbn(), skuInfoVo.getStock(), skuInfoVo.getSkuStock(),
skuInfoVo.getSellPrice(), skuInfoVo.getSkuPic(), skuInfoVo.getSkuIsbn(), skuInfoVo.getStock(), skuInfoVo.getSkuStock(), // skuInfoVo.getWarningStock(), skuInfoVo.getPrice(), skuInfoVo.getPriceMember(), skuInfoVo.getWeight(), skuInfoVo.getBuyFactor(),
skuInfoVo.getWarningStock(), skuInfoVo.getPrice(), skuInfoVo.getPriceMember(), skuInfoVo.getWeight(), skuInfoVo.getBuyFactor(), // skuInfoVo.getBuyRoster(), skuInfoVo.getBuyLimit(), skuInfoVo.getStoreId(), skuInfoVo.getSkuValidity(), skuInfoVo.getVirtualFlg(),
skuInfoVo.getBuyRoster(), skuInfoVo.getBuyLimit(), skuInfoVo.getStoreId(), skuInfoVo.getSkuValidity(), skuInfoVo.getVirtualFlg(), // skuInfoVo.getStatus(), skuInfoVo.getShelvesStatus(), skuInfoVo.getSkuAppear(), skuInfoVo.getShelvesAt(), skuInfoVo.getCreatedBy(),
skuInfoVo.getStatus(), skuInfoVo.getShelvesStatus(), skuInfoVo.getSkuAppear(), skuInfoVo.getShelvesAt(), skuInfoVo.getCreatedBy(), // skuInfoVo.getCreatedAt(), skuInfoVo.getLogisticsTemplate()
skuInfoVo.getCreatedAt(), skuInfoVo.getLogisticsTemplate() // }));
}));
toMqSqls.add(SqlMapping.get("goblin_goods_image.insert")); toMqSqls.add(SqlMapping.get("goblin_goods_image.insert"));
LinkedList<Object[]> initGoodsImageObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initGoodsImageObjs = CollectionUtil.linkedListObjectArr();
if (CollectionUtils.isEmpty(goodsInfoVo.getImageList())) { if (CollectionUtils.isEmpty(goodsInfoVo.getImageList())) {
...@@ -97,22 +121,45 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -97,22 +121,45 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
if (!CollectionUtils.isEmpty(goodsInfoVo.getServiceSupportVoList())) { if (!CollectionUtils.isEmpty(goodsInfoVo.getServiceSupportVoList())) {
goodsInfoVo.getServiceSupportVoList().forEach(ssvo -> initGoodsServiceSupportObjs.add(new Object[]{spuId, ssvo.getSsid()})); goodsInfoVo.getServiceSupportVoList().forEach(ssvo -> initGoodsServiceSupportObjs.add(new Object[]{spuId, ssvo.getSsid()}));
} }
toMqSqls.add(SqlMapping.get("goblin_goods_spec.insert_by_ignore"));
toMqSqls.add(SqlMapping.get("goblin_goods_spec_value.insert_by_ignore"));
LinkedList<Object[]> initGoodsSpecObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> initGoodsSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.insert_by_ignore"));// SPU规格信息
LinkedList<Object[]> initGoodsSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_sku_spec_value.insert_by_ignore"));// SKU规格信息
{// 规格记录 {// 规格记录
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList(); List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();
String cateFid = goodsInfoVo.getCateFid(); specVoList.forEach(s -> {
String cateSid = goodsInfoVo.getCateSid(); initGoodsSpecObjs.add(new Object[]{s.getSpecName(), createdAt});
String cateTid = goodsInfoVo.getCateTid(); s.getSpecValues().forEach(sv -> {
initGoodsSpecValueObjs.add(new Object[]{s.getSpecName(), sv.getSpecVname(), createdAt});
initGoodsSpuSpecValueObjs.add(new Object[]{spuId, s.getSpecName(), sv.getSpecVname(), sv.getSpecVsort()});
});
});
}
{// 分类规格记录
String cateFid = goodsInfoVo.getCateFid(), cateSid = goodsInfoVo.getCateSid(), cateTid = goodsInfoVo.getCateTid();
String filterCateId = StringUtils.isBlank(cateTid) ? (StringUtils.isBlank(cateSid) ? cateFid : cateSid) : cateTid; String filterCateId = StringUtils.isBlank(cateTid) ? (StringUtils.isBlank(cateSid) ? cateFid : cateSid) : cateTid;
List<GoblinMgtCategorySpecVo> categorySpecVoList = goblinMongoUtils.getCategorySpecVos(filterCateId); GoblinMgtCategorySpecVo mgtCategorySpecVoCache = goblinRedisUtils.getCategorySpec(filterCateId);// 分类绑定的规格信息
if (CollectionUtils.isEmpty(categorySpecVoList)) {// 根据分类ID未查取到规格信息,则新增 List<String> addSpecNameList = goodsSkuInfoVoList.get(0).getSkuSpecList().stream().map(GoblinGoodsSpecDto::getSpecName).collect(Collectors.toList());
if (null == mgtCategorySpecVoCache) {// 根据分类ID未查取到规格信息,则新增
GoblinMgtCategorySpecVo initMgtCategorySpecVo = GoblinMgtCategorySpecVo.getNew().setCateId(filterCateId).setSpecNameList(addSpecNameList);
// TODO: 2022/1/18 zhanggb==insert
} else {// 根据分类ID查取到规格信息,则进一步比对判断是否新增 } else {// 根据分类ID查取到规格信息,则进一步比对判断是否新增
List<String> confirmAddSpecNameList = addSpecNameList.stream().filter(r -> !mgtCategorySpecVoCache.getSpecNameList().contains(r)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(confirmAddSpecNameList)) {// 不存在于`mgtCategorySpecVoCache`的,则更新
mgtCategorySpecVoCache.getSpecNameList().addAll(confirmAddSpecNameList);
// TODO: 2022/1/18 zhanggb==update
}
} }
} }
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, initGoodsObjs, initGoodsSkuObjs, initGoodsImageObjs, initGoodsTagObjs, initGoodsServiceSupportObjs)); SqlMapping.gets(toMqSqls, initGoodsObjs, initGoodsSkuObjs, initGoodsImageObjs,
initGoodsTagObjs, initGoodsServiceSupportObjs, initGoodsSpecObjs, initGoodsSpecValueObjs,
initGoodsSpecObjs, initGoodsSpecValueObjs, initGoodsSpuSpecValueObjs, initGoodsSkuSpecValueObjs)
);
} }
@Override @Override
......
...@@ -48,8 +48,7 @@ public class GoblinMongoUtils { ...@@ -48,8 +48,7 @@ public class GoblinMongoUtils {
/* ---------------------------------------- 平台分类数据源 ---------------------------------------- */ /* ---------------------------------------- 平台分类数据源 ---------------------------------------- */
public List<GoblinSelfGoodsCategoryVo> getSelfGoodsCategoryVos() { public List<GoblinSelfGoodsCategoryVo> getSelfGoodsCategoryVos() {
return mongoTemplate.find(Query.query(Criteria.where("delFlg").is("0")), return mongoTemplate.findAll(GoblinSelfGoodsCategoryVo.class, GoblinSelfGoodsCategoryVo.class.getSimpleName());
GoblinSelfGoodsCategoryVo.class, GoblinSelfGoodsCategoryVo.class.getSimpleName());
} }
/* ---------------------------------------- 店铺分类数据源 ---------------------------------------- */ /* ---------------------------------------- 店铺分类数据源 ---------------------------------------- */
...@@ -72,8 +71,8 @@ public class GoblinMongoUtils { ...@@ -72,8 +71,8 @@ public class GoblinMongoUtils {
/* ---------------------------------------- 平台分类规格数据源 ---------------------------------------- */ /* ---------------------------------------- 平台分类规格数据源 ---------------------------------------- */
public List<GoblinMgtCategorySpecVo> getCategorySpecVos(String cateId) { public GoblinMgtCategorySpecVo getCategorySpecVo(String cateId) {
return mongoTemplate.find(Query.query(Criteria.where("cateId").is(cateId).and("delFlg").is("0")), return mongoTemplate.findOne(Query.query(Criteria.where("cateId").is(cateId)),
GoblinMgtCategorySpecVo.class, GoblinMgtCategorySpecVo.class.getSimpleName()); GoblinMgtCategorySpecVo.class, GoblinMgtCategorySpecVo.class.getSimpleName());
} }
......
...@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil; ...@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil; import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -138,6 +139,17 @@ public class GoblinRedisUtils { ...@@ -138,6 +139,17 @@ public class GoblinRedisUtils {
return vos; return vos;
} }
/* ---------------------------------------- 平台分类规格数据源 ---------------------------------------- */
public GoblinMgtCategorySpecVo getCategorySpec(String cateId) {
String rk = GoblinRedisConst.BASIC_SELF_GOODS_CATEGORY_SPEC.concat(cateId);
GoblinMgtCategorySpecVo vo = (GoblinMgtCategorySpecVo) redisUtil.get(rk);
if (null == vo && null != (vo = goblinMongoUtils.getCategorySpecVo(cateId))) {
// redisUtil.set(rk, vo);// TODO: 2022/1/18 zhanggb==
}
return vo;
}
/* ---------------------------------------- 服务支持数据源 ---------------------------------------- */ /* ---------------------------------------- 服务支持数据源 ---------------------------------------- */
public List<GoblinServiceSupportVo> getServiceSupportVos() { public List<GoblinServiceSupportVo> getServiceSupportVos() {
......
...@@ -20,6 +20,14 @@ goblin_store_notice.remove=UPDATE goblin_store_notice SET del_flg='1',updated_by ...@@ -20,6 +20,14 @@ goblin_store_notice.remove=UPDATE goblin_store_notice SET del_flg='1',updated_by
goblin_store_goods_category.insert=INSERT INTO goblin_store_goods_category (store_id,cate_id,name,sort,grade,cate_pid,ne_isbn,created_by,created_at)VALUES(?,?,?,?,?,?,?,?,?) goblin_store_goods_category.insert=INSERT INTO goblin_store_goods_category (store_id,cate_id,name,sort,grade,cate_pid,ne_isbn,created_by,created_at)VALUES(?,?,?,?,?,?,?,?,?)
goblin_store_goods_category.update=UPDATE goblin_store_goods_category SET name=?,sort=?,updated_by=?,updated_at=? WHERE store_id=? AND cate_id=? goblin_store_goods_category.update=UPDATE goblin_store_goods_category SET name=?,sort=?,updated_by=?,updated_at=? WHERE store_id=? AND cate_id=?
goblin_store_goods_category.remove=UPDATE goblin_store_goods_category SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,updated_at=? WHERE store_id=? AND cate_id=? goblin_store_goods_category.remove=UPDATE goblin_store_goods_category SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,updated_at=? WHERE store_id=? AND cate_id=?
#---- 商品分类规格信息
#---- 商品规格信息
goblin_goods_spec.insert_by_ignore=INSERT IGNORE INTO goblin_goods_spec (spec_name,created_by,created_at)VALUES(?,'-',?)
goblin_goods_spec_value.insert_by_ignore=INSERT IGNORE INTO goblin_goods_spec_value (spec_name,spec_vname,created_by,created_at)VALUES(?,?,'-',?)
#---- 商品关联规格信息
goblin_goods_spu_spec_value.insert_by_ignore=INSERT IGNORE INTO goblin_goods_spu_spec_value (spu_id,spec_name,spec_vname,sort)VALUES(?,?,?,?)
goblin_goods_sku_spec_value.insert_by_ignore=INSERT IGNORE INTO goblin_goods_sku_spec_value (spu_id,sku_id,spec_name,spec_vname)VALUES(?,?,?,?)
#---- 商品信息 #---- 商品信息
goblin_goods.insert=INSERT INTO goblin_goods (spu_id,spu_no,name,subtitle,sell_price, price_ge,price_le,intro,details,cover_pic, video,spec_mode,store_id,cate_fid,cate_sid, cate_tid,store_cate_fid,store_cate_sid,store_cate_tid,brand_id, shelves_handle,shelves_time,spu_validity,virtual_flg,status, shelves_status,spu_appear,shelves_at,created_by,created_at, logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_goods.insert=INSERT INTO goblin_goods (spu_id,spu_no,name,subtitle,sell_price, price_ge,price_le,intro,details,cover_pic, video,spec_mode,store_id,cate_fid,cate_sid, cate_tid,store_cate_fid,store_cate_sid,store_cate_tid,brand_id, shelves_handle,shelves_time,spu_validity,virtual_flg,status, shelves_status,spu_appear,shelves_at,created_by,created_at, logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_goods.update_by_shelves=UPDATE goblin_goods SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='0' goblin_goods.update_by_shelves=UPDATE goblin_goods SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='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