yangdamao 2 年之前
父節點
當前提交
43f5ec8ce1

+ 7 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderController.java

@@ -211,4 +211,11 @@ public class OrderController extends BaseController {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         return AjaxResult.success(iOrderService.getHaveBuyGoodsNotExpired(bo.getGoodsId(),loginUser.getUser().getUserId()));
     }
+
+    @ApiOperation("七大员课程学习校验")
+    @GetMapping("/study/check/{orderGoodsId}")
+    public AjaxResult<Void> studyCheck(@PathVariable("orderGoodsId") Long orderGoodsId) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        return toAjax(iOrderService.studyCheck(orderGoodsId,loginUser.getUser().getUserId()) ? 1 : 0);
+    }
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -43,6 +43,7 @@ import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodVo;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
 import com.zhongzheng.modules.user.domain.UserBankRecord;

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserVo.java

@@ -415,4 +415,9 @@ public class GoodsUserVo {
 
 	@ApiModelProperty("大于0开始学习")
 	private Integer studyStatus;
+
+	@ApiModelProperty("七大员继教商品年份")
+	private String sevenYear;
+	@ApiModelProperty("七大员继教订单商品年份")
+	private String orderYear;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java

@@ -92,4 +92,6 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
     Long getPeriodStartTime(ClassGradeUserQueryBo bo);
 
     Long getPeriodEndTime(ClassGradeUserQueryBo bo);
+
+    List<ClassGradeUser> getClassInfoByUser(Long userId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -139,4 +139,6 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	Long checkFinishRequiredCourse(ClassGradeUserQueryBo bo);
 
+    List<ClassGradeUser> getClassInfoByUser(Long userId);
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -217,6 +217,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         if (CollectionUtils.isEmpty(classGradeVos)) {
             return new ArrayList<>();
         }
+        for (ClassGradeVo classGradeVo : classGradeVos) {
+            classGradeVo.setStudentNumAll(classGradeVo.getStudentNum());
+        }
         return classGradeVos;
     }
 

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -2885,6 +2885,11 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return baseMapper.checkFinishRequiredCourse(bo);
     }
 
+    @Override
+    public List<ClassGradeUser> getClassInfoByUser(Long userId) {
+        return baseMapper.getClassInfoByUser(userId);
+    }
+
 
     /**
      * 实体类转化成视图对象

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderService.java

@@ -113,4 +113,6 @@ public interface IOrderService extends IService<Order> {
 	boolean arrangeGrade(String goodsName, Long goodsId, Long orderGoodsId, Long gradeId, Long userId, String orderSn, Long businessId);
 
 	Map<String, String> getActivityGoods(OrderAddBo bo);
+
+    Boolean studyCheck(Long orderGoodsId, Long userId);
 }

+ 31 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -2320,6 +2320,37 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         return payResult;
     }
 
+    @Override
+    public Boolean studyCheck(Long orderGoodsId, Long userId) {
+        OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
+        if (ObjectUtils.isNull(orderGoods)){
+            throw new CustomException("数据错误");
+        }
+        Order order = getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, orderGoods.getOrderSn()));
+        if (!order.getUserId().equals(userId)){
+            throw new CustomException("订单数据不匹配");
+        }
+        //校验是否有正在学习的七大员继教课程
+        List<ClassGradeUser> classGradeUser = iClassGradeUserService.getClassInfoByUser(userId);
+        if (CollectionUtils.isEmpty(classGradeUser)){
+            return true;
+        }
+        if (!classGradeUser.stream().noneMatch(x -> x.getOrderGoodsId().equals(orderGoodsId))){
+            ClassGradeUser gradeUser = classGradeUser.stream().findFirst().orElse(null);
+            OrderGoods orderGoodsTwo = iOrderGoodsService.getById(gradeUser.getOrderGoodsId());
+            Goods goods = iGoodsService.getById(orderGoodsTwo.getGoodsId());
+            throw new CustomException(String.format("请先学完【%s】课程!",goods.getGoodsName()));
+        }
+
+        return true;
+    }
+
+    public static void main(String[] args) {
+        List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
+        boolean b = integers.stream().noneMatch(x -> x == 3);
+        System.out.println("b = " + b);
+    }
+
     private String createGradeCode(Long goodsId, CourseBusinessVo business) {
 
         Goods goods = iGoodsService.getById(goodsId);

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java

@@ -355,4 +355,9 @@ public class OrderGoodsVo {
 	@Excel(name = "0 未学习 1学习中 2已学完  3已审核 4待重修")
 	@ApiModelProperty("0 未学习 1学习中 2已学完  3已审核 4待重修")
 	private Integer sevenClassStatus;
+
+	@ApiModelProperty("七大员继教商品可选年份")
+	private String sevenYear;
+	@ApiModelProperty("七大员继教订单商品年份")
+	private String orderYear;
 }

+ 3 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -198,6 +198,8 @@
         <result property="orderGoodsId" column="order_goods_id"/>
         <result property="profileStatus" column="profile_status"/>
         <result property="profileTpStatus" column="profile_tp_status"/>
+        <result property="sevenYear" column="seven_year"/>
+        <result property="orderYear" column="order_year"/>
 
         <result property="subExamStatus" column="sub_exam_status"/>
         <result property="subPerformance" column="sub_performance"/>
@@ -531,6 +533,7 @@
         og.grade_id,
         og.service_start_time,
         og.service_end_time,
+        og.seven_year as order_year,
         cb.goods_learning_order,
         (SELECT cet.education_name FROM  course_education_type cet  where cet.id = g.education_type_id) as education_name,
         (SELECT cet.project_name FROM  course_project_type cet where cet.id = g.project_id) as project_name,

+ 32 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -1614,4 +1614,36 @@
             ups.record_end_time DESC
             LIMIT 1
     </select>
+
+    <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
+        SELECT
+            cgu.*
+        FROM
+            class_grade_user cgu
+                LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
+                LEFT JOIN goods g ON og.goods_id = g.goods_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
+        WHERE
+                cgu.`status` = 1
+                AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
+                AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
+                AND og.`status` = 1
+                AND og.refund_status != 2
+	            AND og.pay_status IN ( 2, 3, 4 )
+	            AND cgu.period_status = 0
+	            AND cgu.finish_status = 0
+	            AND (
+	            SELECT
+	            	COUNT( usr.record_id )
+	            FROM
+	            	user_study_record usr
+	            WHERE
+	            	usr.order_goods_id = cgu.order_goods_id
+	            	AND usr.user_id = cgu.user_id
+	            	AND usr.current_status = 1
+	            ) > 0
+	            AND cgu.user_id = #{userId}
+    </select>
 </mapper>

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

@@ -113,6 +113,8 @@
         <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
         <result property="sevenClassVersion" column="seven_class_version"/>
         <result property="sevenClassStatus" column="seven_class_status"/>
+        <result property="sevenYear" column="seven_year"/>
+        <result property="orderYear" column="order_year"/>
     </resultMap>
 
     <select id="selectListBybo" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
@@ -470,6 +472,7 @@
         og.service_end_time,
         og.order_goods_id,
         og.grade_id,
+        og.seven_year as order_year,
         (SELECT
         COUNT( m.id )
         FROM