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

Commit 40252d49 authored by 张国柄's avatar 张国柄

~API:SKU删除updateOne -> updateMany;

parent 222f1f2a
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.JsonUtils;
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;
...@@ -756,18 +757,18 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -756,18 +757,18 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
for (List<GoblinGoodsSpecDto> goblinGoodsSpecDtos : remainSkuSpecDtoList) { for (List<GoblinGoodsSpecDto> goblinGoodsSpecDtos : remainSkuSpecDtoList) {
for (GoblinGoodsSpecDto goblinGoodsSpecDto : goblinGoodsSpecDtos) { for (GoblinGoodsSpecDto goblinGoodsSpecDto : goblinGoodsSpecDtos) {
String specName = goblinGoodsSpecDto.getSpecName(), specVname = goblinGoodsSpecDto.getSpecVname(); String specName = goblinGoodsSpecDto.getSpecName(), specVname = goblinGoodsSpecDto.getSpecVname();
Set<String> specVnameSet = remainSkuSpecMap.get(specName); Set<String> remainSkuSpecVnameSet = remainSkuSpecMap.get(specName);
if (CollectionUtils.isEmpty(specVnameSet)) { if (CollectionUtils.isEmpty(remainSkuSpecVnameSet)) {
specVnameSet = CollectionUtil.getStringArraySet(); remainSkuSpecVnameSet = CollectionUtil.getStringArraySet();
} }
specVnameSet.add(specVname); remainSkuSpecVnameSet.add(specVname);
remainSkuSpecMap.put(specName, specVnameSet); remainSkuSpecMap.put(specName, remainSkuSpecVnameSet);
} }
} }
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)); .collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname));
List<GoblinGoodsSpecVo> specVoList = mgtGoodsInfoVo.getSpecVoList();
LinkedList<Object[]> updateGoodsSpuSpecObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> updateGoodsSpuSpecObjs = 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);// 商品指定规格
...@@ -811,6 +812,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -811,6 +812,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
List<String> delSkuIdList = goblinRedisUtils.getSkuRe(delSkuId); List<String> delSkuIdList = goblinRedisUtils.getSkuRe(delSkuId);
delSkuIdList = null == delSkuIdList ? CollectionUtil.arrayListString() : delSkuIdList; delSkuIdList = null == delSkuIdList ? CollectionUtil.arrayListString() : delSkuIdList;
delSkuIdList.add(delSkuId); delSkuIdList.add(delSkuId);
if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SKU删除[delSkuId={},skuReId={}]", delSkuId, JsonUtils.toJson(delSkuIdList));
}
if (goblinMongoUtils.delGoodsSkuInfoVo(goodsSkuInfoVo, delSkuIdList)) { if (goblinMongoUtils.delGoodsSkuInfoVo(goodsSkuInfoVo, delSkuIdList)) {
delSkuIdList.forEach(skuId -> { delSkuIdList.forEach(skuId -> {
goblinRedisUtils.delGoodsSkuInfoVo(skuId); goblinRedisUtils.delGoodsSkuInfoVo(skuId);
......
...@@ -328,7 +328,7 @@ public class GoblinMongoUtils { ...@@ -328,7 +328,7 @@ 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("storeId").is(storeId).and("spuId").in(spuIdList.toArray()).and("delFlg").is("0")), Query.query(Criteria.where("storeId").is(storeId).and("spuId").in(spuIdList).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;
...@@ -525,7 +525,7 @@ public class GoblinMongoUtils { ...@@ -525,7 +525,7 @@ public class GoblinMongoUtils {
} }
public boolean delGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo, List<String> skuIdList) { public boolean delGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo, List<String> skuIdList) {
return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName()).updateOne( return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("skuId").in(skuIdList).and("delFlg").is("0")).getQueryObject(), Query.query(Criteria.where("skuId").in(skuIdList).and("delFlg").is("0")).getQueryObject(),
Update.update("delFlg", "1").set("updatedBy", vo.getUpdatedBy()).set("updatedAt", vo.getUpdatedAt()) Update.update("delFlg", "1").set("updatedBy", vo.getUpdatedBy()).set("updatedAt", vo.getUpdatedAt())
.set("deletedBy", vo.getDeletedBy()).set("deletedAt", vo.getDeletedAt()).getUpdateObject() .set("deletedBy", vo.getDeletedBy()).set("deletedAt", vo.getDeletedAt()).getUpdateObject()
......
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