Bläddra i källkod

有效视频修改

hcst_sunzhen 5 år sedan
förälder
incheckning
ccdffd3476

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/EffiVideoJob.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.job;
 
 
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.system.service.IPerformanceService2;
 import org.quartz.Job;
@@ -12,6 +13,7 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+@Slf4j
 public class EffiVideoJob implements Job {
     @Autowired
     private IPerformanceService2 performanceService;
@@ -26,6 +28,9 @@ public class EffiVideoJob implements Job {
     public void execute(JobExecutionContext jobExecutionContext) {
         //有效视频定时任务,默认跑前一天的
         DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String calcDate = sdf.format(DateUtils.addDay(new Date(), -1));
+        log.info("有效视频定时任务开始执行,有效视频所属时间为" + calcDate);
         performanceService.efficientVideoTask(sdf.format(DateUtils.addDay(new Date(), -1)));
+        log.info("有效视频定时任务结束");
     }
 }

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -4,6 +4,7 @@ import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.modules.system.service.IPerformanceService2;
@@ -120,4 +121,24 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "有效视频定时任务")
+    @ApiOperation(value = "有效视频定时任务", notes = "calcDate传递yyyy-MM-dd格式的日期")
+    @PostMapping(value = "/efficientVideo")
+    public Result<Map<String,Object>> efficientVideo(@RequestParam(name = "calcDate", required = true) String calcDate) {
+        log.info("有效视频任务开始,有效视频所属时间为" + calcDate);
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        if (StringUtils.isBlank(calcDate)){
+            result.error500("时间不能为空");
+        }
+        try {
+            performanceService.efficientVideoTask(calcDate);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            log.error("/ctop/performance2/efficientVideo出错啦" + "date:" + calcDate );
+            result.error500("/ctop/performance2/efficientVideo出错啦");
+        }
+        return result;
+    }
+
 }

+ 10 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -70,10 +70,13 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         //传入时间,获取对应的年份
         Date friday = DateUtils.getFriday(calcDate);
         String effiCalcStart = DateUtils.formatDate(DateUtils.addDay(friday, -14)); //计算有效视频开始的时间
+        log.info("有效视频统计的开始时间为" + effiCalcStart);
         String effiCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -1)); //计算有效视频结束的时间
-
+        log.info("有效视频统计的结束时间为" + effiCalcStart);
         String effiStart = DateUtils.formatDate(DateUtils.addDay(friday, -21)); //有效视频发布开始时间
+        log.info("有效视频发布的开始时间为" + effiStart);
         String effiEnd = DateUtils.formatDate(DateUtils.addDay(friday, -15)); //有效视频发布结束时间
+        log.info("有效视频发布的结束时间为" + effiEnd);
 
         //以周为维度计算
         //获取当前时间所在周所在年份以及季度(如果季度末最后一周的天数>=4则这周属于此季度,否则属于下一个季度)
@@ -81,15 +84,17 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         int thisYear = yearQuarterMap.get("year"); //获取当天所在周所在的年份
         int thisMonth = yearQuarterMap.get("month"); //获取当天所在周所在的月份
         int thisQuarter = yearQuarterMap.get("quarter"); //获取当天所在周所在的季度
+        log.info("统计时间所在年" + thisYear + "月" + thisMonth + "季" + thisQuarter);
 
         //快手有效视频
         kuaishouEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
         //头条有效视频
-        toutiaoEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
+        //toutiaoEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
     }
 
     //快手有效视频统计
     private void kuaishouEffiVideo(Date calcDate, String effiCalcStart, String effiCalcEnd, String effiStart, String effiEnd, int thisYear, int thisMonth, int thisQuarter){
+        log.info("快手有效视频统计开始,统计时间为 " + calcDate);
         //获取时间段内所有<快手>的有效视频
         List<EffiVideoDTO> EffiVideoDTOList = userEfficientVideoMapMapper.getUserVideoMap(effiStart, effiEnd, effiCalcStart, effiCalcEnd);
 
@@ -150,10 +155,12 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
             userEfficientVideoMapMapper.insert(clip);
         }
+        log.info("快手有效视频统计结束,统计时间为 " + calcDate);
     }
 
     //头条有效视频计算
     private void toutiaoEffiVideo(Date calcDate, String effiCalcStart, String effiCalcEnd, String effiStart, String effiEnd, int thisYear, int thisMonth, int thisQuarter){
+        log.info("头条手有效视频统计开始,统计时间为 " + calcDate);
         //获取时间段内所有<快手>的有效视频
         List<EffiVideoDTO> EffiVideoDTOList = userEfficientVideoMapMapper.getToutiaoUserVideoMap(effiStart, effiEnd, effiCalcStart, effiCalcEnd);
 
@@ -218,7 +225,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             //role_code clip
             userEfficientVideoMapMapper.insert(clip);
         }
-
+        log.info("头条有效视频统计结束,统计时间为 " + calcDate);
     }
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //有效视频计算结束

+ 4 - 4
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/UserEfficientVideoMap.java

@@ -26,9 +26,9 @@ import java.util.Date;
 public class UserEfficientVideoMap {
 
 	/**id*/
-	@TableId(type = IdType.UUID)
+	@TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-	private Integer id;
+	private Long id;
 	/**有效视频md5*/
 	@Excel(name = "有效视频md5", width = 15)
     @ApiModelProperty(value = "有效视频md5")
@@ -49,11 +49,11 @@ public class UserEfficientVideoMap {
 	@Excel(name = "年", width = 15)
     @ApiModelProperty(value = "年")
 	private Integer year;
-	/***/
+	/***/
 	@Excel(name = "月", width = 15)
 	@ApiModelProperty(value = "月")
 	private Integer month;
-	/**计算日期_按照此日期进行所属年月季度的计算的*/
+	/**计算日期_用于计算所属年月季的基础日期*/
 	@Excel(name = "计算日期", width = 15)
 	@ApiModelProperty(value = "计算日期")
 	private Date calcDate;