|
@@ -1,6 +1,7 @@
|
|
|
package com.crm.manager.service.impl;
|
|
package com.crm.manager.service.impl;
|
|
|
|
|
|
|
|
-import com.crm.manager.service.AuthorityService;
|
|
|
|
|
|
|
+import com.crm.manager.dao.mapper.UserRoleMapper;
|
|
|
|
|
+import com.crm.manager.service.*;
|
|
|
import com.crm.rely.backend.core.constant.ManagerConstant;
|
|
import com.crm.rely.backend.core.constant.ManagerConstant;
|
|
|
import com.crm.manager.dao.repository.SysActionRepository;
|
|
import com.crm.manager.dao.repository.SysActionRepository;
|
|
|
import com.crm.manager.dao.repository.UserRoleRepository;
|
|
import com.crm.manager.dao.repository.UserRoleRepository;
|
|
@@ -8,15 +9,10 @@ import com.crm.rely.backend.core.dto.user.role.UserActionDisplayDto;
|
|
|
import com.crm.rely.backend.core.dto.user.role.UserAllRoleDto;
|
|
import com.crm.rely.backend.core.dto.user.role.UserAllRoleDto;
|
|
|
import com.crm.rely.backend.core.dto.user.role.UserNodeDisplayDto;
|
|
import com.crm.rely.backend.core.dto.user.role.UserNodeDisplayDto;
|
|
|
import com.crm.rely.backend.core.dto.user.role.UserRoleDto;
|
|
import com.crm.rely.backend.core.dto.user.role.UserRoleDto;
|
|
|
|
|
+import com.crm.rely.backend.core.entity.tenant.info.TenantEntity;
|
|
|
import com.crm.rely.backend.core.entity.user.role.*;
|
|
import com.crm.rely.backend.core.entity.user.role.*;
|
|
|
-import com.crm.rely.backend.core.pojo.table.SysActionTable;
|
|
|
|
|
-import com.crm.rely.backend.core.pojo.table.UserRoleDetailTable;
|
|
|
|
|
-import com.crm.rely.backend.core.pojo.table.UserRoleNodeTable;
|
|
|
|
|
-import com.crm.rely.backend.core.pojo.table.UserRoleTable;
|
|
|
|
|
|
|
+import com.crm.rely.backend.core.pojo.table.*;
|
|
|
import com.crm.rely.backend.core.pojo.view.SysNodeView;
|
|
import com.crm.rely.backend.core.pojo.view.SysNodeView;
|
|
|
-import com.crm.manager.service.UserRoleDetailService;
|
|
|
|
|
-import com.crm.manager.service.UserRoleNodeService;
|
|
|
|
|
-import com.crm.manager.service.UserRoleService;
|
|
|
|
|
import com.crm.rely.backend.core.constant.Constants;
|
|
import com.crm.rely.backend.core.constant.Constants;
|
|
|
import com.crm.rely.backend.core.constant.RoleConstants;
|
|
import com.crm.rely.backend.core.constant.RoleConstants;
|
|
|
import com.crm.rely.backend.core.dto.base.PageDto;
|
|
import com.crm.rely.backend.core.dto.base.PageDto;
|
|
@@ -27,6 +23,7 @@ import com.crm.rely.backend.util.FormatPage;
|
|
|
import com.crm.rely.backend.util.GetRandom;
|
|
import com.crm.rely.backend.util.GetRandom;
|
|
|
import com.crm.rely.backend.util.ValidateUtil;
|
|
import com.crm.rely.backend.util.ValidateUtil;
|
|
|
import com.google.common.base.Strings;
|
|
import com.google.common.base.Strings;
|
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@@ -37,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -66,6 +64,9 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AuthorityService authorityService;
|
|
private AuthorityService authorityService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private UserRoleMapper userRoleMapper;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取角色权限信息
|
|
* 获取角色权限信息
|
|
|
*
|
|
*
|
|
@@ -151,6 +152,7 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|
|
sellerRoleOperateListEntity.setRoleId(userRoleTable.getId());
|
|
sellerRoleOperateListEntity.setRoleId(userRoleTable.getId());
|
|
|
sellerRoleOperateListEntity.setIsMerchantRole(userRoleAddEntity.getIsMerchantRole());
|
|
sellerRoleOperateListEntity.setIsMerchantRole(userRoleAddEntity.getIsMerchantRole());
|
|
|
sellerRoleOperateListEntity.setData(userRoleAddEntity.getData());
|
|
sellerRoleOperateListEntity.setData(userRoleAddEntity.getData());
|
|
|
|
|
+ sellerRoleOperateListEntity.setMerchantId(userRoleAddEntity.getMerchantId());
|
|
|
updateRoleInfo(sellerRoleOperateListEntity);
|
|
updateRoleInfo(sellerRoleOperateListEntity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -331,6 +333,9 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|
|
return transform(userRoleTable);
|
|
return transform(userRoleTable);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TenantService tenantService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 拉取角色列表
|
|
* 拉取角色列表
|
|
|
*
|
|
*
|
|
@@ -376,8 +381,18 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<UserRoleDto> dtos = new ArrayList<>();
|
|
List<UserRoleDto> dtos = new ArrayList<>();
|
|
|
|
|
+ List<TenantEntity> tenantEntities = tenantService.getAllMerchant();
|
|
|
|
|
+ Map<Integer, TenantEntity> tenantMap = new HashMap<>();
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(tenantEntities)){
|
|
|
|
|
+ tenantMap = tenantEntities.stream().collect(Collectors.toMap(TenantEntity::getId, v -> v));
|
|
|
|
|
+ }
|
|
|
for (UserRoleTable userRoleTable : pageResult.getContent()) {
|
|
for (UserRoleTable userRoleTable : pageResult.getContent()) {
|
|
|
- dtos.add(transform(userRoleTable));
|
|
|
|
|
|
|
+ UserRoleDto transform = transform(userRoleTable);
|
|
|
|
|
+ if(tenantMap.containsKey(userRoleTable.getMerchantId())){
|
|
|
|
|
+ transform.setMerchantName(tenantMap.get(userRoleTable.getMerchantId()).getMerchantName());
|
|
|
|
|
+ transform.setMerchantId(userRoleTable.getMerchantId());
|
|
|
|
|
+ }
|
|
|
|
|
+ dtos.add(transform);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return new ResultWithPagerDto(Constants.SUCCESS_CODE, Constants.SEARCH_SUCCESS, dtos, pageDto);
|
|
return new ResultWithPagerDto(Constants.SUCCESS_CODE, Constants.SEARCH_SUCCESS, dtos, pageDto);
|
|
@@ -390,9 +405,13 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|
|
* @throws ServiceException
|
|
* @throws ServiceException
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<UserAllRoleDto> getListInfo() throws ServiceException {
|
|
|
|
|
-
|
|
|
|
|
- List<UserRoleTable> roleTables = userRoleRepository.findAll();
|
|
|
|
|
|
|
+ public List<UserAllRoleDto> getListInfo(Integer merchantId) throws ServiceException {
|
|
|
|
|
+ List<UserRoleTable> roleTables = new ArrayList<>();
|
|
|
|
|
+ if(merchantId != null){
|
|
|
|
|
+ roleTables = userRoleRepository.findAllByMerchantId(merchantId);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ roleTables = userRoleRepository.findAll();
|
|
|
|
|
+ }
|
|
|
List<UserAllRoleDto> allRoleDtos = new ArrayList<>();
|
|
List<UserAllRoleDto> allRoleDtos = new ArrayList<>();
|
|
|
|
|
|
|
|
for (UserRoleTable sellerRoleTable : roleTables) {
|
|
for (UserRoleTable sellerRoleTable : roleTables) {
|
|
@@ -677,4 +696,10 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|
|
return userRoleTable.getId();
|
|
return userRoleTable.getId();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public UserRoleTable findRoleInfo(Long roleId) {
|
|
|
|
|
+ UserRoleTable userRoleTable = userRoleRepository.getOne(roleId);
|
|
|
|
|
+ return userRoleTable;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|