提交 64b81a32 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 eb1bea2e
...@@ -134,14 +134,74 @@ public class DeviceLibraryController { ...@@ -134,14 +134,74 @@ public class DeviceLibraryController {
@ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表") @ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表")
@PostMapping("/core/feature/summary") @PostMapping("/core/feature/summary")
public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) { public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable()); List<DeviceVo> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable()).stream().map(DeviceLibrary::parseVo).collect(Collectors.toList());
Page<DeviceVo> deviceLibraryEntities = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), resultList, deviceLibrarySelectVo.getPageable()).map(DeviceLibrary::parseVo); List<Comparator<DeviceVo>> comparators = new ArrayList<>();
if (deviceLibrarySelectVo.getOrders().size() > 0) {
for (CustomOrder c:deviceLibrarySelectVo.getOrders()) {
if ("model".equals(c.getCoulmn())){
if ("ASC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getModel,Comparator.nullsFirst(String::compareTo)));
}
else if ("DESC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getModel,Comparator.nullsFirst(String::compareTo)).reversed());
}
}
else if ("name".equals(c.getCoulmn())){
if ("ASC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getName,Comparator.nullsFirst(String::compareTo)));
}
else if ("DESC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getName,Comparator.nullsFirst(String::compareTo)).reversed());
}
}
else if ("seqNumber".equals(c.getCoulmn())){
if ("ASC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getSeqNumber,Comparator.nullsFirst(String::compareTo)));
}
else if ("DESC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getSeqNumber,Comparator.nullsFirst(String::compareTo)).reversed());
}
}
else if ("locationUnit".equals(c.getCoulmn())){
if ("ASC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getLocationUnit,Comparator.nullsFirst(String::compareTo)));
}
else if ("DESC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getLocationUnit,Comparator.nullsFirst(String::compareTo)).reversed());
}
}
else if ("ownUnit".equals(c.getCoulmn())){
if ("ASC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getOwnUnit,Comparator.nullsFirst(String::compareTo)));
}
else if ("DESC".equals(c.getDirection().toString())) {
comparators.add(Comparator.comparing(DeviceVo::getOwnUnit,Comparator.nullsFirst(String::compareTo)).reversed());
}
}
}
if (comparators.size()==1){
resultList = resultList.stream().sorted(comparators.get(0)).collect(Collectors.toList());
}
else if(comparators.size()==2){
resultList = resultList.stream().sorted(comparators.get(0).thenComparing(comparators.get(1))).collect(Collectors.toList());
}
else if(comparators.size()==3){
resultList = resultList.stream().sorted(comparators.get(0).thenComparing(comparators.get(1)).thenComparing(comparators.get(2))).collect(Collectors.toList());
}
else if(comparators.size()==4){
resultList = resultList.stream().sorted(comparators.get(0).thenComparing(comparators.get(1)).thenComparing(comparators.get(2)).thenComparing(comparators.get(3))).collect(Collectors.toList());
}
else if(comparators.size()==5){
resultList = resultList.stream().sorted(comparators.get(0).thenComparing(comparators.get(1)).thenComparing(comparators.get(2)).thenComparing(comparators.get(3)).thenComparing(comparators.get(4))).collect(Collectors.toList());
}
}
Page<DeviceVo> deviceLibraryEntities = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), resultList, deviceLibrarySelectVo.getPageable());
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("pages",deviceLibraryEntities); map.put("pages",deviceLibraryEntities);
map.put("models",resultList.stream().map(DeviceLibrary::getModel).collect(Collectors.toSet())); map.put("models",resultList.stream().map(DeviceVo::getModel).collect(Collectors.toSet()));
map.put("names",resultList.stream().map(DeviceLibrary::getName).collect(Collectors.toSet())); map.put("names",resultList.stream().map(DeviceVo::getName).collect(Collectors.toSet()));
map.put("ownUnits",resultList.stream().map(DeviceLibrary::getOwnUnit).collect(Collectors.toSet())); map.put("ownUnits",resultList.stream().map(DeviceVo::getOwnUnit).collect(Collectors.toSet()));
map.put("locationUnits",resultList.stream().map(DeviceLibrary::getLocationUnit).collect(Collectors.toSet())); map.put("locationUnits",resultList.stream().map(DeviceVo::getLocationUnit).collect(Collectors.toSet()));
return ResultUtil.success(map); return ResultUtil.success(map);
} }
......
package com.tykj.dev.device.scrap.controller; package com.tykj.dev.device.scrap.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
...@@ -7,6 +8,7 @@ import com.tykj.dev.device.library.service.DeviceLogService; ...@@ -7,6 +8,7 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.FileVo; import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.scrap.service.ScrapBillService; import com.tykj.dev.device.scrap.service.ScrapBillService;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill; import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.device.scrap.subject.vo.ScrapSaveVo; import com.tykj.dev.device.scrap.subject.vo.ScrapSaveVo;
...@@ -70,6 +72,9 @@ public class DeviceScrapController { ...@@ -70,6 +72,9 @@ public class DeviceScrapController {
Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap(); Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap();
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
ScrapBill scrapBill = scrapBillService.getOne(scrapId); ScrapBill scrapBill = scrapBillService.getOne(scrapId);
if (scrapBill.getScriptJson()!=null){
scrapBill.setScripts(JacksonUtil.readValue(scrapBill.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
}
list.add(scrapBill); list.add(scrapBill);
List<DeviceLibrary> deviceLibraries = StringSplitUtil.userIdSplit(scrapBill.getScrapDetail()).stream() List<DeviceLibrary> deviceLibraries = StringSplitUtil.userIdSplit(scrapBill.getScrapDetail()).stream()
.map(deviceLibraryMap::get) .map(deviceLibraryMap::get)
......
...@@ -437,6 +437,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -437,6 +437,7 @@ public class TaskServiceImpl implements TaskService {
//省能看到所有业务 //省能看到所有业务
if (level == 1) { if (level == 1) {
taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream() taskUserVos = taskDao.findAll(getSelectSpecification(taskSelectVo)).stream()
.filter(taskBto -> taskSelectVo.getType()==1?(taskBto.getCustomInfo()==null|| !"country".equals(taskBto.getCustomInfo())):(taskBto.getCustomInfo()!=null&& "country".equals(taskBto.getCustomInfo())))
.map(Task::parse2Bto) .map(Task::parse2Bto)
.map(TaskBto::toVo) .map(TaskBto::toVo)
.collect(Collectors.toList()); .collect(Collectors.toList());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论