|
@@ -1,5 +1,6 @@
|
|
package com.gree.mall.manager.logic.admin;
|
|
package com.gree.mall.manager.logic.admin;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
import com.alibaba.excel.util.StringUtils;
|
|
import com.alibaba.excel.util.StringUtils;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -10,8 +11,10 @@ import com.gree.mall.manager.exception.RemoteServiceException;
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
import com.gree.mall.manager.plus.entity.AdminRole;
|
|
import com.gree.mall.manager.plus.entity.AdminRole;
|
|
import com.gree.mall.manager.plus.entity.AdminUser;
|
|
import com.gree.mall.manager.plus.entity.AdminUser;
|
|
|
|
+import com.gree.mall.manager.plus.entity.AdminWebsit;
|
|
import com.gree.mall.manager.plus.service.AdminRoleService;
|
|
import com.gree.mall.manager.plus.service.AdminRoleService;
|
|
import com.gree.mall.manager.plus.service.AdminUserService;
|
|
import com.gree.mall.manager.plus.service.AdminUserService;
|
|
|
|
+import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -19,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class AdminRoleLogic {
|
|
public class AdminRoleLogic {
|
|
@@ -28,6 +32,8 @@ public class AdminRoleLogic {
|
|
@Autowired
|
|
@Autowired
|
|
AdminUserService adminUserService;
|
|
AdminUserService adminUserService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ AdminWebsitService adminWebsitService;
|
|
|
|
+ @Autowired
|
|
CommonLogic commonLogic;
|
|
CommonLogic commonLogic;
|
|
|
|
|
|
|
|
|
|
@@ -36,6 +42,7 @@ public class AdminRoleLogic {
|
|
*/
|
|
*/
|
|
public IPage<AdminRole> listPage(HttpServletRequest request ,String companyWechatName, Integer pageNo, Integer pageSize) {
|
|
public IPage<AdminRole> listPage(HttpServletRequest request ,String companyWechatName, Integer pageNo, Integer pageSize) {
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
|
+
|
|
List<String> companyWechatIds = adminUser.getCompanyWechatIds();
|
|
List<String> companyWechatIds = adminUser.getCompanyWechatIds();
|
|
|
|
|
|
final AdminRole role = adminRoleService.getById(adminUser.getRoleId());
|
|
final AdminRole role = adminRoleService.getById(adminUser.getRoleId());
|
|
@@ -47,10 +54,21 @@ public class AdminRoleLogic {
|
|
type = RoleTypeEnum.ADMIN.getCode();
|
|
type = RoleTypeEnum.ADMIN.getCode();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ List<AdminWebsit> websitList = null;
|
|
|
|
+ if (adminUser.getType() == 0 && adminUser.getIsMaster()) {
|
|
|
|
+ websitList = adminWebsitService.lambdaQuery()
|
|
|
|
+ .eq(AdminWebsit::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
|
+ .in(AdminWebsit::getWebsitId, adminUser.getAdminWebsitIds())
|
|
|
|
+ .list();
|
|
|
|
+ }
|
|
|
|
+
|
|
Page<AdminRole> rolePage = adminRoleService.lambdaQuery()
|
|
Page<AdminRole> rolePage = adminRoleService.lambdaQuery()
|
|
.like(StringUtils.isNotBlank(companyWechatName), AdminRole::getCompanyName, companyWechatName)
|
|
.like(StringUtils.isNotBlank(companyWechatName), AdminRole::getCompanyName, companyWechatName)
|
|
.le(AdminRole::getType, type)
|
|
.le(AdminRole::getType, type)
|
|
.in(CollectionUtils.isNotEmpty(companyWechatIds), AdminRole::getCompanyWechatId, companyWechatIds)
|
|
.in(CollectionUtils.isNotEmpty(companyWechatIds), AdminRole::getCompanyWechatId, companyWechatIds)
|
|
|
|
+ .in(CollectionUtil.isNotEmpty(websitList), AdminRole::getRoleWebsitId, websitList.stream()
|
|
|
|
+ .map(AdminWebsit::getWebsitId)
|
|
|
|
+ .collect(Collectors.toList()))
|
|
.orderByDesc(AdminRole::getType)
|
|
.orderByDesc(AdminRole::getType)
|
|
.page(new Page<>(pageNo, pageSize));
|
|
.page(new Page<>(pageNo, pageSize));
|
|
|
|
|