|
@@ -516,29 +516,72 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
|
|
|
}
|
|
|
}
|
|
|
groupPreviewMapper.insert(groupPreview);
|
|
|
- for (int k = 0; k < photoArr.size(); k++) {
|
|
|
- creativePreview.setId(null);
|
|
|
- creativePreview.setSiteId(siteId);
|
|
|
- creativePreview.setClickTrackUrl(clickTrackUrl);
|
|
|
- creativePreview.setActionbarClickUrl(actionbarClickUrl);
|
|
|
- JSONObject photo = photoArr.getJSONObject(k);
|
|
|
- JSONObject image = photo.getJSONObject("image");
|
|
|
- creativePreview.setPlanId(campaignPreview.getId());
|
|
|
- creativePreview.setGroupId(groupPreview.getId());
|
|
|
- creativePreview.setPhotoId(photo.getString("photoId"));
|
|
|
- creativePreview.setImageTokens(photo.getString("imageToken"));
|
|
|
- creativePreview.setMaterialType(photo.getString("materialType"));
|
|
|
- creativePreview.setCreativeName(photo.getString("creativeName") + k);
|
|
|
- creativePreview.setImageUrl(image.getString("url"));
|
|
|
- creativePreview.setImageSignature(image.getString("signature"));
|
|
|
- if (matchingMethod == 1) {
|
|
|
- creativePreview.setDescription(photo.getString("description"));
|
|
|
- } else if (matchingMethod == 2) {
|
|
|
- creativePreview.setDescription(descriptionList.getString(k));
|
|
|
- } else if (matchingMethod == 3) {
|
|
|
- creativePreview.setDescription(descriptionList.getString(i));
|
|
|
+ if (groupPreview.getUnitType() == 4) {
|
|
|
+ for (int k = 0; k < photoArr.size(); k++) {
|
|
|
+ creativePreview.setId(null);
|
|
|
+ creativePreview.setSiteId(siteId);
|
|
|
+ creativePreview.setClickTrackUrl(clickTrackUrl);
|
|
|
+ creativePreview.setActionbarClickUrl(actionbarClickUrl);
|
|
|
+ JSONObject photo = photoArr.getJSONObject(k);
|
|
|
+ JSONObject image = photo.getJSONObject("image");
|
|
|
+ creativePreview.setPlanId(campaignPreview.getId());
|
|
|
+ creativePreview.setGroupId(groupPreview.getId());
|
|
|
+ creativePreview.setPhotoId(photo.getString("photoId"));
|
|
|
+ creativePreview.setImageTokens(photo.getString("imageToken"));
|
|
|
+ creativePreview.setMaterialType(photo.getString("materialType"));
|
|
|
+ creativePreview.setCreativeName(photo.getString("creativeName") + k);
|
|
|
+ creativePreview.setImageUrl(image.getString("url"));
|
|
|
+ creativePreview.setImageSignature(image.getString("signature"));
|
|
|
+ if (matchingMethod == 1) {
|
|
|
+ creativePreview.setDescription(photo.getString("description"));
|
|
|
+ } else if (matchingMethod == 2) {
|
|
|
+ creativePreview.setDescription(descriptionList.getString(k));
|
|
|
+ } else if (matchingMethod == 3) {
|
|
|
+ creativePreview.setDescription(descriptionList.getString(i));
|
|
|
+ }
|
|
|
+ creativePreviewMapper.insert(creativePreview);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (photoArr.size() >= 3) {
|
|
|
+ List<JSONObject> photoIds = JSONArray.parseArray(photoArr.toJSONString(), JSONObject.class);
|
|
|
+ List<List<JSONObject>> splitPhotoIds = Lists.newArrayList(Lists.partition(photoIds, 10));
|
|
|
+ for (int k = 0; k < splitPhotoIds.size(); k++) {
|
|
|
+ //广告语
|
|
|
+ JSONArray descriptions = materialArray.getJSONArray("descriptionList");
|
|
|
+ if (descriptions.size() > 3) {
|
|
|
+ creativePreview.setDescription(getRandomFromList(descriptions));
|
|
|
+ } else {
|
|
|
+ creativePreview.setDescription(JSONArray.toJSONString(descriptions));
|
|
|
+ }
|
|
|
+
|
|
|
+ //photoId集合
|
|
|
+ List<String> photos = new ArrayList<>();
|
|
|
+ // 图片集合
|
|
|
+ List<String> images = new ArrayList<>();
|
|
|
+ for (JSONObject object : splitPhotoIds.get(k)) {
|
|
|
+ if (!Check.isNull(object.getString("photoId"))) {
|
|
|
+ photos.add(object.getString("photoId"));
|
|
|
+ }
|
|
|
+ if (!Check.isNull(object.getString("imageToken"))) {
|
|
|
+ images.add(object.getString("imageToken"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ creativePreview.setId(null);
|
|
|
+ creativePreview.setSiteId(siteId);
|
|
|
+ creativePreview.setClickTrackUrl(clickTrackUrl);
|
|
|
+ creativePreview.setActionbarClickUrl(actionbarClickUrl);
|
|
|
+ creativePreview.setPlanId(campaignPreview.getId());
|
|
|
+ creativePreview.setGroupId(groupPreview.getId());
|
|
|
+ if (!photos.isEmpty()) {
|
|
|
+ creativePreview.setPhotoId(JSONArray.toJSONString(photos));
|
|
|
+ }
|
|
|
+ if (!images.isEmpty()) {
|
|
|
+ creativePreview.setImageTokens(JSONArray.toJSONString(images));
|
|
|
+ }
|
|
|
+ creativePreview.setCreativeName("程序化组-" + k);
|
|
|
+ creativePreviewMapper.insert(creativePreview);
|
|
|
+ }
|
|
|
}
|
|
|
- creativePreviewMapper.insert(creativePreview);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -676,6 +719,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
|
|
|
groupPreview.setAppStore(groupJson.getString("appStore"));
|
|
|
groupPreview.setBatchId(batchId);
|
|
|
groupPreview.setUnitType(groupJson.getInteger("unitType"));
|
|
|
+ groupPreview.setMedia(groupJson.getString("media"));
|
|
|
+ groupPreview.setExcludeMedia(groupJson.getString("excludeMedia"));
|
|
|
+ groupPreview.setMediaSourceType(groupJson.getInteger("mediaSourceType"));
|
|
|
return groupPreview;
|
|
|
}
|
|
|
|