|
@@ -8,6 +8,7 @@ import cn.com.ctop.planeprojectcost.mapper.PlaneProjectCostMapper;
|
|
import cn.com.ctop.userefficientvideomap.entity.*;
|
|
import cn.com.ctop.userefficientvideomap.entity.*;
|
|
import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
|
|
import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import io.micrometer.core.instrument.util.StringUtils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -71,7 +72,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
//传入时间,获取对应的年份
|
|
//传入时间,获取对应的年份
|
|
- Date friday = DateUtils.getFriday(calcDate);
|
|
|
|
|
|
+ Date friday = DateUtils.getFriday(calcDate); //周的第一天
|
|
|
|
+ Date thursday = DateUtils.addDay(friday, 6); //周的最后一天
|
|
String effiCalcStart = DateUtils.formatDate(DateUtils.addDay(friday, -14)); //计算有效视频开始的时间
|
|
String effiCalcStart = DateUtils.formatDate(DateUtils.addDay(friday, -14)); //计算有效视频开始的时间
|
|
log.info("有效视频统计的开始时间,同时也是有效视频第一周开始时间为" + effiCalcStart);
|
|
log.info("有效视频统计的开始时间,同时也是有效视频第一周开始时间为" + effiCalcStart);
|
|
String effiFirstWeekCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -8)); //计算有效视频第一周结束时间
|
|
String effiFirstWeekCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -8)); //计算有效视频第一周结束时间
|
|
@@ -91,10 +93,10 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
int thisQuarter = yearQuarterMap.get("quarter"); //获取当天所在周所在的季度
|
|
int thisQuarter = yearQuarterMap.get("quarter"); //获取当天所在周所在的季度
|
|
log.info("统计时间所在年" + thisYear + "月" + thisMonth + "季" + thisQuarter);
|
|
log.info("统计时间所在年" + thisYear + "月" + thisMonth + "季" + thisQuarter);
|
|
|
|
|
|
- //快手有效视频
|
|
|
|
- kuaishouEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
|
|
|
|
|
|
+ //快手有效视频(新)
|
|
|
|
+ kuaishouNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
//头条有效视频
|
|
//头条有效视频
|
|
- toutiaoEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
|
|
|
|
|
|
+ //toutiaoEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
|
|
}
|
|
}
|
|
|
|
|
|
//快手有效视频统计
|
|
//快手有效视频统计
|
|
@@ -243,24 +245,26 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
//有效视频计算结束
|
|
//有效视频计算结束
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//新有效视频计算开始
|
|
//新有效视频计算开始
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//快手有效视频统计
|
|
//快手有效视频统计
|
|
- private void kuaishouNewEffiVideo(Date calcDate, String effiCalcStart, String effiFirstWeekCalcEnd, String effiCalcEnd, String effiStart, String effiEnd, int thisYear, int thisMonth, int thisQuarter) {
|
|
|
|
|
|
+ private void kuaishouNewEffiVideo(Date calcDate, String effiCalcStart, String effiFirstWeekCalcEnd, int thisYear, int thisMonth, int thisQuarter, String friday, String thursday) {
|
|
log.info("快手有效视频统计开始,统计时间为 " + calcDate);
|
|
log.info("快手有效视频统计开始,统计时间为 " + calcDate);
|
|
- List<EffiVideoDTO> effiList = new ArrayList<>();
|
|
|
|
|
|
+ //List<EffiVideoDTO> effiList = new ArrayList<>();
|
|
|
|
+ Integer appType = 2;
|
|
|
|
|
|
//1.计算第一周(周五-下周周四)所有有消耗得md5
|
|
//1.计算第一周(周五-下周周四)所有有消耗得md5
|
|
List<String> md5List = userEfficientVideoMapMapper.getWeekCostMd5(effiCalcStart, effiFirstWeekCalcEnd);
|
|
List<String> md5List = userEfficientVideoMapMapper.getWeekCostMd5(effiCalcStart, effiFirstWeekCalcEnd);
|
|
//2.排除第一周之前产生消耗的md5以及14天内消耗<5000的md5
|
|
//2.排除第一周之前产生消耗的md5以及14天内消耗<5000的md5
|
|
for (String md5:md5List){
|
|
for (String md5:md5List){
|
|
|
|
+ //有效视频表格去重
|
|
|
|
+ int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(md5, appType);//1头条 2快手
|
|
|
|
+ if (signatureCount != 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
Integer count = userEfficientVideoMapMapper.BeforeWeekCostCount(md5, effiCalcStart);
|
|
Integer count = userEfficientVideoMapMapper.BeforeWeekCostCount(md5, effiCalcStart);
|
|
//如果第一周之前就有消耗的话排除
|
|
//如果第一周之前就有消耗的话排除
|
|
if(count>0){
|
|
if(count>0){
|
|
@@ -273,36 +277,24 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
} catch (ParseException e) {
|
|
} catch (ParseException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- //如果从产生小号开始时间14天内总消耗<5000,则排除掉
|
|
|
|
|
|
+ //如果从产生消耗开始时间14天内总消耗<5000,则排除掉
|
|
BigDecimal videoTotalCost = userEfficientVideoMapMapper.videoTotalCostInDates(md5, videoEarlistCostDate, videoEndCostDate);
|
|
BigDecimal videoTotalCost = userEfficientVideoMapMapper.videoTotalCostInDates(md5, videoEarlistCostDate, videoEndCostDate);
|
|
if( (videoTotalCost.subtract(new BigDecimal("5000"))).compareTo(BigDecimal.ZERO) < 0){
|
|
if( (videoTotalCost.subtract(new BigDecimal("5000"))).compareTo(BigDecimal.ZERO) < 0){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- EffiVideoDTO effiVideoDTO = new EffiVideoDTO();
|
|
|
|
|
|
+
|
|
|
|
+ //获取该视频的编导、剪辑、拍摄、平面等信息
|
|
|
|
+ EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
|
|
|
|
+ if(effiVideoDTO == null){
|
|
|
|
+ effiVideoDTO = new EffiVideoDTO();
|
|
|
|
+ }
|
|
effiVideoDTO.setSignature(md5);
|
|
effiVideoDTO.setSignature(md5);
|
|
effiVideoDTO.setCharge(videoTotalCost);
|
|
effiVideoDTO.setCharge(videoTotalCost);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //3.和ctop_material_info关联并分配角色
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //获取时间段内所有<快手>的有效视频
|
|
|
|
- List<EffiVideoDTO> EffiVideoDTOList = userEfficientVideoMapMapper.getUserVideoMap(effiStart, effiEnd, effiCalcStart, effiCalcEnd);
|
|
|
|
-
|
|
|
|
- for (EffiVideoDTO effiVideoDTO : EffiVideoDTOList) {
|
|
|
|
- //判断此视频是否已经在关系表中存在,如果已经存在则说明此视频已经存在,跳过即可
|
|
|
|
- //有效视频的逻辑是无论是快手还是头条
|
|
|
|
- int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(effiVideoDTO.getSignature(), new Integer(2));//1快手 2头条
|
|
|
|
- if (signatureCount != 0) {
|
|
|
|
- continue;
|
|
|
|
|
|
+ String companyId = null;
|
|
|
|
+ //根据编导id获取视频所属分公司
|
|
|
|
+ if(StringUtils.isNotBlank(effiVideoDTO.getPlanId())) {
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
|
|
}
|
|
}
|
|
|
|
|
|
UserEfficientVideoMap shot = new UserEfficientVideoMap();
|
|
UserEfficientVideoMap shot = new UserEfficientVideoMap();
|
|
@@ -314,62 +306,67 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
shot.setUserId(effiVideoDTO.getShotId());
|
|
shot.setUserId(effiVideoDTO.getShotId());
|
|
shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
shot.setQuarter(thisQuarter);
|
|
shot.setQuarter(thisQuarter);
|
|
- shot.setAppType(2); //1头条 2快手
|
|
|
|
|
|
+ shot.setAppType(appType); //1头条 2快手
|
|
shot.setYear(thisYear);
|
|
shot.setYear(thisYear);
|
|
shot.setMonth(thisMonth);
|
|
shot.setMonth(thisMonth);
|
|
shot.setCalcDate(calcDate);
|
|
shot.setCalcDate(calcDate);
|
|
shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
|
|
shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
|
|
|
|
+ shot.setWeekStart(friday);
|
|
|
|
+ shot.setWeekEnd(thursday);
|
|
|
|
+ shot.setCompanyId(companyId);
|
|
userEfficientVideoMapMapper.insert(shot);
|
|
userEfficientVideoMapMapper.insert(shot);
|
|
|
|
|
|
//平面
|
|
//平面
|
|
plane.setUserId(effiVideoDTO.getPlaneId());
|
|
plane.setUserId(effiVideoDTO.getPlaneId());
|
|
plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
plane.setQuarter(thisQuarter);
|
|
plane.setQuarter(thisQuarter);
|
|
- plane.setAppType(2); //1头条 2快手
|
|
|
|
|
|
+ plane.setAppType(appType); //1头条 2快手
|
|
plane.setYear(thisYear);
|
|
plane.setYear(thisYear);
|
|
plane.setMonth(thisMonth);
|
|
plane.setMonth(thisMonth);
|
|
plane.setCalcDate(calcDate);
|
|
plane.setCalcDate(calcDate);
|
|
plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
|
|
plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
|
|
|
|
+ plane.setWeekStart(friday);
|
|
|
|
+ plane.setWeekEnd(thursday);
|
|
|
|
+ plane.setCompanyId(companyId);
|
|
userEfficientVideoMapMapper.insert(plane);
|
|
userEfficientVideoMapMapper.insert(plane);
|
|
|
|
|
|
- //策划
|
|
|
|
|
|
+ //编导
|
|
plan.setUserId(effiVideoDTO.getPlanId());
|
|
plan.setUserId(effiVideoDTO.getPlanId());
|
|
plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
plan.setQuarter(thisQuarter);
|
|
plan.setQuarter(thisQuarter);
|
|
- plan.setAppType(2); //1头条 2快手
|
|
|
|
|
|
+ plan.setAppType(appType); //1头条 2快手
|
|
plan.setYear(thisYear);
|
|
plan.setYear(thisYear);
|
|
plan.setMonth(thisMonth);
|
|
plan.setMonth(thisMonth);
|
|
plan.setCalcDate(calcDate);
|
|
plan.setCalcDate(calcDate);
|
|
plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
|
|
plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
|
|
|
|
+ plan.setWeekStart(friday);
|
|
|
|
+ plan.setWeekEnd(thursday);
|
|
|
|
+ plan.setCompanyId(companyId);
|
|
userEfficientVideoMapMapper.insert(plan);
|
|
userEfficientVideoMapMapper.insert(plan);
|
|
|
|
|
|
//剪辑
|
|
//剪辑
|
|
clip.setUserId(effiVideoDTO.getClipId());
|
|
clip.setUserId(effiVideoDTO.getClipId());
|
|
clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
clip.setQuarter(thisQuarter);
|
|
clip.setQuarter(thisQuarter);
|
|
- clip.setAppType(2); //1头条 2快手
|
|
|
|
|
|
+ clip.setAppType(appType); //1头条 2快手
|
|
clip.setYear(thisYear);
|
|
clip.setYear(thisYear);
|
|
clip.setMonth(thisMonth);
|
|
clip.setMonth(thisMonth);
|
|
clip.setCalcDate(calcDate);
|
|
clip.setCalcDate(calcDate);
|
|
clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
|
|
clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
|
|
|
|
+ clip.setWeekStart(friday);
|
|
|
|
+ clip.setWeekEnd(thursday);
|
|
|
|
+ clip.setCompanyId(companyId);
|
|
userEfficientVideoMapMapper.insert(clip);
|
|
userEfficientVideoMapMapper.insert(clip);
|
|
|
|
|
|
- //快手有效视频同步到有效视频素材库
|
|
|
|
- userEfficientVideoMapMapper.updateKuaishouEffiType(1, effiVideoDTO.getSignature());
|
|
|
|
-
|
|
|
|
|
|
+ //有效视频同步到有效视频素材库--测试的时候不打开,生产打开
|
|
|
|
+ //userEfficientVideoMapMapper.updateKuaishouEffiType(2, effiVideoDTO.getSignature());
|
|
}
|
|
}
|
|
log.info("快手有效视频统计结束,统计时间为 " + calcDate);
|
|
log.info("快手有效视频统计结束,统计时间为 " + calcDate);
|
|
}
|
|
}
|
|
-
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//新有效视频计算结束
|
|
//新有效视频计算结束
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//绩效计算开始
|
|
//绩效计算开始
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|