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

Commit 4768a889 authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents baf9e389 9a985041
...@@ -8,8 +8,6 @@ import lombok.Data; ...@@ -8,8 +8,6 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@ApiModel(value = "GoblinStoreGoodsCategoryVo", description = "店铺商品分类") @ApiModel(value = "GoblinStoreGoodsCategoryVo", description = "店铺商品分类")
@Data @Data
......
...@@ -30,6 +30,7 @@ import java.time.LocalDateTime; ...@@ -30,6 +30,7 @@ import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@ApiSupport(order = 149005) @ApiSupport(order = 149005)
@Api(tags = "店铺商品分类") @Api(tags = "店铺商品分类")
...@@ -69,21 +70,21 @@ public class GoblinStoreMgtCategoryController { ...@@ -69,21 +70,21 @@ public class GoblinStoreMgtCategoryController {
@NotBlank(message = "平台分类不能为空") @RequestParam String catesid, @NotBlank(message = "平台分类不能为空") @RequestParam String catesid,
// @NotBlank(message = "平台分类不能为空") @RequestParam String catetid, // @NotBlank(message = "平台分类不能为空") @RequestParam String catetid,
@NotBlank(message = "店铺分类名称不能为空") @RequestParam String catename, @NotBlank(message = "店铺分类名称不能为空") @RequestParam String catename,
@Min(value = 0, message = "排序不能小于0") @RequestParam(required = false) Integer sort) { @Min(value = 1, message = "排序不能小于0") @RequestParam(required = false) Integer sort) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) { if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
List<GoblinSelfGoodsCategoryVo> selfGoodsCategoryVos = goblinRedisUtils.getSelfGoodsCategoryVos(); List<GoblinSelfGoodsCategoryVo> selfGoodsCategoryVos = goblinRedisUtils.getSelfGoodsCategoryVos();
if (CollectionUtils.isEmpty(selfGoodsCategoryVos)) { if (CollectionUtils.isEmpty(selfGoodsCategoryVos)) {
log.warn("店铺商品分类管理:添加:平台分类未创建[UID={},storeId={},catefid={},catesid={}]", currentUid, storeId, catefid, catesid); log.warn("店铺商品分类管理:添加:平台分类未创建[UID={},storeId={},catefid={},catesid={},catename={}]", currentUid, storeId, catefid, catesid, catename);
return ResponseDto.failure(ErrorMapping.get("149001")); return ResponseDto.failure(ErrorMapping.get("149001"));
} }
List<String> catePidList = Arrays.asList(catefid, catesid); List<String> catePidList = Arrays.asList(catefid, catesid);
Map<String, GoblinSelfGoodsCategoryVo> filterMap = selfGoodsCategoryVos.stream() Map<String, GoblinSelfGoodsCategoryVo> filterMap = selfGoodsCategoryVos.stream()
.filter(r -> catePidList.contains(r.getCateId())).collect(Collectors.toMap(GoblinSelfGoodsCategoryVo::getCateId, Function.identity())); .filter(r -> catePidList.contains(r.getCateId())).collect(Collectors.toMap(GoblinSelfGoodsCategoryVo::getCateId, Function.identity()));
if (CollectionUtils.isEmpty(filterMap) || filterMap.size() < 2) { if (CollectionUtils.isEmpty(filterMap) || filterMap.size() < 2) {
log.warn("店铺商品分类管理:添加:平台分类ID有误[UID={},storeId={},catefid={},catesid={}]", currentUid, storeId, catefid, catesid); log.warn("店铺商品分类管理:添加:平台分类ID有误[UID={},storeId={},catefid={},catesid={},catename={}]", currentUid, storeId, catefid, catesid, catename);
return ResponseDto.failure(ErrorMapping.get("149001")); return ResponseDto.failure(ErrorMapping.get("149001"));
} }
ArrayList<GoblinStoreGoodsCategoryVo> addStoreGoodsCategoryVoList = ObjectUtil.getGoblinStoreGoodsCategoryVoArrayList(); ArrayList<GoblinStoreGoodsCategoryVo> addStoreGoodsCategoryVoList = ObjectUtil.getGoblinStoreGoodsCategoryVoArrayList();
...@@ -99,6 +100,11 @@ public class GoblinStoreMgtCategoryController { ...@@ -99,6 +100,11 @@ public class GoblinStoreMgtCategoryController {
addStoreGoodsCategoryVoList.add(storeGoodsCategoryVo); addStoreGoodsCategoryVoList.add(storeGoodsCategoryVo);
}); });
} else {// 存在则判断,是否为已存在的父级分类 } else {// 存在则判断,是否为已存在的父级分类
if (storeGoodsCategoryVosCache.stream().anyMatch(r -> r.getName().equals(catename))) {
log.warn("店铺商品分类管理:添加:分类名称重复[UID={},storeId={},catefid={},catesid={},catename={}]", currentUid, storeId, catefid, catesid, catename);
return ResponseDto.failure(ErrorMapping.get("149007"));
}
Map<String, GoblinStoreGoodsCategoryVo> existFilterMap = storeGoodsCategoryVosCache.stream().filter(r -> catePidList.contains(r.getCateId())) Map<String, GoblinStoreGoodsCategoryVo> existFilterMap = storeGoodsCategoryVosCache.stream().filter(r -> catePidList.contains(r.getCateId()))
.collect(Collectors.toMap(GoblinStoreGoodsCategoryVo::getCateId, Function.identity())); .collect(Collectors.toMap(GoblinStoreGoodsCategoryVo::getCateId, Function.identity()));
GoblinStoreGoodsCategoryVo fStoreGoodsCategoryVo = existFilterMap.get(catefid); GoblinStoreGoodsCategoryVo fStoreGoodsCategoryVo = existFilterMap.get(catefid);
...@@ -133,7 +139,7 @@ public class GoblinStoreMgtCategoryController { ...@@ -133,7 +139,7 @@ public class GoblinStoreMgtCategoryController {
storeGoodsCategoryVo.setCreatedAt(now); storeGoodsCategoryVo.setCreatedAt(now);
addStoreGoodsCategoryVoList.add(storeGoodsCategoryVo); addStoreGoodsCategoryVoList.add(storeGoodsCategoryVo);
goblinStoreMgtCategoryService.add(currentUid, addStoreGoodsCategoryVoList, storeGoodsCategoryVosCache); goblinStoreMgtCategoryService.add(storeId, addStoreGoodsCategoryVoList, storeGoodsCategoryVosCache);
return ResponseDto.success(storeGoodsCategoryVo.getCateId()); return ResponseDto.success(storeGoodsCategoryVo.getCateId());
} }
...@@ -150,7 +156,7 @@ public class GoblinStoreMgtCategoryController { ...@@ -150,7 +156,7 @@ public class GoblinStoreMgtCategoryController {
public ResponseDto<Object> edit(@NotBlank(message = "店铺ID不能为空") @RequestParam String storeId, public ResponseDto<Object> edit(@NotBlank(message = "店铺ID不能为空") @RequestParam String storeId,
@NotBlank(message = "店铺分类ID不能为空") @RequestParam String cateid, @NotBlank(message = "店铺分类ID不能为空") @RequestParam String cateid,
@NotBlank(message = "店铺分类名称不能为空") @RequestParam String catename, @NotBlank(message = "店铺分类名称不能为空") @RequestParam String catename,
@Min(value = 0, message = "排序不能小于0") @RequestParam(required = false) Integer sort) { @Min(value = 1, message = "排序不能小于0") @RequestParam(required = false) Integer sort) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) { if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
......
...@@ -105,6 +105,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -105,6 +105,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
goblinMongoUtils.setGoodsInfoVo(goodsInfoVo); goblinMongoUtils.setGoodsInfoVo(goodsInfoVo);
goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList); goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList);
// TODO: 2022/1/18 zhanggb==
goodsSkuInfoVoList.forEach(r -> goblinRedisUtils.setSkuStock(null, r.getSkuId(), r.getSkuStock()));
String spuId = goodsInfoVo.getSpuId(); String spuId = goodsInfoVo.getSpuId();
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
149004= 149004=
149005= 149005=
149006=添加商品失败,规格信息无效 149006=添加商品失败,规格信息无效
149007= 149007=商品分类名称重复,请核实
149008= 149008=
149009= 149009=
149010=商品不存在,请核实 149010=商品不存在,请核实
......
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