浏览代码

Merge branch 'feature/0427-school' into master_saas

liujc 2 年之前
父节点
当前提交
422db85eda

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroup.java

@@ -31,7 +31,7 @@ public class ImGroup extends BaseEntity {
 	
 	private String img;
 
-	/** 乐团群 MUSIC,班级群 CLASS,训练营 TRAINING */
+	/** 乐团群 MUSIC,班级群 CLASS,训练营 TRAINING 学校SCHOOL*/
 	private String type;
 
 	public enum GroupTypeEnum implements BaseEnum<String,GroupTypeEnum> {

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/EFriendRoleType.java

@@ -10,6 +10,7 @@ public enum EFriendRoleType implements BaseEnum<Integer, EFriendRoleType> {
     SCHOOL_LEADER(3,"分管领导"),
     SCHOOL_TEACHER(4,"负责老师"),
     ORCHESTRA_MANAGER(5,"乐团主管"),
+    MAINTENANCE_TECHNICIAN(6,"乐团主管"),
     ORCHESTRA_TEACHER(7,"指导老师"),
     STUDENT(8,"学生"),
 

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SchoolStaffService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.wrapper.SchoolStaffWrapper;
 import com.ym.mec.biz.dal.entity.SchoolStaff;
 
@@ -74,4 +75,20 @@ public interface SchoolStaffService extends IService<SchoolStaff>  {
      * @param id 用户ID
      */
     Boolean del(Long id);
+
+    /**
+     * 实名认证
+     *
+     * @param realName 姓名
+     * @param idcardNo 身份证号
+     */
+    void realNameAuthentication(SysUser user, String realName, String idcardNo);
+
+    /**
+     * 查询学校员工信息
+     *
+     * @param userId 用户ID
+     * @return SchoolStaff
+     */
+    SchoolStaff getByUserId(Integer userId);
 }

+ 46 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SchoolStaffServiceImpl.java

@@ -19,6 +19,8 @@ import com.ym.mec.biz.dal.wrapper.StatGroupWrapper;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
+import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -64,6 +66,8 @@ public class SchoolStaffServiceImpl extends ServiceImpl<SchoolStaffMapper, Schoo
     private ImUserFriendDao imUserFriendDao;
 
 
+    @Autowired
+    private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
 
     @Value("${message.debugMode:false}")
     private boolean debugMode;
@@ -535,5 +539,47 @@ public class SchoolStaffServiceImpl extends ServiceImpl<SchoolStaffMapper, Schoo
 
     }
 
+    /**
+     * 实名认证
+     *
+     * @param realName 姓名
+     * @param idcardNo 身份证号
+     */
+    @Override
+    public void realNameAuthentication(SysUser user,String realName, String idcardNo) {
+
+
+        SchoolStaff schoolStaff = schoolStaffService.getByUserId(user.getId());
+        if (schoolStaff == null) {
+            throw new BizException("用户信息不存在");
+        }
+
+        // 验证数据合法
+        if (!debugMode) {
+            realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idcardNo);
+        }
+
+        // 保存到sys_user表中
+        user.setRealName(realName);
+        user.setIdCardNo(idcardNo);
+        user.setUpdateTime(new Date());
+        teacherDao.updateUser(user);
+    }
+
+    /**
+     * 查询学校员工信息
+     *
+     * @param userId 用户ID
+     * @return SchoolStaff
+     */
+    @Override
+    public SchoolStaff getByUserId(Integer userId) {
+        return this.lambdaQuery()
+                .eq(SchoolStaff::getUserId, userId)
+                .ne(SchoolStaff::getStatus, -1)
+                .last("limit 1")
+                .one();
+    }
+
 
 }

+ 19 - 0
mec-web/src/main/java/com/ym/mec/web/controller/school/SchoolStaffController.java

@@ -20,6 +20,8 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageUtil;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -231,4 +233,21 @@ public class SchoolStaffController extends BaseController {
         return succeed();
     }
 
+
+    @ApiOperation(value = "实名认证")
+    @PostMapping("/realNameAuthentication")
+    @ApiImplicitParams({ @ApiImplicitParam(name = "realName", value = "姓名", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "idcardNo", value = "身份证号码", required = true, dataType = "String")})
+    public Object realNameAuthentication(String realName, String idcardNo) {
+
+        if (StringUtils.isBlank(realName)) {
+            throw new BizException("姓名不能为空");
+        }
+        if (StringUtils.isBlank(idcardNo)) {
+            throw new BizException("身份证号不能为空");
+        }
+        schoolStaffService.realNameAuthentication(sysUserFeignService.queryUserInfo(),realName, idcardNo);
+        return succeed();
+    }
+
 }