Bladeren bron

Merge remote-tracking branch 'origin/master'

周箭河 5 jaren geleden
bovenliggende
commit
25f68b4182

+ 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);
+
 }

+ 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;
+	}
+
 }

+ 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>

+ 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();
+	}
 }