Переглянути джерело

解决数据库恢复问题

LiDongfeng 3 тижнів тому
батько
коміт
22a0af8e67

+ 2 - 2
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -1829,7 +1829,7 @@ public class ServerController extends BaseController {
                     currentFlyingModels = JSONArray.toJSONString(currentFlyingModelss);
                 }
 
-                UserAttributeEntity userAttributeEntity = new UserAttributeEntity();
+                /*UserAttributeEntity userAttributeEntity = new UserAttributeEntity();
                 userAttributeEntity.setUserId(tempUserDB.getId());
                 userAttributeEntity.setBrigade(brigade);
                 userAttributeEntity.setDetachment(detachment);
@@ -1840,7 +1840,7 @@ public class ServerController extends BaseController {
                 userAttributeEntity.setCurrentFlyingModels(currentFlyingModels);
                 userAttributeEntity.setStatus(Constant.TEST_PLAN_STATUS_STOP);
                 userAttributeEntity.setCreateTime(DateUtil.now());
-                this.userAttributeService.save(userAttributeEntity);
+                this.userAttributeService.save(userAttributeEntity);*/
 
             }
             if (isExist) {

+ 28 - 60
src/main/java/com/rf/psychological/scale/rest/DataDownloadController.java

@@ -787,14 +787,14 @@ public class DataDownloadController {
                 newTitle[0] = "被试ID";
                 newTitle[1] = "姓名";
                 newTitle[2] = "年龄";
-                newTitle[3] = "单位名称旅";
+               /* newTitle[3] = "单位名称旅";
                 newTitle[4] = "单位名称大队";
                 newTitle[5] = "飞行等级";
                 newTitle[6] = "现飞机型";
                 newTitle[7] = "任务序次";
                 newTitle[8] = "测试时间";
                 newTitle[9] = "职业";
-                newTitle[10] = "军衔";
+                newTitle[10] = "军衔";*/
                 /*newTitle[0] = "姓名";
                 newTitle[1] = "性别";
                 newTitle[2] = "职业";
@@ -815,14 +815,14 @@ public class DataDownloadController {
                 oldTitle[0] = "被试ID";
                 oldTitle[1] = "姓名";
                 oldTitle[2] = "年龄";
-                oldTitle[3] = "单位名称旅";
+                /*oldTitle[3] = "单位名称旅";
                 oldTitle[4] = "单位名称大队";
                 oldTitle[5] = "飞行等级";
                 oldTitle[6] = "现飞机型";
                 oldTitle[7] = "任务序次";
                 oldTitle[8] = "测试时间";
                 oldTitle[9] = "职业";
-                oldTitle[10] = "军衔";
+                oldTitle[10] = "军衔";*/
                 /*oldTitle[0] = "姓名";
                 oldTitle[1] = "性别";
                 oldTitle[2] = "职业";
@@ -1035,14 +1035,14 @@ public class DataDownloadController {
                 newTitle[0] = "被试ID";
                 newTitle[1] = "姓名";
                 newTitle[2] = "年龄";
-                newTitle[3] = "单位名称旅";
+               /* newTitle[3] = "单位名称旅";
                 newTitle[4] = "单位名称大队";
                 newTitle[5] = "飞行等级";
                 newTitle[6] = "现飞机型";
                 newTitle[7] = "任务序次";
                 newTitle[8] = "测试时间";
                 newTitle[9] = "职业";
-                newTitle[10] = "军衔";
+                newTitle[10] = "军衔";*/
                 for (int x = 0; x < splits.length; x++) {
                     String[] a = splits[x].split(":");
                     newTitle[x + 11] = a[0];
@@ -1056,7 +1056,7 @@ public class DataDownloadController {
                 oldTitle[0] = "被试ID";
                 oldTitle[1] = "姓名";
                 oldTitle[2] = "年龄";
-                oldTitle[3] = "单位名称旅";
+                /*oldTitle[3] = "单位名称旅";
                 oldTitle[4] = "单位名称大队";
                 oldTitle[5] = "飞行等级";
                 oldTitle[6] = "现飞机型";
@@ -1064,7 +1064,7 @@ public class DataDownloadController {
                 oldTitle[8] = "测试时间";
 
                 oldTitle[9] = "职业";
-                oldTitle[10] = "军衔";
+                oldTitle[10] = "军衔";*/
                 for (int y = 0; y < splits.length; y++) {
                     String[] a = splits[y].split(":");
                     oldTitle[y + 11] = a[0];
@@ -1897,12 +1897,12 @@ public class DataDownloadController {
         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);
+        //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);
+            //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")) {
@@ -1914,40 +1914,8 @@ public class DataDownloadController {
                 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 = testResultls.split(";");
-            }*/
+            }
             //创建list.size()行数据
             row = downSheet.createRow(i + 1);
 
@@ -1964,33 +1932,33 @@ public class DataDownloadController {
             cell2.setCellValue(institutionRecordingUsersDTO.getAge());
             cell2.setCellStyle(style);
 
-            String brigade = "";//所在旅
+           /* String brigade = "";//所在旅
             String detachment = "";//所在大队
             String fightRegistration = "";//飞行等级
-           /* String flightDuration = "";//总飞行时长
+           *//* String flightDuration = "";//总飞行时长
             String currentTypeFlightDuration = "";//现机型飞行时长
-            String flyingModels = "";//飞过机型*/
-            String currentFlyingModels = "";//当前机型
-            if (userAttribute != null) {
+            String flyingModels = "";//飞过机型*//*
+            String currentFlyingModels = "";//当前机型*/
+           /* if (userAttribute != null) {
                 brigade = userAttribute.getBrigade();
                 detachment = userAttribute.getDetachment();
                 fightRegistration = userAttribute.getFightRegistration();
-                /*flightDuration = userAttribute.getFlightDuration();
-                currentTypeFlightDuration = userAttribute.getCurrentTypeFlightDuration();*/
+                *//*flightDuration = userAttribute.getFlightDuration();
+                currentTypeFlightDuration = userAttribute.getCurrentTypeFlightDuration();*//*
 
                 List<String> flyingModelList = JSON.parseArray(userAttribute.getFlyingModels(), String.class);
-               /* if (!flyingModelList.isEmpty()) {
+               *//* 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);
+           /* Cell cell3 = row.createCell(3);
             cell3.setCellValue(brigade);
             cell3.setCellStyle(style);
 
@@ -2020,12 +1988,12 @@ public class DataDownloadController {
 
             Cell cell10 = row.createCell(10);
             cell10.setCellValue(institutionRecordingUsersDTO.getMilitary());
-            cell10.setCellStyle(style);
+            cell10.setCellStyle(style);*/
 
 
             for (int z = 0; z < splitl.length; z++) {
                 String[] a = splitl[z].split(":");
-                Cell rowCell = row.createCell(z + 11);
+                Cell rowCell = row.createCell(z + 3);
                 if (a.length < 2) {
                     rowCell.setCellValue("无");
                 } else {
@@ -2112,7 +2080,7 @@ public class DataDownloadController {
             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);
+            /*UserAttributeEntity userAttribute = userAttributeList.stream().filter(att -> user.getId().equals(att.getUserId())).findFirst().orElse(null);
             String brigade = "";//所在旅
             String detachment = "";//所在大队
             String fightRegistration = "";//飞行等级
@@ -2146,7 +2114,7 @@ public class DataDownloadController {
             map.put("现机型飞行时长", currentTypeFlightDuration);
             map.put("飞过机型", flyingModels);
             map.put("职业", user.getProfession());
-            map.put("军衔", user.getMilitary());
+            map.put("军衔", user.getMilitary());*/
             List<UserRecordEntity> matchUserRecordList = userRecordList.stream().filter(rec -> user.getPhone().equals(rec.getPhone())).collect(Collectors.toList());
             if (matchUserRecordList.isEmpty()) {
                 continue;
@@ -2197,7 +2165,7 @@ public class DataDownloadController {
         titleList.add("姓名");
         titleList.add("性别");
         titleList.add("年龄");
-        titleList.add("单位名称旅");
+        /*titleList.add("单位名称旅");
         titleList.add("单位名称大队");
         titleList.add("飞行等级");
         titleList.add("现飞机型");
@@ -2205,7 +2173,7 @@ public class DataDownloadController {
         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())) {

+ 3 - 3
src/main/java/com/rf/psychological/user/rest/UserController.java

@@ -342,7 +342,7 @@ public class UserController extends BaseController {
         if (userEntity == null) {
             return fail("用户不存在");
         }
-        UserAttributeEntity userAttributeEntity = this.userAttributeService.findByUserIdAndStatus(userEntity.getId(), Constant.TEST_PLAN_STATUS_STOP);
+        /*UserAttributeEntity userAttributeEntity = this.userAttributeService.findByUserIdAndStatus(userEntity.getId(), Constant.TEST_PLAN_STATUS_STOP);
         if (userAttributeEntity != null) {
             userAttributeEntity.setStatus(Constant.TEST_PLAN_STATUS_END);
             userAttributeEntity.setUpdateTime(cn.hutool.core.date.DateUtil.now());
@@ -352,11 +352,11 @@ public class UserController extends BaseController {
         userAttribute.setUserId(userEntity.getId());
         userAttribute.setStatus(Constant.TEST_PLAN_STATUS_STOP);
         userAttribute.setCreateTime(cn.hutool.core.date.DateUtil.now());
-        this.userAttributeService.save(userAttribute);
+        this.userAttributeService.save(userAttribute);*/
         userEntity = userService.save(userEntity);
         JSONObject resultJson = new JSONObject();
         resultJson.put("userEntity", userEntity);
-        resultJson.put("userAttribute", userAttribute);
+        //resultJson.put("userAttribute", userAttribute);
         if (userEntity != null) {
             return success(resultJson, "修改成功");
         } else {

+ 4 - 4
src/main/resources/config/application-lan.yml

@@ -8,8 +8,8 @@ spring:
     driver-class-name: com.mysql.cj.jdbc.Driver
     #url: jdbc:mysql://49.232.26.44:3306/psychological_112?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
     #群体
-    #url: jdbc:mysql://127.0.0.1:54051/psychological_wlb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
-    url: jdbc:mysql://127.0.0.1:3306/psychological_wlb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
+    url: jdbc:mysql://127.0.0.1:54051/psychological_wlb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
+    #url: jdbc:mysql://127.0.0.1:3306/psychological_wlb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
     username: root
-    #password: Mysql@.2020
-    password: Aa123456
+    password: Mysql@.2020
+    #password: Aa123456