|  | @@ -343,7 +343,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          // 从Redis中获取观看时长
 |  |          // 从Redis中获取观看时长
 | 
											
												
													
														|  |          String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
 |  |          String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
 | 
											
												
													
														|  | -        log.info("看课redis-key:{}", redisKey);
 |  | 
 | 
											
												
													
														|  | 
 |  | +//        log.info("看课redis-key:{}", redisKey);
 | 
											
												
													
														|  |          try {
 |  |          try {
 | 
											
												
													
														|  |              String durationStr = redisCache.getCacheObject(redisKey);
 |  |              String durationStr = redisCache.getCacheObject(redisKey);
 | 
											
												
													
														|  |              Long duration = durationStr != null ? Long.parseLong(durationStr) : 0L;
 |  |              Long duration = durationStr != null ? Long.parseLong(durationStr) : 0L;
 | 
											
										
											
												
													
														|  | @@ -442,6 +442,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |          log.setDuration(0L);
 |  |          log.setDuration(0L);
 | 
											
												
													
														|  |          log.setCreateTime(new Date());
 |  |          log.setCreateTime(new Date());
 | 
											
												
													
														|  |          log.setLogType(3);
 |  |          log.setLogType(3);
 | 
											
												
													
														|  | 
 |  | +        logger.info("zyp \n【群聊生成看课记录】:{}",param);
 | 
											
												
													
														|  |          courseWatchLogMapper.insertFsCourseWatchLog(log);
 |  |          courseWatchLogMapper.insertFsCourseWatchLog(log);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -728,17 +729,14 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |          if (param.getLinkType() != null && param.getLinkType() == 1) {
 |  |          if (param.getLinkType() != null && param.getLinkType() == 1) {
 | 
											
												
													
														|  |              FsCourseRedPacketLog packetLog = redPacketLogMapper.selectFsCourseRedPacketLogByTemporary(param.getVideoId(), param.getUserId());
 |  |              FsCourseRedPacketLog packetLog = redPacketLogMapper.selectFsCourseRedPacketLogByTemporary(param.getVideoId(), param.getUserId());
 | 
											
												
													
														|  |              if (packetLog != null) {
 |  |              if (packetLog != null) {
 | 
											
												
													
														|  | -                System.out.println("奖励已发放1");
 |  | 
 | 
											
												
													
														|  |                  return R.error("奖励已发放");
 |  |                  return R.error("奖励已发放");
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |              log = courseWatchLogMapper.getWatchCourseVideo(param.getUserId(), param.getVideoId(), param.getQwUserId(), param.getQwExternalId());
 |  |              log = courseWatchLogMapper.getWatchCourseVideo(param.getUserId(), param.getVideoId(), param.getQwUserId(), param.getQwExternalId());
 | 
											
												
													
														|  |              if (log == null) {
 |  |              if (log == null) {
 | 
											
												
													
														|  | -                System.out.println("无记录");
 |  | 
 | 
											
												
													
														|  |                  return R.error("无记录");
 |  |                  return R.error("无记录");
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              if (log.getRewardType() != null) {
 |  |              if (log.getRewardType() != null) {
 | 
											
												
													
														|  | -                System.out.println("奖励已发放2");
 |  | 
 | 
											
												
													
														|  |                  return R.error("奖励已发放");
 |  |                  return R.error("奖励已发放");
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -757,7 +755,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |                  return sendRedPacketReward(param, user, log, video, config);
 |  |                  return sendRedPacketReward(param, user, log, video, config);
 | 
											
												
													
														|  |              // 积分奖励
 |  |              // 积分奖励
 | 
											
												
													
														|  |              case 2:
 |  |              case 2:
 | 
											
												
													
														|  | -                return sendIntegralReward(user, log, config);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                return sendIntegralReward(param,user, log, config);
 | 
											
												
													
														|  |              default:
 |  |              default:
 | 
											
												
													
														|  |                  return R.error("参数错误!");
 |  |                  return R.error("参数错误!");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -792,7 +790,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |                  return sendRedPacketReward(param, user, log, video, config);
 |  |                  return sendRedPacketReward(param, user, log, video, config);
 | 
											
												
													
														|  |              // 积分奖励
 |  |              // 积分奖励
 | 
											
												
													
														|  |              case 2:
 |  |              case 2:
 | 
											
												
													
														|  | -                return sendIntegralReward(user, log, config);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                return sendIntegralReward(param,user, log, config);
 | 
											
												
													
														|  |              default:
 |  |              default:
 | 
											
												
													
														|  |                  return R.error("参数错误!");
 |  |                  return R.error("参数错误!");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -891,7 +889,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |       * @param config 配置信息
 |  |       * @param config 配置信息
 | 
											
												
													
														|  |       * @return 处理结果
 |  |       * @return 处理结果
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    private R sendIntegralReward(FsUser user, FsCourseWatchLog log, CourseConfig config) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private R sendIntegralReward(FsCourseSendRewardUParam param,FsUser user, FsCourseWatchLog log, CourseConfig config) {
 | 
											
												
													
														|  |          // 更新用户积分
 |  |          // 更新用户积分
 | 
											
												
													
														|  |          FsUser userMap = new FsUser();
 |  |          FsUser userMap = new FsUser();
 | 
											
												
													
														|  |          userMap.setUserId(user.getUserId());
 |  |          userMap.setUserId(user.getUserId());
 | 
											
										
											
												
													
														|  | @@ -913,6 +911,22 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |          courseWatchLogMapper.updateFsCourseWatchLog(log);
 |  |          courseWatchLogMapper.updateFsCourseWatchLog(log);
 | 
											
												
													
														|  |          logger.info("发放奖励====================》看课记录,{}",log);
 |  |          logger.info("发放奖励====================》看课记录,{}",log);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        //转换红包
 | 
											
												
													
														|  | 
 |  | +        FsCourseRedPacketLog redPacketLog = new FsCourseRedPacketLog();
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setCourseId(param.getCourseId());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setOutBatchNo(integralLogs.getId().toString());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setCompanyId(param.getCompanyId());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setUserId(param.getUserId());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setVideoId(param.getVideoId());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setStatus(1);
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setQwUserId(param.getQwUserId() != null ? param.getQwUserId() : null );
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setCompanyUserId(param.getCompanyUserId());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setCreateTime(new Date());
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setAmount(BigDecimal.valueOf(config.getAnswerIntegral()).divide(BigDecimal.valueOf(1000)));
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setRemark("点播答题领取积分转");
 | 
											
												
													
														|  | 
 |  | +        redPacketLog.setWatchLogId(log.getLogId() !=null ? log.getLogId() : null);
 | 
											
												
													
														|  | 
 |  | +        redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          return R.ok("奖励发放成功");
 |  |          return R.ok("奖励发放成功");
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 |