|
@@ -47,18 +47,22 @@ class SchoolService extends CrudService {
|
|
|
if (datacheck.errorcode === '1') {
|
|
|
return datacheck;
|
|
|
}
|
|
|
- const school_ = await this.smodel.findOne({ code: schid });
|
|
|
+ const school_ = await this.model.findOne({ code: schid });
|
|
|
+ let schname = '';
|
|
|
+ if (school_) {
|
|
|
+ schname = school_.name;
|
|
|
+ }
|
|
|
const trem_ = await plan.termnum.id(termid);
|
|
|
if (!trem_) {
|
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '期信息不存在');
|
|
|
}
|
|
|
const nowtime = moment().locale('zh-cn').format('YYYY-MM-DD HH:mm:ss');
|
|
|
if (studatas.length > Number(num_)) {
|
|
|
- const jobdata = { code: schid, name: school_.name, planid: plan.id, termid, term: trem_.term, filepath, studs: JSON.stringify(studatas), plannum: num_, schnum: studatas.length, isstore: '0', createtime: nowtime };
|
|
|
+ const jobdata = { code: schid, name: schname, planid: plan.id, termid, term: trem_.term, filepath, studs: JSON.stringify(studatas), plannum: num_, schnum: studatas.length, isstore: '0', createtime: nowtime };
|
|
|
await this.jmodel.create(jobdata);
|
|
|
throw new BusinessError(ErrorCode.SERVICE_FAULT, '学校上传人数超过预期人数');
|
|
|
} else if (studatas.length < Number(num_)) {
|
|
|
- const jobdata = { code: schid, name: school_.name, planid: plan.id, termid, term: trem_.term, filepath, studs: JSON.stringify(studatas), plannum: num_, schnum: studatas.length, isstore: '0', createtime: nowtime };
|
|
|
+ const jobdata = { code: schid, name: schname, planid: plan.id, termid, term: trem_.term, filepath, studs: JSON.stringify(studatas), plannum: num_, schnum: studatas.length, isstore: '0', createtime: nowtime };
|
|
|
await this.jmodel.create(jobdata);
|
|
|
throw new BusinessError(ErrorCode.SERVICE_FAULT, '学校上传人数少于预期人数');
|
|
|
}
|