|
@@ -1013,7 +1013,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
|
|
String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
if (!Check.isNull(resultJson)) {
|
|
if (!Check.isNull(resultJson)) {
|
|
- System.err.println(requestJson);
|
|
|
|
Integer code = resultJson.getInteger("code");
|
|
Integer code = resultJson.getInteger("code");
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
@@ -1026,13 +1025,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
Thread thread = new Thread() {
|
|
Thread thread = new Thread() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
- try {
|
|
|
|
- Thread.sleep(1 * 1000);
|
|
|
|
- } catch (InterruptedException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
getCampaign(accessToken, advertiserId, campaignId);
|
|
getCampaign(accessToken, advertiserId, campaignId);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
};
|
|
};
|
|
@@ -1090,7 +1083,17 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
if (!Check.isNull(dataJson)) {
|
|
if (!Check.isNull(dataJson)) {
|
|
Long unitId = dataJson.getLong("unit_id");
|
|
Long unitId = dataJson.getLong("unit_id");
|
|
- getGroup(accessToken, advertiserId, unitId);
|
|
|
|
|
|
+
|
|
|
|
+ Thread thread = new Thread() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ getGroup(accessToken, advertiserId, unitId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+ thread.start();
|
|
|
|
+
|
|
|
|
+
|
|
returnMap.put("code", 0);
|
|
returnMap.put("code", 0);
|
|
returnMap.put("message", "success");
|
|
returnMap.put("message", "success");
|
|
returnMap.put("unitId", unitId);
|
|
returnMap.put("unitId", unitId);
|
|
@@ -1804,22 +1807,41 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
KuaiShouCreative creative = new KuaiShouCreative();
|
|
KuaiShouCreative creative = new KuaiShouCreative();
|
|
creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
|
|
creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
|
|
creative.setAccountId(advertiserId);
|
|
creative.setAccountId(advertiserId);
|
|
- creative.setStatus(detailJson.getInteger("status"));
|
|
|
|
creative.setCampaignId(detailJson.getLong("campaign_id"));
|
|
creative.setCampaignId(detailJson.getLong("campaign_id"));
|
|
creative.setUnitId(detailJson.getLong("unit_id"));
|
|
creative.setUnitId(detailJson.getLong("unit_id"));
|
|
creative.setCreativeId(detailJson.getLong("creative_id"));
|
|
creative.setCreativeId(detailJson.getLong("creative_id"));
|
|
creative.setCreativeName(detailJson.getString("creative_name"));
|
|
creative.setCreativeName(detailJson.getString("creative_name"));
|
|
|
|
+ creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
|
|
creative.setPhotoId(detailJson.getString("photo_id"));
|
|
creative.setPhotoId(detailJson.getString("photo_id"));
|
|
|
|
+ if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
|
|
|
|
+ creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
|
|
|
|
+ creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
|
|
|
|
+ }
|
|
|
|
+ creative.setStatus(detailJson.getInteger("status"));
|
|
|
|
+ creative.setPutStatus(detailJson.getInteger("put_status"));
|
|
|
|
+ creative.setCreateChannel(detailJson.getInteger("create_channel"));
|
|
creative.setReviewDetail(detailJson.getString("review_detail"));
|
|
creative.setReviewDetail(detailJson.getString("review_detail"));
|
|
creative.setCoverUrl(detailJson.getString("cover_url"));
|
|
creative.setCoverUrl(detailJson.getString("cover_url"));
|
|
- creative.setCoverHeight(detailJson.getString("cover_height"));
|
|
|
|
|
|
+ creative.setImageToken(detailJson.getString("image_token"));
|
|
creative.setCoverWidth(detailJson.getString("cover_width"));
|
|
creative.setCoverWidth(detailJson.getString("cover_width"));
|
|
|
|
+ creative.setCoverHeight(detailJson.getString("cover_height"));
|
|
|
|
+ creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
|
|
|
|
+ creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
|
|
|
|
+ creative.setStickerTitle(detailJson.getString("sticker_title"));
|
|
|
|
+ creative.setOverlayType(detailJson.getString("overlay_type"));
|
|
creative.setClickTrackUrl(detailJson.getString("click_track_url"));
|
|
creative.setClickTrackUrl(detailJson.getString("click_track_url"));
|
|
|
|
+ creative.setImpressionUrl(detailJson.getString("impression_url"));
|
|
|
|
+ creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
|
|
JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
|
|
JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
|
|
if (!Check.isNull(displayInfoJson)) {
|
|
if (!Check.isNull(displayInfoJson)) {
|
|
creative.setDescription(displayInfoJson.getString("description"));
|
|
creative.setDescription(displayInfoJson.getString("description"));
|
|
creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
|
|
creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
|
|
}
|
|
}
|
|
|
|
+ creative.setCreateTime(new Date());
|
|
|
|
+ creative.setUpdateTime(new Date());
|
|
creativeService.saveOrUpdate(creative);
|
|
creativeService.saveOrUpdate(creative);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1839,6 +1861,99 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取 创意信息
|
|
|
|
+ *
|
|
|
|
+ * @param accessToken
|
|
|
|
+ * @param advertiserId
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void getCreativeByCreativeId(String accessToken, Long advertiserId, Date startDate, Date endDate, Integer page, Long creativeId) {
|
|
|
|
+ String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
|
|
|
|
+ Map<String, String> headers = new HashMap<String, String>();
|
|
|
|
+ headers.put("Content-Type", " application/json");
|
|
|
|
+ headers.put("Access-Token", accessToken);
|
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
|
+ param.put("advertiser_id", advertiserId);
|
|
|
|
+ param.put("creative_id", creativeId);
|
|
|
|
+ if (startDate != null && endDate != null) {
|
|
|
|
+ param.put("start_date", DateUtils.formatDate(startDate));
|
|
|
|
+ param.put("end_date", DateUtils.formatDate(endDate));
|
|
|
|
+ }
|
|
|
|
+ param.put("page_size", 200);
|
|
|
|
+ param.put("page", page);
|
|
|
|
+ try {
|
|
|
|
+ String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
|
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
+ if (!Check.isNull(resultJson)) {
|
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ JSONObject dataJson = resultJson.getJSONObject("data");
|
|
|
|
+ if (!Check.isNull(dataJson)) {
|
|
|
|
+ JSONArray details = dataJson.getJSONArray("details");
|
|
|
|
+ if (!Check.isNull(details)) {
|
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
|
+ JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
|
|
|
|
+ if (!Check.isNull(detailJson)) {
|
|
|
|
+ KuaiShouCreative creative = new KuaiShouCreative();
|
|
|
|
+ creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
|
|
|
|
+ creative.setAccountId(advertiserId);
|
|
|
|
+ creative.setCampaignId(detailJson.getLong("campaign_id"));
|
|
|
|
+ creative.setUnitId(detailJson.getLong("unit_id"));
|
|
|
|
+ creative.setCreativeId(detailJson.getLong("creative_id"));
|
|
|
|
+ creative.setCreativeName(detailJson.getString("creative_name"));
|
|
|
|
+ creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
|
|
|
|
+ creative.setPhotoId(detailJson.getString("photo_id"));
|
|
|
|
+ if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
|
|
|
|
+ creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
|
|
|
|
+ creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
|
|
|
|
+ }
|
|
|
|
+ creative.setStatus(detailJson.getInteger("status"));
|
|
|
|
+ creative.setPutStatus(detailJson.getInteger("put_status"));
|
|
|
|
+ creative.setCreateChannel(detailJson.getInteger("create_channel"));
|
|
|
|
+ creative.setReviewDetail(detailJson.getString("review_detail"));
|
|
|
|
+ creative.setCoverUrl(detailJson.getString("cover_url"));
|
|
|
|
+ creative.setImageToken(detailJson.getString("image_token"));
|
|
|
|
+ creative.setCoverWidth(detailJson.getString("cover_width"));
|
|
|
|
+ creative.setCoverHeight(detailJson.getString("cover_height"));
|
|
|
|
+ creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
|
|
|
|
+ creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
|
|
|
|
+ creative.setStickerTitle(detailJson.getString("sticker_title"));
|
|
|
|
+ creative.setOverlayType(detailJson.getString("overlay_type"));
|
|
|
|
+ creative.setClickTrackUrl(detailJson.getString("click_track_url"));
|
|
|
|
+ creative.setImpressionUrl(detailJson.getString("impression_url"));
|
|
|
|
+ creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
|
|
|
|
+ JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
|
|
|
|
+ if (!Check.isNull(displayInfoJson)) {
|
|
|
|
+ creative.setDescription(displayInfoJson.getString("description"));
|
|
|
|
+ creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
|
|
|
|
+ }
|
|
|
|
+ creative.setCreateTime(new Date());
|
|
|
|
+ creative.setUpdateTime(new Date());
|
|
|
|
+ creativeService.saveOrUpdate(creative);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ log.error("获取广告创意组返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ log.error("获取广告创意返回结果异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取token
|
|
* 获取token
|
|
*
|
|
*
|
|
@@ -2005,23 +2120,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
if (!Check.isNull(dataJson)) {
|
|
if (!Check.isNull(dataJson)) {
|
|
- KuaiShouCreativeCreate creativeCreate = new KuaiShouCreativeCreate();
|
|
|
|
- creativeCreate.setCreativeId(dataJson.getLong("creative_id"));
|
|
|
|
- creativeCreate.setAccountId(advertiserId);
|
|
|
|
- creativeCreate.setUnitId(requestJson.getLong("unit_id"));
|
|
|
|
- creativeCreate.setCreativeName(requestJson.getString("creative_name"));
|
|
|
|
- creativeCreate.setPhotoId(requestJson.getString("photo_id"));
|
|
|
|
- creativeCreate.setImageToken(requestJson.getString("image_token"));
|
|
|
|
- creativeCreate.setActionBarText(requestJson.getString("action_bar_text"));
|
|
|
|
- creativeCreate.setDescription(requestJson.getString("description"));
|
|
|
|
- creativeCreate.setClickTrackUrl(requestJson.getString("click_track_url"));
|
|
|
|
- int i = creativeCreateMapper.insert(creativeCreate);
|
|
|
|
- if (i > 0) {
|
|
|
|
- log.info("创建广告创意入库完成,advertiser_id:{}", advertiserId);
|
|
|
|
- }
|
|
|
|
|
|
+ Long creativeId = dataJson.getLong("creative_id");
|
|
|
|
+ Thread thread = new Thread() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ getCreativeByCreativeId(accessToken, advertiserId, null, null, 1, creativeId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+ thread.start();
|
|
returnMap.put("code", 0);
|
|
returnMap.put("code", 0);
|
|
returnMap.put("message", "success");
|
|
returnMap.put("message", "success");
|
|
returnMap.put("success", true);
|
|
returnMap.put("success", true);
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
|
|
log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
|