提交 e93aee55 authored 作者: 133's avatar 133

Merge branch 'master' of git.yfzx.zjtys.com.cn:matrix/device-back into dev

......@@ -3,6 +3,7 @@ package com.tykj.dev.misc.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
......@@ -19,6 +20,7 @@ import java.util.stream.Collectors;
* @createTime 2021年07月14日 13:45:00
*/
@Component
@Slf4j
public class DeviceModelSort {
public static Map<String, Integer> mapModelSort;
......@@ -70,7 +72,11 @@ public class DeviceModelSort {
* @return 排序过后的型号列表
*/
public static List<String> unitToSort(List<String> unitList) {
return unitList.stream().sorted(Comparator.comparing(DeviceModelSort::toUnitSort)).collect(Collectors.toList());
return unitList.stream()
.map(s -> new SortedModel(toUnitSort(s), s))
.sorted(Comparator.comparing(SortedModel::getId).thenComparing(SortedModel::getValue))
.map(SortedModel::getValue)
.collect(Collectors.toList());
}
/**
......@@ -80,7 +86,12 @@ public class DeviceModelSort {
* @return 排序号码
*/
public static Integer toUnitSort(String unitName) {
return mapUnitSort.get(unitName);
if (mapUnitSort.containsKey(unitName)){
return mapUnitSort.get(unitName);
}else {
log.info("单位名称没找到排序:{}",unitName);
return 9999;
}
}
}
......@@ -65,6 +65,11 @@ public class UnitsController {
return ResponseEntity.ok(unitsService.findLeftNavigation1(securityUser));
}
@GetMapping(value = "/areaDirectlyUnder")
@ApiOperation(value = "查询直属代管单位列表", notes = "查询直属代管单位列表")
public ResponseEntity selectOrganizationUnits2(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
return ResponseEntity.ok(unitsService.findLeftNavigation2(securityUser));
}
@GetMapping(value = "/findAll/GreaterThanEqual/{level}")
@ApiOperation(value = "根据当前用户的单位等级,查询所有的下级单位以及自己单位", notes = "单位集合")
......
......@@ -140,6 +140,10 @@ public interface UnitsService extends PublicService<Units> {
*/
LeftNavigation findLeftNavigation1(SecurityUser securityUser);
/**
* 直属单位侧面导航栏接口
*/
LeftNavigation findLeftNavigation2(SecurityUser securityUser);
/**
* 左边侧面导航栏接口 不包括直属单位
*/
......
......@@ -330,6 +330,13 @@ public class UnitsServiceImpl implements UnitsService {
return leftNavigation;
}
@Override
public LeftNavigation findLeftNavigation2(SecurityUser securityUser) {
List<LeftNavigation> leftNavigationList2=unitsDao.findAllByType(2).stream().filter(units1 -> !units1.getName().equals("省应急小组")&& !units1.getName().equals("省机科技管理处")&& !units1.getName().equals("省机通信报务处")).map(Units::toLeftNavigation).collect(Collectors.toList());
LeftNavigation leftNavigation2=new LeftNavigation(0,"省直属",leftNavigationList2, UUID.randomUUID().toString(),1,22,null);
return leftNavigation2;
}
@Override
public LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser) {
LeftNavigation leftNavigation=new LeftNavigation();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论