|
@@ -1,17 +1,18 @@
|
|
|
package com.gree.mall.manager.logic.admin;
|
|
|
|
|
|
-import com.aliyuncs.utils.StringUtils;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gree.mall.manager.bean.admin.AdminDeptTree;
|
|
|
import com.gree.mall.manager.bean.admin.AdminDeptWebsitVO;
|
|
|
import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
-import com.gree.mall.manager.bean.admin.AdminWebsitTree;
|
|
|
-import com.gree.mall.manager.bean.workorder.IncreVO;
|
|
|
import com.gree.mall.manager.commonmapper.AdminMapper;
|
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
-import com.gree.mall.manager.plus.entity.*;
|
|
|
+import com.gree.mall.manager.plus.entity.AdminDept;
|
|
|
+import com.gree.mall.manager.plus.entity.AdminDeptWebsit;
|
|
|
+import com.gree.mall.manager.plus.entity.AdminUserDeptRela;
|
|
|
+import com.gree.mall.manager.plus.entity.AdminWebsit;
|
|
|
import com.gree.mall.manager.plus.service.AdminDeptService;
|
|
|
import com.gree.mall.manager.plus.service.AdminDeptWebsitService;
|
|
|
import com.gree.mall.manager.plus.service.AdminUserDeptRelaService;
|
|
@@ -163,17 +164,39 @@ public class AdminDeptLogic {
|
|
|
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
|
|
|
+ List<AdminDeptTree> trees = new ArrayList<>();
|
|
|
+ if (adminUser.getType() == 0) {
|
|
|
+ // 网点账号只返回网点
|
|
|
+ List<AdminWebsit> adminWebsitList = adminWebsitService.lambdaQuery()
|
|
|
+ .in(AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatIds())
|
|
|
+ .in(AdminWebsit::getWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isEmpty(adminWebsitList)) {
|
|
|
+ return trees;
|
|
|
+ }
|
|
|
+ for (AdminWebsit websit : adminWebsitList) {
|
|
|
+ AdminDeptTree deptTree = new AdminDeptTree();
|
|
|
+ deptTree.setIsWebsit(true);
|
|
|
+ deptTree.setCompanyWechatId(websit.getCompanyWechatId());
|
|
|
+ deptTree.setCompanyWechatName(websit.getCompanyWechatName());
|
|
|
+ deptTree.setAdminDeptId(websit.getWebsitId());
|
|
|
+ deptTree.setDeptName(websit.getName());
|
|
|
+ trees.add(deptTree);
|
|
|
+ }
|
|
|
+ return trees;
|
|
|
+ }
|
|
|
+
|
|
|
List<AdminDept> list = adminDeptService.lambdaQuery()
|
|
|
- .eq(AdminDept::getPId,"0")
|
|
|
+ .eq(AdminDept::getPId, "0")
|
|
|
.list();
|
|
|
- List<AdminDeptTree> trees = new ArrayList<>();
|
|
|
- for(AdminDept adminDept : list){
|
|
|
+
|
|
|
+ for (AdminDept adminDept : list) {
|
|
|
AdminDeptTree adminDeptTree = new AdminDeptTree();
|
|
|
- BeanUtils.copyProperties(adminDept,adminDeptTree);
|
|
|
+ BeanUtils.copyProperties(adminDept, adminDeptTree);
|
|
|
trees.add(adminDeptTree);
|
|
|
}
|
|
|
|
|
|
- for(AdminDeptTree adminDeptTree:trees){
|
|
|
+ for (AdminDeptTree adminDeptTree : trees) {
|
|
|
adminDeptTree.setChildren(this.treeModule(adminDeptTree.getAdminDeptId()));
|
|
|
|
|
|
List<AdminDeptTree> children = adminDeptTree.getChildren();
|
|
@@ -191,7 +214,7 @@ public class AdminDeptLogic {
|
|
|
}
|
|
|
AdminWebsit adminWebsit = adminWebsitService.lambdaQuery().eq(AdminWebsit::getName, child.getDeptName()).last("limit 1").one();
|
|
|
|
|
|
- if (adminWebsit != null){
|
|
|
+ if (adminWebsit != null) {
|
|
|
child.setAdminDeptId(adminWebsit.getWebsitId());
|
|
|
child.setIsWebsit(true);
|
|
|
}
|