he2802 3 лет назад
Родитель
Сommit
2f645bef6b

+ 34 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -20,8 +20,12 @@ import com.zhongzheng.modules.course.service.ICourseMenuService;
 import com.zhongzheng.modules.course.service.ICourseSectionService;
 import com.zhongzheng.modules.course.vo.CourseLiveVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
+import com.zhongzheng.modules.exam.domain.ExamApplyUser;
 import com.zhongzheng.modules.exam.domain.ExamBefore;
+import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
+import com.zhongzheng.modules.exam.service.IExamApplyUserService;
 import com.zhongzheng.modules.exam.service.IExamBeforeService;
+import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.service.IGoodsCourseService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
@@ -127,6 +131,12 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
     @Autowired
     private IExamBeforeService iExamBeforeService;
 
+    @Autowired
+    private IExamApplyGoodsService iExamApplyGoodsService;
+
+    @Autowired
+    private IExamApplyUserService iExamApplyUserService;
+
     @Override
     public OrderGoodsVo queryById(Long orderGoodsId) {
         OrderGoods db = this.baseMapper.selectById(orderGoodsId);
@@ -552,6 +562,30 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
                         }
                     }
                 }
+                //查询对应考试安排
+                List<ExamApplyGoodsVo> examApplyGoodsVoList = iExamApplyGoodsService.listByGoodsId(goodsVo.getGoodsId());
+                if (examApplyGoodsVoList != null && examApplyGoodsVoList.size() > 0) {
+                    List<ExamApplyGoodsVo> examApplyGoodsVos = new ArrayList<>();
+                    List<ExamApplyGoodsVo> examApplyGoodsVos2 = new ArrayList<>();
+                    examApplyGoodsVoList.forEach(examApplyGoodsVo -> {
+                        LambdaQueryWrapper<ExamApplyUser> lqw = Wrappers.lambdaQuery();
+                        lqw.eq(ExamApplyUser::getApplyId, examApplyGoodsVo.getApplyId());
+                        List<ExamApplyUser> examApplyUserList = iExamApplyUserService.list(lqw);
+                        if (examApplyUserList != null && examApplyUserList.size() > 0) {
+                            ArrayList<Long> userIds = new ArrayList<>();
+                            examApplyUserList.forEach(examApplyUser -> {
+                                userIds.add(examApplyUser.getUserId());
+                            });
+                            if (userIds.contains(bo.getUserId())) {
+                                examApplyGoodsVos.add(examApplyGoodsVo);
+                            }
+                        }else {
+                            examApplyGoodsVos2.add(examApplyGoodsVo);
+                        }
+                    });
+                    examApplyGoodsVos.addAll(examApplyGoodsVos2);
+                    goodsVo.setExamApplyGoodsList(examApplyGoodsVos);
+                }
             }
         }
         return list;

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java

@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.zhongzheng.common.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import java.math.BigDecimal;
+
+import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -303,5 +305,9 @@ public class OrderGoodsVo {
 	@Excel(name = "1有效 0无效")
 	@ApiModelProperty("1有效 0无效")
 	private Integer gradeStatus;
+	/** 考试列表 */
+	@Excel(name = "考试列表")
+	@ApiModelProperty("考试列表")
+	private List<ExamApplyGoodsVo> examApplyGoodsList;
 
 }

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -98,6 +98,7 @@
         <result property="subApplySiteEndTime" column="sub_apply_site_end_time"/>
         <result property="subApplySiteExamTime" column="sub_apply_site_exam_time"/>
         <result property="subscribeId" column="subscribe_id"/>
+        <result property="gradeId" column="grade_id"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"