Explorar o código

Merge remote-tracking branch 'origin/master'

zouxuan %!s(int64=4) %!d(string=hai) anos
pai
achega
48d1d64f9b

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

@@ -50,6 +50,9 @@ public class StudentAttendanceQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "课程结束时间")
     private Date endDateOfCourse;
 
+    @ApiModelProperty(value = "分部")
+    private String organId;
+
     public Long getCourseScheduleId() {
         return courseScheduleId;
     }
@@ -145,4 +148,12 @@ public class StudentAttendanceQueryInfo extends QueryInfo {
 	public void setEndDateOfCourse(Date endDateOfCourse) {
 		this.endDateOfCourse = endDateOfCourse;
 	}
+
+	public String getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(String organId) {
+		this.organId = organId;
+	}
 }

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -526,6 +526,9 @@
         	<if test="musicGroupId != null">
         		and cssp.music_group_id_ = #{musicGroupId}
         	</if>
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(cs.organ_id_,#{organId})
+            </if>
         </where>
         ORDER BY cs.id_ DESC
         <include refid="global.limit"/>
@@ -569,6 +572,9 @@
         	<if test="musicGroupId != null">
         		and cssp.music_group_id_ = #{musicGroupId}
         	</if>
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(cs.organ_id_,#{organId})
+            </if>
         </where>
     </select>
     <select id="findByCourseId" resultMap="StudentAttendance">

+ 29 - 0
mec-web/src/main/java/com/ym/mec/web/controller/student/StudentAttendanceController.java

@@ -1,8 +1,12 @@
 package com.ym.mec.web.controller.student;
 
+import java.util.Arrays;
+import java.util.List;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -11,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+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.dto.StudentAttendanceDto;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
@@ -28,6 +36,10 @@ public class StudentAttendanceController extends BaseController {
     private StudentAttendanceService studentAttendanceService;
     @Autowired
     private ClassGroupService classGroupService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     //修复逻辑:是连堂课,有签退记录,某个月,遍历有学员签到记录的每节课
     @GetMapping("/repairStudentAttendance")
@@ -55,6 +67,23 @@ public class StudentAttendanceController extends BaseController {
     @GetMapping("/findStudentAttendance")
     @PreAuthorize("@pcs.hasPermissions('studentAttendance/findStudentAttendance')")
     public Object findStudentAttendance(StudentAttendanceQueryInfo queryInfo){
+    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+                return failed("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                    return failed("非法请求");
+                }
+            }
+        }
         return succeed(studentAttendanceService.findStudentAttendance(queryInfo));
     }