yonge 3 年之前
父节点
当前提交
1b0becaa16
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      mec-student/src/main/java/com/ym/mec/student/controller/StudentController.java

+ 12 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudentController.java

@@ -12,9 +12,11 @@ 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.StudentPreRegistration;
 import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 
 @RequestMapping("student")
 @Api(tags = "学生服务")
@@ -29,7 +31,16 @@ public class StudentController extends BaseController {
 
     @ApiOperation("注册")
     @PostMapping(value = "/registering")
-    public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
+    public Object registering(@RequestBody StudentPreRegistration studentPreRegistration) {
+
+    	// 判断用户是否存在
+        SysUser user = sysUserFeignService.queryUserByMobile(studentPreRegistration.getPhone());
+        if(user != null && user.getId() != null){
+        	if(user.getUserType().contains("STUDENT")){
+        		return succeed("您已注册,请直接下载APP!");
+        	}
+        }
+        
         return studentService.register(studentPreRegistration) ? succeed() : failed();
     }