|
@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.math.BigInteger;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -282,4 +283,49 @@ public class ExamStudentApi {
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "按学习中心统计完成数量", notes = "按学习中心统计完成数量")
|
|
|
+ @GetMapping("/count-by-campus")
|
|
|
+ public List<Map<String, Object>> countByCampus(@RequestParam Long examId) {
|
|
|
+
|
|
|
+ List<Object[]> resultList = examStudentRepo.countByCampusAndFinished(examId);
|
|
|
+ List<Map<String, Object>> returnList = new ArrayList<>();
|
|
|
+ for (Object[] objects : resultList) {
|
|
|
+ Long orgId = ((BigInteger) objects[0]).longValue();
|
|
|
+ Boolean finished = (Boolean) objects[1];
|
|
|
+ Integer count = (Integer) objects[2];
|
|
|
+
|
|
|
+
|
|
|
+ boolean found = false;
|
|
|
+ for (Map<String, Object> m : returnList) {
|
|
|
+ if (m.get("orgId").equals(orgId)) {
|
|
|
+ found = true;
|
|
|
+
|
|
|
+ if (finished) {
|
|
|
+ m.put("finished", count);
|
|
|
+ } else {
|
|
|
+ m.put("unFinished", count);
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!found) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ map.put("orgId", orgId);
|
|
|
+ if (finished) {
|
|
|
+ map.put("finished", count);
|
|
|
+ } else {
|
|
|
+ map.put("unFinished", count);
|
|
|
+ }
|
|
|
+
|
|
|
+ returnList.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return returnList;
|
|
|
+
|
|
|
+ }
|
|
|
}
|