Commit bff63eb6 by zhouhaibao

[+]试驾服务

1 parent 08278c8d
......@@ -36,6 +36,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -275,23 +276,20 @@ public class TrialDriveShopService {
}
public List<SimpleTreeModel> getShopWithUserTree() {
List<Organization> orgList = getShopOrgs();
List<SimpleTreeModel> treeModelList = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(orgList)) {
List<Long> longList = orgList.stream().map(index -> index.getId()).collect(Collectors.toList());
R<List<User>> byOrg = userService.findByOrg(new FindUserRequest().setOrgIds(longList));
List<User> list = byOrg.getDataList(new TypeToken<List<User>>() {
}.getType());
orgList.forEach(o -> {
SimpleTreeModel treeModel = new SimpleTreeModel();
treeModel.setId(o.getId());
treeModel.setLabel(o.getOrgName());
treeModel.setType(0);
R<List<User>> userListR = userService.findByOrg(new FindUserRequest().setOrgId(o.getId()));
List<User> list = userListR.getDataList(new TypeToken<List<User>>() {
}.getType());
List<SimpleTreeModel> children = getChildren(list);
List<User> userList = list.stream().filter(index -> index.getOrgId().equals(o.getId())).collect(Collectors.toList());
List<SimpleTreeModel> children = getChildren(userList);
treeModel.setChildren(children);
treeModelList.add(treeModel);
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!