rk
3 天以前 7b95d5cd6cb9cb6ce48c0d4667d5e3f2334012b3
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
@@ -1360,12 +1360,18 @@
        List<Long> startTimeList = platformLogList.stream().filter(i->Objects.nonNull(i.getParam1()))
                .filter(i->Objects.nonNull(i.getParam1())&&i.getParam1().indexOf(today)>=0)
                .map(i->DateUtil.fromStringToDate("yyyy-MM-dd HH:mm:ss",i.getParam1()).getTime()).collect(Collectors.toList());
        Long startTime  = Collections.min(startTimeList);
        Long startTime  = null ;
        if(CollectionUtils.isNotEmpty(startTimeList)){
            startTime = Collections.min(startTimeList);
        }
        //获取结束时间
        List<Long> endTimeList = platformLogList.stream()
                .filter(i->Objects.nonNull(i.getParam2())&&i.getParam2().indexOf(today)>=0)
                .map(i->DateUtil.fromStringToDate("yyyy-MM-dd HH:mm:ss",i.getParam2()).getTime()).collect(Collectors.toList());
        Long endTime = Collections.max(endTimeList);
        Long endTime = null ;
        if(CollectionUtils.isNotEmpty(endTimeList)){
            endTime = Collections.max(endTimeList);
        }
        if(Objects.isNull(startTime)
            || Objects.isNull(endTime) || (startTime>=endTime)){
            return BigDecimal.ZERO;
@@ -1499,23 +1505,41 @@
    @Override
    public    YearDeviceDataVO yearFightingAdminDeviceData(){
        YearDeviceDataVO data = new YearDeviceDataVO();
        FireStatisticRequest param = new FireStatisticRequest();
        param.setIndexCode("api_fire_statistic");
        BaseResponse<FireStatisticResponse> response = HKService.fireStatistic(param);
        if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ) {
            data.setProtectNum(Constants.formatIntegerNum(response.getData().getMaintenanceNum()));
            data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getDeviceTotalNum()));
//        FireStatisticRequest param = new FireStatisticRequest();
//        param.setIndexCode("api_fire_statistic");
//        BaseResponse<FireStatisticResponse> response = HKService.fireStatistic(param);
//        if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ) {
//            data.setProtectNum(Constants.formatIntegerNum(response.getData().getMaintenanceNum()));
//            data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getDeviceTotalNum()));
//        }
//        param = new FireStatisticRequest();
//        param.setIndexCode("api_fire_statistic_month");
//        BaseResponse<FireStatisticResponse> response1 = HKService.fireStatisticMonth(param);
//        if(response1 != null && StringUtils.equals(response1.getCode(), HKConstants.RESPONSE_SUCCEE)
//                && response1.getData()!=null ) {
//            data.setMonthAddNum(Constants.formatIntegerNum(response1.getData().getMaintenanceNumMonth()));
//            data.setMonthTotalNum(Constants.formatIntegerNum(response1.getData().getDeviceTotalNum()));
//        }
        data.setProtectNum(Constants.ZERO);
        data.setPlanProtectTotal(Constants.ZERO);
        data.setMonthAddNum(Constants.ZERO);
        data.setMonthTotalNum(Constants.ZERO);
        BaseResponse<SensorStatusStatisticResponse> response = HKService.sensorStatusStatistic();
        if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)
                && response.getData()!=null ) {
            data.setProtectNum(Constants.formatIntegerNum(response.getData().getSensorMainNum()));
            data.setPlanProtectTotal(Constants.formatIntegerNum(response.getData().getSensorNum()));
            data.setMonthAddNum(Constants.formatIntegerNum(response.getData().getSensorMainMonthNum()));
            data.setMonthTotalNum(Constants.formatIntegerNum(response.getData().getSensorNum()));
        }
        param = new FireStatisticRequest();
        param.setIndexCode("api_fire_statistic_month");
        BaseResponse<FireStatisticResponse> response1 = HKService.fireStatisticMonth(param);
        if(response1 != null && StringUtils.equals(response1.getCode(), HKConstants.RESPONSE_SUCCEE)
                && response1.getData()!=null ) {
            data.setMonthAddNum(Constants.formatIntegerNum(response1.getData().getMaintenanceNumMonth()));
            data.setMonthTotalNum(Constants.formatIntegerNum(response1.getData().getDeviceTotalNum()));
        }
        return data;
    }
    /**
     * 【消防管控】看板-分类和汇总的各状态设备数量
@@ -2092,6 +2116,8 @@
        data.setInParkCarTotal(
                (int) retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).count()
        );
        //2025年8月4日09:24:23 更换数据源 不从海康取
        data.setFreeParkingLot(data.getParkingLotTotal()<data.getInParkCarTotal()?Constants.ZERO:data.getParkingLotTotal() - data.getInParkCarTotal());
        //当前在园货车司机总数
        data.setInParkCarUserTotal(
                (int) retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.FIVE)).count()
@@ -2365,7 +2391,8 @@
                .selectAs(Platform::getName,PlatformWarnEvent::getPlatformName)
                .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                .eq(PlatformWarnEvent::getIsdeleted,Constants.ZERO)
                .apply("to_days(t.create_date) = to_days(now())")
                //.apply(" to_days(t.create_date) = to_days(now()) ")
                .apply(" ( t.create_date > now() - INTERVAL 10 MINUTE ) ")
                .orderByDesc(PlatformWarnEvent::getCreateDate)
                .last(" limit "+limit)
        );