|
@@ -440,7 +440,6 @@ public class DataDownloadController {
|
|
|
String fileName = split[split.length - 1];
|
|
|
fileName = fileName.replace(".xlsx", "");
|
|
|
JSONObject userRecordJson = new JSONObject(true);
|
|
|
- userEntity.setInstitutionName("");
|
|
|
userRecordJson.put("userEntity", userEntity);
|
|
|
userRecordJson.put("userRecordEntity", userRecordEntity);
|
|
|
|
|
@@ -745,14 +744,7 @@ public class DataDownloadController {
|
|
|
if (testResults.contains("version")) {
|
|
|
newInstitutionUserRecordingList.add(institutionUserRecordingList.get(i));
|
|
|
String testResult = new String();
|
|
|
- JSONArray tableModule = JSONObject.parseObject(institutionUserRecordingList.get(i).getTestResult()).getJSONArray("tableModule");
|
|
|
- JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
- String[] colName = columnValues.getString(0).split(";");
|
|
|
- String[] colValue = columnValues.getString(1).split(";");
|
|
|
- for (int y = 0; y < colValue.length; y++) {
|
|
|
- testResult += colName[y] + ":" + colValue[y] + ";";
|
|
|
- }
|
|
|
- /*for (int x = 0; x < splits.length; x++) {
|
|
|
+ for (int x = 0; x < splits.length; x++) {
|
|
|
if (Arrays.toString(splits).contains("columnValue")) {
|
|
|
if (splits[x].contains("columnValue")) {
|
|
|
JSONArray tableModule = JSONObject.parseObject(institutionUserRecordingList.get(i).getTestResult()).getJSONArray("tableModule");
|
|
@@ -780,59 +772,37 @@ public class DataDownloadController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
splits = testResult.split(";");
|
|
|
//标题行抽出字段
|
|
|
- newTitle = new String[splits.length + 9];
|
|
|
- newTitle[0] = "被试ID";
|
|
|
- newTitle[1] = "姓名";
|
|
|
- newTitle[2] = "年龄";
|
|
|
- /* newTitle[3] = "单位名称旅";
|
|
|
- newTitle[4] = "单位名称大队";
|
|
|
- newTitle[5] = "飞行等级";
|
|
|
- newTitle[6] = "现飞机型";
|
|
|
- newTitle[7] = "任务序次";
|
|
|
- newTitle[8] = "测试时间";
|
|
|
- newTitle[9] = "职业";
|
|
|
- newTitle[10] = "军衔";*/
|
|
|
- /*newTitle[0] = "姓名";
|
|
|
+ newTitle = new String[splits.length + 7];
|
|
|
+ newTitle[0] = "姓名";
|
|
|
newTitle[1] = "性别";
|
|
|
newTitle[2] = "职业";
|
|
|
newTitle[3] = "出生日期";
|
|
|
newTitle[4] = "登录名";
|
|
|
newTitle[5] = "测试时间";
|
|
|
- newTitle[6] = "测试名称";*/
|
|
|
+ newTitle[6] = "测试名称";
|
|
|
for (int x = 0; x < splits.length; x++) {
|
|
|
String[] a = splits[x].split(":");
|
|
|
- newTitle[x + 11] = a[0];
|
|
|
+ newTitle[x + 7] = a[0];
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
oldInstitutionUserRecordingList.add(institutionUserRecordingList.get(i));
|
|
|
|
|
|
//标题行抽出字段
|
|
|
- oldTitle = new String[splits.length + 9];
|
|
|
- oldTitle[0] = "被试ID";
|
|
|
- oldTitle[1] = "姓名";
|
|
|
- oldTitle[2] = "年龄";
|
|
|
- /*oldTitle[3] = "单位名称旅";
|
|
|
- oldTitle[4] = "单位名称大队";
|
|
|
- oldTitle[5] = "飞行等级";
|
|
|
- oldTitle[6] = "现飞机型";
|
|
|
- oldTitle[7] = "任务序次";
|
|
|
- oldTitle[8] = "测试时间";
|
|
|
- oldTitle[9] = "职业";
|
|
|
- oldTitle[10] = "军衔";*/
|
|
|
- /*oldTitle[0] = "姓名";
|
|
|
+ oldTitle = new String[splits.length + 7];
|
|
|
+ oldTitle[0] = "姓名";
|
|
|
oldTitle[1] = "性别";
|
|
|
oldTitle[2] = "职业";
|
|
|
oldTitle[3] = "出生日期";
|
|
|
oldTitle[4] = "登录名";
|
|
|
oldTitle[5] = "测试时间";
|
|
|
- oldTitle[6] = "测试名称";*/
|
|
|
+ oldTitle[6] = "测试名称";
|
|
|
for (int y = 0; y < splits.length; y++) {
|
|
|
String[] a = splits[y].split(":");
|
|
|
- oldTitle[y + 11] = a[0];
|
|
|
+ oldTitle[y + 7] = a[0];
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -992,14 +962,7 @@ public class DataDownloadController {
|
|
|
//institutionUserRecordingList.remove(i);
|
|
|
//i--;
|
|
|
String testResult = new String();
|
|
|
- JSONArray tableModule = JSONObject.parseObject(institutionUserRecordingList.get(i).getTestResult()).getJSONArray("tableModule");
|
|
|
- JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
- String[] colName = columnValues.getString(0).split(";");
|
|
|
- String[] colValue = columnValues.getString(1).split(";");
|
|
|
- for (int y = 0; y < colValue.length; y++) {
|
|
|
- testResult += colName[y] + ":" + colValue[y] + ";";
|
|
|
- }
|
|
|
- /*for (int x = 0; x < splits.length; x++) {
|
|
|
+ for (int x = 0; x < splits.length; x++) {
|
|
|
if (Arrays.toString(splits).contains("columnValue")) {
|
|
|
if (splits[x].contains("columnValue")) {
|
|
|
JSONArray tableModule = JSONObject.parseObject(institutionUserRecordingList.get(i).getTestResult()).getJSONArray("tableModule");
|
|
@@ -1028,46 +991,37 @@ public class DataDownloadController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }*/
|
|
|
+ }
|
|
|
splits = testResult.split(";");
|
|
|
//标题行抽出字段
|
|
|
- newTitle = new String[splits.length + 9];
|
|
|
- newTitle[0] = "被试ID";
|
|
|
- newTitle[1] = "姓名";
|
|
|
- newTitle[2] = "年龄";
|
|
|
- /* newTitle[3] = "单位名称旅";
|
|
|
- newTitle[4] = "单位名称大队";
|
|
|
- newTitle[5] = "飞行等级";
|
|
|
- newTitle[6] = "现飞机型";
|
|
|
- newTitle[7] = "任务序次";
|
|
|
- newTitle[8] = "测试时间";
|
|
|
- newTitle[9] = "职业";
|
|
|
- newTitle[10] = "军衔";*/
|
|
|
+ newTitle = new String[splits.length + 7];
|
|
|
+ newTitle[0] = "姓名";
|
|
|
+ newTitle[1] = "性别";
|
|
|
+ newTitle[2] = "职业";
|
|
|
+ newTitle[3] = "出生日期";
|
|
|
+ newTitle[4] = "登录名";
|
|
|
+ newTitle[5] = "测试时间";
|
|
|
+ newTitle[6] = "测试名称";
|
|
|
for (int x = 0; x < splits.length; x++) {
|
|
|
String[] a = splits[x].split(":");
|
|
|
- newTitle[x + 11] = a[0];
|
|
|
+ newTitle[x + 7] = a[0];
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
oldInstitutionUserRecordingList.add(institutionUserRecordingList.get(i));
|
|
|
|
|
|
//标题行抽出字段
|
|
|
- oldTitle = new String[splits.length + 9];
|
|
|
- oldTitle[0] = "被试ID";
|
|
|
- oldTitle[1] = "姓名";
|
|
|
- oldTitle[2] = "年龄";
|
|
|
- /*oldTitle[3] = "单位名称旅";
|
|
|
- oldTitle[4] = "单位名称大队";
|
|
|
- oldTitle[5] = "飞行等级";
|
|
|
- oldTitle[6] = "现飞机型";
|
|
|
- oldTitle[7] = "任务序次";
|
|
|
- oldTitle[8] = "测试时间";
|
|
|
-
|
|
|
- oldTitle[9] = "职业";
|
|
|
- oldTitle[10] = "军衔";*/
|
|
|
+ oldTitle = new String[splits.length + 7];
|
|
|
+ oldTitle[0] = "姓名";
|
|
|
+ oldTitle[1] = "性别";
|
|
|
+ oldTitle[2] = "职业";
|
|
|
+ oldTitle[3] = "出生日期";
|
|
|
+ oldTitle[4] = "登录名";
|
|
|
+ oldTitle[5] = "测试时间";
|
|
|
+ oldTitle[6] = "测试名称";
|
|
|
for (int y = 0; y < splits.length; y++) {
|
|
|
String[] a = splits[y].split(":");
|
|
|
- oldTitle[y + 11] = a[0];
|
|
|
+ oldTitle[y + 7] = a[0];
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -1730,7 +1684,16 @@ public class DataDownloadController {
|
|
|
}
|
|
|
List<Map<String, Object>> mapList = getExcelMapList(userList, institutionNo);
|
|
|
//设置Excel表头
|
|
|
- List<String> titleList = getExcelTitleList(institutionNo);
|
|
|
+ List<String> titleList = new ArrayList<>();
|
|
|
+ mapList.forEach(map -> {
|
|
|
+ Set<String> set = map.keySet();
|
|
|
+ set.forEach(key -> {
|
|
|
+ if (!titleList.contains(key)) {
|
|
|
+ titleList.add(key);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
Workbook wb = insertDataToExcel(titleList, mapList);
|
|
|
|
|
|
//获取配置文件中保存对应excel文件的路径,本地也可以直接写成F:excel/stuInfoExcel路径
|
|
@@ -1799,7 +1762,15 @@ public class DataDownloadController {
|
|
|
}
|
|
|
List<Map<String, Object>> mapList = getExcelMapList(userList, institutionNo);
|
|
|
//设置Excel表头
|
|
|
- List<String> titleList = getExcelTitleList(institutionNo);
|
|
|
+ List<String> titleList = new ArrayList<>();
|
|
|
+ mapList.forEach(map -> {
|
|
|
+ Set<String> set = map.keySet();
|
|
|
+ set.forEach(key -> {
|
|
|
+ if (!titleList.contains(key)) {
|
|
|
+ titleList.add(key);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
Workbook wb = insertDataToExcel(titleList, mapList);
|
|
|
|
|
@@ -1867,7 +1838,7 @@ public class DataDownloadController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- public Workbook insertData(Sheet downSheet, Workbook wb, String[] title, List<InstitutionRecordingUsersDTO> institutionUserRecordingList, String name) {
|
|
|
+ public static Workbook insertData(Sheet downSheet, Workbook wb, String[] title, List<InstitutionRecordingUsersDTO> institutionUserRecordingList, String name) {
|
|
|
//设置单元格宽度自适应,在此基础上把宽度调至1.5倍
|
|
|
for (int i = 0; i < title.length; i++) {
|
|
|
downSheet.autoSizeColumn(i, true);
|
|
@@ -1895,105 +1866,82 @@ public class DataDownloadController {
|
|
|
}
|
|
|
//把从数据库中取得的数据一一写入excel文件中
|
|
|
Row row = null;
|
|
|
- //获取用户属性信息
|
|
|
- List<String> userIdList = institutionUserRecordingList.stream().map(item -> item.getUserId()).collect(Collectors.toList());
|
|
|
- //List<UserAttributeEntity> userAttributeList = userAttributeService.findListByUserIdListAndStatus(userIdList, Constant.TEST_PLAN_STATUS_STOP);
|
|
|
|
|
|
int size = institutionUserRecordingList.size();
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
InstitutionRecordingUsersDTO institutionRecordingUsersDTO = institutionUserRecordingList.get(institutionUserRecordingList.size() - i - 1);
|
|
|
- //UserAttributeEntity userAttribute = userAttributeList.stream().filter(att -> institutionRecordingUsersDTO.getUserId().equals(att.getUserId())).findFirst().orElse(null);
|
|
|
String testResultls = institutionRecordingUsersDTO.getTestResults();
|
|
|
String[] splitl = testResultls.split(";");
|
|
|
if (testResultls.contains("version")) {
|
|
|
String testResultl = new String();
|
|
|
- JSONArray tableModule = JSONObject.parseObject(institutionRecordingUsersDTO.getTestResult()).getJSONArray("tableModule");
|
|
|
- JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
- String[] colName = columnValues.getString(0).split(";");
|
|
|
- String[] colValue = columnValues.getString(1).split(";");
|
|
|
- for (int y = 0; y < colValue.length; y++) {
|
|
|
- testResultl += colName[y] + ":" + colValue[y] + ";";
|
|
|
+ for (int x = 0; x < splitl.length; x++) {
|
|
|
+ if (Arrays.toString(splitl).contains("columnValue")) {
|
|
|
+ if (splitl[x].contains("columnValue")) {
|
|
|
+ JSONArray tableModule = JSONObject.parseObject(institutionRecordingUsersDTO.getTestResult()).getJSONArray("tableModule");
|
|
|
+ JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
+ String[] colName = columnValues.getString(0).split(";");
|
|
|
+ String[] colValue = columnValues.getString(1).split(";");
|
|
|
+ for (int y = 0; y < colName.length; y++) {
|
|
|
+ testResultl += colName[y] + ":" + colValue[y] + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (splitl[x].contains("totalScoreDesc")) {
|
|
|
+ String b = splitl[x];
|
|
|
+ JSONArray totalScores = JSONArray.parseArray(b.replace("totalScore:", ""));
|
|
|
+ JSONObject totalScore = totalScores.getJSONObject(0);
|
|
|
+ testResultl += "总分:" + totalScore.getString("totalScore") + ";总分结论:" + totalScore.getString("totalScoreDesc") + ";";
|
|
|
+ }
|
|
|
+ if (splitl[x].contains("Describe")) {
|
|
|
+ String b = splitl[x];
|
|
|
+ JSONArray dimensions = JSONArray.parseArray(b.replace("dimensions:", ""));
|
|
|
+ for (int y = 0; y < dimensions.size(); y++) {
|
|
|
+ JSONObject dimension = dimensions.getJSONObject(y);
|
|
|
+ testResultl += dimension.getString("name") + ":" + dimension.getString("score") + ";"
|
|
|
+ + dimension.getString("name") + "结论:" + dimension.getString("Describe") + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
splitl = testResultl.split(";");
|
|
|
- }
|
|
|
+ //continue;
|
|
|
+ }/*else {
|
|
|
+ splitl = testResultl.split(";");
|
|
|
+ }*/
|
|
|
//创建list.size()行数据
|
|
|
row = downSheet.createRow(i + 1);
|
|
|
|
|
|
//把值一一写进单元格里
|
|
|
- Cell cell0 = row.createCell(0);
|
|
|
- cell0.setCellValue(institutionRecordingUsersDTO.getPhone());
|
|
|
- cell0.setCellStyle(style);
|
|
|
-
|
|
|
- Cell cell1 = row.createCell(1);
|
|
|
- cell1.setCellValue(institutionRecordingUsersDTO.getPetName());
|
|
|
- cell1.setCellStyle(style);
|
|
|
-
|
|
|
- Cell cell2 = row.createCell(2);
|
|
|
- cell2.setCellValue(institutionRecordingUsersDTO.getAge());
|
|
|
- cell2.setCellStyle(style);
|
|
|
-
|
|
|
- /* String brigade = "";//所在旅
|
|
|
- String detachment = "";//所在大队
|
|
|
- String fightRegistration = "";//飞行等级
|
|
|
- *//* String flightDuration = "";//总飞行时长
|
|
|
- String currentTypeFlightDuration = "";//现机型飞行时长
|
|
|
- String flyingModels = "";//飞过机型*//*
|
|
|
- String currentFlyingModels = "";//当前机型*/
|
|
|
- /* if (userAttribute != null) {
|
|
|
- brigade = userAttribute.getBrigade();
|
|
|
- detachment = userAttribute.getDetachment();
|
|
|
- fightRegistration = userAttribute.getFightRegistration();
|
|
|
- *//*flightDuration = userAttribute.getFlightDuration();
|
|
|
- currentTypeFlightDuration = userAttribute.getCurrentTypeFlightDuration();*//*
|
|
|
-
|
|
|
- List<String> flyingModelList = JSON.parseArray(userAttribute.getFlyingModels(), String.class);
|
|
|
- *//* if (!flyingModelList.isEmpty()) {
|
|
|
- flyingModels = String.join(",", flyingModelList);
|
|
|
- }*//*
|
|
|
-
|
|
|
- List<String> currentFlyingModelList = JSON.parseArray(userAttribute.getCurrentFlyingModels(), String.class);
|
|
|
- if (!currentFlyingModelList.isEmpty()) {
|
|
|
- currentFlyingModels = String.join(",", currentFlyingModelList);
|
|
|
- }
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
- /* Cell cell3 = row.createCell(3);
|
|
|
- cell3.setCellValue(brigade);
|
|
|
- cell3.setCellStyle(style);
|
|
|
-
|
|
|
Cell cell4 = row.createCell(4);
|
|
|
- cell4.setCellValue(detachment);
|
|
|
+ cell4.setCellValue(institutionRecordingUsersDTO.getPhone());
|
|
|
cell4.setCellStyle(style);
|
|
|
-
|
|
|
Cell cell5 = row.createCell(5);
|
|
|
- cell5.setCellValue(fightRegistration);
|
|
|
+ cell5.setCellValue(institutionRecordingUsersDTO.getTestDate());
|
|
|
cell5.setCellStyle(style);
|
|
|
Cell cell6 = row.createCell(6);
|
|
|
- cell6.setCellValue(currentFlyingModels);
|
|
|
+ cell6.setCellValue(name);
|
|
|
cell6.setCellStyle(style);
|
|
|
|
|
|
-
|
|
|
- Cell cell7 = row.createCell(7);
|
|
|
- cell7.setCellValue(institutionRecordingUsersDTO.getInde());
|
|
|
- cell7.setCellStyle(style);
|
|
|
-
|
|
|
- Cell cell8 = row.createCell(8);
|
|
|
- cell8.setCellValue(institutionRecordingUsersDTO.getTestDate());
|
|
|
- cell8.setCellStyle(style);
|
|
|
-
|
|
|
- Cell cell9 = row.createCell(9);
|
|
|
- cell9.setCellValue(institutionRecordingUsersDTO.getProfession());
|
|
|
- cell9.setCellStyle(style);
|
|
|
-
|
|
|
- Cell cell10 = row.createCell(10);
|
|
|
- cell10.setCellValue(institutionRecordingUsersDTO.getMilitary());
|
|
|
- cell10.setCellStyle(style);*/
|
|
|
-
|
|
|
+ Cell cell0 = row.createCell(0);
|
|
|
+ cell0.setCellValue(institutionRecordingUsersDTO.getPetName());
|
|
|
+ cell0.setCellStyle(style);
|
|
|
+ Cell cell2 = row.createCell(2);
|
|
|
+ cell2.setCellValue(institutionRecordingUsersDTO.getProfession());
|
|
|
+ cell2.setCellStyle(style);
|
|
|
+ Cell cell1 = row.createCell(1);
|
|
|
+ if (institutionRecordingUsersDTO.getGender().equals("0")) {
|
|
|
+ cell1.setCellValue("男");
|
|
|
+ } else {
|
|
|
+ cell1.setCellValue("女");
|
|
|
+ }
|
|
|
+ cell1.setCellStyle(style);
|
|
|
+ Cell cell3 = row.createCell(3);
|
|
|
+ cell3.setCellValue(institutionRecordingUsersDTO.getBirthday());
|
|
|
+ cell3.setCellStyle(style);
|
|
|
|
|
|
for (int z = 0; z < splitl.length; z++) {
|
|
|
String[] a = splitl[z].split(":");
|
|
|
- Cell rowCell = row.createCell(z + 3);
|
|
|
+ Cell rowCell = row.createCell(z + 7);
|
|
|
if (a.length < 2) {
|
|
|
rowCell.setCellValue("无");
|
|
|
} else {
|
|
@@ -2075,12 +2023,11 @@ public class DataDownloadController {
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
for (UserEntity user : userList) {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
-
|
|
|
- map.put("被试ID", user.getPhone());
|
|
|
map.put("姓名", user.getPetName());
|
|
|
map.put("性别", "0".equals(user.getGender()) ? "男" : "女");
|
|
|
- map.put("年龄", user.getAge());
|
|
|
- /*UserAttributeEntity userAttribute = userAttributeList.stream().filter(att -> user.getId().equals(att.getUserId())).findFirst().orElse(null);
|
|
|
+ map.put("出生日期", user.getBirthday());
|
|
|
+ map.put("登录名", user.getPhone());
|
|
|
+ UserAttributeEntity userAttribute = userAttributeList.stream().filter(att -> user.getId().equals(att.getUserId())).findFirst().orElse(null);
|
|
|
String brigade = "";//所在旅
|
|
|
String detachment = "";//所在大队
|
|
|
String fightRegistration = "";//飞行等级
|
|
@@ -2106,36 +2053,55 @@ public class DataDownloadController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- map.put("单位名称旅", brigade);
|
|
|
- map.put("单位名称大队", detachment);
|
|
|
+ map.put("所在旅", brigade);
|
|
|
+ map.put("所在大队", detachment);
|
|
|
map.put("飞行等级", fightRegistration);
|
|
|
- map.put("现飞机型", currentFlyingModels);
|
|
|
map.put("总飞行时长", flightDuration);
|
|
|
map.put("现机型飞行时长", currentTypeFlightDuration);
|
|
|
map.put("飞过机型", flyingModels);
|
|
|
- map.put("职业", user.getProfession());
|
|
|
- map.put("军衔", user.getMilitary());*/
|
|
|
+ map.put("当前机型", currentFlyingModels);
|
|
|
List<UserRecordEntity> matchUserRecordList = userRecordList.stream().filter(rec -> user.getPhone().equals(rec.getPhone())).collect(Collectors.toList());
|
|
|
if (matchUserRecordList.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
for (UserRecordEntity record : matchUserRecordList) {
|
|
|
- if (Constant.DEFAULT_VALUE_ZERO.equals(record.getType())) {
|
|
|
- map.put(record.getName() + "-测试时间", StringUtils.isNotEmpty(record.getTestDate()) ? record.getTestDate() : "无");
|
|
|
- }
|
|
|
+ map.put(record.getName() + "-测试时间", StringUtils.isNotEmpty(record.getTestDate()) ? record.getTestDate() : "无");
|
|
|
String testResults = record.getTestResults();
|
|
|
if (StringUtils.isEmpty(testResults)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (testResults.contains("version")) {
|
|
|
+ //格式不同,进行处理,按格式处理之后,重新放入testResults
|
|
|
+ String[] results = testResults.split(";");
|
|
|
+ List<String> resultList = Arrays.asList(results);
|
|
|
String testResult = "";
|
|
|
- JSONArray tableModule = JSONObject.parseObject(record.getTestResult()).getJSONArray("tableModule");
|
|
|
- JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
- String[] colName = columnValues.getString(0).split(";");
|
|
|
- String[] colValue = columnValues.getString(1).split(";");
|
|
|
- for (int y = 0; y < colValue.length; y++) {
|
|
|
- testResult += colName[y] + ":" + colValue[y] + ";";
|
|
|
+ for (String item : resultList) {
|
|
|
+ if (resultList.contains("columnValue")) {
|
|
|
+ if (item.contains("columnValue")) {
|
|
|
+ JSONArray tableModule = JSONObject.parseObject(record.getTestResult()).getJSONArray("tableModule");
|
|
|
+ JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
+ String[] colName = columnValues.getString(0).split(";");
|
|
|
+ String[] colValue = columnValues.getString(1).split(";");
|
|
|
+ for (int y = 0; y < colName.length; y++) {
|
|
|
+ testResult += colName[y] + ":" + colValue[y] + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (item.contains("totalScoreDesc")) {
|
|
|
+ JSONArray totalScores = JSONArray.parseArray(item.replace("totalScore:", ""));
|
|
|
+ JSONObject totalScore = totalScores.getJSONObject(0);
|
|
|
+ testResult += "总分:" + totalScore.getString("totalScore") + ";总分结论:" + totalScore.getString("totalScoreDesc") + ";";
|
|
|
+ }
|
|
|
+ if (item.contains("Describe")) {
|
|
|
+ JSONArray dimensions = JSONArray.parseArray(item.replace("dimensions:", ""));
|
|
|
+ for (int y = 0; y < dimensions.size(); y++) {
|
|
|
+ JSONObject dimension = dimensions.getJSONObject(y);
|
|
|
+ testResult += dimension.getString("name") + ":" + dimension.getString("score") + ";"
|
|
|
+ + dimension.getString("name") + "结论:" + dimension.getString("Describe") + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
testResults = testResult;
|
|
|
}
|
|
@@ -2159,56 +2125,4 @@ public class DataDownloadController {
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
- public List<String> getExcelTitleList(String institutionNo) {
|
|
|
- List<String> titleList = new ArrayList<>();
|
|
|
- titleList.add("被试ID");
|
|
|
- titleList.add("姓名");
|
|
|
- titleList.add("性别");
|
|
|
- titleList.add("年龄");
|
|
|
- /*titleList.add("单位名称旅");
|
|
|
- titleList.add("单位名称大队");
|
|
|
- titleList.add("飞行等级");
|
|
|
- titleList.add("现飞机型");
|
|
|
- titleList.add("总飞行时长");
|
|
|
- titleList.add("现机型飞行时长");
|
|
|
- titleList.add("飞过机型");
|
|
|
- titleList.add("职业");
|
|
|
- titleList.add("军衔");*/
|
|
|
- List<UserRecordEntity> userRecordList = userRecordService.getListByInstitutionNo(institutionNo);
|
|
|
- for (UserRecordEntity record : userRecordList) {
|
|
|
- if (Constant.DEFAULT_VALUE_ZERO.equals(record.getType())) {
|
|
|
- titleList.add(record.getName() + "-测试时间");
|
|
|
- }
|
|
|
- String testResults = record.getTestResults();
|
|
|
- if (StringUtils.isEmpty(testResults)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- String testResult = "";
|
|
|
- if (testResults.contains("version")) {
|
|
|
- JSONArray tableModule = JSONObject.parseObject(record.getTestResult()).getJSONArray("tableModule");
|
|
|
- JSONArray columnValues = tableModule.getJSONObject(0).getJSONArray("columnValue");
|
|
|
- String[] colName = columnValues.getString(0).split(";");
|
|
|
- String[] colValue = columnValues.getString(1).split(";");
|
|
|
- for (int y = 0; y < colValue.length; y++) {
|
|
|
- testResult += colName[y] + ":" + colValue[y] + ";";
|
|
|
- }
|
|
|
- testResults = testResult;
|
|
|
- }
|
|
|
- //对测试结果进行解析,并放入map;
|
|
|
- String[] results = testResults.split(";");
|
|
|
- List<String> resultList = Arrays.asList(results);
|
|
|
- for (String result : resultList) {
|
|
|
- if (StringUtils.isEmpty(result)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- String[] resultSubs = result.split(":");
|
|
|
- if (resultSubs == null || resultSubs.length < 2) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- titleList.add(record.getName() + "-" + resultSubs[0]);
|
|
|
- }
|
|
|
- }
|
|
|
- return titleList;
|
|
|
- }
|
|
|
-
|
|
|
}
|