|
@@ -1,6 +1,12 @@
|
|
|
package com.jd.cms.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jd.cms.base.Constants;
|
|
|
+import com.jd.cms.mapper.BasicDataMapper;
|
|
|
import com.jd.cms.mapper.FileMapper;
|
|
|
import com.jd.cms.service.FileService;
|
|
|
import com.jd.cms.util.Blank;
|
|
@@ -23,6 +29,8 @@ public class FileServiceImpl implements FileService {
|
|
|
@Resource
|
|
|
private FileMapper fileMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private BasicDataMapper basicDataMapper;
|
|
|
@Override
|
|
|
public Map<String, Object> selectFile(String keywords) {
|
|
|
// 线上文件获取
|
|
@@ -35,7 +43,7 @@ public class FileServiceImpl implements FileService {
|
|
|
// 根据栏目id查询文章id列表
|
|
|
List<Map<String, Object>> temporaryFiles = getArticleList(lsColumnId, keywords);
|
|
|
// 轻应用文件获取
|
|
|
- List<Map<String, Object>> qyyFiles = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> qyyFiles = getQYYFileList();
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("onlineFiles", onlineFiles);
|
|
|
result.put("temporaryFiles", temporaryFiles);
|
|
@@ -43,30 +51,6 @@ public class FileServiceImpl implements FileService {
|
|
|
return SendUtil.send(true, Constants.code200, result);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public Map<String, Object> getFileList() {
|
|
|
-
|
|
|
- // 线上文件获取
|
|
|
- // 获取线上文件栏目id
|
|
|
- String columnId = getColumnIdByName("线上文件");
|
|
|
- List<Map<String, Object>> onlineFiles = getArticleList(columnId, null);
|
|
|
-
|
|
|
- // 临时文件获取
|
|
|
- // 获取临时文件栏目id
|
|
|
- String lsColumnId = getColumnIdByName("临时文件");
|
|
|
- // 根据栏目id查询文章id列表
|
|
|
- List<Map<String, Object>> temporaryFiles = getArticleList(lsColumnId, null);
|
|
|
-
|
|
|
- // 轻应用文件获取
|
|
|
- List<Map<String, Object>> qyyFiles = new ArrayList<>();
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("onlineFiles", onlineFiles);
|
|
|
- result.put("temporaryFiles", temporaryFiles);
|
|
|
- result.put("qyyFiles", qyyFiles);
|
|
|
- return SendUtil.send(true, Constants.code200, result);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 根据栏目id获取所有的文章列表信息
|
|
|
* @param columnId
|
|
@@ -87,6 +71,31 @@ public class FileServiceImpl implements FileService {
|
|
|
return files;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据栏目id获取所有的文章列表信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> getQYYFileList() {
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("current", 1);
|
|
|
+ param.put("size", 10000);
|
|
|
+ String url = basicDataMapper.getValueByType("QYY_FILEURL");
|
|
|
+ String body = HttpRequest.get(url).form(param).execute().body();
|
|
|
+ JSONArray records = new JSONArray();
|
|
|
+ if (StrUtil.isNotBlank(body)) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(body);
|
|
|
+ JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+ if (Blank.isNotEmpty(data)) {
|
|
|
+ records = data.getJSONArray("records");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+ for (Object record : records) {
|
|
|
+ result.add((Map<String, Object>) record);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -99,5 +108,4 @@ public class FileServiceImpl implements FileService {
|
|
|
return columnId;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|