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

[装备模块]添加统计详情,使用状态出库门禁不报警

上级 40d06ab7
...@@ -51,6 +51,14 @@ public class DeviceLibraryController { ...@@ -51,6 +51,14 @@ public class DeviceLibraryController {
@Autowired @Autowired
private DeviceLogService deviceLogService; private DeviceLogService deviceLogService;
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
@PostMapping("/selectByIds")
public ResponseEntity selectByIds(@RequestBody List<Integer> ids){
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
ids.forEach(integer -> deviceLibraries.add(deviceLibraryService.getOne(integer)));
return ResponseEntity.ok(deviceLibraries);
}
@ApiOperation(value = "模糊查询装备分页", notes = "可以通过这个接口查询装备") @ApiOperation(value = "模糊查询装备分页", notes = "可以通过这个接口查询装备")
@PostMapping("/selectDevicePage") @PostMapping("/selectDevicePage")
public ResponseEntity selectDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) { public ResponseEntity selectDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
......
...@@ -139,6 +139,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -139,6 +139,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
//按型号遍历统计各种状态的装备数量 //按型号遍历统计各种状态的装备数量
for (String model : list) { for (String model : list) {
DeviceStatisticsVo deviceStatisticsVo = new DeviceStatisticsVo(); DeviceStatisticsVo deviceStatisticsVo = new DeviceStatisticsVo();
List<Integer> deviceIds = new ArrayList<>();
deviceStatisticsVo.setModel(model); deviceStatisticsVo.setModel(model);
int num = 0; int num = 0;
int inLibraryNum = 0; int inLibraryNum = 0;
...@@ -151,6 +152,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -151,6 +152,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
//遍历核心装备,按照相同型号的装备生命状态统计 //遍历核心装备,按照相同型号的装备生命状态统计
for (DeviceLibrary d2 : libraryEntities) { for (DeviceLibrary d2 : libraryEntities) {
if (d2.getModel().equals(model)) { if (d2.getModel().equals(model)) {
deviceIds.add(d2.getId());
deviceStatisticsVo.setName(d2.getName()); deviceStatisticsVo.setName(d2.getName());
num++; num++;
switch (d2.getLifeStatus()) { switch (d2.getLifeStatus()) {
...@@ -191,6 +193,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -191,6 +193,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
} }
//添加统计vo //添加统计vo
if (num > 0) { if (num > 0) {
deviceStatisticsVo.setDeviceIds(deviceIds);
deviceStatisticsVo.setDeviceNumber(num); deviceStatisticsVo.setDeviceNumber(num);
deviceStatisticsVo.setAllotNum(allotNum); deviceStatisticsVo.setAllotNum(allotNum);
deviceStatisticsVo.setInLibraryNum(inLibraryNum); deviceStatisticsVo.setInLibraryNum(inLibraryNum);
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -43,4 +46,7 @@ public class DeviceStatisticsVo { ...@@ -43,4 +46,7 @@ public class DeviceStatisticsVo {
@ApiModelProperty(value = "使用数量", example = "10") @ApiModelProperty(value = "使用数量", example = "10")
private Integer useNum; private Integer useNum;
@ApiModelProperty(value = "该型号所有装备Id列表")
private List<Integer> deviceIds = new ArrayList<>();
} }
...@@ -137,7 +137,8 @@ public class AccessController { ...@@ -137,7 +137,8 @@ public class AccessController {
outPutCardIds.forEach(s -> deviceLibraries.addAll(deviceLibraryDao.getAllByRfidCardId(s))); outPutCardIds.forEach(s -> deviceLibraries.addAll(deviceLibraryDao.getAllByRfidCardId(s)));
//获取最近1分钟报警的Id //获取最近1分钟报警的Id
List<Integer> ids = getLatestWarningDeviceIds(); List<Integer> ids = getLatestWarningDeviceIds();
List<Integer> idList = deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()); //排除使用状态中的装备,映射成id
List<Integer> idList = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getLifeStatus()!=14).map(DeviceLibrary::getId).collect(Collectors.toList());
ids.retainAll(idList); ids.retainAll(idList);
idList.removeAll(ids); idList.removeAll(ids);
if(idList.size()>0) { if(idList.size()>0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论