From 5fb9ec966051fdb79caed18813da5955e1639652 Mon Sep 17 00:00:00 2001 From: huangzj <826100833@qq.com> Date: Tue, 1 Aug 2023 09:41:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CsDeviceUserPOServiceImpl.java | 18 +++++++++++++----- .../alarm/CsEventDetailPOController.java | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java index 17b33d6..c7e7cd9 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java @@ -14,9 +14,11 @@ import com.njcn.csdevice.mapper.CsLedgerMapper; import com.njcn.csdevice.pojo.po.CsDeviceUserPO; import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO; import com.njcn.csdevice.pojo.po.CsLedger; +import com.njcn.csdevice.pojo.vo.CsLedgerVO; import com.njcn.csdevice.pojo.vo.DevCountVO; import com.njcn.csdevice.service.CsDeviceUserPOService; import com.njcn.csdevice.service.CsEquipmentDeliveryService; +import com.njcn.csdevice.service.ICsLedgerService; import com.njcn.csdevice.service.RoleEngineerDevService; import com.njcn.cswarn.api.CsEquipmentAlarmFeignClient; import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm; @@ -28,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -46,7 +49,7 @@ import static java.util.Objects.*; @RequiredArgsConstructor public class CsDeviceUserPOServiceImpl extends ServiceImpl implements CsDeviceUserPOService{ - private final CsLedgerMapper csLedgerMapper; + private final ICsLedgerService iCsLedgerService; private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient; private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper; private final RoleEngineerDevService roleEngineerDevService; @@ -93,6 +96,10 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl device = roleEngineerDevService.getDevice(); + List deviceTree = iCsLedgerService.getDeviceTree(); + List collect1 = deviceTree.stream().filter(temp -> temp.getId().equals(id)).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getId).collect(Collectors.toList()); + //求交集 + device.retainAll(collect1); if(CollectionUtils.isEmpty(device)){ devCountVO.setOnLineCount(0); devCountVO.setOnLineDevs(new ArrayList<>()); @@ -107,14 +114,15 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.in("id",device); + List csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper); devCountVO.setAllDevs(csEquipmentDeliveryPOS); List collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList()); List collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList()); - devCountVO.setOnLineCount(collect.size()); - devCountVO.setOnLineDevs(collect); - devCountVO.setOffLineCount(collect2.size()); - devCountVO.setOffLineDevs(collect2); + devCountVO.setOnLineCount(collect2.size()); + devCountVO.setOnLineDevs(collect2); + devCountVO.setOffLineCount(collect.size()); + devCountVO.setOffLineDevs(collect); } diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/controller/alarm/CsEventDetailPOController.java b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/controller/alarm/CsEventDetailPOController.java index 7e6d84f..69c424a 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/controller/alarm/CsEventDetailPOController.java +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/controller/alarm/CsEventDetailPOController.java @@ -51,7 +51,7 @@ public class CsEventDetailPOController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/queryList") @ApiOperation("暂态警告分页查询") - @ApiImplicitParam(name = "csEventDetailPageParm", value = "暂态警告查询参数", required = true) + @ApiImplicitParam(name = "csEventDetailParm", value = "暂态警告查询参数", required = true) public HttpResult> queryList(@RequestBody @Validated CsEventDetailParm csEventDetailParm ){ String methodDescribe = getMethodDescribe("queryList");