|
|
@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.FileOutputStream; |
|
|
import java.io.FileOutputStream; |
|
|
import java.nio.file.Files; |
|
|
import java.nio.file.Files; |
|
|
import java.nio.file.Paths; |
|
|
import java.nio.file.Paths; |
|
|
|
|
|
import java.util.Comparator; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
@ -313,8 +314,23 @@ public class ExportServiceImpl implements ExportService { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
// 使用@SuppressWarnings注解抑制警告,因为运行时类型是正确的
|
|
|
// 使用@SuppressWarnings注解抑制警告,因为运行时类型是正确的
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
List<Map> authorList = JSONUtil.toList(authorsJson, Map.class); |
|
|
List<Map> authorList = JSONUtil.toList(authorsJson, Map.class); |
|
|
|
|
|
|
|
|
|
|
|
// 按type值排序:type=0优先,type=2其次,type=1最后
|
|
|
|
|
|
authorList.sort( |
|
|
|
|
|
Comparator.comparing((Map m) -> { |
|
|
|
|
|
Integer type = (Integer) m.get("type"); |
|
|
|
|
|
if (type == null) return 999; // null值放最后
|
|
|
|
|
|
switch (type) { |
|
|
|
|
|
case 0: return 0; // 最高优先级
|
|
|
|
|
|
case 2: return 1; // 中等优先级
|
|
|
|
|
|
case 1: return 2; // 最低优先级
|
|
|
|
|
|
default: return 3; // 其他情况
|
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
StringBuilder result = new StringBuilder(); |
|
|
StringBuilder result = new StringBuilder(); |
|
|
for (int i = 0; i < authorList.size(); i++) { |
|
|
for (int i = 0; i < authorList.size(); i++) { |
|
|
Map<String, Object> author = authorList.get(i); |
|
|
Map<String, Object> author = authorList.get(i); |
|
|
@ -348,7 +364,6 @@ public class ExportServiceImpl implements ExportService { |
|
|
return authorsJson; |
|
|
return authorsJson; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void exportGr(HttpServletResponse response, ExportDto.Query dto) { |
|
|
public void exportGr(HttpServletResponse response, ExportDto.Query dto) { |
|
|
XWPFTemplate template = XWPFTemplate.compile(reportGrTemplate); |
|
|
XWPFTemplate template = XWPFTemplate.compile(reportGrTemplate); |
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|