浏览代码

解析slogan时,判断返回的数据是否为空

huangxuechao 4 年之前
父节点
当前提交
b282e24a26

+ 2 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -14,6 +14,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -29,7 +30,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
 @ApiModel(value = "ctop_material_info对象", description = "素材信息")
 @ApiModel(value = "ctop_material_info对象", description = "素材信息")
-public class MaterialInfo {
+public class MaterialInfo implements Serializable {
 
 
     /**
     /**
      * id
      * id

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java

@@ -28,7 +28,7 @@ public class BytedanceVideoSlogenInfoServiceImpl extends ServiceImpl<BytedanceVi
         for(int i=0;i<slogans.size();i++){
         for(int i=0;i<slogans.size();i++){
             JSONObject sloganObject = slogans.getJSONObject(i);
             JSONObject sloganObject = slogans.getJSONObject(i);
             String title = sloganObject.getString("title");
             String title = sloganObject.getString("title");
-            String creativeWordIds = sloganObject.getJSONArray("creative_word_ids").toJSONString();
+            String creativeWordIds = Check.isNull(sloganObject.getJSONArray("creative_word_ids")) ? "" : sloganObject.getJSONArray("creative_word_ids").toJSONString();
             BytedanceVideoSlogenInfo slogenInfo = new BytedanceVideoSlogenInfo(videoCode,title,userId,creativeWordIds);
             BytedanceVideoSlogenInfo slogenInfo = new BytedanceVideoSlogenInfo(videoCode,title,userId,creativeWordIds);
             this.save(slogenInfo);
             this.save(slogenInfo);
         }
         }