ソースを参照

重做班主任计划: 计划日历&培训计划&班主任计划完成

lrf 9 ヶ月 前
コミット
212e2a9337

+ 1 - 0
app/model/trainplan.js

@@ -46,6 +46,7 @@ const termInfo = new Schema({
   term: { type: String, required: false, maxLength: 200 }, // 期数
   term: { type: String, required: false, maxLength: 200 }, // 期数
   classnum: { type: String, required: false, maxLength: 200 }, // 班级数
   classnum: { type: String, required: false, maxLength: 200 }, // 班级数
   batchnum: { type: [batchInfo], select: true }, // 批
   batchnum: { type: [batchInfo], select: true }, // 批
+  placereteacher: { type: Object, required: false }, // 场地对应的督导教师: placeid:teacherName(手写)
   reteacher: { type: String, required: false, maxLength: 2000 }, // 督导教师, 根据地点多人所以这里应该有问题
   reteacher: { type: String, required: false, maxLength: 2000 }, // 督导教师, 根据地点多人所以这里应该有问题
 });
 });
 
 

+ 2 - 2
app/service/school.js

@@ -131,11 +131,11 @@ class SchoolService extends CrudService {
     let dbStuList = await this.ctx.model.Student.find({ termid, batchid, schid });
     let dbStuList = await this.ctx.model.Student.find({ termid, batchid, schid });
     if (dbStuList.length > 0) {
     if (dbStuList.length > 0) {
       // 查这个学校的这期学生是否修改过班级 或 寝室
       // 查这个学校的这期学生是否修改过班级 或 寝室
-      const is_change = dbStuList.find((f) => f.classid || f.bedroomid);
+      const is_change = dbStuList.find((f) => f.classid ); // || 2024-07-05 修改:f.bedroomid去掉,因为现在不在中心培训了,不管寝室了
       if (is_change) {
       if (is_change) {
         throw new BusinessError(
         throw new BusinessError(
           ErrorCode.BUSINESS,
           ErrorCode.BUSINESS,
-          '上报过的学生已经安排班级或寝室!若需要替换学生,让同性别的学生直接来和班主任说,修改信息即可.若还是有疑问,请和中心负责人联系(最好联系下)'
+          '上报过的学生已经安排班级!若需要替换学生,让同性别的学生直接来和班主任说,修改信息即可.若还是有疑问,请和中心负责人联系(最好联系下)', // 或寝室
         );
         );
       }
       }
     }
     }

+ 2 - 2
app/service/student.js

@@ -136,7 +136,7 @@ class StudentService extends CrudService {
     const result = { total, data };
     const result = { total, data };
     return result;
     return result;
   }
   }
-
+  /**2024-07-25根据寝室和班级找学生信息,用不上了 */
   async findbedroom(data) {
   async findbedroom(data) {
     const { batchid, classid } = data;
     const { batchid, classid } = data;
     const result = [];
     const result = [];
@@ -260,7 +260,7 @@ class StudentService extends CrudService {
     }
     }
   }
   }
 
 
-  // 批量更新寝室号
+  // 批量更新寝室号 2024-07-25不管寝室了,应该用不上了
   async updatabedroom(data) {
   async updatabedroom(data) {
     for (const el of data) {
     for (const el of data) {
       const student = await this.model.findById(el.id);
       const student = await this.model.findById(el.id);

+ 7 - 7
app/service/trainplan.js

@@ -464,7 +464,7 @@ class TrainplanService extends CrudService {
         { key: 'family_is_hard', title: '是否困难' },
         { key: 'family_is_hard', title: '是否困难' },
         { key: 'have_grant', title: ' 是否获得过助学金' },
         { key: 'have_grant', title: ' 是否获得过助学金' },
         // { key: 'job', title: '职务' },
         // { key: 'job', title: '职务' },
-        { key: 'bedroom', title: '寝室号' },
+        // { key: 'bedroom', title: '寝室号' },
         { key: 'is_fine', title: '是否优秀' },
         { key: 'is_fine', title: '是否优秀' },
         { key: 'isComming', title: '是否签到' },
         { key: 'isComming', title: '是否签到' },
         { key: 'selfscore', title: '个人分' },
         { key: 'selfscore', title: '个人分' },
@@ -1148,18 +1148,18 @@ class TrainplanService extends CrudService {
     return res;
     return res;
   }
   }
 
 
-  async updatereteacher({ trainplanid, termid, reteacher }) {
-    assert(trainplanid && termid && reteacher, '缺少参数项');
+  async updatereteacher({ trainplanid, termid, placereteacher }) {
+    assert(trainplanid && termid && placereteacher, '缺少参数项');
     // 根据全年计划表id查出对应的全年计划详细信息
     // 根据全年计划表id查出对应的全年计划详细信息
     const trainplan = await this.model.findById(trainplanid);
     const trainplan = await this.model.findById(trainplanid);
     if (!trainplan) {
     if (!trainplan) {
       throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '全年计划信息不存在');
       throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '全年计划信息不存在');
     }
     }
-    const term = await trainplan.termnum.id(termid);
-    if (term) {
-      term.reteacher = reteacher;
+    const termnum = trainplan.termnum.find((f) => ObjectId(termid).equals(f._id));
+    if (termnum) {
+      termnum.placereteacher = placereteacher;
     }
     }
-    return await trainplan.save();
+    await this.model.updateOne({ _id: trainplanid }, trainplan);
   }
   }
 }
 }
 module.exports = TrainplanService;
 module.exports = TrainplanService;

+ 17 - 15
app/service/user.js

@@ -207,7 +207,7 @@ class UserService extends CrudService {
     let user = await this.model.findOne({ appopenid }).populate({
     let user = await this.model.findOne({ appopenid }).populate({
       path: 'uid',
       path: 'uid',
       model: 'Student',
       model: 'Student',
-      select: 'classid bedroomid',
+      select: 'classid', //2024-07-25 寝室相关移出 bedroomid
       populate: [
       populate: [
         {
         {
           path: 'classid',
           path: 'classid',
@@ -219,11 +219,12 @@ class UserService extends CrudService {
             select: 'name ibeacon',
             select: 'name ibeacon',
           },
           },
         },
         },
-        {
-          path: 'bedroomid',
-          model: 'Bedroom',
-          select: 'code ibeacon',
-        },
+        //2024-07-25 寝室相关移出
+        // {
+        //   path: 'bedroomid',
+        //   model: 'Bedroom',
+        //   select: 'code ibeacon',
+        // },
       ],
       ],
     });
     });
 
 
@@ -232,7 +233,8 @@ class UserService extends CrudService {
       // 整理数据
       // 整理数据
       const { uid } = user;
       const { uid } = user;
       if (uid) {
       if (uid) {
-        const { _id, classid, bedroomid } = uid;
+        //2024-07-25 寝室相关移出 bedroomid
+        const { _id, classid } = uid;
         // 先解析classid
         // 先解析classid
         if (classid) {
         if (classid) {
           const { jslocationid } = classid;
           const { jslocationid } = classid;
@@ -244,14 +246,14 @@ class UserService extends CrudService {
             }
             }
           }
           }
         }
         }
-        // 在解析bedroomid
-        if (bedroomid) {
-          const { code, ibeacon } = bedroomid;
-          if (code && ibeacon) {
-            user.bedroomname = code;
-            user.bedroomibeacon = ibeacon;
-          }
-        }
+        // 2024-07-25 寝室相关移出 解析bedroomid
+        // if (bedroomid) {
+        //   const { code, ibeacon } = bedroomid;
+        //   if (code && ibeacon) {
+        //     user.bedroomname = code;
+        //     user.bedroomibeacon = ibeacon;
+        //   }
+        // }
         user.uid = _id;
         user.uid = _id;
       }
       }
     }
     }

+ 3 - 2
app/service/util.js

@@ -654,11 +654,12 @@ XQIDAQAB
     let type = '0';
     let type = '0';
     if (term.batchnum && term.batchnum.length > 0 && term.batchnum[0].class && term.batchnum[0].class.length > 0) type = term.batchnum[0].class[0].type;
     if (term.batchnum && term.batchnum.length > 0 && term.batchnum[0].class && term.batchnum[0].class.length > 0) type = term.batchnum[0].class[0].type;
     const planyearid = plan.planyearid;
     const planyearid = plan.planyearid;
-    // 检查这个范围的学生是否存在,存在的话是否更改过(classid,bedroomid这两项存不存在可以放过,但凡有一个人,就不行了)
+    // 检查这个范围的学生是否存在,存在的话是否更改过(classid,bedroomid这两项存不存在可以放过,但凡有一个人,就不行了) 
+    //2024-07-25 寝室相关移出
     let dbStuList = await this.ctx.model.Student.find({ planid, termid, batchid });
     let dbStuList = await this.ctx.model.Student.find({ planid, termid, batchid });
     if (dbStuList.length > 0) {
     if (dbStuList.length > 0) {
       // 查这个学校的这期学生是否修改过班级 或 寝室
       // 查这个学校的这期学生是否修改过班级 或 寝室
-      const is_change = dbStuList.find(f => f.classid || f.bedroomid);
+      const is_change = dbStuList.find(f => f.classid ); // f.bedroomid
       if (is_change) {
       if (is_change) {
         throw new BusinessError(
         throw new BusinessError(
           ErrorCode.BUSINESS,
           ErrorCode.BUSINESS,