Commit a06e9b89 authored by 高建强's avatar 高建强

item:知识库导入迁移

parent aaccb931
package com.yeejoin.amos.knowledgebase.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -212,18 +214,31 @@ public class DocLibraryResource {
docLibraryService.export(id, type, response);
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "导入excel文档")
// @RequestMapping(value = "/import", method = RequestMethod.POST)
// public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file,
// @RequestPart(value = "module") String moduleStr) {
// ExcelImportConfig excelConfig;
// try {
// excelConfig = JSON.parseObject(moduleStr, ExcelImportConfig.class);
// } catch (Exception e) {
// throw new BadRequest("模板配置信息格式有误");
// }
// return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfig));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入excel文档")
@RequestMapping(value = "/import", method = RequestMethod.POST)
public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file,
@RequestPart(value = "module") String moduleStr) {
ExcelImportConfig excelConfig;
public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file, @RequestPart(value = "module") String moduleStr) {
List<ExcelImportConfig> excelConfigList;
try {
excelConfig = JSON.parseObject(moduleStr, ExcelImportConfig.class);
excelConfigList = JSONArray.parseArray(moduleStr, ExcelImportConfig.class);
} catch (Exception e) {
throw new BadRequest("模板配置信息格式有误");
}
return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfig));
return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfigList));
}
}
package com.yeejoin.amos.knowledgebase.face.service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -257,4 +250,13 @@ public class DocCategoryService extends BaseService<KnowledgeDocCategoryModel, K
List<KnowledgeDocCategoryModel> categoryModelList = this.queryForList(null, true, categoryName, parentId);
return categoryModelList.isEmpty() ? null : categoryModelList.get(0);
}
public Map<String, Long> getGroupNameValue(List<Long> ids) {
List<KnowledgeDocCategoryModel> list = this.queryBatchSeq(ids);
Map<String, Long> result = new HashMap<>();
for(KnowledgeDocCategoryModel knowledgeDocCategoryModel: list) {
result.put(knowledgeDocCategoryModel.getCategoryName(), knowledgeDocCategoryModel.getSequenceNbr());
}
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment