|
@@ -2,6 +2,7 @@ package cn.com.ctop.manage.modules.material.service.impl;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.MaterialInfo;
|
|
import cn.com.ctop.common.module.entity.MaterialInfo;
|
|
|
|
+import cn.com.ctop.common.module.enums.MaterialEnum;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
|
|
import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
|
|
import cn.com.ctop.common.module.service.IFileInfoService;
|
|
import cn.com.ctop.common.module.service.IFileInfoService;
|
|
@@ -9,6 +10,8 @@ import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
import cn.com.ctop.common.module.utils.LoadFileUtil;
|
|
import cn.com.ctop.common.module.utils.LoadFileUtil;
|
|
import cn.com.ctop.common.module.utils.PropertiesUtils;
|
|
import cn.com.ctop.common.module.utils.PropertiesUtils;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
|
|
import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -48,6 +51,8 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
@Autowired
|
|
@Autowired
|
|
private IFileInfoService fileInfoService;
|
|
private IFileInfoService fileInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouImageGetService iKuaiShouImageGetService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -174,7 +179,26 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
if (!Check.isNull(dataJson)) {
|
|
if (!Check.isNull(dataJson)) {
|
|
if ("IMAGE".equals(materialInfo.getType())) {
|
|
if ("IMAGE".equals(materialInfo.getType())) {
|
|
- kuaishouInterfaceService.imageGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("image_token"));
|
|
|
|
|
|
+ // kuaishouInterfaceService.imageGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("image_token"));
|
|
|
|
+ if (!Check.isNull(dataJson)) {
|
|
|
|
+ String signature = dataJson.getString("signature");
|
|
|
|
+ KuaiShouImageGet imageGet = new KuaiShouImageGet();
|
|
|
|
+ imageGet.setId(accountId + signature);
|
|
|
|
+ imageGet.setAccountId(accountId);
|
|
|
|
+ imageGet.setUrl(dataJson.getString("url"));
|
|
|
|
+ imageGet.setWidth(dataJson.getLong("width"));
|
|
|
|
+ imageGet.setHeight(dataJson.getLong("height"));
|
|
|
|
+ imageGet.setSize(dataJson.getLong("size"));
|
|
|
|
+ imageGet.setFormat(dataJson.getString("format"));
|
|
|
|
+ Integer type = MaterialEnum.getTypeBySize(dataJson.getLong("width"), dataJson.getLong("height"));
|
|
|
|
+ if (!Check.isNull(type)) {
|
|
|
|
+ imageGet.setMaterialType(type);
|
|
|
|
+ }
|
|
|
|
+ imageGet.setSignature(signature);
|
|
|
|
+ imageGet.setImageToken(dataJson.getString("image_token"));
|
|
|
|
+ iKuaiShouImageGetService.saveOrUpdate(imageGet);
|
|
|
|
+ }
|
|
|
|
+
|
|
} else if ("VIDEO".equals(materialInfo.getType())) {
|
|
} else if ("VIDEO".equals(materialInfo.getType())) {
|
|
kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
|
|
kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
|
|
}
|
|
}
|