he2802 3 жил өмнө
parent
commit
f14cab8fc0
14 өөрчлөгдсөн 281 нэмэгдсэн , 10 устгасан
  1. 28 2
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java
  2. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionController.java
  3. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java
  4. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java
  5. 25 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java
  6. 9 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseEducationTypeServiceImpl.java
  7. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java
  8. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java
  9. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java
  10. 5 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsAttachedVo.java
  11. 29 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserQuestionVo.java
  12. 122 1
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml
  13. 11 2
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml
  14. 33 0
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

+ 28 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -4,7 +4,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Arrays;
 
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.bank.bo.ExamQuestionQueryBo;
+import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
@@ -15,7 +17,10 @@ import com.zhongzheng.modules.goods.service.IGoodsAuditionConfigService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.goods.vo.GoodsAuditionConfigVo;
+import com.zhongzheng.modules.goods.vo.GoodsUserQuestionVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -52,8 +57,7 @@ public class GoodsController extends BaseController {
 
     private final IGoodsAttachedService iGoodsAttachedService;
 
-    @Autowired
-    private IGoodsAuditionConfigService iGoodsAuditionConfigService;
+    private final IQuestionService iQuestionService;
 
     /**
      * 查询商品列表
@@ -218,4 +222,26 @@ public class GoodsController extends BaseController {
         List<ExamNumberGoodsVo> list = iGoodsService.listGoods(bo);
         return getDataTable(list);
     }
+
+    /**
+     * 查询免费题库商品列表
+     */
+    @ApiOperation("查询免费题库商品列表")
+    @GetMapping("/listFreeGoodsList")
+    public TableDataInfo<GoodsUserQuestionVo> listFreeGoodsList(GoodsQueryBo bo) {
+        startPage();
+        List<GoodsUserQuestionVo> list = iQuestionService.listFreeGoodsList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询免费题库商品列表
+     */
+    @ApiOperation("查询用户题库商品列表")
+    @GetMapping("/listBankGoodsList")
+    public TableDataInfo<GoodsUserQuestionVo> listBankGoodsList(GoodsQueryBo bo) {
+        startPage();
+        List<GoodsUserQuestionVo> list = iQuestionService.listBankGoodsList(bo);
+        return getDataTable(list);
+    }
 }

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionController.java

@@ -95,7 +95,7 @@ public class QuestionController extends BaseController {
         startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
-        List<GoodsUserQuestionVo> list = iQuestionService.listFreeGoodsList(bo);
+        List<GoodsUserQuestionVo> list = iQuestionService.listUserFreeGoodsList(bo);
         for (GoodsUserQuestionVo g : list) {
             UserExamRecordQueryBo userExamRecordQueryBo = new UserExamRecordQueryBo();
             userExamRecordQueryBo.setOrderGoodsId(g.getOrderGoodsId());

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java

@@ -22,5 +22,9 @@ public interface QuestionMapper extends BaseMapper<Question> {
 
     List<GoodsUserQuestionVo> listGoodsUserQuestionVo(GoodsQueryBo bo);
 
+    List<GoodsUserQuestionVo> listUserFreeGoodsList(GoodsQueryBo bo);
+
     List<GoodsUserQuestionVo> listFreeGoodsList(GoodsQueryBo bo);
+
+    List<GoodsUserQuestionVo> listBankGoodsList(GoodsQueryBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java

@@ -34,8 +34,12 @@ public interface IQuestionService extends IService<Question> {
 	List<QuestionVo> selectList(QuestionQueryBo bo);
 
 
+	List<GoodsUserQuestionVo> listUserFreeGoodsList(GoodsQueryBo bo);
+
 	List<GoodsUserQuestionVo> listFreeGoodsList(GoodsQueryBo bo);
 
+	List<GoodsUserQuestionVo> listBankGoodsList(GoodsQueryBo bo);
+
 	/**
 	 * 查询列表
 	 */

+ 25 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -33,6 +33,7 @@ import com.zhongzheng.modules.exam.bo.ExamKnowledgeBusinessAddBo;
 import com.zhongzheng.modules.exam.domain.ExamKnowledge;
 import com.zhongzheng.modules.exam.service.IExamKnowledgeService;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
+import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsUserQuestionVo;
 
 import org.apache.poi.openxml4j.opc.PackagePart;
@@ -93,6 +94,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     @Autowired
     private IExamQuestionService iExamQuestionService;
 
+    @Autowired
+    private IGoodsService iGoodsService;
+
     @Autowired
     private RedisCache redisCache;
 
@@ -114,9 +118,29 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return questionMapper.selectList(bo);
     }
 
+    @Override
+    public List<GoodsUserQuestionVo> listUserFreeGoodsList(GoodsQueryBo bo) {
+        return this.baseMapper.listUserFreeGoodsList(bo);
+    }
+
     @Override
     public List<GoodsUserQuestionVo> listFreeGoodsList(GoodsQueryBo bo) {
-        return this.baseMapper.listFreeGoodsList(bo);
+        List<GoodsUserQuestionVo> list = this.baseMapper.listFreeGoodsList(bo);
+        for(GoodsUserQuestionVo vo : list){
+            Long totalNum = iGoodsService.getExamNum(vo.getGoodsId());
+            vo.setTotalExamNum(totalNum);
+        }
+        return list;
+    }
+
+    @Override
+    public List<GoodsUserQuestionVo> listBankGoodsList(GoodsQueryBo bo) {
+        List<GoodsUserQuestionVo> list = this.baseMapper.listBankGoodsList(bo);
+        for(GoodsUserQuestionVo vo : list){
+            Long totalNum = iGoodsService.getExamNum(vo.getGoodsId());
+            vo.setTotalExamNum(totalNum);
+        }
+        return list;
     }
 
 

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseEducationTypeServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.course.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.utils.DateUtils;
@@ -44,7 +45,14 @@ public class CourseEducationTypeServiceImpl extends ServiceImpl<CourseEducationT
     @Override
     public CourseEducationTypeVo queryById(Long id){
         CourseEducationType db = this.baseMapper.selectById(id);
-        return BeanUtil.toBean(db, CourseEducationTypeVo.class);
+        CourseEducationTypeVo vo = BeanUtil.toBean(db, CourseEducationTypeVo.class);
+        if(Validator.isNotEmpty(vo)){
+            CourseEducationTierVo tierVo = courseEducationTierService.queryById(vo.getId());
+            if(Validator.isNotEmpty(tierVo)){
+                vo.setTireStatus(tierVo.getTireStatus());
+            }
+        }
+        return vo;
     }
 
     @Override

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -19,6 +19,7 @@ import java.util.List;
  */
 public interface GoodsMapper extends BaseMapper<Goods> {
     List<GoodsVo> selectAllList(GoodsQueryBo bo);
+
     GoodsVo selectDetail(Long goodsId);
 
     List<ExamNumberGoodsVo> listGoods(ExamNumberGoodsQueryBo bo);
@@ -30,4 +31,6 @@ public interface GoodsMapper extends BaseMapper<Goods> {
     int queryUpGoods();
 
     List<GoodsVo> selectListToInput(GoodsQueryBo bo);
+
+    Long getExamNum(Long goodsId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -33,6 +33,8 @@ public interface IGoodsService extends IService<Goods> {
 
 	Long getQuestionNum(Long goodsId);
 
+	Long getExamNum(Long goodsId);
+
 	/**
 	 * 查询列表
 	 */

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -126,6 +126,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return baseMapper.getQuestionNum(goodsId);
     }
 
+    @Override
+    public Long getExamNum(Long goodsId) {
+        return baseMapper.getExamNum(goodsId);
+    }
+
     @Override
     public List<GoodsVo> queryList(GoodsQueryBo bo) {
         LambdaQueryWrapper<Goods> lqw = Wrappers.lambdaQuery();

+ 5 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsAttachedVo.java

@@ -77,5 +77,9 @@ public class GoodsAttachedVo {
 	private Integer doNum;
 	@ApiModelProperty("试卷可以做次数")
 	private Integer answerNum;
-
+	/** 发布状态 1发布 0未发布 */
+	@ApiModelProperty("发布状态 1发布 0未发布")
+	private Long publishStatus;
+	@ApiModelProperty("编码")
+	private String code;
 }

+ 29 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserQuestionVo.java

@@ -34,7 +34,7 @@ public class GoodsUserQuestionVo {
 	private Long supplyId;
 	/** $column.columnComment */
 	@Excel(name = "供应方" , readConverterExp = "商品类型 1视频2题库 3面授 4服务 5组合")
-	@ApiModelProperty("商品类型 1视频2题库 3面授 4服务 5组合")
+	@ApiModelProperty("商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库")
 	private Integer goodsType;
 	/** 教育类型id */
 	@Excel(name = "教育类型id")
@@ -242,4 +242,32 @@ public class GoodsUserQuestionVo {
 	@Excel(name = "订单商品ID")
 	@ApiModelProperty("订单商品ID")
 	private Long orderGoodsId;
+
+	/** 学员编码 */
+	@Excel(name = "学员姓名")
+	@ApiModelProperty("学员姓名")
+	private String realName;
+
+
+	/** 学员编码 */
+	@Excel(name = "学员身份证")
+	@ApiModelProperty("学员身份证")
+	private String idCard;
+
+	/** 订单编号 */
+	@Excel(name = "订单编号")
+	@ApiModelProperty("订单编号")
+	private String orderSn;
+
+	@Excel(name = "做题开始时间")
+	@ApiModelProperty("做题开始时间")
+	private Long doStartTime;
+
+	@Excel(name = "做题结束时间")
+	@ApiModelProperty("做题结束时间")
+	private Long doEndTime;
+	@ApiModelProperty("已做的试卷数量")
+	private Long doExamNum;
+	@ApiModelProperty("总的试卷数量")
+	private Long totalExamNum;
 }

+ 122 - 1
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -163,6 +163,13 @@
         <result property="serviceStartTime" column="service_start_time"/>
         <result property="serviceEndTime" column="service_end_time"/>
         <result property="orderGoodsId" column="order_goods_id"/>
+        <result property="realName" column="realname"/>
+        <result property="idCard" column="id_card"/>
+        <result property="orderSn" column="order_sn"/>
+
+        <result property="doStartTime" column="do_start_time"/>
+        <result property="doEndTime" column="do_end_time"/>
+        <result property="doExamNum" column="do_exam_num"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
@@ -317,7 +324,7 @@
     </select>
 
 
-    <select id="listFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
+    <select id="listUserFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
         SELECT
              g.*,
                      ps.supply_name,
@@ -357,4 +364,118 @@
             </if>
             ORDER BY og.create_time DESC
     </select>
+
+    <select id="listFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
+        SELECT
+        g.*,
+        ps.supply_name,
+        cet.education_name,
+        cpt.project_name,
+        cb.business_name,
+        s.school_name,
+        m.category_name,
+        ot.type AS template_type,
+        ( SELECT gs.goods_name FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_name,
+        ( SELECT gs.CODE FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_code,
+        o.user_id,
+        o.order_sn,
+        og.create_time as order_create_time,
+        og.service_start_time,
+        og.service_end_time,
+        og.order_goods_id,
+        u.realname,
+        u.id_card,
+        (SELECT MIN(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_start_time,
+        (SELECT MAX(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_end_time,
+        (SELECT count(DISTINCT uer.exam_id) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_exam_num
+        FROM `order` o
+        LEFT JOIN order_goods og ON o.order_sn = og.order_sn
+        LEFT JOIN order_goods_free ogf ON og.order_goods_id = ogf.order_goods_id
+        LEFT JOIN goods g ON ogf.free_goods_id = g.goods_id
+        LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
+        LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        LEFT JOIN school s ON s.id = g.school_id
+        LEFT JOIN major m ON g.major_id = m.id
+        LEFT JOIN order_input_template ot ON cb.template_status = ot.id
+        LEFT JOIN `user` u ON u.user_id = o.user_id
+        WHERE
+        1 = 1
+        AND g.goods_type = 5
+        AND og.`status` = 1
+        AND og.pay_status IN ( 2, 3, 4 )
+        AND og.refund_status IN (0,3,1)
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="majorId != null and majorId != ''">
+            AND g.major_id = #{majorId}
+        </if>
+        <if test="searchKey != null and searchKey != ''">
+            and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
+        </if>
+        ORDER BY og.create_time DESC
+    </select>
+
+    <select id="listBankGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
+        SELECT
+        g.*,
+        ps.supply_name,
+        cet.education_name,
+        cpt.project_name,
+        cb.business_name,
+        s.school_name,
+        m.category_name,
+        ot.type AS template_type,
+        ( SELECT gs.goods_name FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_name,
+        ( SELECT gs.CODE FROM goods gs WHERE 1 = 1 AND g.make_goods_id = gs.goods_id ) AS make_goods_code,
+        o.user_id,
+        o.order_sn,
+        og.create_time as order_create_time,
+        og.service_start_time,
+        og.service_end_time,
+        og.order_goods_id,
+        u.realname,
+        u.id_card,
+        (SELECT MIN(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_start_time,
+        (SELECT MAX(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_end_time,
+        (SELECT count(DISTINCT uer.exam_id) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_exam_num
+        FROM `order` o
+        LEFT JOIN order_goods og ON o.order_sn = og.order_sn
+        LEFT JOIN goods g ON og.goods_id = g.goods_id
+        LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
+        LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        LEFT JOIN school s ON s.id = g.school_id
+        LEFT JOIN major m ON g.major_id = m.id
+        LEFT JOIN order_input_template ot ON cb.template_status = ot.id
+        LEFT JOIN `user` u ON u.user_id = o.user_id
+        WHERE
+        1 = 1
+        AND g.goods_type = 5
+        AND og.`status` = 1
+        AND og.pay_status IN ( 2, 3, 4 )
+        AND og.refund_status IN (0,3,1)
+        <if test="goodsId != null and goodsId != ''">
+            AND og.goods_id = #{goodsId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="majorId != null and majorId != ''">
+            AND g.major_id = #{majorId}
+        </if>
+        <if test="searchKey != null and searchKey != ''">
+            and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
+        </if>
+        ORDER BY og.create_time DESC
+    </select>
 </mapper>

+ 11 - 2
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -34,6 +34,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="doType" column="do_type"/>
 		<result property="doNum" column="do_num"/>
 		<result property="answerNum" column="answer_num"/>
+		<result property="publishStatus" column="publish_status"/>
+		<result property="code" column="code"/>
     </resultMap>
 
     <select id="getList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">
@@ -76,14 +78,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 					e.question_num
 				END question_num,
 			CASE
-
 				WHEN ga.type = 1 THEN
 					qm.publish_status
 				WHEN ga.type = 2 THEN
 					qc.publish_status
 				WHEN ga.type = 3 THEN
 					e.publish_status
-				END publish_status
+				END publish_status,
+			CASE
+			WHEN ga.type = 1 THEN
+			qm.`code`
+			WHEN ga.type = 2 THEN
+			qc.`code`
+			WHEN ga.type = 3 THEN
+			e.`code`
+			END code
 			<if test="userId != null ">
 				,
 				CASE

+ 33 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -515,4 +515,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="queryUpGoods">
         update goods g set g.goods_status=0 where unix_timestamp(now()) > g.validity_end_time and g.goods_status = 1
     </update>
+
+    <select id="getExamNum" parameterType="Long" resultType="Long">
+        SELECT
+                count( exam_id )+((
+                SELECT
+                    count( major_id )
+                FROM
+                    goods_attached
+                WHERE
+                    goods_id = #{goodsId}
+                  AND type = 3
+            )) AS exam_num
+        FROM
+            question_chapter_exam
+        WHERE
+            FIND_IN_SET(
+                    chapter_exam_id,
+                    (
+                        SELECT
+                            concat(
+                                    IFNULL(( SELECT GROUP_CONCAT( major_id ) eids FROM goods_attached WHERE goods_id = #{goodsId} AND type = 2 ), '' ),
+                                    ',',
+                                    IFNULL(
+                                            (
+                                                SELECT
+                                                    GROUP_CONCAT( chapter_exam_id ) eids2
+                                                FROM
+                                                    question_module_chapter
+                                                WHERE
+                                                        module_exam_id IN ( SELECT major_id FROM goods_attached WHERE goods_id = #{goodsId} AND type = 1 )),
+                                            ''
+                                        ))))
+    </select>
 </mapper>