zouxuan 5 years ago
parent
commit
2ddbec94e7

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SchoolDao.java

@@ -15,7 +15,7 @@ public interface SchoolDao extends BaseDAO<Integer, School> {
      * @param organId
      * @return
      */
-    List<School> queryByOrganId(@Param("organId") Integer organId);
+    List<School> queryByOrganId(@Param("organId") String organId);
 
     /**
      * 根据学校编号列表获取学校名称map

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

@@ -12,7 +12,7 @@ public interface SchoolService extends BaseService<Integer, School> {
      * @param organId
      * @return
      */
-    List<School> queryByOrganId(Integer organId);
+    List<School> queryByOrganId(String organId);
 
     /**
      * @describe 获取教师vip课教学点

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

@@ -24,7 +24,7 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School>  impleme
 	}
 
 	@Override
-	public List<School> queryByOrganId(Integer organId) {
+	public List<School> queryByOrganId(String organId) {
 		return schoolDao.queryByOrganId(organId);
 	}
 

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

@@ -358,7 +358,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 			CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId.longValue());
 			ClassGroup classGroup = classGroupDao.findByCourseSchedule(courseScheduleId);
 			if(classGroup != null && courseSchedule != null){
-				int advanceSignMinutes = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_IN_MINUTES));
+//				int advanceSignMinutes = Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_SIGN_IN_MINUTES));
 				Date date = new Date();
 				String classDate = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
 				String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
@@ -372,7 +372,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 					studentAttendance = new StudentAttendance();
 					studentAttendance.setClassGroupId(classGroup.getId());
 					studentAttendance.setCourseScheduleId(courseScheduleId.longValue());
-					studentAttendance.setCurrentClassTimes(classGroup.getCurrentClassTimes());
+					studentAttendance.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
 					studentAttendance.setGroupType(classGroup.getGroupType());
 					studentAttendance.setMusicGroupId(classGroup.getMusicGroupId());
 					studentAttendance.setStatus(statusEnum);

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

@@ -112,7 +112,7 @@
         <where>
             del_flag_ = 0
             <if test="organId != null">
-                AND organ_id_ = #{organId}
+                AND FIND_IN_SET(organ_id_,#{organId})
             </if>
         </where>
     </select>

+ 29 - 1
mec-web/src/main/java/com/ym/mec/web/controller/SchoolController.java

@@ -1,5 +1,9 @@
 package com.ym.mec.web.controller;
 
+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.entity.School;
 import com.ym.mec.biz.dal.page.SchoolQueryInfo;
 import com.ym.mec.biz.service.SchoolService;
@@ -7,11 +11,14 @@ import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+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.*;
 
+import java.util.Arrays;
 import java.util.Date;
+import java.util.List;
 
 @RequestMapping("school")
 @Api(tags = "学校(教学点)服务")
@@ -20,6 +27,10 @@ public class SchoolController extends BaseController {
 
     @Autowired
     private SchoolService schoolService;
+    @Autowired
+    private EmployeeDao employeeDao;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "新增学校")
     @PostMapping("/add")
@@ -63,7 +74,24 @@ public class SchoolController extends BaseController {
     @ApiOperation(value = "根据机构编号获取学校列表")
     @GetMapping("/queryByOrganId")
     @PreAuthorize("@pcs.hasPermissions('school/queryByOrganId')")
-    public Object queryByOrganId(@RequestParam Integer organId){
+    public Object queryByOrganId(String organId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(organId)) {
+                organId = employee.getOrganIdList();
+            }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+                return failed("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(organId.split(",")))){
+                    return failed("非法请求");
+                }
+            }
+        }
         return succeed(schoolService.queryByOrganId(organId));
     }