瀏覽代碼

Merge branch 'master' of http://git.dayaedu.com/yonge/edu-saas

yonge 5 年之前
父節點
當前提交
e71064f95f

+ 1 - 2
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/AuthServerApplication.java

@@ -1,5 +1,6 @@
 package com.keao.edu.auth;
 
+import com.spring4all.swagger.EnableSwagger2Doc;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -12,8 +13,6 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
-import com.spring4all.swagger.EnableSwagger2Doc;
-
 @SpringBootApplication
 @EnableDiscoveryClient
 @EnableFeignClients({"com.keao.edu"})

+ 10 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomController.java

@@ -126,7 +126,16 @@ public class ExamRoomController extends BaseController {
     @ApiOperation("删除教室")
     @PostMapping(value = "/deleteExamRooms")
     public HttpResponseResult deleteExamRooms(String examRoomIds){
-        examRoomService.deleteExamRooms(examRoomIds);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        Integer organId=null;
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeService.get(sysUser.getId());
+            if(Objects.isNull(employee)){
+                return failed("用户信息异常");
+            }
+            organId=employee.getOrganId();
+        }
+        examRoomService.deleteExamRooms(organId,examRoomIds);
         return succeed();
     }
 

+ 30 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomStudentRelationController.java

@@ -8,7 +8,6 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.im.api.entity.PublishMessageDto;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
 import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
-import com.keao.edu.user.dto.NeedCheckingDetailDto;
 import com.keao.edu.user.dto.StuRecordDetailDto;
 import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.page.ExamRoomStudentRelationQueryInfo;
@@ -124,14 +123,32 @@ public class ExamRoomStudentRelationController extends BaseController {
     @ApiOperation("给教室分配学员")
     @PostMapping(value = "/addStudentForRoom")
     public HttpResponseResult addStudentForRoom(Long examRoomId, String registIds){
-        examRoomStudentRelationService.addStudentForRoom(examRoomId, registIds);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        Integer organId=null;
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeService.get(sysUser.getId());
+            if(Objects.isNull(employee)){
+                return failed("用户信息异常");
+            }
+            organId=employee.getOrganId();
+        }
+        examRoomStudentRelationService.addStudentForRoom(examRoomId, registIds, organId);
         return succeed();
     }
 
     @ApiOperation("更换学员考场")
     @PostMapping(value = "/changeStudentExamRoom")
     public HttpResponseResult changeStudentExamRoom(Long registId, Long examRoomId){
-        examRoomStudentRelationService.changeStudentExamRoom(registId, examRoomId);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        Integer organId=null;
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeService.get(sysUser.getId());
+            if(Objects.isNull(employee)){
+                return failed("用户信息异常");
+            }
+            organId=employee.getOrganId();
+        }
+        examRoomStudentRelationService.changeStudentExamRoom(registId, examRoomId, organId);
         return succeed();
     }
 
@@ -151,7 +168,16 @@ public class ExamRoomStudentRelationController extends BaseController {
     @ApiOperation("删除指定教室学员")
     @PostMapping(value = "/deleteStudentFromRoom")
     public HttpResponseResult deleteStudentFromRoom(Long examRoomId, String registIds){
-        examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, registIds);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        Integer organId=null;
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeService.get(sysUser.getId());
+            if(Objects.isNull(employee)){
+                return failed("用户信息异常");
+            }
+            organId=employee.getOrganId();
+        }
+        examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, registIds, organId);
         return succeed();
     }
 }

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java

@@ -54,7 +54,7 @@ public interface ExamRoomService extends BaseService<Long, ExamRoom> {
      * @param examRoomIds:
      * @return void
      */
-    void deleteExamRooms(String examRoomIds);
+    void deleteExamRooms(Integer organId,String examRoomIds);
 
     /**
      * @describe 发送考试安排

+ 3 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomStudentRelationService.java

@@ -31,7 +31,7 @@ public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRo
      * @param registIds:
      * @return void
      */
-    void addStudentForRoom(Long examRoomId, String registIds);
+    void addStudentForRoom(Long examRoomId, String registIds, Integer organId);
 
     /**
      * @describe 更换学员考场
@@ -41,7 +41,7 @@ public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRo
      * @param examRoomId:
      * @return void
      */
-    void changeStudentExamRoom(Long registId, Long examRoomId);
+    void changeStudentExamRoom(Long registId, Long examRoomId, Integer organId);
 
     /**
      * @describe 获取教室学员
@@ -60,7 +60,7 @@ public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRo
      * @param registIds:
      * @return void
      */
-    void deleteStudentFromRoom(Long examRoomId, String registIds);
+    void deleteStudentFromRoom(Long examRoomId, String registIds, Integer organId);
 
     /**
      * 获取教室学员关联

+ 16 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -262,6 +262,11 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
 		ExamRoom existExamRoom = examRoomDao.get(examRoom.getId());
 
+		ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(existExamRoom.getExaminationBasicId(), examRoom.getOrganId());
+		if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
+			throw new BizException("无权操作");
+		}
+
 		if(ExamModeEnum.ONLINE.equals(examRoom.getExamMode())){
 			examRoom.setExamLocationId(null);
 		}
@@ -317,7 +322,7 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void deleteExamRooms(String examRoomIdsStr) {
+	public void deleteExamRooms(Integer organId,String examRoomIdsStr) {
 		if(StringUtils.isBlank(examRoomIdsStr)){
 			return;
 		}
@@ -325,6 +330,11 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
 		ExamRoom examRoom = examRoomDao.get(examRoomIds.get(0));
 
+		ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRoom.getExaminationBasicId(), organId);
+		if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
+			throw new BizException("无权操作");
+		}
+
 		List<ExamRoomStudentRelation> roomStudents = examRoomStudentRelationService.findStudentsWithExamRooms(examRoomIds);
 		List<Long> registIds = roomStudents.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toList());
 
@@ -350,6 +360,11 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 			throw new BizException("考级项目不存在");
 		}
 
+		ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(exam.getId(), organId);
+		if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
+			throw new BizException("无权操作");
+		}
+
 		int withoutExamRoomStudentNum = examRegistrationDao.countWithoutExamRoomStudentNum(null, examId);
 		if(withoutExamRoomStudentNum>0){
 			throw new BizException("存在未安排教室的学员");

+ 23 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -64,6 +64,8 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private SysConfigService sysConfigService;
+	@Autowired
+	private ExamOrganizationRelationDao examOrganizationRelationDao;
 
 	@Override
 	public BaseDAO<Long, ExamRoomStudentRelation> getDAO() {
@@ -77,7 +79,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-	public void addStudentForRoom(Long examRoomId, String registIdsStr) {
+	public void addStudentForRoom(Long examRoomId, String registIdsStr, Integer organId) {
 		if(Objects.isNull(examRoomId)){
 			throw new BizException("请指定教室");
 		}
@@ -88,6 +90,12 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(Objects.isNull(examRoom)){
 			throw new BizException("教室不存在");
 		}
+
+		ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRoom.getExaminationBasicId(), organId);
+		if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
+			throw new BizException("无权操作");
+		}
+
 		ExamLocation examLocation = null;
 		if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
 			examLocation = examLocationDao.get(examRoom.getExamLocationId());
@@ -171,7 +179,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void changeStudentExamRoom(Long registId, Long examRoomId) {
+	public void changeStudentExamRoom(Long registId, Long examRoomId, Integer organId) {
 		if(Objects.isNull(registId)){
 			throw new BizException("请指定报名信息");
 		}
@@ -186,6 +194,12 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(Objects.isNull(examRoom)){
 			throw new BizException("考场信息不存在");
 		}
+
+		ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRoom.getExaminationBasicId(), organId);
+		if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
+			throw new BizException("无权操作");
+		}
+
 		ExamRoomStudentRelation studentExamRoom = examRoomStudentRelationDao.getStudentExamRoom(registId);
 		if(Objects.isNull(studentExamRoom)){
 			studentExamRoom=new ExamRoomStudentRelation();
@@ -246,7 +260,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-	public void deleteStudentFromRoom(Long examRoomId, String registIdsStr) {
+	public void deleteStudentFromRoom(Long examRoomId, String registIdsStr, Integer organId) {
 		if(Objects.isNull(examRoomId)){
 			throw new BizException("请指定教室");
 		}
@@ -254,6 +268,12 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(Objects.isNull(examRoom)){
 			throw new BizException("教室不存在");
 		}
+
+		ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRoom.getExaminationBasicId(), organId);
+		if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
+			throw new BizException("无权操作");
+		}
+
 		if(StringUtils.isBlank(registIdsStr)){
 			return;
 		}

+ 14 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSubjectSongServiceImpl.java

@@ -92,6 +92,20 @@ public class ExamSubjectSongServiceImpl extends BaseServiceImpl<Long, ExamSubjec
 				throw new BizException("请指定报名费用");
 			}
 
+			boolean praNull = Objects.isNull(examSubjectSong.getPracticeNum());
+
+			boolean perNull = Objects.isNull(examSubjectSong.getPerformNum());
+
+			if(praNull&&perNull){
+				throw new BizException("参数错误");
+			}
+
+			if(!praNull){
+				examSubjectSong.setPerformNum(0);
+			}else if(!perNull){
+				examSubjectSong.setPracticeNum(0);
+			}
+
 			examSubjectSong.setTenantId(TenantContextHolder.getTenantId());
 
 			if(existSubjectIds.contains(examSubjectSong.getExamSubjectId().longValue())){

+ 1 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/OrganizationServiceImpl.java

@@ -143,6 +143,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 				employee.setDelFlag(false);
 				employee.setTenantId(organ.getTenantId());
 				employee.setEmployeeType("ORGAN");
+				employee.setOrganId(organization.getId());
 				employeeDao.update(employee);
 				organ.setParentOrganIdTag(currentOrganization.getParentOrganIdTag() + "," + organization.getId());
 				organ.setDelFlag(YesOrNoEnum.NO);

+ 3 - 5
edu-user/edu-user-server/src/main/resources/application.yml

@@ -74,12 +74,10 @@ spring:
         #连接池中的最小空闲连接
         min-idle: 1
 
-
-
 mybatis:
-    mapperLocations: classpath:config/mybatis/*.xml
-    configuration:
-      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  mapperLocations: classpath:config/mybatis/*.xml
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 swagger:
   base-package: com.keao.edu.user.controller