|
|
@@ -3,6 +3,7 @@ package vip.xiaonuo.disk.service.impl;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
|
|
import vip.xiaonuo.disk.domain.ResourceFootprint;
|
|
|
@@ -98,4 +99,35 @@ public class ResourceStatisticServiceImpl extends ServiceImpl<ResourceStatisticM
|
|
|
Map<String,Object> map=getTime(type);
|
|
|
return resourceStatisticMapper.resourcePublicStatistic(collegeId,map);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> hotStatistic(String collegeId, String type) {
|
|
|
+ Map<String, Object> map = getTime(type);
|
|
|
+ Map<String, Object> rs = resourceStatisticMapper.hotStatistic(collegeId, map);
|
|
|
+
|
|
|
+ List<Map<String, Object>> newList = new ArrayList<>();
|
|
|
+
|
|
|
+ // 推荐资源
|
|
|
+ newList.add(createStatisticMap(1, MapUtils.getInteger(rs, "dNum", 0)));
|
|
|
+
|
|
|
+ // 热门资源
|
|
|
+ newList.add(createStatisticMap(2, MapUtils.getInteger(rs, "hotNum", 0)));
|
|
|
+
|
|
|
+ // 既是热门又是推荐的资源
|
|
|
+ newList.add(createStatisticMap(3, MapUtils.getInteger(rs, "hdNum", 0)));
|
|
|
+
|
|
|
+ return newList;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 创建统计信息Map
|
|
|
+ * @param type 类型 1:推荐 2:热门 3:热门且推荐
|
|
|
+ * @param num 数量
|
|
|
+ * @return 统计信息Map
|
|
|
+ */
|
|
|
+ private Map<String, Object> createStatisticMap(int type, int num) {
|
|
|
+ Map<String, Object> map = new HashMap<>(2);
|
|
|
+ map.put("type", type);
|
|
|
+ map.put("num", num);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|