Yansen пре 2 година
родитељ
комит
03593f2f99

db/.back_文明创办/文明创办-backup-2023216160334.pdma.json → db/.back_文明创办/文明创办-backup-2023217134109.pdma.json Прегледај датотеку

4
   "avatar": "",
4
   "avatar": "",
5
   "version": "4.1.4",
5
   "version": "4.1.4",
6
   "createdTime": "2022-12-12 09:36:12",
6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-2-13 11:18:21",
7
+  "updatedTime": "2023-2-16 16:03:34",
8
   "dbConns": [],
8
   "dbConns": [],
9
   "profile": {
9
   "profile": {
10
     "default": {
10
     "default": {
5219
       "fields": [
5219
       "fields": [
5220
         {
5220
         {
5221
           "defKey": "item_id",
5221
           "defKey": "item_id",
5222
-          "defName": "点位ID",
5222
+          "defName": "测评项目ID",
5223
           "comment": "",
5223
           "comment": "",
5224
           "type": "",
5224
           "type": "",
5225
           "len": 32,
5225
           "len": 32,

+ 35
- 1
db/文明创办.pdma.json Прегледај датотеку

4
   "avatar": "",
4
   "avatar": "",
5
   "version": "4.1.4",
5
   "version": "4.1.4",
6
   "createdTime": "2022-12-12 09:36:12",
6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-2-16 16:03:34",
7
+  "updatedTime": "2023-2-17 13:41:09",
8
   "dbConns": [],
8
   "dbConns": [],
9
   "profile": {
9
   "profile": {
10
     "default": {
10
     "default": {
4833
           "domain": "",
4833
           "domain": "",
4834
           "id": "F2E17D81-03A9-42C4-8DD7-732C8D40DC59"
4834
           "id": "F2E17D81-03A9-42C4-8DD7-732C8D40DC59"
4835
         },
4835
         },
4836
+        {
4837
+          "defKey": "loc_score_percent",
4838
+          "defName": "实地测评得分占比",
4839
+          "comment": "",
4840
+          "type": "DECIMAL",
4841
+          "len": 6,
4842
+          "scale": 2,
4843
+          "primaryKey": false,
4844
+          "notNull": false,
4845
+          "autoIncrement": false,
4846
+          "defaultValue": "",
4847
+          "hideInGraph": false,
4848
+          "refDict": "",
4849
+          "extProps": {},
4850
+          "domain": "",
4851
+          "id": "DE02FAE0-A53F-4F6F-BB1B-B1669DD46C82"
4852
+        },
4853
+        {
4854
+          "defKey": "survey_score_percent",
4855
+          "defName": "调查问卷得分占比",
4856
+          "comment": "",
4857
+          "type": "DECIMAL",
4858
+          "len": 6,
4859
+          "scale": 2,
4860
+          "primaryKey": false,
4861
+          "notNull": false,
4862
+          "autoIncrement": false,
4863
+          "defaultValue": "",
4864
+          "hideInGraph": false,
4865
+          "refDict": "",
4866
+          "extProps": {},
4867
+          "domain": "",
4868
+          "id": "85BA110E-FCC5-4FC5-BE12-2C83C3D0EC27"
4869
+        },
4836
         {
4870
         {
4837
           "defKey": "start_date",
4871
           "defKey": "start_date",
4838
           "defName": "开始日期",
4872
           "defName": "开始日期",

+ 7
- 6
src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java Прегледај датотеку

74
     @GetMapping("/taCheck/{checkId}/item/{typeId}")
74
     @GetMapping("/taCheck/{checkId}/item/{typeId}")
75
     public ResponseBean queryByCheckId(@ApiParam("测评ID") @PathVariable String checkId,
75
     public ResponseBean queryByCheckId(@ApiParam("测评ID") @PathVariable String checkId,
76
                                        @ApiParam("点位ID 或者 调查问卷") @PathVariable String typeId) throws Exception {
76
                                        @ApiParam("点位ID 或者 调查问卷") @PathVariable String typeId) throws Exception {
77
-        TaCheckItem taCheckItem = getByCheckAndType(checkId, typeId);
77
+        String itemType = StringUtils.isEmpty(typeId) || Constants.CHECK_OF_SURVEY.equals(typeId) ? Constants.CHECK_OF_SURVEY : Constants.CHECK_OF_LOC;
78
+        TaCheckItem taCheckItem = getByCheckAndType(checkId, typeId, itemType);
78
         if (null == taCheckItem || Constants.STATUS_DELETE == taCheckItem.getStatus()) {
79
         if (null == taCheckItem || Constants.STATUS_DELETE == taCheckItem.getStatus()) {
79
             return ResponseBean.error("未找到测评项目");
80
             return ResponseBean.error("未找到测评项目");
80
         }
81
         }
87
         return ResponseBean.success(taCheckItem);
88
         return ResponseBean.success(taCheckItem);
88
     }
89
     }
89
 
90
 
90
-    private TaCheckItem getByCheckAndType(String checkId, String typeId) {
91
+    private TaCheckItem getByCheckAndType(String checkId, String typeId, String itemType) {
91
         QueryWrapper<TaCheckItem> queryWrapper = new QueryWrapper<>();
92
         QueryWrapper<TaCheckItem> queryWrapper = new QueryWrapper<>();
92
         queryWrapper.eq("check_id", checkId);
93
         queryWrapper.eq("check_id", checkId);
93
 
94
 
94
-        if (Constants.CHECK_OF_SURVEY.equals(typeId)) {
95
+        if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
95
             queryWrapper.eq("item_type", Constants.CHECK_OF_SURVEY);
96
             queryWrapper.eq("item_type", Constants.CHECK_OF_SURVEY);
96
         } else {
97
         } else {
97
             queryWrapper.eq("item_type", Constants.CHECK_OF_LOC); // 只查点位
98
             queryWrapper.eq("item_type", Constants.CHECK_OF_LOC); // 只查点位
151
             }
152
             }
152
         }
153
         }
153
 
154
 
154
-        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getTypeId());
155
+        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getTypeId(), taCheckItem.getItemType());
155
         if (null == origin) {
156
         if (null == origin) {
156
             // 新增
157
             // 新增
157
             taCheckItem.setStatus(Constants.STATUS_NORMAL);
158
             taCheckItem.setStatus(Constants.STATUS_NORMAL);
192
             }});
193
             }});
193
         }
194
         }
194
 
195
 
195
-        if (Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
196
+//        if (Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
196
             int cnt = taCheckAnswerService.countByItem(taCheckItem.getItemId());
197
             int cnt = taCheckAnswerService.countByItem(taCheckItem.getItemId());
197
             if (cnt >= taCheckItem.getNum()) {
198
             if (cnt >= taCheckItem.getNum()) {
198
                 return ResponseBean.success(new HashMap<String, Object>(){{
199
                 return ResponseBean.success(new HashMap<String, Object>(){{
200
                     put("message", "当前问卷已收齐, 无须作答");
201
                     put("message", "当前问卷已收齐, 无须作答");
201
                 }});
202
                 }});
202
             }
203
             }
203
-        }
204
+//        }
204
 
205
 
205
         return ResponseBean.success(new HashMap<String, Object>(){{
206
         return ResponseBean.success(new HashMap<String, Object>(){{
206
             put("errorCode", 0);    // 0 代表可以答题
207
             put("errorCode", 0);    // 0 代表可以答题

+ 6
- 0
src/main/java/com/example/civilizedcity/entity/TaCheck.java Прегледај датотеку

39
        /** 调查问卷得分 */
39
        /** 调查问卷得分 */
40
        @ApiModelProperty(name = "调查问卷得分",notes = "")
40
        @ApiModelProperty(name = "调查问卷得分",notes = "")
41
        private Double surveyScore ;
41
        private Double surveyScore ;
42
+     /** 实地测评得分占比 */
43
+     @ApiModelProperty(name = "实地测评得分占比",notes = "")
44
+     private Double locScorePercent ;
45
+     /** 调查问卷得分占比 */
46
+     @ApiModelProperty(name = "调查问卷得分占比",notes = "")
47
+     private Double surveyScorePercent ;
42
       /** 开始日期;YYYY-MM-DD */
48
       /** 开始日期;YYYY-MM-DD */
43
       @ApiModelProperty(name = "开始日期",notes = "YYYY-MM-DD")
49
       @ApiModelProperty(name = "开始日期",notes = "YYYY-MM-DD")
44
       private String startDate ;
50
       private String startDate ;

+ 9
- 18
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java Прегледај датотеку

113
 
113
 
114
             // 每份试卷的得分 = 总分 / 份数
114
             // 每份试卷的得分 = 总分 / 份数
115
             double maxScore = taCheckItem.getFullScore()  / taCheckItem.getNum();
115
             double maxScore = taCheckItem.getFullScore()  / taCheckItem.getNum();
116
-            double totalScore = maxScore + negativeScore + positiveScore;
117
-
118
-            if (0 > totalScore) {
119
-                // 如果扣分项太多
120
-                totalScore = 0.0;
121
-            }
116
+            double totalScore = negativeScore + positiveScore;
117
+//            double totalScore = maxScore + negativeScore + positiveScore;
118
+//
119
+//            if (0 > totalScore) {
120
+//                // 如果扣分项太多
121
+//                totalScore = 0.0;
122
+//            }
122
             if (totalScore > maxScore) {
123
             if (totalScore > maxScore) {
123
                 // 如果得分超过总分
124
                 // 如果得分超过总分
124
                 totalScore = maxScore;
125
                 totalScore = maxScore;
186
             if (score > 0) {
187
             if (score > 0) {
187
                 positiveScore += score;
188
                 positiveScore += score;
188
             } else {
189
             } else {
189
-//                negativeScore += score;
190
-
191
-                // 扣分项
192
-                if (sign < 0) {
193
-                    mustCreateIssue = true;
194
-                    score = qu.getMaxScore() - score;
195
-                    if (score < 0) {
196
-                        score = 0;
197
-                    }
198
-
199
-                    positiveScore += score;
200
-                }
190
+                mustCreateIssue = true;
191
+                negativeScore += score;
201
             }
192
             }
202
 
193
 
203
             // 保存附件
194
             // 保存附件

+ 34
- 1
src/main/java/com/example/civilizedcity/service/impl/TaCheckServiceImpl.java Прегледај датотеку

68
             checkItem.setScore(s);
68
             checkItem.setScore(s);
69
             taCheckItemMapper.updateById(checkItem);
69
             taCheckItemMapper.updateById(checkItem);
70
 
70
 
71
+            // 如果得到正分, 说明试卷得了满分
72
+            if (s > 0) {
73
+                s = checkItem.getFullScore();
74
+            }
75
+
76
+            // 如果产生扣分项
77
+            if (s < 0) {
78
+                s = checkItem.getFullScore() + s;
79
+                if (s < 0) {
80
+                    s = 0;
81
+                }
82
+            }
83
+
71
             totalScore += s;
84
             totalScore += s;
72
         }
85
         }
73
 
86
 
100
             if (quList == null || quList.size() == 0) continue;
113
             if (quList == null || quList.size() == 0) continue;
101
             int quNum = quList.size();
114
             int quNum = quList.size();
102
 
115
 
116
+            // 每份试卷的最大分数
117
+            double maxItemScore = 100.00 / copyNum;
103
             // 每题的最大分数
118
             // 每题的最大分数
104
-            double maxStandScore = 100.00 / copyNum / quNum;
119
+            double maxStandScore = maxItemScore / quNum;
105
 
120
 
106
             // 总分
121
             // 总分
107
             double score = 0.0;
122
             double score = 0.0;
139
                     quScore += s * ratio;
154
                     quScore += s * ratio;
140
                 }
155
                 }
141
 
156
 
157
+                if (quScore > maxStandScore) {
158
+                    quScore = maxStandScore;
159
+                }
160
+
142
                 answer.setScore(quScore);
161
                 answer.setScore(quScore);
143
                 taCheckAnswerMapper.updateById(answer);
162
                 taCheckAnswerMapper.updateById(answer);
144
 
163
 
146
                 score += quScore;
165
                 score += quScore;
147
             }
166
             }
148
 
167
 
168
+            // 如果是正数, 那么就是试卷的得分
169
+            // 但是不能超过最大值
170
+            if (score > maxItemScore) {
171
+                score = maxItemScore;
172
+            }
173
+
174
+            // 调查问卷理论上不会出现分数为负的情况
175
+            if (score < 0) {
176
+                score = maxItemScore + score;
177
+                if (score < 0) {
178
+                    score = 0;
179
+                }
180
+            }
181
+
149
             checkItem.setScore(score);
182
             checkItem.setScore(score);
150
             taCheckItemMapper.updateById(checkItem);
183
             taCheckItemMapper.updateById(checkItem);
151
 
184