فهرست منبع

Merge remote-tracking branch 'origin/master'

Joburgess 5 سال پیش
والد
کامیت
61c7bffa65

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleEvaluate.java

@@ -47,6 +47,10 @@ public class CourseScheduleEvaluate {
 
     private String month;
 
+    @ApiModelProperty(value = "报告版本")
+    private Integer version;
+
+
     public Integer getIsPushed() {
         return isPushed;
     }
@@ -174,4 +178,12 @@ public class CourseScheduleEvaluate {
     public void setMonth(String month) {
         this.month = month;
     }
+
+    public Integer getVersion() {
+        return version;
+    }
+
+    public void setVersion(Integer version) {
+        this.version = version;
+    }
 }

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Teacher.java

@@ -100,6 +100,15 @@ public class Teacher extends SysUser {
 	
 	@ApiModelProperty(value = "是否支持额外的网管课", required = false)
 	private Boolean isSupportExtraPracticeLesson;
+	
+	@ApiModelProperty(value = "身份证正面照", required = false)
+	private String idcardFrontImg;
+	
+	@ApiModelProperty(value = "身份证反面照", required = false)
+	private String idcardBackImg;
+	
+	@ApiModelProperty(value = "手持身份证照", required = false)
+	private String idcardHandImg;
 
 	private List<School> teacherSchools;
 
@@ -295,6 +304,30 @@ public class Teacher extends SysUser {
 		this.isSupportExtraPracticeLesson = isSupportExtraPracticeLesson;
 	}
 
+	public String getIdcardFrontImg() {
+		return idcardFrontImg;
+	}
+
+	public void setIdcardFrontImg(String idcardFrontImg) {
+		this.idcardFrontImg = idcardFrontImg;
+	}
+
+	public String getIdcardBackImg() {
+		return idcardBackImg;
+	}
+
+	public void setIdcardBackImg(String idcardBackImg) {
+		this.idcardBackImg = idcardBackImg;
+	}
+
+	public String getIdcardHandImg() {
+		return idcardHandImg;
+	}
+
+	public void setIdcardHandImg(String idcardHandImg) {
+		this.idcardHandImg = idcardHandImg;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherService.java

@@ -159,4 +159,17 @@ public interface TeacherService extends BaseService<Integer, Teacher> {
      * @return
      */
     List<BasicUserDto> queryEducationIpa(Integer id, String search);
+    
+    /**
+     * 实名认证
+     * @param userId 用户编号
+     * @param realName 姓名
+     * @param idcardNo 身份证号码
+     * @param idcardFrontImg 身份证正面
+     * @param idcardBackImg 身份证反面
+     * @param idcardHandImg 手持身份照
+     * @return
+     */
+	boolean realNameAuthentication(Integer userId, String realName, String idcardNo, String idcardFrontImg, String idcardBackImg, String idcardHandImg);
+
 }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -615,9 +615,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if(classGroupIds.size() > 0){
             courseScheduleEvaluates = courseScheduleEvaluateDao.findByClassGroupIds(classGroupIds);
         }
-        Map<Integer, Long> reportMap = new HashMap<>();
+        Map<Integer, List<CourseScheduleEvaluate>> reportMap = new HashMap<>();
         if(courseScheduleEvaluates.size()>0) {
-            reportMap = courseScheduleEvaluates.stream().collect(Collectors.toMap(CourseScheduleEvaluate::getClassGroupId, CourseScheduleEvaluate::getId));
+            reportMap = courseScheduleEvaluates.stream().collect(Collectors.groupingBy(CourseScheduleEvaluate::getClassGroupId));
         }
 
         Set<String> musicGroupId = musicCourse.stream().map(e -> e.getMusicId()).collect(Collectors.toSet());
@@ -673,7 +673,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             if(ClassGroupTypeEnum.PRACTICE == e.getType()){
                 e.setStudentNames(practiceStuNames.get(e.getPracticeId()));
                 e.setPracticeRenewUrl(practiceRenewUrlConfig.getParanValue() + e.getPracticeId());
-                if(reportMap.containsKey(e.getClassGroupId()) && (new Date()).compareTo(DateUtil.stringToDate("2020-03-01 12:18:00"))>=0){
+                if(reportMap.containsKey(e.getClassGroupId())){
                     e.setHasReport(true);
                     String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
                     e.setStudyReportUrl(baseUrl + "/#/reportDetail?classGroupId=" + e.getClassGroupId());

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java

@@ -19,6 +19,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -443,4 +444,39 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		return teacher;
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean realNameAuthentication(Integer userId, String realName, String idcardNo, String idcardFrontImg, String idcardBackImg, String idcardHandImg) {
+
+		SysUser user = sysUserFeignService.queryUserById(userId);
+		if (user == null) {
+			throw new BizException("用户不存在");
+		}
+
+		Teacher teacher = teacherDao.get(userId);
+		if (teacher == null) {
+			throw new BizException("用户信息不存在");
+		}
+		// 查询是否已实名认证
+		if (StringUtils.isNotBlank(teacher.getIdcardBackImg()) && StringUtils.isNotBlank(teacher.getIdcardFrontImg())
+				&& StringUtils.isNotBlank(teacher.getIdcardHandImg())) {
+			throw new BizException("已实名认证,不能重复操作");
+		}
+
+		Date date = new Date();
+
+		user.setRealName(realName);
+		user.setIdCardNo(idcardNo);
+		user.setUpdateTime(date);
+		sysUserFeignService.updateSysUser(user);
+
+		teacher.setIdcardBackImg(idcardBackImg);
+		teacher.setIdcardFrontImg(idcardFrontImg);
+		teacher.setIdcardHandImg(idcardHandImg);
+		teacher.setUpdateTime(date);
+		teacherDao.update(teacher);
+
+		return true;
+	}
+
 }

+ 4 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml

@@ -14,15 +14,16 @@
         <result column="subject_name_" jdbcType="VARCHAR" property="subjectName"/>
         <result column="is_pushed_" jdbcType="INTEGER" property="isPushed"/>
         <result column="month_" jdbcType="VARCHAR" property="month"/>
+        <result column="version_" jdbcType="INTEGER" property="version"/>
     </resultMap>
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
         insert into course_schedule_evaluate (music_group_id_, class_group_id_, course_schedule_id_,
                                               teacher_id_, item_, comment_,
-                                              create_time_)
+                                              create_time_,version_)
         values (#{musicGroupId,jdbcType=VARCHAR}, #{classGroupId,jdbcType=INTEGER}, #{courseScheduleId,jdbcType=BIGINT},
                 #{teacherId,jdbcType=INTEGER}, #{item,jdbcType=VARCHAR}, #{comment,jdbcType=LONGVARCHAR},
-                #{createTime,jdbcType=TIMESTAMP})
+                #{createTime,jdbcType=TIMESTAMP},#{version,jdbcType=INTEGER})
     </insert>
 
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate">
@@ -34,7 +35,7 @@
         FROM course_schedule_evaluate cse
                  LEFT JOIN practice_group pg ON pg.id_ = cse.music_group_id_
                  LEFT JOIN subject s on s.id_ = pg.subject_id_
-        WHERE cse.class_group_id_ = #{classGroupId} LIMIT 1
+        WHERE cse.class_group_id_ = #{classGroupId} ORDER BY create_time_ DESC LIMIT 1
     </select>
 
     <select id="findByClassGroupIds" resultMap="CourseScheduleEvaluate">

+ 14 - 2
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -28,6 +28,9 @@
         <result column="introduction_" property="introduction"/>
         <result column="is_support_extra_practice_lesson_" property="isSupportExtraPracticeLesson"/>
         <result column="is_support_course_schedule_rewards_rules_" property="isSupportCourseScheduleRewardsRules"/>
+        <result column="idcard_front_img_" property="idcardFrontImg"/>
+        <result column="idcard_back_img_" property="idcardBackImg"/>
+        <result column="idcard_hand_img_" property="idcardHandImg"/>
         <result column="update_time_" property="updateTime"/>
         <result column="create_time_" property="createTime"/>
 
@@ -74,8 +77,8 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Teacher" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO teacher
-        (id_,organ_id_,job_type_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,work_unit_,subject_id_,entry_date_,demission_date_,certificate_type_,certificate_num_,flow_organ_range_,introduction_,update_time_,create_time_,is_support_extra_practice_lesson_,is_support_course_schedule_rewards_rules_)
-        VALUES(#{id},#{organId},#{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{jobNature},#{isProbationPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{educationBackground},#{graduateSchool},#{technicalTitles},#{workUnit},#{subjectId},#{entryDate},#{demissionDate},#{certificateType},#{certificateNum},#{flowOrganRange},#{introduction},now(),now(),#{isSupportExtraPracticeLesson},#{isSupportCourseScheduleRewardsRules})
+        (id_,organ_id_,job_type_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,work_unit_,subject_id_,entry_date_,demission_date_,certificate_type_,certificate_num_,flow_organ_range_,introduction_,update_time_,create_time_,is_support_extra_practice_lesson_,is_support_course_schedule_rewards_rules_,idcard_front_img_,idcard_back_img_,idcard_hand_img_)
+        VALUES(#{id},#{organId},#{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{jobNature},#{isProbationPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{educationBackground},#{graduateSchool},#{technicalTitles},#{workUnit},#{subjectId},#{entryDate},#{demissionDate},#{certificateType},#{certificateNum},#{flowOrganRange},#{introduction},now(),now(),#{isSupportExtraPracticeLesson},#{isSupportCourseScheduleRewardsRules},#{idcardFrontImg},#{idcardBackImg},#{idcardHandImg})
     </insert>
 
     <insert id="addSysUser" parameterType="com.ym.mec.auth.api.entity.SysUser" useGeneratedKeys="true" keyColumn="id"
@@ -144,6 +147,15 @@
             <if test="isSupportExtraPracticeLesson != null">
                 is_support_extra_practice_lesson_ = #{isSupportExtraPracticeLesson},
             </if>
+            <if test="idcardFrontImg != null">
+                idcard_front_img_ = #{idcardFrontImg},
+            </if>
+            <if test="idcardBackImg != null">
+                idcard_back_img_ = #{idcardBackImg},
+            </if>
+            <if test="idcardHandImg != null">
+                idcard_hand_img_ = #{idcardHandImg},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>

+ 13 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudyReportController.java

@@ -5,6 +5,7 @@ import com.ym.mec.common.controller.BaseController;
 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;
@@ -23,4 +24,16 @@ public class StudyReportController extends BaseController {
 	public Object info(Integer classGroupId) {
 		return succeed(courseScheduleEvaluateService.getStudyReport(classGroupId));
 	}
+
+	@ApiOperation(value = "课程组评论列表")
+	@GetMapping("getGroupReviews")
+	public Object getGroupReviews(Integer groupId) {
+		return succeed(courseScheduleEvaluateService.findByGroupId(groupId));
+	}
+
+	@ApiOperation(value = "评论详情")
+	@GetMapping("getReviewsInfo")
+	public Object getReviewsInfo(Integer id) {
+		return succeed(courseScheduleEvaluateService.findById(id));
+	}
 }

+ 40 - 8
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherController.java

@@ -1,5 +1,20 @@
 package com.ym.mec.teacher.controller;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.Teacher;
@@ -11,14 +26,6 @@ import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.controller.BaseController;
-import io.swagger.annotations.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Date;
 
 @RequestMapping("teacher")
 @Api(tags = "教师服务")
@@ -48,6 +55,16 @@ public class TeacherController extends BaseController {
     }
 
     @ApiOperation(value = "根据教师编号查询教师基本信息")
+    @GetMapping("/queryUserInfo")
+    public Object queryUserInfo() {
+    	SysUser user = sysUserFeignService.queryUserInfo();
+		if (user == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+        return succeed(teacherService.get(user.getId()));
+    }
+
+    @ApiOperation(value = "根据教师编号查询教师基本信息")
     @GetMapping("/get")
     @ApiParam(value = "教师编号", required = true)
     public Object get(Integer id) {
@@ -118,4 +135,19 @@ public class TeacherController extends BaseController {
     public Object findSubByMusicGroupId(String musicGroupId){
         return succeed(subjectService.findSubByMusicGroupId(musicGroupId));
     }
+
+	@ApiOperation(value = "实名认证")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "realName", value = "姓名", required = true, dataType = "String"),
+			@ApiImplicitParam(name = "idcardNo", value = "身份证号码", required = true, dataType = "String"),
+			@ApiImplicitParam(name = "idcardFrontImg", value = "身份证正面", required = true, dataType = "String"),
+			@ApiImplicitParam(name = "idcardBackImg", value = "身份证背面", required = true, dataType = "String"),
+			@ApiImplicitParam(name = "idcardHandImg", value = "手持身份证照", required = true, dataType = "String") })
+	public Object realNameAuthentication(String realName, String idcardNo, String idcardFrontImg, String idcardBackImg, String idcardHandImg) {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if (user == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		teacherService.realNameAuthentication(user.getId(), realName, idcardNo, idcardFrontImg, idcardBackImg, idcardHandImg);
+		return succeed();
+	}
 }