Sfoglia il codice sorgente

未完课课程推送

wangxy 1 settimana fa
parent
commit
de884dc56f

+ 6 - 2
fs-admin/src/main/java/com/fs/his/task/FsCourseTask.java

@@ -91,10 +91,14 @@ public class FsCourseTask {
                 continue;
             }
             String redisKey = "uniPush:unfinishedCourse:" + date + ":" + watchLog.getUserId() + ":" + watchLog.getVideoId();
-            if (!redisCache.setIfAbsent(redisKey, "1", 1, TimeUnit.DAYS)) {
+            if (!redisCache.setIfAbsent(redisKey, "1", 30, TimeUnit.MINUTES)) {
+                continue;
+            }
+            boolean pushed = uniPush2Service.pushUnfinishedCourse(watchLog.getUserId(), watchLog.getCourseId(), watchLog.getVideoId(), "");
+            if (!pushed) {
+                redisCache.deleteObject(redisKey);
                 continue;
             }
-            uniPush2Service.pushUnfinishedCourse(watchLog.getUserId(), watchLog.getCourseId(), watchLog.getVideoId(), "");
             pushCount++;
         }
         log.info("当日未完课课程信息推送 - 任务完成,待推送:{},实际触发:{}", watchLogs.size(), pushCount);

+ 2 - 0
fs-service/src/main/java/com/fs/course/dto/BatchUrgeCourseTaskDTO.java

@@ -68,6 +68,8 @@ public class BatchUrgeCourseTaskDTO implements Serializable {
     @ApiModelProperty(value = "是否发送课程链接", required = true)
     private Boolean sendCourse;
 
+    private  String url;
+
     @NotNull
     @ApiModelProperty(value = "任务类型:1-未看课催课;2-未完课催课", required = true)
     private Integer taskType;

+ 13 - 4
fs-service/src/main/java/com/fs/course/vo/TodayUnfinishedCourseVO.java

@@ -8,10 +8,7 @@ import java.time.LocalDateTime;
 import java.util.Date;
 
 @Data
-public class TodayUnfinishedCourseVO implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+public class TodayUnfinishedCourseVO {
     private Long logId;
 
     private Long courseId;
@@ -38,6 +35,18 @@ public class TodayUnfinishedCourseVO implements Serializable {
 
     private String periodName;
 
+    private  String imgUrl;
+
+    private  String url;
+
+    private  Long companyUserId;
+
+    private  Long periodDaysId;
+
+    private  Long projectId;
+
+    private  Long companyId;
+
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime startDateTime;
 

+ 4 - 2
fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java

@@ -101,7 +101,7 @@ public class uniPush2ServiceImpl implements uniPush2Service {
     }
 
     @Override
-    public void pushUnfinishedCourse(Long userId, Long courseId, Long videoId, String purl) {
+    public boolean pushUnfinishedCourse(Long userId, Long courseId, Long videoId, String purl) {
         try {
             FsUserCourse course = fsUserCourseMapper.selectFsUserCourseByCourseId(courseId);
             FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
@@ -113,7 +113,7 @@ public class uniPush2ServiceImpl implements uniPush2Service {
             PushReqBean param = getImParam(userId, purl, title, content, 1f, PushLogDesTypeEnum.STUDY_COURSE.getValue(), "");
             if (param == null) {
                 log.warn("未完课课程信息单推取消,用户无有效推送标识或参数非法 userId:{} courseId:{} videoId:{}", userId, courseId, videoId);
-                return;
+                return false;
             }
 
             param.setForce_notification(true);
@@ -136,8 +136,10 @@ public class uniPush2ServiceImpl implements uniPush2Service {
             pushLog.setBusinessId(videoId != null ? videoId : courseId);
             pushLog.setCreateTime(DateUtils.getNowDate());
             logService.insertUniPushLog(PushUtils.returnMsg(pushResult, pushLog));
+            return true;
         } catch (Exception e) {
             log.error("未完课课程信息单推异常 userId:{} courseId:{} videoId:{}", userId, courseId, videoId, e);
+            return false;
         }
     }
 

+ 1 - 1
fs-service/src/main/java/com/fs/gtPush/service/uniPush2Service.java

@@ -10,7 +10,7 @@ public interface uniPush2Service {
 
     void pushOne(Long userId,Long businessId,String purl,String title,String content, Float type, Integer desType);
 
-    void pushUnfinishedCourse(Long userId, Long courseId, Long videoId, String purl);
+    boolean pushUnfinishedCourse(Long userId, Long courseId, Long videoId, String purl);
 
     PushReqBean getParam(Long userId,String purl,String title,String content,Float type,Integer desType,String imJsonString);
     void pushIm(Long userId, Long businessId, String purl, String title, String content, Float type, Integer desType,String imJsonString);