Przeglądaj źródła

人群包功能开发,文件下载失败给相关提示

zhaoxian 4 lat temu
rodzic
commit
b82b605207

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouCrowdPackServiceImpl.java

@@ -13,6 +13,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
 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 com.baomidou.mybatisplus.extension.api.R;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
@@ -79,11 +80,13 @@ public class KuaishouCrowdPackServiceImpl extends ServiceImpl<KuaishouCrowdPackM
     public Result<Object> uploadCrowdPack(Integer type, String orientationName, Long accountId, String url) {
     public Result<Object> uploadCrowdPack(Integer type, String orientationName, Long accountId, String url) {
         StringBuffer path = new StringBuffer();
         StringBuffer path = new StringBuffer();
         path.append(downloadPath).append(DateUtils.getNowDate(DateUtils.WEB_FORMAT)).append("/").append(UUID.randomUUID().toString()).append("/");
         path.append(downloadPath).append(DateUtils.getNowDate(DateUtils.WEB_FORMAT)).append("/").append(UUID.randomUUID().toString()).append("/");
-        log.info("-------下载到服务器地址:{}", path.toString());
         if (!url.contains("http")) {
         if (!url.contains("http")) {
             url = "https:".concat(url);
             url = "https:".concat(url);
         }
         }
         String newFileUrl = LoadFileUtil.downLoadFromUrl(url, path.toString());
         String newFileUrl = LoadFileUtil.downLoadFromUrl(url, path.toString());
+        if (Check.isNull(newFileUrl)) {
+            return Result.error("文件下载失败,路径:" + url);
+        }
         String md5 = null;
         String md5 = null;
         try {
         try {
             md5 = LoadFileUtil.getMD5(newFileUrl);
             md5 = LoadFileUtil.getMD5(newFileUrl);