Przeglądaj źródła

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

huangxuechao 4 lat temu
rodzic
commit
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 org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -29,7 +30,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value = "ctop_material_info对象", description = "素材信息")
-public class MaterialInfo {
+public class MaterialInfo implements Serializable {
 
     /**
      * 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++){
             JSONObject sloganObject = slogans.getJSONObject(i);
             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);
             this.save(slogenInfo);
         }