|
@@ -385,6 +385,17 @@ class ClassService extends CrudService {
|
|
|
if (!tClass) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '班级不存在,无法复制设定的班级设置');
|
|
|
const { name, termid, batchid } = tClass;
|
|
|
const r = templateList.find(f => f.name === name);
|
|
|
+ // 找到班主任全年计划
|
|
|
+ const trainPlan = await this.tmodel.findById(tClass.planid);
|
|
|
+ if (!trainPlan) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到该班所在的年度计划信息');
|
|
|
+ const tpt = trainPlan.termnum.id(tClass.termid);
|
|
|
+ if (!tpt) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到该班所在年度计划的期信息');
|
|
|
+ const tpb = tpt.batchnum.id(tClass.batchid);
|
|
|
+ if (!tpb) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到该班所在年度计划的批次信息');
|
|
|
+ if (!tpb.class) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到该班所在年度计划批次下的班级');
|
|
|
+ const tpc = tpb.class.find(f => f.name === tClass.name);
|
|
|
+ if (!tpc) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到该班所在年度计划的班级信息');
|
|
|
+ const { headteacherid } = tpc;
|
|
|
if (r) {
|
|
|
// 说明这个是正常班,且从模板中找得到; 除了礼仪教师外,都复制过来
|
|
|
const { jslocationid, kbyslocationid, kzjhlocationid, yclocationid } = r;
|
|
@@ -392,6 +403,7 @@ class ClassService extends CrudService {
|
|
|
if (!tClass.kbyslocationid && kbyslocationid) tClass.kbyslocationid = kbyslocationid;
|
|
|
if (!tClass.kzjhlocationid && kzjhlocationid) tClass.kzjhlocationid = kzjhlocationid;
|
|
|
if (!tClass.yclocationid && yclocationid) tClass.yclocationid = yclocationid;
|
|
|
+ if (!tClass.headteacherid && headteacherid) tClass.headteacherid = headteacherid;
|
|
|
await tClass.save();
|
|
|
} else {
|
|
|
// 没找到,有可能是普通班,也有可能是非普通班
|
|
@@ -410,6 +422,7 @@ class ClassService extends CrudService {
|
|
|
if (!tClass.kbyslocationid && kbyslocationid) tClass.kbyslocationid = kbyslocationid;
|
|
|
if (!tClass.kzjhlocationid && kzjhlocationid) tClass.kzjhlocationid = kzjhlocationid;
|
|
|
if (!tClass.yclocationid && yclocationid) tClass.yclocationid = yclocationid;
|
|
|
+ if (!tClass.headteacherid && headteacherid) tClass.headteacherid = headteacherid;
|
|
|
await tClass.save();
|
|
|
}
|
|
|
}
|