Commit 2ad1289d by 梅存智

工作台优化首页行为分析优化

parent bc7a6daf
package com.yizhi.site.application.vo.site; package com.yizhi.site.application.vo.site;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
...@@ -13,4 +14,10 @@ public class EventTrackTypeNumVo { ...@@ -13,4 +14,10 @@ public class EventTrackTypeNumVo {
private Integer type; private Integer type;
private String subType; private String subType;
private Integer num; private Integer num;
@ApiModelProperty(value = "本次")
private Integer numTotal;
@ApiModelProperty(value = "上次")
private Integer preNumTotal;
} }
...@@ -30,9 +30,11 @@ public interface EventTrackMapper extends BaseMapper<EventTrack> { ...@@ -30,9 +30,11 @@ public interface EventTrackMapper extends BaseMapper<EventTrack> {
DayNumVo getNumByType(@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("siteId") Long siteId, @Param("weekStartDate") String weekStartDate, @Param("weekEndDate") String weekEndDate); DayNumVo getNumByType(@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("siteId") Long siteId, @Param("weekStartDate") String weekStartDate, @Param("weekEndDate") String weekEndDate);
DayNumVo getTgNumByType(@Param("date") String date,@Param("dateString") String dateString,@Param("siteId") Long siteId); DayNumVo getTgNumByType(@Param("date") String date,@Param("dateString") String dateString,@Param("siteId") Long siteId);
List<EventTrackTypeNumVo> queryNumByType(@Param("deptId") Long deptId,@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("subNameList")List<String> subNameList,@Param("siteId") Long siteId); List<EventTrackTypeNumVo> queryNumByType(@Param("deptId") Long deptId,@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("subNameList")List<String> subNameList,@Param("siteId") Long siteId,
@Param("isPre") Boolean isPre);
List<EventTrackTypeNumVo> queryNumByTypeInformation(@Param("deptId") Long deptId,@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("subNameList")List<String> subNameList,@Param("siteId") Long siteId); List<EventTrackTypeNumVo> queryNumByTypeInformation(@Param("deptId") Long deptId,@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("subNameList")List<String> subNameList,@Param("siteId") Long siteId,
@Param("isPre") Boolean isPre);
List<EventTrackTypeNumVo> queryTgNumByDept(@Param("deptName") String deptName,@Param("typeId")Long typeId,@Param("siteId") Long siteId); List<EventTrackTypeNumVo> queryTgNumByDept(@Param("deptName") String deptName,@Param("typeId")Long typeId,@Param("siteId") Long siteId);
......
...@@ -170,7 +170,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr ...@@ -170,7 +170,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
if(date.equals("2")){ if(date.equals("2")){
DayNumVo day7NumVo = new DayNumVo(); DayNumVo day7NumVo = new DayNumVo();
//查询本、上月 //查询本、上月
dateString = dateString + "-01 00:00:00"; dateString = dateString + "-01 00:00:00";
DayNumVo dayNumVo = this.baseMapper.getMailTgNumByType(date,dateString,context.getSiteId(), null, null); DayNumVo dayNumVo = this.baseMapper.getMailTgNumByType(date,dateString,context.getSiteId(), null, null);
day7NumVo.setNum(dayNumVo.getNum()); day7NumVo.setNum(dayNumVo.getNum());
day7NumVo.setPreNum(dayNumVo.getPreNum()); day7NumVo.setPreNum(dayNumVo.getPreNum());
...@@ -288,7 +288,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr ...@@ -288,7 +288,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
if(date.equals("2")){ if(date.equals("2")){
DayNumVo day7NumVo = new DayNumVo(); DayNumVo day7NumVo = new DayNumVo();
//查询本、上月 //查询本、上月
dateString = dateString + "-01 00:00:00"; dateString = dateString + "-01 00:00:00";
DayNumVo dayNumVo = this.baseMapper.getNumByType(date,dateString,types,context.getSiteId(), null, null); DayNumVo dayNumVo = this.baseMapper.getNumByType(date,dateString,types,context.getSiteId(), null, null);
day7NumVo.setNum(dayNumVo.getNum()); day7NumVo.setNum(dayNumVo.getNum());
day7NumVo.setPreNum(dayNumVo.getPreNum()); day7NumVo.setPreNum(dayNumVo.getPreNum());
...@@ -398,8 +398,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr ...@@ -398,8 +398,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
return null; return null;
} }
@Override private List<EventTrackTypeNumVo> queryNumByType(String date, Boolean isPre, List<Integer> types,String subName) {
public List<EventTrackTypeNumVo> queryNumByType(String date,List<Integer> types,String subName) {
if(ObjectUtils.isEmpty(date)){ if(ObjectUtils.isEmpty(date)){
date = "3"; date = "3";
} }
...@@ -428,9 +427,9 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr ...@@ -428,9 +427,9 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
//判断是否获取阅读量 //判断是否获取阅读量
if(types.get(0).equals(6)){ if(types.get(0).equals(6)){
//阅读量 //阅读量
eventTrackTypeNumVoList = this.baseMapper.queryNumByTypeInformation(null,date,dateString,types,subNameList,context.getSiteId()); eventTrackTypeNumVoList = this.baseMapper.queryNumByTypeInformation(null,date,dateString,types,subNameList,context.getSiteId(), isPre);
} else { } else {
eventTrackTypeNumVoList = this.baseMapper.queryNumByType(null,date,dateString,types,subNameList,context.getSiteId()); eventTrackTypeNumVoList = this.baseMapper.queryNumByType(null,date,dateString,types,subNameList,context.getSiteId(), isPre);
} }
if(CollectionUtil.isNotEmpty(subNameList)){ if(CollectionUtil.isNotEmpty(subNameList)){
List<EventTrackTypeNumVo> finalEventTrackTypeNumVoList = eventTrackTypeNumVoList; List<EventTrackTypeNumVo> finalEventTrackTypeNumVoList = eventTrackTypeNumVoList;
...@@ -453,6 +452,31 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr ...@@ -453,6 +452,31 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
} }
@Override @Override
public List<EventTrackTypeNumVo> queryNumByType(String date,List<Integer> types,String subName) {
//统计本次量
List<EventTrackTypeNumVo> eventTrackTypeNumVoList = queryNumByType(date, false, types, subName);
Integer numTotal = 0;
for(EventTrackTypeNumVo item : eventTrackTypeNumVoList){
numTotal += item.getNum();
}
//统计上次量
List<EventTrackTypeNumVo> preNumVoList = queryNumByType(date, true, types, subName);
Integer preNumTotal = 0;
for(EventTrackTypeNumVo item : preNumVoList){
preNumTotal += item.getNum();
}
//赋值
for(EventTrackTypeNumVo item : eventTrackTypeNumVoList){
item.setNumTotal(numTotal);
item.setPreNumTotal(preNumTotal);
}
return eventTrackTypeNumVoList;
}
@Override
public List<EventTrackDeptNumVo> queryDeptByType(String date, List<Integer> types) { public List<EventTrackDeptNumVo> queryDeptByType(String date, List<Integer> types) {
if(ObjectUtils.isEmpty(date)){ if(ObjectUtils.isEmpty(date)){
date = "3"; date = "3";
...@@ -473,7 +497,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr ...@@ -473,7 +497,7 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
if(CollUtil.isNotEmpty(eventTrackDeptNumVoList)){ if(CollUtil.isNotEmpty(eventTrackDeptNumVoList)){
String finalDate = date; String finalDate = date;
eventTrackDeptNumVoList.stream().forEach(eventTrackDeptNumVo -> { eventTrackDeptNumVoList.stream().forEach(eventTrackDeptNumVo -> {
List<EventTrackTypeNumVo> eventTrackTypeNumVoList = this.baseMapper.queryNumByType(eventTrackDeptNumVo.getDeptId(),finalDate, dateString,types,null,context.getSiteId()); List<EventTrackTypeNumVo> eventTrackTypeNumVoList = this.baseMapper.queryNumByType(eventTrackDeptNumVo.getDeptId(),finalDate, dateString,types,null,context.getSiteId(), false);
if(CollectionUtil.isNotEmpty(eventTrackTypeNumVoList)){ if(CollectionUtil.isNotEmpty(eventTrackTypeNumVoList)){
List<EventTrackTypeNumVo> voList = Lists.newArrayList(); List<EventTrackTypeNumVo> voList = Lists.newArrayList();
eventTrackTypeNumVoList.stream().forEach(numVo->{ eventTrackTypeNumVoList.stream().forEach(numVo->{
......
...@@ -25,15 +25,24 @@ ...@@ -25,15 +25,24 @@
<if test="date==4"> <if test="date==4">
and WEEK(e.create_time) = WEEK(now()) and DATE_FORMAT(e.create_time, '%Y') = DATE_FORMAT(now(), '%Y') and WEEK(e.create_time) = WEEK(now()) and DATE_FORMAT(e.create_time, '%Y') = DATE_FORMAT(now(), '%Y')
</if> </if>
<if test="date==3"> <if test="date==3 and isPre==false">
and DATE_FORMAT(e.create_time, '%Y-%m-%d') = #{dateString} and DATE_FORMAT(e.create_time, '%Y-%m-%d') = #{dateString}
</if> </if>
<if test="date==2"> <if test="date==3 and isPre==true">
and DATE_FORMAT(e.create_time, '%Y-%m') = #{dateString} and DATE_FORMAT(e.create_time, '%Y-%m-%d') = DATE_SUB(DATE_FORMAT(#{dateString}, '%Y-%m-%d'), INTERVAL 1 DAY)
</if> </if>
<if test="date==1"> <if test="date==2 and isPre==false">
and DATE_FORMAT(e.create_time, '%Y') = #{dateString} and DATE_FORMAT(e.create_time, '%Y-%m') = #{dateString}
</if> </if>
<if test="date==2 and isPre==true">
and DATE_FORMAT(e.create_time, '%Y-%m') = DATE_FORMAT(DATE_SUB(DATE_FORMAT(#{dateString}, '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m')
</if>
<if test="date==1 and isPre==false">
and DATE_FORMAT(e.create_time, '%Y') = #{dateString}
</if>
<if test="date==1 and isPre==true">
and DATE_FORMAT(e.create_time, '%Y') = DATE_FORMAT(DATE_SUB(DATE_FORMAT(#{dateString}, '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y')
</if>
where e.deleted =0 where e.deleted =0
and e.dept_id in (SELECT id FROM cloud_system.authz_user_group where site_id = #{siteId}) and e.dept_id in (SELECT id FROM cloud_system.authz_user_group where site_id = #{siteId})
<if test="types!=null and types.size()>0"> <if test="types!=null and types.size()>0">
...@@ -311,15 +320,24 @@ ...@@ -311,15 +320,24 @@
<if test="date==4"> <if test="date==4">
and WEEK(e.create_time) = WEEK(now()) and DATE_FORMAT(e.create_time, '%Y') = DATE_FORMAT(now(), '%Y') and WEEK(e.create_time) = WEEK(now()) and DATE_FORMAT(e.create_time, '%Y') = DATE_FORMAT(now(), '%Y')
</if> </if>
<if test="date==3"> <if test="date==3 and isPre==false">
and DATE_FORMAT(e.create_time, '%Y-%m-%d') = #{dateString} and DATE_FORMAT(e.create_time, '%Y-%m-%d') = #{dateString}
</if> </if>
<if test="date==2"> <if test="date==3 and isPre==true">
and DATE_FORMAT(e.create_time, '%Y-%m-%d') = DATE_SUB(DATE_FORMAT(#{dateString}, '%Y-%m-%d'), INTERVAL 1 DAY)
</if>
<if test="date==2 and isPre==false">
and DATE_FORMAT(e.create_time, '%Y-%m') = #{dateString} and DATE_FORMAT(e.create_time, '%Y-%m') = #{dateString}
</if> </if>
<if test="date==1"> <if test="date==2 and isPre==true">
and DATE_FORMAT(e.create_time, '%Y-%m') = DATE_FORMAT(DATE_SUB(DATE_FORMAT(#{dateString}, '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m')
</if>
<if test="date==1 and isPre==false">
and DATE_FORMAT(e.create_time, '%Y') = #{dateString} and DATE_FORMAT(e.create_time, '%Y') = #{dateString}
</if> </if>
<if test="date==1 and isPre==true">
and DATE_FORMAT(e.create_time, '%Y') = DATE_FORMAT(DATE_SUB(DATE_FORMAT(#{dateString}, '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y')
</if>
where e.deleted =0 where e.deleted =0
and e.dept_id in (SELECT id FROM cloud_system.authz_user_group where site_id = #{siteId}) and e.dept_id in (SELECT id FROM cloud_system.authz_user_group where site_id = #{siteId})
<if test="types!=null and types.size()>0"> <if test="types!=null and types.size()>0">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment