|
@@ -58,13 +58,14 @@ public class ZQuestionUpdateService {
|
58
|
58
|
}
|
59
|
59
|
for (TSubject s : subjects) {
|
60
|
60
|
List<TSubjectQuestiontype> qtypelist = zQuestionUpdateMapper.listSubjectQtype(s.getLevel(), s.getSubjectid());
|
61
|
|
- Map<Integer, TSubjectQuestiontype> tmap = new TreeMap();
|
|
61
|
+ Map<String, TSubjectQuestiontype> tmap = new TreeMap();
|
62
|
62
|
if (N_Utils.isListEmpty(qtypelist)) {
|
63
|
63
|
throw new Exception(s.getSubjectname() + "未设置题型");
|
64
|
64
|
}
|
65
|
65
|
for (TSubjectQuestiontype t : qtypelist) {
|
66
|
|
- if(!tmap.containsKey(t.getCtype())){
|
67
|
|
- tmap.put(t.getCtype(), t);
|
|
66
|
+ String key = t.getCtype() + "_"+t.getQtypename();
|
|
67
|
+ if(!tmap.containsKey(key)){
|
|
68
|
+ tmap.put(key, t);
|
68
|
69
|
}
|
69
|
70
|
}
|
70
|
71
|
|
|
@@ -110,12 +111,14 @@ public class ZQuestionUpdateService {
|
110
|
111
|
q.setSchoolid(qvo.getSchoolid());
|
111
|
112
|
TSubjectQuestiontype st = null;
|
112
|
113
|
if (qvo.getCtype() == 7 || qvo.getCtype() == 8) {
|
113
|
|
- st = tmap.get(16);
|
|
114
|
+ String sckey = "16_"+qvo.getQtypename();
|
|
115
|
+ st = tmap.get(sckey);
|
114
|
116
|
q.setCtype(16);
|
115
|
117
|
|
116
|
118
|
}
|
117
|
119
|
if (qvo.getCtype() == 10) {
|
118
|
|
- st = tmap.get(17);
|
|
120
|
+ String sckey = "17_"+qvo.getQtypename();
|
|
121
|
+ st = tmap.get(sckey);
|
119
|
122
|
q.setCtype(17);
|
120
|
123
|
}
|
121
|
124
|
|
|
@@ -148,7 +151,19 @@ public class ZQuestionUpdateService {
|
148
|
151
|
td.setCreatetime(timestamp);
|
149
|
152
|
directors.add(td);
|
150
|
153
|
}
|
|
154
|
+
|
|
155
|
+ String key1 = "1_单选题";
|
|
156
|
+ String key2 = "1_选择题";
|
|
157
|
+ TSubjectQuestiontype sonqtype = null;
|
|
158
|
+ if(tmap.containsKey(key1)){
|
|
159
|
+ sonqtype = tmap.get(key1);
|
|
160
|
+ }else if(tmap.containsKey(key2)){
|
|
161
|
+ sonqtype = tmap.get(key2);
|
|
162
|
+ }
|
151
|
163
|
|
|
164
|
+ if (sonqtype == null) {
|
|
165
|
+ throw new Exception("科目下无单选题题型:" + s.getSubjectname() + ";试题id:" + qvo.getQuestionid());
|
|
166
|
+ }
|
152
|
167
|
|
153
|
168
|
for (int i = 0; i < optionlist.size(); i++) {
|
154
|
169
|
Map map = optionlist.get(i);
|
|
@@ -184,10 +199,9 @@ public class ZQuestionUpdateService {
|
184
|
199
|
sq.setBelong(qvo.getBelong());
|
185
|
200
|
sq.setSchoolid(qvo.getSchoolid());
|
186
|
201
|
|
187
|
|
- TSubjectQuestiontype st1 = tmap.get(1);
|
188
|
202
|
sq.setCtype(1);
|
189
|
|
- sq.setQtypeid(st1.getQtypeid());
|
190
|
|
- sq.setQtypename(st1.getQtypename());
|
|
203
|
+ sq.setQtypeid(sonqtype.getQtypeid());
|
|
204
|
+ sq.setQtypename(sonqtype.getQtypename());
|
191
|
205
|
|
192
|
206
|
questions.add(sq);
|
193
|
207
|
}
|