|
@@ -11,7 +11,6 @@ import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
import com.gree.mall.manager.plus.entity.AdminRole;
|
|
|
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.AdminUserService;
|
|
|
import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
@@ -22,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class AdminRoleLogic {
|
|
@@ -54,21 +52,16 @@ public class AdminRoleLogic {
|
|
|
type = RoleTypeEnum.ADMIN.getCode();
|
|
|
}
|
|
|
|
|
|
- List<AdminWebsit> websitList = null;
|
|
|
+ List<String> websitList = null;
|
|
|
if (adminUser.getType() == 0 && adminUser.getIsMaster()) {
|
|
|
- websitList = adminWebsitService.lambdaQuery()
|
|
|
- .eq(AdminWebsit::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
- .in(AdminWebsit::getWebsitId, adminUser.getAdminWebsitIds())
|
|
|
- .list();
|
|
|
+ websitList = adminUser.getAdminWebsitIds();
|
|
|
}
|
|
|
|
|
|
Page<AdminRole> rolePage = adminRoleService.lambdaQuery()
|
|
|
.like(StringUtils.isNotBlank(companyWechatName), AdminRole::getCompanyName, companyWechatName)
|
|
|
.le(AdminRole::getType, type)
|
|
|
.in(CollectionUtils.isNotEmpty(companyWechatIds), AdminRole::getCompanyWechatId, companyWechatIds)
|
|
|
- .in(CollectionUtil.isNotEmpty(websitList), AdminRole::getRoleWebsitId, websitList.stream()
|
|
|
- .map(AdminWebsit::getWebsitId)
|
|
|
- .collect(Collectors.toList()))
|
|
|
+ .in(CollectionUtil.isNotEmpty(websitList), AdminRole::getRoleWebsitId, websitList)
|
|
|
.orderByDesc(AdminRole::getType)
|
|
|
.page(new Page<>(pageNo, pageSize));
|
|
|
|
|
@@ -86,6 +79,10 @@ public class AdminRoleLogic {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
adminRole.setCompanyWechatId(adminUser.getCompanyWechatId());
|
|
|
adminRole.setCompanyName(adminUser.getCompanyName());
|
|
|
+ if (adminUser.getType() == 0 && adminUser.getIsMaster()) {
|
|
|
+ adminRole.setRoleWebsitId(adminUser.getAdminWebsitIds().get(0));
|
|
|
+ adminRole.setLevel(0);
|
|
|
+ }
|
|
|
adminRole.setCreateTime(new Date());
|
|
|
adminRoleService.save(adminRole);
|
|
|
}
|