From 3b0516a2959e25576e4f3fda697a3b025d06c8c9 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期二, 24 六月 2025 14:09:07 +0800 Subject: [PATCH] 每日录像可用指标添加日志,修改大屏为查看当前月平均 --- ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java | 45 +++++++++++++++++++++++++++++---------------- 1 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java index 6514277..6d4294b 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java +++ b/ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java @@ -1,13 +1,18 @@ package com.ycl.calculate; +import com.fasterxml.jackson.databind.ser.Serializers; import com.ycl.platform.domain.entity.CheckIndexVideo; +import com.ycl.platform.domain.result.BaseResult; import com.ycl.platform.domain.result.UY.QueryVqdResult; +import com.ycl.platform.domain.result.UY.VideoOnlineResult; import com.ycl.platform.domain.vo.PlatformOnlineVO; import com.ycl.platform.mapper.CheckIndexVideoMapper; import com.ycl.platform.service.ICheckIndexVideoService; import com.ycl.system.mapper.SysDeptMapper; import constant.ApiConstants; import constant.CheckConstants; +import enumeration.general.AreaDeptEnum; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -25,7 +30,8 @@ * 涓嶅尯鍒嗗尯鍩� */ @Component -public class PlatformOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<PlatformOnlineVO> { +@Slf4j +public class PlatformOnlineCalculation extends IndexCalculationUtils implements CalculationStrategy<PlatformOnlineVO> { @Autowired private SysDeptMapper deptMapper; @Autowired @@ -35,24 +41,29 @@ @Override public void calculate(List<PlatformOnlineVO> list) { + //list 瀵硅薄鏄煡璇� t_platform_online 鏄ㄥぉ鏃舵鐨勯泦鍚堝璞� + Map<String,Double> map = new HashMap<>(); if (!CollectionUtils.isEmpty(list)) { - //鎬荤绾挎椂闀� - int time = list.stream().map(PlatformOnlineVO::getTodayOutlineSed).reduce(0, Integer::sum); - //绂荤嚎鏃堕暱杞崲浣嶅垎閽熺劧鍚庡彇妯� - int num = (time / 60) % 30; - double score = Math.max(1 - num * 0.1, 0); + for (PlatformOnlineVO platformOnlineVO : list) { + String[] areas = platformOnlineVO.getArea().split(","); + for (String area : areas) { + Integer deptId = AreaDeptEnum.fromCode(area).getDeptId(); + //绂荤嚎鏃堕暱 + Integer time = platformOnlineVO.getTodayOutlineSed(); + //绂荤嚎鏃堕暱杞崲涓哄垎閽� + int num = (time / 60) / 30; + double score = Math.max(1 - num * 0.1, 0); + map.put(deptId+"",score); + map.put(ApiConstants.Province + deptId,score); + map.put(ApiConstants.Dept + deptId,score); + } + } + //鏄惁宸茬粡瀛樺湪褰撴棩鏁版嵁 List<CheckIndexVideo> checkIndexVideos = videoMapper.selectToday(DateUtils.getDate()); - //鎵�鏈夊尯鍩熼儴闂� - List<Long> deptIds = deptMapper.selectByParentId(207L); - List<String> keys = new ArrayList<>(); - //鍑嗗鍖哄垎鐪佸巺銆佸尯鍩熺殑deptId list - for (Long deptId : deptIds) { - keys.add(deptId + ""); - keys.add(ApiConstants.Province + deptId); - } + List<CheckIndexVideo> videos = new ArrayList<>(); - keys.forEach(key -> { + map.forEach((key,score) -> { //濡傛灉涓嶅瓨鍦ㄥ氨鏂板濡傛灉瀛樺湪鍒欏鐢� CheckIndexVideo checkIndex = getCheckIndex(key, checkIndexVideos, CheckIndexVideo.class); if (checkIndex != null) { @@ -60,8 +71,10 @@ videos.add(checkIndex); } }); - checkIndexVideoService.saveOrUpdateBatch(videos); + }else { + log.info("鏁版嵁涓虹┖"); } } + } -- Gitblit v1.8.0