Browse Source

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

yonge 5 years ago
parent
commit
0ea8387ff6
21 changed files with 170 additions and 39 deletions
  1. 10 0
      edu-auth/edu-auth-api/src/main/java/com/keao/edu/auth/api/client/SysMessageFeignService.java
  2. 9 0
      edu-auth/edu-auth-api/src/main/java/com/keao/edu/auth/api/client/fallback/SysMessageFeignServiceFallback.java
  3. 1 1
      edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/config/ResourceServerConfig.java
  4. 2 2
      edu-auth/edu-auth-server/src/main/resources/application.yml
  5. 2 2
      edu-im/edu-im-server/src/main/resources/application.yml
  6. 21 10
      edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/ExamRoom.java
  7. 42 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentController.java
  8. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/TeacherController.java
  9. 13 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRegistrationDao.java
  10. 2 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRoomDao.java
  11. 10 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/OrganizationQueryInfo.java
  12. 8 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java
  13. 15 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java
  14. 2 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentServiceImpl.java
  15. 0 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TeacherServiceImpl.java
  16. 2 2
      edu-user/edu-user-server/src/main/resources/application.yml
  17. 13 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml
  18. 9 5
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml
  19. 1 10
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml
  20. 3 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/OrganizationMapper.xml
  21. 4 1
      edu-user/edu-user-server/src/main/resources/config/mybatis/TeacherMapper.xml

+ 10 - 0
edu-auth/edu-auth-api/src/main/java/com/keao/edu/auth/api/client/SysMessageFeignService.java

@@ -0,0 +1,10 @@
+package com.keao.edu.auth.api.client;
+
+import com.keao.edu.auth.api.client.fallback.SysMessageFeignServiceFallback;
+import com.keao.edu.common.config.FeignConfiguration;
+import org.springframework.cloud.openfeign.FeignClient;
+
+@FeignClient(contextId = "SysMessageFeignService", name = "auth-server", configuration = { FeignConfiguration.class }, fallback = SysMessageFeignServiceFallback.class)
+public interface SysMessageFeignService {
+
+}

+ 9 - 0
edu-auth/edu-auth-api/src/main/java/com/keao/edu/auth/api/client/fallback/SysMessageFeignServiceFallback.java

@@ -0,0 +1,9 @@
+package com.keao.edu.auth.api.client.fallback;
+
+import com.keao.edu.auth.api.client.SysMessageFeignService;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SysMessageFeignServiceFallback implements SysMessageFeignService {
+
+}

+ 1 - 1
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/config/ResourceServerConfig.java

@@ -26,7 +26,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
 		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
-				.authorizeRequests().antMatchers("/task/**","/v2/api-docs","/code/*").hasIpAddress("0.0.0.0/0").anyRequest().authenticated().and().httpBasic();
+				.authorizeRequests().antMatchers("/task/**","/v2/api-docs","/code/*","/user/updatePassword","/user/noAuth/queryUserByPhone").hasIpAddress("0.0.0.0/0").anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 2 - 2
edu-auth/edu-auth-server/src/main/resources/application.yml

@@ -26,7 +26,7 @@ spring:
 
   datasource:
     name: test
-    url: jdbc:mysql://47.99.212.176:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://47.114.176.40:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     username: edu_saas
     password: dayaDataOnline@2019
     # 使用druid数据源
@@ -47,7 +47,7 @@ spring:
     maxOpenPreparedStatements: 20
 
   redis:
-    host: 47.99.212.176
+    host: 47.114.176.40
     port: 6379
     password: dyym
     database: 1

+ 2 - 2
edu-im/edu-im-server/src/main/resources/application.yml

@@ -30,7 +30,7 @@ spring:
 
   datasource:
     name: test
-    url: jdbc:mysql://47.99.212.176:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://47.114.176.40:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     username: edu_saas
     password: dayaDataOnline@2019
     # 使用druid数据源
@@ -51,7 +51,7 @@ spring:
     maxOpenPreparedStatements: 20
 
   redis:
-    host: 47.99.212.176
+    host: 47.114.176.40
     port: 6379
     password: dyym
     database: 1

+ 21 - 10
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/ExamRoom.java

@@ -1,5 +1,6 @@
 package com.keao.edu.user.api.entity;
 
+import com.keao.edu.common.enums.YesOrNoEnum;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 /**
@@ -28,9 +29,11 @@ public class ExamRoom {
 	private String assistantTeacherUserIdList;
 	
 	/** 考试时间(json格式) */
-	private String examTimeJson;
+	private String examTime;
 
 	private Integer organId;
+
+	private YesOrNoEnum examPlanPushFlag;
 	
 	/**  */
 	private boolean delFlag;
@@ -99,14 +102,6 @@ public class ExamRoom {
 	public String getAssistantTeacherUserIdList(){
 		return this.assistantTeacherUserIdList;
 	}
-			
-	public void setExamTimeJson(String examTimeJson){
-		this.examTimeJson = examTimeJson;
-	}
-	
-	public String getExamTimeJson(){
-		return this.examTimeJson;
-	}
 
 	public Integer getOrganId() {
 		return organId;
@@ -139,7 +134,23 @@ public class ExamRoom {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
+
+	public String getExamTime() {
+		return examTime;
+	}
+
+	public void setExamTime(String examTime) {
+		this.examTime = examTime;
+	}
+
+	public YesOrNoEnum getExamPlanPushFlag() {
+		return examPlanPushFlag;
+	}
+
+	public void setExamPlanPushFlag(YesOrNoEnum examPlanPushFlag) {
+		this.examPlanPushFlag = examPlanPushFlag;
+	}
+
 	public void setTenantId(String tenantId){
 		this.tenantId = tenantId;
 	}

+ 42 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentController.java

@@ -0,0 +1,42 @@
+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.common.page.QueryInfo;
+import com.keao.edu.user.entity.Student;
+import com.keao.edu.user.service.StudentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "学员服务")
+@RequestMapping(value = "student")
+public class StudentController extends BaseController {
+
+	@Autowired
+	private StudentService studentService;
+
+	@ApiOperation(value = "学员列表")
+	@GetMapping(value = "list")
+    @PreAuthorize("@pcs.hasPermissions('teacher/list')")
+	public HttpResponseResult<PageInfo<Student>> list(QueryInfo queryInfo) {
+		return succeed(studentService.queryPage(queryInfo));
+	}
+
+	@ApiOperation(value = "查询学员")
+	@GetMapping(value = "get")
+    @PreAuthorize("@pcs.hasPermissions('teacher/get')")
+	public HttpResponseResult<Student> get(Integer id) {
+		return succeed(studentService.get(id));
+	}
+}

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

@@ -55,7 +55,7 @@ public class TeacherController extends BaseController {
 	}
 
 	@ApiOperation(value = "删除教师")
-	@GetMapping(value = "del")
+	@PostMapping(value = "del")
     @PreAuthorize("@pcs.hasPermissions('teacher/del')")
 	public HttpResponseResult<Teacher> del(Integer id) {
 		teacherService.delete(id);

+ 13 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRegistrationDao.java

@@ -3,8 +3,20 @@ package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.entity.ExamRegistration;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ExamRegistrationDao extends BaseDAO<Long, ExamRegistration> {
 
-	
+    /**
+     * @describe 统计无教室学员
+     * @author Joburgess
+     * @date 2020.06.29
+     * @param organIds:
+     * @return int
+     */
+    int countWithoutExamRoomStudentNum(@Param("organIds")List<Integer> organIds,
+                                       @Param("examId") Integer examId);
+
 }

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

@@ -34,4 +34,6 @@ public interface ExamRoomDao extends BaseDAO<Long, ExamRoom> {
      * @return int
      */
     int batchDeleteExamRooms(@Param("examRoomIds") List<Long> examRoomIds);
+
+//    int batchUpdateExamRoomPushStatus(@Param())
 }

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/OrganizationQueryInfo.java

@@ -8,6 +8,16 @@ public class OrganizationQueryInfo extends QueryInfo {
 
     private Integer parentId;
 
+    private Integer isAllowArrangeExam;
+
+    public Integer getIsAllowArrangeExam() {
+        return isAllowArrangeExam;
+    }
+
+    public void setIsAllowArrangeExam(Integer isAllowArrangeExam) {
+        this.isAllowArrangeExam = isAllowArrangeExam;
+    }
+
     public Integer getParentId() {
         return parentId;
     }

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

@@ -42,4 +42,12 @@ public interface ExamRoomService extends BaseService<Long, ExamRoom> {
      * @return void
      */
     void deleteExamRooms(String examRoomIds);
+
+    /**
+     * @describe 发送考试安排
+     * @author Joburgess
+     * @date 2020.06.29
+     * @return void
+     */
+    void sendExamPlan(Integer organId, Integer examId);
 }

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

@@ -7,6 +7,7 @@ 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.dao.ExamRegistrationDao;
 import com.keao.edu.user.dao.ExamRoomDao;
 import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
 import com.keao.edu.user.dto.ExamRoomDto;
@@ -14,6 +15,7 @@ import com.keao.edu.user.enums.ExamModeEnum;
 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.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +33,8 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 	private ExamRoomStudentRelationDao examRoomStudentRelationDao;
 	@Autowired
 	private OrganizationService organizationService;
+	@Autowired
+	private ExamRegistrationDao examRegistrationDao;
 
 	@Override
 	public BaseDAO<Long, ExamRoom> getDAO() {
@@ -84,7 +88,7 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 		if(Objects.isNull(examRoom.getMainTeacherUserId())){
 			throw new BizException("请指定主考老师");
 		}
-		if(StringUtils.isBlank(examRoom.getExamTimeJson())){
+		if(StringUtils.isBlank(examRoom.getExamTime())){
 			throw new BizException("请指定考试时间");
 		}
 		examRoomDao.update(examRoom);
@@ -100,4 +104,14 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 		examRoomDao.batchDeleteExamRooms(examRoomIds);
 		examRoomStudentRelationDao.deleteWithExamRooms(examRoomIds);
 	}
+
+	@Override
+	public void sendExamPlan(Integer organId, Integer examId) {
+		List<Integer> nextLevelOrganIds = organizationService.getNextLevelOrganIds(organId, true);
+		int withoutExamRoomStudentNum = examRegistrationDao.countWithoutExamRoomStudentNum(nextLevelOrganIds, examId);
+		if(withoutExamRoomStudentNum>0){
+			throw new BizException("存在未安排教室的学员");
+		}
+
+	}
 }

+ 2 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentServiceImpl.java

@@ -10,12 +10,14 @@ import com.keao.edu.user.entity.Student;
 import com.keao.edu.user.service.StudentService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
  * @Author Joburgess
  * @Date 2020.06.18
  */
+@Service
 public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implements StudentService {
 
     @Autowired

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

@@ -49,9 +49,6 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher> implem
 		teacher.setTenantId(tenantId);
 		sysUser.setTenantId(tenantId);
 		if(user != null && user.getId() != null){
-			if(user.getUserType().contains("TEACHER")){
-				throw new BizException("此手机号已被占用");
-			}
 			Integer id = user.getId();
 			sysUser.setId(id);
 			Teacher teacher1 = teacherDao.get(id);

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

@@ -29,7 +29,7 @@ spring:
 #    url: jdbc:mysql://47.99.212.176:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #    username: edu_saas
 #    password: edu_saas
-    url: jdbc:mysql://47.99.212.176:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://47.114.176.40:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     username: edu_saas
     password: dayaDataOnline@2019
     # 使用druid数据源
@@ -50,7 +50,7 @@ spring:
     maxOpenPreparedStatements: 20
 
   redis:
-    host: 47.99.212.176
+    host: 47.114.176.40
     port: 6379
     password: dyym
     database: 1

+ 13 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -148,4 +148,17 @@
 		SELECT COUNT(*) FROM exam_registration
 		<include refid="queryCondition"/>
 	</select>
+    <select id="countWithoutExamRoomStudentNum" resultType="int">
+		SELECT
+			COUNT(ersr.id_)
+		FROM
+			exam_registration er
+		LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_
+		ersr.organ_id_ IN
+		<foreach collection="organIds" item="organI" separator="," open="(" close=")">
+			#{organI}
+		</foreach>
+		AND er.examination_basic_id_ = #{examId}
+		AND ersr.id_ IS NULL
+	</select>
 </mapper>

+ 9 - 5
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -14,9 +14,10 @@
 		<result column="subject_id_list_" property="subjectIdList" />
 		<result column="main_teacher_user_id_" property="mainTeacherUserId" />
 		<result column="assistant_teacher_user_id_list_" property="assistantTeacherUserIdList" />
-		<result column="exam_time_json_" property="examTimeJson" />
+		<result column="exam_time_" property="examTime" />
 		<result column="del_flag_" property="delFlag" />
 		<result column="organ_id_" property="organId"/>
+		<result column="exam_plan_push_flag_" property="examPlanPushFlag" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
@@ -35,9 +36,9 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.api.entity.ExamRoom" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		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_time_json_,del_flag_,organ_id_,create_time_,update_time_,tenant_id_)
+		assistant_teacher_user_id_list_,exam_time_,del_flag_,organ_id_,exam_plan_push_flag_,create_time_,update_time_,tenant_id_)
 		VALUES(#{id},#{examinationBasicId},#{examMode},#{examLocationId},#{subjectIdList},#{mainTeacherUserId},#{assistantTeacherUserIdList},
-		#{examTimeJson},#{delFlag},#{organId},NOW(),NOW(),#{tenantId})
+		#{examTime},#{delFlag},#{organId},#{examPlanPushFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -51,7 +52,7 @@
 				examination_basic_id_ = #{examinationBasicId},
 			</if>
 			<if test="examTimeJson != null">
-				exam_time_json_ = #{examTimeJson},
+				exam_time_ = #{examTime},
 			</if>
 			<if test="subjectIdList != null">
 				subject_id_list_ = #{subjectIdList},
@@ -74,6 +75,9 @@
 			<if test="organId != null">
 				organ_id_ = #{organId},
 			</if>
+			<if test="examPlanPushFlag != null">
+				exam_plan_push_flag_ = #{examPlanPushFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
+			</if>
 				update_time_ = NOW()
 		</set> WHERE id_ = #{id}
 	</update>
@@ -84,7 +88,7 @@
 	</delete>
 
 	<delete id="batchDeleteExamRooms">
-		DELETE FROM exam_room WHERE id_ IN
+		DELETE FROM exam_room WHERE exam_plan_push_flag_=0 AND id_ IN
 		<foreach collection="examRoomIds" item="examRoomId" separator="," open="(" close=")">
 			#{examRoomId}
 		</foreach>

+ 1 - 10
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -107,8 +107,6 @@
 		SELECT COUNT(*) FROM exam_room_student_relation
 	</select>
 
-
-
 	<sql id="queryCondition">
 		<where>
 			ersr.organ_id_ IN
@@ -143,11 +141,7 @@
 
 	<select id="countExamRoomStudents" resultType="int">
 		SELECT
-		ersr.id_,
-		ersr.student_id_,
-		er.subject_id_,
-		er.level_,
-		er.create_time_
+			COUNT(ersr.id_)
 		FROM
 		exam_registration er
 		LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_
@@ -157,7 +151,4 @@
 	<select id="findStudentsWithExamRoom" resultMap="ExamRoomStudentRelation">
 		SELECT id_, examination_basic_id_, exam_room_id_, student_id_ FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
 	</select>
-	<select id="findByBasicIdAndStudentId">
-
-	</select>
 </mapper>

+ 3 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/OrganizationMapper.xml

@@ -93,6 +93,9 @@
 			<if test="settlementType != null and settlementType != ''">
 				AND settlement_type_ = #{settlementType}
 			</if>
+			<if test="isAllowArrangeExam != null">
+				AND is_allow_arrange_exam_ = #{isAllowArrangeExam}
+			</if>
 			<if test="search != null and search != ''">
 				AND (id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%')
 				OR contact_name_ LIKE CONCAT('%',#{search},'%')

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

@@ -64,7 +64,7 @@
 	</insert>
 
 	<update id="delete">
-		UPDATE teacher SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
+		UPDATE teacher SET del_flag_ = 1,update_time_ = NOW() WHERE user_id_ = #{id}
 	</update>
 	<sql id="teacherQueryPage">
 		<where>
@@ -74,6 +74,9 @@
 				OR su.real_name_ LIKE CONCAT('%',#{search},'%')
 				OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			</if>
+			<if test="settlementType != null and settlementType != ''">
+				AND t.salary_settlement_type_ = #{settlementType}
+			</if>
 		</where>
 	</sql>
 	<!-- 分页查询 -->