From 74fb0ca8f830e145513cc8e18257c5bac4c5ed62 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期六, 24 八月 2024 12:09:32 +0800
Subject: [PATCH] refactor:合同考核结果详情调整
---
ycl-server/src/main/java/com/ycl/calculate/PlatformOnlineCalculation.java | 63 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 3 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 2ae0bfb..6f0c037 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,70 @@
package com.ycl.calculate;
+import com.ycl.platform.domain.entity.CheckIndexVideo;
import com.ycl.platform.domain.result.UY.QueryVqdResult;
+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 lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import utils.DateUtils;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-public class PlatformOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<QueryVqdResult> {
+/**
+ * 骞冲彴鍦ㄧ嚎鐜囪绠�
+ * 绂荤嚎鏃堕暱姣忚秴杩�30鍒嗛挓鎵g櫨鍒嗕箣鍗�
+ * 涓嶅尯鍒嗗尯鍩�
+ */
+@Component
+@Slf4j
+public class PlatformOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<PlatformOnlineVO> {
+ @Autowired
+ private SysDeptMapper deptMapper;
+ @Autowired
+ private CheckIndexVideoMapper videoMapper;
+ @Autowired
+ private ICheckIndexVideoService checkIndexVideoService;
@Override
- public void calculate(List<QueryVqdResult> list) {
-
+ public void calculate(List<PlatformOnlineVO> list) {
+ 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);
+ //鏄惁宸茬粡瀛樺湪褰撴棩鏁版嵁
+ 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 -> {
+ //濡傛灉涓嶅瓨鍦ㄥ氨鏂板濡傛灉瀛樺湪鍒欏鐢�
+ CheckIndexVideo checkIndex = getCheckIndex(key, checkIndexVideos, CheckIndexVideo.class);
+ if (checkIndex != null) {
+ checkIndex.setPlatformOnline(new BigDecimal(score));
+ videos.add(checkIndex);
+ }
+ });
+ checkIndexVideoService.saveOrUpdateBatch(videos);
+ }else {
+ log.info("鏁版嵁涓虹┖");
+ }
}
}
--
Gitblit v1.8.0