浏览代码

Merge remote-tracking branch 'origin/master'

周箭河 5 年之前
父节点
当前提交
f38dafb69f

+ 1 - 1
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/enums/SysUserType.java

@@ -6,7 +6,7 @@ import com.ym.mec.common.enums.BaseEnum;
 
 public enum SysUserType implements BaseEnum<String, SysUserType> {
 
-	STUDENT("学生"), EDU_TEACHER("教务老师"), TEACHER("指导老师"), SYSTEM("系统內置"), ADMIN("管理员");
+	STUDENT("学生"), EDUCATION("教务老师"), TEACHER("指导老师"), SYSTEM("系统內置"), ADMIN("管理员");
 
 	private String desc;
 

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -278,13 +278,13 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     /**
      * @param month:
-     * @param organId:
+     * @param organIdList:
      * @return java.util.List<java.util.Date>
      * @describe 获取当月有课的日期
      * @author Joburgess
      * @date 2019/10/18
      */
-    List<Date> getCourseScheduleDate(@Param("month") Date month, @Param("organId") Long organId);
+    List<Date> getCourseScheduleDate(@Param("month") Date month, @Param("organIdList") String organIdList);
 
     /**
      * @Author: Joburgess

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseScheduleQueryInfo.java

@@ -12,7 +12,7 @@ import java.util.Date;
 public class CourseScheduleQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "部门编号")
-    private Long organId;
+    private String organIdList;
 
     @ApiModelProperty(value = "上课日期")
     private Date date;
@@ -50,12 +50,12 @@ public class CourseScheduleQueryInfo extends QueryInfo {
         this.classGroupId = classGroupId;
     }
 
-    public Long getOrganId() {
-        return organId;
+    public String getOrganIdList() {
+        return organIdList;
     }
 
-    public void setOrganId(Long organId) {
-        this.organId = organId;
+    public void setOrganIdList(String organIdList) {
+        this.organIdList = organIdList;
     }
 
     public Date getDate() {

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

@@ -167,7 +167,7 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @return java.util.List<java.util.Date>
 	 * @describe 获取
 	 */
-	List<Date> getCourseScheduleDates(Date month);
+	List<Date> getCourseScheduleDates(Date month, String organIdList);
 
 	/**
 	 * @describe 课程调整

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

@@ -305,12 +305,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     }
 
     @Override
-    public List<Date> getCourseScheduleDates(Date month) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (null == user) {
-            throw new BizException("请登录");
-        }
-        return courseScheduleDao.getCourseScheduleDate(month, Long.parseLong(user.getOrganId()));
+    public List<Date> getCourseScheduleDates(Date month, String organIdList) {
+        return courseScheduleDao.getCourseScheduleDate(month, organIdList);
     }
 
     @Override
@@ -354,11 +350,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
     @Override
     public PageInfo getCourseSchedulesWithDateByEdu(CourseScheduleQueryInfo queryInfo) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (null == user) {
-            throw new BizException("请登录");
-        }
-        queryInfo.setOrganId(Long.parseLong(user.getOrganId()));
         PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 
         if (Objects.isNull(queryInfo.getDate())) {

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -454,7 +454,7 @@
             LEFT JOIN teacher_attendance ta ON cs.id_=ta.class_group_id_ AND ta.teacher_id_=cs.teacher_id_
         WHERE
         (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
-        AND mg.organ_id_ = #{organId}
+        AND FIND_IN_SET(mg.organ_id_,#{organIdList})
         AND cs.id_ IS NOT NULL AND cg.group_type_ = 'MUSIC'
         AND cs.class_date_ = DATE_FORMAT(#{date},'%Y-%m-%d')
         <include refid="global.limit"/>
@@ -469,7 +469,7 @@
         LEFT JOIN course_schedule cs ON cg.id_ = cs.class_group_id_
         WHERE
         (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
-        AND mg.organ_id_ = #{organId}
+        AND FIND_IN_SET(mg.organ_id_,#{organIdList})
         AND cs.id_ IS NOT NULL AND cg.group_type_ = 'MUSIC'
         AND cs.class_date_ = DATE_FORMAT(#{date},'%Y-%m-%d')
     </select>
@@ -769,7 +769,7 @@
         LEFT JOIN course_schedule cs ON cg.id_ = cs.class_group_id_
         WHERE
         (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
-        AND mg.organ_id_ = #{organId} AND cs.id_ IS NOT NULL
+        AND FIND_IN_SET(mg.organ_id_,#{organIdList}) AND cs.id_ IS NOT NULL
         <if test="month==null">
             AND DATE_FORMAT( NOW(), '%Y%m' ) = DATE_FORMAT( cs.class_date_, '%Y%m' )
         </if>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -299,7 +299,7 @@
             LEFT JOIN sys_user su ON t.id_ = su.id_
         WHERE
             FIND_IN_SET(#{subjectIds},t.subject_id_)
-            AND INTE_ARRAY ( CONCAT(t.organ_id_,',',t.flow_organ_range_), #{organIds} )
+            AND INTE_ARRAY ( CONCAT( t.organ_id_, IF(t.flow_organ_range_ IS NULL,'',CONCAT(',', t.flow_organ_range_)) ), #{organIds} )
     </select>
     <select id="findByTeacherId" resultMap="TeacherBasicDto">
         SELECT

+ 2 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java

@@ -8,6 +8,7 @@
 package com.ym.mec.common.page;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -130,6 +131,7 @@ public class PageInfo<T> implements Serializable {
 
 	public void setTotal(int total) {
 		this.total = total;
+		this.totalPage=new BigDecimal(total).divide(new BigDecimal(limit),0,BigDecimal.ROUND_CEILING).intValue();
 	}
 
 	public List<T> getRows() {

+ 0 - 15
mec-education/src/main/java/com/ym/mec/education/controller/CourseScheduleController.java

@@ -2,7 +2,6 @@ package com.ym.mec.education.controller;
 
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
@@ -12,14 +11,12 @@ import com.ym.mec.education.resp.CourseScheduleResp;
 import com.ym.mec.education.service.ICourseScheduleService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -65,18 +62,6 @@ public class CourseScheduleController {
         return courseScheduleService.courseInfo(courseScheduleReq);
     }
 
-    @ApiOperation(value = "根据月份获取乐团在该月有课的日期")
-    @GetMapping("/getCourseScheduleDateByMonth")
-    public Object getCourseScheduleDateByMonth(@ApiParam(value = "月份", required = true) @RequestParam Date month) {
-        return BaseResponse.success(scheduleService.getCourseScheduleDates(month));
-    }
-
-    @ApiOperation(value = "根据日期获取当日排课")
-    @GetMapping("/getCourseSchedulesWithDate")
-    public Object getCourseSchedulesWithDate(CourseScheduleQueryInfo queryInfo) {
-        return BaseResponse.success(scheduleService.getCourseSchedulesWithDateByEdu(queryInfo));
-    }
-
     @ApiOperation(value = "课时调整")
     @PostMapping(value = "/classStartDateAdjust")
     public Object classStartDateAdjust(ClassDateAdjustDto classDateAdjustDto){

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -58,7 +58,7 @@ public class TeacherCourseScheduleController extends BaseController {
     @ApiOperation(value = "根据日期获取当日排课")
     @GetMapping("/getCourseSchedulesWithDate")
     public Object getCourseSchedulesWithDate(@ApiParam(value = "日期", required = true) Date date,
-                                             @ApiParam(value = "课程类型",required = false) String type){
+                                             @ApiParam(value = "课程类型") String type){
         if(Objects.isNull(date)){
             return failed("请指定日期!");
         }

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupCategoryController.java

@@ -41,7 +41,7 @@ public class VipGroupCategoryController extends BaseController {
 		if (Objects.isNull(user)) {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
-		return succeed(vipGroupCategoryService.findAllByOrgan(user.getOrganId().toString()));
+		return succeed(vipGroupCategoryService.findAllByOrgan(user.getOrganId()));
 	}
 
 	@ApiOperation("新增")

+ 32 - 3
mec-web/src/main/java/com/ym/mec/web/controller/EducationCourseScheduleController.java → mec-web/src/main/java/com/ym/mec/web/controller/education/EducationCourseScheduleController.java

@@ -1,8 +1,14 @@
-package com.ym.mec.web.controller;
+package com.ym.mec.web.controller.education;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -13,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * @Author Joburgess
@@ -26,17 +33,39 @@ public class EducationCourseScheduleController extends BaseController {
 
     @Autowired
     private CourseScheduleService scheduleService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private SysConfigService sysConfigService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "根据月份获取乐团在该月有课的日期")
     @GetMapping("/getCourseScheduleDateByMonth")
     public Object getCourseScheduleDateByMonth(@ApiParam(value = "月份", required = true) @RequestParam Date month) {
-        return succeed(scheduleService.getCourseScheduleDates(month));
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (null == user) {
+            throw new BizException("请登录");
+        }
+        Employee employee = employeeDao.get(user.getId());
+        if(Objects.isNull(employee)){
+            throw new BizException("员工信息不存在");
+        }
+        return succeed(scheduleService.getCourseScheduleDates(month,employee.getOrganIdList()));
     }
 
     @ApiOperation(value = "根据日期获取当日排课")
     @GetMapping("/getCourseSchedulesWithDate")
     public Object getCourseSchedulesWithDate(CourseScheduleQueryInfo queryInfo) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (null == user) {
+            throw new BizException("请登录");
+        }
+        Employee employee = employeeDao.get(user.getId());
+        if(Objects.isNull(employee)){
+            throw new BizException("员工信息不存在");
+        }
+        queryInfo.setOrganIdList(employee.getOrganIdList());
         return succeed(scheduleService.getCourseSchedulesWithDateByEdu(queryInfo));
     }
-
 }