|
@@ -25,6 +25,7 @@ import com.persagy.fm.department.model.dto.PageQueryDepartmentDTO;
|
|
|
import com.persagy.fm.department.model.dto.QueryDepartmentDTO;
|
|
|
import com.persagy.fm.department.model.dto.UpdateDepartmentDTO;
|
|
|
import com.persagy.fm.department.model.vo.DepSimpleObjVO;
|
|
|
+import com.persagy.fm.department.model.vo.FullPathInfoVO;
|
|
|
import com.persagy.fm.department.service.IDepartmentService;
|
|
|
import com.persagy.fm.depproject.model.dto.AddDepProjectDTO;
|
|
|
import com.persagy.fm.depproject.service.IDepProjectService;
|
|
@@ -40,6 +41,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -551,4 +553,36 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
throw new BusinessException(ResponseCode.B0300.getCode(), "无法获取当前登录人所在的集团部门");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public FullPathInfoVO getFullPathInfo(String depId) {
|
|
|
+ FullPathInfoVO fullPathInfoVO = new FullPathInfoVO();
|
|
|
+ List<DepSimpleObjVO> resultList = Lists.newArrayList();
|
|
|
+ getDepInfoListInFullPath(depId, resultList);
|
|
|
+ // 因为部门信息放入的顺序是从后往前,这里做一次反转
|
|
|
+ Collections.reverse(resultList);
|
|
|
+ fullPathInfoVO.setFullPathInfo(resultList);
|
|
|
+ return fullPathInfoVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取部门全路径中的部门信息列表
|
|
|
+ *
|
|
|
+ * @param depId 部门id
|
|
|
+ * @param resultList 最终要返回的结果
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/4/26 5:12 下午
|
|
|
+ */
|
|
|
+ private void getDepInfoListInFullPath(String depId, List<DepSimpleObjVO> resultList) {
|
|
|
+ if (StringUtils.isNotBlank(depId) && !DepConstants.NO_PARENT_ID.equals(depId)) {
|
|
|
+ Department department = getById(depId);
|
|
|
+ DepSimpleObjVO depSimpleObjVO = new DepSimpleObjVO();
|
|
|
+ depSimpleObjVO.setId(depId);
|
|
|
+ depSimpleObjVO.setName(department.getName());
|
|
|
+ resultList.add(depSimpleObjVO);
|
|
|
+
|
|
|
+ String parentId = department.getParentId();
|
|
|
+ getDepInfoListInFullPath(parentId, resultList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|