|
@@ -43,7 +43,7 @@ class SchoolService extends CrudService {
|
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '计划信息不存在');
|
|
|
}
|
|
|
// 取得学校预计人数
|
|
|
- const num_ = await this.getschnum(plan, type, schid, termid);
|
|
|
+ const num_ = await this.getschnum(plan, type, schid, termid, batchid);
|
|
|
console.log('*******************');
|
|
|
console.log(num_);
|
|
|
console.log('*******************');
|
|
@@ -134,17 +134,17 @@ class SchoolService extends CrudService {
|
|
|
}
|
|
|
|
|
|
// 取得学校预计人数
|
|
|
- async getschnum(plan, type, schid, termid) {
|
|
|
+ async getschnum(plan, type, schid, termid, batchid) {
|
|
|
const schtime = await this.schmodel.findOne({ schid, planid: plan.id });
|
|
|
let { arrange } = schtime;
|
|
|
const { termnum } = plan;
|
|
|
- arrange = _.groupBy(arrange, 'term');
|
|
|
+ arrange = _.groupBy(arrange, 'termid');
|
|
|
const keys = Object.keys(arrange);
|
|
|
let arr = keys.map(key => {
|
|
|
- const rt = termnum.find(f => f.term === key);
|
|
|
+ const rt = termnum.find(f => f.termid === key);
|
|
|
let ar = arrange[key];
|
|
|
ar = ar.map(a => {
|
|
|
- const rb = rt.batchnum.find(f => f.batch === a.batch);
|
|
|
+ const rb = rt.batchnum.find(f => f.batchid === a.batchid);
|
|
|
if (rb) {
|
|
|
const bh = _.head(rb.class);
|
|
|
const { type } = bh;
|