|  | @@ -1,10 +1,13 @@
 | 
	
		
			
				|  |  |  package com.yonge.cooleshow.tenant.controller.open;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.TenantApplyRecord;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 | 
	
		
			
				|  |  |  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.SysConfigService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.TenantApplyRecordService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
	
		
			
				|  | @@ -37,6 +40,12 @@ public class OpenTenantController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SmsCodeService smsCodeService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TenantInfoService tenantInfoService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysConfigService sysConfigService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @PostMapping("/apply")
 | 
	
		
			
				|  |  |      @ApiOperation(value = "申请")
 | 
	
	
		
			
				|  | @@ -78,6 +87,15 @@ public class OpenTenantController {
 | 
	
		
			
				|  |  |                  throw new BizException(5003, "请等待审核完成");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        Long tenantId = tenantStaff.getTenantId();
 | 
	
		
			
				|  |  | +        TenantInfo tenantInfo = tenantInfoService.getById(tenantId);
 | 
	
		
			
				|  |  | +        if(tenantInfo == null){
 | 
	
		
			
				|  |  | +            throw new BizException("机构不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (Boolean.FALSE.equals(tenantInfo.getEnableFlag())) {
 | 
	
		
			
				|  |  | +            String configValue = sysConfigService.findConfigValue("customer_service_phone");
 | 
	
		
			
				|  |  | +            throw new BizException(5004, "机构已停用,请联系客服/n" + (StringUtils.isEmpty(configValue) ? "" : configValue));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          tenantStaff.setWxOpenid(openId);
 | 
	
		
			
				|  |  |          tenantStaffService.updateById(tenantStaff);
 | 
	
		
			
				|  |  |          return HttpResponseResult.succeed();
 |