parent
29e0f13a2d
commit
f3e1a74e2f
|
@ -19,9 +19,9 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author song.tianyang
|
* @author song.tianyang
|
||||||
|
@ -57,8 +57,18 @@ public class ShareInfoController {
|
||||||
if (request.getApiIdList() != null) {
|
if (request.getApiIdList() != null) {
|
||||||
//要根据ids的顺序进行返回排序
|
//要根据ids的顺序进行返回排序
|
||||||
List<ApiDefinitionWithBLOBs> apiModels = apiDefinitionService.getBLOBs(request.getApiIdList());
|
List<ApiDefinitionWithBLOBs> apiModels = apiDefinitionService.getBLOBs(request.getApiIdList());
|
||||||
Map<String, ApiDefinitionWithBLOBs> apiModelMaps = apiModels.stream().collect(Collectors.toMap(ApiDefinitionWithBLOBs::getId, a -> a, (k1, k2) -> k1));
|
Map<String, ApiDefinitionWithBLOBs> apiModelMaps = new HashMap<>();
|
||||||
Map<String, User> userIdMap = userService.queryName();
|
List<String> userIdList = new ArrayList<>();
|
||||||
|
apiModels.forEach(item -> {
|
||||||
|
apiModelMaps.put(item.getId(), item);
|
||||||
|
if (!userIdList.contains(item.getUserId())) {
|
||||||
|
userIdList.add(item.getUserId());
|
||||||
|
}
|
||||||
|
if (!userIdList.contains(item.getCreateUser())) {
|
||||||
|
userIdList.add(item.getCreateUser());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Map<String, User> userIdMap = userService.getUserIdMapByIds(userIdList);
|
||||||
for (String id : request.getApiIdList()) {
|
for (String id : request.getApiIdList()) {
|
||||||
ApiDefinitionWithBLOBs model = apiModelMaps.get(id);
|
ApiDefinitionWithBLOBs model = apiModelMaps.get(id);
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
|
@ -66,7 +76,7 @@ public class ShareInfoController {
|
||||||
model.setId(id);
|
model.setId(id);
|
||||||
model.setName(id);
|
model.setName(id);
|
||||||
}
|
}
|
||||||
ApiDocumentInfoDTO returnDTO = shareInfoService.conversionModelToDTO(model,userIdMap);
|
ApiDocumentInfoDTO returnDTO = shareInfoService.conversionModelToDTO(model, userIdMap);
|
||||||
returnList.add(returnDTO);
|
returnList.add(returnDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,8 +88,15 @@ public class ShareInfoController {
|
||||||
ApiDefinitionWithBLOBs apiModel = apiDefinitionService.getBLOBs(id);
|
ApiDefinitionWithBLOBs apiModel = apiDefinitionService.getBLOBs(id);
|
||||||
ApiDocumentInfoDTO returnDTO = new ApiDocumentInfoDTO();
|
ApiDocumentInfoDTO returnDTO = new ApiDocumentInfoDTO();
|
||||||
try {
|
try {
|
||||||
Map<String, User> userIdMap = userService.queryName();
|
List<String> userIdList = new ArrayList<>();
|
||||||
returnDTO = shareInfoService.conversionModelToDTO(apiModel,userIdMap);
|
if (!userIdList.contains(apiModel.getUserId())) {
|
||||||
|
userIdList.add(apiModel.getUserId());
|
||||||
|
}
|
||||||
|
if (!userIdList.contains(apiModel.getCreateUser())) {
|
||||||
|
userIdList.add(apiModel.getCreateUser());
|
||||||
|
}
|
||||||
|
Map<String, User> userIdMap = userService.getUserIdMapByIds(userIdList);
|
||||||
|
returnDTO = shareInfoService.conversionModelToDTO(apiModel, userIdMap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue