|
@@ -58,18 +58,46 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
|
|
QueryWrapper<KuaishouBatchCampaignPreview> campaignWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaishouBatchCampaignPreview> campaignWrapper = new QueryWrapper<>();
|
|
campaignWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
|
|
campaignWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
|
|
List<KuaishouBatchCampaignPreview> campaignPreviewList = campaignPreviewMapper.selectList(campaignWrapper);
|
|
List<KuaishouBatchCampaignPreview> campaignPreviewList = campaignPreviewMapper.selectList(campaignWrapper);
|
|
- obj.put("campaignList", campaignPreviewList);
|
|
|
|
QueryWrapper<KuaishouBatchGroupPreview> groupWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaishouBatchGroupPreview> groupWrapper = new QueryWrapper<>();
|
|
groupWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
|
|
groupWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
|
|
List<KuaishouBatchGroupPreview> groupPreviewList = groupPreviewMapper.selectList(groupWrapper);
|
|
List<KuaishouBatchGroupPreview> groupPreviewList = groupPreviewMapper.selectList(groupWrapper);
|
|
- obj.put("groupList", groupPreviewList);
|
|
|
|
QueryWrapper<KuaishouBatchCreativePreview> creativeWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaishouBatchCreativePreview> creativeWrapper = new QueryWrapper<>();
|
|
creativeWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
|
|
creativeWrapper.eq("batch_id", batchId).eq("account_id", accountId).orderByDesc("create_time");
|
|
List<KuaishouBatchCreativePreview> creativePreviewList = creativePreviewMapper.selectList(creativeWrapper);
|
|
List<KuaishouBatchCreativePreview> creativePreviewList = creativePreviewMapper.selectList(creativeWrapper);
|
|
- obj.put("creativeList", creativePreviewList);
|
|
|
|
|
|
+ obj.put("campaignList", getCampaignList(campaignPreviewList, groupPreviewList, creativePreviewList));
|
|
return obj;
|
|
return obj;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<KuaishouBatchCampaignPreview> getCampaignList(List<KuaishouBatchCampaignPreview> campaignPreviewList, List<KuaishouBatchGroupPreview> kuaishouBatchGroupPreviews, List<KuaishouBatchCreativePreview> kuaishouBatchCreativePreviews) {
|
|
|
|
+ List<KuaishouBatchGroupPreview> groups = new ArrayList<>();
|
|
|
|
+ for (KuaishouBatchGroupPreview groupPreview : kuaishouBatchGroupPreviews) {
|
|
|
|
+ List<KuaishouBatchCreativePreview> creatives = new ArrayList<>();
|
|
|
|
+ for (KuaishouBatchCreativePreview creativePreview : kuaishouBatchCreativePreviews) {
|
|
|
|
+ if (groupPreview.getPlanId().equals(creativePreview.getPlanId()) && creativePreview.getGroupId().equals(groupPreview.getId())) {
|
|
|
|
+ creatives.add(creativePreview);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ groupPreview.setKuaishouBatchCreativePreviews(creatives);
|
|
|
|
+ QueryWrapper<KuaishouTemplate> queryWrapper = new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("template_id", groupPreview.getTemplateId());
|
|
|
|
+ KuaishouTemplate template = kuaishouTemplateService.getOne(queryWrapper);
|
|
|
|
+ groupPreview.setTemplateName(template.getTemplateName());
|
|
|
|
+ groups.add(groupPreview);
|
|
|
|
+ }
|
|
|
|
+ List<KuaishouBatchCampaignPreview> campaigns = new ArrayList<>();
|
|
|
|
+ for (KuaishouBatchCampaignPreview campaignPreview : campaignPreviewList) {
|
|
|
|
+ List<KuaishouBatchGroupPreview> groupList = new ArrayList<>();
|
|
|
|
+ for (KuaishouBatchGroupPreview group : groups) {
|
|
|
|
+ if (campaignPreview.getId().equals(group.getPlanId())) {
|
|
|
|
+ groupList.add(group);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ campaignPreview.setKuaishouBatchGroupPreviews(groupList);
|
|
|
|
+ campaigns.add(campaignPreview);
|
|
|
|
+ }
|
|
|
|
+ return campaigns;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void addPreviewData(JSONObject data) throws Exception {
|
|
public void addPreviewData(JSONObject data) throws Exception {
|
|
String batchId = data.getString("batchId");
|
|
String batchId = data.getString("batchId");
|