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..5b3b6384 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; @@ -183,7 +180,13 @@ public class AgencyServiceImpl implements IAgencyService { agency.setValue(agency.getId().toString()); } List agenciesTree = buildDeptTree(agencies); - return agenciesTree.stream().map(AgencyTreeVO::new).collect(Collectors.toList()); + //排序 + List sortedAgenciesTree = agenciesTree.stream().sorted(Comparator.comparing(AgencyVO::getAgencySort)).collect(Collectors.toList()); + for (AgencyVO agencyVO : sortedAgenciesTree) { + List collect = agencyVO.getChildren().stream().sorted(Comparator.comparing(AgencyVO::getAgencySort)).collect(Collectors.toList()); + agencyVO.setChildren(collect); + } + return sortedAgenciesTree.stream().map(AgencyTreeVO::new).collect(Collectors.toList()); } /** 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); }