fix pointRecommendLine 优化代码

This commit is contained in:
shuo.wang
2025-02-06 10:17:36 +08:00
parent 78af1e29d5
commit a109c20c34

View File

@@ -661,14 +661,13 @@ public class PointServiceImpl implements PointService {
if(CollectionUtils.isNotEmpty(recommendList)){ if(CollectionUtils.isNotEmpty(recommendList)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "推送失败,铺位已被选"); throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "推送失败,铺位已被选");
} }
List<Long> shopIds = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus())).filter(o->request.getShopIds().contains(o.getShopId())).map(PointRecommendDO::getShopId).collect(Collectors.toList()); List<Long> shopIds = recommendPointList.stream()
if(CollectionUtils.isNotEmpty(shopIds)){ .filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus()))
shopIds.retainAll(request.getShopIds()); .filter(o->request.getShopIds().contains(o.getShopId())).map(PointRecommendDO::getShopId).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(shopIds)){ if(CollectionUtils.isNotEmpty(shopIds)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "请勿重复推送"); throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "请勿重复推送");
} }
} }
}
List<PointRecommendDO> recommendList = request.convertList(); List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList); return pointRecommendDAO.addRecommendPoint(recommendList);
} }