Explorar el Código

teacher接口编写

weifanli hace 3 años
padre
commit
ab45ed1c00
Se han modificado 15 ficheros con 360 adiciones y 128 borrados
  1. 68 1
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/entity/HttpResponseResult.java
  2. 0 1
      cooleshow-gateway/gateway-web/src/main/resources/bootstrap-dev.properties
  3. 10 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherAuthEntryRecordDao.java
  4. 22 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/AuthOperaDto.java
  5. 16 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/TeacherAuthEntryRecordSearch.java
  6. 7 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TeacherAuthEntryRecord.java
  7. 22 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherAuthEntryRecordService.java
  8. 49 6
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherAuthEntryRecordServiceImpl.java
  9. 23 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/Condition.java
  10. 2 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/Query.java
  11. 38 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherAuthEntryRecordVo.java
  12. 76 56
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherAuthEntryRecordMapper.xml
  13. 23 53
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherAuthEntryRecordController.java
  14. 2 0
      cooleshow-user/user-teacher/src/main/resources/bootstrap-dev.yml
  15. 2 2
      toolset/utils/src/main/java/com/yonge/toolset/utils/idcard/IdcardInfoExtractor.java

+ 68 - 1
cooleshow-common/src/main/java/com/yonge/cooleshow/common/entity/HttpResponseResult.java

@@ -1,8 +1,29 @@
 package com.yonge.cooleshow.common.entity;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.toolset.thirdparty.exception.ThirdpartyException;
+import com.yonge.toolset.utils.http.HttpUtil;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.springframework.context.support.DefaultMessageSourceResolvable;
 import org.springframework.http.HttpStatus;
-
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.validation.BindException;
+import org.springframework.validation.FieldError;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.servlet.http.HttpServletRequest;
+import java.net.URLEncoder;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * HttpResponse 返回结果
@@ -79,4 +100,50 @@ public class HttpResponseResult<T> {
 	public void setNowTime(Date nowTime) {
 		this.nowTime = nowTime;
 	}
+
+
+	public static <T> HttpResponseResult<T> succeed(T object) {
+		return getResponseData(true, HttpStatus.OK, object, "");
+	}
+
+	public static <T> HttpResponseResult<T> succeed() {
+		return getResponseData(true, HttpStatus.OK, null, "");
+	}
+
+	public static <T> HttpResponseResult<T> succeedData(T obj) {
+		return getResponseData(true, HttpStatus.OK, obj, "操作成功");
+	}
+
+	public static <T> HttpResponseResult<T> warned(String message) {
+		return failed(HttpStatus.MULTI_STATUS, message);
+	}
+
+	public static <T> HttpResponseResult<T> failed() {
+		return failed("");
+	}
+
+	public static <T> HttpResponseResult<T> failed(String msg) {
+		return failed(HttpStatus.INTERNAL_SERVER_ERROR, msg);
+	}
+
+	public static <T> HttpResponseResult<T> failed(HttpStatus statusCode, String msg) {
+		return getResponseData(false, statusCode, null, msg);
+	}
+
+	public static <T> HttpResponseResult<T> status(boolean flag) {
+		return flag ? succeed() : failed("操作失败");
+	}
+
+	public static <T> HttpResponseResult<T> failed(HttpStatus statusCode, T data, String msg) {
+		return getResponseData(false, statusCode, data, msg);
+	}
+
+	private static <T> HttpResponseResult<T> getResponseData(boolean status, HttpStatus statusCode, T data, String message) {
+		HttpResponseResult<T> obj = new HttpResponseResult<T>();
+		obj.setStatus(status);
+		obj.setCode(statusCode.value());
+		obj.setData(data);
+		obj.setMsg(message);
+		return obj;
+	}
 }

+ 0 - 1
cooleshow-gateway/gateway-web/src/main/resources/bootstrap-dev.properties

@@ -3,7 +3,6 @@
 #\u670d\u52a1\u5668\u5730\u5740
 spring.cloud.nacos.config.server-addr=47.114.1.200:8848
 
-
 #\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
 spring.cloud.nacos.config.namespace=6f8374a9-598f-4889-bb17-476070ffb8de
 #\u6307\u5b9a\u914d\u7f6e\u7fa4\u7ec4 --\u5982\u679c\u662fPublic\u547d\u540d\u7a7a\u95f4 \u5219\u53ef\u4ee5\u7701\u7565\u7fa4\u7ec4\u914d\u7f6e

+ 10 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherAuthEntryRecordDao.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.dto.TeacherApplyDetailDto;
 import com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord;
+import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
 import io.swagger.models.auth.In;
 import org.apache.ibatis.annotations.Param;
 
@@ -14,7 +15,7 @@ public interface TeacherAuthEntryRecordDao extends BaseMapper<TeacherAuthEntryRe
 	/**
 	 * 自定义分页
 	 */
-	List<TeacherAuthEntryRecord> selectPage(IPage page, TeacherAuthEntryRecord teacherAuthEntryRecord);
+	List<TeacherAuthEntryRecordVo> selectPage(IPage page, TeacherAuthEntryRecord teacherAuthEntryRecord);
 
 	/***
 	 * 修改用户实名信息
@@ -24,4 +25,12 @@ public interface TeacherAuthEntryRecordDao extends BaseMapper<TeacherAuthEntryRe
 	 * @return: java.lang.Integer
 	 */
 	Integer updateUserCard(@Param("param") TeacherApplyDetailDto teacherApplyDetailDto);
+	/***
+	 * 根据老师id查询详情
+	 * @author liweifan
+	 * @param: id
+	 * @updateTime 2022/3/21 13:43
+	 * @return: com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo
+	 */
+    TeacherAuthEntryRecordVo detail(@Param("id") Long id);
 }

+ 22 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/AuthOperaDto.java

@@ -0,0 +1,22 @@
+package com.yonge.cooleshow.biz.dal.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 审核操作对象
+ *
+ * @Author: liweifan
+ * @Data: 2022/3/18 15:04
+ */
+@Data
+@ApiModel(value = "AuthOperaDto", description = "审核操作对象")
+public class AuthOperaDto {
+    @ApiModelProperty(value = "审核单id", required = true)
+    private Long id;
+    @ApiModelProperty(value = "审核是否通过", required = true)
+    private Boolean isPass;
+    @ApiModelProperty(value = "审核理由", required = true)
+    private String reason;
+}

+ 16 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/TeacherAuthEntryRecordSearch.java

@@ -0,0 +1,16 @@
+package com.yonge.cooleshow.biz.dal.dto.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/21 15:26
+ */
+@Data
+@ApiModel(value = "TeacherAuthEntryRecordSearch", description = "老师入驻审核列表查询")
+public class TeacherAuthEntryRecordSearch {
+    @ApiModelProperty(value = "老师编号/名称/电话", required = true)
+    private String search;
+}

+ 7 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TeacherAuthEntryRecord.java

@@ -8,17 +8,23 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.NoArgsConstructor;
 import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 老师入驻审核表
  */
 @Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
 @TableName("teacher_auth_entry_record")
 @ApiModel(value = "TeacherAuthEntryRecord对象", description = "老师入驻审核表")
 public class TeacherAuthEntryRecord implements Serializable {
@@ -27,7 +33,7 @@ public class TeacherAuthEntryRecord implements Serializable {
     * 审核单id 
     */
     @ApiModelProperty("审核单id ")
-    @TableId(value = "id_", type = IdType.UUID)
+    @TableId(value = "id_", type = IdType.AUTO)
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
     /** 

+ 22 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherAuthEntryRecordService.java

@@ -3,8 +3,11 @@ package com.yonge.cooleshow.biz.dal.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.AuthOperaDto;
 import com.yonge.cooleshow.biz.dal.dto.TeacherApplyDetailDto;
 import com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord;
+import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 
 /**
  * 老师入驻审核表 服务类
@@ -12,14 +15,12 @@ import com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord;
  * @date 2022-03-18
  */
 public interface TeacherAuthEntryRecordService extends IService<TeacherAuthEntryRecord>  {
-
-
     /**
      * 自定义分页
      * @author liweifan
  	 * @date 2022-03-18
      */
-    IPage<TeacherAuthEntryRecord> selectPage(IPage<TeacherAuthEntryRecord> page, TeacherAuthEntryRecord teacherAuthEntryRecord);
+    IPage<TeacherAuthEntryRecordVo> selectPage(IPage<TeacherAuthEntryRecordVo> page, TeacherAuthEntryRecord teacherAuthEntryRecord);
     /***
      * 老师入驻申请
      * @author liweifan
@@ -28,5 +29,22 @@ public interface TeacherAuthEntryRecordService extends IService<TeacherAuthEntry
      * @updateTime 2022/3/18 15:38
      * @return: java.lang.Boolean
      */
-    Boolean doApply(TeacherApplyDetailDto teacherApplyDetailDto, SysUser sysUser);
+    HttpResponseResult<Boolean> doApply(TeacherApplyDetailDto teacherApplyDetailDto, SysUser sysUser) throws Exception;
+    /***
+     * 根据老师id查询审批单详情
+     * @author liweifan
+     * @param: id
+     * @updateTime 2022/3/21 13:42
+     * @return: com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo
+     */
+    TeacherAuthEntryRecordVo detail(Long id);
+    /***
+     * 审核
+     * @author liweifan
+     * @param: authOperaDto
+     * @param: sysUser
+     * @updateTime 2022/3/21 14:21
+     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.lang.Boolean>
+     */
+    HttpResponseResult<Boolean> doAuth(AuthOperaDto authOperaDto, SysUser sysUser);
 }

+ 49 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherAuthEntryRecordServiceImpl.java

@@ -1,13 +1,22 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.AuthOperaDto;
 import com.yonge.cooleshow.biz.dal.dto.TeacherApplyDetailDto;
+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.stereotype.Service;
 import com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord;
 import com.yonge.cooleshow.biz.dal.dao.TeacherAuthEntryRecordDao;
 import com.yonge.cooleshow.biz.dal.service.TeacherAuthEntryRecordService;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.lang.reflect.InvocationTargetException;
 
 
 @Service
@@ -16,22 +25,56 @@ public class TeacherAuthEntryRecordServiceImpl extends ServiceImpl<TeacherAuthEn
     /**
      * 分页查询
      */
-     @Override
-    public IPage<TeacherAuthEntryRecord> selectPage(IPage<TeacherAuthEntryRecord> page, TeacherAuthEntryRecord teacherAuthEntryRecord){
+    @Override
+    public IPage<TeacherAuthEntryRecordVo> selectPage(IPage<TeacherAuthEntryRecordVo> page, TeacherAuthEntryRecord teacherAuthEntryRecord) {
         return page.setRecords(baseMapper.selectPage(page, teacherAuthEntryRecord));
     }
 
     @Override
-    public Boolean doApply(TeacherApplyDetailDto teacherApplyDetailDto, SysUser sysUser) {
+    @Transactional(rollbackFor = Exception.class)
+    public HttpResponseResult<Boolean> doApply(TeacherApplyDetailDto teacherApplyDetailDto, SysUser sysUser) throws Exception {
         teacherApplyDetailDto.setUserId(sysUser.getId());
+        //判断用户是否已经提交申请
+        if (hasApply(sysUser.getId())) {
+            return HttpResponseResult.failed("已经提交过申请");
+        }
         //修改用户表
-        Integer integer = baseMapper.updateUserCard(teacherApplyDetailDto);
-        //
+        baseMapper.updateUserCard(teacherApplyDetailDto);
+        //新增申请记录
+        TeacherAuthEntryRecord teacherAuthEntryRecord = new TeacherAuthEntryRecord();
+        BeanUtils.copyProperties(teacherApplyDetailDto, teacherAuthEntryRecord);
 
-        return null;
+        return HttpResponseResult.status(baseMapper.insert(teacherAuthEntryRecord) > 0);
     }
 
+    @Override
+    public TeacherAuthEntryRecordVo detail(Long id) {
+        return baseMapper.detail(id);
+    }
 
+    @Override
+    public HttpResponseResult<Boolean> doAuth(AuthOperaDto authOperaDto, SysUser sysUser) {
+        TeacherAuthEntryRecord build = TeacherAuthEntryRecord.builder()
+                .id(authOperaDto.getId())
+                .teacherAuthStatus(authOperaDto.getIsPass() ? AuthStatusEnum.PASS.getCode() : AuthStatusEnum.UNPASS.getCode())
+                .reason(authOperaDto.getReason())
+                .build();
+        return HttpResponseResult.succeed(baseMapper.updateById(build) > 0);
+    }
+
+    /***
+     * 判断用户是否已经提交申请
+     * @author liweifan
+     * @param: userId
+     * @updateTime 2022/3/21 11:37
+     * @return: java.lang.Boolean
+     */
+    private Boolean hasApply(Long userId) {
+        TeacherAuthEntryRecord teacherAuthEntryRecord = baseMapper.selectOne(Wrappers.<TeacherAuthEntryRecord>query().lambda()
+                .eq(TeacherAuthEntryRecord::getUserId, userId)
+                .eq(TeacherAuthEntryRecord::getTeacherAuthStatus, 1));
+        return teacherAuthEntryRecord != null;
+    }
 
 
 }

+ 23 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/Condition.java

@@ -3,10 +3,12 @@ package com.yonge.cooleshow.biz.dal.support;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.toolset.utils.string.StringUtil;
 import org.springframework.beans.BeanUtils;
 
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * 分页工具
@@ -27,7 +29,7 @@ public class Condition {
 	 * @return IPage
 	 */
 	public static <T> IPage<T> getPage(Query query) {
-		Page<T> page = new Page<T>(toInt(query.getCurrent(),1), toInt(query.getSize(),10));
+		Page<T> page = new Page<T>(toInt(query.getPage(),1), toInt(query.getRows(),10));
 		page.setAsc(StringUtil.toStrArray(SqlKeyword.filter(query.getAscs())));
 		page.setDesc(StringUtil.toStrArray(SqlKeyword.filter(query.getDescs())));
 		return page;
@@ -61,4 +63,24 @@ public class Condition {
 		return qw;
 	}
 
+
+	/**
+	 * 将mybatisPlus的分页模型 转换为本项目的分页模型
+	 *
+	 * @param source  mybatisPlus的分页模型
+	 * @param <T>返回的类
+	 */
+	public static <T> PageInfo<T> pageInfo(IPage<T> source) {
+		if (Objects.isNull(source)) {
+			return new PageInfo<>(1, 20);
+		}
+		int total = Integer.parseInt(String.valueOf(source.getTotal()));
+		int limit = Integer.parseInt(String.valueOf(source.getSize()));
+		PageInfo<T> resultPage = new PageInfo<>();
+		resultPage.setRows(source.getRecords());
+		resultPage.setLimit(limit);
+		resultPage.setTotal(total);
+		return resultPage;
+	}
+
 }

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/Query.java

@@ -19,13 +19,13 @@ public class Query {
 	 * 当前页
 	 */
 	@ApiModelProperty(value = "当前页")
-	private Integer current;
+	private Integer page;
 
 	/**
 	 * 每页的数量
 	 */
 	@ApiModelProperty(value = "每页的数量")
-	private Integer size;
+	private Integer rows;
 
 	/**
 	 * 正排序规则

+ 38 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherAuthEntryRecordVo.java

@@ -0,0 +1,38 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/21 13:34
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "TeacherAuthEntryRecordVo对象", description = "老师入驻审核详情")
+public class TeacherAuthEntryRecordVo extends TeacherAuthEntryRecord {
+
+    @ApiModelProperty(value = "真实姓名")
+    private String realName;
+
+    @ApiModelProperty(value = "身份证号")
+    private String idCardNo;
+
+    @ApiModelProperty(value = "性别(0,女  1,男)")
+    private String gender;
+
+    @ApiModelProperty("手机号 ")
+    private String phone;
+
+    @ApiModelProperty(value = "专业技能")
+    private String subjectName;
+
+    @ApiModelProperty("审核人 ")
+    private String verifyUser;
+}

+ 76 - 56
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherAuthEntryRecordMapper.xml

@@ -1,66 +1,86 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE  mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.yonge.cooleshow.biz.dal.dao.TeacherAuthEntryRecordDao">
-	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord">
-            <result column="id_" property="id" />
-	        <result column="user_id_" property="userId" />
-	        <result column="subject_id_" property="subjectId" />
-	        <result column="introduction_" property="introduction" />
-	        <result column="graduate_school_" property="graduateSchool" />
-	        <result column="subject_" property="subject" />
-	        <result column="grad_certificate_" property="gradCertificate" />
-	        <result column="degree__certificate_" property="degreeCertificate" />
-	        <result column="teacher__certificate_" property="teacherCertificate" />
-	        <result column="teacher_auth_status_" property="teacherAuthStatus" />
-	        <result column="verify_user_id_" property="verifyUserId" />
-	        <result column="reason_" property="reason" />
-	        <result column="create_time_" property="createTime" />
-	        <result column="update_time_" property="updateTime" />
-		</resultMap>  
-    
+    <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord">
+        <result column="id_" property="id"/>
+        <result column="user_id_" property="userId"/>
+        <result column="subject_id_" property="subjectId"/>
+        <result column="introduction_" property="introduction"/>
+        <result column="graduate_school_" property="graduateSchool"/>
+        <result column="subject_" property="subject"/>
+        <result column="grad_certificate_" property="gradCertificate"/>
+        <result column="degree__certificate_" property="degreeCertificate"/>
+        <result column="teacher__certificate_" property="teacherCertificate"/>
+        <result column="teacher_auth_status_" property="teacherAuthStatus"/>
+        <result column="verify_user_id_" property="verifyUserId"/>
+        <result column="reason_" property="reason"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+    </resultMap>
+
     <!-- 表字段 -->
     <sql id="baseColumns">
-         t.id_
-        , t.user_id_
-        , t.subject_id_
-        , t.introduction_
-        , t.graduate_school_
-        , t.subject_
-        , t.grad_certificate_
-        , t.degree__certificate_
-        , t.teacher__certificate_
-        , t.teacher_auth_status_
-        , t.verify_user_id_
-        , t.reason_
-        , t.create_time_
-        , t.update_time_
+         t.id_ as "id"
+        , t.user_id_ as "userId"
+        , t.subject_id_ as "subjectId"
+        , t.introduction_ as "introduction"
+        , t.graduate_school_ as "graduateSchool"
+        , t.subject_ as "subject"
+        , t.grad_certificate_ as "gradCertificate"
+        , t.degree__certificate_ as "degreeCertificate"
+        , t.teacher__certificate_ as "teacherCertificate"
+        , t.teacher_auth_status_ as "teacherAuthStatus"
+        , t.verify_user_id_ as "verifyUserId"
+        , t.reason_ as "reason"
+        , t.create_time_ as "createTime"
+        , t.update_time_ as "updateTime"
         </sql>
 
-	<update id="updateUserCard">
-		UPDATE sys_user
-		<set>
-			<if test="realName != null and realName != ''">
-				real_name_ = #{param.realName},
-			</if>
-			<if test="idCardNo != null and idCardNo != ''">
-				id_card_no_ = #{param.idCardNo},
-			</if>
-			<if test="gender != null and gender != ''">
-				gender_ = #{param.gender},
-			</if>
-			<if test="birthdate != null">
-				birthdate_ = #{param.birthdate},
-			</if>
-		</set>
-		WHERE id_ = #{param.userId}
-	</update>
-
+    <update id="updateUserCard">
+        UPDATE sys_user
+        <set>
+            <if test="realName != null and realName != ''">
+                real_name_ = #{param.realName},
+            </if>
+            <if test="idCardNo != null and idCardNo != ''">
+                id_card_no_ = #{param.idCardNo},
+            </if>
+            <if test="gender != null and gender != ''">
+                gender_ = #{param.gender},
+            </if>
+            <if test="birthdate != null">
+                birthdate_ = #{param.birthdate},
+            </if>
+        </set>
+        WHERE id_ = #{param.userId}
+    </update>
 
+    <!-- 分页查询 -->
+    <select id="selectPage" resultType = "com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo">
+        SELECT
+            <include refid="baseColumns"/>
+            u.real_name_ as realName,
+            u.id_card_no_ as idCardNo,
+            u.phone_ as phone
+        FROM teacher_auth_entry_record t
+        left join sys_user u on t.user_id_ = u.id_
+        where
+    </select>
 
-	<!-- 分页查询 -->
-    <select id="selectPage" resultMap="BaseResultMap">
-		SELECT         
-        	<include refid="baseColumns" />
-		FROM teacher_auth_entry_record t
-	</select>
+    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo">
+        select
+        	<include refid="baseColumns"/>
+			u.real_name_ as realName,
+			u.id_card_no_ as idCardNo,
+			u.gender_ as gender,
+			(
+                SELECT GROUP_CONCAT(name_) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
+            ) as subjectName,
+            (
+                SELECT u.username_ FROM sys_user u WHERE u.id_ = t.verify_user_id_
+            ) as verifyUser
+        from teacher_auth_entry_record t
+        left join sys_user u on t.user_id_ = u.id_
+        where t.id_ = #{id}
+    </select>
 </mapper>

+ 23 - 53
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherAuthEntryRecordController.java

@@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.AuthOperaDto;
 import com.yonge.cooleshow.biz.dal.dto.RealnameAuthDto;
 import com.yonge.cooleshow.biz.dal.dto.TeacherApplyDetailDto;
 import com.yonge.cooleshow.biz.dal.support.Condition;
 import com.yonge.cooleshow.biz.dal.support.Query;
+import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.toolset.thirdparty.user.realname.RealnameAuthenticationPlugin;
 import com.yonge.toolset.utils.idcard.IdcardInfoExtractor;
 import com.yonge.toolset.utils.idcard.IdcardValidator;
@@ -23,8 +26,6 @@ import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.Valid;
-
 import com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord;
 import com.yonge.cooleshow.biz.dal.service.TeacherAuthEntryRecordService;
 
@@ -40,9 +41,10 @@ public class TeacherAuthEntryRecordController extends BaseController {
     @Autowired
     private RealnameAuthenticationPlugin realnameAuthenticationPlugin;
 
-    @GetMapping("/realnameAuth")
+    @PostMapping("/realnameAuth")
     @ApiOperation(value = "实名认证", notes = "传入realnameAuthDto")
-    public HttpResponseResult<IdcardInfoExtractor> realnameAuth(RealnameAuthDto realnameAuthDto) {
+    @ResponseBody
+    public HttpResponseResult<IdcardInfoExtractor> realnameAuth(@RequestBody RealnameAuthDto realnameAuthDto) {
         IdcardValidator idcardValidator = new IdcardValidator();
         //验证身份证号合法性
         boolean validatedAllIdcard = idcardValidator.isValidatedAllIdcard(realnameAuthDto.getIdcardNo());
@@ -59,35 +61,12 @@ public class TeacherAuthEntryRecordController extends BaseController {
         }
     }
 
-    @GetMapping("/doApply")
+    @PostMapping("/doApply")
     @ApiOperation(value = "提交申请", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult<Boolean> doApply(TeacherApplyDetailDto teacherApplyDetailDto) {
+    public HttpResponseResult<Boolean> doApply(TeacherApplyDetailDto teacherApplyDetailDto) throws Exception{
         SysUser sysUser = sysUserFeignService.queryUserInfo();
 		//处理老师申请逻辑
-        Boolean b = teacherAuthEntryRecordService.doApply(teacherApplyDetailDto, sysUser);
-        return succeed(b);
-    }
-
-
-    /**
-     * 查询单条
-     */
-    @GetMapping("/detail")
-    @ApiOperation(value = "详情", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult<TeacherAuthEntryRecord> detail(TeacherAuthEntryRecord teacherAuthEntryRecord) {
-        TeacherAuthEntryRecord detail = teacherAuthEntryRecordService.getOne(Condition.getQueryWrapper(teacherAuthEntryRecord));
-        return succeed(detail);
-    }
-
-
-    /**
-     * 查询集合
-     */
-    @GetMapping("/list")
-    @ApiOperation(value = "查询集合", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult<List<TeacherAuthEntryRecord>> list(TeacherAuthEntryRecord teacherAuthEntryRecord) {
-        List<TeacherAuthEntryRecord> list = teacherAuthEntryRecordService.list();
-        return succeed(list);
+        return teacherAuthEntryRecordService.doApply(teacherApplyDetailDto, sysUser);
     }
 
     /**
@@ -95,36 +74,27 @@ public class TeacherAuthEntryRecordController extends BaseController {
      */
     @GetMapping("/page")
     @ApiOperation(value = "查询分页", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult<IPage<TeacherAuthEntryRecord>> page(TeacherAuthEntryRecord teacherAuthEntryRecord, Query query) {
-        IPage<TeacherAuthEntryRecord> pages = teacherAuthEntryRecordService.selectPage(Condition.getPage(query), teacherAuthEntryRecord);
-        return succeed(pages);
+    public HttpResponseResult<PageInfo<TeacherAuthEntryRecordVo>> page(TeacherAuthEntryRecord teacherAuthEntryRecord, Query query) {
+        IPage<TeacherAuthEntryRecordVo> pages = teacherAuthEntryRecordService.selectPage(Condition.getPage(query), teacherAuthEntryRecord);
+        return succeed(Condition.pageInfo(pages));
     }
 
     /**
-     * 新增
+     * 查询单条详情
      */
-    @PostMapping("/save")
-    @ApiOperation(value = "新增", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult save(@Valid @RequestBody TeacherAuthEntryRecord teacherAuthEntryRecord) {
-        return status(teacherAuthEntryRecordService.save(teacherAuthEntryRecord));
+    @GetMapping("/detail")
+    @ApiOperation(value = "详情", notes = "传入teacherAuthEntryRecord")
+    public HttpResponseResult<TeacherAuthEntryRecordVo> detail(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
+        TeacherAuthEntryRecordVo detail =  teacherAuthEntryRecordService.detail(id);
+        return succeed(detail);
     }
 
-    /**
-     * 修改
-     */
-    @PostMapping("/update")
-    @ApiOperation(value = "修改", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult update(@Valid @RequestBody TeacherAuthEntryRecord teacherAuthEntryRecord) {
-        return status(teacherAuthEntryRecordService.updateById(teacherAuthEntryRecord));
-    }
 
-    /**
-     * 新增或修改
-     */
-    @PostMapping("/submit")
-    @ApiOperation(value = "新增或修改", notes = "传入teacherAuthEntryRecord")
-    public HttpResponseResult submit(@RequestBody TeacherAuthEntryRecord teacherAuthEntryRecord) {
-        return status(teacherAuthEntryRecordService.saveOrUpdate(teacherAuthEntryRecord));
+    @PostMapping("/doAuth")
+    @ApiOperation(value = "审核", notes = "传入authOperaDto")
+    public HttpResponseResult<Boolean> doAuth(AuthOperaDto authOperaDto) throws Exception{
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        return teacherAuthEntryRecordService.doAuth(authOperaDto, sysUser);
     }
 
     /**

+ 2 - 0
cooleshow-user/user-teacher/src/main/resources/bootstrap-dev.yml

@@ -1,4 +1,6 @@
 spring:
+  application:
+    name: teacher-server
   cloud:
     nacos:
       config:

+ 2 - 2
toolset/utils/src/main/java/com/yonge/toolset/utils/idcard/IdcardInfoExtractor.java

@@ -133,9 +133,9 @@ public class IdcardInfoExtractor {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
-	public static void main(String[] args) {
+	/*public static void main(String[] args) {
 		IdcardInfoExtractor extractor = new IdcardInfoExtractor("421125198708123013", true);
 		System.out.println(extractor);
-	}
+	}*/
 
 }