|
@ -90,12 +90,14 @@ public class CertifiService extends BaseVerifyService implements ICertifiService
|
90
|
90
|
Long count = repository.count(spec);
|
91
|
91
|
PageRequest pageReques = PageRequest.of(req.curPage, req.pageSize);
|
92
|
92
|
Page<Certificate> pages = repository.findAll(spec, pageReques);
|
93
|
|
List<Certificate> list = pages.getContent();
|
94
|
|
setProperties(list);
|
|
93
|
List<Certificate> cers = pages.getContent();
|
|
94
|
setProperties(cers);
|
|
95
|
List<ClientResWrap> wraps = getWraps(null, cers);
|
95
|
96
|
|
96
|
97
|
Map map = new LinkedHashMap();
|
97
|
|
map.put("total", count);
|
98
|
|
map.put("list", list);
|
|
98
|
map.put("total", cers.size());
|
|
99
|
map.put("cers", cers);
|
|
100
|
map.put("cards", wraps);
|
99
|
101
|
return map;
|
100
|
102
|
}
|
101
|
103
|
|
|
@ -114,12 +116,14 @@ public class CertifiService extends BaseVerifyService implements ICertifiService
|
114
|
116
|
Long count = repository.count(spec);
|
115
|
117
|
PageRequest pageReques = PageRequest.of(req.curPage, req.pageSize);
|
116
|
118
|
Page<Certificate> pages = repository.findAll(spec, pageReques);
|
117
|
|
List<Certificate> list = pages.getContent();
|
118
|
|
setProperties(list);
|
|
119
|
List<Certificate> cers = pages.getContent();
|
|
120
|
setProperties(cers);
|
|
121
|
List<ClientResWrap> wraps = getWraps(null, cers);
|
119
|
122
|
|
120
|
123
|
Map map = new LinkedHashMap();
|
121
|
|
map.put("total", count);
|
122
|
|
map.put("list", list);
|
|
124
|
map.put("total", cers.size());
|
|
125
|
map.put("cers", cers);
|
|
126
|
map.put("cards", wraps);
|
123
|
127
|
return map;
|
124
|
128
|
}
|
125
|
129
|
|
|
@ -180,52 +184,59 @@ public class CertifiService extends BaseVerifyService implements ICertifiService
|
180
|
184
|
repository.saveAll(all);
|
181
|
185
|
}
|
182
|
186
|
|
183
|
|
private ClientResWrap getOne(Student student, Certificate cer) {
|
184
|
|
CopyObjTool.copyProperties(student, cer);
|
185
|
|
ClientResWrap wrap = new ClientResWrap();
|
186
|
|
String exam_id = cer.getExam_id();
|
187
|
|
Exam exam = examRepository.findById(exam_id).get();
|
188
|
|
wrap.setYear("" + exam.getYear() + "年");
|
189
|
|
wrap.setExam_name(exam.getExam_name());
|
190
|
|
wrap.setSeries_name(cer.getSeries_name());
|
191
|
|
wrap.setLevel_name(cer.getLevel_name());
|
192
|
|
wrap.setSubject_name(exam.getSubject_name());
|
193
|
|
wrap.setScore("" + cer.getScore());
|
194
|
|
wrap.setValidity(cer.getValidity());//有效期 截止日期
|
195
|
|
|
196
|
|
wrap.setPrint_title("水利部" + wrap.getYear() + "年度职称专业理论知识考试");
|
197
|
|
wrap.setPrint_certi_num(cer.getCerti_num());
|
198
|
|
wrap.setPrint_name(cer.getName());
|
199
|
|
wrap.setPrint_card_num(cer.getCard_num());
|
200
|
|
wrap.setSeries_name(cer.getSeries_name());
|
201
|
|
wrap.setLevel_name(cer.getLevel_name());
|
202
|
|
//合格证的生成日期,转换为汉语大写
|
203
|
|
Date create_time = cer.getCreate_time();
|
204
|
|
wrap.setPrint_time(ExamTimeUtil.change(create_time));
|
205
|
|
|
206
|
|
String endYear = ExamTimeUtil.format(cer.getValidity()).substring(0, 4);
|
207
|
|
wrap.setPrint_validity("(有效期:" + exam.getYear() + "年~" + endYear + "年)");
|
208
|
|
return wrap;
|
|
187
|
private List<ClientResWrap> getWraps(Student student, List<Certificate> cers) {
|
|
188
|
List<ClientResWrap> wraps = new ArrayList<>();
|
|
189
|
for (Certificate cer : cers) {
|
|
190
|
if (student == null) {
|
|
191
|
student = studentRepository.findById(cer.getStudent_id()).get();
|
|
192
|
}
|
|
193
|
CopyObjTool.copyProperties(student, cer);
|
|
194
|
ClientResWrap wrap = new ClientResWrap();
|
|
195
|
String exam_id = cer.getExam_id();
|
|
196
|
Exam exam = examRepository.findById(exam_id).get();
|
|
197
|
wrap.setYear("" + exam.getYear() + "年");
|
|
198
|
wrap.setExam_name(exam.getExam_name());
|
|
199
|
wrap.setSeries_name(cer.getSeries_name());
|
|
200
|
wrap.setLevel_name(cer.getLevel_name());
|
|
201
|
wrap.setSubject_name(exam.getSubject_name());
|
|
202
|
wrap.setScore("" + cer.getScore());
|
|
203
|
wrap.setValidity(cer.getValidity());//有效期 截止日期
|
|
204
|
|
|
205
|
wrap.setPrint_title("水利部" + wrap.getYear() + "年度职称专业理论知识考试");
|
|
206
|
wrap.setPrint_certi_num(cer.getCerti_num());
|
|
207
|
wrap.setPrint_name(cer.getName());
|
|
208
|
wrap.setPrint_card_num(cer.getCard_num());
|
|
209
|
wrap.setSeries_name(cer.getSeries_name());
|
|
210
|
wrap.setLevel_name(cer.getLevel_name());
|
|
211
|
//合格证的生成日期,转换为汉语大写
|
|
212
|
Date create_time = cer.getCreate_time();
|
|
213
|
wrap.setPrint_time(ExamTimeUtil.change(create_time));
|
|
214
|
|
|
215
|
String endYear = ExamTimeUtil.format(cer.getValidity()).substring(0, 4);
|
|
216
|
wrap.setPrint_validity("(有效期:" + exam.getYear() + "年~" + endYear + "年)");
|
|
217
|
wraps.add(wrap);
|
|
218
|
}
|
|
219
|
return wraps;
|
209
|
220
|
}
|
210
|
221
|
|
211
|
222
|
public Map myCerti(String student_id) {
|
212
|
223
|
Student student = studentRepository.findById(student_id).get();
|
213
|
224
|
List<Certificate> cers = repository.myCerti(student_id);
|
214
|
|
List<ClientResWrap> list = new ArrayList<>();
|
215
|
|
for (Certificate cer : cers) {
|
216
|
|
list.add(getOne(student, cer));
|
217
|
|
}
|
|
225
|
List<ClientResWrap> wraps = getWraps(student, cers);
|
|
226
|
|
218
|
227
|
Map map = new LinkedHashMap();
|
219
|
|
map.put("total", list.size());
|
220
|
|
map.put("list", list);
|
|
228
|
map.put("total", cers.size());
|
|
229
|
map.put("cers", cers);
|
|
230
|
map.put("cards", wraps);
|
221
|
231
|
return map;
|
222
|
232
|
}
|
223
|
233
|
|
224
|
234
|
public ClientResWrap myOneCerti(String student_id, String exam_id) {
|
225
|
235
|
Student student = studentRepository.findById(student_id).get();
|
226
|
236
|
List<Certificate> cers = repository.myOneCerti(student_id, exam_id);
|
227
|
|
if (cers.size() > 0) {
|
228
|
|
return getOne(student, cers.get(0));
|
|
237
|
List<ClientResWrap> wraps = getWraps(student, cers);
|
|
238
|
if (wraps.size() > 0) {
|
|
239
|
return wraps.get(0);
|
229
|
240
|
}
|
230
|
241
|
return new ClientResWrap();
|
231
|
242
|
}
|