直播记录加上营养师、时间范围筛选,导出功能,进粉、导粉、直播时长统计

This commit is contained in:
xiezhijun
2021-08-24 18:09:07 +08:00
parent ec4f96dc7c
commit 38ba732152
8 changed files with 350 additions and 28 deletions

View File

@ -1,5 +1,6 @@
package com.stdiet.custom.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -24,44 +25,38 @@ public class SysLiveSchedul extends BaseEntity
private Long id;
/** 直播间序号 */
@Excel(name = "直播间序号")
private Integer liveRoom;
/** 排班日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "排班日期", width = 30, dateFormat = "yyyy-MM-dd")
@Excel(name = "直播日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 1)
private Date liveSchedulDate;
/** 直播开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@Excel(name = "直播开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date liveStartTime;
@Excel(name = "直播时间", width = 30, sort = 3)
private String liveStartTimeString;
/** 直播结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@Excel(name = "直播结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date liveEndTime;
/** 直播营养师 */
@Excel(name = "直播营养师")
private Long liveNutritionistId;
/** 直播运营 */
@Excel(name = "直播运营")
private Long liveOperatorId;
/** 直播策划 */
@Excel(name = "直播策划")
private Long livePlannerId;
/** 微信账号管理的进粉渠道 */
@Excel(name = "微信账号管理的进粉渠道")
private Integer fanChannel;
/** 直播状态0未开播 1已开播 2已下播 */
@Excel(name = "直播状态0未开播 1已开播 2已下播")
@Excel(name = "直播状态", readConverterExp="0=未开播,1=已开播,2=已下播",sort = 4)
private Long liveStatus;
/** 删除标识默认0 */
@ -71,19 +66,33 @@ public class SysLiveSchedul extends BaseEntity
private Long wxAccountId;
//直播间名称
@Excel(name = "直播间", sort = 2)
private String liveRoomName;
@Excel(name = "直播营养师", sort = 5)
private String liveNutritionistName;
private String livePlannerName;
private String liveOperatorName;
@Excel(name = "所属账号",sort = 6)
private String fanChannelName;
//导粉情况
private List<Map<String,Object>> wxAccountList;
//导粉数量
@Excel(name = "导粉数量",sort = 7,isStatistics = true,cellType = Excel.ColumnType.NUMERIC)
private Integer importFanSize;
//进粉情况
private List<Map<String,Object>> addFanList;
//进粉数量
@Excel(name = "进粉数量",sort = 8, isStatistics=true,cellType = Excel.ColumnType.NUMERIC)
private Integer addFanSize;
@Excel(name = "直播时长",sort = 9, isStatistics=true,cellType = Excel.ColumnType.NUMERIC)
private BigDecimal liveTotalHour;
}

View File

@ -96,4 +96,25 @@ public interface SysLiveSchedulMapper
* @return
*/
public SysLiveSchedul getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul);
/**
* 查询导粉总量
* @param sysLiveSchedul
* @return
*/
int getTotalImportFanNumByLiveSchedul(SysLiveSchedul sysLiveSchedul);
/**
* 查询总进粉量
* @param sysLiveSchedul
* @return
*/
int getTotalAddFanNumByLiveSchedul(SysLiveSchedul sysLiveSchedul);
/**
* 查询总直播时长
* @param sysLiveSchedul
* @return
*/
int getLiveTotalTimeByLiveSchedul(SysLiveSchedul sysLiveSchedul);
}

View File

@ -113,4 +113,25 @@ public interface ISysLiveSchedulService
* @return
*/
int delLiveSchedulFanRecord(Long id);
/**
* 查询导粉总量
* @param sysLiveSchedul
* @return
*/
int getTotalImportFanNumByLiveSchedul(SysLiveSchedul sysLiveSchedul);
/**
* 查询总进粉量
* @param sysLiveSchedul
* @return
*/
int getTotalAddFanNumByLiveSchedul(SysLiveSchedul sysLiveSchedul);
/**
* 查询总直播时长
* @param sysLiveSchedul
* @return
*/
int getLiveTotalTimeByLiveSchedul(SysLiveSchedul sysLiveSchedul);
}

View File

@ -216,4 +216,31 @@ public class SysLiveSchedulServiceImpl implements ISysLiveSchedulService
public int delLiveSchedulFanRecord(Long id){
return sysLiveSchedulFanRecordMapper.deleteSysLiveSchedulFanRecordById(id);
}
/**
* 查询导粉总量
* @param sysLiveSchedul
* @return
*/
public int getTotalImportFanNumByLiveSchedul(SysLiveSchedul sysLiveSchedul){
return sysLiveSchedulMapper.getTotalImportFanNumByLiveSchedul(sysLiveSchedul);
}
/**
* 查询总进粉量
* @param sysLiveSchedul
* @return
*/
public int getTotalAddFanNumByLiveSchedul(SysLiveSchedul sysLiveSchedul){
return sysLiveSchedulMapper.getTotalAddFanNumByLiveSchedul(sysLiveSchedul);
}
/**
* 查询总直播时长
* @param sysLiveSchedul
* @return
*/
public int getLiveTotalTimeByLiveSchedul(SysLiveSchedul sysLiveSchedul){
return sysLiveSchedulMapper.getLiveTotalTimeByLiveSchedul(sysLiveSchedul);
}
}

View File

@ -67,8 +67,11 @@
left join sys_user su_plan on su_plan.user_id = slc.live_planner_id and su_plan.del_flag = 0
left join sys_user su_operator on su_operator.user_id = slc.live_operator_id and su_operator.del_flag = 0
where slc.del_flag = 0
<if test="liveSchedulDate != null">
and date_format(slc.live_schedul_date,'%y%m%d') = date_format(#{liveSchedulDate},'%y%m%d')
<if test="liveStartTime != null and liveEndTime != null">
and (
date_format(slc.live_schedul_date,'%y%m%d') >= date_format(#{liveStartTime},'%y%m%d')
and date_format(#{liveEndTime},'%y%m%d') >= date_format(slc.live_schedul_date,'%y%m%d')
)
</if>
<if test="liveRoom != null">
and slc.live_room = #{liveRoom}
@ -76,9 +79,10 @@
<if test="fanChannel != null">
and slc.fan_channel = #{fanChannel}
</if>
<!--<if test="wxAccountId != null">
and slc.fan_channel = (SELECT swd.account_id FROM sys_wx_distribution AS swd where swd.wechat_account = #{wxAccountId} and swd.del_flag = 0 limit 1)
</if>-->
<if test="liveNutritionistId != null">
and slc.live_nutritionist_id = #{liveNutritionistId}
</if>
order by slc.live_schedul_date desc,slc.live_start_time desc ,slc.live_room asc
</select>
@ -175,6 +179,31 @@
group by w.wx_account,su.nick_name
</select>
<!-- 查询直播列表中导粉总数量 -->
<select id="getTotalImportFanNumByLiveSchedul" parameterType="SysLiveSchedul" resultType="int">
SELECT ifnull(sum(wa.import_fan_num),0) as fanNum from sys_import_fan_record as fc
left join sys_import_fan_wx_account as wa on wa.import_fan_record_id = fc.id and wa.del_flag = 0
where fc.del_flag = 0 and fc.import_fan_live in (
select slc.id from sys_live_schedul slc
where slc.del_flag = 0
<if test="liveStartTime != null and liveEndTime != null">
and (
date_format(slc.live_schedul_date,'%y%m%d') >= date_format(#{liveStartTime},'%y%m%d')
and date_format(#{liveEndTime},'%y%m%d') >= date_format(slc.live_schedul_date,'%y%m%d')
)
</if>
<if test="liveRoom != null">
and slc.live_room = #{liveRoom}
</if>
<if test="fanChannel != null">
and slc.fan_channel = #{fanChannel}
</if>
<if test="liveNutritionistId != null">
and slc.live_nutritionist_id = #{liveNutritionistId}
</if>
)
</select>
<!-- 查询直播时间范围是否重叠 -->
<select id="getLiveSchedulByLiveTime" parameterType="SysLiveSchedul" resultMap="SysLiveSchedulResultSigle">
select
@ -234,4 +263,52 @@
where fr.del_flag = 0 and fr.live_schedul_id = #{id} order by fr.create_time desc
</select>
<!-- 查询总进粉量 -->
<select id="getTotalAddFanNumByLiveSchedul" parameterType="SysLiveSchedul" resultType="int">
select
count(fr.id)
from sys_live_schedul_fan_record as fr
where fr.del_flag = 0 and fr.live_schedul_id in
(
select slc.id from sys_live_schedul slc
where slc.del_flag = 0
<if test="liveStartTime != null and liveEndTime != null">
and (
date_format(slc.live_schedul_date,'%y%m%d') >= date_format(#{liveStartTime},'%y%m%d')
and date_format(#{liveEndTime},'%y%m%d') >= date_format(slc.live_schedul_date,'%y%m%d')
)
</if>
<if test="liveRoom != null">
and slc.live_room = #{liveRoom}
</if>
<if test="fanChannel != null">
and slc.fan_channel = #{fanChannel}
</if>
<if test="liveNutritionistId != null">
and slc.live_nutritionist_id = #{liveNutritionistId}
</if>
)
</select>
<!-- 查询总直播时长(分钟) -->
<select id="getLiveTotalTimeByLiveSchedul" parameterType="SysLiveSchedul" resultType="int">
select ifnull(sum(TIMESTAMPDIFF(minute,slc.live_start_time,slc.live_end_time)),0) from sys_live_schedul as slc
where slc.del_flag = 0 and slc.live_start_time is not null and slc.live_end_time is not null
<if test="liveStartTime != null and liveEndTime != null">
and (
date_format(slc.live_schedul_date,'%y%m%d') >= date_format(#{liveStartTime},'%y%m%d')
and date_format(#{liveEndTime},'%y%m%d') >= date_format(slc.live_schedul_date,'%y%m%d')
)
</if>
<if test="liveRoom != null">
and slc.live_room = #{liveRoom}
</if>
<if test="fanChannel != null">
and slc.fan_channel = #{fanChannel}
</if>
<if test="liveNutritionistId != null">
and slc.live_nutritionist_id = #{liveNutritionistId}
</if>
</select>
</mapper>