|  |  | @ -20,17 +20,21 @@ package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.AppClientConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.enums.SuperAdminEnum; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.security.password.PasswordUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.FieldConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.OperUserDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.OperUserDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.OperUserEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.UserEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.OperRoleUserFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.redis.OperUserRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.OperUserService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.UserService; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  | @ -55,6 +59,8 @@ public class OperUserServiceImpl extends BaseServiceImpl<OperUserDao, OperUserEn | 
			
		
	
		
			
				
					|  |  |  | 	private OperUserDao operUserDao; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private OperRoleUserFeignClient operRoleUserFeignClient; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private UserService userService; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public PageData<OperUserDTO> page(Map<String, Object> params) { | 
			
		
	
	
		
			
				
					|  |  | @ -85,14 +91,23 @@ public class OperUserServiceImpl extends BaseServiceImpl<OperUserDao, OperUserEn | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public OperUserDTO get(String id) { | 
			
		
	
		
			
				
					|  |  |  |         OperUserEntity entity = baseDao.selectById(id); | 
			
		
	
		
			
				
					|  |  |  |         return ConvertUtils.sourceToTarget(entity, OperUserDTO.class); | 
			
		
	
		
			
				
					|  |  |  |         OperUserDTO result = ConvertUtils.sourceToTarget(entity, OperUserDTO.class); | 
			
		
	
		
			
				
					|  |  |  |         //用户角色列表
 | 
			
		
	
		
			
				
					|  |  |  |         Result<List<String>> roleIdList = operRoleUserFeignClient.getRoleIdList(result.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |         result.setRoleIdList(roleIdList.getData()); | 
			
		
	
		
			
				
					|  |  |  |         return result; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
			
				
					|  |  |  |     public void save(OperUserDTO dto) { | 
			
		
	
		
			
				
					|  |  |  |         OperUserEntity entity = ConvertUtils.sourceToTarget(dto, OperUserEntity.class); | 
			
		
	
		
			
				
					|  |  |  |         UserEntity userEntity = new UserEntity(); | 
			
		
	
		
			
				
					|  |  |  |         userEntity.setFromClient(AppClientConstant.APP_OPER); | 
			
		
	
		
			
				
					|  |  |  |         userEntity.setFromApp(AppClientConstant.CLIENT_WEB); | 
			
		
	
		
			
				
					|  |  |  |         userService.insert(userEntity); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         OperUserEntity entity = ConvertUtils.sourceToTarget(dto, OperUserEntity.class); | 
			
		
	
		
			
				
					|  |  |  |         entity.setUserId(userEntity.getId()); | 
			
		
	
		
			
				
					|  |  |  |         //密码加密
 | 
			
		
	
		
			
				
					|  |  |  |         String password = PasswordUtils.encode(entity.getPassword()); | 
			
		
	
		
			
				
					|  |  |  |         entity.setPassword(password); | 
			
		
	
	
		
			
				
					|  |  | @ -101,7 +116,7 @@ public class OperUserServiceImpl extends BaseServiceImpl<OperUserDao, OperUserEn | 
			
		
	
		
			
				
					|  |  |  |         insert(entity); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //更新角色用户关系
 | 
			
		
	
		
			
				
					|  |  |  |         operRoleUserFeignClient.saveOrUpdate(entity.getId(),dto.getRoleIdList()); | 
			
		
	
		
			
				
					|  |  |  |         operRoleUserFeignClient.saveOrUpdate(userEntity.getId(),dto.getRoleIdList()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
	
		
			
				
					|  |  | 
 |