@ApiOperation(“导出知识库文件”)
@RequestMapping(“exportFileKnowledgeBase”)
@ResponseBody
public String exportFileKnowledgeBase(@RequestParam Map<String, Object> mapS,HttpServletRequest request,HttpServletResponse response) throws Exception {
LOGGER.info(“class:ServiceController method:exportFileKnowledgeBase”);
List<Map<String,Object>> list = new ArrayList<>();
List<Map<String,Object>> exportList = customerService.exportFileKnowledgeBase(StringTools.obj2NotNullString(mapS.get(“merchantId”)),StringTools.obj2NotNullString(mapS.get(“title”)) ,StringTools.obj2NotNullString(mapS.get(“type”)) ,StringTools.obj2NotNullString(mapS.get(“status”)), StringTools.obj2NotNullString(mapS.get(“popular”)),StringTools.obj2NotNullString(mapS.get(“startDate”)) , StringTools.obj2NotNullString(mapS.get(“endDate”)), StringTools.obj2NotNullString(mapS.get(“tableOrder”)), StringTools.obj2NotNullString(mapS.get(“tableAsc”)) );
HashMap mapDemo = new HashMap();
for (int i = 0; i < exportList.size(); i++) {
//克隆效率比NEW高
Map map = (Map)mapDemo.clone();
map.put(“问题”,StringTools.obj2NotNullString(exportList.get(i).get(“QUESTION_TITLE”)));
map.put(“类别”,StringTools.obj2NotNullString(exportList.get(i).get(“TYPE_NAME”)));
map.put(“答案”,StringTools.obj2NotNullString(exportList.get(i).get(“CONTEXT”)));
list.add(map);
}
String[] headers = {“问题”, “类别”,“答案”};
ExcelTools ss = new ExcelTools();
ss.excel(headers, list, response);
return null;
}
导出乱码解决
最新推荐文章于 2022-04-25 19:13:16 发布
立即提交 org.apache.poi poi-ooxml 3.10-FINAL