|
@@ -39,6 +39,8 @@ import java.util.concurrent.Executors;
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEtlInfoMapper, KuaishouVideoEtlInfo> implements IKuaishouVideoEtlInfoService {
|
|
public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEtlInfoMapper, KuaishouVideoEtlInfo> implements IKuaishouVideoEtlInfoService {
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMaterialAscriptionService materialAscriptionService;
|
|
@Resource
|
|
@Resource
|
|
private KuaishouVideoEtlInfoMapper kuaishouVideoEtlInfoMapper;
|
|
private KuaishouVideoEtlInfoMapper kuaishouVideoEtlInfoMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -69,9 +71,9 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
etlInfo = new KuaishouVideoEtlInfo(nowData);
|
|
etlInfo = new KuaishouVideoEtlInfo(nowData);
|
|
BigDecimal totalCost = etlInfo.getTotalCost();
|
|
BigDecimal totalCost = etlInfo.getTotalCost();
|
|
JSONObject ascription = materialAscriptionService.getDetailByCode(signature);
|
|
JSONObject ascription = materialAscriptionService.getDetailByCode(signature);
|
|
- String planId = null;
|
|
|
|
|
|
+ String clipId = null;
|
|
if (null != ascription) {
|
|
if (null != ascription) {
|
|
- planId = ascription.getString("planId");
|
|
|
|
|
|
+ String planId = ascription.getString("planId");
|
|
if (null != planId && !planId.trim().equals("")) {
|
|
if (null != planId && !planId.trim().equals("")) {
|
|
etlInfo.setPlanId(planId);
|
|
etlInfo.setPlanId(planId);
|
|
}
|
|
}
|
|
@@ -79,7 +81,7 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
if (null != planName && !planName.trim().equals("")) {
|
|
if (null != planName && !planName.trim().equals("")) {
|
|
etlInfo.setPlanName(planName);
|
|
etlInfo.setPlanName(planName);
|
|
}
|
|
}
|
|
- String clipId = ascription.getString("clipId");
|
|
|
|
|
|
+ clipId = ascription.getString("clipId");
|
|
if (null != clipId && !clipId.trim().equals("")) {
|
|
if (null != clipId && !clipId.trim().equals("")) {
|
|
etlInfo.setClipId(clipId);
|
|
etlInfo.setClipId(clipId);
|
|
}
|
|
}
|
|
@@ -96,8 +98,8 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
etlInfo.setShotName(shotName);
|
|
etlInfo.setShotName(shotName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (null != planId) {
|
|
|
|
- String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(planId);
|
|
|
|
|
|
+ if (null != clipId) {
|
|
|
|
+ String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(clipId);
|
|
if (null != companyName && !companyName.trim().equals("")) {
|
|
if (null != companyName && !companyName.trim().equals("")) {
|
|
etlInfo.setCompanyName(companyName);
|
|
etlInfo.setCompanyName(companyName);
|
|
}
|
|
}
|
|
@@ -128,9 +130,9 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
this.save(etlInfo);
|
|
this.save(etlInfo);
|
|
} else {
|
|
} else {
|
|
JSONObject ascription = materialAscriptionService.getDetailByCode(signature);
|
|
JSONObject ascription = materialAscriptionService.getDetailByCode(signature);
|
|
- String planId = null;
|
|
|
|
|
|
+ String clipId = null;
|
|
if (null != ascription) {
|
|
if (null != ascription) {
|
|
- planId = ascription.getString("planId");
|
|
|
|
|
|
+ String planId = ascription.getString("planId");
|
|
if (null != planId && !planId.trim().equals("")) {
|
|
if (null != planId && !planId.trim().equals("")) {
|
|
etlInfo.setPlanId(planId);
|
|
etlInfo.setPlanId(planId);
|
|
}
|
|
}
|
|
@@ -138,7 +140,7 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
if (null != planName && !planName.trim().equals("")) {
|
|
if (null != planName && !planName.trim().equals("")) {
|
|
etlInfo.setPlanName(planName);
|
|
etlInfo.setPlanName(planName);
|
|
}
|
|
}
|
|
- String clipId = ascription.getString("clipId");
|
|
|
|
|
|
+ clipId = ascription.getString("clipId");
|
|
if (null != clipId && !clipId.trim().equals("")) {
|
|
if (null != clipId && !clipId.trim().equals("")) {
|
|
etlInfo.setClipId(clipId);
|
|
etlInfo.setClipId(clipId);
|
|
}
|
|
}
|
|
@@ -155,8 +157,8 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
etlInfo.setShotName(shotName);
|
|
etlInfo.setShotName(shotName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (null != planId) {
|
|
|
|
- String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(planId);
|
|
|
|
|
|
+ if (null != clipId) {
|
|
|
|
+ String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(clipId);
|
|
if (null != companyName && !companyName.trim().equals("")) {
|
|
if (null != companyName && !companyName.trim().equals("")) {
|
|
etlInfo.setCompanyName(companyName);
|
|
etlInfo.setCompanyName(companyName);
|
|
}
|
|
}
|
|
@@ -212,156 +214,6 @@ public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEt
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaishouProjectVideoEtlInfoService kuaishouProjectVideoEtlInfoService;
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void etlKuaishouVideoInfoGroupByProjectId(Date getDate) {
|
|
|
|
- String date = DateUtils.formatDate(getDate);
|
|
|
|
- //1:查询单当日视频信息--以项目汇总
|
|
|
|
- List<KuaiShouReportDailyMaterial> materials = dailyMaterialService.getSignatureByDateGroupByProjectId(date);
|
|
|
|
- if (null != materials && !materials.isEmpty()) {
|
|
|
|
- CountDownLatch countDownLatch = new CountDownLatch(materials.size());
|
|
|
|
- materials.forEach(material -> {
|
|
|
|
- executorService.submit(() -> {
|
|
|
|
- try {
|
|
|
|
- if (null == material.getSignature() || material.getSignature().trim().equals("")) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (null == material.getProjectId() || material.getProjectId() == 0) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String signature = material.getSignature();
|
|
|
|
- Long projectId = material.getProjectId();
|
|
|
|
- KuaishouProjectVideoEtlInfo etlInfo = kuaishouProjectVideoEtlInfoService.getByProjectVideoEtlInfoByParams(signature, projectId);
|
|
|
|
- KuaiShouReportDailyMaterial nowData = dailyMaterialService.getEtlDataByParams(signature, date, projectId);
|
|
|
|
- String minDate = nowData.getStatDate();
|
|
|
|
- Integer days = DateUtils.getdaysOfTwoDate(minDate, date);
|
|
|
|
- if (null == etlInfo) {
|
|
|
|
- //第一次查询的数据
|
|
|
|
- etlInfo = new KuaishouProjectVideoEtlInfo(nowData, projectId);
|
|
|
|
- JSONObject ascription = materialAscriptionService.getDetailByCode(signature);
|
|
|
|
- String planId = null;
|
|
|
|
- if (null != ascription) {
|
|
|
|
- planId = ascription.getString("planId");
|
|
|
|
- if (null != planId && !planId.trim().equals("")) {
|
|
|
|
- etlInfo.setPlanId(planId);
|
|
|
|
- }
|
|
|
|
- String planName = ascription.getString("planName");
|
|
|
|
- if (null != planName && !planName.trim().equals("")) {
|
|
|
|
- etlInfo.setPlanName(planName);
|
|
|
|
- }
|
|
|
|
- String clipId = ascription.getString("clipId");
|
|
|
|
- if (null != clipId && !clipId.trim().equals("")) {
|
|
|
|
- etlInfo.setClipId(clipId);
|
|
|
|
- }
|
|
|
|
- String clipName = ascription.getString("clipName");
|
|
|
|
- if (null != clipName && !clipName.trim().equals("")) {
|
|
|
|
- etlInfo.setClipName(clipName);
|
|
|
|
- }
|
|
|
|
- String shotId = ascription.getString("shotId");
|
|
|
|
- if (null != shotId && !shotId.trim().equals("")) {
|
|
|
|
- etlInfo.setShotId(shotId);
|
|
|
|
- }
|
|
|
|
- String shotName = ascription.getString("shotName");
|
|
|
|
- if (null != shotName && !shotName.trim().equals("")) {
|
|
|
|
- etlInfo.setShotName(shotName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (null != planId) {
|
|
|
|
- String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(planId);
|
|
|
|
- if (null != companyName && !companyName.trim().equals("")) {
|
|
|
|
- etlInfo.setCompanyName(companyName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //计算投放总天数
|
|
|
|
- if (days <= 7) {
|
|
|
|
- etlInfo.setSingleWeekCost(nowData.getCharge());
|
|
|
|
- }
|
|
|
|
- if (days <= 14) {
|
|
|
|
- etlInfo.setTwoWeekCost(nowData.getCharge());
|
|
|
|
- }
|
|
|
|
- if (days <= 28) {
|
|
|
|
- etlInfo.setFourWeekCost(nowData.getCharge());
|
|
|
|
- }
|
|
|
|
- etlInfo.setCreateTime(new Date());
|
|
|
|
- etlInfo.setUpdateTime(new Date());
|
|
|
|
- kuaishouProjectVideoEtlInfoService.save(etlInfo);
|
|
|
|
- } else {
|
|
|
|
- JSONObject ascription = materialAscriptionService.getDetailByCode(signature);
|
|
|
|
- String planId = null;
|
|
|
|
- if (null != ascription) {
|
|
|
|
- planId = ascription.getString("planId");
|
|
|
|
- if (null != planId && !planId.trim().equals("")) {
|
|
|
|
- etlInfo.setPlanId(planId);
|
|
|
|
- }
|
|
|
|
- String planName = ascription.getString("planName");
|
|
|
|
- if (null != planName && !planName.trim().equals("")) {
|
|
|
|
- etlInfo.setPlanName(planName);
|
|
|
|
- }
|
|
|
|
- String clipId = ascription.getString("clipId");
|
|
|
|
- if (null != clipId && !clipId.trim().equals("")) {
|
|
|
|
- etlInfo.setClipId(clipId);
|
|
|
|
- }
|
|
|
|
- String clipName = ascription.getString("clipName");
|
|
|
|
- if (null != clipName && !clipName.trim().equals("")) {
|
|
|
|
- etlInfo.setClipName(clipName);
|
|
|
|
- }
|
|
|
|
- String shotId = ascription.getString("shotId");
|
|
|
|
- if (null != shotId && !shotId.trim().equals("")) {
|
|
|
|
- etlInfo.setShotId(shotId);
|
|
|
|
- }
|
|
|
|
- String shotName = ascription.getString("shotName");
|
|
|
|
- if (null != shotName && !shotName.trim().equals("")) {
|
|
|
|
- etlInfo.setShotName(shotName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (null != planId) {
|
|
|
|
- String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(planId);
|
|
|
|
- if (null != companyName && !companyName.trim().equals("")) {
|
|
|
|
- etlInfo.setCompanyName(companyName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //只需要更新汇总数据
|
|
|
|
- etlInfo.setTotalCost(nowData.getCharge());
|
|
|
|
- etlInfo.setAclick(nowData.getAclick());
|
|
|
|
- etlInfo.setBclick(nowData.getBclick());
|
|
|
|
- etlInfo.setPhotoClick(nowData.getPhotoClick());
|
|
|
|
- etlInfo.setPhotoShow(nowData.getPhotoShow());
|
|
|
|
- etlInfo.setUpdateTime(new Date());
|
|
|
|
- //计算投放总天数
|
|
|
|
- if (days <= 7) {
|
|
|
|
- etlInfo.setSingleWeekCost(nowData.getCharge());
|
|
|
|
- }
|
|
|
|
- if (days <= 14) {
|
|
|
|
- etlInfo.setTwoWeekCost(nowData.getCharge());
|
|
|
|
- }
|
|
|
|
- if (days <= 28) {
|
|
|
|
- etlInfo.setFourWeekCost(nowData.getCharge());
|
|
|
|
- }
|
|
|
|
- kuaishouProjectVideoEtlInfoService.updateById(etlInfo);
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
-
|
|
|
|
- } finally {
|
|
|
|
- countDownLatch.countDown();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- countDownLatch.await();
|
|
|
|
- } catch (InterruptedException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- log.info("{}数据获取完成", date);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IMaterialAscriptionService materialAscriptionService;
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public KuaishouVideoEtlInfo getBySignature(String signature) {
|
|
public KuaishouVideoEtlInfo getBySignature(String signature) {
|
|
QueryWrapper<KuaishouVideoEtlInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaishouVideoEtlInfo> queryWrapper = new QueryWrapper<>();
|