|
@@ -4,6 +4,7 @@ import cn.com.ctop.common.utils.Check;
|
|
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;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.modules.ctop.entity.CtopOauthToken;
|
|
import org.jeecg.modules.ctop.entity.CtopOauthToken;
|
|
import org.jeecg.modules.ctop.service.ICtopOauthTokenService;
|
|
import org.jeecg.modules.ctop.service.ICtopOauthTokenService;
|
|
import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignCreate;
|
|
import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignCreate;
|
|
@@ -27,9 +28,9 @@ import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Service
|
|
@Service
|
|
public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
- private static final Logger logger = LoggerFactory.getLogger(KuaiShouCreateServiceImpl.class);
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private KuaiShouCampaignTemplateMapper campaignTemplateMapper;
|
|
private KuaiShouCampaignTemplateMapper campaignTemplateMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -42,6 +43,11 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
private ICtopOauthTokenService oauthTokenService;
|
|
private ICtopOauthTokenService oauthTokenService;
|
|
@Autowired
|
|
@Autowired
|
|
private KuaiShouCampaignCreateMapper campaignCreateMapper;
|
|
private KuaiShouCampaignCreateMapper campaignCreateMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouVideoService videoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouImageService imageService;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> createGroups(KuaiShouGroupCreateLog groupCreateTemplate) {
|
|
public Map<String, Object> createGroups(KuaiShouGroupCreateLog groupCreateTemplate) {
|
|
@@ -64,11 +70,12 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
|
|
|
|
CtopOauthToken ctopOauthToken = oauthTokenService.getOauthTokenByAccountId(String.valueOf(accountId));
|
|
CtopOauthToken ctopOauthToken = oauthTokenService.getOauthTokenByAccountId(String.valueOf(accountId));
|
|
if (Check.isNull(ctopOauthToken)) {
|
|
if (Check.isNull(ctopOauthToken)) {
|
|
- logger.error("未获取到token信息,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("未获取到token信息,accountId:{}", accountId);
|
|
throw new Exception("未获取到token信息");
|
|
throw new Exception("未获取到token信息");
|
|
}
|
|
}
|
|
String accessToken = ctopOauthToken.getAccessToken();
|
|
String accessToken = ctopOauthToken.getAccessToken();
|
|
- Long campaignTemplateId = groupCreateTemplate.getCampaignTemplateId(); // 广告计划模板id
|
|
|
|
|
|
+ // 广告计划模板id
|
|
|
|
+ Long campaignTemplateId = groupCreateTemplate.getCampaignTemplateId();
|
|
if (Check.isNull(campaignTemplateId)) {
|
|
if (Check.isNull(campaignTemplateId)) {
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
@@ -76,9 +83,10 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
return returnMap;
|
|
return returnMap;
|
|
}
|
|
}
|
|
|
|
|
|
- KuaiShouCampaignTemplate kuaiShouCampaignTemplate = campaignTemplateMapper.selectById(campaignTemplateId); // 广告计划信息
|
|
|
|
|
|
+ // 广告计划信息
|
|
|
|
+ KuaiShouCampaignTemplate kuaiShouCampaignTemplate = campaignTemplateMapper.selectById(campaignTemplateId);
|
|
if (Check.isNull(kuaiShouCampaignTemplate)) {
|
|
if (Check.isNull(kuaiShouCampaignTemplate)) {
|
|
- logger.error("查询广告计划为空:模板id:{}", campaignTemplateId);
|
|
|
|
|
|
+ log.error("查询广告计划为空:模板id:{}", campaignTemplateId);
|
|
throw new Exception("根据模板id查询创意模板信息为空");
|
|
throw new Exception("根据模板id查询创意模板信息为空");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -107,17 +115,19 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
groupCreateTemplate.setCampaignId(campaignId);
|
|
groupCreateTemplate.setCampaignId(campaignId);
|
|
|
|
|
|
JSONObject groupJson = new JSONObject();
|
|
JSONObject groupJson = new JSONObject();
|
|
- Integer type = kuaiShouCampaignTemplate.getType();// 计划类型
|
|
|
|
|
|
+ // 计划类型
|
|
|
|
+ Integer type = kuaiShouCampaignTemplate.getType();
|
|
if (type == 3 || type == 4 || type == 5) {
|
|
if (type == 3 || type == 4 || type == 5) {
|
|
if (type == 3) {
|
|
if (type == 3) {
|
|
groupJson.put("url_type", kuaiShouCampaignTemplate.getUrlType());
|
|
groupJson.put("url_type", kuaiShouCampaignTemplate.getUrlType());
|
|
}
|
|
}
|
|
groupJson.put("url", kuaiShouCampaignTemplate.getUrl());
|
|
groupJson.put("url", kuaiShouCampaignTemplate.getUrl());
|
|
}
|
|
}
|
|
- if (type == 2) { // app推广
|
|
|
|
|
|
+ // app推广
|
|
|
|
+ if (type == 2) {
|
|
KuaiShouCreateAppTemplate appTemplate = createAppTemplateMapper.selectById(kuaiShouCampaignTemplate.getAppId());
|
|
KuaiShouCreateAppTemplate appTemplate = createAppTemplateMapper.selectById(kuaiShouCampaignTemplate.getAppId());
|
|
if (Check.isNull(appTemplate)) {
|
|
if (Check.isNull(appTemplate)) {
|
|
- logger.error("快手上传视频未获取到本地app信息,appId:{}", kuaiShouCampaignTemplate.getAppId());
|
|
|
|
|
|
+ log.error("快手上传视频未获取到本地app信息,appId:{}", kuaiShouCampaignTemplate.getAppId());
|
|
throw new Exception("快手上传视频未获取到本地app信息");
|
|
throw new Exception("快手上传视频未获取到本地app信息");
|
|
}
|
|
}
|
|
JSONObject apkJson = new JSONObject();
|
|
JSONObject apkJson = new JSONObject();
|
|
@@ -206,14 +216,14 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
groupJson.put("unit_name", name);
|
|
groupJson.put("unit_name", name);
|
|
Map<String, Object> groupMap = kuaishouInterfaceService.adUnitCreate(accessToken, accountId, groupJson);
|
|
Map<String, Object> groupMap = kuaishouInterfaceService.adUnitCreate(accessToken, accountId, groupJson);
|
|
if ((Integer) groupMap.get("code") != 0) {
|
|
if ((Integer) groupMap.get("code") != 0) {
|
|
- logger.error("创建广告组失败,accountId:{},unitName:{}", accountId, unitName);
|
|
|
|
|
|
+ log.error("创建广告组失败,accountId:{},unitName:{}", accountId, unitName);
|
|
return groupMap;
|
|
return groupMap;
|
|
}
|
|
}
|
|
groupCreateTemplate.setUnitId((Long) groupMap.get("unitId"));
|
|
groupCreateTemplate.setUnitId((Long) groupMap.get("unitId"));
|
|
groupCreateTemplate.setUnitName(name);
|
|
groupCreateTemplate.setUnitName(name);
|
|
int y = groupCreateLogMapper.insert(groupCreateTemplate);
|
|
int y = groupCreateLogMapper.insert(groupCreateTemplate);
|
|
if (y > 0) {
|
|
if (y > 0) {
|
|
- logger.info("创建广告组记录信息入库完成,accountId:{},unitName:{}", accountId, unitName);
|
|
|
|
|
|
+ log.info("创建广告组记录信息入库完成,accountId:{},unitName:{}", accountId, unitName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
returnMap.put("code", 0);
|
|
returnMap.put("code", 0);
|
|
@@ -224,23 +234,16 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("desc", "批量创建广告组失败");
|
|
returnMap.put("desc", "批量创建广告组失败");
|
|
-
|
|
|
|
}
|
|
}
|
|
return returnMap;
|
|
return returnMap;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 批量创建创意
|
|
* 批量创建创意
|
|
*
|
|
*
|
|
* @param requestJson
|
|
* @param requestJson
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Autowired
|
|
|
|
- private IKuaiShouVideoService videoService;
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaiShouImageService imageService;
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> createCreative(JSONObject requestJson) {
|
|
public Map<String, Object> createCreative(JSONObject requestJson) {
|
|
System.err.println("广告类型: " + requestJson.getInteger("positionType"));
|
|
System.err.println("广告类型: " + requestJson.getInteger("positionType"));
|
|
@@ -250,7 +253,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
Map<String, Object> returnMap = new HashMap<>();
|
|
Map<String, Object> returnMap = new HashMap<>();
|
|
try {
|
|
try {
|
|
if (Check.isNull(requestJson)) {
|
|
if (Check.isNull(requestJson)) {
|
|
- logger.error("创建创意入参为空");
|
|
|
|
|
|
+ log.error("创建创意入参为空");
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "入参为空");
|
|
returnMap.put("message", "入参为空");
|
|
@@ -260,7 +263,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
JSONObject createJson = new JSONObject();
|
|
JSONObject createJson = new JSONObject();
|
|
Long accountId = requestJson.getLong("accountId");
|
|
Long accountId = requestJson.getLong("accountId");
|
|
if (Check.isNull(accountId)) {
|
|
if (Check.isNull(accountId)) {
|
|
- logger.error("创建创意广告主id为空,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("创建创意广告主id为空,accountId:{}", accountId);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "请选择快手账号");
|
|
returnMap.put("message", "请选择快手账号");
|
|
@@ -269,13 +272,13 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
|
|
|
|
CtopOauthToken cTopOauthToken = oauthTokenService.getOauthTokenByAccountId(String.valueOf(accountId));
|
|
CtopOauthToken cTopOauthToken = oauthTokenService.getOauthTokenByAccountId(String.valueOf(accountId));
|
|
if (Check.isNull(cTopOauthToken)) {
|
|
if (Check.isNull(cTopOauthToken)) {
|
|
- logger.error("未获取到token信息,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("未获取到token信息,accountId:{}", accountId);
|
|
throw new Exception("未获取到token信息");
|
|
throw new Exception("未获取到token信息");
|
|
}
|
|
}
|
|
String accessToken = cTopOauthToken.getAccessToken();
|
|
String accessToken = cTopOauthToken.getAccessToken();
|
|
Long unitId = requestJson.getLong("unitId");
|
|
Long unitId = requestJson.getLong("unitId");
|
|
if (Check.isNull(unitId)) {
|
|
if (Check.isNull(unitId)) {
|
|
- logger.error("创建创意广告组为空,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("创建创意广告组为空,accountId:{}", accountId);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "请选择广告组");
|
|
returnMap.put("message", "请选择广告组");
|
|
@@ -284,7 +287,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
createJson.put("unit_id", unitId);
|
|
createJson.put("unit_id", unitId);
|
|
|
|
|
|
if (Check.isNull(requestJson.getString("description"))) {
|
|
if (Check.isNull(requestJson.getString("description"))) {
|
|
- logger.error("请填写广告语,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("请填写广告语,accountId:{}", accountId);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "请填写广告语");
|
|
returnMap.put("message", "请填写广告语");
|
|
@@ -295,12 +298,14 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
createJson.put("action_bar_text", requestJson.getString("actionBarText"));
|
|
createJson.put("action_bar_text", requestJson.getString("actionBarText"));
|
|
}
|
|
}
|
|
|
|
|
|
- Integer creativeMaterialType = requestJson.getInteger("creativeMaterialType"); // 1 竖版视频 2 横版视频 3 贴片图片
|
|
|
|
|
|
+ // 1 竖版视频 2 横版视频 3 贴片图片
|
|
|
|
+ Integer creativeMaterialType = requestJson.getInteger("creativeMaterialType");
|
|
createJson.put("creative_material_type", creativeMaterialType);
|
|
createJson.put("creative_material_type", creativeMaterialType);
|
|
createJson.put("description", requestJson.getString("description"));
|
|
createJson.put("description", requestJson.getString("description"));
|
|
String creativeName = requestJson.getString("creativeName");
|
|
String creativeName = requestJson.getString("creativeName");
|
|
Integer sceneId = requestJson.getInteger("sceneId");
|
|
Integer sceneId = requestJson.getInteger("sceneId");
|
|
- if (sceneId == 2) { // 普通 广告
|
|
|
|
|
|
+ // 普通 广告
|
|
|
|
+ if (sceneId == 2) {
|
|
JSONObject localVideoJson = new JSONObject();
|
|
JSONObject localVideoJson = new JSONObject();
|
|
localVideoJson.put("videoType", requestJson.getString("creativeMaterialType"));
|
|
localVideoJson.put("videoType", requestJson.getString("creativeMaterialType"));
|
|
localVideoJson.put("login_id", requestJson.getString("loginId"));
|
|
localVideoJson.put("login_id", requestJson.getString("loginId"));
|
|
@@ -308,9 +313,10 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
localVideoJson.put("description", requestJson.getString("description"));
|
|
localVideoJson.put("description", requestJson.getString("description"));
|
|
localVideoJson.put("positionType", requestJson.getString("positionType"));
|
|
localVideoJson.put("positionType", requestJson.getString("positionType"));
|
|
localVideoJson.put("accountId", requestJson.getString("accountId"));
|
|
localVideoJson.put("accountId", requestJson.getString("accountId"));
|
|
- String videoUrl = videoService.localInsert(localVideoJson); // 校验文件是否在本地有留存记录
|
|
|
|
|
|
+ // 校验文件是否在本地有留存记录
|
|
|
|
+ String videoUrl = videoService.localInsert(localVideoJson);
|
|
if (Check.isNull(videoUrl)) {
|
|
if (Check.isNull(videoUrl)) {
|
|
- logger.error("创建创意视频为空,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("创建创意视频为空,accountId:{}", accountId);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "请选择上传的视频");
|
|
returnMap.put("message", "请选择上传的视频");
|
|
@@ -318,14 +324,14 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
}
|
|
}
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
long startTime = System.currentTimeMillis();
|
|
- logger.info("开始上传视频");
|
|
|
|
|
|
+ log.info("开始上传视频");
|
|
Map<String, Object> videoMap = kuaishouInterfaceService.videoUpload(accountId, accessToken, videoUrl); // 上传视频到快手后台
|
|
Map<String, Object> videoMap = kuaishouInterfaceService.videoUpload(accountId, accessToken, videoUrl); // 上传视频到快手后台
|
|
if ((Integer) videoMap.get("code") != 0) {
|
|
if ((Integer) videoMap.get("code") != 0) {
|
|
- logger.error("上传视频失败,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("上传视频失败,accountId:{}", accountId);
|
|
return videoMap;
|
|
return videoMap;
|
|
}
|
|
}
|
|
createJson.put("photo_id", videoMap.get("photoId"));
|
|
createJson.put("photo_id", videoMap.get("photoId"));
|
|
- logger.info("上传信息流广告视频完成,共耗时:{} ms", System.currentTimeMillis() - startTime);
|
|
|
|
|
|
+ log.info("上传信息流广告视频完成,共耗时:{} ms", System.currentTimeMillis() - startTime);
|
|
|
|
|
|
|
|
|
|
if (!Check.isNull(requestJson.getString("clickTrackUrl"))) {
|
|
if (!Check.isNull(requestJson.getString("clickTrackUrl"))) {
|
|
@@ -334,7 +340,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
|
|
|
|
JSONArray imageUrlArr = requestJson.getJSONArray("imageUrl");
|
|
JSONArray imageUrlArr = requestJson.getJSONArray("imageUrl");
|
|
if (Check.isNull(imageUrlArr)) {
|
|
if (Check.isNull(imageUrlArr)) {
|
|
- logger.error("请选择封面图,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("请选择封面图,accountId:{}", accountId);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "请选择广告创意封面图");
|
|
returnMap.put("message", "请选择广告创意封面图");
|
|
@@ -367,7 +373,8 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- } else if (sceneId == 3) { // 后贴片 广告
|
|
|
|
|
|
+ } else if (sceneId == 3) {
|
|
|
|
+ // 后贴片 广告
|
|
if (!Check.isNull(requestJson.getString("impressionUrl"))) {
|
|
if (!Check.isNull(requestJson.getString("impressionUrl"))) {
|
|
createJson.put("impression_url", requestJson.getString("impressionUrl"));
|
|
createJson.put("impression_url", requestJson.getString("impressionUrl"));
|
|
}
|
|
}
|
|
@@ -375,7 +382,8 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
if (!Check.isNull(requestJson.getString("adPhotoPlayedT3sUrl"))) {
|
|
if (!Check.isNull(requestJson.getString("adPhotoPlayedT3sUrl"))) {
|
|
createJson.put("ad_photo_played_t3s_url", requestJson.getString("adPhotoPlayedT3sUrl"));
|
|
createJson.put("ad_photo_played_t3s_url", requestJson.getString("adPhotoPlayedT3sUrl"));
|
|
}
|
|
}
|
|
- if (creativeMaterialType != 3) { // 后贴片 视频集合
|
|
|
|
|
|
+ if (creativeMaterialType != 3) {
|
|
|
|
+ // 后贴片 视频集合
|
|
JSONArray haveSinglePicVideoUrlArr = requestJson.getJSONArray("haveSinglePicVideoUrl");
|
|
JSONArray haveSinglePicVideoUrlArr = requestJson.getJSONArray("haveSinglePicVideoUrl");
|
|
if (Check.isNull(haveSinglePicVideoUrlArr)) {
|
|
if (Check.isNull(haveSinglePicVideoUrlArr)) {
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
@@ -398,7 +406,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
haveLocalVideoJson.put("videoType", requestJson.getString("creativeMaterialType"));
|
|
haveLocalVideoJson.put("videoType", requestJson.getString("creativeMaterialType"));
|
|
String havaVideoUrl = videoService.localInsert(haveLocalVideoJson); // 校验文件是否在本地有留存记录
|
|
String havaVideoUrl = videoService.localInsert(haveLocalVideoJson); // 校验文件是否在本地有留存记录
|
|
if (Check.isNull(havaVideoUrl)) {
|
|
if (Check.isNull(havaVideoUrl)) {
|
|
- logger.error("创建创意视频为空,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("创建创意视频为空,accountId:{}", accountId);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
returnMap.put("message", "请选择上传的视频");
|
|
returnMap.put("message", "请选择上传的视频");
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
@@ -406,24 +414,23 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
}
|
|
}
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
long startTime = System.currentTimeMillis();
|
|
- logger.info("开始上传视频");
|
|
|
|
|
|
+ log.info("开始上传视频");
|
|
Map<String, Object> videoMap = kuaishouInterfaceService.videoUpload(accountId, accessToken, havaVideoUrl); // 上传视频到快手后台
|
|
Map<String, Object> videoMap = kuaishouInterfaceService.videoUpload(accountId, accessToken, havaVideoUrl); // 上传视频到快手后台
|
|
if ((Integer) videoMap.get("code") != 0) {
|
|
if ((Integer) videoMap.get("code") != 0) {
|
|
- logger.error("后贴片素材上传视频失败,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("后贴片素材上传视频失败,accountId:{}", accountId);
|
|
return videoMap;
|
|
return videoMap;
|
|
}
|
|
}
|
|
- logger.info("上传贴片视频完成,共耗时:{} ms", System.currentTimeMillis() - startTime);
|
|
|
|
|
|
+ log.info("上传贴片视频完成,共耗时:{} ms", System.currentTimeMillis() - startTime);
|
|
createJson.put("photo_id", videoMap.get("photoId"));
|
|
createJson.put("photo_id", videoMap.get("photoId"));
|
|
createJson.put("creative_name", creativeName + "_" + i);
|
|
createJson.put("creative_name", creativeName + "_" + i);
|
|
Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
|
|
Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
|
|
if ((Integer) creativeMap.get("code") != 0) {
|
|
if ((Integer) creativeMap.get("code") != 0) {
|
|
- logger.error("后贴片视频素材批量创建创意失败,accountId:{},creativeName:{}", accountId, creativeName + "_" + i);
|
|
|
|
|
|
+ log.error("后贴片视频素材批量创建创意失败,accountId:{},creativeName:{}", accountId, creativeName + "_" + i);
|
|
return creativeMap;
|
|
return creativeMap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- } else { // 后贴片图片素材
|
|
|
|
|
|
+ } else {
|
|
|
|
+ // 后贴片图片素材
|
|
JSONArray haveSinglePicimagesListArr = requestJson.getJSONArray("haveSinglePicimagesList");
|
|
JSONArray haveSinglePicimagesListArr = requestJson.getJSONArray("haveSinglePicimagesList");
|
|
if (Check.isNull(haveSinglePicimagesListArr)) {
|
|
if (Check.isNull(haveSinglePicimagesListArr)) {
|
|
returnMap.put("code", -1);
|
|
returnMap.put("code", -1);
|
|
@@ -446,7 +453,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
String imagePath = imageService.localInsert(imageJson);
|
|
String imagePath = imageService.localInsert(imageJson);
|
|
Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
|
|
Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
|
|
if ((Integer) imageMap.get("code") != 0) {
|
|
if ((Integer) imageMap.get("code") != 0) {
|
|
- logger.error("上传后贴片单张图片素材失败,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("上传后贴片单张图片素材失败,accountId:{}", accountId);
|
|
return imageMap;
|
|
return imageMap;
|
|
}
|
|
}
|
|
createJson.put("creative_name", creativeName + "_" + i);
|
|
createJson.put("creative_name", creativeName + "_" + i);
|
|
@@ -455,13 +462,12 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
createJson.put("image_tokens", imageTokens);
|
|
createJson.put("image_tokens", imageTokens);
|
|
Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
|
|
Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
|
|
if ((Integer) creativeMap.get("code") != 0) {
|
|
if ((Integer) creativeMap.get("code") != 0) {
|
|
- logger.error("后贴片素材单张图片批量创建创意失败,accountId:{}", accountId);
|
|
|
|
|
|
+ log.error("后贴片素材单张图片批量创建创意失败,accountId:{}", accountId);
|
|
return creativeMap;
|
|
return creativeMap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
returnMap.put("code", 0);
|
|
returnMap.put("code", 0);
|
|
returnMap.put("success", true);
|
|
returnMap.put("success", true);
|
|
returnMap.put("message", "创建创意成功");
|
|
returnMap.put("message", "创建创意成功");
|
|
@@ -470,7 +476,6 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
returnMap.put("success", false);
|
|
returnMap.put("success", false);
|
|
returnMap.put("message", "批量创建广告创意失败");
|
|
returnMap.put("message", "批量创建广告创意失败");
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
-
|
|
|
|
}
|
|
}
|
|
return returnMap;
|
|
return returnMap;
|
|
}
|
|
}
|
|
@@ -505,7 +510,6 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
optionsJson.put("isLeaf", false);
|
|
optionsJson.put("isLeaf", false);
|
|
result.add(optionsJson);
|
|
result.add(optionsJson);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -534,7 +538,6 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
|
|
optionsJson.put("label", groupCreateLog.getUnitName());
|
|
optionsJson.put("label", groupCreateLog.getUnitName());
|
|
result.add(optionsJson);
|
|
result.add(optionsJson);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|