Browse Source

Merge remote-tracking branch 'origin/wn' into ywx

ywx
雍文秀 8 months ago
parent
commit
80e21e3af8
1 changed files with 71 additions and 54 deletions
  1. 71
    54
      src/main/java/com/xhkjedu/service/EPaperVerifyService.java

+ 71
- 54
src/main/java/com/xhkjedu/service/EPaperVerifyService.java View File

@@ -137,77 +137,94 @@ public class EPaperVerifyService {
137 137
             psq.setAnswered(0);
138 138
         } else {
139 139
             List<String> stuanswers = JSON.parseArray(stuanswer, String.class);
140
-            String qanswer = answerVo.getAnswer();
141
-            List<String> qanswers = JSON.parseArray(qanswer, String.class);
142
-            int ctype = answerVo.getCtype();
143
-            if (psq.getAnswertype() == 1) {
144
-                if (N_Utils.isObjectiveQuestion(ctype)) {
145
-                    //客观题进行批阅
146
-                    if (ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6) {
147
-                        //单选、判断
148
-                        if (stuanswer.equalsIgnoreCase(qanswer)) {
149
-                            stuscore = answerVo.getScore();
150
-                        }
151
-                    } else if (ctype == 2) {//多选
152
-                        //多选、选错不得分
153
-                        if (stuanswers.get(0).length() <= qanswer.length()) {
154
-                            String[] qanswerList = qanswers.get(0).split("");
155
-                            String[] stuanswerList = stuanswers.get(0).split("");
156
-                            int rightNum = 0;//选对个数
157
-                            for (String sa : stuanswerList) {
158
-                                int right = 0;
159
-                                for (String qa : qanswerList) {
160
-                                    if (qa.equals(sa)) {
161
-                                        right = 1;
162
-                                        rightNum++;
140
+            if(stuanswers.get(0).equals("null") || "".equals(stuanswers.get(0))){
141
+                //说明是空
142
+                psq.setAnswered(0);
143
+                psq.setStuanswer(null);
144
+                psq.setStuanswertxt(null);
145
+                psq.setStuscore(stuscore);
146
+                psq.setChecked(2);
147
+                psq.setChecktime(timestamp);
148
+                psq.setAnswered(0);
149
+            }else{
150
+                String qanswer = answerVo.getAnswer();
151
+                List<String> qanswers = JSON.parseArray(qanswer, String.class);
152
+                int ctype = answerVo.getCtype();
153
+                if (psq.getAnswertype() == 1) {
154
+                    if (N_Utils.isObjectiveQuestion(ctype)) {
155
+                        //客观题进行批阅
156
+                        if (ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6) {
157
+                            //单选、判断
158
+                            if (stuanswer.equalsIgnoreCase(qanswer)) {
159
+                                stuscore = answerVo.getScore();
160
+                            }
161
+                        } else if (ctype == 2) {//多选
162
+                            //多选、选错不得分
163
+                            if (stuanswers.get(0).length() <= qanswer.length()) {
164
+                                String[] qanswerList = qanswers.get(0).split("");
165
+                                String[] stuanswerList = stuanswers.get(0).split("");
166
+                                int rightNum = 0;//选对个数
167
+                                for (String sa : stuanswerList) {
168
+                                    int right = 0;
169
+                                    for (String qa : qanswerList) {
170
+                                        if (qa.equals(sa)) {
171
+                                            right = 1;
172
+                                            rightNum++;
173
+                                        }
174
+                                    }
175
+                                    if (right == 0) {//说明选错
176
+                                        rightNum = 0;
177
+                                        break;
163 178
                                     }
164 179
                                 }
165
-                                if (right == 0) {//说明选错
166
-                                    rightNum = 0;
167
-                                    break;
168
-                                }
169
-                            }
170
-                            if (rightNum > 0) {
171
-                                if (qanswerList.length == rightNum) {
172
-                                    //全选对
173
-                                    stuscore = answerVo.getScore();
174
-                                } else if (qanswerList.length > rightNum) {
175
-                                    //少选得半分
176
-                                    stuscore = N_Utils.div(answerVo.getScore(), 2, 1);
180
+                                if (rightNum > 0) {
181
+                                    if (qanswerList.length == rightNum) {
182
+                                        //全选对
183
+                                        stuscore = answerVo.getScore();
184
+                                    } else if (qanswerList.length > rightNum) {
185
+                                        //少选得半分
186
+                                        stuscore = N_Utils.div(answerVo.getScore(), 2, 1);
187
+                                    }
177 188
                                 }
178 189
                             }
179 190
                         }
191
+                        psq.setChecked(2);
192
+                        psq.setChecktime(timestamp);
193
+                    } else {
194
+                        psq.setChecked(0);
180 195
                     }
181
-                    psq.setChecked(2);
182
-                    psq.setChecktime(timestamp);
183 196
                 } else {
184
-                    psq.setChecked(0);
185
-                }
186
-            } else {
187
-                if(N_Utils.isNotEmpty(stuanswertxt)){
188
-                    List<String> stuanswertxt_list = JSON.parseArray(stuanswertxt,String.class);
189
-                    String stuanswertxt_txt = stuanswertxt_list.get(0);
190
-                    if(N_Utils.isNotEmpty(stuanswertxt_txt)){
191
-                        stuanswertxt_txt = N_Utils.strTrim(stuanswertxt_txt);
197
+                    if(N_Utils.isNotEmpty(stuanswertxt)){
198
+                        List<String> stuanswertxt_list = JSON.parseArray(stuanswertxt,String.class);
199
+                        String stuanswertxt_txt = stuanswertxt_list.get(0);
192 200
                         if(N_Utils.isNotEmpty(stuanswertxt_txt)){
193
-                            psq.setChecked(0);
194
-                            List<String> stuanswertxt_list_new = new ArrayList<>();
195
-                            stuanswertxt_list_new.add(stuanswertxt_txt);
196
-                            psq.setStuanswertxt(JSON.toJSONString(stuanswertxt_list_new));
201
+                            stuanswertxt_txt = N_Utils.strTrim(stuanswertxt_txt);
202
+                            if(N_Utils.isNotEmpty(stuanswertxt_txt)){
203
+                                psq.setChecked(0);
204
+                                List<String> stuanswertxt_list_new = new ArrayList<>();
205
+                                stuanswertxt_list_new.add(stuanswertxt_txt);
206
+                                psq.setStuanswertxt(JSON.toJSONString(stuanswertxt_list_new));
207
+                            }else{
208
+                                psq.setChecked(2);
209
+                                psq.setStuanswertxt("[\"\"]");
210
+                            }
197 211
                         }else{
198 212
                             psq.setChecked(2);
199 213
                             psq.setStuanswertxt("[\"\"]");
200 214
                         }
201 215
                     }else{
202 216
                         psq.setChecked(2);
203
-                        psq.setStuanswertxt("[\"\"]");
204 217
                     }
205
-                }else{
206
-                    psq.setChecked(2);
207 218
                 }
219
+
220
+                String newStuAnswer = stuanswers.get(0).toUpperCase();
221
+                List<String> newStuAnswers = new ArrayList<>();
222
+                newStuAnswers.add(newStuAnswer);
223
+                psq.setStuanswer(JSON.toJSONString(newStuAnswers));
224
+
225
+                psq.setStuscore(stuscore);
226
+                psq.setAnswered(1);
208 227
             }
209
-            psq.setStuscore(stuscore);
210
-            psq.setAnswered(1);
211 228
         }
212 229
     }
213 230
 

Loading…
Cancel
Save