|
@@ -58,7 +58,6 @@ import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -242,25 +241,25 @@ public class IotInspectOrderController {
|
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-inspect-order:query')")
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-inspect-order:query')")
|
|
|
public CommonResult<PageResult<IotInspectOrderRespVO>> getIotInspectOrderPageApp(@Valid IotInspectOrderPageReqVO pageReqVO) {
|
|
public CommonResult<PageResult<IotInspectOrderRespVO>> getIotInspectOrderPageApp(@Valid IotInspectOrderPageReqVO pageReqVO) {
|
|
|
PageResult<IotInspectOrderDO> pageResult = iotInspectOrderService.getIotInspectOrderPageApp(pageReqVO);
|
|
PageResult<IotInspectOrderDO> pageResult = iotInspectOrderService.getIotInspectOrderPageApp(pageReqVO);
|
|
|
- List<IotInspectOrderRespVO> collect = pageResult.getList().stream().map(e -> {
|
|
|
|
|
- IotInspectOrderRespVO iotInspectOrderRespVO = new IotInspectOrderRespVO();
|
|
|
|
|
- BeanUtils.copyProperties(e, iotInspectOrderRespVO);
|
|
|
|
|
- List<IotInspectOrderDetailDO> details = iotInspectOrderDetailMapper.selectList("order_id", e.getId());
|
|
|
|
|
- long deviceCount = details.stream().map(IotInspectOrderDetailDO::getDeviceId).distinct().count();
|
|
|
|
|
- long exceptionCount = details.stream().filter(f -> Objects.nonNull(f.getIfNormal()) && !f.getIfNormal()).map(IotInspectOrderDetailDO::getDeviceId).distinct().count();
|
|
|
|
|
- Map<Long, List<IotInspectOrderDetailDO>> collect1 = details.stream().collect(Collectors.groupingBy(IotInspectOrderDetailDO::getDeviceId));
|
|
|
|
|
- AtomicInteger needDevice = new AtomicInteger();
|
|
|
|
|
- collect1.forEach((k, v) -> {
|
|
|
|
|
- if (v.stream().anyMatch(gg -> Objects.isNull(gg.getIfNormal()))){
|
|
|
|
|
- needDevice.getAndIncrement();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- iotInspectOrderRespVO.setDeviceCount(deviceCount);
|
|
|
|
|
- iotInspectOrderRespVO.setExceptionCount(exceptionCount);
|
|
|
|
|
- iotInspectOrderRespVO.setNeedDevice(needDevice.get());
|
|
|
|
|
- return iotInspectOrderRespVO;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
- return success(new PageResult<>(collect, pageResult.getTotal()));
|
|
|
|
|
|
|
+// List<IotInspectOrderRespVO> collect = pageResult.getList().stream().map(e -> {
|
|
|
|
|
+// IotInspectOrderRespVO iotInspectOrderRespVO = new IotInspectOrderRespVO();
|
|
|
|
|
+// BeanUtils.copyProperties(e, iotInspectOrderRespVO);
|
|
|
|
|
+// List<IotInspectOrderDetailDO> details = iotInspectOrderDetailMapper.selectList("order_id", e.getId());
|
|
|
|
|
+// long deviceCount = details.stream().map(IotInspectOrderDetailDO::getDeviceId).distinct().count();
|
|
|
|
|
+// long exceptionCount = details.stream().filter(f -> Objects.nonNull(f.getIfNormal()) && !f.getIfNormal()).map(IotInspectOrderDetailDO::getDeviceId).distinct().count();
|
|
|
|
|
+// Map<Long, List<IotInspectOrderDetailDO>> collect1 = details.stream().collect(Collectors.groupingBy(IotInspectOrderDetailDO::getDeviceId));
|
|
|
|
|
+// AtomicInteger needDevice = new AtomicInteger();
|
|
|
|
|
+// collect1.forEach((k, v) -> {
|
|
|
|
|
+// if (v.stream().anyMatch(gg -> Objects.isNull(gg.getIfNormal()))){
|
|
|
|
|
+// needDevice.getAndIncrement();
|
|
|
|
|
+// }
|
|
|
|
|
+// });
|
|
|
|
|
+// iotInspectOrderRespVO.setDeviceCount(deviceCount);
|
|
|
|
|
+// iotInspectOrderRespVO.setExceptionCount(exceptionCount);
|
|
|
|
|
+// iotInspectOrderRespVO.setNeedDevice(needDevice.get());
|
|
|
|
|
+// return iotInspectOrderRespVO;
|
|
|
|
|
+// }).collect(Collectors.toList());
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, IotInspectOrderRespVO.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/device/page")
|
|
@GetMapping("/device/page")
|