|
@@ -15,13 +15,18 @@ class CountService extends CrudService {
|
|
|
this.tmodel = this.ctx.model.Trainplan;
|
|
|
this.lmodel = this.ctx.model.Leave;
|
|
|
this.schmodel = this.ctx.model.School;
|
|
|
+ this.setmodel = this.ctx.model.Setting;
|
|
|
}
|
|
|
|
|
|
// 查询
|
|
|
async countstudent() {
|
|
|
// 取得当前年份计划信息
|
|
|
+ const setting = await this.setmodel.findOne();
|
|
|
+ if (!setting) {
|
|
|
+ throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '没有找到默认设置');
|
|
|
+ }
|
|
|
console.log(moment().format('YYYY'));
|
|
|
- const plan = await this.tmodel.findOne({ year: moment().format('YYYY') });
|
|
|
+ const plan = await this.tmodel.findById(setting.planid);
|
|
|
if (!plan) {
|
|
|
throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '当前全年计划不存在');
|
|
|
}
|