|
@@ -27,6 +27,12 @@ class SchoolService extends CrudService {
|
|
if (!plan) {
|
|
if (!plan) {
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '计划信息不存在');
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '计划信息不存在');
|
|
}
|
|
}
|
|
|
|
+ const schs = await plan.school;
|
|
|
|
+ const sch_ = _.find(schs, { code: schid });
|
|
|
|
+ let num_ = '0';
|
|
|
|
+ if (sch_) {
|
|
|
|
+ num_ = sch_.num;
|
|
|
|
+ }
|
|
const planid = plan.id;
|
|
const planid = plan.id;
|
|
const planyearid = plan.planyearid;
|
|
const planyearid = plan.planyearid;
|
|
// 取得excle中数据
|
|
// 取得excle中数据
|
|
@@ -34,6 +40,9 @@ class SchoolService extends CrudService {
|
|
console.log(_filepath);
|
|
console.log(_filepath);
|
|
const studatas = await this.getImportXLSXData(_filepath, termid, schid, planid, planyearid);
|
|
const studatas = await this.getImportXLSXData(_filepath, termid, schid, planid, planyearid);
|
|
console.log(studatas);
|
|
console.log(studatas);
|
|
|
|
+ if (studatas.length > Number(num_)) {
|
|
|
|
+ throw new BusinessError(ErrorCode.SERVICE_FAULT, '学校上传人数超过预期人数');
|
|
|
|
+ }
|
|
// 将得到的数据校验
|
|
// 将得到的数据校验
|
|
const datacheck = await this.datacheck(studatas);
|
|
const datacheck = await this.datacheck(studatas);
|
|
if (datacheck.errorcode === '1') {
|
|
if (datacheck.errorcode === '1') {
|