From 861d0de9a80cfc5fe8edf0eb0d62e1eb7e85b427 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期日, 26 一月 2025 18:03:12 +0800 Subject: [PATCH] 1.bug修改 --- medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java | 65 ++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java index 860f7d8..aac9f1f 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java @@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sinata.common.constant.CacheConstants; +import com.sinata.common.core.domain.entity.SysUser; import com.sinata.common.entity.PageDTO; import com.sinata.common.exception.ServiceException; import com.sinata.common.utils.BeanUtils; import com.sinata.common.utils.CollUtils; import com.sinata.common.utils.SecurityUtils; import com.sinata.common.utils.StringUtils; +import com.sinata.system.domain.MwApplication; import com.sinata.system.domain.SysDepartment; import com.sinata.system.domain.SysDepartmentInfo; import com.sinata.system.domain.SysUserDepartment; @@ -155,6 +157,45 @@ public List<SysDepartmentVO> getRegionTree(String keyword) { List<SysDepartmentVO> root = new ArrayList<>(); SysDepartment currentDepartment = getMyDepartment(); + if (Objects.isNull(currentDepartment)) { + return root; + } + if (!currentDepartment.getOrgType().equals(DepartmentEnum.REGION.getCode())) { + return root; + } + Map<Long, List<SysDepartment>> childrenMap = getChildrenDepartmentByOrgType(currentDepartment, Collections.singletonList(DepartmentEnum.REGION.getCode())); + SysDepartmentVO sysDepartmentVO = fillChildrenTreeModel(currentDepartment, childrenMap); + root.add(sysDepartmentVO); + if (StringUtils.isNotBlank(keyword)) { + treeMatch(root, keyword); + } + return root; + } + @Override + public List<SysDepartmentVO> getRegionTree1(String keyword) { + SysUser sysUser = SecurityUtils.getLoginUser().getUser(); + + List<SysDepartmentVO> root = new ArrayList<>(); + SysDepartment sysDepartment = this.baseMapper.selectById(sysUser.getDepartmentId()); + SysDepartment currentDepartment = this.baseMapper.selectById(sysDepartment.getParentId()); + if (Objects.isNull(currentDepartment)) { + return root; + } + if (!currentDepartment.getOrgType().equals(DepartmentEnum.REGION.getCode())) { + return root; + } + Map<Long, List<SysDepartment>> childrenMap = getChildrenDepartmentByOrgType(currentDepartment, Collections.singletonList(DepartmentEnum.REGION.getCode())); + SysDepartmentVO sysDepartmentVO = fillChildrenTreeModel(currentDepartment, childrenMap); + root.add(sysDepartmentVO); + if (StringUtils.isNotBlank(keyword)) { + treeMatch(root, keyword); + } + return root; + } + public List<SysDepartmentVO> getRegionTree2(String keyword) { + + List<SysDepartmentVO> root = new ArrayList<>(); + SysDepartment currentDepartment = this.baseMapper.selectById(-1); if (Objects.isNull(currentDepartment)) { return root; } @@ -840,4 +881,28 @@ public List<MedicalInstitutionVO> getHospitalListByRouteId(Long id) { return baseMapper.getHospitalListByRouteId(id); } + + /** + * 创建机构 + * + * @param mwApplication + */ + @Override + public void createDepartment(MwApplication mwApplication) { + SysDepartment parent = this.getById(mwApplication.getDepartmentId()); + if (Objects.isNull(parent)) { + throw new ServiceException("找不到对应父级组织"); + } + SysDepartment department = new SysDepartment(); + department.setParentId(mwApplication.getDepartmentId()); + department.setDepartmentName(mwApplication.getUnitName()); + department.setContactPerson(mwApplication.getConcat()); + department.setContactPhone(mwApplication.getPhone()); + department.setOrgType(mwApplication.getUnitType().equals(1) ? DepartmentEnum.MEDICAL_INSTITUTION.getCode() : DepartmentEnum.DISPOSAL_UNIT.getCode()); + department.setRegion(mwApplication.getRegion()); + department.setRelation(mwApplication.getRelation()); + department.setTreeCode(generateTreeCode(parent.getId())); + department.setOrgCode(getOrgCode(parent.getId(), department.getOrgType())); + save(department); + } } -- Gitblit v1.7.1