|
@@ -5,11 +5,9 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget;
|
|
import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper;
|
|
import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper;
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
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;
|
|
@@ -44,10 +42,18 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
private IKuaiShouImageGetService imageGetService;
|
|
private IKuaiShouImageGetService imageGetService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaiShouMaterialUploadService uploadService;
|
|
private IKuaiShouMaterialUploadService uploadService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouTemplateTargetService templateTargetService;
|
|
|
|
|
|
- static ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
|
|
-
|
|
|
|
|
|
+ static ExecutorService executorService = Executors.newFixedThreadPool(5);
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 提交创建任务
|
|
|
|
+ *
|
|
|
|
+ * @param requestJson
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public JSONObject submitUnitTask(JSONObject requestJson) throws Exception {
|
|
public JSONObject submitUnitTask(JSONObject requestJson) throws Exception {
|
|
Long accountId = requestJson.getLong("accountId");
|
|
Long accountId = requestJson.getLong("accountId");
|
|
@@ -94,14 +100,14 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
Long app_id = requestJson.getLong("appId");
|
|
Long app_id = requestJson.getLong("appId");
|
|
Integer show_mode = requestJson.getInteger("showMode");
|
|
Integer show_mode = requestJson.getInteger("showMode");
|
|
Integer speed = requestJson.getInteger("speed");
|
|
Integer speed = requestJson.getInteger("speed");
|
|
- String click_track_url = requestJson.getString("click_track_url");
|
|
|
|
- String actionbar_click_url = requestJson.getString("actionbar_click_url");
|
|
|
|
- Integer creative_category = requestJson.getInteger("creative_category");
|
|
|
|
- JSONArray creative_tag = requestJson.getJSONArray("creative_tag");
|
|
|
|
- String creative_name = requestJson.getString("creative_name");
|
|
|
|
- String action_bar_text = requestJson.getString("action_bar_text");
|
|
|
|
|
|
+ String click_track_url = requestJson.getString("clickTrackUrl");
|
|
|
|
+ String actionbar_click_url = requestJson.getString("actionbarClickUrl");
|
|
|
|
+ Integer creative_category = requestJson.getInteger("creativeCategory");
|
|
|
|
+ JSONArray creative_tag = requestJson.getJSONArray("creativeTag");
|
|
|
|
+ String creative_name = requestJson.getString("creativeName");
|
|
|
|
+ String action_bar_text = requestJson.getString("actionBarText");
|
|
String description = requestJson.getString("description");
|
|
String description = requestJson.getString("description");
|
|
- Long site_id = requestJson.getLong("site_id");
|
|
|
|
|
|
+ Long site_id = requestJson.getLong("siteId");
|
|
|
|
|
|
List<KuaiShouGroupTemplate> templates = new ArrayList<>();
|
|
List<KuaiShouGroupTemplate> templates = new ArrayList<>();
|
|
for (int i = 0; i < createCount; i++) {
|
|
for (int i = 0; i < createCount; i++) {
|
|
@@ -144,7 +150,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
template.setSceneId(scene_id.toJSONString());
|
|
template.setSceneId(scene_id.toJSONString());
|
|
}
|
|
}
|
|
if (!Check.isNull(unit_type)) {
|
|
if (!Check.isNull(unit_type)) {
|
|
- template.setUrlType(unit_type);
|
|
|
|
|
|
+ template.setUnitType(unit_type);
|
|
}
|
|
}
|
|
if (!Check.isNull(begin_time)) {
|
|
if (!Check.isNull(begin_time)) {
|
|
template.setBeginTime(begin_time);
|
|
template.setBeginTime(begin_time);
|
|
@@ -204,6 +210,8 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
template.setSiteId(site_id);
|
|
template.setSiteId(site_id);
|
|
}
|
|
}
|
|
template.setTaskStatus(0);
|
|
template.setTaskStatus(0);
|
|
|
|
+ template.setCreativeReviewDetail("创意待创建");
|
|
|
|
+ template.setCreativeStatus(0);
|
|
templates.add(template);
|
|
templates.add(template);
|
|
}
|
|
}
|
|
boolean b = this.saveBatch(templates);
|
|
boolean b = this.saveBatch(templates);
|
|
@@ -218,11 +226,15 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
return returnJson;
|
|
return returnJson;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 创建组
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public void createUnit() {
|
|
public void createUnit() {
|
|
QueryWrapper<KuaiShouGroupTemplate> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaiShouGroupTemplate> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq("task_status", 0);
|
|
queryWrapper.eq("task_status", 0);
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
|
|
|
+ queryWrapper.orderByAsc("create_time");
|
|
queryWrapper.last("limit 30");
|
|
queryWrapper.last("limit 30");
|
|
List<KuaiShouGroupTemplate> list = this.list(queryWrapper);
|
|
List<KuaiShouGroupTemplate> list = this.list(queryWrapper);
|
|
if (Check.isNull(list)) {
|
|
if (Check.isNull(list)) {
|
|
@@ -243,12 +255,39 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
updateTemplate.setTaskStatus(1);
|
|
updateTemplate.setTaskStatus(1);
|
|
updateById(updateTemplate); // 修改状态为创建中
|
|
updateById(updateTemplate); // 修改状态为创建中
|
|
JSONObject createUnitJson = new JSONObject();
|
|
JSONObject createUnitJson = new JSONObject();
|
|
- createUnitJson.put("campaign_id", template.getCampaignId());
|
|
|
|
- createUnitJson.put("unit_name", template.getUnitName());
|
|
|
|
|
|
|
|
- if (!Check.isNull(template.getTemplateId())) {
|
|
|
|
- createUnitJson.put("template_id", template.getTemplateId());
|
|
|
|
|
|
+ JSONArray sceneIdArr = JSONArray.parseArray(template.getSceneId());
|
|
|
|
+ if (Check.isNull(sceneIdArr)) {
|
|
|
|
+ updateTemplate.setTaskStatus(3);
|
|
|
|
+ updateTemplate.setReviewDetail("scene_id不能为空");
|
|
|
|
+ updateTemplate.setCreativeStatus(3);
|
|
|
|
+ updateTemplate.setCreativeReviewDetail("组创建失败");
|
|
|
|
+ updateById(updateTemplate);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ createUnitJson.put("scene_id", sceneIdArr); //资源位置
|
|
|
|
+ Integer sceneId = (Integer) sceneIdArr.get(0);
|
|
|
|
+ if (sceneId != 5) {
|
|
|
|
+ if (!Check.isNull(template.getTemplateId())) {
|
|
|
|
+ createUnitJson.put("template_id", template.getTemplateId());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (!Check.isNull(template.getTemplateId())) {
|
|
|
|
+ JSONObject unionJson = getUnionJson(template.getTemplateId());
|
|
|
|
+ if (unionJson.getInteger("code") != 0) {
|
|
|
|
+ updateTemplate.setTaskStatus(3);
|
|
|
|
+ updateTemplate.setReviewDetail(unionJson.getString("message"));
|
|
|
|
+ updateTemplate.setCreativeStatus(3);
|
|
|
|
+ updateTemplate.setCreativeReviewDetail("组创建失败");
|
|
|
|
+ updateById(updateTemplate);
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ createUnitJson.put("target", unionJson.getJSONObject("target"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ createUnitJson.put("campaign_id", template.getCampaignId());
|
|
|
|
+ createUnitJson.put("unit_name", template.getUnitName());
|
|
if (!Check.isNull(template.getBidType())) {
|
|
if (!Check.isNull(template.getBidType())) {
|
|
createUnitJson.put("bid_type", template.getBidType()); // 优化目标类型
|
|
createUnitJson.put("bid_type", template.getBidType()); // 优化目标类型
|
|
}
|
|
}
|
|
@@ -256,7 +295,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
createUnitJson.put("use_app_market", template.getUseAppMarket()); //优先从系统应用商店下载
|
|
createUnitJson.put("use_app_market", template.getUseAppMarket()); //优先从系统应用商店下载
|
|
}
|
|
}
|
|
if (!Check.isNull(template.getAppStore())) {
|
|
if (!Check.isNull(template.getAppStore())) {
|
|
- createUnitJson.put("app_store", template.getAppStore()); //应用商店列表
|
|
|
|
|
|
+ createUnitJson.put("app_store", JSONArray.parseArray(template.getAppStore())); //应用商店列表
|
|
}
|
|
}
|
|
if (!Check.isNull(template.getBid())) {
|
|
if (!Check.isNull(template.getBid())) {
|
|
createUnitJson.put("bid", template.getBid()); //出价
|
|
createUnitJson.put("bid", template.getBid()); //出价
|
|
@@ -273,9 +312,6 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
if (!Check.isNull(template.getDeepConversionBid())) {
|
|
if (!Check.isNull(template.getDeepConversionBid())) {
|
|
createUnitJson.put("deep_conversion_bid", template.getDeepConversionBid()); //深度转化目标出价
|
|
createUnitJson.put("deep_conversion_bid", template.getDeepConversionBid()); //深度转化目标出价
|
|
}
|
|
}
|
|
- if (!Check.isNull(template.getSceneId())) {
|
|
|
|
- createUnitJson.put("scene_id", template.getSceneId()); //资源位置
|
|
|
|
- }
|
|
|
|
if (!Check.isNull(template.getUnitType())) {
|
|
if (!Check.isNull(template.getUnitType())) {
|
|
createUnitJson.put("unit_type", template.getUnitType()); //创意制作方式
|
|
createUnitJson.put("unit_type", template.getUnitType()); //创意制作方式
|
|
}
|
|
}
|
|
@@ -294,8 +330,8 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
if (!Check.isNull(template.getConvertId())) {
|
|
if (!Check.isNull(template.getConvertId())) {
|
|
createUnitJson.put("convert_id", template.getConvertId()); //转化目标ID
|
|
createUnitJson.put("convert_id", template.getConvertId()); //转化目标ID
|
|
}
|
|
}
|
|
- if (!Check.isNull(template.getUnitType())) {
|
|
|
|
- createUnitJson.put("url_type", template.getUnitType()); //url类型
|
|
|
|
|
|
+ if (!Check.isNull(template.getUrlType())) {
|
|
|
|
+ createUnitJson.put("url_type", template.getUrlType()); //url类型
|
|
}
|
|
}
|
|
if (!Check.isNull(template.getUrl())) {
|
|
if (!Check.isNull(template.getUrl())) {
|
|
createUnitJson.put("url", template.getUrl()); // 投放链接
|
|
createUnitJson.put("url", template.getUrl()); // 投放链接
|
|
@@ -315,7 +351,6 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
Integer code = (Integer) groupMap.get("code");
|
|
Integer code = (Integer) groupMap.get("code");
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
updateTemplate.setTaskStatus(2);
|
|
updateTemplate.setTaskStatus(2);
|
|
- updateTemplate.setCreativeReviewDetail("创意待创建");
|
|
|
|
Long unit = (Long) groupMap.get("unitId");
|
|
Long unit = (Long) groupMap.get("unitId");
|
|
updateTemplate.setUnitId((unit));
|
|
updateTemplate.setUnitId((unit));
|
|
Thread thread = new Thread() {
|
|
Thread thread = new Thread() {
|
|
@@ -325,15 +360,15 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
}
|
|
}
|
|
};
|
|
};
|
|
thread.start();
|
|
thread.start();
|
|
-
|
|
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
updateTemplate.setTaskStatus(3);
|
|
updateTemplate.setTaskStatus(3);
|
|
updateTemplate.setReviewDetail((String) groupMap.get("message"));
|
|
updateTemplate.setReviewDetail((String) groupMap.get("message"));
|
|
|
|
+ updateTemplate.setCreativeStatus(3);
|
|
|
|
+ updateTemplate.setCreativeReviewDetail("组创建失败");
|
|
}
|
|
}
|
|
updateById(updateTemplate);
|
|
updateById(updateTemplate);
|
|
try {
|
|
try {
|
|
- Thread.sleep(1 * 1000);
|
|
|
|
|
|
+ Thread.sleep(2 * 1000);
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@@ -343,22 +378,139 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据模板id 获取联盟定向
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private JSONObject getUnionJson(Long templateId) {
|
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
|
+ QueryWrapper<KuaishouTemplateTarget> targetQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ targetQueryWrapper.eq("template_id", templateId);
|
|
|
|
+ targetQueryWrapper.last("limit 1");
|
|
|
|
+ KuaishouTemplateTarget templateTarget = templateTargetService.getOne(targetQueryWrapper);
|
|
|
|
+ if (Check.isNull(templateTarget)) {
|
|
|
|
+ returnJson.put("code", -1);
|
|
|
|
+ returnJson.put("message", "根据模板id未获取到模板详情");
|
|
|
|
+ return returnJson;
|
|
|
|
+ }
|
|
|
|
+ JSONObject target = new JSONObject();
|
|
|
|
+ if (!Check.isNull(templateTarget.getRegion())) {
|
|
|
|
+ target.put("region", JSONArray.parseArray(templateTarget.getRegion()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getMax()) && !Check.isNull(templateTarget.getMin())) {
|
|
|
|
+ JSONObject ageJson = new JSONObject();
|
|
|
|
+ if (!Check.isNull(templateTarget.getMax())) {
|
|
|
|
+ ageJson.put("max", templateTarget.getMax());
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(templateTarget.getMin())) {
|
|
|
|
+ ageJson.put("min", templateTarget.getMin());
|
|
|
|
+ }
|
|
|
|
+ target.put("age", ageJson);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(templateTarget.getAgesRange())) {
|
|
|
|
+ target.put("ages_range", JSONArray.parseArray(templateTarget.getAgesRange()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getGender())) {
|
|
|
|
+ target.put("gender", templateTarget.getGender());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getPlatformOs())) {
|
|
|
|
+ target.put("platform_os", templateTarget.getPlatformOs());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getAndroidOsv())) {
|
|
|
|
+ target.put("android_osv", templateTarget.getAndroidOsv());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getIosOsv())) {
|
|
|
|
+ target.put("ios_osv", templateTarget.getIosOsv());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getNetwork())) {
|
|
|
|
+ target.put("network", templateTarget.getNetwork());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getDeviceBrand())) {
|
|
|
|
+ target.put("device_brand", JSONArray.parseArray(templateTarget.getDeviceBrand()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getDevicePrice())) {
|
|
|
|
+ target.put("device_price", JSONArray.parseArray(templateTarget.getDevicePrice()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getAppInterest())) {
|
|
|
|
+ target.put("app_interest", JSONArray.parseArray(templateTarget.getAppInterest()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getAppIds())) {
|
|
|
|
+ target.put("app_ids", JSONArray.parseArray(templateTarget.getAppIds()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getPopulation())) {
|
|
|
|
+ target.put("population", templateTarget.getPopulation());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getExcludePopulation())) {
|
|
|
|
+ target.put("exclude_population", templateTarget.getExcludePopulation());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(templateTarget.getPaidAudience())) {
|
|
|
|
+ target.put("paid_audience", templateTarget.getPaidAudience());
|
|
|
|
+ }
|
|
|
|
+ returnJson.put("target", target);
|
|
|
|
+ returnJson.put("code", 0);
|
|
|
|
+ return returnJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取当天api创建创意数
|
|
|
|
+ *
|
|
|
|
+ * @param accountId
|
|
|
|
+ * @param date
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public Integer getApiCreateCount(Long accountId, String date) {
|
|
public Integer getApiCreateCount(Long accountId, String date) {
|
|
return groupTemplateMapper.getApiCreateCount(accountId, date);
|
|
return groupTemplateMapper.getApiCreateCount(accountId, date);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据photoId 获取视频、封面链接
|
|
|
|
+ *
|
|
|
|
+ * @param photoId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public JSONObject getUrlByPhotoId(Long photoId) {
|
|
public JSONObject getUrlByPhotoId(Long photoId) {
|
|
return groupTemplateMapper.getUrlByPhotoId(photoId);
|
|
return groupTemplateMapper.getUrlByPhotoId(photoId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private void createCreative(String accessToken, Long unitId, KuaiShouGroupTemplate template) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建创意
|
|
|
|
+ *
|
|
|
|
+ * @param accessToken
|
|
|
|
+ * @param unitId
|
|
|
|
+ * @param template
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void createCreative(String accessToken, Long unitId, KuaiShouGroupTemplate template) {
|
|
|
|
+ KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
|
|
|
|
+ updateTemplate.setId(template.getId());
|
|
|
|
+ updateTemplate.setCreativeStatus(1);
|
|
|
|
+ updateTemplate.setCreativeReviewDetail("创意创建中");
|
|
|
|
+ this.updateById(updateTemplate);
|
|
Long photoId = template.getPhotoId();
|
|
Long photoId = template.getPhotoId();
|
|
JSONObject md5Json = groupTemplateMapper.getMd5ByPhotoId(photoId);
|
|
JSONObject md5Json = groupTemplateMapper.getMd5ByPhotoId(photoId);
|
|
if (Check.isNull(md5Json)) {
|
|
if (Check.isNull(md5Json)) {
|
|
log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
|
|
log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
|
|
|
|
+ updateTemplate.setCreativeStatus(3);
|
|
|
|
+ updateTemplate.setCreativeReviewDetail("未获取到素材信息");
|
|
|
|
+ this.updateById(updateTemplate);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
String md5 = md5Json.getString("md5");
|
|
String md5 = md5Json.getString("md5");
|
|
@@ -375,7 +527,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
createJson.put("creative_category", template.getCreativeCategory());
|
|
createJson.put("creative_category", template.getCreativeCategory());
|
|
}
|
|
}
|
|
if (!Check.isNull(template.getCreativeTag())) {
|
|
if (!Check.isNull(template.getCreativeTag())) {
|
|
- createJson.put("creative_tag", template.getCreativeTag());
|
|
|
|
|
|
+ createJson.put("creative_tag", JSONArray.parseArray(template.getCreativeTag()));
|
|
}
|
|
}
|
|
Integer materialType = md5Json.getInteger("materialType");
|
|
Integer materialType = md5Json.getInteger("materialType");
|
|
JSONArray creatives = new JSONArray();
|
|
JSONArray creatives = new JSONArray();
|
|
@@ -429,17 +581,15 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
|
|
}
|
|
}
|
|
createJson.put("creatives", creatives);
|
|
createJson.put("creatives", creatives);
|
|
Map<String, Object> creativeMap = iKuaishouInterfaceService.batchCreativeCreate(accessToken, template.getAccountId(), createJson, 1, template.getUserId());
|
|
Map<String, Object> creativeMap = iKuaishouInterfaceService.batchCreativeCreate(accessToken, template.getAccountId(), createJson, 1, template.getUserId());
|
|
- KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
|
|
|
|
- updateTemplate.setId(template.getId());
|
|
|
|
Integer code = (Integer) creativeMap.get("code");
|
|
Integer code = (Integer) creativeMap.get("code");
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
|
|
+ updateTemplate.setCreativeStatus(2);
|
|
updateTemplate.setCreativeReviewDetail("创意创建成功");
|
|
updateTemplate.setCreativeReviewDetail("创意创建成功");
|
|
updateTemplate.setCreateCreativeCount((Integer) creativeMap.get("count"));
|
|
updateTemplate.setCreateCreativeCount((Integer) creativeMap.get("count"));
|
|
} else {
|
|
} else {
|
|
- updateTemplate.setCreativeReviewDetail("创意创建失败:" + creativeMap.get("message"));
|
|
|
|
|
|
+ updateTemplate.setCreativeStatus(3);
|
|
|
|
+ updateTemplate.setCreativeReviewDetail((String) creativeMap.get("message"));
|
|
}
|
|
}
|
|
this.updateById(updateTemplate);
|
|
this.updateById(updateTemplate);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|