Commit 5b4846f0 by zhouhaibao

[+]试驾服务

1 parent de95783e
......@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class OrganizaService {
......@@ -21,23 +22,27 @@ public class OrganizaService {
public void drawOrganization(List<? extends BaseAreaDto> list){
Type type = new TypeToken<List<Organization>>() {
}.getType();
list.forEach(efd -> {
R<List<Organization>> listR = organizationService.getTenantPathsByUserId(efd.getCreatedBy());
List<Organization> orgList = listR.getDataList(type);
if (CollectionUtils.isNotEmpty(orgList)) {
int size = orgList.size();
if(size<2){
return;
}else{
efd.setArea(orgList.get(1).getOrgName());
if(size>2){
efd.setProvince(orgList.get(2).getOrgName());
}
if(size>3){
efd.setCity(orgList.get(3).getOrgName());
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<Organization> organizations = orgList.stream().filter(index -> index.getUserId().equals(efd.getCreatedBy())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(organizations)) {
int size = orgList.size();
if (size < 2) {
return;
} else {
efd.setArea(orgList.get(1).getOrgName());
if (size > 2) {
efd.setProvince(orgList.get(2).getOrgName());
}
if (size > 3) {
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!