|
|
@@ -8,6 +8,7 @@ import com.izouma.wenlvju.domain.Organization;
|
|
|
import com.izouma.wenlvju.domain.Record;
|
|
|
import com.izouma.wenlvju.domain.RecordSpecialty;
|
|
|
import com.izouma.wenlvju.domain.regulation.Complain;
|
|
|
+import com.izouma.wenlvju.domain.regulation.NumOfReport;
|
|
|
import com.izouma.wenlvju.domain.regulation.Report;
|
|
|
import com.izouma.wenlvju.dto.PageQuery;
|
|
|
import com.izouma.wenlvju.dto.ReportDTO;
|
|
|
@@ -263,20 +264,38 @@ public class ReportService {
|
|
|
/*
|
|
|
总统计图
|
|
|
*/
|
|
|
- public Map<String, Integer> getTotal(List<Record> records, List<Complain> complains) {
|
|
|
- Map<String, Integer> map = new HashMap<>();
|
|
|
+ public List<NumOfReport> getTotal(List<Record> records, List<Complain> complains) {
|
|
|
+ List<NumOfReport> total = new ArrayList<>(3);
|
|
|
//备案条数
|
|
|
- map.put("record", records.size());
|
|
|
+ total.add(NumOfReport.builder()
|
|
|
+ .name("record")
|
|
|
+ .num(records.size())
|
|
|
+ .build());
|
|
|
//报考人数
|
|
|
int examQuantity = records.stream().mapToInt(Record::getExamQuantity).sum();
|
|
|
- map.put("examQuantity", examQuantity);
|
|
|
- //投诉数量
|
|
|
- map.put("complain", complains.size());
|
|
|
- return map;
|
|
|
+ total.add(NumOfReport.builder()
|
|
|
+ .name("examQuantity")
|
|
|
+ .num(examQuantity)
|
|
|
+ .build());
|
|
|
+ //投诉条数
|
|
|
+ total.add(NumOfReport.builder()
|
|
|
+ .name("complain")
|
|
|
+ .num(complains.size())
|
|
|
+ .build());
|
|
|
+
|
|
|
+ return total;
|
|
|
+// Map<String, Integer> map = new HashMap<>();
|
|
|
+// //备案条数
|
|
|
+// map.put("record", records.size());
|
|
|
+// //报考人数
|
|
|
+// map.put("examQuantity", examQuantity);
|
|
|
+// //投诉数量
|
|
|
+// map.put("complain", complains.size());
|
|
|
+// return map;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- 各转报考人数-饼图
|
|
|
+ 各专业考场数量-饼图
|
|
|
*/
|
|
|
public Map<String, Long> getSpecialty(List<RecordSpecialty> recordSpecialties) {
|
|
|
Map<String, Long> specialtyCount = recordSpecialties.stream().filter(rs -> StrUtil.isNotEmpty(rs.getCode()))
|
|
|
@@ -339,7 +358,7 @@ public class ReportService {
|
|
|
List<RecordSpecialty> recordSpecialties = recordSpecialtyRepo.findAllByRecordIdIn(recordIds);
|
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
-// try {
|
|
|
+
|
|
|
//标题
|
|
|
dataMap.put("year", report.getYear());
|
|
|
if (ReportType.QUARTERLY.equals(report.getType())) {
|
|
|
@@ -355,10 +374,11 @@ public class ReportService {
|
|
|
}
|
|
|
|
|
|
//总统计
|
|
|
- Map<String, Integer> total = this.getTotal(records, complains);
|
|
|
- dataMap.put("record", total.get("record"));
|
|
|
- dataMap.put("totalExamQuantity", total.get("examQuantity"));
|
|
|
- dataMap.put("totalComplain", total.get("complain"));
|
|
|
+ List<NumOfReport> total = this.getTotal(records, complains);
|
|
|
+ total.forEach(num -> dataMap.put(num.getName(), num.getNum()));
|
|
|
+// dataMap.put("record", total.get("record"));
|
|
|
+// dataMap.put("totalExamQuantity", total.get("examQuantity"));
|
|
|
+// dataMap.put("totalComplain", total.get("complain"));
|
|
|
|
|
|
//各专业统计
|
|
|
Map<String, Long> specialty = this.getSpecialty(recordSpecialties);
|
|
|
@@ -413,13 +433,11 @@ public class ReportService {
|
|
|
String url = storageService.uploadFromInputStream(is, "word" + "/" + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date())
|
|
|
+ RandomStringUtils.randomAlphabetic(8) + ".docx");
|
|
|
|
|
|
+ report.setTotal(total);
|
|
|
report.setFile(url);
|
|
|
report.setTime(String.valueOf(date.get("time")));
|
|
|
report.setTitle("南京市社会艺术水平考级监管报告");
|
|
|
reportRepo.save(report);
|
|
|
-// } catch (Exception e) {
|
|
|
-// log.error("生成word错误", e);
|
|
|
-// throw new BusinessException(e.getMessage());
|
|
|
-// }
|
|
|
+
|
|
|
}
|
|
|
}
|