Commit 5b4846f0 by zhouhaibao

[+]试驾服务

1 parent de95783e
...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; ...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class OrganizaService { public class OrganizaService {
...@@ -21,23 +22,27 @@ public class OrganizaService { ...@@ -21,23 +22,27 @@ public class OrganizaService {
public void drawOrganization(List<? extends BaseAreaDto> list){ public void drawOrganization(List<? extends BaseAreaDto> list){
Type type = new TypeToken<List<Organization>>() { Type type = new TypeToken<List<Organization>>() {
}.getType(); }.getType();
List<Long> collect = list.stream().map(index -> index.getCreatedBy()).collect(Collectors.toList());
R<List<Organization>> tenantByUserIds = organizationService.getTenantByUserIds(collect);
List<Organization> orgList = tenantByUserIds.getDataList(type);
if(CollectionUtils.isNotEmpty(orgList)) {
list.forEach(efd -> { list.forEach(efd -> {
R<List<Organization>> listR = organizationService.getTenantPathsByUserId(efd.getCreatedBy()); List<Organization> organizations = orgList.stream().filter(index -> index.getUserId().equals(efd.getCreatedBy())).collect(Collectors.toList());
List<Organization> orgList = listR.getDataList(type); if (CollectionUtils.isNotEmpty(organizations)) {
if (CollectionUtils.isNotEmpty(orgList)) {
int size = orgList.size(); int size = orgList.size();
if(size<2){ if (size < 2) {
return; return;
}else{ } else {
efd.setArea(orgList.get(1).getOrgName()); efd.setArea(orgList.get(1).getOrgName());
if(size>2){ if (size > 2) {
efd.setProvince(orgList.get(2).getOrgName()); efd.setProvince(orgList.get(2).getOrgName());
} }
if(size>3){ if (size > 3) {
efd.setCity(orgList.get(3).getOrgName()); efd.setCity(orgList.get(3).getOrgName());
} }
} }
} }
}); });
} }
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!