|
|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.jeeplus.common.TokenProvider;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
import com.jeeplus.flowable.feign.IFlowableApi;
|
|
|
@@ -19,6 +20,7 @@ import com.jeeplus.psimanage.collect.mapper.*;
|
|
|
import com.jeeplus.psimanage.collect.service.dto.PsiCollectDto;
|
|
|
import com.jeeplus.psimanage.collect.service.dto.PsiCollectExportDto;
|
|
|
import com.jeeplus.psimanage.collect.service.dto.PsiWareHouseSummaryDto;
|
|
|
+import com.jeeplus.psimanage.collect.service.dto.TreeUserDto;
|
|
|
import com.jeeplus.psimanage.psiWareHouse.domain.PsiWareHouseDetailed;
|
|
|
import com.jeeplus.psimanage.psiWareHouse.service.PsiWareHouseBasicService;
|
|
|
import com.jeeplus.psimanage.purchase.service.PsiMaterialService;
|
|
|
@@ -29,8 +31,10 @@ import com.jeeplus.psimanage.psiWareHouse.service.dto.PsiWareHouseDto;
|
|
|
import com.jeeplus.psimanage.oss.service.dto.WorkAttachmentDto;
|
|
|
import com.jeeplus.psimanage.serialNumTpl.service.PsiSerialnumTplService;
|
|
|
import com.jeeplus.sys.feign.IDictApi;
|
|
|
+import com.jeeplus.sys.feign.IRoleApi;
|
|
|
import com.jeeplus.sys.feign.IUserApi;
|
|
|
import com.jeeplus.sys.feign.IWorkAttachmentApi;
|
|
|
+import com.jeeplus.sys.service.dto.RoleDTO;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.utils.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -1053,4 +1057,77 @@ public class PsiCollectService {
|
|
|
}
|
|
|
return psiCollectDto;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //用户树形
|
|
|
+ public List<TreeUserDto> userTree(String name) {
|
|
|
+ List<TreeUserDto> list = new ArrayList<>();
|
|
|
+ List<TreeUserDto> filterList = new ArrayList<>();
|
|
|
+ List<TreeUserDto> officeList1 = basicMapper.findOfficeListByTenantId("10009");
|
|
|
+ filterList.addAll(officeList1);
|
|
|
+ List<TreeUserDto> offices = Lists.newArrayList();
|
|
|
+ ArrayList<TreeUserDto> treeUserDtos = new ArrayList<>();
|
|
|
+ //查询物资公司所有用户信息
|
|
|
+ List<TreeUserDto> UserList=basicMapper.findJxcUserList(name);
|
|
|
+ treeUserDtos.addAll(UserList);
|
|
|
+ list = disposeUserTree(treeUserDtos, filterList);
|
|
|
+ for (TreeUserDto officeDto : officeList1) {
|
|
|
+ if("0".equals(officeDto.getParentId())){
|
|
|
+ list.add(officeDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (TreeUserDto officeDto : offices) {
|
|
|
+ if("0".equals(officeDto.getParentId())){
|
|
|
+ list.add(officeDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //去重
|
|
|
+ List<TreeUserDto> newList = list.stream().collect(Collectors.collectingAndThen(
|
|
|
+ Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TreeUserDto::getId))), ArrayList::new)
|
|
|
+ );
|
|
|
+ return newList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户树形数据处理
|
|
|
+ * @param userList
|
|
|
+ * @param officeList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<TreeUserDto> disposeUserTree(List<TreeUserDto> userList, List<TreeUserDto> officeList){
|
|
|
+ List<TreeUserDto> list = new ArrayList<>();
|
|
|
+ for (TreeUserDto userDto : userList) {
|
|
|
+
|
|
|
+ for (TreeUserDto officeDto : officeList) {
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotBlank(userDto.getParentId()) && userDto.getParentId().equals(officeDto.getId())){
|
|
|
+ list.add(officeDto);
|
|
|
+ list.add(userDto);
|
|
|
+ List<TreeUserDto> treeUserDtos = disposeOfficeTree(officeDto, officeList);
|
|
|
+ if(null!= treeUserDtos && treeUserDtos.size()>0){
|
|
|
+ list.addAll(treeUserDtos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户树形数据处理
|
|
|
+ * @param officeInfo
|
|
|
+ * @param officeList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<TreeUserDto> disposeOfficeTree(TreeUserDto officeInfo, List<TreeUserDto> officeList){
|
|
|
+ List<TreeUserDto> listAll = Lists.newArrayList();
|
|
|
+ for (TreeUserDto officeDto : officeList) {
|
|
|
+ if(officeInfo.getParentId().equals(officeDto.getId())){
|
|
|
+ listAll.add(officeDto);
|
|
|
+ disposeOfficeTree(officeDto,officeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return listAll;
|
|
|
+ }
|
|
|
+
|
|
|
}
|