fix manager api calling updateGoodsMarketAble error

fix manager api es generator get progress error info
This commit is contained in:
paulGao
2021-09-16 11:55:58 +08:00
parent 471b128f22
commit 8ae04e7ee6
3 changed files with 23 additions and 12 deletions

View File

@@ -282,25 +282,27 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
public Boolean updateGoodsMarketAble(List<String> goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason) {
boolean result;
AuthUser currentUser = UserContext.getCurrentUser();
if (currentUser == null || (currentUser.getRole().equals(UserEnums.STORE) && currentUser.getStoreId() == null)) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
//如果商品为空,直接返回
if (goodsIds == null || goodsIds.isEmpty()) {
return true;
}
LambdaUpdateWrapper<Goods> updateWrapper = Wrappers.lambdaUpdate();
LambdaQueryWrapper<Goods> queryWrapper = new LambdaQueryWrapper<Goods>().in(Goods::getId, goodsIds);
updateWrapper.set(Goods::getMarketEnable, goodsStatusEnum.name());
updateWrapper.set(Goods::getUnderMessage, underReason);
updateWrapper.eq(Goods::getStoreId, currentUser.getStoreId());
AuthUser currentUser = UserContext.getCurrentUser();
if (currentUser == null || (currentUser.getRole().equals(UserEnums.STORE) && currentUser.getStoreId() == null)) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
} else if (currentUser.getRole().equals(UserEnums.STORE) && currentUser.getStoreId() != null) {
updateWrapper.eq(Goods::getStoreId, currentUser.getStoreId());
queryWrapper.eq(Goods::getStoreId, currentUser.getStoreId());
}
updateWrapper.in(Goods::getId, goodsIds);
result = this.update(updateWrapper);
//修改规格商品
List<Goods> goodsList = this.list(new LambdaQueryWrapper<Goods>().in(Goods::getId, goodsIds).eq(Goods::getStoreId, currentUser.getStoreId()));
List<Goods> goodsList = this.list(queryWrapper);
for (Goods goods : goodsList) {
goodsSkuService.updateGoodsSkuStatus(goods);
}

View File

@@ -199,7 +199,6 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
resultMap.put(KEY_FAIL, 0);
resultMap.put(KEY_PROCESSED, 0);
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix() + "", resultMap);
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), true);
if (!goodsIndexList.isEmpty()) {
goodsIndexRepository.deleteAll();
for (EsGoodsIndex goodsIndex : goodsIndexList) {