新增工会统计流水字段
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.accompany.admin.model.stats;
|
||||
|
||||
import com.accompany.common.annotation.FieldComment;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -52,4 +53,7 @@ public class HallLaborStats {
|
||||
@ApiModelProperty("新用户送礼人数")
|
||||
public Integer newUserSendGift;
|
||||
|
||||
@ApiModelProperty("新用户送礼流水")
|
||||
private Integer newUserSendGiftAmount;
|
||||
|
||||
}
|
||||
|
@@ -37,6 +37,9 @@ public class LaborStatsVo extends BaseVo {
|
||||
// 新用户(当日注册)送礼人数
|
||||
@FieldComment("新用户送礼人数")
|
||||
public Integer newUserSendGift;
|
||||
// 新用户送礼流水
|
||||
@FieldComment("新用户送礼流水")
|
||||
private Integer newUserSendGiftAmount;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -45,5 +45,7 @@ public interface LaborStatsMapper {
|
||||
List<LaborStatsDto> getCountNewUserInRoom(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("roomUidList") List<Long> roomUidList);
|
||||
|
||||
List<LaborStatsDto> getCountNewUserSendGift(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("roomUidList") List<Long> roomUidList);
|
||||
|
||||
List<LaborStatsDto> getNewUserSendGiftAmount(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("roomUidList") List<Long> roomUidList);
|
||||
}
|
||||
|
||||
|
@@ -162,6 +162,11 @@ public class LaborStatsAdminService extends BaseService {
|
||||
if (newUserSendGiftRecords == null) {
|
||||
newUserSendGiftRecords = Collections.emptyList();
|
||||
}
|
||||
//新用户送礼流水
|
||||
List<LaborStatsDto> newUserSendGiftAmountRecords = laborStatsMapper.getNewUserSendGiftAmount(beginTimeOfDay, endTimeOfDay, roomUidList);
|
||||
if (newUserSendGiftAmountRecords == null) {
|
||||
newUserSendGiftAmountRecords = Collections.emptyList();
|
||||
}
|
||||
Map<String, List<LaborStatsDto>> firstInRoomUserMap = firstInRoomRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
Map<String, List<LaborStatsDto>> totalInRoomUserMap = totalInRoomRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
Map<String, List<LaborStatsDto>> firstInRoomGiftUserMap = firstInRoomGiftUserRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
@@ -171,6 +176,7 @@ public class LaborStatsAdminService extends BaseService {
|
||||
Map<String, List<LaborStatsDto>> roomBackpackRevenueMap = roomBackpackRevenueRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
Map<String, List<LaborStatsDto>> newUserInRoomMap = newUserInRoomRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
Map<String, List<LaborStatsDto>> newUserSendGiftMap = newUserSendGiftRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
Map<String, List<LaborStatsDto>> newUserSendGiftAmountMap = newUserSendGiftAmountRecords.stream().collect(Collectors.groupingBy(LaborStatsDto::getDate));
|
||||
while (DateTimeUtil.compareTime(endTime, dateTime) >= 0) {
|
||||
for (String erBanNo : erBanNoArray) {
|
||||
String dateStr = DateTimeUtil.convertDate(dateTime, DateTimeUtil.DEFAULT_DATE_PATTERN);
|
||||
@@ -280,6 +286,16 @@ public class LaborStatsAdminService extends BaseService {
|
||||
}
|
||||
}
|
||||
stats.setNewUserSendGift(newUserSendGift);
|
||||
//新用户送礼流水
|
||||
int newUserSendGiftAmount = 0;
|
||||
List<LaborStatsDto> newUserSendGiftAmounts = newUserSendGiftAmountMap.get(dateStr);
|
||||
if (newUserSendGiftAmounts != null) {
|
||||
Optional<LaborStatsDto> any = newUserSendGiftAmounts.stream().filter(v -> v.getRoomUid().equals(roomUid)).findAny();
|
||||
if (any.isPresent()) {
|
||||
newUserSendGiftAmount = any.get().getStatsCount();
|
||||
}
|
||||
}
|
||||
stats.setNewUserSendGiftAmount(newUserSendGiftAmount);
|
||||
data.add(stats);
|
||||
}
|
||||
dateTime = DateTimeUtil.addDays(dateTime, 1);
|
||||
|
@@ -111,6 +111,7 @@ public class HallLaborStatsServiceImpl extends ServiceImpl<HallLaborStatsMapper,
|
||||
.set(HallLaborStats::getFirstInRoomGiftRate, stats.getFirstInRoomGiftRate())
|
||||
.set(HallLaborStats::getNewUserInRoom, stats.getNewUserInRoom())
|
||||
.set(HallLaborStats::getNewUserSendGift, stats.getNewUserSendGift())
|
||||
.set(HallLaborStats::getNewUserSendGiftAmount, stats.getNewUserSendGiftAmount())
|
||||
.eq(HallLaborStats::getDate, stats.getDate())
|
||||
.eq(HallLaborStats::getErbanNo, stats.getErbanNo()));
|
||||
}
|
||||
|
@@ -213,4 +213,22 @@
|
||||
</if>
|
||||
group by gsr.room_uid, date
|
||||
</select>
|
||||
|
||||
<select id="getNewUserSendGiftAmount" resultType="com.accompany.admin.dto.stats.LaborStatsDto">
|
||||
select
|
||||
date_format(gsr.create_time, '%Y-%m-%d') as date,
|
||||
gsr.room_uid as roomUid,
|
||||
ifnull(sum(gsr.total_gold_num), 0) as statsCount
|
||||
from gift_send_record as gsr
|
||||
left join users as u on u.uid = gsr.uid
|
||||
where u.create_time between #{startTime} and #{endTime}
|
||||
and gsr.create_time between #{startTime} and #{endTime}
|
||||
<if test="roomUidList != null and roomUidList.size > 0">
|
||||
and gsr.room_uid in
|
||||
<foreach item="item" index="index" collection="roomUidList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
group by gsr.room_uid, date
|
||||
</select>
|
||||
</mapper>
|
@@ -114,7 +114,7 @@ public class StatsAdminController extends BaseController {
|
||||
String filename = "laborExport";
|
||||
List<String> fields = Arrays.asList("date", "erbanNo", "roomTitle", "firstInRoom", "firstInRoomRetained",
|
||||
"totalInRoom", "firstInRoomGiftUser", "giftUser", "roomRevenue", "roomNormalRevenue",
|
||||
"roomBackpackRevenue", "firstInRoomGiftRate", "newUserInRoom", "newUserSendGift");
|
||||
"roomBackpackRevenue", "firstInRoomGiftRate", "newUserInRoom", "newUserSendGift", "newUserSendGiftAmount");
|
||||
ExcelUtils.exportExcel("公会统计", filename, fields, busiResult.getData(), response);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user