| 
					
				 | 
			
			
				@@ -5,6 +5,8 @@ import com.yonge.cooleshow.auth.api.client.SysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.auth.api.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.entity.Student; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.entity.TenantInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.service.SmsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.StudentService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.TenantInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -14,6 +16,7 @@ import com.yonge.cooleshow.tenant.vo.StudentVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.base.exception.BizException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.validation.annotation.Validated; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.PostMapping; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,9 +39,20 @@ public class OpenStudentController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysUserFeignService sysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private SmsCodeService smsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("/save") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "新增/修改", notes = "传入Student,换绑时按照返回错误码5004判断,是否需要换绑,updateTenant=true表示换绑") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public HttpResponseResult<Boolean> save(@Validated @RequestBody StudentVo.Student student) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String code = student.getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isEmpty(code)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("验证码不能为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!smsCodeService.verifyValidCode(student.getPhone(), code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MessageTypeEnum.SMS_VERIFY_CODE_REGISTER.getCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("验证码错误"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long tenantId = student.getTenantId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (tenantId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("未指定机构"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -64,7 +78,8 @@ public class OpenStudentController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (one != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (one.getTenantId().equals(-1L)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new BizException("该手机号已经注册为平台学生"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else if (!one.getTenantId().equals(tenantId) && !student.getUpdateTenant()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (!one.getTenantId().equals(tenantId) && (student.getUpdateTenant() == null || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        !student.getUpdateTenant())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new BizException(5004, "该手机号已经注册为其他平台学生"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 |