| 
					
				 | 
			
			
				@@ -1,25 +1,31 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.yonge.cooleshow.biz.dal.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.api.feign.dto.EmployeeApi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.api.feign.dto.StudentApi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.api.feign.dto.TeacherApi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.api.feign.dto.TenantWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.auth.api.client.SysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.auth.api.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.entity.SysConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.entity.SysMessage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.ClientEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.MessageSendMode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.service.SmsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.service.SysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.service.SysMessageService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.common.constant.SysConfigConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.common.enums.SysUserType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.common.enums.UserLockFlag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.common.security.SecurityConstants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.base.exception.BizException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.data.redis.core.RedisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.security.authentication.LockedException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.security.core.userdetails.UsernameNotFoundException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Optional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class SmsCodeServiceImpl implements SmsCodeService { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -33,6 +39,21 @@ public class SmsCodeServiceImpl implements SmsCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private RedisTemplate<String,String> redisTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private EmployeeService employeeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private StudentService studentService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private TeacherService teacherService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private TenantStaffService tenantStaffService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private TenantInfoService tenantInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public boolean verifyValidCode(String mobile, String authCode, String type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		MessageTypeEnum typeEnum; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -84,6 +105,54 @@ public class SmsCodeServiceImpl implements SmsCodeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Long userId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (sysUser != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			userId = sysUser.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 如果是登陆,判断账号是否被锁定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ("LOGIN".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 判断账号是否被锁定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (sysUser.getLockFlag() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new BizException("账号已冻结,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 判断各端账号状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //判断用户是否被锁定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ClientEnum.STUDENT == platform || ClientEnum.TENANT_STUDENT == platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Student student = studentService.getById(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (student != null && UserLockFlag.LOCKED.equals(student.getLockFlag())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new LockedException("账号已冻结,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else if(ClientEnum.TEACHER == platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Teacher teacher = teacherService.getById(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (teacher !=null && UserLockFlag.LOCKED.equals(teacher.getLockFlag())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new LockedException("账号已冻结,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else if(ClientEnum.SYSTEM == platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Employee employee = employeeService.get(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (employee == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new UsernameNotFoundException("账户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (UserLockFlag.LOCKED.equals(employee.getLockFlag())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new LockedException("账号已冻结,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (ClientEnum.TENANT == platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantStaff tenantStaff = tenantStaffService.getByUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (tenantStaff == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new UsernameNotFoundException("账户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantInfo tenantInfo = tenantInfoService.getById(Optional.ofNullable(tenantStaff.getTenantId()).orElse(-1L)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (tenantInfo == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new UsernameNotFoundException("账户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (Boolean.FALSE.equals(tenantInfo.getEnableFlag())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 机构锁定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new LockedException("账号已冻结,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (UserLockFlag.LOCKED.equals(tenantStaff.getStatus())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // 账号被锁定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new LockedException("账号已冻结,请联系管理员"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			sysUser = sysUserFeignService.queryUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if (sysUser != null) { 
			 |