feat【资源库】首页统计增加上下架的过滤
This commit is contained in:
parent
ee97b24e51
commit
10e80dbf49
|
@ -23,7 +23,7 @@ public class BigScreenStatisticService {
|
|||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> m = achievementsMapper.getAchievement(days[0], days[1], source)
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrYYYYMMDD(days[0], days[1]);
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
Date[] lastDays = DateUtil.getDays(7, 13);
|
||||
long lastSum = Optional.ofNullable(achievementsMapper.countAchievementBySource(lastDays[0], lastDays[1], source)).orElse(0L);
|
||||
long sum = Optional.ofNullable(achievementsMapper.countAchievementBySource(null, null, source)).orElse(0L);
|
||||
|
@ -58,10 +58,17 @@ public class BigScreenStatisticService {
|
|||
return achievementsMapper.getAchievementType();
|
||||
}
|
||||
|
||||
public Map<String, List<KeyValueVo>> getAchievementActData() {
|
||||
public List<Map<String,Object>> getAchievementActData() {
|
||||
List<KeyValueVo> list = achievementsMapper.getAchievementActData();
|
||||
Map<String, List<KeyValueVo>> res = list.stream().collect(Collectors.groupingBy(KeyValueVo::getKey));
|
||||
return res;
|
||||
List<Map<String, Object>> r = new ArrayList<>();
|
||||
res.forEach( (k, v) -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("key", k);
|
||||
map.put("value", v);
|
||||
r.add(map);
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAchievementDomain() {
|
||||
|
|
|
@ -337,7 +337,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Override
|
||||
public Map<String, Object> indexTaskStatistic() {
|
||||
Map<String, Object> res = achievementsMapper.indexTaskStatistic();
|
||||
double convertedTaskAmount = taskResourceLibraryMapper.getConvertedTaskAmount();
|
||||
double convertedTaskAmount = taskResourceLibraryMapper.getConvertedTaskAmount2();
|
||||
res.put("convertedTaskAmount", convertedTaskAmount);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -108,4 +108,6 @@ public interface TaskResourceLibraryMapper {
|
|||
int delFavorite(Favorite favorite);
|
||||
|
||||
int delWatcher(Watcher watcher);
|
||||
|
||||
double getConvertedTaskAmount2();
|
||||
}
|
||||
|
|
|
@ -373,33 +373,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="indexProjectStatistic" resultType="java.util.Map">
|
||||
select COUNT(*) as projectAchievementCount,
|
||||
IFNULL(SUM(attachment_count), 0) as attachmentCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='1') as clickCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='1' and a.status=1) as clickCount,
|
||||
(select COUNT(distinct project_id) from project_resource_library) as projectCount
|
||||
from achievements
|
||||
where source = '1'
|
||||
where source = '1' and status='1'
|
||||
</select>
|
||||
|
||||
<select id="indexTaskStatistic" resultType="java.util.Map">
|
||||
select (select count(distinct trl.task_id) from achievements a join task_resource_library trl on a.source_id = trl.id where a.source='2') as taskCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='2') as clickCount,
|
||||
select (select count(distinct trl.task_id) from achievements a join task_resource_library trl on a.source_id = trl.id where a.source='2' and a.status=1) as taskCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='2' and a.status=1) as clickCount,
|
||||
COUNT(*) as expertAuditCount
|
||||
from achievements
|
||||
where source = '2'
|
||||
where source = '2' and status=1
|
||||
</select>
|
||||
<select id="indexCompetitionStatistic" resultType="java.util.Map">
|
||||
select COUNT(*) as CompetitionCountAchievementCount,
|
||||
(select COUNT(distinct crl.open_competition_id) from achievements a join competition_resource_library crl
|
||||
on a.source_id = crl.id where source = '3' and a.is_expert_audit = 1) as expertAuditCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='3') as clickCount,
|
||||
(select COUNT(distinct open_competition_id) from competition_resource_library) as CompetitionCount
|
||||
on a.source_id = crl.id where source = '3' and a.is_expert_audit = 1 and a.status='1') as expertAuditCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='3' and a.status='1') as clickCount,
|
||||
(select COUNT(distinct open_competition_id) from competition_resource_library crl inner join achievements a on a.source_id=crl.id where a.status='1') as CompetitionCount
|
||||
from achievements
|
||||
where source = '3'
|
||||
where source = '3' and status='1'
|
||||
</select>
|
||||
|
||||
<select id="indexSchoolEnterpriseStatistic" resultType="java.lang.Long">
|
||||
select COUNT(*)
|
||||
from achievements a
|
||||
where source = #{s}
|
||||
and a.status = '1'
|
||||
<if test="t != null and t != ''">
|
||||
and tags = #{t}
|
||||
</if>
|
||||
|
@ -470,7 +471,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select count(*)
|
||||
from achievements
|
||||
<where>
|
||||
<if test="source != null and source != ''">and `source` = #{source}</if>
|
||||
<if test="t != null and t != ''">and `source` = #{t}</if>
|
||||
<if test="s != null">and create_time >= #{s}</if>
|
||||
<if test="e != null">and create_time <= #{e}</if>
|
||||
</where>
|
||||
|
@ -485,19 +486,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getAchievementType" resultType="java.util.Map">
|
||||
select achievement_type as 'k', count(*) as 'v'
|
||||
from achievements
|
||||
from achievements where achievement_type is not null
|
||||
group by achievement_type
|
||||
</select>
|
||||
|
||||
<select id="getAchievementActData" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select * from (
|
||||
select 'w' as `key`, DATE_FORMAT(created_at, '%Y') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
select '关注' as `key`, DATE_FORMAT(created_at, '%Y') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
union all
|
||||
select 'c' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from clickers where click_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
select '浏览' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from clickers where click_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
union all
|
||||
select 'd' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from downloads where download_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
select '下载' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from downloads where download_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
union all
|
||||
select 'f' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y'))t
|
||||
select '收藏' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y'))t
|
||||
order by t.name
|
||||
</select>
|
||||
|
||||
|
@ -517,7 +518,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
group by field_3) a
|
||||
group by a.domain_value
|
||||
order by sum(a.countResult) desc) f
|
||||
right join categories c on c.id = f.name
|
||||
right join categories c on c.id = f.name where f.value is not null
|
||||
|
||||
</select>
|
||||
|
||||
|
|
|
@ -530,6 +530,16 @@
|
|||
where is_transferred_to_results_library = 1) tmp
|
||||
</select>
|
||||
|
||||
<select id="getConvertedTaskAmount2" resultType="java.lang.Double">
|
||||
select IFNULL(SUM(bounty), 0)
|
||||
from (select distinct t.id, t.bounty
|
||||
from tasks t
|
||||
join (select task_id from papers where status = 2) p on t.id = p.task_id
|
||||
join task_resource_library on t.id = task_resource_library.task_id
|
||||
join achievements a on a.source_id = task_resource_library.id and a.source='2' and a.status= '1'
|
||||
where is_transferred_to_results_library = 1) tmp
|
||||
</select>
|
||||
|
||||
<select id="getConvertedTasksCount" resultType="java.lang.Long">
|
||||
select count(*)
|
||||
from tasks t
|
||||
|
|
Loading…
Reference in New Issue