Просмотр исходного кода

泽林领红包未落答题记录表

luolinsong 1 месяц назад
Родитель
Сommit
cdc4abb7ea

+ 13 - 0
fs-service/src/main/java/com/fs/course/mapper/FsCourseAnswerLogsMapper.java

@@ -118,6 +118,19 @@ public interface FsCourseAnswerLogsMapper
             "</script>"})
     FsCourseAnswerLogs selectRightLogByCourseVideo(@Param("videoId") Long videoId,@Param("userId") Long userId,@Param("qwUserId") String qwUserId);
 
+
+    @Select({"<script> " +
+            "select * from fs_course_answer_logs where video_id = #{videoId} and user_id = #{userId} and is_right = 1 " +
+            "<if test = 'qwUserId !=null '> " +
+            "and qw_user_id = #{qwUserId} " +
+            "</if>" +
+            "<if test = 'periodId !=null '> " +
+            "and period_id = #{periodId} " +
+            "</if>" +
+            "limit 1 " +
+            "</script>"})
+    FsCourseAnswerLogs selectRightLogByCourseVideoAndPeriodId(@Param("videoId") Long videoId, @Param("userId") Long userId, @Param("qwUserId") String qwUserId, @Param("periodId") Long periodId);
+
     @Select({"<script> " +
             "select * from fs_course_answer_logs where video_id = #{videoId} and user_id = #{userId} and is_right = 1 " +
             "<if test = 'qwUserId !=null '> " +

+ 1 - 0
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -513,6 +513,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
     FsCourseWatchLog getWatchCourseVideoByFsUser(@Param("userId") Long userId, @Param("videoId") Long videoId, @Param("companyUserId") Long companyUserId);
 
     FsCourseWatchLog getWatchLogByFsUser(@Param("videoId") Long videoId, @Param("fsUserId") Long fsUserId, @Param("companyUserId") Long companyUserId);
+    FsCourseWatchLog getWatchLogByFsUserAndPeriodId(@Param("videoId") Long videoId, @Param("fsUserId") Long fsUserId, @Param("companyUserId") Long companyUserId, @Param("periodId") Long periodId);
 
     List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVONew(FsCourseWatchLogStatisticsListParam param);
 

+ 49 - 20
fs-service/src/main/java/com/fs/course/service/impl/FsCourseQuestionBankServiceImpl.java

@@ -21,6 +21,7 @@ import com.fs.his.service.IFsStorePaymentService;
 import com.fs.system.service.ISysConfigService;
 import lombok.Getter;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -58,7 +59,8 @@ public class FsCourseQuestionBankServiceImpl implements IFsCourseQuestionBankSer
     private FsCourseWatchLogMapper courseWatchLogMapper;
     @Autowired
     private FsUserCourseCategoryMapper courseCategoryMapper;
-
+    @Value("${cloud_host.company_name}")
+    private String signProjectName;
     /**
      * 查询题库
      *
@@ -154,31 +156,58 @@ public class FsCourseQuestionBankServiceImpl implements IFsCourseQuestionBankSer
         FsCourseAnswerLogs rightLog;
         //判断短链类型
 
-        FsCourseWatchLog log = courseWatchLogMapper.getWatchLogByFsUser(param.getVideoId(), param.getUserId(), param.getCompanyUserId());
-        if (log==null){
-            return R.error("无记录");
-        }
-        if (log.getLogType()!=2){
-            return R.error("未完课");
-        }
-        logId = log.getLogId();
+        if ("泽林文化".equals(signProjectName)){
+            FsCourseWatchLog log = courseWatchLogMapper.getWatchLogByFsUserAndPeriodId(param.getVideoId(), param.getUserId(), param.getCompanyUserId(),param.getPeriodId());
+            if (log==null){
+                return R.error("无记录");
+            }
+            if (log.getLogType()!=2){
+                return R.error("未完课");
+            }
+            logId = log.getLogId();
 
-        rightLog = courseAnswerLogsMapper.selectRightLogByCourseVideo(param.getVideoId(), param.getUserId(), param.getQwUserId());
-        if (rightLog != null) {
-            if (log.getRewardType() != null) {
-                // 增加判断,去查询红包记录是否已发送成功,如果成功,则返回当前提示,否则返回答题成功(让其可以继续答题,直到红包领取完成)
-                FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(),param.getPeriodId());
-                if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
-                    return R.error("该课程已答题完成,不可重复答题");
+            rightLog = courseAnswerLogsMapper.selectRightLogByCourseVideoAndPeriodId(param.getVideoId(), param.getUserId(), param.getQwUserId(),param.getPeriodId());
+            if (rightLog != null) {
+                if (log.getRewardType() != null) {
+                    // 增加判断,去查询红包记录是否已发送成功,如果成功,则返回当前提示,否则返回答题成功(让其可以继续答题,直到红包领取完成)
+                    FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(),param.getPeriodId());
+                    if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
+                        return R.error("该课程已答题完成,不可重复答题");
+                    } else {
+                        return R.ok("答题成功");
+                    }
                 } else {
                     return R.ok("答题成功");
                 }
-            } else {
-                return R.ok("答题成功");
             }
-        }
-        errorCount = courseAnswerLogsMapper.selectErrorCountByCourseVideo(param.getVideoId(), param.getUserId(),param.getQwUserId(),log.getProject());
+            errorCount = courseAnswerLogsMapper.selectErrorCountByCourseVideo(param.getVideoId(), param.getUserId(),param.getQwUserId(),log.getProject());
 
+        }else {
+            FsCourseWatchLog log = courseWatchLogMapper.getWatchLogByFsUser(param.getVideoId(), param.getUserId(), param.getCompanyUserId());
+            if (log == null) {
+                return R.error("无记录");
+            }
+            if (log.getLogType() != 2) {
+                return R.error("未完课");
+            }
+            logId = log.getLogId();
+
+            rightLog = courseAnswerLogsMapper.selectRightLogByCourseVideo(param.getVideoId(), param.getUserId(), param.getQwUserId());
+            if (rightLog != null) {
+                if (log.getRewardType() != null) {
+                    // 增加判断,去查询红包记录是否已发送成功,如果成功,则返回当前提示,否则返回答题成功(让其可以继续答题,直到红包领取完成)
+                    FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(), param.getPeriodId());
+                    if (fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
+                        return R.error("该课程已答题完成,不可重复答题");
+                    } else {
+                        return R.ok("答题成功");
+                    }
+                } else {
+                    return R.ok("答题成功");
+                }
+            }
+            errorCount = courseAnswerLogsMapper.selectErrorCountByCourseVideo(param.getVideoId(), param.getUserId(), param.getQwUserId(), log.getProject());
+        }
 
 
         if (errorCount >= config.getAnswerErrorCount()) {

+ 33 - 0
fs-service/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -634,6 +634,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                   AND user_id = #{fsUserId}
                   AND company_user_id = #{companyUserId}  order by log_id desc limit 1
             </select>
+
+    <select id="getWatchLogByFsUserAndPeriodId" resultType="com.fs.course.domain.FsCourseWatchLog">
+        SELECT
+            log_id,
+            user_id,
+            video_id,
+            log_type,
+            create_time,
+            update_time,
+            duration,
+            company_user_id,
+            company_id,
+            course_id,
+            send_type,
+            reward_type,
+            last_heartbeat_time,
+            sop_id,
+            finish_time,
+            send_finish_msg,
+            camp_period_time,
+            period_id
+        FROM
+            fs_course_watch_log
+        WHERE
+            send_type = 1
+          AND video_id = #{videoId}
+          AND user_id = #{fsUserId}
+          AND company_user_id = #{companyUserId}
+        <if test="periodId != null">
+            and period_id = #{periodId}
+        </if>
+        order by log_id desc limit 1
+    </select>
             <select id="selectFsCourseWatchLogStatisticsListVONew"
                     resultType="com.fs.course.vo.FsCourseWatchLogStatisticsListVO">
                 SELECT