lrf402788946 %!s(int64=4) %!d(string=hai) anos
pai
achega
3425861fca
Modificáronse 4 ficheiros con 29 adicións e 3 borrados
  1. 1 1
      app/model/class.js
  2. 1 1
      app/model/location.js
  3. 1 1
      app/service/lesson.js
  4. 26 0
      app/service/util.js

+ 1 - 1
app/model/class.js

@@ -13,7 +13,7 @@ const ClassSchema = {
   headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
   lyteacherid: { type: String, required: false, maxLength: 200 }, // 礼仪课老师id
   yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id
-  kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 拓展计划地点id
+  kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 拓展训练地点id
   kbyslocationid: { type: String, required: false, maxLength: 200 }, // 开班仪式地点id
   jslocationid: { type: String, required: false, maxLength: 200 }, // 教室位置id
   lessonid: { type: String, required: false, maxLength: 200 }, // 课程表id

+ 1 - 1
app/model/location.js

@@ -5,7 +5,7 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 // 位置表
 const LocationSchema = {
   name: { type: String, required: true, maxLength: 500 }, // 名称
-  type: { type: String, required: true, maxLength: 10 }, // 0、教室位置 1、开班仪式地点 2、拓展计划地点 3、用餐地点
+  type: { type: String, required: true, maxLength: 10 }, // 0、教室位置 1、开班仪式地点 2拓展训练地点 3、用餐地点
   ibeacon: { type: String, required: false, maxLength: 500 }, // 蓝牙设备号
 };
 

+ 1 - 1
app/service/lesson.js

@@ -354,7 +354,7 @@ class LessonService extends CrudService {
   }
   // 给班主任发信息
   async getHeadTeacherMsg(classInfo) {
-    // 班主任 需要知道 期,批,班,时间段,星期段,礼仪课教师,用餐地点,拓展计划地点,开班仪式地点,上课地点
+    // 班主任 需要知道 期,批,班,时间段,星期段,礼仪课教师,用餐地点,拓展训练地点,开班仪式地点,上课地点
     const { term, batch, headteacher, name, headteacherid, startdate, enddate } = classInfo;
     if (!headteacherid) return;
     let msg = `班主任-${headteacher},中心已经安排您为: ${term}期-${name.includes('班') ? name : `${name}班`} 班主任`;

+ 26 - 0
app/service/util.js

@@ -76,6 +76,32 @@ class UtilService extends CrudService {
     return data;
   }
   async utilMethod(data, body) {
+    // 将指定计划,期数的教师状态解除确认
+    let trainPlan = await this.ctx.model.Trainplan.findById('5f5adb337ceb003386c9b0d4');
+    trainPlan = JSON.parse(JSON.stringify(trainPlan));
+    let terms = {};
+    for (const term of trainPlan.termnum) {
+      if (ObjectId('5f5aed5e69b4221aedaa5005').equals(term._id)) {
+        for (const batch of term.batchnum) {
+          for (const c of batch.class) {
+            for (const l of c.lessons) {
+              l.status = '0';
+            }
+          }
+        }
+        terms = term;
+      }
+    }
+    const i = trainPlan.termnum.findIndex(f => ObjectId('5f5aed5e69b4221aedaa5005').equals(f._id));
+    trainPlan.termnum[i] = terms;
+    delete trainPlan.meta;
+    const r = await this.ctx.model.Trainplan.update(
+      { _id: ObjectId('5f5adb337ceb003386c9b0d4') },
+      { ...trainPlan }
+    );
+    console.log(r);
+
+
     // const output = fs.createWriteStream('E:\\exportFile\\test.zip');
     // const archive = archiver('zip', {
     //   zlib: { level: 9 },