2021与蓝度共同重构项目,服务端
liuhaonan
2022-10-25 350608105f300c6c629d743dc9896feca2f22e8d
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -425,20 +425,19 @@
                DeviceOnLineCountVO c3m = new DeviceOnLineCountVO();
                c3mChargings.forEach(
                        device -> {
//                            RedisUtils.getBean().set(C3mRedisConstant.C3_STATUS.getCode() + heartbeatReportInnerFrame.getHeartBeatDataPackage().getC3Mac()
//                                    , heartbeatReportInnerFrame.getHeartBeatDataPackage(), 300L);
                            String s = redisUtils.get(C3mRedisConstant.C3_STATUS.getCode() + device.getC3Mac());
                            RedisDeviceStatus redisDeviceStatus = new RedisDeviceStatus();
                            redisDeviceStatus.setDeviceId(device.getC3Id().toString());
                            if (s != null) {
                                A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class);
                                //  充电桩口状态位  1.空闲 2.充电中 3.充电中断,等待服务器确认 4.充电结束,等待服务器确认 5.有故障 6.与充电桩对接中
                                if ("5".equals(heartBeatDataPackage.getStatusBit())) {
                                    //在线
                                    onLine.getAndIncrement();
                                } else {
                                    //故障
                                    onLine.getAndIncrement();
                                    error.getAndIncrement();
                                } else {
                                    //在线
                                    onLine.getAndIncrement();
                                }
                            } else {
                                //离线
@@ -472,7 +471,7 @@
                DeviceOnLineCountVO air = new DeviceOnLineCountVO();
                airEquipments.forEach(
                        device -> {
                            String s = redisUtils.get(DeviceRedisKey.AIR + device.getAirMac());
                            String s = redisUtils.get(DeviceRedisKey.AIR + device.getMac());
                            if (s != null) {
                                RedisDeviceStatus redisDeviceStatus = JSON.parseObject(s, RedisDeviceStatus.class);
                                if (redisDeviceStatus.getStatus() == 0) {
@@ -728,24 +727,24 @@
     * @param param
     * @return
     */
    public List<Pole> isBind(List<Pole> list, PoleStatesParam param) {
        List<Pole> bindList = new ArrayList<>();//已绑定客户
        List<Pole> unbindList = new ArrayList<>();//未绑定客户
        list.forEach(bindwarpper -> {
//                Long clientId = bindwarpper.getClientId();
            if (bindwarpper.getClientId() == null) {//判断是否绑定
                unbindList.add(bindwarpper);
            } else {
                bindList.add(bindwarpper);
            }
        });
        if (param.getBingStates() == 0) {
            return bindList;
        } else if (param.getBingStates() == 1) {
            return unbindList;
        }
        return list;
    }
//    public List<Pole> isBind(List<Pole> list, PoleStatesParam param) {
//        List<Pole> bindList = new ArrayList<>();//已绑定客户
//        List<Pole> unbindList = new ArrayList<>();//未绑定客户
//        list.forEach(bindwarpper -> {
////                Long clientId = bindwarpper.getClientId();
//            if (bindwarpper.getClientId() == null) {//判断是否绑定
//                unbindList.add(bindwarpper);
//            } else {
//                bindList.add(bindwarpper);
//            }
//        });
//        if (param.getBingStates() == 0) {
//            return bindList;
//        } else if (param.getBingStates() == 1) {
//            return unbindList;
//        }
//        return list;
//    }
    public List<Pole> isTrue(List<Pole> list, PoleStatesParam param) {
        //实体灯杆
@@ -883,7 +882,7 @@
        }
        String deviceName = byId.getDeviceCode();
        if (deviceName.isEmpty()) {
            throw new BusinessException("该灯杆Mca为空");
            throw new BusinessException("该灯杆Mac为空");
        }
        IRequestFrame build = FrameBuilder.builderA5().orderType(A5OrderEnum.REQUEST_LIGHT_DATA.getCode()).innerFrame(new A5LightResetReqInnerFrame()).build();
        CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, build);
@@ -1128,22 +1127,15 @@
    public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword, Long cilentId) {
        LambdaQueryWrapper<Pole> eq;
//        if(SecurityUtils.getClientId()!=null){
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        if (clientService.findClientId(cilentId)) {
            eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, cilentId);
            eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId);
        } else {
            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
            eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId).or(pole -> {
                pole.eq(Pole::getUserId, cilentId);
            });
        }
//        }else {
//            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
//            eq = Wrappers.lambdaQuery(Pole.class);
//        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        if (!keyword.isEmpty()) {
            eq.like(Pole::getPoleName, keyword).or(code -> {
                code.like(Pole::getPoleCode, keyword);
@@ -1151,6 +1143,7 @@
                deviceCode.like(Pole::getDeviceCode, keyword);
            });
        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        List<Pole> list;
        list = list(eq);
        setCount(list);