Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

周箭河 5 gadi atpakaļ
vecāks
revīzija
cbec2757ba

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherAttendancesDto.java

@@ -11,6 +11,9 @@ public class TeacherAttendancesDto {
     @ApiModelProperty(value = "老师名",required = false)
 	private String teacherName;
 
+    @ApiModelProperty(value = "分部名",required = false)
+	private String organName;
+
     @ApiModelProperty(value = "教师编号",required = false)
     private Integer teacherId;
 
@@ -52,6 +55,14 @@ public class TeacherAttendancesDto {
     @ApiModelProperty(value = "签退时间",required = false)
     private Date signOutTime;
 
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
     public String getClassDate() {
         return classDate;
     }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/TeacherCloseQueryInfo.java

@@ -19,6 +19,9 @@ public class TeacherCloseQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "课程类型")
     private String courseScheduleType;
 
+    @ApiModelProperty(value = "课程状态")
+    private String courseScheduleStatus;
+
     @ApiModelProperty(value = "课程名称")
     private String classGroupName;
 
@@ -31,6 +34,14 @@ public class TeacherCloseQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "分部")
     private String organId;
 
+    public String getCourseScheduleStatus() {
+        return courseScheduleStatus;
+    }
+
+    public void setCourseScheduleStatus(String courseScheduleStatus) {
+        this.courseScheduleStatus = courseScheduleStatus;
+    }
+
     public String getSignOutStatus() {
         return signOutStatus;
     }

+ 30 - 27
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -1346,6 +1346,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             checkTeacherLeaveDate = false;
         }
 
+        SysConfig practiceFreeApplyExpireDateConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
+        Date practiceFreeApplyExpireDate = DateUtil.stringToDate(practiceFreeApplyExpireDateConfig.getParanValue());
+
         Date now = new Date();
         if (now.before(applyStartDay)) {
             now = applyStartDay;
@@ -1356,13 +1359,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         calendar.set(Calendar.MINUTE, 0);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        while (calendar.getTime().before(activityEndDate)) {
+        while (calendar.getTime().before(practiceFreeApplyExpireDate)) {
             calendar.add(Calendar.DATE, 1);
             Date applyStartDay = calendar.getTime();
             calendar.add(Calendar.DATE, 6);
             Date applyEndDay = calendar.getTime();
-            if (applyEndDay.after(activityEndDate)) {
-                applyEndDay = activityEndDate;
+            if (applyEndDay.after(practiceFreeApplyExpireDate)) {
+                applyEndDay = practiceFreeApplyExpireDate;
             }
             Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDay, Calendar.MONDAY);
             Date secondMonday = DateUtil.getWeekDayWithDate(applyEndDay, Calendar.MONDAY);
@@ -1698,18 +1701,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             practiceGroup.setSecondCourseTime(practiceGroup.getFirstCourseTime());
             practiceGroup.setFirstCourseTime(tmp);
         }
-        if (practiceGroup.getFirstCourseTime().before(now)
-                || practiceGroup.getFirstCourseTime().after(activityEndDate)) {
-            result.put("status", "APPLY_DATE_OVERFLOW");
-            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-            return result;
-        }
-        if (practiceGroup.getSecondCourseTime().before(now)
-                || practiceGroup.getSecondCourseTime().after(activityEndDate)) {
-            result.put("status", "APPLY_DATE_OVERFLOW");
-            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-            return result;
-        }
+//        if (practiceGroup.getFirstCourseTime().before(now)
+//                || practiceGroup.getFirstCourseTime().after(activityEndDate)) {
+//            result.put("status", "APPLY_DATE_OVERFLOW");
+//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
+//            return result;
+//        }
+//        if (practiceGroup.getSecondCourseTime().before(now)
+//                || practiceGroup.getSecondCourseTime().after(activityEndDate)) {
+//            result.put("status", "APPLY_DATE_OVERFLOW");
+//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
+//            return result;
+//        }
         if (DateUtil.isSameDay(practiceGroup.getFirstCourseTime(), practiceGroup.getSecondCourseTime())) {
             result.put("status", "TWO_DATE_ON_ONE_DAY");
             result.put("info", "预约失败,网管课选择时间重复,请重试。");
@@ -1758,18 +1761,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             allCourseDates.remove(3);
             allCourseDates.add(DateUtil.addDays(tempDate, 7));
         }
-        if (allCourseDates.get(2).before(now)
-                || allCourseDates.get(2).after(courseExpireDate)) {
-            result.put("status", "APPLY_DATE_OVERFLOW");
-            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-            return result;
-        }
-        if (allCourseDates.get(3).before(now)
-                || allCourseDates.get(3).after(courseExpireDate)) {
-            result.put("status", "APPLY_DATE_OVERFLOW");
-            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
-            return result;
-        }
+//        if (allCourseDates.get(2).before(now)
+//                || allCourseDates.get(2).after(courseExpireDate)) {
+//            result.put("status", "APPLY_DATE_OVERFLOW");
+//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
+//            return result;
+//        }
+//        if (allCourseDates.get(3).before(now)
+//                || allCourseDates.get(3).after(courseExpireDate)) {
+//            result.put("status", "APPLY_DATE_OVERFLOW");
+//            result.put("info", "预约失败,网管课的时间超出活动时间范围(2020-5-31之前),请重试。");
+//            return result;
+//        }
         allCourseDates.sort(Comparator.comparing(Date::getTime));
 
         studentDao.lockUser(practiceGroup.getStudentId());

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -425,7 +425,7 @@ public class StudentManageServiceImpl implements StudentManageService {
         student.setServiceTag(sysUser.getServiceTag());
         student.setTeacherId(sysUser.getTeacherId());
         studentService.upSet(student);
-        if(new Integer(1).equals(student.getServiceTag())){
+        if(new Integer(0).equals(student.getServiceTag())){
             studentExtracurricularExercisesSituationDao.deleteByStudent(sysUser.getId());
         }
         return userId;

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

@@ -123,7 +123,7 @@ public class StudentServeServiceImpl implements StudentServeService {
                     long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
                     studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
                     if(replyNum>0){
-                        Date lastSubmitTime = studentHomeworks.stream().max(Comparator.comparing(StudentServeCourseHomeworkDto::getSubmitTime)).get().getSubmitTime();
+                        Date lastSubmitTime = studentHomeworks.stream().filter(e->Objects.nonNull(e.getSubmitTime())).max(Comparator.comparing(StudentServeCourseHomeworkDto::getSubmitTime)).get().getSubmitTime();
                         studentExtracurricularExercisesSituation.setLastSubmitTime(lastSubmitTime);
                     }
                     int exercisesMessageNum=0;
@@ -160,7 +160,7 @@ public class StudentServeServiceImpl implements StudentServeService {
                 long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
                 studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
                 if(replyNum>0){
-                    Date lastSubmitTime = studentExercises.stream().max(Comparator.comparing(ExtracurricularExercisesReply::getSubmitTime)).get().getSubmitTime();
+                    Date lastSubmitTime = studentExercises.stream().filter(e->Objects.nonNull(e.getSubmitTime())).max(Comparator.comparing(ExtracurricularExercisesReply::getSubmitTime)).get().getSubmitTime();
                     studentExtracurricularExercisesSituation.setLastSubmitTime(lastSubmitTime);
                 }
                 int exercisesMessageNum=0;

+ 9 - 4
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -174,6 +174,7 @@
         <result column="course_schedule_status_" property="courseScheduleStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="course_schedule_name_" property="courseScheduleName"/>
         <result column="teacher_name_" property="teacherName"/>
+        <result column="organ_name_" property="organName"/>
         <result column="teacher_id_" property="teacherId"/>
         <result column="sign_in_status_" property="signInStatus"/>
         <result column="sign_out_status_" property="signOutStatus"/>
@@ -221,10 +222,10 @@
             <if test="search != null and search != ''">
                 AND (su.id_ = #{search} OR su.real_name_ LIKE CONCAT('%',#{search},'%') OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%'))
             </if>
-            <if test="courseStartDate != null">
+            <if test="courseStartDate != null and courseStartDate != ''">
                 AND cs.class_date_ &gt;= #{courseStartDate}
             </if>
-            <if test="courseEndDate != null">
+            <if test="courseEndDate != null and courseEndDate != ''">
                 AND cs.class_date_ &lt;= #{courseEndDate}
             </if>
             <if test="signInStatus != null and signInStatus != '' and signInStatus != 3">
@@ -239,9 +240,12 @@
             <if test="signInStatus != null and signInStatus != '' and signInStatus == 3">
                 AND ta.sign_in_status_ IS NULL
             </if>
-            <if test="courseScheduleType != null">
+            <if test="courseScheduleType != null  and courseScheduleType != ''">
                 AND cs.type_ = #{courseScheduleType}
             </if>
+            <if test="courseScheduleStatus != null  and courseScheduleStatus != ''">
+                AND cs.status_ = #{courseScheduleStatus}
+            </if>
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(t.organ_id_,#{organId})
             </if>
@@ -268,11 +272,12 @@
         cs.class_date_,cs.start_class_time_,cs.end_class_time_,cs.type_ course_schedule_type_,
         IF(ta.sign_in_status_ IS NULL,3,ta.sign_in_status_) sign_in_status_,
         IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
-        ta.sign_in_time_,ta.sign_out_time_,ta.remark_
+        ta.sign_in_time_,ta.sign_out_time_,ta.remark_,o.name_ organ_name_
         FROM course_schedule cs
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
         LEFT JOIN teacher t ON t.id_ = ta.teacher_id_
         LEFT JOIN sys_user su ON su.id_ = t.id_
+        LEFT JOIN organization o ON o.id_ = t.organ_id_
         <include refid="queryTeacherAttendancesCondition"/>
         ORDER BY cs.class_date_ ASC,cs.start_class_time_ ASC
         <include refid="global.limit"/>

+ 14 - 14
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -55,7 +55,7 @@ public class PracticeGroupController extends BaseController {
     @Autowired
     private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
 
-    private static final Set<Integer> ENABLE_APPLY_ORGANIDS = new HashSet<>(Arrays.asList(new Integer[]{28,34,37}));
+//    private static final Set<Integer> ENABLE_APPLY_ORGANIDS = new HashSet<>(Arrays.asList(new Integer[]{28,34,37}));
 
     @ApiOperation("获取学生的陪练课")
     @GetMapping(value = "/findUserPracticeCourses")
@@ -75,12 +75,12 @@ public class PracticeGroupController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         Map<String,Object> result=practiceGroupService.checkCanApplyFreePracticeGroup(sysUser.getId());
-        if(ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
-            Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(sysUser.getId());
-            result.put("canApply", applyTimes < 1 ? 1 : 0);
-        }else{
-            result.put("canApply", 0);
-        }
+//        if(ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
+        Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(sysUser.getId());
+        result.put("canApply", applyTimes < 1 ? 1 : 0);
+//        }else{
+//            result.put("canApply", 0);
+//        }
         result.put("organId", sysUser.getOrganId());
         return succeed(result);
     }
@@ -93,12 +93,12 @@ public class PracticeGroupController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         Map<String,Object> result=practiceGroupService.getPracticeApplyParams(sysUser.getId());
-        if(ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
+//        if(ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
             Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(sysUser.getId());
             result.put("enableApply", applyTimes < 1 ? 1 : 0);
-        }else{
-            result.put("enableApply", 0);
-        }
+//        }else{
+//            result.put("enableApply", 0);
+//        }
         return succeed(result);
     }
 
@@ -152,9 +152,9 @@ public class PracticeGroupController extends BaseController {
         if(excludeOrganIds.contains(sysUser.getOrganId())){
             throw new BizException("请联系老师确认您的所属分部");
         }
-        if(!ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
-            throw new BizException("陪练课预约活动已结束");
-        }
+//        if(!ENABLE_APPLY_ORGANIDS.contains(sysUser.getOrganId())){
+//            throw new BizException("陪练课预约活动已结束");
+//        }
         practiceGroup.setStudentId(sysUser.getId());
         return succeed(practiceGroupService.practiceApply(practiceGroup));
     }