|
@@ -454,6 +454,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
headers.put("Content-Type", " application/json");
|
|
|
String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
+ log.info("快手创建广告组返回,accountId:{},返回结果:{}", advertiserId, resultJson);
|
|
|
if (!Check.isNull(resultJson)) {
|
|
|
Integer code = resultJson.getInteger("code");
|
|
|
if (code == 0) {
|
|
@@ -467,14 +468,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- log.error("创建广告信息失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
|
|
|
+ log.error("创建广告信息失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
|
|
|
returnMap.put("code", -1);
|
|
|
returnMap.put("message", resultJson.getString("message"));
|
|
|
returnMap.put("desc", "创建广告组失败");
|
|
|
returnMap.put("success", false);
|
|
|
}
|
|
|
} else {
|
|
|
- log.error("快手创建广告计划返回内容为空,advertiser_id:{}", advertiserId);
|
|
|
+ log.error("快手创建广告计划返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
|
|
|
returnMap.put("code", -1);
|
|
|
returnMap.put("message", "创建广告组异常");
|
|
|
returnMap.put("desc", "result is null");
|
|
@@ -945,7 +946,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
|
|
|
String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), header);
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
- log.info("快手创建创意返回信息:{}", resultJson);
|
|
|
+ log.info("快手创建创意返回:accountId:{},返回结果{}", advertiserId, resultJson);
|
|
|
if (!Check.isNull(resultJson)) {
|
|
|
Integer code = resultJson.getInteger("code");
|
|
|
if (code == 0) {
|
|
@@ -970,14 +971,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
returnMap.put("success", true);
|
|
|
}
|
|
|
} else {
|
|
|
- log.error("创建广告创意失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
|
|
|
+ log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson);
|
|
|
returnMap.put("code", -1);
|
|
|
returnMap.put("message", resultJson.getString("message"));
|
|
|
returnMap.put("desc", "上传图片失败");
|
|
|
returnMap.put("success", false);
|
|
|
}
|
|
|
} else {
|
|
|
- log.error("快手创建广告创意返回内容为空,advertiser_id:{}", advertiserId);
|
|
|
+ log.error("快手创建广告创意返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);
|
|
|
returnMap.put("code", -1);
|
|
|
returnMap.put("message", "上传图片异常");
|
|
|
returnMap.put("desc", "result is null");
|
|
@@ -998,7 +999,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> videoUpload(Long advertiserId, String accessToken, String videoUrl) {
|
|
|
- log.info("开始上传视频");
|
|
|
Map<String, Object> returnMap = new HashMap<>();
|
|
|
try {
|
|
|
QueryWrapper<KuaiShouVideoUpload> wrapper = new QueryWrapper<>();
|
|
@@ -1017,6 +1017,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
log.error("下载文件到本地文件夹失败,filePath:{},accountId:{}", videoUrl, advertiserId);
|
|
|
throw new Exception("下载文件到本地失败");
|
|
|
}
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
|
|
|
JSONObject requestJson = new JSONObject();
|
|
|
requestJson.put("advertiser_id", advertiserId);
|
|
@@ -1049,7 +1050,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
queryWrapper.eq("local_url", videoUrl);
|
|
|
int y = kuaiShouVideoMapper.update(video, queryWrapper);
|
|
|
if (y > 0) {
|
|
|
- log.info("更新快手视频状态成功.accountId:{}", advertiserId);
|
|
|
+ log.info("更新快手视频状态成功.accountId:{},上传耗时:{} ms", advertiserId, System.currentTimeMillis() - startTime);
|
|
|
}
|
|
|
|
|
|
returnMap.put("code", 0);
|
|
@@ -1245,7 +1246,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, Object> imageUpload(Long advertiserId, String accessToken, String filePath, Integer type) {
|
|
|
- log.info("上传快手图片");
|
|
|
Map<String, Object> returnMap = new HashMap<>();
|
|
|
try {
|
|
|
QueryWrapper<KuaiShouImageUploand> queryWrapper = new QueryWrapper<>();
|
|
@@ -1264,6 +1264,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
log.error("下载文件到本地文件夹失败,filePath:{},accountId:{}", filePath, advertiserId);
|
|
|
throw new Exception("下载文件到本地失败");
|
|
|
}
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
|
|
|
JSONObject requestJson = new JSONObject();
|
|
|
requestJson.put("advertiser_id", advertiserId);
|
|
@@ -1290,7 +1291,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
imageUploand.setWidth(dataJson.getLong("width"));
|
|
|
int i = imageUploandMapper.insert(imageUploand);
|
|
|
if (i > 0) {
|
|
|
- log.info("快手-图片上传成功");
|
|
|
+ log.info("快手-图片上传成功,共耗时:{} ms", System.currentTimeMillis() - startTime);
|
|
|
}
|
|
|
returnMap.put("code", 0);
|
|
|
returnMap.put("desc", "上传图片完成");
|
|
@@ -1364,6 +1365,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
Map<String, String> header = new HashMap<String, String>();
|
|
|
header.put("Content-Type", "multipart/form-data");
|
|
|
header.put("Access-Token", accessToken);
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
String result = exceptInfoForRestTemplate(url, requestJson, header, localUrl);
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
if (!Check.isNull(result)) {
|
|
@@ -1385,7 +1387,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
appCreate.setUploadTime(new Date().toString());
|
|
|
int i = appCreateMapper.insert(appCreate);
|
|
|
if (i > 0) {
|
|
|
- log.info("快手创建应用成功");
|
|
|
+ log.info("快手创建应用成功,共耗时:{} ms", System.currentTimeMillis() - startTime);
|
|
|
}
|
|
|
returnMap.put("appId", dataJson.getLong("app_id"));
|
|
|
returnMap.put("success", true);
|
|
@@ -1672,7 +1674,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
}
|
|
|
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(param, headers);
|
|
|
ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
|
|
|
- System.err.println(responseEntity.getBody());
|
|
|
return responseEntity.getBody();
|
|
|
}
|
|
|
} catch (Exception e) {
|