|
|
@@ -94,9 +94,18 @@ public class ServiceHallManagerImpl extends AbstractManager implements ServiceHa |
|
|
|
@Override |
|
|
|
public List<ServiceHallSonQueryModel> querySon(ServiceHallSonQueryRequestDTO reqDto) { |
|
|
|
List<QtkServiceHall> all = serviceHallRepo.findAll(); |
|
|
|
Map<String, List<QtkServiceHall>> collect = all.stream().collect(Collectors.groupingBy(QtkServiceHall::getSuperServiceHallId)); |
|
|
|
List<QtkServiceHall> remove = collect.remove(null); |
|
|
|
return querySon(remove, collect); |
|
|
|
if (CollectionUtil.isEmpty(all)) return null; |
|
|
|
List<QtkServiceHall> top = new ArrayList<>();//最顶级的网点 |
|
|
|
List<QtkServiceHall> son = new ArrayList<>();//子网点 |
|
|
|
for (QtkServiceHall qtkServiceHall : all) { |
|
|
|
if (qtkServiceHall.getSuperServiceHallId() == null) { |
|
|
|
top.add(qtkServiceHall); |
|
|
|
}else { |
|
|
|
son.add(qtkServiceHall); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, List<QtkServiceHall>> collect = son.stream().collect(Collectors.groupingBy(QtkServiceHall::getSuperServiceHallId)); |
|
|
|
return querySon(top, collect); |
|
|
|
} |
|
|
|
|
|
|
|
//递归 |
|
|
@@ -109,6 +118,7 @@ public class ServiceHallManagerImpl extends AbstractManager implements ServiceHa |
|
|
|
model.setServicehallId(serviceHallId); |
|
|
|
model.setServicehallName(serviceHall.getName()); |
|
|
|
List<QtkServiceHall> serviceHalls1 = collect.get(serviceHallId); |
|
|
|
|
|
|
|
if (serviceHalls1 != null) { |
|
|
|
model.setChildrens(querySon(serviceHalls1, collect)); |
|
|
|
} |
|
|
@@ -148,7 +158,6 @@ public class ServiceHallManagerImpl extends AbstractManager implements ServiceHa |
|
|
|
newServiceHall.setLongitude(reqDto.getLongitude()); |
|
|
|
newServiceHall.setLatitude(reqDto.getLatitude()); |
|
|
|
newServiceHall.setRadial(reqDto.getRadial()); |
|
|
|
newServiceHall.setMapChannelId(reqDto.getCenterServiceHallId()); |
|
|
|
serviceHallRepo.save(newServiceHall); |
|
|
|
if (!isEmpty(reqDto.getLocationModels())) { |
|
|
|
List<QtkServicehallLocation> locations = Lists.newArrayList(); |
|
|
@@ -208,7 +217,6 @@ public class ServiceHallManagerImpl extends AbstractManager implements ServiceHa |
|
|
|
qtkServiceHall.setContact(reqDto.getContact()); |
|
|
|
qtkServiceHall.setLongitude(reqDto.getLongitude()); |
|
|
|
qtkServiceHall.setLatitude(reqDto.getLatitude()); |
|
|
|
qtkServiceHall.setMapChannelId(reqDto.getCenterServiceHallId()); |
|
|
|
qtkServiceHall.setUpdateTime(now); |
|
|
|
// 更新 |
|
|
|
serviceHallRepo.merge(qtkServiceHall); |