|
@@ -32,6 +32,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -70,7 +71,7 @@ public class ResourceServiceImpl extends BaseMybatisService<ServiceResource,Stri
|
|
|
@Override
|
|
|
public Page<ServiceResourceDTO> page(Searchable searchable) {
|
|
|
Page<ServiceResource> page = serviceResourceMapper.pagingBySearchable(searchable);
|
|
|
- List<ServiceResourceDTO> dtos = new ArrayList<ServiceResourceDTO>();
|
|
|
+ List<ServiceResourceDTO> dtos = new ArrayList<>();
|
|
|
List<ServiceResource> content = page.getContent();
|
|
|
for (ServiceResource serviceResource : content) {
|
|
|
ServiceResourceDTO dto = new ServiceResourceDTO();
|
|
@@ -109,11 +110,11 @@ public class ResourceServiceImpl extends BaseMybatisService<ServiceResource,Stri
|
|
|
apps.add(applyInfo);
|
|
|
}
|
|
|
List<MenuResourceDTO> menuDTOList = list.stream()
|
|
|
- .filter(item->item.getMenusResources()!=null)
|
|
|
+ .filter(item -> item.getMenusResources() != null)
|
|
|
.map(AppResourceDTO::getMenusResources)
|
|
|
.flatMap(List::stream)
|
|
|
.collect(Collectors.toList());
|
|
|
- Map<String, String> codeToIdMap = apps.stream().collect(Collectors.toMap(item -> item.getApplyCode(), item -> item.getId()));
|
|
|
+ Map<String, String> codeToIdMap = apps.stream().collect(Collectors.toMap(ApplyInfo::getApplyCode, ApplyInfo::getId));
|
|
|
batchInsertMenu(menuDTOList,codeToIdMap);
|
|
|
return apps;
|
|
|
}
|
|
@@ -190,18 +191,18 @@ public class ResourceServiceImpl extends BaseMybatisService<ServiceResource,Stri
|
|
|
List<ResourceSync> menuList = resourceMap.get(ResourceTypeEnum.TJ_APP_MENU.getResourceId());
|
|
|
//插入应用资源
|
|
|
if(null!=appList){
|
|
|
- List<AppResourceDTO> apps = appList.stream().map(item -> getAppResourceDTO(item)).collect(Collectors.toList());
|
|
|
+ List<AppResourceDTO> apps = appList.stream().map(this::getAppResourceDTO).collect(Collectors.toList());
|
|
|
batchInsertAppResource(apps);
|
|
|
}
|
|
|
//插入服务资源
|
|
|
if(null!=serviceList){
|
|
|
- List<ServiceResourceDTO> services = serviceList.stream().map(item -> getServiceResourceDTO(item)).collect(Collectors.toList());
|
|
|
+ List<ServiceResourceDTO> services = serviceList.stream().map(this::getServiceResourceDTO).collect(Collectors.toList());
|
|
|
batchInsertServiceResource(services);
|
|
|
}
|
|
|
//插入菜单目录
|
|
|
- if(null!=menuList){
|
|
|
- List<MenuResourceDTO> menus = menuList.stream().map(item -> getMenuResourceDTOs(item))
|
|
|
- .flatMap(list->list.stream())
|
|
|
+ if(null!=menuList) {
|
|
|
+ List<MenuResourceDTO> menus = menuList.stream().map(this::getMenuResourceDTOs)
|
|
|
+ .flatMap(Collection::stream)
|
|
|
.collect(Collectors.toList());
|
|
|
batchInsertMenu(menus);
|
|
|
}
|