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

【清退提交】 直属单位相关代码

上级 c804b39f
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.sendback.controller; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.sendback.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.sendback.entity.vo.DeviceIdLIstVo; import com.tykj.dev.device.sendback.entity.vo.DeviceIdLIstVo;
import com.tykj.dev.device.sendback.entity.vo.ModelAndTypeVo;
import com.tykj.dev.device.sendback.service.RepelQueryService; import com.tykj.dev.device.sendback.service.RepelQueryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -111,4 +112,15 @@ public class RepelQueryController { ...@@ -111,4 +112,15 @@ public class RepelQueryController {
public ResponseEntity provinceDirectlyUnderSelectedDev( @PathVariable Integer taskId, @PathVariable Integer unitId){ public ResponseEntity provinceDirectlyUnderSelectedDev( @PathVariable Integer taskId, @PathVariable Integer unitId){
return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderSelectedDev(taskId,unitId)); return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderSelectedDev(taskId,unitId));
} }
/**
* 清退管理 选择装备列表的接口
*/
@PostMapping(value ="/findRepelListModelNameGroup")
@ApiOperation(value = "清退管理 选择装备列表的接口", notes = "清退管理 选择装备列表的接口")
public ResponseEntity findRepelListModelNameGroup(@RequestBody ModelAndTypeVo modelAndTypeVo){
return ResponseEntity.ok(repelQueryService.findRepelListModelNameGroup(modelAndTypeVo));
}
} }
...@@ -27,7 +27,7 @@ public class ModelNameGroup { ...@@ -27,7 +27,7 @@ public class ModelNameGroup {
/** /**
* 类型 * 类型
*/ */
private String name; private Integer name;
/** /**
* 装备id集合 * 装备id集合
......
...@@ -49,7 +49,7 @@ public interface RepelQueryService { ...@@ -49,7 +49,7 @@ public interface RepelQueryService {
/** /**
* 待清退页面查询统计查询接口 * 待清退页面查询统计查询接口
*/ */
List<ModelNameGroup> findRepelListModelNameGroup(ModelAndTypeVo modelAndTypeVo); List<DevRepelVo> findRepelListModelNameGroup(ModelAndTypeVo modelAndTypeVo);
/** /**
* 已清退列表 * 已清退列表
......
...@@ -92,7 +92,6 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -92,7 +92,6 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override @Override
public List<ModelNameGroup> toRepelList(Integer unitId) { public List<ModelNameGroup> toRepelList(Integer unitId) {
Map<String,ModelNameGroup> modelNameGroupMap=new HashMap<>();
Units units= unitsService.findById(unitId); Units units= unitsService.findById(unitId);
return toModelNameGroup(deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15)); return toModelNameGroup(deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15));
} }
...@@ -105,7 +104,7 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -105,7 +104,7 @@ public class RepelQueryServiceImpl implements RepelQueryService {
String key=deviceLibrary.getModel()+deviceLibrary.getName(); String key=deviceLibrary.getModel()+deviceLibrary.getName();
if (!modelNameGroupMap.containsKey(key)){ if (!modelNameGroupMap.containsKey(key)){
ids.add(deviceLibrary.getId()); ids.add(deviceLibrary.getId());
modelNameGroupMap.put(key,new ModelNameGroup(deviceLibrary.getModel(),deviceLibrary.getName(),ids)); modelNameGroupMap.put(key,new ModelNameGroup(deviceLibrary.getModel(),deviceLibrary.getType(),ids));
}else { }else {
ModelNameGroup modelNameGroup=modelNameGroupMap.get(key); ModelNameGroup modelNameGroup=modelNameGroupMap.get(key);
ids=modelNameGroupMap.get(key).getIds(); ids=modelNameGroupMap.get(key).getIds();
...@@ -119,27 +118,23 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -119,27 +118,23 @@ public class RepelQueryServiceImpl implements RepelQueryService {
} }
@Override @Override
public List<ModelNameGroup> findRepelListModelNameGroup(ModelAndTypeVo modelAndTypeVo) { public List<DevRepelVo> findRepelListModelNameGroup(ModelAndTypeVo modelAndTypeVo) {
Map<String,ModelNameGroup> modelNameGroupMap=new HashMap<>();
Units units= unitsService.findById(modelAndTypeVo.getUnitId()); Units units= unitsService.findById(modelAndTypeVo.getUnitId());
deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15).stream().filter(deviceLibrary -> modelAndTypeVo.getModel()!=null&&deviceLibrary.getModel().equals(modelAndTypeVo.getModel())) if (modelAndTypeVo.getModel()==null&&modelAndTypeVo.getType()==null){
.filter(deviceLibrary -> modelAndTypeVo.getType()!=null&& deviceLibrary.getLifeStatus().equals(modelAndTypeVo.getType())).forEach( return deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15).stream()
deviceLibrary -> { .map(this::devRepelVo).collect(Collectors.toList());
List<Integer> ids=new ArrayList<>(); }else if (modelAndTypeVo.getModel()!=null&&modelAndTypeVo.getType()==null){
String key=deviceLibrary.getModel()+deviceLibrary.getName(); return deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15).stream().filter(deviceLibrary -> deviceLibrary.getModel().equals(modelAndTypeVo.getModel()))
if (!modelNameGroupMap.containsKey(key)){ .map(this::devRepelVo).collect(Collectors.toList());
ids.add(deviceLibrary.getId()); }else if (modelAndTypeVo.getModel()==null&&modelAndTypeVo.getType()!=null){
modelNameGroupMap.put(key,new ModelNameGroup(deviceLibrary.getModel(),deviceLibrary.getName(),ids)); return deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15).stream()
}else { .filter(deviceLibrary -> deviceLibrary.getType().equals(modelAndTypeVo.getType()))
ModelNameGroup modelNameGroup=modelNameGroupMap.get(key); .map(this::devRepelVo).collect(Collectors.toList());
ids=modelNameGroupMap.get(key).getIds(); }else {
ids.add(deviceLibrary.getId()); return deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),15).stream().filter(deviceLibrary -> deviceLibrary.getModel().equals(modelAndTypeVo.getModel()))
modelNameGroup.setIds(ids); .filter(deviceLibrary -> deviceLibrary.getType().equals(modelAndTypeVo.getType()))
modelNameGroupMap.put(key,modelNameGroup); .map(this::devRepelVo).collect(Collectors.toList());
} }
}
);
return modelNameGroupMap.values().stream().sorted(Comparator.comparing(ModelNameGroup::getModel)).collect(Collectors.toList());
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论