فهرست منبع

发放奖励-奖励类型调整为从配置中获取

Long 3 هفته پیش
والد
کامیت
bd0af43293

+ 1 - 0
fs-service-system/src/main/java/com/fs/course/config/CourseConfig.java

@@ -15,5 +15,6 @@ public class CourseConfig implements Serializable {
     private Integer defaultLine;//默认看课线路
     private String realLinkDomainName;//真链域名
     private String courseDomainName;//链接域名
+    private Integer rewardType; // 奖励类型 1红包 2积分
 
 }

+ 0 - 1
fs-service-system/src/main/java/com/fs/course/param/FsCourseSendRewardUParam.java

@@ -20,7 +20,6 @@ public class FsCourseSendRewardUParam implements Serializable
     private Long companyId;
     private Long courseId;
     private String corpId;
-    private Integer rewardType; //奖励类型
     private Integer linkType;
     private Long qwExternalId;
     private Integer source=1;//来源 1:h5  2:彩虹汇医小程序

+ 11 - 5
fs-service-system/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -104,6 +104,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
     private FsCourseLinkMapper courseLinkMapper;
     @Autowired
     RedisCache redisCache;
+    @Autowired
+    private ISysConfigService sysConfigService;
+
     /**
      * 查询课堂视频
      *
@@ -581,8 +584,13 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         }
 
         FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
+
+        // 获取配置
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+
         //发放奖励
-        switch (param.getRewardType()){
+        switch (config.getRewardType()){
             //红包奖励
             case 1:
                 BigDecimal amount = BigDecimal.ZERO;
@@ -613,7 +621,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
                     redPacketLog.setWatchLogId(log.getLogId() !=null ? log.getLogId() : null);
                     redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
                     if (param.getLinkType()==null || param.getLinkType()==0){
-                        log.setRewardType(param.getRewardType());
+                        log.setRewardType(config.getRewardType());
                         courseWatchLogMapper.updateFsCourseWatchLog(log);
                     }
                     return R.ok("奖励发放成功");
@@ -622,8 +630,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
                 }
             //积分奖励
             case 2:
-                String json = configService.selectConfigByKey("course.config");
-                CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
                 //增加积分
                 FsUser userMap=new FsUser();
                 userMap.setUserId(user.getUserId());
@@ -638,7 +644,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
                 integralLogs.setCreateTime(new Date());
                 fsUserIntegralLogsMapper.insertFsUserIntegralLogs(integralLogs);
                 if (param.getLinkType()==null || param.getLinkType()==0 ){
-                    log.setRewardType(param.getRewardType());
+                    log.setRewardType(config.getRewardType());
                     courseWatchLogMapper.updateFsCourseWatchLog(log);
                     //转换红包
                     FsCourseRedPacketLog redPacketLog = new FsCourseRedPacketLog();