|
@@ -129,6 +129,47 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
|
|
|
return offices;
|
|
|
}
|
|
|
|
|
|
+ public List <OfficeDTO> getFinanceRootTree(List<OfficeDTO> list, String extId, String type, String showAll, String showMyOffice) {
|
|
|
+ List<OfficeDTO> offices = Lists.newArrayList ();
|
|
|
+ // 获取到所有parent_id为‘0’的部门数据
|
|
|
+ List<Office> children = officeMapper.getFinanceChildren(OfficeDTO.getRootId());
|
|
|
+// List<Office> children = super.getChildren(new Office(OfficeDTO.getRootId()));
|
|
|
+ List<OfficeDTO> rootTrees = OfficeWrapper.INSTANCE.toDTO (children);
|
|
|
+ for (OfficeDTO root : rootTrees) {
|
|
|
+ if (this.isUseAble ( extId, type,root, showAll )){
|
|
|
+ // 不是被排除节点的子节点
|
|
|
+ List<OfficeDTO> officeList = formatListToTree (root, list, extId, type, showAll);
|
|
|
+ offices.addAll (officeList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(showMyOffice)) {
|
|
|
+ OfficeDTO officeDTO = UserUtils.getCurrentUserDTO().getOfficeDTO();
|
|
|
+ // 排除管理员
|
|
|
+ if (!UserUtils.getCurrentUserDTO().isAdmin()){
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())) {
|
|
|
+ String[] split = officeDTO.getParentIds().split(",");
|
|
|
+ if (split.length > 2) {
|
|
|
+ Office office = officeMapper.selectById(split[2]);
|
|
|
+ if ("0".equals(office.getIsPublic())) {
|
|
|
+ // isPublic为“0”,当前用户的公司为私有,查询的部门包含自己所属公司全部部门和其他的公有部门
|
|
|
+ if(null != officeDTO && org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())){
|
|
|
+ offices = this.getCompanyFromTree(offices);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ("0".equals(officeDTO.getIsPublic())) {
|
|
|
+ // isPublic为“0”,当前用户的公司为私有,查询的部门包含自己所属公司全部部门和其他的公有部门
|
|
|
+ if(null != officeDTO && org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())){
|
|
|
+ offices = this.getCompanyFromTree(offices);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return offices;
|
|
|
+ }
|
|
|
+
|
|
|
public List <OfficeDTO> getRootTree(List<OfficeDTO> list, String extId, String type, String showAll, String showMyOffice) {
|
|
|
List<OfficeDTO> offices = Lists.newArrayList ();
|
|
|
// 获取到所有parent_id为‘0’的部门数据
|
|
@@ -337,6 +378,17 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
|
|
|
return officeList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据部门名称查询部门信息
|
|
|
+ * @param officeName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<OfficeDTO> getOfficeAllByFinanceOfficeName(String officeName){
|
|
|
+ List<OfficeDTO> officeList = officeMapper.getOfficeAllByFinanceOfficeName(officeName);
|
|
|
+
|
|
|
+ return officeList;
|
|
|
+ }
|
|
|
+
|
|
|
public List <OfficeDTO> getRootTree2(List<OfficeDTO> list, String extId, String type, String showAll) {
|
|
|
List<OfficeDTO> offices = Lists.newArrayList ();
|
|
|
List<OfficeDTO> rootTrees = officeWrapper.toDTO (super.getChildren (new Office (OfficeDTO.getRootId ())));
|