Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

周箭河 5 gadi atpakaļ
vecāks
revīzija
5e44548ac4
36 mainītis faili ar 625 papildinājumiem un 123 dzēšanām
  1. 6 0
      edu-im/edu-im-server/pom.xml
  2. 29 15
      edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/ExamRoom.java
  3. 1 1
      edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/enums/ExamModeEnum.java
  4. 2 2
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamReviewController.java
  5. 5 5
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomController.java
  6. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectController.java
  7. 23 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamTeacherSalaryController.java
  8. 0 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentExamResultController.java
  9. 2 2
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/TenantInfoController.java
  10. 1 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRoomDao.java
  11. 35 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamTeacherSalaryDao.java
  12. 6 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/TeacherDao.java
  13. 63 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/BaseUserInfoDto.java
  14. 20 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/TeacherDto.java
  15. 12 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamCertification.java
  16. 11 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamReview.java
  17. 1 2
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamTeacherSalary.java
  18. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExaminationBasic.java
  19. 12 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/StudentExamResult.java
  20. 35 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamTeacherSalaryService.java
  21. 6 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java
  22. 40 5
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java
  23. 101 4
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java
  24. 1 2
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExaminationBasicServiceImpl.java
  25. 3 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/OrganizationServiceImpl.java
  26. 1 4
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java
  27. 8 4
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamCertificationMapper.xml
  28. 16 9
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamOrganizationRelationMapper.xml
  29. 33 20
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml
  30. 13 6
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamReviewMapper.xml
  31. 24 8
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml
  32. 7 5
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml
  33. 59 2
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamTeacherSalaryMapper.xml
  34. 24 13
      edu-user/edu-user-server/src/main/resources/config/mybatis/StudentExamResultMapper.xml
  35. 11 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/SysUserMapper.xml
  36. 12 1
      edu-user/edu-user-server/src/main/resources/config/mybatis/TeacherMapper.xml

+ 6 - 0
edu-im/edu-im-server/pom.xml

@@ -65,6 +65,12 @@
 		<dependency>
 			<groupId>com.keao.edu</groupId>
 			<artifactId>edu-auth-api</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>com.keao.edu</groupId>
+					<artifactId>edu-thirdparty</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>com.keao.edu</groupId>

+ 29 - 15
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/ExamRoom.java

@@ -1,6 +1,8 @@
 package com.keao.edu.user.api.entity;
 
 import com.keao.edu.common.enums.YesOrNoEnum;
+import com.keao.edu.user.api.enums.ExamModeEnum;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.util.Date;
@@ -10,29 +12,33 @@ import java.util.Date;
  */
 public class ExamRoom {
 
-	/**  */
 	private Long id;
 
+	@ApiModelProperty(value = "考级项目编号")
 	private Integer examinationBasicId;
 	
-	/** 考试模式(线上/线下) */
-	private String examMode;
+	@ApiModelProperty(value = "考试模式")
+	private ExamModeEnum examMode;
 	
-	/** 考点 */
+	@ApiModelProperty(value = "考点编号")
 	private Integer examLocationId;
 	
-	/** 考试专业(多选,逗号分隔) */
+	@ApiModelProperty(value = "考试专业")
 	private String subjectIdList;
 	
-	/** 主考老师 */
+	@ApiModelProperty(value = "主考老师编号")
 	private Integer mainTeacherUserId;
 	
-	/** 助考老师(多个用逗号分隔) */
+	@ApiModelProperty(value = "助考老师(多个用逗号分隔)")
 	private String assistantTeacherUserIdList;
+
+	@ApiModelProperty(value = "考试时间:[{'examStartTime':'','examEndTime':''}]")
+	private String examTimeJson;
 	
-	/** 考试时间 */
+	@ApiModelProperty(value = "考试开始时间")
 	private Date examStartTime;
 
+	@ApiModelProperty(value = "考试结束时间")
 	private Date examEndTime;
 
 	private Integer organId;
@@ -69,14 +75,14 @@ public class ExamRoom {
 		this.examinationBasicId = examinationBasicId;
 	}
 
-	public void setExamMode(String examMode){
-		this.examMode = examMode;
+	public ExamModeEnum getExamMode() {
+		return examMode;
 	}
-	
-	public String getExamMode(){
-		return this.examMode;
+
+	public void setExamMode(ExamModeEnum examMode) {
+		this.examMode = examMode;
 	}
-			
+
 	public void setExamLocationId(Integer examLocationId){
 		this.examLocationId = examLocationId;
 	}
@@ -132,7 +138,15 @@ public class ExamRoom {
 	public java.util.Date getCreateTime(){
 		return this.createTime;
 	}
-			
+
+	public String getExamTimeJson() {
+		return examTimeJson;
+	}
+
+	public void setExamTimeJson(String examTimeJson) {
+		this.examTimeJson = examTimeJson;
+	}
+
 	public void setUpdateTime(java.util.Date updateTime){
 		this.updateTime = updateTime;
 	}

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/enums/ExamModeEnum.java → edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/enums/ExamModeEnum.java

@@ -1,4 +1,4 @@
-package com.keao.edu.user.enums;
+package com.keao.edu.user.api.enums;
 
 import com.keao.edu.common.enums.BaseEnum;
 

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamReviewController.java

@@ -22,7 +22,7 @@ import java.util.Objects;
 
 @RestController
 @RequestMapping("examReview")
-@Api(tags = "考场服务")
+@Api(tags = "评审服务")
 public class ExamReviewController extends BaseController {
 
     @Autowired
@@ -52,7 +52,7 @@ public class ExamReviewController extends BaseController {
         return succeed();
     }
 
-    @ApiModelProperty("创建评审")
+    @ApiOperation("创建评审")
     @PostMapping(value = "/createExamReview")
     public HttpResponseResult createExamReview(ExamReview examReview){
         examReviewService.insert(examReview);

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

@@ -58,7 +58,7 @@ public class ExamRoomController extends BaseController {
         return succeed();
     }
 
-    @ApiModelProperty("创建教室")
+    @ApiOperation("创建教室")
     @PostMapping(value = "/createExamRoom")
     public HttpResponseResult createExamRoom(@RequestBody ExamRoom examRoom){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
@@ -67,7 +67,7 @@ public class ExamRoomController extends BaseController {
         return succeed();
     }
 
-    @ApiModelProperty("更新教室信息")
+    @ApiOperation("更新教室信息")
     @PostMapping(value = "/updateExamRoom")
     public HttpResponseResult<ExamRoom> updateExamRoom(@RequestBody ExamRoom examRoom){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
@@ -75,20 +75,20 @@ public class ExamRoomController extends BaseController {
         return succeed(examRoomService.updateExamRoom(examRoom));
     }
 
-    @ApiModelProperty("删除教室")
+    @ApiOperation("删除教室")
     @PostMapping(value = "/deleteExamRooms")
     public HttpResponseResult deleteExamRooms(String examRoomIds){
         examRoomService.deleteExamRooms(examRoomIds);
         return succeed();
     }
 
-    @ApiModelProperty("获取教室")
+    @ApiOperation("获取教室")
     @GetMapping(value = "/get")
     public ExamRoom getExamRoom(Long id){
         return examRoomService.get(id);
     }
 
-    @ApiModelProperty("获取考场统计信息")
+    @ApiOperation("获取考场统计信息")
     @GetMapping(value = "/getExamRoomStatisticsInfo")
     public HttpResponseResult<ExamRoomStatisticsDto> getExamRoomStatisticsInfo(Integer examId){
         SysUser sysUser = sysUserFeignService.queryUserInfo();

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

@@ -16,7 +16,7 @@ import java.util.List;
 
 @RestController
 @RequestMapping("examSubject")
-@Api(tags = "考级项目考级专业服务")
+@Api(tags = "考级专业服务")
 public class ExamSubjectController extends BaseController {
 
     @Autowired

+ 23 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamTeacherSalaryController.java

@@ -3,6 +3,8 @@ package com.keao.edu.user.controller;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
 import com.keao.edu.user.page.ExamTeacherSalaryQueryInfo;
 import com.keao.edu.user.service.ExamTeacherSalaryService;
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @Author Joburgess
@@ -20,7 +23,7 @@ import java.util.Date;
  */
 @RestController
 @RequestMapping("examTeacherSalary")
-@Api(tags = "考级项目评审教室分润")
+@Api(tags = "考级项目教师服务")
 public class ExamTeacherSalaryController extends BaseController {
 
     @Autowired
@@ -42,6 +45,19 @@ public class ExamTeacherSalaryController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("新增考级教师")
+    @PostMapping(value = "/addExamTeacherSalary")
+    public HttpResponseResult addExamTeacherSalary(Integer examId, String teacherIdsStr) {
+        examTeacherSalaryService.addExamTeacherSalary(examId, teacherIdsStr);
+        return succeed();
+    }
+
+    @ApiOperation("获取指定考级项目可排考教师")
+    @GetMapping(value = "/getExamTeachers")
+    public HttpResponseResult<List<BaseUserInfoDto>> getExamTeachers(Integer examId){
+        return succeed(examTeacherSalaryService.getExamTeachers(examId));
+    }
+
     @ApiOperation("更新")
     @PostMapping(value = "/update")
     public HttpResponseResult update(ExamTeacherSalary examTeacherSalary) {
@@ -57,4 +73,10 @@ public class ExamTeacherSalaryController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("获取与考级项目无关的教师")
+    @GetMapping(value = "/getUnRelatedWithExamTeachers")
+    public HttpResponseResult<PageInfo<TeacherDto>> getUnRelatedWithExamTeachers(ExamTeacherSalaryQueryInfo queryInfo){
+        return succeed(examTeacherSalaryService.getUnRelatedWithExamTeachers(queryInfo));
+    }
+
 }

+ 0 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentExamResultController.java

@@ -49,9 +49,6 @@ public class StudentExamResultController extends BaseController {
                 queryInfo.setOrganId(employee.getOrganId());
             }
         }
-        if(){
-
-        }
         return succeed(studentExamResultService.queryStudentExamResult(queryInfo));
     }
 

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/TenantInfoController.java

@@ -56,8 +56,8 @@ public class TenantInfoController extends BaseController {
 	}
 
 	@ApiOperation("删除")
-	@PostMapping(value = "/del/{id}")
-	public HttpResponseResult add(@PathVariable("id") Integer id) {
+	@PostMapping(value = "/del")
+	public HttpResponseResult add(Integer id) {
 		return succeed(tenantInfoService.delete(id));
 	}
 

+ 1 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRoomDao.java

@@ -11,6 +11,7 @@ import java.util.Map;
 
 public interface ExamRoomDao extends BaseDAO<Long, ExamRoom> {
 
+    int batchInsert(@Param("examRooms") List<ExamRoom> examRooms);
 
     /**
      * COUNT教师考试列表

+ 35 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamTeacherSalaryDao.java

@@ -2,13 +2,19 @@ package com.keao.edu.user.dao;
 
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.entity.Teacher;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ExamTeacherSalaryDao extends BaseDAO<Long, ExamTeacherSalary> {
 
+    int batchInsert(@Param("examTeacherSalaries") List<ExamTeacherSalary> examTeacherSalaries);
+
     int batchUpdate(@Param("teacherSalaries") List<ExamTeacherSalary> teacherSalaries);
 
     /**
@@ -20,4 +26,33 @@ public interface ExamTeacherSalaryDao extends BaseDAO<Long, ExamTeacherSalary> {
      */
     List<ExamTeacherSalary> queryWithExam(@Param("examId") Integer examId);
 
+    /**
+     * @describe 获取指定考级项目下教师的基本信息
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.dto.BaseUserInfoDto>
+     */
+    List<BaseUserInfoDto> getTeachersWithExam(@Param("examId") Integer examId);
+
+    /**
+     * @describe 获取指定考级项目下指定老师的分润设置
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @param teacherIds:
+     * @return java.util.List<com.keao.edu.user.entity.ExamTeacherSalary>
+     */
+    List<ExamTeacherSalary> getWithExamAndTeacher(@Param("examId") Integer examId,
+                                                  @Param("teacherIds") List<Integer> teacherIds);
+
+    /**
+     * @describe 获取与考级项目无关的教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param params:
+     * @return java.util.List<com.keao.edu.user.entity.Teacher>
+     */
+    List<TeacherDto> queryUnRelatedWithExamTeachers(Map<String, Object> params);
+    int countUnRelatedWithExamTeachers(Map<String, Object> params);
 }

+ 6 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/TeacherDao.java

@@ -3,7 +3,12 @@ package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.entity.Teacher;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface TeacherDao extends BaseDAO<Integer, Teacher> {
 
-}
+    List<Teacher> getWithTeachers(@Param("teacherIds") List<Integer> teacherIds);
+
+}

+ 63 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/BaseUserInfoDto.java

@@ -0,0 +1,63 @@
+package com.keao.edu.user.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.07.02
+ */
+public class BaseUserInfoDto {
+
+    /** 主键ID */
+    private Integer id;
+
+    @ApiModelProperty(value = "手机号",required = false)
+    private String phone;
+
+    /** 头像 */
+    @ApiModelProperty(value = "头像",required = false)
+    private String avatar;
+
+    @ApiModelProperty(value = "真实姓名",required = false)
+    private String realName;
+
+    public BaseUserInfoDto() {
+    }
+
+    public BaseUserInfoDto(Integer id, String realName) {
+        this.id = id;
+        this.realName = realName;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+}

+ 20 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/TeacherDto.java

@@ -0,0 +1,20 @@
+package com.keao.edu.user.dto;
+
+import com.keao.edu.user.entity.Teacher;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.07.02
+ */
+public class TeacherDto extends Teacher {
+
+    private String subjectNames;
+
+    public String getSubjectNames() {
+        return subjectNames;
+    }
+
+    public void setSubjectNames(String subjectNames) {
+        this.subjectNames = subjectNames;
+    }
+}

+ 12 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamCertification.java

@@ -10,6 +10,9 @@ public class ExamCertification {
 
 	private Long id;
 
+	@ApiModelProperty(value = "学员报名编号")
+	private Long examRegistrationId;
+
 	@ApiModelProperty(value = "考级项目编号")
 	private Integer examinationBasicId;
 
@@ -39,7 +42,15 @@ public class ExamCertification {
 	private java.util.Date updateTime;
 
 	private String tenantId;
-	
+
+	public Long getExamRegistrationId() {
+		return examRegistrationId;
+	}
+
+	public void setExamRegistrationId(Long examRegistrationId) {
+		this.examRegistrationId = examRegistrationId;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

+ 11 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamReview.java

@@ -1,6 +1,5 @@
 package com.keao.edu.user.entity;
 
-import com.keao.edu.user.enums.ExamEvaluationResultEnum;
 import com.keao.edu.user.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -13,6 +12,9 @@ public class ExamReview {
 	/**  */
 	private Long id;
 
+	@ApiModelProperty(value = "学员报考编号")
+	private Long examRegistrationId;
+
 	@ApiModelProperty(value = "考试编号")
 	private Integer examinationBasicId;
 	
@@ -44,6 +46,14 @@ public class ExamReview {
 	@ApiModelProperty(value = "考试基本信息")
 	private ExaminationBasic examinationBasic;
 
+	public Long getExamRegistrationId() {
+		return examRegistrationId;
+	}
+
+	public void setExamRegistrationId(Long examRegistrationId) {
+		this.examRegistrationId = examRegistrationId;
+	}
+
 	public ExaminationBasic getExaminationBasic() {
 		return examinationBasic;
 	}

+ 1 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamTeacherSalary.java

@@ -1,8 +1,7 @@
 package com.keao.edu.user.entity;
 
 import com.keao.edu.auth.api.entity.SysUser;
-import com.keao.edu.user.enums.ExamModeEnum;
-import com.keao.edu.user.enums.SettlementTypeEnum;
+import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.enums.TeacherSettlementTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExaminationBasic.java

@@ -1,6 +1,6 @@
 package com.keao.edu.user.entity;
 
-import com.keao.edu.user.enums.ExamModeEnum;
+import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.enums.ExamStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;

+ 12 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/StudentExamResult.java

@@ -10,6 +10,9 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 public class StudentExamResult {
 
 	private Long id;
+
+	@ApiModelProperty(value = "学员报考编号")
+	private Long examRegistrationId;
 	
 	@ApiModelProperty(value = "考级项目编号")
 	private Integer examinationBasicId;
@@ -43,7 +46,15 @@ public class StudentExamResult {
 	private java.util.Date updateTime;
 
 	private String tenantId;
-	
+
+	public Long getExamRegistrationId() {
+		return examRegistrationId;
+	}
+
+	public void setExamRegistrationId(Long examRegistrationId) {
+		this.examRegistrationId = examRegistrationId;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

+ 35 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamTeacherSalaryService.java

@@ -1,7 +1,15 @@
 package com.keao.edu.user.service;
 
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.entity.Teacher;
+import com.keao.edu.user.page.ExamTeacherSalaryQueryInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherSalary> {
 
@@ -23,4 +31,31 @@ public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherS
      */
     void deleteExamTeacherSalary(Long examTeacherSalaryId);
 
+    /**
+     * @describe 新增考级项目教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @param teacherIdsStr:
+     * @return void
+     */
+    void addExamTeacherSalary(Integer examId, String teacherIdsStr);
+
+    /**
+     * @describe 获取指定考级项目可排考教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.dto.BaseUserInfoDto>
+     */
+    List<BaseUserInfoDto> getExamTeachers(Integer examId);
+
+    /**
+     * @describe 获取与考级项目无关的教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param queryInfo:
+     * @return java.util.List<com.keao.edu.user.entity.Teacher>
+     */
+    PageInfo<TeacherDto> getUnRelatedWithExamTeachers(ExamTeacherSalaryQueryInfo queryInfo);
 }

+ 6 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -153,12 +153,15 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 		baseUrl = baseUrl+"/#/signUp?";
 
 		for (ExamOrganizationRelation examOrgan : examOrgans) {
-			examOrgan.setUrl(shortUrlService.createShortUrl(""));
-			examOrgan.setSendUrlFlag(YesOrNoEnum.YES);
-
+			if(YesOrNoEnum.YES.equals(examOrgan.getSendUrlFlag())){
+				continue;
+			}
 			String registrationUrl = baseUrl + "organId=" + examOrgan.getOrganId();
 			String registShortUrl = shortUrlService.createShortUrl(registrationUrl);
 
+			examOrgan.setUrl(registShortUrl);
+			examOrgan.setSendUrlFlag(YesOrNoEnum.YES);
+
 			SysUser student = sysUserFeignService.queryUserById(examOrgan.getOrganId());
 			Map<Integer, String> userPhoneMap = new HashMap<>();
 			userPhoneMap.put(examOrgan.getOrganId(), student.getPhone());

+ 40 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -1,6 +1,9 @@
 package com.keao.edu.user.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.enums.YesOrNoEnum;
 import com.keao.edu.common.exception.BizException;
@@ -11,25 +14,28 @@ import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.dao.ExamRegistrationDao;
 import com.keao.edu.user.dao.ExamRoomDao;
 import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
+import com.keao.edu.user.dao.ExaminationBasicDao;
 import com.keao.edu.user.dto.ExamRoomDto;
 import com.keao.edu.user.dto.ExamRoomStatisticsDto;
-import com.keao.edu.user.enums.ExamModeEnum;
+import com.keao.edu.user.api.enums.ExamModeEnum;
+import com.keao.edu.user.entity.ExaminationBasic;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 import com.keao.edu.user.service.ExamRoomService;
 import com.keao.edu.user.service.OrganizationService;
-import com.keao.edu.user.service.StudentService;
 import com.keao.edu.util.collection.MapUtil;
+import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
 public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> implements ExamRoomService {
-	
+
 	@Autowired
 	private ExamRoomDao examRoomDao;
 	@Autowired
@@ -38,6 +44,8 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 	private OrganizationService organizationService;
 	@Autowired
 	private ExamRegistrationDao examRegistrationDao;
+	@Autowired
+	private ExaminationBasicDao examinationBasicDao;
 
 	@Override
 	public BaseDAO<Long, ExamRoom> getDAO() {
@@ -69,6 +77,13 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
 	@Override
 	public void createExamRoom(ExamRoom examRoom) {
+		if(Objects.isNull(examRoom.getExaminationBasicId())){
+			throw new BizException("请指定考级项目");
+		}
+		ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
+		if(Objects.isNull(examinationBasic)){
+			throw new BizException("考级项目不存在");
+		}
 		if(Objects.isNull(examRoom.getExamMode())){
 			throw new BizException("请指定考试类型");
 		}
@@ -81,12 +96,32 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 		if(Objects.isNull(examRoom.getMainTeacherUserId())){
 			throw new BizException("请指定主考老师");
 		}
-		if(Objects.isNull(examRoom.getExamStartTime())){
+		if(StringUtils.isBlank(examRoom.getExamTimeJson())){
 			throw new BizException("请指定考试时间");
 		}
 		examRoom.setTenantId(TenantContextHolder.getTenantId().toString());
 		examRoom.setExamPlanPushFlag(YesOrNoEnum.NO);
-		examRoomDao.insert(examRoom);
+		if(StringUtils.isBlank(examRoom.getExamTimeJson())){
+			examRoomDao.insert(examRoom);
+			return;
+		}
+		List<ExamRoom> examRooms=new ArrayList<>();
+		List<JSONObject> examTimes = JSON.parseArray(examRoom.getExamTimeJson(), JSONObject.class);
+		for (JSONObject examTime : examTimes) {
+			ExamRoom er;
+			try {
+				er= (ExamRoom) BeanUtils.cloneBean(examRoom);
+			} catch (Exception e) {
+				throw new BizException("教室创建失败");
+			}
+			er.setExamStartTime(examTime.getDate("examStartTime"));
+			er.setExamEndTime(examTime.getDate("examEndTime"));
+			if(Objects.isNull(er.getExamStartTime())||Objects.isNull(er.getExamEndTime())){
+				throw new BizException("请指定考试时间");
+			}
+			examRooms.add(er);
+		}
+		examRoomDao.batchInsert(examRooms);
 	}
 
 	@Override

+ 101 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java

@@ -2,19 +2,24 @@ package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
-import com.keao.edu.user.dao.ExamRoomDao;
-import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
-import com.keao.edu.user.dao.ExamTeacherSalaryDao;
-import com.keao.edu.user.dao.ExaminationBasicDao;
+import com.keao.edu.user.dao.*;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.entity.Teacher;
 import com.keao.edu.user.enums.SettlementTypeEnum;
 import com.keao.edu.user.enums.TeacherSettlementTypeEnum;
+import com.keao.edu.user.page.ExamTeacherSalaryQueryInfo;
 import com.keao.edu.user.service.ExamTeacherSalaryService;
 import com.keao.edu.user.service.ExaminationBasicService;
+import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -33,6 +38,8 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 	private ExamRoomStudentRelationDao examRoomStudentRelationDao;
 	@Autowired
 	private ExamTeacherSalaryDao examTeacherSalaryDao;
+	@Autowired
+	private TeacherDao teacherDao;
 
 	@Override
 	public BaseDAO<Long, ExamTeacherSalary> getDAO() {
@@ -94,4 +101,94 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 		}
 		examTeacherSalaryDao.delete(examTeacherSalaryId);
 	}
+
+	@Override
+	public void addExamTeacherSalary(Integer examId, String teacherIdsStr) {
+		if(Objects.isNull(examId)){
+			throw new BizException("请指定考级项目");
+		}
+		if(StringUtils.isBlank(teacherIdsStr)){
+			throw new BizException("请指定教师");
+		}
+		List<Integer> teacherIds = Arrays.stream(teacherIdsStr.split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+		List<ExamTeacherSalary> withExamAndTeacher = examTeacherSalaryDao.getWithExamAndTeacher(examId, teacherIds);
+		if(!CollectionUtils.isEmpty(withExamAndTeacher)){
+			List<String> teacherNames = withExamAndTeacher.stream().map(e -> e.getTeacher().getRealName()).collect(Collectors.toList());
+			throw new BizException("{}教师已存在", teacherNames);
+		}
+		List<Teacher> teachers = teacherDao.getWithTeachers(teacherIds);
+		Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getUserId, t -> t));
+
+		List<ExamTeacherSalary> examTeacherSalaries=new ArrayList<>();
+		for (Integer teacherId : teacherIds) {
+			Teacher teacher = idTeacherMap.get(teacherId);
+			if(Objects.isNull(teacher)){
+				throw new BizException("教师信息异常");
+			}
+			ExamTeacherSalary ets=new ExamTeacherSalary();
+			ets.setExaminationBasicId(examId);
+			ets.setTeacherId(teacherId);
+			ets.setSettlementType(teacher.getSalarySettlementType());
+			ets.setShareProfitAmount(teacher.getSalary());
+			ets.setTotalSettlementCost(BigDecimal.ZERO);
+			ets.setTotalInvigilationStudentNum(0);
+			ets.setTotalInvigilationNum(0);
+			ets.setTenantId(TenantContextHolder.getTenantId().toString());
+			examTeacherSalaries.add(ets);
+		}
+		examTeacherSalaryDao.batchInsert(examTeacherSalaries);
+	}
+
+	@Override
+	public List<BaseUserInfoDto> getExamTeachers(Integer examId) {
+		if(Objects.isNull(examId)){
+			throw new BizException("请指定考级项目");
+		}
+		return examTeacherSalaryDao.getTeachersWithExam(examId);
+	}
+
+	@Override
+	public PageInfo<TeacherDto> getUnRelatedWithExamTeachers(ExamTeacherSalaryQueryInfo queryInfo) {
+		PageInfo<TeacherDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<TeacherDto> dataList = new ArrayList<>();
+		int count = examTeacherSalaryDao.countUnRelatedWithExamTeachers(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = examTeacherSalaryDao.queryUnRelatedWithExamTeachers(params);
+			List<Integer> subjectIds=new ArrayList<>();
+			for (TeacherDto teacher : dataList) {
+				if(StringUtils.isBlank(teacher.getSubjectIdList())){
+					continue;
+				}
+				for (String subjectId : teacher.getSubjectIdList().split(",")) {
+					if(!subjectIds.contains(Integer.valueOf(subjectId))){
+						subjectIds.add(Integer.valueOf(subjectId));
+					}
+				}
+			}
+			if(!CollectionUtils.isEmpty(subjectIds)){
+				Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
+				for (TeacherDto teacher : dataList) {
+					if(StringUtils.isBlank(teacher.getSubjectIdList())){
+						continue;
+					}
+					List<String> subjectNames=new ArrayList<>();
+					for (String subjectId : teacher.getSubjectIdList().split(",")) {
+						String subjectName = subjectIdNameMap.get(Integer.valueOf(subjectId));
+						if(StringUtils.isNotBlank(subjectName)){
+							subjectNames.add(subjectName);
+						}
+					}
+					teacher.setSubjectNames(StringUtils.join(subjectNames, ","));
+				}
+			}
+		}
+
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 1 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExaminationBasicServiceImpl.java

@@ -10,13 +10,12 @@ import com.keao.edu.user.dao.ExaminationBasicDao;
 import com.keao.edu.user.dto.ExaminationBasicDto;
 import com.keao.edu.user.entity.ExamOrganizationRelation;
 import com.keao.edu.user.entity.ExaminationBasic;
-import com.keao.edu.user.enums.ExamModeEnum;
+import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.enums.ExamStatusEnum;
 import com.keao.edu.user.page.ExaminationQueryInfo;
 import com.keao.edu.user.service.ExaminationBasicService;
 import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;

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

@@ -170,6 +170,9 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 
 	@Override
 	public List<Integer> getNextLevelOrganIds(Integer organId, boolean includeSelf) {
+		if(Objects.isNull(organId)){
+			return null;
+		}
 		Organization organization = organDao.get(organId);
 		if(Objects.isNull(organization)){
 			throw new BizException("当前声部不存在");

+ 1 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java

@@ -1,6 +1,5 @@
 package com.keao.edu.user.service.impl;
 
-import com.keao.edu.auth.api.client.SysUserFeignService;
 import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
@@ -13,9 +12,7 @@ import com.keao.edu.user.dao.SysUserDao;
 import com.keao.edu.user.dao.TenantInfoDao;
 import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.entity.TenantInfo;
-import com.keao.edu.user.enums.YesOrNoEnum;
 import com.keao.edu.user.service.TenantInfoService;
-import com.netflix.discovery.converters.Auto;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -42,7 +39,7 @@ public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo>
 
 	@Override
 	public void addTenant(TenantInfo tenantInfo) {
-		if(StringUtils.isNotBlank(tenantInfo.getContactPhone())){
+		if(StringUtils.isBlank(tenantInfo.getContactPhone())){
 			throw new BizException("请填写手机号码");
 		}
 		SysUser userWithPhone = sysUserDao.queryByPhone(tenantInfo.getContactPhone());

+ 8 - 4
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamCertificationMapper.xml

@@ -9,6 +9,7 @@
 	<resultMap type="com.keao.edu.user.entity.ExamCertification" id="ExamCertification">
 		<result column="id_" property="id" />
 		<result column="examination_basic_id_" property="examinationBasicId" />
+		<result column="exam_registration_id_" property="examRegistrationId" />
 		<result column="student_id_" property="studentId" />
 		<result column="card_no_" property="cardNo" />
 		<result column="subject_id_" property="subjectId" />
@@ -34,18 +35,18 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.entity.ExamCertification" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO exam_certification (id_,examination_basic_id_,student_id_,card_no_,subject_id_,
-		level_,exam_start_time_,exam_end_time_,exam_address_,create_time_,update_time_,tenant_id_)
+		level_,exam_start_time_,exam_end_time_,exam_address_,create_time_,update_time_,tenant_id_,exam_registration_id_)
 		VALUES(#{id},#{examinationBasicId},#{studentId},#{cardNo},#{subjectId},#{level},#{examStartTime},
-		#{examEndTime},#{examAddress},NOW(),NOW(),#{tenantId})
+		#{examEndTime},#{examAddress},NOW(),NOW(),#{tenantId},#{examRegistrationId})
 	</insert>
 
 	<insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamCertification" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO exam_certification (examination_basic_id_,student_id_,card_no_,subject_id_,
-		level_,exam_start_time_,exam_end_time_,exam_address_,create_time_,update_time_,tenant_id_)
+		level_,exam_start_time_,exam_end_time_,exam_address_,create_time_,update_time_,tenant_id_,exam_registration_id_)
 		VALUES
 		<foreach collection="ecs" item="ec" separator=",">
 			(#{ec.examinationBasicId},#{ec.studentId},#{ec.cardNo},#{ec.subjectId},#{ec.level},#{ec.examStartTime},
-			#{ec.examEndTime},#{ec.examAddress},NOW(),NOW(),#{ec.tenantId})
+			#{ec.examEndTime},#{ec.examAddress},NOW(),NOW(),#{ec.tenantId},#{ec.examRegistrationId})
 		</foreach>
 	</insert>
 	
@@ -56,6 +57,9 @@
 			<if test="examinationBasicId != null">
 				examination_basic_id_ = #{examinationBasicId},
 			</if>
+			<if test="examRegistrationId != null">
+				exam_registration_id_ = #{examRegistrationId},
+			</if>
 			<if test="subjectId != null">
 				subject_id_ = #{subjectId},
 			</if>

+ 16 - 9
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamOrganizationRelationMapper.xml

@@ -132,10 +132,13 @@
 
 	<update id="batchUpdateSendUrlFlag">
 		UPDATE exam_organization_relation SET send_url_flag_=#{sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
-		WHERE examination_basic_id_=#{examId} AND organ_id_ IN
-		<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-			#{organId}
-		</foreach>
+		WHERE examination_basic_id_=#{examId}
+		<if test="organIds!=null">
+			AND organ_id_ IN
+			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+				#{organId}
+			</foreach>
+		</if>
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -147,10 +150,12 @@
 		<where>
 			ear.tenant_id_=#{tenantId}
 			AND ear.examination_basic_id_=#{examId}
-			AND ear.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND ear.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="settlementType!=null">
 				AND ear.settlement_type_=#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
 			</if>
@@ -211,11 +216,13 @@
 				LEFT JOIN organization o1 ON o1.id_ = eor1.organ_id_
 			WHERE eor1.examination_basic_id_=#{examId}
 			) eor ON eor.parent_organ_id_tag_ LIKE CONCAT( o.parent_organ_id_tag_, '%' )
-		WHERE
+		<if test="organIds!=null">
+			WHERE
 			o.id_ IN
 			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
 				#{organId}
 			</foreach>
+		</if>
 		GROUP BY o.id_
 	</select>
     <select id="findByOrganId" resultType="java.lang.Integer">

+ 33 - 20
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -104,10 +104,12 @@
 
 	<sql id="queryCondition">
 		<where>
-			er.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND er.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="examId!=null">
 				AND er.examination_basic_id_ = #{examId}
 			</if>
@@ -158,10 +160,13 @@
 		FROM
 			exam_registration er
 		LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_
-		WHERE ersr.organ_id_ IN
-		<foreach collection="organIds" item="organI" separator="," open="(" close=")">
-			#{organI}
-		</foreach>
+		WHERE 1=1
+		<if test="organIds!=null">
+			AND ersr.organ_id_ IN
+			<foreach collection="organIds" item="organI" separator="," open="(" close=")">
+				#{organI}
+			</foreach>
+		</if>
 		AND er.examination_basic_id_ = #{examId}
 		AND ersr.id_ IS NULL
 	</select>
@@ -172,10 +177,13 @@
 		FROM
 			exam_room_student_relation ersr
 		LEFT JOIN exam_registration er ON ersr.student_id_ = er.student_id_ AND er.examination_basic_id_=ersr.examination_basic_id_
-		WHERE er.organ_id_ IN
-		<foreach collection="organIds" item="organI" separator="," open="(" close=")">
-			#{organI}
-		</foreach>
+		WHERE 1=1
+		<if test="organIds!=null">
+			er.organ_id_ IN
+			<foreach collection="organIds" item="organI" separator="," open="(" close=")">
+				#{organI}
+			</foreach>
+		</if>
 		AND ersr.examination_basic_id_ = #{examId}
 	</select>
 
@@ -196,10 +204,12 @@
 			exam_registration er
 		WHERE
 			er.examination_basic_id_ = #{examId}
-			AND er.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND er.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
     </select>
 
 	<select id="countTotalRegistrationStudentNumWithExam" resultType="int">
@@ -207,10 +217,13 @@
 			COUNT(er.id_)
 		FROM
 		exam_registration er
-		WHERE er.organ_id_ IN
-		<foreach collection="organIds" item="organI" separator="," open="(" close=")">
-			#{organI}
-		</foreach>
+		WHERE 1=1
+		<if test="organIds!=null">
+			AND er.organ_id_ IN
+			<foreach collection="organIds" item="organI" separator="," open="(" close=")">
+				#{organI}
+			</foreach>
+		</if>
 		AND er.examination_basic_id_ = #{examId}
 		AND er.status_ != ''
 	</select>

+ 13 - 6
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamReviewMapper.xml

@@ -9,6 +9,7 @@
 	<resultMap type="com.keao.edu.user.entity.ExamReview" id="ExamReview">
 		<result column="id_" property="id" />
 		<result column="examination_basic_id_" property="examinationBasicId" />
+		<result column="exam_registration_id_" property="examRegistrationId" />
 		<result column="teacher_id_" property="teacherId" />
 		<result column="student_id_" property="studentId" />
 		<result column="evaluation_content_" property="evaluationContent" />
@@ -37,9 +38,10 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.entity.ExamReview" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO exam_review (id_,examination_basic_id_,teacher_id_,student_id_,evaluation_content_,
-		evaluation_result_,create_time_,update_time_,tenant_id_,enable_edit_)
+		evaluation_result_,create_time_,update_time_,tenant_id_,enable_edit_,exam_registration_id_)
 		VALUES(#{id},#{examinationBasicId},#{teacherId},#{studentId},#{evaluationContent},
-		#{evaluationResult,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{tenantId},#{enableEdit,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler})
+		#{evaluationResult,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),
+		#{tenantId},#{enableEdit,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examRegistrationId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -49,6 +51,9 @@
 			<if test="examinationBasicId != null">
 				examination_basic_id_ = #{examinationBasicId},
 			</if>
+			<if test="examRegistrationId != null">
+				exam_registration_id_ = #{examRegistrationId},
+			</if>
 			<if test="teacherId != null">
 				teacher_id_ = #{teacherId},
 			</if>
@@ -90,10 +95,12 @@
 
 	<sql id="findExamResultCondition">
 		<where>
-			ere.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND ere.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="examinationBaseId!=null">
 				AND ere.examination_basic_id_ = #{examinationBaseId}
 			</if>

+ 24 - 8
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -9,7 +9,7 @@
 	<resultMap type="com.keao.edu.user.api.entity.ExamRoom" id="ExamRoom">
 		<result column="id_" property="id" />
 		<result column="examination_basic_id_" property="examinationBasicId"/>
-		<result column="exam_mode_" property="examMode" />
+		<result column="exam_mode_" property="examMode" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
 		<result column="exam_location_id_" property="examLocationId" />
 		<result column="subject_id_list_" property="subjectIdList" />
 		<result column="main_teacher_user_id_" property="mainTeacherUserId" />
@@ -40,10 +40,24 @@
 		INSERT INTO exam_room (id_,examination_basic_id_,exam_mode_,exam_location_id_,subject_id_list_,main_teacher_user_id_,
 		assistant_teacher_user_id_list_,exam_start_time_,exam_end_time_,del_flag_,organ_id_,exam_plan_push_flag_,
 		exam_room_student_num_,create_time_,update_time_,tenant_id_)
-		VALUES(#{id},#{examinationBasicId},#{examMode},#{examLocationId},#{subjectIdList},#{mainTeacherUserId},#{assistantTeacherUserIdList},
+		VALUES(#{id},#{examinationBasicId},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examLocationId},#{subjectIdList},
+		#{mainTeacherUserId},#{assistantTeacherUserIdList},
 		#{examStartTime},#{examEndTime},#{delFlag},#{organId},#{examPlanPushFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 		#{examRoomStudentNum},NOW(),NOW(),#{tenantId})
 	</insert>
+
+	<insert id="batchInsert" parameterType="com.keao.edu.user.api.entity.ExamRoom" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO exam_room (examination_basic_id_,exam_mode_,exam_location_id_,subject_id_list_,main_teacher_user_id_,
+		assistant_teacher_user_id_list_,exam_start_time_,exam_end_time_,del_flag_,organ_id_,exam_plan_push_flag_,
+		exam_room_student_num_,create_time_,update_time_,tenant_id_)
+		VALUES
+		<foreach collection="examRooms" item="examRoom" separator=",">
+			(#{examRoom.examinationBasicId},#{examRoom.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examRoom.examLocationId},
+			#{examRoom.subjectIdList},#{examRoom.mainTeacherUserId},#{examRoom.assistantTeacherUserIdList},
+			#{examRoom.examStartTime},#{examRoom.examEndTime},#{examRoom.delFlag},#{examRoom.organId},#{examRoom.examPlanPushFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
+			#{examRoom.examRoomStudentNum},NOW(),NOW(),#{examRoom.tenantId})
+		</foreach>
+	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.api.entity.ExamRoom">
@@ -68,7 +82,7 @@
 				tenant_id_ = #{tenantId},
 			</if>
 			<if test="examMode != null">
-				exam_mode_ = #{examMode},
+				exam_mode_ = #{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 			</if>
 			<if test="examLocationId != null">
 				exam_location_id_ = #{examLocationId},
@@ -114,7 +128,7 @@
 				tenant_id_ = #{tenantId},
 			</if>
 			<if test="examMode != null">
-				exam_mode_ = #{examMode},
+				exam_mode_ = #{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 			</if>
 			<if test="examLocationId != null">
 				exam_location_id_ = #{examLocationId},
@@ -162,10 +176,12 @@
 
 	<sql id="queryExamRoomPageSql">
 		<where>
-			er.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND er.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="examRoomId!=null">
 				AND er.id_=#{examRoomId}
 			</if>

+ 7 - 5
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -109,11 +109,13 @@
 
 	<sql id="queryCondition">
 		<where>
-			ersr.organ_id_ IN
-			<foreach collection="organIds" item="organI" separator="," open="(" close=")">
-				#{organI}
-			</foreach>
-			AND er.status_='AUDIT_PASS'
+			er.status_='AUDIT_PASS'
+			<if test="organIds!=null">
+				AND ersr.organ_id_ IN
+				<foreach collection="organIds" item="organI" separator="," open="(" close=")">
+					#{organI}
+				</foreach>
+			</if>
 			<if test="examId!=null">
 				AND er.examination_basic_id_ = 1
 			</if>

+ 59 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamTeacherSalaryMapper.xml

@@ -19,7 +19,7 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
-		<association property="teacher" columnPrefix="teacher_" resultMap="com.keao.edu.auth.dal.dao.SysUserDao.SysUser"/>
+		<association property="teacher" columnPrefix="teacher_" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
  	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -39,6 +39,17 @@
 		VALUES(#{id},#{examinationBasicId},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{teacherId},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{shareProfitAmount},
 		#{totalInvigilationNum},#{totalInvigilationStudentNum},#{totalSettlementCost},NOW(),NOW(),#{tenantId})
 	</insert>
+
+	<insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamTeacherSalary" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO exam_teacher_salary (examination_basic_id_,exam_mode_,teacher_id_,settlement_type_,share_profit_amount_,
+		total_invigilation_num_,total_invigilation_student_num_,total_settlement_fee_,create_time_,update_time_,tenant_id_)
+		VALUES
+		<foreach collection="examTeacherSalaries" item="ets" separator=",">
+			(#{ets.examinationBasicId},#{ets.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{ets.teacherId},
+			#{ets.settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{ets.shareProfitAmount},
+			#{ets.totalInvigilationNum},#{ets.totalInvigilationStudentNum},#{ets.totalSettlementCost},NOW(),NOW(),#{ets.tenantId})
+		</foreach>
+	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.entity.ExamTeacherSalary">
@@ -118,7 +129,7 @@
 
 	<sql id="queryPageCondition">
 		<where>
-			examination_basic_id_ = #{examinationBasicId}
+			examination_basic_id_ = #{examId}
 		</where>
 	</sql>
 	
@@ -135,7 +146,53 @@
 		SELECT COUNT(*) FROM exam_teacher_salary ets
 		<include refid="queryPageCondition"/>
 	</select>
+
     <select id="queryWithExam" resultMap="ExamTeacherSalary">
 		SELECT * FROM exam_teacher_salary WHERE examination_basic_id_=#{examId}
 	</select>
+
+    <select id="getTeachersWithExam" resultMap="com.keao.edu.user.dao.SysUserDao.BaseUserInfoDto">
+		SELECT <include refid="com.keao.edu.user.dao.SysUserDao.BaseUserColumns"/>
+		FROM exam_teacher_salary ets
+		LEFT JOIN sys_user sys_user ON ets.teacher_id_=sys_user.id_
+		WHERE ets.examination_basic_id_=#{examId}
+	</select>
+
+	<select id="getWithExamAndTeacher" resultMap="ExamTeacherSalary">
+		SELECT ets.*,su.real_name_ teacher_real_name_ FROM exam_teacher_salary ets
+		LEFT JOIN sys_user su ON ets.teacher_id_=su.id_
+		WHERE ets.examination_basic_id_=#{examId} AND ets.teacher_id_ IN
+		<foreach collection="teacherIds" item="teacherId" separator="," open="(" close=")">
+			#{teacherId}
+		</foreach>
+	</select>
+
+	<sql id="queryUnRelatedWithExamTeachersCondition">
+		<where>
+			t.tenant_id_=#{tenantId}
+			AND NOT EXISTS ( SELECT teacher_id_ FROM exam_teacher_salary WHERE teacher_id_ = t.user_id_ AND examination_basic_id_ = #{examId} )
+		</where>
+	</sql>
+
+	<select id="queryUnRelatedWithExamTeachers" resultMap="com.keao.edu.user.dao.TeacherDao.TeacherDto">
+		SELECT
+			t.*,
+			su.real_name_ teacher_real_name_
+		FROM
+			teacher t
+			LEFT JOIN sys_user su ON t.user_id_ = su.id_
+		<include refid="queryUnRelatedWithExamTeachersCondition"/>
+		ORDER BY t.user_id_
+		<include refid="global.limit"/>
+	</select>
+
+	<select id="countUnRelatedWithExamTeachers" resultType="int">
+		SELECT
+			COUNT(t.user_id_)
+		FROM
+			teacher t
+			LEFT JOIN sys_user su ON t.user_id_ = su.id_
+		<include refid="queryUnRelatedWithExamTeachersCondition"/>
+	</select>
+
 </mapper>

+ 24 - 13
edu-user/edu-user-server/src/main/resources/config/mybatis/StudentExamResultMapper.xml

@@ -8,6 +8,7 @@
 	
 	<resultMap type="com.keao.edu.user.entity.StudentExamResult" id="StudentExamResult">
 		<result column="id_" property="id" />
+		<result column="exam_registration_id_" property="examRegistrationId" />
 		<result column="examination_basic_id_" property="examinationBasicId" />
 		<result column="student_id_" property="studentId" />
 		<result column="result_" property="result" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
@@ -34,16 +35,19 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.entity.StudentExamResult" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO student_exam_result (id_,examination_basic_id_,student_id_,result_,avg_score_,confirm_status_,memo_,operator_id_,is_finished_exam_,create_time_,update_time_,tenant_id_)
-		VALUES(#{id},#{examinationBasicId},#{studentId},#{result,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{avgScore},#{confirmStatus},#{memo},#{operatorId},#{isFinishedExam},NOW(),NOW(),#{tenantId})
+		INSERT INTO student_exam_result (id_,examination_basic_id_,student_id_,result_,avg_score_,
+		confirm_status_,memo_,operator_id_,is_finished_exam_,create_time_,update_time_,tenant_id_,exam_registration_id_)
+		VALUES(#{id},#{examinationBasicId},#{studentId},#{result,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
+		#{avgScore},#{confirmStatus},#{memo},#{operatorId},#{isFinishedExam},NOW(),NOW(),#{tenantId},#{examRegistrationId})
 	</insert>
 
 	<insert id="batchInsert" parameterType="com.keao.edu.user.entity.StudentExamResult" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO student_exam_result (examination_basic_id_,student_id_,result_,#{avg_score_},confirm_status_,memo_,operator_id_,is_finished_exam_,create_time_,update_time_,tenant_id_)
+		INSERT INTO student_exam_result (examination_basic_id_,student_id_,result_,#{avg_score_},
+		confirm_status_,memo_,operator_id_,is_finished_exam_,create_time_,update_time_,tenant_id_,exam_registration_id_)
 		VALUES
 		<foreach collection="results" item="result" separator=",">
 			(#{result.examinationBasicId},#{result.studentId},#{result.result,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
-			#{result.avgScore},#{result.confirmStatus},#{result.memo},#{result.operatorId},#{result.isFinishedExam},NOW(),NOW(),#{result.tenantId})
+			#{result.avgScore},#{result.confirmStatus},#{result.memo},#{result.operatorId},#{result.isFinishedExam},NOW(),NOW(),#{result.tenantId},#{result.examRegistrationId})
 		</foreach>
 	</insert>
 
@@ -51,6 +55,9 @@
 	<update id="update" parameterType="com.keao.edu.user.entity.StudentExamResult">
 		UPDATE student_exam_result
 		<set>
+			<if test="examRegistrationId != null">
+				exam_registration_id_ = #{examRegistrationId},
+			</if>
 			<if test="examinationBasicId != null">
 				examination_basic_id_ = #{examinationBasicId},
 			</if>
@@ -99,12 +106,14 @@
 
 	<sql id="queryStudentExamResultCondition">
 		<where>
-			er.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND er.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="examId!=null">
-				er.examination_basic_id_ = #{examId}
+				AND er.examination_basic_id_ = #{examId}
 			</if>
 		</where>
 	</sql>
@@ -148,10 +157,12 @@
 			AND er.student_id_ = ser.student_id_
 		WHERE
 			er.examination_basic_id_ = #{examId}
-			AND er.organ_id_ IN
-			<foreach collection="organIds" item="organId" separator="," open="(" close=")">
-				#{organId}
-			</foreach>
+			<if test="organIds!=null">
+				AND er.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 		GROUP BY
 			er.examination_basic_id_
 	</select>

+ 11 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -32,6 +32,17 @@
         <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
+    <resultMap id="BaseUserInfoDto" type="com.keao.edu.user.dto.BaseUserInfoDto">
+        <result column="id_" property="id"/>
+        <result column="real_name_" property="realName"/>
+        <result column="phone_" property="phone"/>
+        <result column="avatar_" property="avatar"/>
+    </resultMap>
+
+    <sql id="BaseUserColumns">
+        sys_user.id_,sys_user.real_name_,sys_user.phone_,sys_user.avatar_
+    </sql>
+
     <!-- 查询条件 -->
     <sql id="queryCondition">
         tenant_id_ = #{tenantId}

+ 12 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -19,7 +19,11 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
-		<association property="sysUser" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
+		<association property="sysUser" columnPrefix="teacher_" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
+	</resultMap>
+
+	<resultMap id="TeacherDto" type="com.keao.edu.user.dto.TeacherDto" extends="Teacher">
+		<result property="subjectNames" column="subject_names_"/>
 	</resultMap>
 
 	<select id="get" resultMap="Teacher">
@@ -105,4 +109,11 @@
 		LEFT JOIN sys_user su ON t.user_id_ = su.id_
 		<include refid="teacherQueryPage"/>
 	</select>
+
+    <select id="getWithTeachers" resultMap="Teacher">
+		SELECT * FROM teacher WHERE user_id_ IN
+		<foreach collection="teacherIds" item="teacherId" separator=",">
+			(#{teacherId})
+		</foreach>
+	</select>
 </mapper>