|
|
@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -910,13 +911,16 @@ public class KwsEnterpriseService {
|
|
|
collect = kwsEntTypeList.stream().collect(Collectors.groupingBy(KwsEntType::getEntId));
|
|
|
}
|
|
|
|
|
|
- List<Long> managers = kwsEnterprises.stream().map(KwsEnterprise::getManager).toList();
|
|
|
+ List<FindManagePojo> manageInfoByEntIds = kwsEnterpriseDao.findManageInfoByEntIds(kwsEnterprises.stream().map(KwsEnterprise::getId).toList());
|
|
|
Map<Long, KwsUser> userCollect = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
- if (CollectionUtils.isNotEmpty(managers)) {
|
|
|
- List<KwsUser> kwsUsers = kwsUserService.selectByKeys(managers);
|
|
|
+ Map<Long, FindManagePojo> manageInfoCollect = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+ if (CollectionUtils.isNotEmpty(manageInfoByEntIds)) {
|
|
|
+ List<KwsUser> kwsUsers = kwsUserService.selectByKeys(manageInfoByEntIds.stream().map(FindManagePojo::getUserId).toList());
|
|
|
if (CollectionUtils.isNotEmpty(kwsUsers)) {
|
|
|
userCollect = kwsUsers.stream().collect(Collectors.toMap(KwsUser::getId, e -> e, (n, o) -> n));
|
|
|
}
|
|
|
+
|
|
|
+ manageInfoCollect = manageInfoByEntIds.stream().collect(Collectors.toMap(FindManagePojo::getEntId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -925,14 +929,17 @@ public class KwsEnterpriseService {
|
|
|
QueryCurrentOrganizationResVo queryCurrentOrganizationResVo = new QueryCurrentOrganizationResVo();
|
|
|
List<KwsEntType> kwsEntTypeList1 = collect.get(kwsEnterprise.getId());
|
|
|
queryCurrentOrganizationResVo.setEntTypes(CollectionUtils.isEmpty(kwsEntTypeList1) ? null : String.join(Global.COMMA, kwsEntTypeList1.stream().map(KwsEntType::getType).map(String::valueOf).toList()));
|
|
|
- Long manager = kwsEnterprise.getManager();
|
|
|
- if (Objects.nonNull(manager)) {
|
|
|
- queryCurrentOrganizationResVo.setContactsId(manager);
|
|
|
- KwsUser kwsUser = userCollect.get(manager);
|
|
|
+ FindManagePojo findManagePojo = manageInfoCollect.get(kwsEnterprise.getId());
|
|
|
+ if (Objects.nonNull(findManagePojo)) {
|
|
|
+ queryCurrentOrganizationResVo.setContactsId(findManagePojo.getUserId());
|
|
|
+ KwsUser kwsUser = userCollect.get(findManagePojo.getUserId());
|
|
|
if (Objects.nonNull(kwsUser)) {
|
|
|
queryCurrentOrganizationResVo.setContacts(kwsUser.getName());
|
|
|
queryCurrentOrganizationResVo.setPhone(kwsUser.getPhone());
|
|
|
}
|
|
|
+ } else {
|
|
|
+ queryCurrentOrganizationResVo.setContacts(kwsEnterprise.getContacts());
|
|
|
+ queryCurrentOrganizationResVo.setPhone(kwsEnterprise.getPhone());
|
|
|
}
|
|
|
queryCurrentOrganizationResVo.setCityName(kwsEnterprise.getCityName());
|
|
|
queryCurrentOrganizationResVo.setBusiness(kwsEnterprise.getBusiness());
|