diff --git a/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java b/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java index e118190c..5a2a6d4e 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java @@ -195,7 +195,7 @@ public class Constants { public static final String TASK_STATUS_CODE = "TSC"; /** - * 任务状态编码 + * 机构代码编码 */ public static final String AGENCY_CODE = "AYC"; diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/agency/impl/AgencyServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/agency/impl/AgencyServiceImpl.java index 4eb40e03..3542efc0 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/agency/impl/AgencyServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/agency/impl/AgencyServiceImpl.java @@ -27,10 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/agencycategory/impl/AgencyCategoryServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/agencycategory/impl/AgencyCategoryServiceImpl.java index c9fd7370..9300523c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/agencycategory/impl/AgencyCategoryServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/agencycategory/impl/AgencyCategoryServiceImpl.java @@ -1,7 +1,9 @@ package com.xinelu.manage.service.agencycategory.impl; +import com.xinelu.common.constant.Constants; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.StringUtils; +import com.xinelu.common.utils.codes.GenerateSystemCodeUtil; import com.xinelu.manage.domain.agencycategory.AgencyCategory; import com.xinelu.manage.mapper.agencycategory.AgencyCategoryMapper; import com.xinelu.manage.service.agencycategory.IAgencyCategoryService; @@ -28,6 +30,8 @@ import java.util.stream.Collectors; public class AgencyCategoryServiceImpl implements IAgencyCategoryService { @Resource private AgencyCategoryMapper agencyCategoryMapper; + @Resource + private GenerateSystemCodeUtil generateSystemCodeUtil; /** * 查询机构类别 @@ -65,6 +69,7 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService { } agencyCategory.setCreateTime(LocalDateTime.now()); agencyCategory.setCreateBy(SecurityUtils.getUsername()); + agencyCategory.setCategoryCode(Constants.CATEGORY_CODE + generateSystemCodeUtil.generateSystemCode(Constants.CATEGORY_CODE)); return agencyCategoryMapper.insertAgencyCategory(agencyCategory); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/department/impl/DepartmentServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/department/impl/DepartmentServiceImpl.java index f3de2b33..ee46c83e 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/department/impl/DepartmentServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/department/impl/DepartmentServiceImpl.java @@ -124,6 +124,9 @@ public class DepartmentServiceImpl implements IDepartmentService { */ @Override public int updateDepartment(Department department) { + if (Objects.nonNull(department) && Objects.nonNull(department.getId()) && Objects.nonNull(department.getParentDepartmentId()) && department.getId().equals(department.getParentDepartmentId())) { + department.setParentDepartmentId(null); + } department.setUpdateBy(SecurityUtils.getUsername()); department.setUpdateTime(LocalDateTime.now()); return departmentMapper.updateDepartmentById(department);