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

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

~API;

parent 7ab63305
...@@ -149,7 +149,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -149,7 +149,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
// vo.setPriceLe(BigDecimal.ZERO); // vo.setPriceLe(BigDecimal.ZERO);
vo.setIntro(this.getIntro()); vo.setIntro(this.getIntro());
vo.setDetails(this.getDetails()); vo.setDetails(this.getDetails());
vo.setCoverPic(this.getCoverPic()); vo.setCoverPic(StringUtils.isBlank(this.getCoverPic()) ? this.getImageList().get(0) : this.getCoverPic());
vo.setVideo(this.getVideo()); vo.setVideo(this.getVideo());
vo.setSpecMode(this.getSpecMode()); vo.setSpecMode(this.getSpecMode());
vo.setCateFid(this.getCateFid()); vo.setCateFid(this.getCateFid());
...@@ -197,7 +197,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -197,7 +197,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
vo.setSellPrice(this.getSellPrice()); vo.setSellPrice(this.getSellPrice());
vo.setIntro(this.getIntro()); vo.setIntro(this.getIntro());
vo.setDetails(this.getDetails()); vo.setDetails(this.getDetails());
vo.setCoverPic(this.getCoverPic()); vo.setCoverPic(StringUtils.isBlank(this.getCoverPic()) ? this.getImageList().get(0) : this.getCoverPic());
vo.setVideo(this.getVideo()); vo.setVideo(this.getVideo());
vo.setSpecMode(this.getSpecMode()); vo.setSpecMode(this.getSpecMode());
vo.setCateFid(this.getCateFid()); vo.setCateFid(this.getCateFid());
...@@ -288,7 +288,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -288,7 +288,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
vos.add(skuInfoVo); vos.add(skuInfoVo);
skuIdList.add(skuInfoVo.getSkuId()); skuIdList.add(skuInfoVo.getSkuId());
priceGe = priceGe.compareTo(skuInfoVo.getPrice()) > 0 ? skuInfoVo.getPrice() : priceGe; priceGe = priceGe.compareTo(BigDecimal.ZERO) == 0 ? skuInfoVo.getPrice() : (priceGe.compareTo(skuInfoVo.getPrice()) > 0 ? skuInfoVo.getPrice() : priceGe);
priceLe = priceLe.compareTo(skuInfoVo.getPrice()) < 0 ? skuInfoVo.getPrice() : priceLe; priceLe = priceLe.compareTo(skuInfoVo.getPrice()) < 0 ? skuInfoVo.getPrice() : priceLe;
if (CollectionUtils.isEmpty(skuSpecList) || (skuSpecSize > 0 && skuSpecSize != skuSpecList.size())) { if (CollectionUtils.isEmpty(skuSpecList) || (skuSpecSize > 0 && skuSpecSize != skuSpecList.size())) {
......
...@@ -9,7 +9,10 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -9,7 +9,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -29,6 +32,8 @@ public class GoblinStoreMgtGoodsEditSkuParam implements Serializable { ...@@ -29,6 +32,8 @@ public class GoblinStoreMgtGoodsEditSkuParam implements Serializable {
@ApiModelProperty(position = 13, required = true, value = "单品默认图片的url[256]") @ApiModelProperty(position = 13, required = true, value = "单品默认图片的url[256]")
private String skuPic; private String skuPic;
@ApiModelProperty(position = 14, required = true, value = "单品规格信息") @ApiModelProperty(position = 14, required = true, value = "单品规格信息")
@Valid
@NotNull(message = "规格信息不能为空")
private List<GoblinGoodsSpecDto> skuSpecList; private List<GoblinGoodsSpecDto> skuSpecList;
@ApiModelProperty(position = 15, required = false, value = "单品销售价-原价[20,2]") @ApiModelProperty(position = 15, required = false, value = "单品销售价-原价[20,2]")
private BigDecimal sellPrice; private BigDecimal sellPrice;
......
...@@ -8,6 +8,7 @@ import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo; ...@@ -8,6 +8,7 @@ import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IGoblinstoreMgtGoodsService { public interface IGoblinstoreMgtGoodsService {
/** /**
...@@ -38,10 +39,11 @@ public interface IGoblinstoreMgtGoodsService { ...@@ -38,10 +39,11 @@ public interface IGoblinstoreMgtGoodsService {
/** /**
* 商品管理:商品编辑:SPU编辑 * 商品管理:商品编辑:SPU编辑
* *
* @param uid UID
* @param storeMgtGoodsAddParam GoblinStoreMgtGoodsAddParam * @param storeMgtGoodsAddParam GoblinStoreMgtGoodsAddParam
* @return boolean * @return boolean
*/ */
boolean goodsEditSpu(GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam); boolean goodsEditSpu(String uid, GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam);
/** /**
* 商品管理:商品编辑:SKU编辑 * 商品管理:商品编辑:SKU编辑
...@@ -49,35 +51,40 @@ public interface IGoblinstoreMgtGoodsService { ...@@ -49,35 +51,40 @@ public interface IGoblinstoreMgtGoodsService {
* @param uid UID * @param uid UID
* @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam * @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam
* @param goodsInfoVo GoblinGoodsInfoVo * @param goodsInfoVo GoblinGoodsInfoVo
* @param delSpuSpecMap Map<String, String>
* @param beUpdateSpuSpecFlg boolean
* @return boolean * @return boolean
*/ */
boolean goodsEditSku(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo); boolean goodsEditSku(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam,
GoblinGoodsInfoVo goodsInfoVo, Map<String, String> delSpuSpecMap, boolean beUpdateSpuSpecFlg);
/** /**
* 商品管理:商品编辑:SKU添加 * 商品管理:商品编辑:SKU添加
* *
* @param uid UID
* @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam * @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam
* @param goodsInfoVo GoblinGoodsInfoVo * @param goodsInfoVo GoblinGoodsInfoVo
*/ */
void goodsEditSkuAdd(GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo); void goodsEditSkuAdd(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo);
/** /**
* 商品管理:商品编辑:SKU删除 * 商品管理:商品编辑:SKU删除
* *
* @param uid UID
* @param goodsSkuInfoVo GoblinGoodsSkuInfoVo * @param goodsSkuInfoVo GoblinGoodsSkuInfoVo
* @return boolean * @return boolean
*/ */
boolean goodsEditSkuDel(GoblinGoodsSkuInfoVo goodsSkuInfoVo); boolean goodsEditSkuDel(String uid, GoblinGoodsSkuInfoVo goodsSkuInfoVo);
/** // /**
* 商品管理:商品编辑:SKU批改 // * 商品管理:商品编辑:SKU批改
* // *
* @param spuId 商品ID // * @param spuId 商品ID
* @param batField 批量修改属性 // * @param batField 批量修改属性
* @param batFieldVal 批量修改属性值 // * @param batFieldVal 批量修改属性值
* @return boolean // * @return boolean
*/ // */
boolean goodsEditSkuBat(String spuId, String batField, String batFieldVal); // boolean goodsEditSkuBat(String spuId, String batField, String batFieldVal);
/** /**
* 商品管理:上下架商品 * 商品管理:上下架商品
......
...@@ -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 unique index uidx_ggssv_spu_s_s on goblin_goods_spu_spec_value (spu_id, spec_name, spec_vname); create unique index uidx_ggssv_spu_s_s on goblin_goods_spu_spec_value (spu_id, spec_name, spec_vname, del_flg);
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
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 unique index uidx_ggssv_s_s_s on goblin_goods_sku_spec_value (sku_id, spec_name, spec_vname); create unique index uidx_ggssv_s_s_s on goblin_goods_sku_spec_value (sku_id, spec_name, del_flg);
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
drop table if exists goblin_goods_spec_value; drop table if exists goblin_goods_spec_value;
......
...@@ -103,6 +103,10 @@ public class GoblinStoreMgtCertificationController { ...@@ -103,6 +103,10 @@ public class GoblinStoreMgtCertificationController {
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) { if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
if (null == storeInfoVo || Arrays.asList("3","4","5").contains(storeInfoVo.getStatus())) {
return ResponseDto.success();// 店铺认证通过后不允许删除
}
log.info("删除店铺[UID={},storeId={}]", currentUid, storeId); log.info("删除店铺[UID={},storeId={}]", currentUid, storeId);
return ResponseDto.success(goblinStoreMgtCertificationService.certificationCancelProcessing(storeId, currentUid)); return ResponseDto.success(goblinStoreMgtCertificationService.certificationCancelProcessing(storeId, currentUid));
} }
......
...@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.controller.manage; ...@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.controller.manage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.common.exception.constant.ErrorCode;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil; import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
...@@ -33,10 +34,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -33,10 +34,9 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
...@@ -134,6 +134,9 @@ public class GoblinStoreMgtGoodsController { ...@@ -134,6 +134,9 @@ public class GoblinStoreMgtGoodsController {
if (CollectionUtils.isEmpty(storeMgtGoodsAddParam.getSkuParamList())) { if (CollectionUtils.isEmpty(storeMgtGoodsAddParam.getSkuParamList())) {
return ResponseDto.failure(ErrorMapping.get("149006")); return ResponseDto.failure(ErrorMapping.get("149006"));
} }
if (CollectionUtils.isEmpty(storeMgtGoodsAddParam.getImageList())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品图片不能为空");
}
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
GoblinGoodsInfoVo goodsInfoVo = storeMgtGoodsAddParam.initGoodsInfoVo(); GoblinGoodsInfoVo goodsInfoVo = storeMgtGoodsAddParam.initGoodsInfoVo();
goodsInfoVo.setCreatedBy(currentUid); goodsInfoVo.setCreatedBy(currentUid);
...@@ -198,16 +201,21 @@ public class GoblinStoreMgtGoodsController { ...@@ -198,16 +201,21 @@ public class GoblinStoreMgtGoodsController {
@ApiOperation(value = "商品编辑:SPU编辑", notes = "只修改商品信息,不包含规格相关信息") @ApiOperation(value = "商品编辑:SPU编辑", notes = "只修改商品信息,不包含规格相关信息")
@PostMapping("edit_spu") @PostMapping("edit_spu")
public ResponseDto<Object> editSpu(@Valid @RequestBody GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam) { public ResponseDto<Object> editSpu(@Valid @RequestBody GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam) {
if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeMgtGoodsAddParam.getStoreId())) { String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeMgtGoodsAddParam.getStoreId())) {
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
if (StringUtils.isBlank(storeMgtGoodsAddParam.getSpuId()) || null == goblinRedisUtils.getMgtGoodsInfoVo(storeMgtGoodsAddParam.getSpuId())) { if (StringUtils.isBlank(storeMgtGoodsAddParam.getSpuId()) || null == goblinRedisUtils.getMgtGoodsInfoVo(storeMgtGoodsAddParam.getSpuId())) {
return ResponseDto.failure(ErrorMapping.get("149010")); return ResponseDto.failure(ErrorMapping.get("149010"));
} }
if (CollectionUtils.isEmpty(storeMgtGoodsAddParam.getImageList())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品图片不能为空");
}
// TODO: 2022/1/20 zhanggb==valid category
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(storeMgtGoodsAddParam)); log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(storeMgtGoodsAddParam));
} }
return ResponseDto.success(goblinstoreMgtGoodsService.goodsEditSpu(storeMgtGoodsAddParam)); return ResponseDto.success(goblinstoreMgtGoodsService.goodsEditSpu(currentUid, storeMgtGoodsAddParam));
} }
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
...@@ -256,16 +264,21 @@ public class GoblinStoreMgtGoodsController { ...@@ -256,16 +264,21 @@ public class GoblinStoreMgtGoodsController {
List<GoblinGoodsSpecDto> paramSkuSpecList = storeMgtGoodsEditSkuParam.getSkuSpecList(); List<GoblinGoodsSpecDto> paramSkuSpecList = storeMgtGoodsEditSkuParam.getSkuSpecList();
List<String> skuIdList = goodsInfoVo.getSkuIdList(); List<String> skuIdList = goodsInfoVo.getSkuIdList();
Map<String, List<GoblinGoodsSpecDto>> otherSkuSpecListMap = new HashMap<>();
Map<String, String> delSpuSpecMap = CollectionUtil.mapStringString();
boolean beUpdateSpuSpecFlg = false;
for (String skuId : skuIdList) {// 比对所有SKU规格信息 for (String skuId : skuIdList) {// 比对所有SKU规格信息
GoblinGoodsSkuInfoVo existMgtGoodsSkuInfoVo = goblinRedisUtils.getMgtGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo existMgtGoodsSkuInfoVo = goblinRedisUtils.getMgtGoodsSkuInfoVo(skuId);
Map<String, String> editBefSkuSpecMap = existMgtGoodsSkuInfoVo.getSkuSpecList().stream() List<GoblinGoodsSpecDto> skuSpecList = existMgtGoodsSkuInfoVo.getSkuSpecList();
otherSkuSpecListMap.put(skuId, skuSpecList);
Map<String, String> editBefSkuSpecMap = skuSpecList.stream()
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2)); .collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2));
boolean diffSpecFlg = false;
if (paramSkuSpecList.size() != editBefSkuSpecMap.size()) { if (paramSkuSpecList.size() != editBefSkuSpecMap.size()) {
log.warn("商品管理:商品编辑:SKU编辑:规格信息不一致[skuId={},editBefSkuSpecMap={},paramGoodsSpecDto={}]", log.warn("商品管理:商品编辑:SKU编辑:规格信息不一致[skuId={},editBefSkuSpecMap={},paramGoodsSpecDto={}]",
paramSkuId, editBefSkuSpecMap, paramSkuSpecList); paramSkuId, editBefSkuSpecMap, paramSkuSpecList);
return ResponseDto.failure(ErrorMapping.get("149014")); return ResponseDto.failure(ErrorMapping.get("149014"));
} }
boolean diffSpecFlg = false;
for (GoblinGoodsSpecDto paramGoodsSpecDto : paramSkuSpecList) {// 入参规格逐个与当前商品所有SKU规格比对 for (GoblinGoodsSpecDto paramGoodsSpecDto : paramSkuSpecList) {// 入参规格逐个与当前商品所有SKU规格比对
String editBefSkuSpecVname = editBefSkuSpecMap.get(paramGoodsSpecDto.getSpecName()); String editBefSkuSpecVname = editBefSkuSpecMap.get(paramGoodsSpecDto.getSpecName());
if (null == editBefSkuSpecVname) {// 入参规格不存在于原SKU中,则参数有误 if (null == editBefSkuSpecVname) {// 入参规格不存在于原SKU中,则参数有误
...@@ -279,28 +292,45 @@ public class GoblinStoreMgtGoodsController { ...@@ -279,28 +292,45 @@ public class GoblinStoreMgtGoodsController {
} }
} }
if (skuId.equals(paramSkuId)) { if (skuId.equals(paramSkuId)) {
if (diffSpecFlg) {// 更改了规格,则同步修改SPU里的规格信息 otherSkuSpecListMap.remove(skuId);
if (diffSpecFlg) {// 更改了规格,则同步修改SPU里的规格信息(新增 + 删除,不做更新)
Map<String, String> paramSkuSpecMap = paramSkuSpecList.stream() Map<String, String> paramSkuSpecMap = paramSkuSpecList.stream()
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2)); .collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2));
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList(); List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();// SPU规格集
for (Map.Entry<String, String> entry : editBefSkuSpecMap.entrySet()) { for (Map.Entry<String, String> entry : editBefSkuSpecMap.entrySet()) {
for (GoblinGoodsSpecVo specVo : specVoList) { String specName = entry.getKey();
if (specVo.getSpecName().equals(entry.getKey())) { String oldSpecVname = entry.getValue();
List<GoblinGoodsSpecValueVo> specValues = specVo.getSpecValues(); for (GoblinGoodsSpecVo specVo : specVoList) {// SPU规格集遍历
if (specVo.getSpecName().equals(specName)) {// SPU规格集中筛选出当前所编辑SKU的规格
List<GoblinGoodsSpecValueVo> specValues = specVo.getSpecValues();// 筛选得到的SPU的规格对应值集合
String newSpecVname = paramSkuSpecMap.get(specVo.getSpecName());
if (!newSpecVname.equals(oldSpecVname)) {
// 规格值集合中当前所编辑SKU规格值的索引
int idx = IntStream.range(0, specValues.size()) int idx = IntStream.range(0, specValues.size())
.filter(i -> specValues.get(i).getSpecVname().equals(entry.getValue())).findFirst().orElse(-1); .filter(i -> specValues.get(i).getSpecVname().equals(newSpecVname)).findFirst().orElse(-1);
if (idx == -1) { if (idx == -1) {// 不存在则新增且处理旧规格值,存在则不做处理
log.warn("商品管理:商品编辑:SKU编辑:规格信息不一致[skuId={},specVoList={},editBefSkuSpecMap={}]", beUpdateSpuSpecFlg = true;
paramSkuId, JsonUtils.toJson(specValues), editBefSkuSpecMap);
return ResponseDto.failure(ErrorMapping.get("149014")); specValues.add(GoblinGoodsSpecValueVo.getNew().setSpecVname(newSpecVname).setSpecVsort(specValues.size() + 2));
} else {
specValues.get(idx).setSpecVname(paramSkuSpecMap.get(specVo.getSpecName())); boolean toDelOldSpecVnameFlg = true;// 其他SKU中只要存在该规格值,即不可删除该规格值
Set<Map.Entry<String, List<GoblinGoodsSpecDto>>> entries = otherSkuSpecListMap.entrySet();
for (Map.Entry<String, List<GoblinGoodsSpecDto>> ent : entries) {
for (GoblinGoodsSpecDto specDto : ent.getValue()) {
if (specDto.getSpecName().equals(specName) && specDto.getSpecVname().equals(oldSpecVname)) {
toDelOldSpecVnameFlg = false;
}
}
}
if (toDelOldSpecVnameFlg) {
specValues.removeIf(rmr -> rmr.getSpecVname().equals(oldSpecVname));
delSpuSpecMap.put(specName, oldSpecVname);
}
}
} }
} }
} }
} }
} else {// 未更改规格,则标记为NULL(用于判断MONGO是否更新SPU规格信息)
storeMgtGoodsEditSkuParam.setSkuSpecList(null);
} }
continue; continue;
} }
...@@ -310,7 +340,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -310,7 +340,7 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.failure(ErrorMapping.get("149015")); return ResponseDto.failure(ErrorMapping.get("149015"));
} }
} }
if (goblinstoreMgtGoodsService.goodsEditSku(currentUid, storeMgtGoodsEditSkuParam, goodsInfoVo)) { if (goblinstoreMgtGoodsService.goodsEditSku(currentUid, storeMgtGoodsEditSkuParam, goodsInfoVo, delSpuSpecMap, beUpdateSpuSpecFlg)) {
return ResponseDto.success(goblinRedisUtils.getMgtGoodsSkuInfoVo(paramSkuId)); return ResponseDto.success(goblinRedisUtils.getMgtGoodsSkuInfoVo(paramSkuId));
} else { } else {
if (null != operStock && operStock != 0) {// 处理库存:回滚 if (null != operStock && operStock != 0) {// 处理库存:回滚
...@@ -329,43 +359,57 @@ public class GoblinStoreMgtGoodsController { ...@@ -329,43 +359,57 @@ public class GoblinStoreMgtGoodsController {
@ApiOperation(value = "商品编辑:SKU添加") @ApiOperation(value = "商品编辑:SKU添加")
@PutMapping("edit_sku/add") @PutMapping("edit_sku/add")
public ResponseDto<Object> editSkuAdd(@Valid @RequestBody GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam) { public ResponseDto<Object> editSkuAdd(@Valid @RequestBody GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam) {
if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeMgtGoodsEditSkuParam.getStoreId())) { String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeMgtGoodsEditSkuParam.getStoreId())) {
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
if (storeMgtGoodsEditSkuParam.getPrice().compareTo(BigDecimal.ZERO) <= 0
|| storeMgtGoodsEditSkuParam.getPriceMember().compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "价格无效");
}
if (storeMgtGoodsEditSkuParam.getStock() <= 0 || storeMgtGoodsEditSkuParam.getSkuStock() <= 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "库存无效");
}
GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getMgtGoodsInfoVo(storeMgtGoodsEditSkuParam.getSpuId()); GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getMgtGoodsInfoVo(storeMgtGoodsEditSkuParam.getSpuId());
if (null == goodsInfoVo || !goodsInfoVo.getStoreId().equals(storeMgtGoodsEditSkuParam.getStoreId())) { if (null == goodsInfoVo || !goodsInfoVo.getStoreId().equals(storeMgtGoodsEditSkuParam.getStoreId())) {
return ResponseDto.failure(ErrorMapping.get("149010")); return ResponseDto.failure(ErrorMapping.get("149010"));
} }
List<String> skuIdList = goodsInfoVo.getSkuIdList(); List<String> skuIdList = goodsInfoVo.getSkuIdList();
List<GoblinGoodsSpecDto> skuSpecList = storeMgtGoodsEditSkuParam.getSkuSpecList(); List<GoblinGoodsSpecDto> paramSkuSpecDtoList = storeMgtGoodsEditSkuParam.getSkuSpecList();
for (String skuId : skuIdList) {// 比对所有SKU规格信息 for (String skuId : skuIdList) {// 比对所有SKU规格信息
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getMgtGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getMgtGoodsSkuInfoVo(skuId);
if (mgtGoodsSkuInfoVo.getSkuSpecList().size() != paramSkuSpecDtoList.size()) {
log.warn("商品管理:商品编辑:SKU添加:规格信息有误[skuSpecMap={},paramSkuSpecMap={}]", JsonUtils.toJson(mgtGoodsSkuInfoVo.getSkuSpecList()), JsonUtils.toJson(paramSkuSpecDtoList));
return ResponseDto.failure(ErrorMapping.get("149014"));
}
Map<String, String> skuSpecMap = mgtGoodsSkuInfoVo.getSkuSpecList().stream() Map<String, String> skuSpecMap = mgtGoodsSkuInfoVo.getSkuSpecList().stream()
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2)); .collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2));
boolean diffSpecFlg = false; boolean diffSpecFlg = false;
for (GoblinGoodsSpecDto goodsSpecDto : skuSpecList) { for (GoblinGoodsSpecDto goodsSpecDto : paramSkuSpecDtoList) {
if (!skuSpecMap.get(goodsSpecDto.getSpecName()).equals(goodsSpecDto.getSpecVname())) { if (!skuSpecMap.get(goodsSpecDto.getSpecName()).equals(goodsSpecDto.getSpecVname())) {
diffSpecFlg = true;// 多个规格中只要存在一个不一致,即可跳过,标记为允许添加 diffSpecFlg = true;// 多个规格中只要存在一个不一致,即可跳过,标记为允许添加
break; break;
} }
} }
if (!diffSpecFlg) { if (!diffSpecFlg) {
log.warn("商品管理:商品编辑:SKU添加:重复的规格信息[skuSpecMap={},paramSkuSpecMap={}]", skuSpecMap, JsonUtils.toJson(skuSpecList)); log.warn("商品管理:商品编辑:SKU添加:重复的规格信息[skuSpecMap={},paramSkuSpecMap={}]", skuSpecMap, JsonUtils.toJson(paramSkuSpecDtoList));
return ResponseDto.failure(ErrorMapping.get("149015")); return ResponseDto.failure(ErrorMapping.get("149015"));
} }
} }
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList(); List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();
if (CollectionUtils.isEmpty(specVoList)) { if (CollectionUtils.isEmpty(specVoList)) {
if (null == specVoList) specVoList = ObjectUtil.getGoblinGoodsSpecVoArrayList(); if (null == specVoList) specVoList = ObjectUtil.getGoblinGoodsSpecVoArrayList();
int size = skuSpecList.size(); int size = paramSkuSpecDtoList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
GoblinGoodsSpecDto specDto = skuSpecList.get(i); GoblinGoodsSpecDto specDto = paramSkuSpecDtoList.get(i);
ArrayList<GoblinGoodsSpecValueVo> specValueVoList = ObjectUtil.getGoblinGoodsSpecValueVoArrayList(); ArrayList<GoblinGoodsSpecValueVo> specValueVoList = ObjectUtil.getGoblinGoodsSpecValueVoArrayList();
specValueVoList.add(GoblinGoodsSpecValueVo.getNew().setSpecVname(specDto.getSpecVname()).setSpecVsort(i)); specValueVoList.add(GoblinGoodsSpecValueVo.getNew().setSpecVname(specDto.getSpecVname()).setSpecVsort(i));
specVoList.add(GoblinGoodsSpecVo.getNew().setSpecName(specDto.getSpecName()).setSpecSort(i).setSpecValues(specValueVoList)); specVoList.add(GoblinGoodsSpecVo.getNew().setSpecName(specDto.getSpecName()).setSpecSort(i).setSpecValues(specValueVoList));
} }
} else { } else {
Map<String, String> paramSkuSpecMap = skuSpecList.stream() Map<String, String> paramSkuSpecMap = paramSkuSpecDtoList.stream()
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2)); .collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2));
for (GoblinGoodsSpecVo specVo : specVoList) {// 同步添加SPU规格信息 for (GoblinGoodsSpecVo specVo : specVoList) {// 同步添加SPU规格信息
List<GoblinGoodsSpecValueVo> specValues = specVo.getSpecValues(); List<GoblinGoodsSpecValueVo> specValues = specVo.getSpecValues();
...@@ -376,7 +420,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -376,7 +420,7 @@ public class GoblinStoreMgtGoodsController {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SKU添加:[GoblinStoreMgtGoodsEditSkuParam={}]", JsonUtils.toJson(storeMgtGoodsEditSkuParam)); log.debug("商品管理:商品编辑:SKU添加:[GoblinStoreMgtGoodsEditSkuParam={}]", JsonUtils.toJson(storeMgtGoodsEditSkuParam));
} }
goblinstoreMgtGoodsService.goodsEditSkuAdd(storeMgtGoodsEditSkuParam, goodsInfoVo); goblinstoreMgtGoodsService.goodsEditSkuAdd(currentUid, storeMgtGoodsEditSkuParam, goodsInfoVo);
return ResponseDto.success(); return ResponseDto.success();
} }
...@@ -389,14 +433,15 @@ public class GoblinStoreMgtGoodsController { ...@@ -389,14 +433,15 @@ public class GoblinStoreMgtGoodsController {
@PostMapping("edit_sku/del") @PostMapping("edit_sku/del")
public ResponseDto<Object> editSkuDel(@NotBlank(message = "店铺ID不能为空") String storeId, public ResponseDto<Object> editSkuDel(@NotBlank(message = "店铺ID不能为空") String storeId,
@NotBlank(message = "单品ID不能为空") String skuId) { @NotBlank(message = "单品ID不能为空") String skuId) {
if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeId)) { String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getMgtGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getMgtGoodsSkuInfoVo(skuId);
if (null == mgtGoodsSkuInfoVo || !mgtGoodsSkuInfoVo.getStoreId().equals(storeId)) { if (null == mgtGoodsSkuInfoVo || !mgtGoodsSkuInfoVo.getStoreId().equals(storeId)) {
return ResponseDto.failure(ErrorMapping.get("149011")); return ResponseDto.failure(ErrorMapping.get("149011"));
} }
return ResponseDto.success(goblinstoreMgtGoodsService.goodsEditSkuDel(mgtGoodsSkuInfoVo)); return ResponseDto.success(goblinstoreMgtGoodsService.goodsEditSkuDel(currentUid, mgtGoodsSkuInfoVo));
} }
// @ApiOperationSupport(order = 10) // @ApiOperationSupport(order = 10)
......
...@@ -124,7 +124,7 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe ...@@ -124,7 +124,7 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe
storeInfoVo.setUpdatedAt(LocalDateTime.now()); storeInfoVo.setUpdatedAt(LocalDateTime.now());
storeInfoVo.setUpdatedBy(CurrentUtil.getCurrentUid()); storeInfoVo.setUpdatedBy(CurrentUtil.getCurrentUid());
if (goblinMongoUtils.updateStoreInfoVo(param.completeStoreInfoVo(storeInfoVo))) { if (goblinMongoUtils.updateStoreInfoVo(param.completeStoreInfoVo(storeInfoVo))) {
// TODO: 2022/1/6 zhanggb redis goblinRedisUtils.delStoreInfoVo(storeInfoVo.getStoreId());
// LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); // LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
// LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr(); // LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
......
package com.liquidnet.service.goblin.service.impl.manage; package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
...@@ -27,10 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -27,10 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.LinkedList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -44,7 +42,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -44,7 +42,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
@Override @Override
public PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam filterParam) { public PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam filterParam) {
return goblinMongoUtils.getGoodsInfoVo(filterParam); return goblinMongoUtils.getMgtGoodsInfoVos(filterParam);
} }
@Override @Override
...@@ -67,14 +65,14 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -67,14 +65,14 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
if (null == mgtCategorySpecVoCache) {// 根据分类ID未查取到规格信息,则Cache、数据库新增 if (null == mgtCategorySpecVoCache) {// 根据分类ID未查取到规格信息,则Cache、数据库新增
GoblinMgtCategorySpecVo initMgtCategorySpecVo = GoblinMgtCategorySpecVo.getNew().setCateId(filterCateId).setSpecNameList(addSpecNameList); GoblinMgtCategorySpecVo initMgtCategorySpecVo = GoblinMgtCategorySpecVo.getNew().setCateId(filterCateId).setSpecNameList(addSpecNameList);
goblinMongoUtils.setCategorySpecVo(initMgtCategorySpecVo); goblinMongoUtils.setCategorySpecVo(initMgtCategorySpecVo);
// goblinRedisUtils.setCategorySpec(filterCateId, initMgtCategorySpecVo);// TODO: 2022/1/19 zhanggb== goblinRedisUtils.setCategorySpec(filterCateId, initMgtCategorySpecVo);
addSpecNameList.forEach(r -> initGoodsCategorySpecObjs.add(new Object[]{filterCateId, r})); addSpecNameList.forEach(r -> initGoodsCategorySpecObjs.add(new Object[]{filterCateId, r}));
} else {// 根据分类ID查取到规格信息,则进一步比对判断是否新增 } else {// 根据分类ID查取到规格信息,则进一步比对判断是否新增
List<String> confirmAddSpecNameList = addSpecNameList.stream().filter(r -> !mgtCategorySpecVoCache.getSpecNameList().contains(r)).collect(Collectors.toList()); List<String> confirmAddSpecNameList = addSpecNameList.stream().filter(r -> !mgtCategorySpecVoCache.getSpecNameList().contains(r)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(confirmAddSpecNameList)) {// 不存在于`mgtCategorySpecVoCache`的,则更新Cache,数据库新增 if (!CollectionUtils.isEmpty(confirmAddSpecNameList)) {// 不存在于`mgtCategorySpecVoCache`的,则更新Cache,数据库新增
mgtCategorySpecVoCache.getSpecNameList().addAll(confirmAddSpecNameList); mgtCategorySpecVoCache.getSpecNameList().addAll(confirmAddSpecNameList);
goblinMongoUtils.updateCategorySpecVo(mgtCategorySpecVoCache); goblinMongoUtils.updateCategorySpecVo(mgtCategorySpecVoCache);
// goblinRedisUtils.setCategorySpec(filterCateId, mgtCategorySpecVoCache);// TODO: 2022/1/19 zhanggb== goblinRedisUtils.setCategorySpec(filterCateId, mgtCategorySpecVoCache);
confirmAddSpecNameList.forEach(r -> initGoodsCategorySpecObjs.add(new Object[]{filterCateId, r})); confirmAddSpecNameList.forEach(r -> initGoodsCategorySpecObjs.add(new Object[]{filterCateId, r}));
} }
} }
...@@ -142,8 +140,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -142,8 +140,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
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.insert_by_ignore"));
toMqSqls.add(SqlMapping.get("goblin_goods_spec_value.insert_by_ignore"));
LinkedList<Object[]> initGoodsSpecObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initGoodsSpecObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spec_value.insert_by_ignore"));
LinkedList<Object[]> initGoodsSpecValueObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initGoodsSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.insert_by_ignore"));// SPU规格信息 toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.insert_by_ignore"));// SPU规格信息
LinkedList<Object[]> initGoodsSpuSpecValueObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initGoodsSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
...@@ -189,42 +187,119 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -189,42 +187,119 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
} }
@Override @Override
public boolean goodsEditSpu(GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam) { public boolean goodsEditSpu(String uid, GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam) {
GoblinGoodsInfoVo editGoodsSkuInfoVo = storeMgtGoodsAddParam.initEditGoodsInfoVo(); GoblinGoodsInfoVo updateSpuInfoVo = storeMgtGoodsAddParam.initEditGoodsInfoVo();
if (goblinMongoUtils.updateGoodsInfoVo(editGoodsSkuInfoVo)) { updateSpuInfoVo.setUpdatedBy(uid);
updateSpuInfoVo.setUpdatedAt(LocalDateTime.now());
if (goblinMongoUtils.updateGoodsInfoVo(updateSpuInfoVo)) {
GoblinGoodsSkuInfoVo updateSkuInfoVo = GoblinGoodsSkuInfoVo.getNew(); GoblinGoodsSkuInfoVo updateSkuInfoVo = GoblinGoodsSkuInfoVo.getNew();
updateSkuInfoVo.setSpuId(editGoodsSkuInfoVo.getSpuId()); updateSkuInfoVo.setSpuId(updateSpuInfoVo.getSpuId());
updateSkuInfoVo.setSkuNo(editGoodsSkuInfoVo.getSpuNo()); updateSkuInfoVo.setSkuNo(updateSpuInfoVo.getSpuNo());
updateSkuInfoVo.setName(editGoodsSkuInfoVo.getName()); // updateSkuInfoVo.setName(updateSpuInfoVo.getName());
updateSkuInfoVo.setSubtitle(editGoodsSkuInfoVo.getSubtitle()); // updateSkuInfoVo.setSubtitle(updateSpuInfoVo.getSubtitle());
updateSkuInfoVo.setVirtualFlg(editGoodsSkuInfoVo.getVirtualFlg()); updateSkuInfoVo.setVirtualFlg(updateSpuInfoVo.getVirtualFlg());
updateSkuInfoVo.setLogisticsTemplate(editGoodsSkuInfoVo.getLogisticsTemplate()); updateSkuInfoVo.setLogisticsTemplate(updateSpuInfoVo.getLogisticsTemplate());
updateSkuInfoVo.setUpdatedBy(updateSpuInfoVo.getUpdatedBy());
updateSkuInfoVo.setUpdatedAt(updateSpuInfoVo.getUpdatedAt());
goblinMongoUtils.updateGoodsSkuInfoVoBySpuId(updateSkuInfoVo); goblinMongoUtils.updateGoodsSkuInfoVoBySpuId(updateSkuInfoVo);
// TODO: 2022/1/5 zhanggb redis+sql goblinRedisUtils.delGoodsInfoVo(updateSpuInfoVo.getSpuId());
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_edit"));
LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
updateGoodsInfoObjs.add(new Object[]{
updateSpuInfoVo.getSpuNo(), updateSpuInfoVo.getName(), updateSpuInfoVo.getSubtitle(), updateSpuInfoVo.getSellPrice(),
updateSpuInfoVo.getIntro(), updateSpuInfoVo.getDetails(), updateSpuInfoVo.getCoverPic(), updateSpuInfoVo.getVideo(),
updateSpuInfoVo.getSpecMode(), updateSpuInfoVo.getCateFid(), updateSpuInfoVo.getCateSid(), updateSpuInfoVo.getCateTid(),
updateSpuInfoVo.getShelvesHandle(), updateSpuInfoVo.getShelvesTime(), updateSpuInfoVo.getSpuValidity(), updateSpuInfoVo.getVirtualFlg(),
updateSpuInfoVo.getLogisticsTemplate(), updateSpuInfoVo.getUpdatedBy(), updateSpuInfoVo.getUpdatedAt(), updateSpuInfoVo.getSpuId()
});
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_edit_spu"));
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
updateGoodsSkuObjs.add(new Object[]{
updateSkuInfoVo.getSkuNo(), updateSkuInfoVo.getVirtualFlg(), updateSkuInfoVo.getLogisticsTemplate(),
updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(), updateSkuInfoVo.getSpuId()
});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, updateGoodsInfoObjs, updateGoodsSkuObjs));
return true; return true;
} }
return false; return false;
} }
@Override @Override
public boolean goodsEditSku(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo) { public boolean goodsEditSku(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo,
GoblinGoodsSkuInfoVo editGoodsSkuInfoVo = storeMgtGoodsEditSkuParam.initEditGoodsSkuInfoVo(); Map<String, String> updateSpuSpecMap, boolean beUpdateSpuSpecFlg) {
editGoodsSkuInfoVo.setUpdatedBy(uid); GoblinGoodsSkuInfoVo updateSkuInfoVo = storeMgtGoodsEditSkuParam.initEditGoodsSkuInfoVo();
editGoodsSkuInfoVo.setUpdatedAt(LocalDateTime.now()); updateSkuInfoVo.setUpdatedBy(uid);
if (goblinMongoUtils.updateGoodsSkuInfoVo(editGoodsSkuInfoVo)) { updateSkuInfoVo.setUpdatedAt(LocalDateTime.now());
if (goblinMongoUtils.updateGoodsSkuInfoVo(updateSkuInfoVo)) {
String skuId = updateSkuInfoVo.getSkuId();
String spuId = goodsInfoVo.getSpuId();
Integer operStock = storeMgtGoodsEditSkuParam.getOperStock(); Integer operStock = storeMgtGoodsEditSkuParam.getOperStock();
if (null != operStock && operStock != 0) { if (null != operStock && operStock != 0) {
goblinRedisUtils.setSkuStock(null, editGoodsSkuInfoVo.getSkuId(), editGoodsSkuInfoVo.getSkuStock()); goblinRedisUtils.setSkuStock(null, skuId, updateSkuInfoVo.getSkuStock());
} }
goblinRedisUtils.delGoodsSkuInfoVo(skuId);
LinkedList<Object[]> updateSkuSpecValueObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> initSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> delSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> updateSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
if (beUpdateSpuSpecFlg) {
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();
for (GoblinGoodsSpecVo specVo : specVoList) {
List<GoblinGoodsSpecValueVo> specValues = specVo.getSpecValues();
specValues.sort(Comparator.comparing(GoblinGoodsSpecValueVo::getSpecVsort));
for (int i = 0; i < specValues.size(); i++) {
GoblinGoodsSpecValueVo specValueVo = specValues.get(i);
specValueVo.setSpecVsort(i);
if (!CollectionUtils.isEmpty(storeMgtGoodsEditSkuParam.getSkuSpecList())) {// 更改了规格,需要同步SPU里的规格信息 updateSpuSpecValueObjs.add(new Object[]{i, spuId, specVo.getSpecName(), specValueVo.getSpecVname()});
}
}
List<GoblinGoodsSpecDto> skuSpecList = storeMgtGoodsEditSkuParam.getSkuSpecList();
skuSpecList.forEach(spec -> {
String specName = spec.getSpecName(), specVname = spec.getSpecVname();
GoblinGoodsSpecVo specVo = specVoList.stream().filter(r -> r.getSpecName().equals(specName)).findAny().get();
GoblinGoodsSpecValueVo specValueVo = specVo.getSpecValues().stream().filter(rv -> rv.getSpecVname().equals(specVname)).findAny().get();
initSpuSpecValueObjs.add(new Object[]{spuId, specName, specVname, specValueVo.getSpecVsort()});
});
if (!CollectionUtils.isEmpty(updateSpuSpecMap)) {// 更改了规格,需要同步SPU里的规格信息
goodsInfoVo.setUpdatedBy(uid); goodsInfoVo.setUpdatedBy(uid);
goodsInfoVo.setUpdatedAt(editGoodsSkuInfoVo.getUpdatedAt()); goodsInfoVo.setUpdatedAt(updateSkuInfoVo.getUpdatedAt());
goblinMongoUtils.updateGoodsInfoVo(goodsInfoVo); goblinMongoUtils.updateGoodsInfoVo(goodsInfoVo);
goblinRedisUtils.delGoodsInfoVo(spuId);
updateSpuSpecMap.forEach((k, v) -> delSpuSpecValueObjs.add(new Object[]{spuId, k, v}));
}
} }
// TODO: 2022/1/5 zhanggb redis+sql
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_edit"));
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
updateGoodsSkuObjs.add(new Object[]{
updateSkuInfoVo.getSkuPic(), updateSkuInfoVo.getSellPrice(), updateSkuInfoVo.getPrice(), updateSkuInfoVo.getPriceMember(),
updateSkuInfoVo.getWeight(), updateSkuInfoVo.getStock(), updateSkuInfoVo.getSkuStock(), updateSkuInfoVo.getWarningStock(),
updateSkuInfoVo.getSkuAppear(), updateSkuInfoVo.getSkuIsbn(), updateSkuInfoVo.getBuyFactor(), updateSkuInfoVo.getBuyRoster(),
updateSkuInfoVo.getBuyLimit(), updateSkuInfoVo.getSkuValidity(), updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(),
skuId
});
toMqSqls.add(SqlMapping.get("goblin_goods_sku_spec_value.update_by_edit"));
// LinkedList<Object[]> updateSkuSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.insert_by_ignore"));
// LinkedList<Object[]> initSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.update_by_editdel"));
// LinkedList<Object[]> delSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.update_by_edit"));
// LinkedList<Object[]> updateSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, updateGoodsSkuObjs, updateSkuSpecValueObjs, initSpuSpecValueObjs, delSpuSpecValueObjs));
return true; return true;
} }
...@@ -232,49 +307,89 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -232,49 +307,89 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
} }
@Override @Override
public void goodsEditSkuAdd(GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo) { public void goodsEditSkuAdd(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo) {
String spuId = storeMgtGoodsEditSkuParam.getSpuId();
String uid = CurrentUtil.getCurrentUid();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String spuId = storeMgtGoodsEditSkuParam.getSpuId();
String skuId = spuId.concat(StringUtils.right(String.valueOf(System.nanoTime()), 5));
GoblinGoodsSkuInfoVo addGoodsSkuInfoVo = storeMgtGoodsEditSkuParam.initEditAddGoodsSkuInfoVo(); GoblinGoodsSkuInfoVo addSkuInfoVo = storeMgtGoodsEditSkuParam.initEditAddGoodsSkuInfoVo();
addGoodsSkuInfoVo.setSkuId(spuId.concat(StringUtils.right(String.valueOf(System.nanoTime()), 5))); addSkuInfoVo.setSkuId(skuId);
addGoodsSkuInfoVo.setSpuId(spuId); addSkuInfoVo.setSpuId(spuId);
addGoodsSkuInfoVo.setSkuNo(goodsInfoVo.getSpuNo()); addSkuInfoVo.setSkuNo(goodsInfoVo.getSpuNo());
addGoodsSkuInfoVo.setName(goodsInfoVo.getName()); addSkuInfoVo.setName(goodsInfoVo.getName());
addGoodsSkuInfoVo.setSubtitle(goodsInfoVo.getSubtitle()); addSkuInfoVo.setSubtitle(goodsInfoVo.getSubtitle());
addGoodsSkuInfoVo.setVirtualFlg(goodsInfoVo.getVirtualFlg()); addSkuInfoVo.setVirtualFlg(goodsInfoVo.getVirtualFlg());
addGoodsSkuInfoVo.setStatus("3"); addSkuInfoVo.setStatus("3");
addGoodsSkuInfoVo.setShelvesStatus(goodsInfoVo.getShelvesStatus()); addSkuInfoVo.setShelvesStatus(goodsInfoVo.getShelvesStatus());
addGoodsSkuInfoVo.setDelFlg("0"); addSkuInfoVo.setDelFlg("0");
addGoodsSkuInfoVo.setCreatedAt(now); addSkuInfoVo.setCreatedAt(now);
addGoodsSkuInfoVo.setCreatedBy(uid); addSkuInfoVo.setCreatedBy(uid);
addGoodsSkuInfoVo.setLogisticsTemplate(goodsInfoVo.getLogisticsTemplate()); addSkuInfoVo.setLogisticsTemplate(goodsInfoVo.getLogisticsTemplate());
goblinMongoUtils.setGoodsSkuInfoVo(addGoodsSkuInfoVo); goblinMongoUtils.setGoodsSkuInfoVo(addSkuInfoVo);
List<String> skuIdList = goodsInfoVo.getSkuIdList(); List<String> skuIdList = goodsInfoVo.getSkuIdList();
skuIdList.add(addGoodsSkuInfoVo.getSkuId()); skuIdList.add(addSkuInfoVo.getSkuId());
goodsInfoVo.setSkuIdList(skuIdList); goodsInfoVo.setSkuIdList(skuIdList);
goblinMongoUtils.updateGoodsInfoVo(goodsInfoVo); goblinMongoUtils.updateGoodsInfoVo(goodsInfoVo);
goblinRedisUtils.delGoodsSkuInfoVo(spuId);
goblinRedisUtils.setSkuStock(null, addSkuInfoVo.getSkuId(), addSkuInfoVo.getSkuStock());
// TODO: 2022/1/5 zhanggb redis+sql LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
goblinRedisUtils.setSkuStock(null, addGoodsSkuInfoVo.getSkuId(), addGoodsSkuInfoVo.getSkuStock()); toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert"));
LinkedList<Object[]> initGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
initGoodsSkuObjs.add(new Object[]{
addSkuInfoVo.getSkuId(), addSkuInfoVo.getSpuId(), addSkuInfoVo.getSkuNo(), addSkuInfoVo.getName(), addSkuInfoVo.getSubtitle(),
addSkuInfoVo.getSellPrice(), addSkuInfoVo.getSkuPic(), addSkuInfoVo.getSkuIsbn(), addSkuInfoVo.getStock(), addSkuInfoVo.getSkuStock(),
addSkuInfoVo.getWarningStock(), addSkuInfoVo.getPrice(), addSkuInfoVo.getPriceMember(), addSkuInfoVo.getWeight(), addSkuInfoVo.getBuyFactor(),
addSkuInfoVo.getBuyRoster(), addSkuInfoVo.getBuyLimit(), addSkuInfoVo.getStoreId(), addSkuInfoVo.getSkuValidity(), addSkuInfoVo.getVirtualFlg(),
addSkuInfoVo.getStatus(), addSkuInfoVo.getShelvesStatus(), addSkuInfoVo.getSkuAppear(), addSkuInfoVo.getShelvesAt(), uid,
now, addSkuInfoVo.getLogisticsTemplate()
});
toMqSqls.add(SqlMapping.get("goblin_goods_spec.insert_by_ignore"));
LinkedList<Object[]> initGoodsSpecObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spec_value.insert_by_ignore"));
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规格信息
LinkedList<Object[]> initGoodsSkuSpecValueObjs = CollectionUtil.linkedListObjectArr();
addSkuInfoVo.getSkuSpecList().forEach(skuSpecDto -> initGoodsSkuSpecValueObjs.add(new Object[]{
spuId, skuId, skuSpecDto.getSpecName(), skuSpecDto.getSpecVname()
}));
{// 规格记录
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();
specVoList.forEach(s -> {
initGoodsSpecObjs.add(new Object[]{s.getSpecName(), now});
s.getSpecValues().forEach(sv -> {
initGoodsSpecValueObjs.add(new Object[]{s.getSpecName(), sv.getSpecVname(), now});
initGoodsSpuSpecValueObjs.add(new Object[]{spuId, s.getSpecName(), sv.getSpecVname(), sv.getSpecVsort()});
});
});
}
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, initGoodsSkuObjs, initGoodsSkuSpecValueObjs, initGoodsSpecObjs,
initGoodsSpecValueObjs, initGoodsSpuSpecValueObjs, initGoodsSkuSpecValueObjs)
);
} }
@Override @Override
public boolean goodsEditSkuDel(GoblinGoodsSkuInfoVo goodsSkuInfoVo) { public boolean goodsEditSkuDel(String uid, GoblinGoodsSkuInfoVo goodsSkuInfoVo) {
String skuId = goodsSkuInfoVo.getSkuId(); String spuId = goodsSkuInfoVo.getSpuId();
String delSkuId = goodsSkuInfoVo.getSkuId();
GoblinGoodsInfoVo mgtGoodsInfoVo = goblinRedisUtils.getMgtGoodsInfoVo(goodsSkuInfoVo.getSpuId()); GoblinGoodsInfoVo mgtGoodsInfoVo = goblinRedisUtils.getMgtGoodsInfoVo(spuId);
List<String> skuIdList = mgtGoodsInfoVo.getSkuIdList(); mgtGoodsInfoVo.getSkuIdList().removeIf(r -> r.equals(delSkuId));
skuIdList.removeIf(r -> r.equals(skuId));
mgtGoodsInfoVo.setSkuIdList(skuIdList);
List<GoblinGoodsSpecVo> specVoList = mgtGoodsInfoVo.getSpecVoList(); List<GoblinGoodsSpecVo> specVoList = mgtGoodsInfoVo.getSpecVoList();
Map<String, String> delGoodsSkuSpecMap = goodsSkuInfoVo.getSkuSpecList().stream() Map<String, String> delGoodsSkuSpecMap = goodsSkuInfoVo.getSkuSpecList().stream()
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2)); .collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname));
LinkedList<Object[]> updateGoodsSpuSpecObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> updateGoodsSpuSpecDelObjs = CollectionUtil.linkedListObjectArr();
for (int i = 0; i < specVoList.size(); i++) {// 处理商品规格信息 for (int i = 0; i < specVoList.size(); i++) {// 处理商品规格信息
GoblinGoodsSpecVo specVo = specVoList.get(i); GoblinGoodsSpecVo specVo = specVoList.get(i);
List<GoblinGoodsSpecValueVo> modifySpecValues = ObjectUtil.getGoblinGoodsSpecValueVoArrayList(); List<GoblinGoodsSpecValueVo> modifySpecValues = ObjectUtil.getGoblinGoodsSpecValueVoArrayList();
...@@ -286,34 +401,72 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -286,34 +401,72 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
if (specValue.getSpecVname().equals(delSpecVname)) { if (specValue.getSpecVname().equals(delSpecVname)) {
modifySpecValues.remove(specValue); modifySpecValues.remove(specValue);
rmIdx = specValue.getSpecVsort(); rmIdx = specValue.getSpecVsort();
updateGoodsSpuSpecDelObjs.add(new Object[]{spuId, specVo.getSpecName(), delSpecVname});
} else { } else {
modifySpecValues.add(specValue); modifySpecValues.add(specValue);
} }
if (null != rmIdx && specValue.getSpecVsort() > rmIdx) { if (null != rmIdx && specValue.getSpecVsort() > rmIdx) {
specValue.setSpecVsort(specValue.getSpecVsort() - 1); specValue.setSpecVsort(specValue.getSpecVsort() - 1);
updateGoodsSpuSpecObjs.add(new Object[]{specValue.getSpecVsort(), spuId, specVo.getSpecName(), specValue.getSpecVname()});
} }
} }
if (modifySpecValues.size() == 0) {// 规格下规格值为0的时候,移除规格 if (modifySpecValues.size() == 0) {// 规格下规格值为0的时候,移除规格
specVoList.remove(specVo); // specVoList.remove(specVo);
} else { } else {
specVo.setSpecValues(modifySpecValues); specVo.setSpecValues(modifySpecValues);
} }
} }
LocalDateTime now = LocalDateTime.now();
goodsSkuInfoVo.setUpdatedBy(uid);
goodsSkuInfoVo.setUpdatedAt(now);
goodsSkuInfoVo.setDeletedBy(uid);
goodsSkuInfoVo.setDeletedAt(now);
if (goblinMongoUtils.delGoodsSkuInfoVo(goodsSkuInfoVo)) {
goblinRedisUtils.delGoodsSkuInfoVo(delSkuId);
goblinMongoUtils.delGoodsSkuInfoVo(skuId); BigDecimal priceGe = BigDecimal.ZERO, priceLe = BigDecimal.ZERO;
goblinRedisUtils.delGoodsSkuInfoVo(skuId); for (String skuId : mgtGoodsInfoVo.getSkuIdList()) {
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
// TODO: 2022/1/5 zhanggb redis+sql priceGe = priceGe.compareTo(BigDecimal.ZERO) == 0 ? skuInfoVo.getPrice() : (priceGe.compareTo(skuInfoVo.getPrice()) > 0 ? skuInfoVo.getPrice() : priceGe);
priceLe = priceLe.compareTo(skuInfoVo.getPrice()) < 0 ? skuInfoVo.getPrice() : priceLe;
}
mgtGoodsInfoVo.setUpdatedBy(uid);
mgtGoodsInfoVo.setUpdatedAt(now);
return goblinMongoUtils.updateGoodsInfoVo(mgtGoodsInfoVo); LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
if (priceGe.compareTo(mgtGoodsInfoVo.getPriceGe()) != 0 || priceLe.compareTo(mgtGoodsInfoVo.getPriceLe()) != 0) {
mgtGoodsInfoVo.setPriceGe(priceGe);
mgtGoodsInfoVo.setPriceLe(priceLe);
updateGoodsInfoObjs.add(new Object[]{priceGe, priceLe, uid, now, spuId});
} }
goblinMongoUtils.updateGoodsInfoVo(mgtGoodsInfoVo);
goblinRedisUtils.delGoodsInfoVo(spuId);
@Override LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
public boolean goodsEditSkuBat(String spuId, String batField, String batFieldVal) { toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_del"));
// TODO: 2022/1/5 zhanggb LinkedList<Object[]> delGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
delGoodsSkuObjs.add(new Object[]{uid, now, uid, now, spuId, goodsSkuInfoVo.getStoreId()});
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.update_by_del_sku1"));
// LinkedList<Object[]> updateGoodsSpuSpecDelObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.update_by_del_sku2"));
// LinkedList<Object[]> updateGoodsSpuSpecObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_del_sku"));
// LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, delGoodsSkuObjs, updateGoodsSpuSpecDelObjs, updateGoodsSpuSpecObjs, updateGoodsInfoObjs));
return true;
}
return false; return false;
} }
// @Override
// public boolean goodsEditSkuBat(String spuId, String batField, String batFieldVal) {
// return false;
// }
@Override @Override
public void goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam storeMgtGoodsActionParam, String uid, boolean shelvesFlg) { public void goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam storeMgtGoodsActionParam, String uid, boolean shelvesFlg) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
...@@ -322,7 +475,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -322,7 +475,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
if (goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) { if (goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
if (goblinMongoUtils.updateGoodsSkuInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) { if (goblinMongoUtils.updateGoodsSkuInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
// TODO: 2022/1/7 zhanggb redis spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
List<String> skuIds = goblinMongoUtils.getMgtGoodsSkuIds(storeId, spuIdList);
skuIds.forEach(skuId -> goblinRedisUtils.delGoodsSkuInfoVo(skuId));
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_shelves")); toMqSqls.add(SqlMapping.get("goblin_goods.update_by_shelves"));
...@@ -348,7 +503,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -348,7 +503,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
List<String> spuIdList = storeMgtGoodsActionParam.getSpuIdList(); List<String> spuIdList = storeMgtGoodsActionParam.getSpuIdList();
if (goblinMongoUtils.delGoodsInfoVoBySpuIds(storeId, spuIdList, uid, now)) { if (goblinMongoUtils.delGoodsInfoVoBySpuIds(storeId, spuIdList, uid, now)) {
// TODO: 2022/1/7 zhanggb redis spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
List<String> skuIdList = goblinMongoUtils.getMgtGoodsSkuIds(storeId, spuIdList);
skuIdList.forEach(skuId -> goblinRedisUtils.delGoodsSkuInfoVo(skuId));
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_del")); toMqSqls.add(SqlMapping.get("goblin_goods.update_by_del"));
......
...@@ -66,19 +66,41 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService { ...@@ -66,19 +66,41 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
} }
} }
if (!CollectionUtils.isEmpty(updateStoreConfigVoList) && goblinMongoUtils.updateStoreConfigVos(updateStoreConfigVoList)) { if (!CollectionUtils.isEmpty(updateStoreConfigVoList) && goblinMongoUtils.updateStoreConfigVos(updateStoreConfigVoList)) {
// goblinRedisUtils.setStoreConfigVos(storeId, storeConfigVos);// TODO: 2022/1/17 zhanggb== // goblinRedisUtils.setStoreConfigVos(storeId, storeConfigVos);// TODO: 2022/1/17 zhanggb==redis
LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
if (toUpdateStoreStatusFlg) { if (toUpdateStoreStatusFlg) {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId); String status = confMap.get(GoblinStoreConf.BUSINESS_STATUS.name());
storeInfoVo.setStatus(confMap.get(GoblinStoreConf.BUSINESS_STATUS.name()));
goblinMongoUtils.updateStoreInfoVo(storeInfoVo); GoblinStoreInfoVo updateStoreInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
// goblinRedisUtils.setStoreInfoVo(storeInfoVo);// TODO: 2022/1/17 zhanggb== updateStoreInfoVo.setStatus(status);
updateStoreInfoVo.setUpdatedBy(uid);
updateStoreInfoVo.setUpdatedAt(now);
goblinMongoUtils.updateStoreInfoVo(updateStoreInfoVo);
// goblinRedisUtils.setStoreInfoVo(updateStoreInfoVo);// TODO: 2022/1/17 zhanggb==redis
goblinMongoUtils.updateGoodsInfoVoAppear(storeId, status, now, uid);
List<String> spuIdList = goblinMongoUtils.getMgtGoodsSpuIds(storeId);
spuIdList.forEach(spuId -> goblinRedisUtils.delGoodsInfoVo(spuId));
updateStoreInfoObjs.add(new Object[]{updateStoreInfoVo.getStatus(), uid, now, storeId});
updateGoodsInfoObjs.add(new Object[]{status, uid, now, storeId});
} }
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_store_config.update"));
LinkedList<Object[]> updateStoreConfigVoObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> updateStoreConfigVoObjs = CollectionUtil.linkedListObjectArr();
updateStoreConfigVoList.forEach(uc -> updateStoreConfigVoObjs.add(new Object[]{uc.getConfigVal(), uc.getUpdatedBy(), uc.getUpdatedAt(), uc.getStoreId(), uc.getConfigKey()})); updateStoreConfigVoList.forEach(uc -> updateStoreConfigVoObjs.add(new Object[]{
uc.getConfigVal(), uc.getUpdatedBy(), uc.getUpdatedAt(), uc.getStoreId(), uc.getConfigKey()}));
toMqSqls.add(SqlMapping.get("goblin_store_info.update_by_setting"));
// LinkedList<Object[]> updateStoreInfoObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_status"));
// LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("goblin_store_config.update", updateStoreConfigVoObjs)); SqlMapping.gets(toMqSqls, updateStoreConfigVoObjs, updateStoreInfoObjs, updateGoodsInfoObjs));
return true; return true;
} }
return false; return false;
......
...@@ -295,14 +295,14 @@ public class GoblinMongoUtils { ...@@ -295,14 +295,14 @@ public class GoblinMongoUtils {
public boolean delGoodsInfoVoBySpuIds(String storeId, List<String> spuIdList, String uid, LocalDateTime time) { public boolean delGoodsInfoVoBySpuIds(String storeId, List<String> spuIdList, String uid, LocalDateTime time) {
return mongoTemplate.updateMulti( return mongoTemplate.updateMulti(
Query.query(Criteria.where("store_id").is(storeId).and("spuId").in(spuIdList.toArray()).and("delFlg").is("0")), Query.query(Criteria.where("storeId").is(storeId).and("spuId").in(spuIdList.toArray()).and("delFlg").is("0")),
Update.update("delFlg", 1).set("updatedBy", uid).set("updatedAt", time).set("deletedBy", uid).set("deletedAt", time), Update.update("delFlg", 1).set("updatedBy", uid).set("updatedAt", time).set("deletedBy", uid).set("deletedAt", time),
GoblinGoodsInfoVo.class.getSimpleName() GoblinGoodsInfoVo.class.getSimpleName()
).getModifiedCount() > 0; ).getModifiedCount() > 0;
} }
public List<String> delGoodsInfoVoByStoreId(String storeId, String uid, LocalDateTime time) { public List<String> delGoodsInfoVoByStoreId(String storeId, String uid, LocalDateTime time) {
Query query = Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0").and("shelves_status").is("3")); Query query = Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0").and("shelvesStatus").is("3"));
query.fields().include("spuId"); query.fields().include("spuId");
List<GoblinGoodsInfoVo> storeSpus = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()); List<GoblinGoodsInfoVo> storeSpus = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
...@@ -320,7 +320,7 @@ public class GoblinMongoUtils { ...@@ -320,7 +320,7 @@ public class GoblinMongoUtils {
} }
// SPU分页 // SPU分页
public PagedResult<GoblinStoreMgtGoodsListVo> getGoodsInfoVo(GoblinStoreMgtGoodsFilterParam filterParam) { public PagedResult<GoblinStoreMgtGoodsListVo> getMgtGoodsInfoVos(GoblinStoreMgtGoodsFilterParam filterParam) {
Criteria criteria = Criteria.where("delFlg").is("0").and("storeId").is(filterParam.getStoreId()).and("marketId").exists(false); Criteria criteria = Criteria.where("delFlg").is("0").and("storeId").is(filterParam.getStoreId()).and("marketId").exists(false);
if (StringUtils.isNotBlank(filterParam.getKeyword())) { if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE); Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
...@@ -368,6 +368,24 @@ public class GoblinMongoUtils { ...@@ -368,6 +368,24 @@ public class GoblinMongoUtils {
return pagedResult.setList(goodsListVos).setTotal(count, filterParam.getPageSize()); return pagedResult.setList(goodsListVos).setTotal(count, filterParam.getPageSize());
} }
// SPU信息
public List<String> getMgtGoodsSpuIds(String storeId) {
Query query = Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0"));
query.fields().include("spuId");
List<GoblinGoodsInfoVo> vos = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
return CollectionUtils.isEmpty(vos) ? CollectionUtil.arrayListString()
: vos.stream().map(GoblinGoodsInfoVo::getSpuId).collect(Collectors.toList());
}
// SKU信息
public List<String> getMgtGoodsSkuIds(String storeId, List<String> spuIdList) {
Query query = Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0").and("spuId").in(spuIdList.toArray()));
query.fields().include("skuId");
List<GoblinGoodsSkuInfoVo> vos = mongoTemplate.find(query, GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
return CollectionUtils.isEmpty(vos) ? CollectionUtil.arrayListString()
: vos.stream().map(GoblinGoodsSkuInfoVo::getSkuId).collect(Collectors.toList());
}
// SPU信息 // SPU信息
public GoblinGoodsInfoVo getGoodsInfoVo(String spuId) { public GoblinGoodsInfoVo getGoodsInfoVo(String spuId) {
return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0").and("shelvesStatus").is("3")), return mongoTemplate.findOne(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0").and("shelvesStatus").is("3")),
...@@ -382,13 +400,20 @@ public class GoblinMongoUtils { ...@@ -382,13 +400,20 @@ public class GoblinMongoUtils {
// SPU信息 // SPU信息
public boolean updateGoodsInfoVo(GoblinGoodsInfoVo vo) { public boolean updateGoodsInfoVo(GoblinGoodsInfoVo vo) {
return mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName()) return mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName()).updateOne(
.updateOne(
Query.query(Criteria.where("spuId").is(vo.getSpuId()).and("delFlg").is("0")).getQueryObject(), Query.query(Criteria.where("spuId").is(vo.getSpuId()).and("delFlg").is("0")).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo)) ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0; ).getModifiedCount() > 0;
} }
// SPU信息
public boolean updateGoodsInfoVoAppear(String storeId, String spuAppear, LocalDateTime time, String uid) {
return mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0")).getQueryObject(),
Update.update("spuAppear", spuAppear).set("updatedBy", uid).set("updatedAt", time).getUpdateObject()
).getModifiedCount() > 0;
}
public boolean updateGoodsInfoVoByShelves(String storeId, List<String> spuIdList, boolean shelvesFlg, String uid, LocalDateTime time) { public boolean updateGoodsInfoVoByShelves(String storeId, List<String> spuIdList, boolean shelvesFlg, String uid, LocalDateTime time) {
return mongoTemplate.updateMulti(Query.query(Criteria.where("storeId").is(storeId).and("spuId").in(spuIdList.toArray())), return mongoTemplate.updateMulti(Query.query(Criteria.where("storeId").is(storeId).and("spuId").in(spuIdList.toArray())),
Update.update("shelvesStatus", shelvesFlg ? "3" : "1").set("shelvesAt", time).set("updatedBy", uid).set("updatedAt", time), Update.update("shelvesStatus", shelvesFlg ? "3" : "1").set("shelvesAt", time).set("updatedBy", uid).set("updatedAt", time),
...@@ -405,13 +430,16 @@ public class GoblinMongoUtils { ...@@ -405,13 +430,16 @@ public class GoblinMongoUtils {
return (List<GoblinGoodsSkuInfoVo>) mongoTemplate.insert(vos, GoblinGoodsSkuInfoVo.class.getSimpleName()); return (List<GoblinGoodsSkuInfoVo>) mongoTemplate.insert(vos, GoblinGoodsSkuInfoVo.class.getSimpleName());
} }
public boolean delGoodsSkuInfoVo(String skuId) { public boolean delGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) {
return mongoTemplate.remove(Query.query(Criteria.where("skuId").is(skuId).and("delFlg").is("0")), return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName()).updateOne(
GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName()).getDeletedCount() > 0; Query.query(Criteria.where("skuId").is(vo.getSkuId()).and("delFlg").is("0")).getQueryObject(),
Update.update("updatedBy", vo.getUpdatedBy()).set("updatedAt", vo.getUpdatedAt())
.set("deletedBy", vo.getDeletedBy()).set("deletedAt", vo.getDeletedAt()).getUpdateObject()
).getModifiedCount() > 0;
} }
public List<String> delGoodsSkuInfoVoByStoreId(String storeId, String uid, LocalDateTime time) { public List<String> delGoodsSkuInfoVoByStoreId(String storeId, String uid, LocalDateTime time) {
Query query = Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0").and("shelves_status").is("3")); Query query = Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0").and("shelvesStatus").is("3"));
query.fields().include("skuId"); query.fields().include("skuId");
List<GoblinGoodsSkuInfoVo> storeSkus = mongoTemplate.find(query, GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName()); List<GoblinGoodsSkuInfoVo> storeSkus = mongoTemplate.find(query, GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
......
...@@ -4,6 +4,7 @@ goblin_store_info.update_by_cert1=UPDATE goblin_store_info SET store_type=?,cert ...@@ -4,6 +4,7 @@ goblin_store_info.update_by_cert1=UPDATE goblin_store_info SET store_type=?,cert
goblin_store_info.update_by_cert2=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,status=?,store_type=?,updated_by=?,updated_at=? WHERE store_id=? goblin_store_info.update_by_cert2=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,status=?,store_type=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_del=UPDATE goblin_store_info SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=? goblin_store_info.update_by_del=UPDATE goblin_store_info SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_edit=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,updated_by=?,updated_at=? WHERE store_id=? goblin_store_info.update_by_edit=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_setting=UPDATE goblin_store_info SET status=?,updated_by=?,updated_at=? WHERE store_id=? AND del_flg='0'
goblin_store_certification.insert_by_cert=INSERT INTO goblin_store_certification (store_id,person_cert_type,person_name,person_cert_code,person_cert_validity,person_cert_lasting,person_cert_fpic,person_cert_bpic,person_cert_spic,province_id,province_name,city_id,city_name,county_id,county_name,bus_address,bus_name,bus_cert_code,bus_cert_validity,bus_cert_lasting,bus_cert_pic,bus_quality_pic,created_by,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_store_certification.insert_by_cert=INSERT INTO goblin_store_certification (store_id,person_cert_type,person_name,person_cert_code,person_cert_validity,person_cert_lasting,person_cert_fpic,person_cert_bpic,person_cert_spic,province_id,province_name,city_id,city_name,county_id,county_name,bus_address,bus_name,bus_cert_code,bus_cert_validity,bus_cert_lasting,bus_cert_pic,bus_quality_pic,created_by,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET person_cert_type=?,person_name=?,person_cert_code=?,person_cert_validity=?,person_cert_lasting=?,person_cert_fpic=?,person_cert_bpic=?,person_cert_spic=?,province_id=?,province_name=?,city_id=?,city_name=?,county_id=?,county_name=?,bus_address=?,bus_name=?,bus_cert_code=?,bus_cert_validity=?,bus_cert_lasting=?,bus_cert_pic=?,bus_quality_pic=?,updated_by=?,updated_at=? WHERE store_id=? goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET person_cert_type=?,person_name=?,person_cert_code=?,person_cert_validity=?,person_cert_lasting=?,person_cert_fpic=?,person_cert_bpic=?,person_cert_spic=?,province_id=?,province_name=?,city_id=?,city_name=?,county_id=?,county_name=?,bus_address=?,bus_name=?,bus_cert_code=?,bus_cert_validity=?,bus_cert_lasting=?,bus_cert_pic=?,bus_quality_pic=?,updated_by=?,updated_at=? WHERE store_id=?
...@@ -27,17 +28,28 @@ goblin_goods_spec.insert_by_ignore=INSERT IGNORE INTO goblin_goods_spec (spec_na ...@@ -27,17 +28,28 @@ goblin_goods_spec.insert_by_ignore=INSERT IGNORE INTO goblin_goods_spec (spec_na
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_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_spu_spec_value.insert_by_ignore=INSERT IGNORE INTO goblin_goods_spu_spec_value (spu_id,spec_name,spec_vname,sort)VALUES(?,?,?,?)
goblin_goods_spu_spec_value.update_by_editdel=UPDATE goblin_goods_spu_spec_value SET del_flg='1' WHERE spu_id=? AND spec_name=? AND spec_vname=? AND del_flg='0'
goblin_goods_spu_spec_value.update_by_edit=UPDATE goblin_goods_spu_spec_value SET sort=? WHERE spu_id=? AND spec_name=? AND spec_vname=? AND del_flg='0'
goblin_goods_spu_spec_value.update_by_del_sku1=UPDATE goblin_goods_spu_spec_value SET del_flg='1' WHERE spu_id=? AND spec_name=? AND spec_vname=?
goblin_goods_spu_spec_value.update_by_del_sku2=UPDATE goblin_goods_spu_spec_value SET sort=? WHERE spu_id=? AND spec_name=? AND spec_vname=?
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_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_sku_spec_value.update_by_edit=UPDATE goblin_goods_sku_spec_value SET spec_vname=? WHERE sku_id=? AND spec_name=? AND del_flg='0'
goblin_goods_sku_spec_value.update_by_del=UPDATE goblin_goods_sku_spec_value SET del_flg='1' WHERE sku_id=? AND del_flg='0'
#---- 商品信息 #---- 商品信息
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_edit=UPDATE goblin_goods SET spu_no=?,name=?,subtitle=?,sell_price=?,intro=?,details=?,cover_pic=?,video=?,spec_mode=?,cate_fid=?,cate_sid=?,cate_tid=?,shelves_handle=?,shelves_time=?,spu_validity=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='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' 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_del_store=UPDATE goblin_goods SET del_flg=1,updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=? goblin_goods.update_by_status=UPDATE goblin_goods SET spu_appear=?,updated_by=?,updated_at=? WHERE store_id=? AND del_flg='0'
goblin_goods.update_by_del=UPDATE goblin_goods SET del_flg=1,updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND store_id=? goblin_goods.update_by_del_sku=UPDATE goblin_goods SET price_ge=?,price_le=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods.update_by_del_store=UPDATE goblin_goods SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=?
goblin_goods.update_by_del=UPDATE goblin_goods SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND store_id=?
goblin_goods_sku.insert=INSERT INTO goblin_goods_sku (sku_id,spu_id,sku_no,name,subtitle, sell_price,sku_pic,sku_isbn,stock,sku_stock, warning_stock,price,price_member,weight,buy_factor, buy_roster,buy_limit,store_id,sku_validity,virtual_flg, status,shelves_status,sku_appear,shelves_at,created_by, created_at,logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_goods_sku.insert=INSERT INTO goblin_goods_sku (sku_id,spu_id,sku_no,name,subtitle, sell_price,sku_pic,sku_isbn,stock,sku_stock, warning_stock,price,price_member,weight,buy_factor, buy_roster,buy_limit,store_id,sku_validity,virtual_flg, status,shelves_status,sku_appear,shelves_at,created_by, created_at,logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_goods_sku.update_by_edit=UPDATE goblin_goods_sku SET sku_pic=?,sell_price=?,price=?,price_member=?,weight=?,stock=?,sku_stock=?,warning_stock=?,sku_appear=?,sku_isbn=?,buy_factor=?,buy_roster=?,buy_limit=?,sku_validity=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_spu=UPDATE goblin_goods_sku SET sku_no=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_shelves=UPDATE goblin_goods_sku SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND sku_appear='0' goblin_goods_sku.update_by_shelves=UPDATE goblin_goods_sku SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND sku_appear='0'
goblin_goods_sku.update_by_del_store=UPDATE goblin_goods_sku SET del_flg=1,updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=? goblin_goods_sku.update_by_del_store=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=?
goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg=1,updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND store_id=? goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND store_id=?
goblin_goods_image.insert=INSERT INTO goblin_goods_image (spu_id,url)VALUES(?,?) goblin_goods_image.insert=INSERT INTO goblin_goods_image (spu_id,url)VALUES(?,?)
goblin_goods_tag.insert=insert into goblin_goods_tag (spu_id,tag_id,sort,tag_belong)VALUES(?,?,?,?) goblin_goods_tag.insert=insert into goblin_goods_tag (spu_id,tag_id,sort,tag_belong)VALUES(?,?,?,?)
......
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