| 
					
				 | 
			
			
				@@ -1,10 +1,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.yonge.cooleshow.tenant.controller.open; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.entity.TenantEntryRecord; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.entity.TenantApplyRecord; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.entity.TenantStaff; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.SmsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.TenantApplyRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.service.TenantEntryRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.TenantStaffService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.common.entity.HttpResponseResult; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,9 +36,6 @@ public class OpenTenantController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SmsCodeService smsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private TenantEntryRecordService tenantEntryRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("/apply") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "申请") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -61,17 +58,20 @@ public class OpenTenantController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!validCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("验证码错误"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        TenantStaff tenantStaff = tenantStaffService.getByPhone(phone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (tenantStaff == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TenantApplyRecord one = tenantApplyRecordService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(TenantApplyRecord::getPhone, phone) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .orderByDesc(TenantApplyRecord::getCreateTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .last("limit 1").one(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (one == null || AuthStatusEnum.UNPASS.equals(one.getStatus())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException(5002, "请先申请机构入驻"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        TenantEntryRecord one = tenantEntryRecordService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .eq(TenantEntryRecord::getPhone, phone) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .eq(TenantEntryRecord::getStatus, "DOING") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .last("limit 1").one(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (one != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (AuthStatusEnum.DOING.equals(one.getStatus())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException(5003, "请等待审核完成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TenantStaff tenantStaff = tenantStaffService.getByPhone(phone); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tenantStaff == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("账号注册失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tenantStaff.setWxOpenid(openId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tenantStaffService.updateById(tenantStaff); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return HttpResponseResult.succeed(); 
			 |