yangdamao 3 năm trước cách đây
mục cha
commit
2b18b658ab

+ 31 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -15,6 +15,7 @@ import com.zhongzheng.modules.activity.domain.ActivityRecommend;
 import com.zhongzheng.modules.activity.domain.ActivityRecommendGoods;
 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.bank.domain.Exam;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.service.IExamService;
@@ -354,17 +355,40 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         if (CollectionUtils.isEmpty(page.getRecords())){
             return tableDataInfo;
         }
-        List<GoodsVo> result = page.getRecords().stream().map(item -> {
-            Goods goods = iGoodsService.getById(item.getGoodsId());
-            GoodsVo goodsVo = new GoodsVo();
-            BeanUtil.copyProperties(goods, goodsVo);
-            return goodsVo;
-        }).collect(Collectors.toList());
 
+        List<ActivityRecommendGoods> result = page.getRecords();
+        List<ActivityRecommendGoodsVo> listVos = new ArrayList<>();
+        for (ActivityRecommendGoods item : result) {
+            Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
+                    .eq(Goods::getGoodsId, item.getGoodsId())
+                    .eq(Goods::getGoodsStatus, 1));
+            if (ObjectUtils.isNotNull(goods)){
+                ActivityRecommendGoodsVo vo = new ActivityRecommendGoodsVo();
+                BeanUtil.copyProperties(item, vo);
+                vo.setGoodsName(goods.getGoodsName());
+                vo.setGoodsType(goods.getGoodsType());
+                vo.setCoverUrl(goods.getCoverUrl());
+                vo.setYear(goods.getYear());
+                vo.setStandPrice(goods.getStandPrice());
+                vo.setLinePrice(goods.getLinePrice());
+                listVos.add(vo);
+            }
+        }
         tableDataInfo.setTotal(page.getTotal());
-        tableDataInfo.setRows(result);
+        tableDataInfo.setRows(listVos);
         tableDataInfo.setCode(200);
         return tableDataInfo;
+//        List<GoodsVo> result = page.getRecords().stream().map(item -> {
+//            Goods goods = iGoodsService.getById(item.getGoodsId());
+//            GoodsVo goodsVo = new GoodsVo();
+//            BeanUtil.copyProperties(goods, goodsVo);
+//            return goodsVo;
+//        }).collect(Collectors.toList());
+//
+//        tableDataInfo.setTotal(page.getTotal());
+//        tableDataInfo.setRows(result);
+//        tableDataInfo.setCode(200);
+//        return tableDataInfo;
     }
 
     private boolean checkNameUnique(ExamApply entity) {