Browse Source

修改订单记录

change 3 years ago
parent
commit
d146e9b537

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodAddBo.java

@@ -48,4 +48,7 @@ public class UserPeriodAddBo {
     /** 章ID */
     @ApiModelProperty("章ID")
     private Long chapterId;
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodEditBo.java

@@ -66,4 +66,8 @@ public class UserPeriodEditBo {
     @ApiModelProperty("1单独审核  2待审核项目全部审核")
     private Long completeAudit;
 
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodQueryBo.java

@@ -67,4 +67,6 @@ public class UserPeriodQueryBo extends BaseEntity {
 	/** 當前位置 */
 	@ApiModelProperty("當前位置")
 	private Long numIndex;
+
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriod.java

@@ -48,4 +48,6 @@ private static final long serialVersionUID=1L;
     private Long moduleId;
     /** 章ID */
     private Long chapterId;
+    /** 班级ID */
+    private Long gradeId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodVo.java

@@ -56,4 +56,8 @@ public class UserPeriodVo {
 	@Excel(name = "章ID")
 	@ApiModelProperty("章ID")
 	private Long chapterId;
+
+	/** 班级ID */
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderAddBo.java

@@ -78,4 +78,8 @@ public class OrderAddBo {
     @ApiModelProperty("系统订单操作人")
     private String createBy;
 
+    /** 1有效 0无效 */
+    @ApiModelProperty("1有效 0无效")
+    private Integer status;
+
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderEditBo.java

@@ -93,5 +93,9 @@ public class OrderEditBo {
     @ApiModelProperty("学员信息")
     private OrderStudentInfoEditBo OrderStudent;
 
+    /** 1有效 0无效 */
+    @ApiModelProperty("1有效 0无效")
+    private Integer status;
+
 
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderQueryBo.java

@@ -107,4 +107,8 @@ public class OrderQueryBo extends BaseEntity {
 	private Integer refundStatus;
 	@ApiModelProperty("商品类型 1视频2题库 3面授 4服务 5组合")
 	private Long goodsType;
+
+	/** 1有效 0无效 */
+	@ApiModelProperty("1有效 0无效")
+	private Integer status;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/Order.java

@@ -67,4 +67,7 @@ private static final long serialVersionUID=1L;
     @TableField(fill = FieldFill.INSERT)
     private String createBy;
 
+    /** 1有效 0无效 */
+    private Integer status;
+
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderVo.java

@@ -49,6 +49,10 @@ public class OrderVo {
 	@Excel(name = "支付时间")
 	@ApiModelProperty("支付时间")
 	private Long payTime;
+
+	/** 1有效 0无效 */
+	@ApiModelProperty("1有效 0无效")
+	private Integer status;
 	/** 支付平台 1微信 2支付宝 */
 	@Excel(name = "支付平台 1微信 2支付宝")
 	@ApiModelProperty("支付平台 1微信 2支付宝")

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -37,5 +37,5 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
 
     List<String> examTypes(Long id);
 
-    Long selectStudyRecord(UserStudyRecordAddBo bo);
+    Long selectStudyRecord(UserStudyRecord bo);
 }

+ 31 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -7,6 +7,12 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.microsoft.schemas.office.visio.x2012.main.SectionType;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.grade.bo.UserPeriodAddBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusAddBo;
+import com.zhongzheng.modules.grade.domain.UserPeriod;
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.service.IUserPeriodService;
+import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordMapper;
@@ -46,6 +52,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     @Autowired
     private IUserStudyRecordPhotoService userStudyRecordPhotoService;
 
+    @Autowired
+    private IUserPeriodService iUserPeriodService;
+
+    @Autowired
+    private IUserPeriodStatusService iUserPeriodStatusService;
+
 
 
 
@@ -131,8 +143,25 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         //记录学时审核
         Long periodId = null;
         // 学习无记录加一条学时审核记录
-        if (baseMapper.selectStudyRecord(bo) > 0){
-
+        if (baseMapper.selectStudyRecord(entity) < 1){
+            UserPeriod userPeriod = new UserPeriod();
+            userPeriod.setUserId(entity.getUserId());
+            userPeriod.setCourseId(entity.getCourseId());
+            userPeriod.setSectionId(entity.getSectionId());
+            userPeriod.setGoodsId(entity.getGoodsId());
+            userPeriod.setType(1);
+            userPeriod.setCreateTime(DateUtils.getNowTime());
+            userPeriod.setUpdateTime(DateUtils.getNowTime());
+            userPeriod.setModuleId(entity.getModuleId());
+            userPeriod.setChapterId(entity.getChapterId());
+            userPeriod.setGradeId(entity.getGradeId());
+            iUserPeriodService.save(userPeriod);
+            periodId = userPeriod.getId();
+            UserPeriodStatus userPeriodStatusAddBo = new UserPeriodStatus();
+            userPeriodStatusAddBo.setPeriodStatus(1);
+            userPeriodStatusAddBo.setStatus(2);
+            userPeriodStatusAddBo.setPeriodId(userPeriod.getId());
+            iUserPeriodStatusService.save(userPeriodStatusAddBo);
         }
         //待审有结束时间跳过下面两步
         //有学习记录时审核记录或0作弊或3待重修更改为待审核,完整播放也添加结束时间

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

@@ -387,7 +387,7 @@
             cgu.grade_id,
                cgu.user_id,
         (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
-        (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status
+        (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
         (SELECT ea.apply_name FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,
         (SELECT eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name
         FROM

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

@@ -131,6 +131,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="userId != null">
             AND u.user_id = #{userId}
         </if>
+        <if test="status != null">
+            AND o.status = #{status}
+        </if>
         ORDER BY o.order_id DESC
     </select>
 

+ 59 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -432,4 +432,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and a.id =#{id}
         </if>
     </select>
+
+    <select id="selectStudyRecord" parameterType="com.zhongzheng.modules.user.domain.UserStudyRecord" resultType="Long">
+        SELECT
+            COUNT( 1 )
+        FROM
+            user_study_record usr
+        WHERE
+            1 =1
+          AND usr.record_id != #{recordId}
+        <choose>
+            <when test="chapterId != null and chapterId !=''">
+                AND usr.chapter_id = #{chapterId}
+            </when>
+            <otherwise>
+                AND usr.chapter_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="sectionId != null and sectionId !=''">
+                AND usr.section_id = #{sectionId}
+            </when>
+            <otherwise>
+                AND usr.section_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="moduleId != null and moduleId !=''">
+                AND usr.module_id = #{moduleId}
+            </when>
+            <otherwise>
+                AND usr.module_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="courseId != null and courseId !=''">
+                AND usr.course_id = #{courseId}
+            </when>
+            <otherwise>
+                AND usr.course_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="gradeId != null and gradeId !=''">
+                AND usr.grade_id = #{gradeId}
+            </when>
+            <otherwise>
+                AND usr.grade_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="goodsId != null and goodsId !=''">
+                AND usr.goods_id = #{gradeId}
+            </when>
+            <otherwise>
+                AND usr.goods_id = 0
+            </otherwise>
+        </choose>
+          AND usr.user_id = #{userId}
+    </select>
 </mapper>