|
@@ -19,10 +19,15 @@ import com.zhongzheng.modules.activity.service.IActivityRecommendGoodsService;
|
|
|
import com.zhongzheng.modules.activity.service.IActivityRecommendService;
|
|
|
import com.zhongzheng.modules.activity.vo.ActivityRecommendGoodsVo;
|
|
|
import com.zhongzheng.modules.activity.vo.ActivityRecommendVo;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseSubjectService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseSubjectVo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsSpecAttributeRelation;
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsSpecTemplate;
|
|
|
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.goods.vo.GoodsVo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -47,6 +52,10 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
|
|
|
private IGoodsService iGoodsService;
|
|
|
@Autowired
|
|
|
private IGoodsSpecAttributeRelationService goodsSpecAttributeRelationService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseSubjectService iCourseSubjectService;
|
|
|
+ @Autowired
|
|
|
+ private IGoodsSpecTemplateService goodsSpecTemplateService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -195,13 +204,16 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
|
|
|
public TableDataInfo<ActivityRecommendGoodsVo> getGoodsList(ActivityRecommendGoodsQueryBo bo) {
|
|
|
TableDataInfo<ActivityRecommendGoodsVo> result = new TableDataInfo<>();
|
|
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<ActivityRecommendGoodsVo> page =
|
|
|
- iActivityRecommendGoodsService.getRecommendGoodsListByPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(bo.getPageNum(), bo.getPageSize()),bo.getRecommendId());
|
|
|
+ iActivityRecommendGoodsService.getRecommendGoodsListByPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(bo.getPageNum(), bo.getPageSize()),bo.getRecommendId(),bo.getSubjectId());
|
|
|
if (CollectionUtils.isEmpty(page.getRecords())){
|
|
|
return result;
|
|
|
}
|
|
|
page.getRecords().forEach(item -> {
|
|
|
Goods goods = iGoodsService.getById(item.getGoodsId());
|
|
|
- if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
|
|
|
+ if (ObjectUtils.isNotNull(goods.getSpecTemplateId()) &&
|
|
|
+ goodsSpecTemplateService.count(new LambdaQueryWrapper<GoodsSpecTemplate>()
|
|
|
+ .eq(GoodsSpecTemplate::getSpecTemplateId,goods.getSpecTemplateId())
|
|
|
+ .eq(GoodsSpecTemplate::getStatus,1)) > 0){
|
|
|
item.setSpecTemplateId(goods.getSpecTemplateId());
|
|
|
}else {
|
|
|
List<GoodsSpecAttributeRelation> list = goodsSpecAttributeRelationService.list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
@@ -219,4 +231,24 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
|
|
|
result.setCode(200);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CourseSubjectVo> getSubjectList(ActivityRecommendGoodsQueryBo bo) {
|
|
|
+ List<ActivityRecommendGoods> recommendGoods = iActivityRecommendGoodsService.list(new LambdaQueryWrapper<ActivityRecommendGoods>()
|
|
|
+ .eq(ActivityRecommendGoods::getRecommendId, bo.getRecommendId())
|
|
|
+ .orderByAsc(ActivityRecommendGoods::getSort));
|
|
|
+ if (CollectionUtils.isEmpty(recommendGoods)){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<Goods> goodsList = iGoodsService.listByIds(recommendGoods.stream().map(ActivityRecommendGoods::getGoodsId).collect(Collectors.toList()));
|
|
|
+ Set<Long> subjectIds = new HashSet<>();
|
|
|
+ goodsList.stream().filter(x -> com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(x.getSubjectIds())).forEach(item -> {
|
|
|
+ Arrays.stream(item.getSubjectIds().split(",")).forEach(id -> {
|
|
|
+ subjectIds.add(Long.valueOf(id));
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //获取科目信息
|
|
|
+ List<CourseSubject> subjects = iCourseSubjectService.listByIds(subjectIds);
|
|
|
+ return subjects.stream().map(item -> BeanUtil.toBean(item,CourseSubjectVo.class)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|