|
|
@@ -27,6 +27,7 @@ import com.zhongzheng.modules.goods.domain.GoodsSpecAttributeRelation;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsSpecAttributeRelationService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsSpecTemplateService;
|
|
|
+import com.zhongzheng.modules.order.bo.CommonOfficialBo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -278,4 +279,37 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
|
|
|
List<CourseSubject> subjects = iCourseSubjectService.listByIds(subjectIds);
|
|
|
return subjects.stream().map(item -> BeanUtil.toBean(item,CourseSubjectVo.class)).collect(Collectors.toList());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ActivityRecommendVo> officialList(CommonOfficialBo bo) {
|
|
|
+ ActivityRecommendQueryBo queryBo = new ActivityRecommendQueryBo();
|
|
|
+ queryBo.setStatusList(Arrays.asList(bo.getStatus()));
|
|
|
+ queryBo.setPlatform(bo.getPlatform());
|
|
|
+ List<ActivityRecommendVo> activityRecommendVos = baseMapper.selectListByBo(queryBo);
|
|
|
+ if (CollectionUtils.isEmpty(activityRecommendVos)){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<ActivityRecommendVo> collect = activityRecommendVos.stream().sorted(Comparator.comparing(ActivityRecommendVo::getType).thenComparing(ActivityRecommendVo::getSort)).collect(Collectors.toList());
|
|
|
+ for (ActivityRecommendVo recommendVo : collect) {
|
|
|
+ //获取商品
|
|
|
+ List<ActivityRecommendGoods> list = iActivityRecommendGoodsService.list(new LambdaQueryWrapper<ActivityRecommendGoods>()
|
|
|
+ .eq(ActivityRecommendGoods::getRecommendId, recommendVo.getRecommendId())
|
|
|
+ .orderByAsc(ActivityRecommendGoods::getSort));
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ List<Goods> goods = iGoodsService.list(new LambdaQueryWrapper<Goods>()
|
|
|
+ .in(Goods::getGoodsId,list.stream().map(ActivityRecommendGoods::getGoodsId).collect(Collectors.toList()))
|
|
|
+ .last("limit 5"));
|
|
|
+ List<ActivityRecommendGoodsVo> collect1 = goods.stream().map(item -> {
|
|
|
+ ActivityRecommendGoodsVo vo = new ActivityRecommendGoodsVo();
|
|
|
+ vo.setGoodsId(item.getGoodsId());
|
|
|
+ vo.setGoodsName(item.getGoodsName());
|
|
|
+ vo.setStandPrice(item.getStandPrice());
|
|
|
+ vo.setCoverUrl(item.getCoverUrl());
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ recommendVo.setGoodsList(collect1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return activityRecommendVos;
|
|
|
+ }
|
|
|
}
|