|
@@ -7,6 +7,8 @@ import cn.com.ctop.planeprojectcost.entity.PlaneProjectCost;
|
|
|
import cn.com.ctop.planeprojectcost.mapper.PlaneProjectCostMapper;
|
|
|
import cn.com.ctop.userefficientvideomap.entity.*;
|
|
|
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 io.micrometer.core.instrument.util.StringUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -43,6 +45,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
private SysRoleMapper sysRoleMapper;
|
|
|
@Autowired
|
|
|
private PlaneProjectCostMapper planeProjectCostMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserVideoMapMapper userVideoMapMapper;
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
//有效视频计算开始
|
|
@@ -94,9 +98,12 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
log.info("统计时间所在年" + thisYear + "月" + thisMonth + "季" + thisQuarter);
|
|
|
|
|
|
//快手有效视频(新)
|
|
|
- //kuaishouNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
|
+ 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));
|
|
|
+ //toutiaoNewEffiVideo(calcDate, effiCalcStart, effiFirstWeekCalcEnd, thisYear, thisMonth, thisQuarter, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
|
+
|
|
|
+ //总视频
|
|
|
+ //kuaishouNewVideo( calcDate, thisYear, thisQuarter, thisMonth, DateUtils.formatDate(friday), DateUtils.formatDate(thursday));
|
|
|
}
|
|
|
|
|
|
//快手有效视频统计
|
|
@@ -248,7 +255,6 @@ 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);
|
|
@@ -293,9 +299,16 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
|
|
|
String companyId = null;
|
|
|
//根据编导id获取视频所属分公司
|
|
|
- if(StringUtils.isNotBlank(effiVideoDTO.getPlanId())) {
|
|
|
+ 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();
|
|
@@ -310,7 +323,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
shot.setYear(thisYear);
|
|
|
shot.setMonth(thisMonth);
|
|
|
shot.setCalcDate(calcDate);
|
|
|
- shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
|
|
|
+ shot.setRoleId("shot");
|
|
|
shot.setWeekStart(friday);
|
|
|
shot.setWeekEnd(thursday);
|
|
|
shot.setCompanyId(companyId);
|
|
@@ -324,7 +337,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
plane.setYear(thisYear);
|
|
|
plane.setMonth(thisMonth);
|
|
|
plane.setCalcDate(calcDate);
|
|
|
- plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
|
|
|
+ plane.setRoleId("plane");
|
|
|
plane.setWeekStart(friday);
|
|
|
plane.setWeekEnd(thursday);
|
|
|
plane.setCompanyId(companyId);
|
|
@@ -338,7 +351,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
plan.setYear(thisYear);
|
|
|
plan.setMonth(thisMonth);
|
|
|
plan.setCalcDate(calcDate);
|
|
|
- plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
|
|
|
+ plan.setRoleId("plan");
|
|
|
plan.setWeekStart(friday);
|
|
|
plan.setWeekEnd(thursday);
|
|
|
plan.setCompanyId(companyId);
|
|
@@ -352,7 +365,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
clip.setYear(thisYear);
|
|
|
clip.setMonth(thisMonth);
|
|
|
clip.setCalcDate(calcDate);
|
|
|
- clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
|
|
|
+ clip.setRoleId("clip");
|
|
|
clip.setWeekStart(friday);
|
|
|
clip.setWeekEnd(thursday);
|
|
|
clip.setCompanyId(companyId);
|
|
@@ -408,9 +421,16 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
|
|
|
String companyId = null;
|
|
|
//根据编导id获取视频所属分公司
|
|
|
- if(StringUtils.isNotBlank(effiVideoDTO.getPlanId())) {
|
|
|
+ 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();
|
|
@@ -425,7 +445,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
shot.setYear(thisYear);
|
|
|
shot.setMonth(thisMonth);
|
|
|
shot.setCalcDate(calcDate);
|
|
|
- shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
|
|
|
+ shot.setRoleId("shot");
|
|
|
shot.setWeekStart(friday);
|
|
|
shot.setWeekEnd(thursday);
|
|
|
shot.setCompanyId(companyId);
|
|
@@ -439,7 +459,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
plane.setYear(thisYear);
|
|
|
plane.setMonth(thisMonth);
|
|
|
plane.setCalcDate(calcDate);
|
|
|
- plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
|
|
|
+ plane.setRoleId("plane");
|
|
|
plane.setWeekStart(friday);
|
|
|
plane.setWeekEnd(thursday);
|
|
|
plane.setCompanyId(companyId);
|
|
@@ -453,7 +473,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
plan.setYear(thisYear);
|
|
|
plan.setMonth(thisMonth);
|
|
|
plan.setCalcDate(calcDate);
|
|
|
- plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
|
|
|
+ plan.setRoleId("plan");
|
|
|
plan.setWeekStart(friday);
|
|
|
plan.setWeekEnd(thursday);
|
|
|
plan.setCompanyId(companyId);
|
|
@@ -467,7 +487,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
clip.setYear(thisYear);
|
|
|
clip.setMonth(thisMonth);
|
|
|
clip.setCalcDate(calcDate);
|
|
|
- clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
|
|
|
+ clip.setRoleId("clip");
|
|
|
clip.setWeekStart(friday);
|
|
|
clip.setWeekEnd(thursday);
|
|
|
clip.setCompanyId(companyId);
|
|
@@ -483,6 +503,102 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ //新总视频计算开始
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ 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("设计师周总视频计算结束");
|
|
|
+ }
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ //新总视频计算结束
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
//绩效计算开始
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
/**
|
|
@@ -2071,24 +2187,22 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartUserInfo();
|
|
|
//2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
|
|
|
for (UserDto2 userDto : userDto2List) {
|
|
|
- String roleCode = userDto.getRoleCode();
|
|
|
//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 总消耗
|
|
|
- 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.setEffiVideoCount(effiVideoCount);
|
|
|
}
|
|
@@ -2104,23 +2218,20 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
for (UserDto2 userDto : userDto2List) {
|
|
|
String roleCode = userDto.getRoleCode();
|
|
|
//2.1 获取有效视频数量
|
|
|
- Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getRoleId(), userDto.getUserId(), 1);
|
|
|
+ Integer effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByCalcDate(startDate, endDate, userDto.getUserId(), 1);
|
|
|
//2.2 获取视频总数
|
|
|
- Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
|
|
|
+ Integer videoCount = userEfficientVideoMapMapper.getVideoCountByUserId(userDto.getUserId(), startDate, endDate);
|
|
|
//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.setEffiVideoCount(effiVideoCount);
|
|
|
}
|
|
@@ -2209,6 +2320,12 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
|
|
|
}
|
|
|
|
|
|
//根据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){
|
|
|
List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getEffiWeekVideoList(appType, startDate, endDate, userId);
|
|
|
return materialInfoList;
|