Browse Source

修改报错

yumeng 5 years ago
parent
commit
d08002107a

+ 29 - 21
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -518,7 +518,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             MaterialInfo info = new MaterialInfo();
             MaterialInfo info = new MaterialInfo();
             Long projectId = json.getLong("projectId");
             Long projectId = json.getLong("projectId");
             String code = json.getString("code");
             String code = json.getString("code");
-            info.setId(code +"_" +  projectId);
+            info.setId(code + "_" + projectId);
             info.setCode(code);
             info.setCode(code);
             if (!Check.isNull(json.getString("watermarkUrl"))) {
             if (!Check.isNull(json.getString("watermarkUrl"))) {
                 info.setWatermarkUrl(json.getString("watermarkUrl"));
                 info.setWatermarkUrl(json.getString("watermarkUrl"));
@@ -589,13 +589,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
             }
             materialTagInfoService.deleteByCode(code);
             materialTagInfoService.deleteByCode(code);
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
-            insertTagList(code,userId,modalityTagList);
+            insertTagList(code, userId, modalityTagList);
             JSONArray contentTagList = json.getJSONArray("contentTagList");
             JSONArray contentTagList = json.getJSONArray("contentTagList");
-            insertTagList(code,userId,contentTagList);
+            insertTagList(code, userId, contentTagList);
             JSONArray senceTagList = json.getJSONArray("senceTagList");
             JSONArray senceTagList = json.getJSONArray("senceTagList");
-            insertTagList(code,userId,senceTagList);
+            insertTagList(code, userId, senceTagList);
             JSONArray modTagList = json.getJSONArray("modTagList");
             JSONArray modTagList = json.getJSONArray("modTagList");
-            insertTagList(code,userId,modTagList);
+            insertTagList(code, userId, modTagList);
             getFile(info, project.getMediaId());
             getFile(info, project.getMediaId());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
         } catch (Exception e) {
@@ -605,17 +605,25 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return resultMap;
         return resultMap;
     }
     }
 
 
-    private void insertTagList(String code,String userId,JSONArray tagList){
-        if(null!=tagList&&!tagList.isEmpty()){
-            for(int m=0;m<tagList.size();m++){
-                Long tagId = tagList.getLong(m);
-                TagInfo tagInfo = tagInfoService.getById(tagId);
-                MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,userId);
-                setTag.setCategoryId(tagInfo.getTagCategoryId());
-                materialTagInfoService.save(setTag);
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        try {
+
+            if (null != tagList && !tagList.isEmpty()) {
+                for (int m = 0; m < tagList.size(); m++) {
+                    Long tagId = tagList.getLong(m);
+                    TagInfo tagInfo = tagInfoService.getById(tagId);
+                    MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, userId);
+                    setTag.setCategoryId(tagInfo.getTagCategoryId());
+                    materialTagInfoService.save(setTag);
+                }
             }
             }
+        } catch (Exception e) {
+            e.printStackTrace();
+
         }
         }
+
     }
     }
+
     @Autowired
     @Autowired
     private ITagInfoService tagInfoService;
     private ITagInfoService tagInfoService;
     @Autowired
     @Autowired
@@ -676,14 +684,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
     }
 
 
     @Override
     @Override
-    public Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
-        Map<String,Object> result = new HashMap<>();
-        PageHelper.startPage(pageNo,pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate, userId);
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+        Map<String, Object> result = new HashMap<>();
+        PageHelper.startPage(pageNo, pageSize);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId);
         List<MaterialInfo> setList = new ArrayList<>();
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
-        if(null!=dailyList&&!dailyList.isEmpty()){
-            for(MaterialInfo info:dailyList){
+        if (null != dailyList && !dailyList.isEmpty()) {
+            for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 //判断是否已经同步到快手平台
                 //判断是否已经同步到快手平台
                 Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
                 Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
@@ -722,8 +730,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
             }
         }
         }
         pageInfo.setList(setList);
         pageInfo.setList(setList);
-        result.put("data",pageInfo);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        result.put("data", pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
         return result;
     }
     }
 }
 }