|
@@ -7,7 +7,10 @@ import cn.com.ctop.planeprojectcost.entity.PlaneProjectCost;
|
|
import cn.com.ctop.planeprojectcost.mapper.PlaneProjectCostMapper;
|
|
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 cn.com.ctop.uservideomap.entity.UserVideoMap;
|
|
|
|
+import cn.com.ctop.uservideomap.mapper.UserVideoMapMapper;
|
|
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;
|
|
@@ -42,6 +45,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
private SysRoleMapper sysRoleMapper;
|
|
private SysRoleMapper sysRoleMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private PlaneProjectCostMapper planeProjectCostMapper;
|
|
private PlaneProjectCostMapper planeProjectCostMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserVideoMapMapper userVideoMapMapper;
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//有效视频计算开始
|
|
//有效视频计算开始
|
|
@@ -71,9 +76,12 @@ 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)); //计算有效视频第一周结束时间
|
|
|
|
+ log.info("有效视频第一周结束时间为" + effiCalcStart);
|
|
String effiCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -1)); //计算有效视频结束的时间
|
|
String effiCalcEnd = DateUtils.formatDate(DateUtils.addDay(friday, -1)); //计算有效视频结束的时间
|
|
log.info("有效视频统计的结束时间为" + effiCalcEnd);
|
|
log.info("有效视频统计的结束时间为" + effiCalcEnd);
|
|
String effiStart = DateUtils.formatDate(DateUtils.addDay(friday, -21)); //有效视频发布开始时间
|
|
String effiStart = DateUtils.formatDate(DateUtils.addDay(friday, -21)); //有效视频发布开始时间
|
|
@@ -89,10 +97,13 @@ 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);
|
|
|
|
- //头条有效视频
|
|
|
|
- toutiaoEffiVideo(calcDate, effiCalcStart, effiCalcEnd, effiStart, effiEnd, thisYear, thisMonth, thisQuarter);
|
|
|
|
|
|
+ //快手有效视频(新)
|
|
|
|
+ kuaishouNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
|
|
+ //头条有效视频(新)
|
|
|
|
+ toutiaoNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
|
|
+
|
|
|
|
+ //总视频
|
|
|
|
+ kuaishouNewVideo( calcDate, thisYear, thisQuarter, thisMonth, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
}
|
|
}
|
|
|
|
|
|
//快手有效视频统计
|
|
//快手有效视频统计
|
|
@@ -242,6 +253,352 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //新有效视频计算开始
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //快手有效视频统计
|
|
|
|
+ private void kuaishouNewEffiVideo(Date calcDate, String effiCalcStart, String effiFirstWeekCalcEnd, int thisYear, int thisMonth, int thisQuarter, String friday, String thursday) {
|
|
|
|
+ log.info("快手有效视频统计开始,统计时间为 " + calcDate);
|
|
|
|
+ //List<EffiVideoDTO> effiList = new ArrayList<>();
|
|
|
|
+ Integer appType = 2;
|
|
|
|
+
|
|
|
|
+ //1.计算第一周(周五-下周周四)所有有消耗得md5
|
|
|
|
+ List<String> md5List = userEfficientVideoMapMapper.getWeekCostMd5(effiCalcStart, effiFirstWeekCalcEnd);
|
|
|
|
+ //2.排除第一周之前产生消耗的md5以及14天内消耗<5000的md5
|
|
|
|
+ for (String md5:md5List){
|
|
|
|
+ //有效视频去重--如果之前在对应的媒体中存在的话就跳过
|
|
|
|
+ int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(md5, appType);//1头条 2快手
|
|
|
|
+ if (signatureCount != 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Integer count = userEfficientVideoMapMapper.beforeWeekCostCount(md5, effiCalcStart);
|
|
|
|
+ //如果第一周之前就有消耗的话排除
|
|
|
|
+ if(count>0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String videoEarlistCostDate = userEfficientVideoMapMapper.getVideoEarlistCostDate(md5);
|
|
|
|
+ String videoEndCostDate = null;
|
|
|
|
+ try {
|
|
|
|
+ videoEndCostDate = DateUtils.formatDate(DateUtils.addDay(videoEarlistCostDate, 13)); //有效视频发布开始时间
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //如果从产生消耗开始时间14天内总消耗<5000,则排除掉
|
|
|
|
+ BigDecimal videoTotalCost = userEfficientVideoMapMapper.videoTotalCostInDates(md5, videoEarlistCostDate, videoEndCostDate);
|
|
|
|
+ if( (videoTotalCost.subtract(new BigDecimal("5000"))).compareTo(BigDecimal.ZERO) < 0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取该视频的编导、剪辑、拍摄、平面等信息
|
|
|
|
+ EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
|
|
|
|
+ if(effiVideoDTO == null){
|
|
|
|
+ effiVideoDTO = new EffiVideoDTO();
|
|
|
|
+ }
|
|
|
|
+ effiVideoDTO.setSignature(md5);
|
|
|
|
+ effiVideoDTO.setCharge(videoTotalCost);
|
|
|
|
+
|
|
|
|
+ String companyId = null;
|
|
|
|
+ //根据编导id获取视频所属分公司
|
|
|
|
+ if( StringUtils.isNotBlank(effiVideoDTO.getPlanId()) ) {
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
|
|
|
|
+ }else if( StringUtils.isNotBlank(effiVideoDTO.getClipId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getClipId() );
|
|
|
|
+ }else if( StringUtils.isNotBlank(effiVideoDTO.getShotId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getShotId() );
|
|
|
|
+ }else if ( StringUtils.isNotBlank(effiVideoDTO.getPlaneId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getPlaneId() );
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
+ UserEfficientVideoMap shot = new UserEfficientVideoMap();
|
|
|
|
+ UserEfficientVideoMap plane = new UserEfficientVideoMap();
|
|
|
|
+ UserEfficientVideoMap plan = new UserEfficientVideoMap();
|
|
|
|
+ UserEfficientVideoMap clip = new UserEfficientVideoMap();
|
|
|
|
+
|
|
|
|
+ //拍摄
|
|
|
|
+ shot.setUserId(effiVideoDTO.getShotId());
|
|
|
|
+ shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ shot.setQuarter(thisQuarter);
|
|
|
|
+ shot.setAppType(appType); //1头条 2快手
|
|
|
|
+ shot.setYear(thisYear);
|
|
|
|
+ shot.setMonth(thisMonth);
|
|
|
|
+ shot.setCalcDate(calcDate);
|
|
|
|
+ shot.setRoleId("shot");
|
|
|
|
+ shot.setWeekStart(friday);
|
|
|
|
+ shot.setWeekEnd(thursday);
|
|
|
|
+ shot.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(shot);
|
|
|
|
+
|
|
|
|
+ //平面
|
|
|
|
+ plane.setUserId(effiVideoDTO.getPlaneId());
|
|
|
|
+ plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ plane.setQuarter(thisQuarter);
|
|
|
|
+ plane.setAppType(appType); //1头条 2快手
|
|
|
|
+ plane.setYear(thisYear);
|
|
|
|
+ plane.setMonth(thisMonth);
|
|
|
|
+ plane.setCalcDate(calcDate);
|
|
|
|
+ plane.setRoleId("plane");
|
|
|
|
+ plane.setWeekStart(friday);
|
|
|
|
+ plane.setWeekEnd(thursday);
|
|
|
|
+ plane.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(plane);
|
|
|
|
+
|
|
|
|
+ //编导
|
|
|
|
+ plan.setUserId(effiVideoDTO.getPlanId());
|
|
|
|
+ plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ plan.setQuarter(thisQuarter);
|
|
|
|
+ plan.setAppType(appType); //1头条 2快手
|
|
|
|
+ plan.setYear(thisYear);
|
|
|
|
+ plan.setMonth(thisMonth);
|
|
|
|
+ plan.setCalcDate(calcDate);
|
|
|
|
+ plan.setRoleId("plan");
|
|
|
|
+ plan.setWeekStart(friday);
|
|
|
|
+ plan.setWeekEnd(thursday);
|
|
|
|
+ plan.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(plan);
|
|
|
|
+
|
|
|
|
+ //剪辑
|
|
|
|
+ clip.setUserId(effiVideoDTO.getClipId());
|
|
|
|
+ clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ clip.setQuarter(thisQuarter);
|
|
|
|
+ clip.setAppType(appType); //1头条 2快手
|
|
|
|
+ clip.setYear(thisYear);
|
|
|
|
+ clip.setMonth(thisMonth);
|
|
|
|
+ clip.setCalcDate(calcDate);
|
|
|
|
+ clip.setRoleId("clip");
|
|
|
|
+ clip.setWeekStart(friday);
|
|
|
|
+ clip.setWeekEnd(thursday);
|
|
|
|
+ clip.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(clip);
|
|
|
|
+
|
|
|
|
+ //有效视频同步到有效视频素材库--测试的时候不打开,生产打开
|
|
|
|
+ //userEfficientVideoMapMapper.updateKuaishouEffiType(2, effiVideoDTO.getSignature());
|
|
|
|
+ }
|
|
|
|
+ log.info("快手有效视频统计结束,统计时间为 " + calcDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //toutiao新有效视频统计
|
|
|
|
+ private void toutiaoNewEffiVideo(Date calcDate, String effiCalcStart, String effiFirstWeekCalcEnd, int thisYear, int thisMonth, int thisQuarter, String friday, String thursday) {
|
|
|
|
+ log.info("toutiao有效视频统计开始,统计时间为 " + calcDate);
|
|
|
|
+ //List<EffiVideoDTO> effiList = new ArrayList<>();
|
|
|
|
+ Integer appType = 1;
|
|
|
|
+
|
|
|
|
+ //1.计算第一周(周五-下周周四)所有有消耗得md5
|
|
|
|
+ List<String> md5List = userEfficientVideoMapMapper.toutiaoGetWeekCostMd5(effiCalcStart, effiFirstWeekCalcEnd);
|
|
|
|
+ //2.排除第一周之前产生消耗的md5以及14天内消耗<5000的md5
|
|
|
|
+ for (String md5:md5List){
|
|
|
|
+ //有效视频去重--如果之前在对应的媒体中存在的话就跳过
|
|
|
|
+ int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(md5, appType);//1头条 2快手
|
|
|
|
+ if (signatureCount != 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Integer count = userEfficientVideoMapMapper.toutiaoBeforeWeekCostCount(md5, effiCalcStart);
|
|
|
|
+ //如果第一周之前就有消耗的话排除
|
|
|
|
+ if(count>0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String videoEarlistCostDate = userEfficientVideoMapMapper.getToutiaoVideoEarlistCostDate(md5);
|
|
|
|
+ String videoEndCostDate = null;
|
|
|
|
+ try {
|
|
|
|
+ videoEndCostDate = DateUtils.formatDate(DateUtils.addDay(videoEarlistCostDate, 13)); //有效视频发布开始时间
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //如果从产生消耗开始时间14天内总消耗<5000,则排除掉
|
|
|
|
+ BigDecimal videoTotalCost = userEfficientVideoMapMapper.toutiaoVideoTotalCostInDates(md5, videoEarlistCostDate, videoEndCostDate);
|
|
|
|
+ if( (videoTotalCost.subtract(new BigDecimal("5000"))).compareTo(BigDecimal.ZERO) < 0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取该视频的编导、剪辑、拍摄、平面等信息
|
|
|
|
+ EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
|
|
|
|
+ if(effiVideoDTO == null){
|
|
|
|
+ effiVideoDTO = new EffiVideoDTO();
|
|
|
|
+ }
|
|
|
|
+ effiVideoDTO.setSignature(md5);
|
|
|
|
+ effiVideoDTO.setCharge(videoTotalCost);
|
|
|
|
+
|
|
|
|
+ String companyId = null;
|
|
|
|
+ //根据编导id获取视频所属分公司
|
|
|
|
+ if( StringUtils.isNotBlank(effiVideoDTO.getPlanId()) ) {
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
|
|
|
|
+ }else if( StringUtils.isNotBlank(effiVideoDTO.getClipId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getClipId() );
|
|
|
|
+ }else if( StringUtils.isNotBlank(effiVideoDTO.getShotId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getShotId() );
|
|
|
|
+ }else if ( StringUtils.isNotBlank(effiVideoDTO.getPlaneId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getPlaneId() );
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
+ UserEfficientVideoMap shot = new UserEfficientVideoMap();
|
|
|
|
+ UserEfficientVideoMap plane = new UserEfficientVideoMap();
|
|
|
|
+ UserEfficientVideoMap plan = new UserEfficientVideoMap();
|
|
|
|
+ UserEfficientVideoMap clip = new UserEfficientVideoMap();
|
|
|
|
+
|
|
|
|
+ //拍摄
|
|
|
|
+ shot.setUserId(effiVideoDTO.getShotId());
|
|
|
|
+ shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ shot.setQuarter(thisQuarter);
|
|
|
|
+ shot.setAppType(appType); //1头条 2快手
|
|
|
|
+ shot.setYear(thisYear);
|
|
|
|
+ shot.setMonth(thisMonth);
|
|
|
|
+ shot.setCalcDate(calcDate);
|
|
|
|
+ shot.setRoleId("shot");
|
|
|
|
+ shot.setWeekStart(friday);
|
|
|
|
+ shot.setWeekEnd(thursday);
|
|
|
|
+ shot.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(shot);
|
|
|
|
+
|
|
|
|
+ //平面
|
|
|
|
+ plane.setUserId(effiVideoDTO.getPlaneId());
|
|
|
|
+ plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ plane.setQuarter(thisQuarter);
|
|
|
|
+ plane.setAppType(appType); //1头条 2快手
|
|
|
|
+ plane.setYear(thisYear);
|
|
|
|
+ plane.setMonth(thisMonth);
|
|
|
|
+ plane.setCalcDate(calcDate);
|
|
|
|
+ plane.setRoleId("plane");
|
|
|
|
+ plane.setWeekStart(friday);
|
|
|
|
+ plane.setWeekEnd(thursday);
|
|
|
|
+ plane.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(plane);
|
|
|
|
+
|
|
|
|
+ //编导
|
|
|
|
+ plan.setUserId(effiVideoDTO.getPlanId());
|
|
|
|
+ plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ plan.setQuarter(thisQuarter);
|
|
|
|
+ plan.setAppType(appType); //1头条 2快手
|
|
|
|
+ plan.setYear(thisYear);
|
|
|
|
+ plan.setMonth(thisMonth);
|
|
|
|
+ plan.setCalcDate(calcDate);
|
|
|
|
+ plan.setRoleId("plan");
|
|
|
|
+ plan.setWeekStart(friday);
|
|
|
|
+ plan.setWeekEnd(thursday);
|
|
|
|
+ plan.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(plan);
|
|
|
|
+
|
|
|
|
+ //剪辑
|
|
|
|
+ clip.setUserId(effiVideoDTO.getClipId());
|
|
|
|
+ clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ clip.setQuarter(thisQuarter);
|
|
|
|
+ clip.setAppType(appType); //1头条 2快手
|
|
|
|
+ clip.setYear(thisYear);
|
|
|
|
+ clip.setMonth(thisMonth);
|
|
|
|
+ clip.setCalcDate(calcDate);
|
|
|
|
+ clip.setRoleId("clip");
|
|
|
|
+ clip.setWeekStart(friday);
|
|
|
|
+ clip.setWeekEnd(thursday);
|
|
|
|
+ clip.setCompanyId(companyId);
|
|
|
|
+ userEfficientVideoMapMapper.insert(clip);
|
|
|
|
+
|
|
|
|
+ //有效视频同步到有效视频素材库--测试的时候不打开,生产打开
|
|
|
|
+ //userEfficientVideoMapMapper.updateToutiaoEffiType(2, effiVideoDTO.getSignature());
|
|
|
|
+ }
|
|
|
|
+ log.info("toutiao有效视频统计结束,统计时间为 " + calcDate);
|
|
|
|
+ }
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //新有效视频计算结束
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //新总视频计算开始
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ public void kuaishouNewVideo(Date calcDate, int thisYear, int thisQuarter, int thisMonth, String friday, String thursday){
|
|
|
|
+ log.info("设计师周总视频计算开始");
|
|
|
|
+ List<String> videoMd5s = userEfficientVideoMapMapper.getVideoByDates(friday,thursday);
|
|
|
|
+ for(String md5:videoMd5s){
|
|
|
|
+ //去重
|
|
|
|
+ Integer signatureCount = userEfficientVideoMapMapper.getVideoCountByCode(md5);
|
|
|
|
+ if(signatureCount > 0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
+ //获取该视频的编导、剪辑、拍摄、平面等信息
|
|
|
|
+ EffiVideoDTO effiVideoDTO = userEfficientVideoMapMapper.getDesignerInfoByCode(md5);
|
|
|
|
+ if(effiVideoDTO == null){
|
|
|
|
+ effiVideoDTO = new EffiVideoDTO();
|
|
|
|
+ }
|
|
|
|
+ effiVideoDTO.setSignature(md5);
|
|
|
|
+
|
|
|
|
+ String companyId = null;
|
|
|
|
+ //根据编导id获取视频所属分公司
|
|
|
|
+ if( StringUtils.isNotBlank(effiVideoDTO.getPlanId()) ) {
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId(effiVideoDTO.getPlanId());
|
|
|
|
+ }else if( StringUtils.isNotBlank(effiVideoDTO.getClipId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getClipId() );
|
|
|
|
+ }else if( StringUtils.isNotBlank(effiVideoDTO.getShotId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getShotId() );
|
|
|
|
+ }else if ( StringUtils.isNotBlank(effiVideoDTO.getPlaneId()) ){
|
|
|
|
+ companyId = userEfficientVideoMapMapper.getCompanyInfoByUserId( effiVideoDTO.getPlaneId() );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ UserVideoMap shot = new UserVideoMap();
|
|
|
|
+ UserVideoMap plane = new UserVideoMap();
|
|
|
|
+ UserVideoMap plan = new UserVideoMap();
|
|
|
|
+ UserVideoMap clip = new UserVideoMap();
|
|
|
|
+
|
|
|
|
+ //拍摄
|
|
|
|
+ shot.setUserId(effiVideoDTO.getShotId());
|
|
|
|
+ shot.setVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ shot.setQuarter(thisQuarter);
|
|
|
|
+ shot.setYear(thisYear);
|
|
|
|
+ shot.setMonth(thisMonth);
|
|
|
|
+ shot.setCalcDate(calcDate);
|
|
|
|
+ shot.setRoleId("shot");
|
|
|
|
+ shot.setWeekStart(friday);
|
|
|
|
+ shot.setWeekEnd(thursday);
|
|
|
|
+ shot.setCompanyId(companyId);
|
|
|
|
+ userVideoMapMapper.insert(shot);
|
|
|
|
+
|
|
|
|
+ //平面
|
|
|
|
+ plane.setUserId(effiVideoDTO.getPlaneId());
|
|
|
|
+ plane.setVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ plane.setQuarter(thisQuarter);
|
|
|
|
+ plane.setYear(thisYear);
|
|
|
|
+ plane.setMonth(thisMonth);
|
|
|
|
+ plane.setCalcDate(calcDate);
|
|
|
|
+ plane.setRoleId("plane");
|
|
|
|
+ plane.setWeekStart(friday);
|
|
|
|
+ plane.setWeekEnd(thursday);
|
|
|
|
+ plane.setCompanyId(companyId);
|
|
|
|
+ userVideoMapMapper.insert(plane);
|
|
|
|
+
|
|
|
|
+ //编导
|
|
|
|
+ plan.setUserId(effiVideoDTO.getPlanId());
|
|
|
|
+ plan.setVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ plan.setQuarter(thisQuarter);
|
|
|
|
+ plan.setYear(thisYear);
|
|
|
|
+ plan.setMonth(thisMonth);
|
|
|
|
+ plan.setCalcDate(calcDate);
|
|
|
|
+ plan.setRoleId("plan");
|
|
|
|
+ plan.setWeekStart(friday);
|
|
|
|
+ plan.setWeekEnd(thursday);
|
|
|
|
+ plan.setCompanyId(companyId);
|
|
|
|
+ userVideoMapMapper.insert(plan);
|
|
|
|
+
|
|
|
|
+ //剪辑
|
|
|
|
+ clip.setUserId(effiVideoDTO.getClipId());
|
|
|
|
+ clip.setVideoSignature(effiVideoDTO.getSignature());
|
|
|
|
+ clip.setQuarter(thisQuarter);
|
|
|
|
+ clip.setYear(thisYear);
|
|
|
|
+ clip.setMonth(thisMonth);
|
|
|
|
+ clip.setCalcDate(calcDate);
|
|
|
|
+ clip.setRoleId("clip");
|
|
|
|
+ clip.setWeekStart(friday);
|
|
|
|
+ clip.setWeekEnd(thursday);
|
|
|
|
+ clip.setCompanyId(companyId);
|
|
|
|
+ userVideoMapMapper.insert(clip);
|
|
|
|
+ }
|
|
|
|
+ log.info("设计师周总视频计算结束");
|
|
|
|
+ }
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ //新总视频计算结束
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+
|
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//绩效计算开始
|
|
//绩效计算开始
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
/**
|
|
/**
|
|
@@ -925,7 +1282,6 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
//TODO ctop_project表有修改,需要进行相对应的变化
|
|
//TODO ctop_project表有修改,需要进行相对应的变化
|
|
//获取所有project根据媒体类型获取快手下的项目类型 1-头条 2-快手
|
|
//获取所有project根据媒体类型获取快手下的项目类型 1-头条 2-快手
|
|
List<ProjectDTO> projectDTOS = userEfficientVideoMapMapper.getProjects("1");
|
|
List<ProjectDTO> projectDTOS = userEfficientVideoMapMapper.getProjects("1");
|
|
- System.out.println("头条项目数量为:" + projectDTOS.size());
|
|
|
|
|
|
|
|
//循环project
|
|
//循环project
|
|
for (ProjectDTO projectDTO : projectDTOS) {
|
|
for (ProjectDTO projectDTO : projectDTOS) {
|
|
@@ -1830,24 +2186,22 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartUserInfo();
|
|
List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartUserInfo();
|
|
//2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
|
|
//2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
|
|
for (UserDto2 userDto : userDto2List) {
|
|
for (UserDto2 userDto : userDto2List) {
|
|
- String roleCode = userDto.getRoleCode();
|
|
|
|
//2.1 获取有效视频数量
|
|
//2.1 获取有效视频数量
|
|
- Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 2);
|
|
|
|
- //2.2 获取有效视频总数
|
|
|
|
- Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
|
|
|
|
|
|
+ Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 2);
|
|
|
|
+ //2.2 获取视频总数
|
|
|
|
+ Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
|
|
//2.3 总消耗
|
|
//2.3 总消耗
|
|
- BigDecimal cost = null;
|
|
|
|
- if ("clip".equals(roleCode)) {
|
|
|
|
- cost = userEfficientVideoMapMapper.getTotalCostByClipId(userDto.getUserId(), startDate, endDate);
|
|
|
|
- } else if ("plan".equals(roleCode)) {
|
|
|
|
- cost = userEfficientVideoMapMapper.getTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
|
|
|
|
- } else if ("shot".equals(roleCode)) {
|
|
|
|
- cost = userEfficientVideoMapMapper.getTotalCostByShotId(userDto.getUserId(), startDate, endDate);
|
|
|
|
- }
|
|
|
|
- if(cost == null){
|
|
|
|
- cost = BigDecimal.ZERO;
|
|
|
|
|
|
+ BigDecimal totalCost = BigDecimal.ZERO;
|
|
|
|
+ List<String> md5s = userEfficientVideoMapMapper.getTotalSignatureByUserId(userDto.getUserId(), startDate, endDate);
|
|
|
|
+ for(String md5:md5s){
|
|
|
|
+ BigDecimal cost = userEfficientVideoMapMapper.getSumChargeBySignature(md5, startDate, endDate);
|
|
|
|
+ if(cost== null){
|
|
|
|
+ cost = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+ totalCost = totalCost.add(cost);
|
|
}
|
|
}
|
|
- userDto.setCost(cost);
|
|
|
|
|
|
+
|
|
|
|
+ userDto.setCost(totalCost);
|
|
userDto.setVideoCount(videoCount);
|
|
userDto.setVideoCount(videoCount);
|
|
userDto.setEffiVideoCount(effiVideoCount);
|
|
userDto.setEffiVideoCount(effiVideoCount);
|
|
}
|
|
}
|
|
@@ -1863,23 +2217,20 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
for (UserDto2 userDto : userDto2List) {
|
|
for (UserDto2 userDto : userDto2List) {
|
|
String roleCode = userDto.getRoleCode();
|
|
String roleCode = userDto.getRoleCode();
|
|
//2.1 获取有效视频数量
|
|
//2.1 获取有效视频数量
|
|
- Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 1);
|
|
|
|
|
|
+ Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 1);
|
|
//2.2 获取视频总数
|
|
//2.2 获取视频总数
|
|
- Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
|
|
|
|
|
|
+ Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
|
|
//2.3 总消耗
|
|
//2.3 总消耗
|
|
- BigDecimal cost = null;
|
|
|
|
- if ("clip".equals(roleCode)) {
|
|
|
|
- cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByClipId(userDto.getUserId(), startDate, endDate);
|
|
|
|
- } else if ("plan".equals(roleCode)) {
|
|
|
|
- cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
|
|
|
|
- } else if ("shot".equals(roleCode)) {
|
|
|
|
- cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByShotId(userDto.getUserId(), startDate, endDate);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(cost == null){
|
|
|
|
- cost = BigDecimal.ZERO;
|
|
|
|
|
|
+ BigDecimal totalCost = BigDecimal.ZERO;
|
|
|
|
+ List<String> md5s = userEfficientVideoMapMapper.getTotalSignatureByUserId(userDto.getUserId(), startDate, endDate);
|
|
|
|
+ for(String md5:md5s){
|
|
|
|
+ BigDecimal cost = userEfficientVideoMapMapper.getToutiaoSumChargeBySignature(md5, startDate, endDate);
|
|
|
|
+ if(cost== null){
|
|
|
|
+ cost = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+ totalCost = totalCost.add(cost);
|
|
}
|
|
}
|
|
- userDto.setCost(cost);
|
|
|
|
|
|
+ userDto.setCost(totalCost);
|
|
userDto.setVideoCount(videoCount);
|
|
userDto.setVideoCount(videoCount);
|
|
userDto.setEffiVideoCount(effiVideoCount);
|
|
userDto.setEffiVideoCount(effiVideoCount);
|
|
}
|
|
}
|
|
@@ -1968,8 +2319,44 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
}
|
|
}
|
|
|
|
|
|
//根据userid,appType,年度,季度查询有效视频列表
|
|
//根据userid,appType,年度,季度查询有效视频列表
|
|
|
|
+ public List<MaterialInfo> getVideoList(String userId, String startDate, String endDate){
|
|
|
|
+ List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getVideoList(userId, startDate, endDate);
|
|
|
|
+ return materialInfoList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据userid,appType,年度,季度查询有效视频列表
|
|
public List<MaterialInfo> getEffiWeekVideoList(Integer appType, String startDate, String endDate, String userId){
|
|
public List<MaterialInfo> getEffiWeekVideoList(Integer appType, String startDate, String endDate, String userId){
|
|
List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getEffiWeekVideoList(appType, startDate, endDate, userId);
|
|
List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getEffiWeekVideoList(appType, startDate, endDate, userId);
|
|
|
|
+
|
|
|
|
+ //String effiCalcStart = null;
|
|
|
|
+ //String effiCalcEnd =null;
|
|
|
|
+ //try {
|
|
|
|
+ // effiCalcStart = DateUtils.formatDate(DateUtils.addDay(startDate, -14)); //计算有效视频开始的时间
|
|
|
|
+ // log.info("周有效视频开始时间:" + effiCalcStart);
|
|
|
|
+ // effiCalcEnd = DateUtils.formatDate(DateUtils.addDay(startDate, -1)); //计算有效视频结束的时间
|
|
|
|
+ // log.info("周有效视频结束时间:" + effiCalcEnd);
|
|
|
|
+ //} catch (ParseException e) {
|
|
|
|
+ // e.printStackTrace();
|
|
|
|
+ //}
|
|
|
|
+ //
|
|
|
|
+ //BigDecimal cost = null;
|
|
|
|
+ //if(appType == 2){
|
|
|
|
+ // for(MaterialInfo materialInfo:materialInfoList){
|
|
|
|
+ // cost = userEfficientVideoMapMapper.videoTotalCostInDates(materialInfo.getCode(),effiCalcStart, effiCalcEnd);
|
|
|
|
+ // if(cost == null){
|
|
|
|
+ // cost = BigDecimal.ZERO;
|
|
|
|
+ // }
|
|
|
|
+ // materialInfo.setCost(cost);
|
|
|
|
+ // }
|
|
|
|
+ //}else if(appType == 1){
|
|
|
|
+ // for(MaterialInfo materialInfo:materialInfoList){
|
|
|
|
+ // cost = userEfficientVideoMapMapper.toutiaoVideoTotalCostInDates(materialInfo.getCode(),effiCalcStart, effiCalcEnd);
|
|
|
|
+ // if(cost == null){
|
|
|
|
+ // cost = BigDecimal.ZERO;
|
|
|
|
+ // }
|
|
|
|
+ // materialInfo.setCost(cost);
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
return materialInfoList;
|
|
return materialInfoList;
|
|
}
|
|
}
|
|
|
|
|