|
@@ -1,14 +1,10 @@
|
|
package cn.com.ctop.kuaishou.modules.material.service.impl;
|
|
package cn.com.ctop.kuaishou.modules.material.service.impl;
|
|
|
|
|
|
-import cn.com.ctop.common.module.entity.MaterialAscription;
|
|
|
|
import cn.com.ctop.common.module.entity.MaterialInfo;
|
|
import cn.com.ctop.common.module.entity.MaterialInfo;
|
|
import cn.com.ctop.common.module.entity.SysUser;
|
|
import cn.com.ctop.common.module.entity.SysUser;
|
|
-import cn.com.ctop.common.module.entity.UserCompany;
|
|
|
|
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
|
import cn.com.ctop.common.module.service.IMaterialAscriptionService;
|
|
import cn.com.ctop.common.module.service.IMaterialAscriptionService;
|
|
import cn.com.ctop.common.module.service.IMaterialInfoService;
|
|
import cn.com.ctop.common.module.service.IMaterialInfoService;
|
|
import cn.com.ctop.common.module.service.ISysUserService;
|
|
import cn.com.ctop.common.module.service.ISysUserService;
|
|
-import cn.com.ctop.common.module.service.IUserCompanyService;
|
|
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
|
|
import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
|
|
import cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo;
|
|
@@ -17,6 +13,7 @@ import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoServic
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -24,6 +21,9 @@ import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 快手视频报表信息
|
|
* 快手视频报表信息
|
|
@@ -32,6 +32,7 @@ import java.util.List;
|
|
* @version V1.0
|
|
* @version V1.0
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
|
|
+@Slf4j
|
|
public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVideoInfoMapper, EtlKuaishouVideoInfo> implements IEtlKuaishouVideoInfoService {
|
|
public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVideoInfoMapper, EtlKuaishouVideoInfo> implements IEtlKuaishouVideoInfoService {
|
|
@Resource
|
|
@Resource
|
|
private EtlKuaishouVideoInfoMapper etlKuaishouVideoInfoMapper;
|
|
private EtlKuaishouVideoInfoMapper etlKuaishouVideoInfoMapper;
|
|
@@ -43,72 +44,92 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
|
|
private ISysUserService sysUserService;
|
|
private ISysUserService sysUserService;
|
|
@Autowired
|
|
@Autowired
|
|
private IMaterialInfoService materialInfoService;
|
|
private IMaterialInfoService materialInfoService;
|
|
|
|
+
|
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(200);
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void etlKuaishouVideoInfo(String date) {
|
|
public void etlKuaishouVideoInfo(String date) {
|
|
//1:查询当前日期内的所有存在md5码信息的视频数据
|
|
//1:查询当前日期内的所有存在md5码信息的视频数据
|
|
List<KuaiShouVideoGet> videoGets = videoGetService.getVideoInfoGroupBySignature(date);
|
|
List<KuaiShouVideoGet> videoGets = videoGetService.getVideoInfoGroupBySignature(date);
|
|
if(null!=videoGets&&!videoGets.isEmpty()){
|
|
if(null!=videoGets&&!videoGets.isEmpty()){
|
|
|
|
+ CountDownLatch countDownLatch = new CountDownLatch(videoGets.size());
|
|
videoGets.forEach(videoGet -> {
|
|
videoGets.forEach(videoGet -> {
|
|
- //1:查询素材名称
|
|
|
|
- EtlKuaishouVideoInfo etlKuaishouVideoInfo = new EtlKuaishouVideoInfo();
|
|
|
|
- MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(videoGet.getSignature());
|
|
|
|
- if(null == materialInfo){
|
|
|
|
- etlKuaishouVideoInfo.setVideoName(materialInfo.getMaterialName());
|
|
|
|
- }else{
|
|
|
|
- etlKuaishouVideoInfo.setVideoName(videoGet.getPhotoName());
|
|
|
|
- }
|
|
|
|
- etlKuaishouVideoInfo.setVideoCode(videoGet.getSignature());
|
|
|
|
- etlKuaishouVideoInfo.setUrl(videoGet.getUrl());
|
|
|
|
- etlKuaishouVideoInfo.setCoverUrl(videoGet.getCoverUrl());
|
|
|
|
- etlKuaishouVideoInfo.setChannelType(videoGet.getChannelType().toString());
|
|
|
|
- if(videoGet.getChannelType() == 0){
|
|
|
|
- etlKuaishouVideoInfo.setChannelName("内部");
|
|
|
|
- }else {
|
|
|
|
- etlKuaishouVideoInfo.setChannelName("素造");
|
|
|
|
- }
|
|
|
|
- //查询相关设计人员信息
|
|
|
|
- JSONObject ascription = ascriptionService.getDetailByCode(videoGet.getSignature());
|
|
|
|
- if(null!=ascription){
|
|
|
|
- String clipId = ascription.getString("clipId");
|
|
|
|
- if(null!=clipId&&!clipId.trim().equals("")){
|
|
|
|
- etlKuaishouVideoInfo.setClipId(clipId);
|
|
|
|
- //根据id查询剪辑所属的设计负责人
|
|
|
|
- SysUser user = sysUserService.getById(clipId);
|
|
|
|
- SysUser designTeamLeader = sysUserService.getDesignerTeamLeaderBy(user.getOrgCode());
|
|
|
|
- if(null!=designTeamLeader){
|
|
|
|
- etlKuaishouVideoInfo.setDesignTeamLeaderId(designTeamLeader.getId());
|
|
|
|
- etlKuaishouVideoInfo.setDesignTeamLeaderName(designTeamLeader.getRealname());
|
|
|
|
|
|
+ executorService.submit(()->{
|
|
|
|
+ try {
|
|
|
|
+ //1:查询素材名称
|
|
|
|
+ EtlKuaishouVideoInfo etlKuaishouVideoInfo = new EtlKuaishouVideoInfo();
|
|
|
|
+ MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(videoGet.getSignature());
|
|
|
|
+ if(null != materialInfo){
|
|
|
|
+ etlKuaishouVideoInfo.setVideoName(materialInfo.getMaterialName());
|
|
|
|
+ }else{
|
|
|
|
+ etlKuaishouVideoInfo.setVideoName(videoGet.getPhotoName());
|
|
}
|
|
}
|
|
|
|
+ etlKuaishouVideoInfo.setVideoCode(videoGet.getSignature());
|
|
|
|
+ etlKuaishouVideoInfo.setUrl(videoGet.getUrl());
|
|
|
|
+ etlKuaishouVideoInfo.setCoverUrl(videoGet.getCoverUrl());
|
|
|
|
+ etlKuaishouVideoInfo.setChannelType(videoGet.getChannelType().toString());
|
|
|
|
+ if(videoGet.getChannelType() == 0){
|
|
|
|
+ etlKuaishouVideoInfo.setChannelName("内部");
|
|
|
|
+ }else {
|
|
|
|
+ etlKuaishouVideoInfo.setChannelName("素造");
|
|
|
|
+ }
|
|
|
|
+ //查询相关设计人员信息
|
|
|
|
+ JSONObject ascription = ascriptionService.getDetailByCode(videoGet.getSignature());
|
|
|
|
+ if(null!=ascription){
|
|
|
|
+ String clipId = ascription.getString("clipId");
|
|
|
|
+ if(null!=clipId&&!clipId.trim().equals("")){
|
|
|
|
+ etlKuaishouVideoInfo.setClipId(clipId);
|
|
|
|
+ //根据id查询剪辑所属的设计负责人
|
|
|
|
+ SysUser user = sysUserService.getById(clipId);
|
|
|
|
+ if(null!=user){
|
|
|
|
+ SysUser designTeamLeader = sysUserService.getDesignerTeamLeaderBy(user.getOrgCode());
|
|
|
|
+ if(null!=designTeamLeader){
|
|
|
|
+ etlKuaishouVideoInfo.setDesignTeamLeaderId(designTeamLeader.getId());
|
|
|
|
+ etlKuaishouVideoInfo.setDesignTeamLeaderName(designTeamLeader.getRealname());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String clipName = ascription.getString("clipName");
|
|
|
|
+ if(null!=clipName&&!clipName.trim().equals("")){
|
|
|
|
+ etlKuaishouVideoInfo.setClipName(clipName);
|
|
|
|
+ }
|
|
|
|
+ String planId = ascription.getString("planId");
|
|
|
|
+ if(null!=planId&&!planId.trim().equals("")){
|
|
|
|
+ etlKuaishouVideoInfo.setPlanId(planId);
|
|
|
|
+ }
|
|
|
|
+ String planName = ascription.getString("planName");
|
|
|
|
+ if(null!=planName&&!planName.trim().equals("")){
|
|
|
|
+ etlKuaishouVideoInfo.setPlanName(planName);
|
|
|
|
+ }
|
|
|
|
+ String shotId = ascription.getString("shotId");
|
|
|
|
+ if(null!=shotId&&!shotId.trim().equals("")){
|
|
|
|
+ etlKuaishouVideoInfo.setShotId(shotId);
|
|
|
|
+ }
|
|
|
|
+ String shotName = ascription.getString("shotName");
|
|
|
|
+ if(null!=shotName&&!shotName.trim().equals("")){
|
|
|
|
+ etlKuaishouVideoInfo.setShotName(shotName);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //查询视频初次消耗时间
|
|
|
|
+ String minDate = etlKuaishouVideoInfoMapper.getVideoMinDate(videoGet.getSignature());
|
|
|
|
+ if(null!=minDate&&!"".equals(minDate)){
|
|
|
|
+ Date getDate = DateUtils.parseDate(minDate,"yyyy-MM-dd");
|
|
|
|
+ etlKuaishouVideoInfo.setStateDate(getDate);
|
|
|
|
+ }
|
|
|
|
+ etlKuaishouVideoInfoMapper.replaceVideoInfo(etlKuaishouVideoInfo);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ countDownLatch.countDown();
|
|
}
|
|
}
|
|
- String clipName = ascription.getString("clipName");
|
|
|
|
- if(null!=clipName&&!clipName.trim().equals("")){
|
|
|
|
- etlKuaishouVideoInfo.setClipName(clipName);
|
|
|
|
- }
|
|
|
|
- String planId = ascription.getString("planId");
|
|
|
|
- if(null!=planId&&!planId.trim().equals("")){
|
|
|
|
- etlKuaishouVideoInfo.setPlanId(planId);
|
|
|
|
- }
|
|
|
|
- String planName = ascription.getString("planName");
|
|
|
|
- if(null!=planName&&!planName.trim().equals("")){
|
|
|
|
- etlKuaishouVideoInfo.setPlanName(planName);
|
|
|
|
- }
|
|
|
|
- String shotId = ascription.getString("shotId");
|
|
|
|
- if(null!=shotId&&!shotId.trim().equals("")){
|
|
|
|
- etlKuaishouVideoInfo.setShotId(shotId);
|
|
|
|
- }
|
|
|
|
- String shotName = ascription.getString("shotName");
|
|
|
|
- if(null!=shotName&&!shotName.trim().equals("")){
|
|
|
|
- etlKuaishouVideoInfo.setShotName(shotName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //查询视频初次消耗时间
|
|
|
|
- String minDate = etlKuaishouVideoInfoMapper.getVideoMinDate(videoGet.getSignature());
|
|
|
|
- if(null!=minDate&&!"".equals(minDate)){
|
|
|
|
- Date getDate = DateUtils.parseDate(minDate,"yyyy-MM-dd");
|
|
|
|
- etlKuaishouVideoInfo.setStateDate(getDate);
|
|
|
|
- }
|
|
|
|
- etlKuaishouVideoInfoMapper.replaceVideoInfo(etlKuaishouVideoInfo);
|
|
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
+ try {
|
|
|
|
+ countDownLatch.await();
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ log.info("{}数据获取完成",date);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|