|
@@ -811,23 +811,61 @@ public class OkcVideoProServiceImpl implements IOkcVideoProService
|
|
|
chartsStatus.getFileName();
|
|
|
String title = chartsStatus.getTitle();
|
|
|
mkdirs(filePath);
|
|
|
- Map<Integer, String> map = new LinkedHashMap<>();
|
|
|
+ List<List<String>> datas = new ArrayList<>();
|
|
|
if (ObjectUtils.isNotEmpty(dataMap) && dataMap.size() <= 50) {
|
|
|
- Map<String, String> in = new LinkedHashMap<>();
|
|
|
- List<String> inList = new ArrayList<>();
|
|
|
- for (Map.Entry<String, String> data: dataMap.entrySet()) {
|
|
|
- inList.add(data.getKey());
|
|
|
- }
|
|
|
- for (int i = 0; i < inList.size() - 1; i++) {
|
|
|
- if (Integer.parseInt(inList.get(i)) + 1 < Integer.parseInt(inList.get(i + 1))) {
|
|
|
- in.put(String.valueOf(Integer.parseInt(inList.get(i + 1)) - 1), dataMap.get(inList.get(i)));
|
|
|
+ try {
|
|
|
+ for (Map.Entry<String, String> data: dataMap.entrySet()) {
|
|
|
+ List<String> in = new ArrayList<>();
|
|
|
+ in.add(data.getKey());
|
|
|
+ in.add(data.getValue());
|
|
|
+ datas.add(in);
|
|
|
+ }
|
|
|
+ List<List<String>> inList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < datas.size() - 1; i++) {
|
|
|
+ if ((Integer.parseInt(datas.get(i).get(0)) + 1 < Integer.parseInt(datas.get(i + 1).get(0)))
|
|
|
+ && !StringUtils.equals(datas.get(i).get(1), datas.get(i + 1).get(1))) {
|
|
|
+ List<String> in = new ArrayList<>();
|
|
|
+ in.add(String.valueOf(Integer.parseInt(datas.get(i + 1).get(0)) - 1));
|
|
|
+ in.add(datas.get(i).get(1));
|
|
|
+ inList.add(in);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ datas.addAll(inList);
|
|
|
+ datas = datas.stream().sorted(Comparator.comparing(c -> Integer.parseInt(c.get(1))))
|
|
|
+ .sorted(Comparator.comparing(c -> Integer.parseInt(c.get(0)))).collect(Collectors.toList());
|
|
|
+ } catch (Exception e) {
|
|
|
+ List<List<String>> newData = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, String> data: dataMap.entrySet()) {
|
|
|
+ List<String> in = new ArrayList<>();
|
|
|
+ in.add(data.getKey());
|
|
|
+ in.add(data.getValue());
|
|
|
+ newData.add(in);
|
|
|
}
|
|
|
+ datas = newData;
|
|
|
+ }
|
|
|
+// datas = dataMap.keySet().stream().collect(Collectors.toList());
|
|
|
+// Map<String, String> in = new LinkedHashMap<>();
|
|
|
+// List<String> inList = new ArrayList<>();
|
|
|
+// for (Map.Entry<String, String> data: dataMap.entrySet()) {
|
|
|
+// inList.add(data.getKey());
|
|
|
+// }
|
|
|
+// for (int i = 0; i < inList.size() - 1; i++) {
|
|
|
+// if (Integer.parseInt(inList.get(i)) + 1 < Integer.parseInt(inList.get(i + 1))) {
|
|
|
+// in.put(String.valueOf(Integer.parseInt(inList.get(i + 1)) - 1), dataMap.get(inList.get(i)));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// dataMap.putAll(in);
|
|
|
+ } else {
|
|
|
+ for (Map.Entry<String, String> data: dataMap.entrySet()) {
|
|
|
+ List<String> in = new ArrayList<>();
|
|
|
+ in.add(data.getKey());
|
|
|
+ in.add(data.getValue());
|
|
|
+ datas.add(in);
|
|
|
}
|
|
|
- dataMap.putAll(in);
|
|
|
}
|
|
|
- map = dataMap.entrySet().stream().collect(Collectors.toMap(e -> Integer.parseInt(e.getKey()), Map.Entry::getValue));
|
|
|
- map = sortByKey(map);
|
|
|
- ChartUtils.createLinePortThreeD(title, map, "学生控制行为", "教师控制行为", filePath, line);
|
|
|
+// map = dataMap.entrySet().stream().collect(Collectors.toMap(e -> Integer.parseInt(e.getKey()), Map.Entry::getValue));
|
|
|
+// map = sortByKey(map);
|
|
|
+ ChartUtils.createLinePortThreeD(title, datas, "学生控制行为", "教师控制行为", filePath, line);
|
|
|
res.put("name", chartsStatus.getFileName());
|
|
|
res.put("path", filePath);
|
|
|
res.put("relativePath", "/profile/" + okcVideoPro.getId() + File.separator + chartsStatus.getFileName());
|