zouxuan 5 yıl önce
ebeveyn
işleme
e4bd8a8644

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupStudentMapperService.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.service.BaseService;
 
+import java.io.IOException;
 import java.util.List;
 
 public interface ClassGroupStudentMapperService extends BaseService<Long, ClassGroupStudentMapper> {
@@ -52,4 +53,11 @@ public interface ClassGroupStudentMapperService extends BaseService<Long, ClassG
      * @throws Exception
      */
     boolean addStudents(Integer classGroupId, String userIdsStr, GroupType groupType) throws Exception;
+
+    /**
+     * 获取节假日
+     * @param year
+     * @return
+     */
+    Object queryHoliday(String year) throws IOException;
 }

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -1632,12 +1632,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             dataList.forEach(e -> {
                 e.setMixClassGroupName(classGroupNames.get(e.getMixClassGroupId()));
                 List<CourseScheduleTeacherSalary> currentBishopTeacher = courseScheduleBishopTeacherMaps.get(e.getCourseScheduleId().longValue());
+                List<CourseScheduleTeacherSalary> TeachingTeachers = new ArrayList<>();
                 if (!Objects.isNull(currentBishopTeacher)&&!CollectionUtils.isEmpty(currentBishopTeacher)) {
                     e.setMasterTeacherId(currentBishopTeacher.get(0).getUserId());
                     e.setMasterTeacherName(currentBishopTeacher.get(0).getUserName());
+                }else {
+                    currentBishopTeacher = new ArrayList<>();
                 }
+                TeachingTeachers.addAll(currentBishopTeacher);
                 List<CourseScheduleTeacherSalary> currentCourseTeachingTeachers = courseScheduleTeachingTeacherMaps.get(e.getCourseScheduleId().longValue());
-                if (CollectionUtils.isEmpty(currentCourseTeachingTeachers)&&!CollectionUtils.isEmpty(currentBishopTeacher)) {
+                if(Objects.isNull(currentCourseTeachingTeachers) || CollectionUtils.isEmpty(currentCourseTeachingTeachers)){
+                    currentCourseTeachingTeachers = new ArrayList<>();
+                }
+                TeachingTeachers.addAll(currentCourseTeachingTeachers);
+                e.setTeachingTeachers(TeachingTeachers);
+                e.setTeacherNum(TeachingTeachers.size());
+                /*if (CollectionUtils.isEmpty(currentCourseTeachingTeachers) && !CollectionUtils.isEmpty(currentBishopTeacher)) {
                     currentCourseTeachingTeachers = new ArrayList<>();
                     if (currentBishopTeacher != null) {
                         currentCourseTeachingTeachers.add(currentBishopTeacher.get(0));
@@ -1650,7 +1660,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     }
                     e.setTeachingTeachers(currentCourseTeachingTeachers);
                     e.setTeacherNum(currentCourseTeachingTeachers.size());
-                }
+                }*/
             });
         }
         if (count == 0) {

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -11,10 +11,12 @@ import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
+import com.ym.mec.util.http.HttpUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
 
@@ -37,6 +39,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
     @Autowired
     private ImFeignService imFeignService;
 
+    private static String holidayUrl = "http://tool.bitefu.net/jiari/?d=";
+
     @Override
     public BaseDAO<Long, ClassGroupStudentMapper> getDAO() {
         return classGroupStudentMapperDao;
@@ -227,4 +231,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
         return true;
     }
+
+    @Override
+    public Object queryHoliday(String year) throws IOException {
+        return HttpUtil.get(holidayUrl + year,null);
+    }
 }

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -574,7 +574,7 @@
         IF(ISNULL(ta.sign_out_status_),3,ta.sign_out_status_) sign_out_status_
         FROM course_schedule cs
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
-        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
+        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_ AND ta.teacher_id_ = cs.actual_teacher_id_
         LEFT JOIN class_group_relation cgr ON cgr.sub_class_group_id_ = cs.class_group_id_
         LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cs.class_group_id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
@@ -586,7 +586,7 @@
         SELECT COUNT(cs.id_)
         FROM course_schedule cs
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
-        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
+        LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_ AND ta.teacher_id_ = cs.actual_teacher_id_
         LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cs.class_group_id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
     </select>

+ 14 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupStudentController.java

@@ -11,10 +11,13 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.IOException;
+
 @RequestMapping("classGroupStudent")
 @Api(tags = "班级学生服务")
 @RestController
@@ -65,4 +68,15 @@ public class ClassGroupStudentController extends BaseController {
         return succeed(classGroupStudentMapperService.addStudents(classGroupId, userIdsStr, GroupType.MUSIC));
     }
 
+    /**
+     * 获取节假日
+     * @param year
+     * @return
+     */
+    @ApiOperation(value = "获取节假日")
+    @GetMapping("/queryHoliday")
+    @PreAuthorize("@pcs.hasPermissions('classGroupStudent/queryHoliday')")
+    public Object queryHoliday(String year) throws IOException {
+        return succeed(classGroupStudentMapperService.queryHoliday(year));
+    }
 }