寻爱-记录-增加分区id
This commit is contained in:
@@ -31,4 +31,6 @@ public class DrawLotteryRecordDto {
|
||||
private Long erbanNo;
|
||||
|
||||
private Integer dataType;
|
||||
|
||||
private Integer partitionId;
|
||||
}
|
||||
|
@@ -8,5 +8,5 @@ import java.util.Date;
|
||||
public interface DrawLotteryRecordDayAdminMapper {
|
||||
DrawLotteryRecordStatisVo getDrawStaticList(@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("keyPrice") Integer keyPrice, @Param("poolType") Byte poolType,
|
||||
@Param("uid") Long uid, @Param("dataType") Integer dataType);
|
||||
@Param("uid") Long uid, @Param("dataType") Integer dataType, Integer partitionId);
|
||||
}
|
||||
|
@@ -8,5 +8,6 @@ import java.util.Date;
|
||||
public interface DrawLotteryRecordMapperExpand {
|
||||
DrawLotteryRecordStatisVo getDrawStaticList(@Param("startTime") Date startTime, @Param("endTime") Date endTime,
|
||||
@Param("keyPrice") Integer keyPrice, @Param("poolType") Byte poolType,
|
||||
@Param("uid") Long uid, @Param("dataType") Integer dataType);
|
||||
@Param("uid") Long uid, @Param("dataType") Integer dataType,
|
||||
@Param("partitionId") Integer partitionId);
|
||||
}
|
||||
|
@@ -76,10 +76,10 @@ public class DrawLotteryRecordAdminService extends BaseService {
|
||||
if (dto.getStartDate() != null && dto.getEndDate() != null) {
|
||||
if (oldQuery) {
|
||||
drawLotteryRecordStatisVo = drawLotteryRecordMapperExpand
|
||||
.getDrawStaticList(dto.getStartDate(), dto.getEndDate(), keyPrice, dto.getPoolType(), uid, dto.getDataType());
|
||||
.getDrawStaticList(dto.getStartDate(), dto.getEndDate(), keyPrice, dto.getPoolType(), uid, dto.getDataType(), dto.getPartitionId());
|
||||
} else {
|
||||
List<DrawLotteryRecordStatisVo> voList = drawLotteryRecordDayAdminService
|
||||
.getDrawStaticList(dto.getStartDate(), dto.getEndDate(), keyPrice, dto.getPoolType(), uid, dto.getDataType());
|
||||
.getDrawStaticList(dto.getStartDate(), dto.getEndDate(), keyPrice, dto.getPoolType(), uid, dto.getDataType(), dto.getPartitionId());
|
||||
drawLotteryRecordStatisVo = addVoData(initialDrawLotteryRecordVo(voList.get(0), null),
|
||||
initialDrawLotteryRecordVo(voList.get(1), null));
|
||||
}
|
||||
|
@@ -20,15 +20,15 @@ public class DrawLotteryRecordDayAdminService extends BaseService {
|
||||
@Autowired
|
||||
private DrawLotteryRecordDayAdminMapper drawLotteryRecordDayAdminMapper;
|
||||
|
||||
public List<DrawLotteryRecordStatisVo> getDrawStaticList(Date startTime, Date endTime, Integer keyPrice, Byte poolType, Long uid, Integer dataType) {
|
||||
public List<DrawLotteryRecordStatisVo> getDrawStaticList(Date startTime, Date endTime, Integer keyPrice, Byte poolType, Long uid, Integer dataType, Integer partitionId) {
|
||||
Date todayStart = DateTimeUtil.getBeginTimeOfDay(new Date());
|
||||
// 结束时间早于今天,全部从每天数据里面查询
|
||||
if (endTime.compareTo(todayStart) <= 0) {
|
||||
return Arrays.asList(drawLotteryRecordDayAdminMapper.getDrawStaticList(startTime, endTime, keyPrice, poolType, uid, dataType), new DrawLotteryRecordStatisVo());
|
||||
return Arrays.asList(drawLotteryRecordDayAdminMapper.getDrawStaticList(startTime, endTime, keyPrice, poolType, uid, dataType, partitionId), new DrawLotteryRecordStatisVo());
|
||||
}
|
||||
// 历史的加上今天的实时数据
|
||||
DrawLotteryRecordStatisVo vo = drawLotteryRecordDayAdminMapper.getDrawStaticList(startTime, todayStart, keyPrice, poolType, uid, dataType);
|
||||
DrawLotteryRecordStatisVo vo2 = drawLotteryRecordMapperExpand.getDrawStaticList(todayStart, endTime, keyPrice, poolType, uid, dataType);
|
||||
DrawLotteryRecordStatisVo vo = drawLotteryRecordDayAdminMapper.getDrawStaticList(startTime, todayStart, keyPrice, poolType, uid, dataType, partitionId);
|
||||
DrawLotteryRecordStatisVo vo2 = drawLotteryRecordMapperExpand.getDrawStaticList(todayStart, endTime, keyPrice, poolType, uid, dataType, partitionId);
|
||||
return Arrays.asList(vo, vo2);
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,9 @@
|
||||
<if test="endTime != null">
|
||||
and `date` <= #{endTime}
|
||||
</if>
|
||||
<if test="partitionId != null">
|
||||
and partition_id = #{partitionId}
|
||||
</if>
|
||||
<if test="poolType != null">
|
||||
and prize_pool_type = #{poolType}
|
||||
</if>
|
||||
|
@@ -30,6 +30,9 @@
|
||||
<if test="endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="partitionId != null">
|
||||
and partition_id = #{partitionId}
|
||||
</if>
|
||||
<if test="poolType != null">
|
||||
and prize_pool_type = #{poolType}
|
||||
</if>
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package com.accompany.business.model;
|
||||
|
||||
import com.accompany.common.annotation.ReplaceAppDomain;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class DrawLotteryRecord {
|
||||
private Long id;
|
||||
|
||||
@@ -36,123 +38,6 @@ public class DrawLotteryRecord {
|
||||
|
||||
private Integer keyPrice;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
private Integer partitionId;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(Long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId == null ? null : deviceId.trim();
|
||||
}
|
||||
|
||||
public Integer getPrizeId() {
|
||||
return prizeId;
|
||||
}
|
||||
|
||||
public void setPrizeId(Integer prizeId) {
|
||||
this.prizeId = prizeId;
|
||||
}
|
||||
|
||||
public Byte getPrizeType() {
|
||||
return prizeType;
|
||||
}
|
||||
|
||||
public void setPrizeType(Byte prizeType) {
|
||||
this.prizeType = prizeType;
|
||||
}
|
||||
|
||||
public String getPrizeName() {
|
||||
return prizeName;
|
||||
}
|
||||
|
||||
public void setPrizeName(String prizeName) {
|
||||
this.prizeName = prizeName == null ? null : prizeName.trim();
|
||||
}
|
||||
|
||||
public String getPrizeImgUrl() {
|
||||
return prizeImgUrl;
|
||||
}
|
||||
|
||||
public void setPrizeImgUrl(String prizeImgUrl) {
|
||||
this.prizeImgUrl = prizeImgUrl == null ? null : prizeImgUrl.trim();
|
||||
}
|
||||
|
||||
public Integer getReferenceId() {
|
||||
return referenceId;
|
||||
}
|
||||
|
||||
public void setReferenceId(Integer referenceId) {
|
||||
this.referenceId = referenceId;
|
||||
}
|
||||
|
||||
public Integer getPlatformValue() {
|
||||
return platformValue;
|
||||
}
|
||||
|
||||
public void setPlatformValue(Integer platformValue) {
|
||||
this.platformValue = platformValue;
|
||||
}
|
||||
|
||||
public Integer getActualValue() {
|
||||
return actualValue;
|
||||
}
|
||||
|
||||
public void setActualValue(Integer actualValue) {
|
||||
this.actualValue = actualValue;
|
||||
}
|
||||
|
||||
public Byte getPrizeLevel() {
|
||||
return prizeLevel;
|
||||
}
|
||||
|
||||
public void setPrizeLevel(Byte prizeLevel) {
|
||||
this.prizeLevel = prizeLevel;
|
||||
}
|
||||
|
||||
public Byte getPrizePoolType() {
|
||||
return prizePoolType;
|
||||
}
|
||||
|
||||
public void setPrizePoolType(Byte prizePoolType) {
|
||||
this.prizePoolType = prizePoolType;
|
||||
}
|
||||
|
||||
public Integer getPrizeKeyRecordId() {
|
||||
return prizeKeyRecordId;
|
||||
}
|
||||
|
||||
public void setPrizeKeyRecordId(Integer prizeKeyRecordId) {
|
||||
this.prizeKeyRecordId = prizeKeyRecordId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getKeyPrice() {
|
||||
return keyPrice;
|
||||
}
|
||||
|
||||
public void setKeyPrice(Integer keyPrice) {
|
||||
this.keyPrice = keyPrice;
|
||||
}
|
||||
}
|
@@ -32,4 +32,6 @@ public class DrawLotteryRecordDay {
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Integer partitionId;
|
||||
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ public class DrawLotteryRecordDayService extends ServiceImpl<DrawLotteryRecordDa
|
||||
record.setRecordNum(it.getPrizeKeyRecordId());
|
||||
record.setCreateTime(new Date());
|
||||
record.setDate(date);
|
||||
record.setPartitionId(it.getPartitionId());
|
||||
drawLotteryRecordDayList.add(record);
|
||||
});
|
||||
saveBatch(drawLotteryRecordDayList);
|
||||
|
@@ -20,6 +20,7 @@ import com.accompany.business.service.box.filter.PrizePoolKeyNumResponse;
|
||||
import com.accompany.business.service.mq.RocketMQService;
|
||||
import com.accompany.business.service.purse.UserPurseService;
|
||||
import com.accompany.business.service.record.BillRecordService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.vo.PrizeWithRateVo;
|
||||
import com.accompany.business.vo.openbox.DrawPrizeItemVo;
|
||||
import com.accompany.business.vo.openbox.OpenBoxResult;
|
||||
@@ -31,6 +32,7 @@ import com.accompany.common.utils.BlankUtil;
|
||||
import com.accompany.common.utils.UUIDUtil;
|
||||
import com.accompany.core.enumeration.BillObjTypeEnum;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.SysConfService;
|
||||
import com.accompany.core.service.base.BaseService;
|
||||
import com.accompany.core.service.common.JedisLockService;
|
||||
@@ -97,6 +99,9 @@ public abstract class OpenBoxService extends BaseService implements Initializing
|
||||
@Autowired
|
||||
protected NormalBigPrizeService normalBigPrizeService;
|
||||
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
|
||||
private List<PrizePoolKeyNumFilter> filters;
|
||||
|
||||
/**
|
||||
@@ -464,6 +469,8 @@ public abstract class OpenBoxService extends BaseService implements Initializing
|
||||
if (StringUtils.isEmpty(deviceId)){
|
||||
throw new ServiceException(BusiStatus.DEVICE_ID_NOT_EXISTS);
|
||||
}
|
||||
Users u = usersService.getNotNullUsersByUid(uid);
|
||||
|
||||
String lockVal = jedisLockService.lock(RedisKey.open_box_lock_draw.getKey(uid.toString()), 10 * 1000);
|
||||
if (BlankUtil.isBlank(lockVal)) {
|
||||
logger.error("转盘,获取分布式锁失败,uid:{},keyNum:{}", uid, keyNum);
|
||||
@@ -575,7 +582,8 @@ public abstract class OpenBoxService extends BaseService implements Initializing
|
||||
logger.error("奖池存在奖品id,然而奖品表找到该奖品,prize id:{},prizePoolItemId:{}", prizeId, prizePoolItemId);
|
||||
throw new ServiceException(BusiStatus.OPEN_BOX_BAD_POOL_CONFIG);
|
||||
}
|
||||
DrawLotteryRecord drawLotteryRecord = buildDrawLotteryRecord(prize, prizePoolItem, userDeviation, deviateRangeMap, uid, deviceId, openBoxTime, keyPrice);
|
||||
DrawLotteryRecord drawLotteryRecord = buildDrawLotteryRecord(prize, prizePoolItem, userDeviation, deviateRangeMap,
|
||||
uid, u.getPartitionId(), deviceId, openBoxTime, keyPrice);
|
||||
//相同奖品,抽中多个,要插入多条记录
|
||||
int prizeNum = drawPrizeItemIdNumMap.get(prizePoolItemId);
|
||||
for (int i = 0; i < prizeNum; i++) {
|
||||
@@ -657,7 +665,7 @@ public abstract class OpenBoxService extends BaseService implements Initializing
|
||||
* 构建促销活动记录record DrawLotteryRecord
|
||||
*/
|
||||
private DrawLotteryRecord buildDrawLotteryRecord(Prize prize, PrizePoolItem prizePoolItem, int userDeviation,
|
||||
Map<Integer, DeviateRange> deviateRangeMap, Long uid, String deviceId, Date date, Integer keyPrice) {
|
||||
Map<Integer, DeviateRange> deviateRangeMap, Long uid, Integer partitionId, String deviceId, Date date, Integer keyPrice) {
|
||||
DrawLotteryRecord drawLotteryRecord = new DrawLotteryRecord();
|
||||
drawLotteryRecord.setActualValue(prize.getActualValue());
|
||||
drawLotteryRecord.setCreateTime(date);
|
||||
@@ -672,6 +680,7 @@ public abstract class OpenBoxService extends BaseService implements Initializing
|
||||
drawLotteryRecord.setUid(uid);
|
||||
drawLotteryRecord.setReferenceId(prize.getReferenceId());
|
||||
drawLotteryRecord.setKeyPrice(keyPrice);
|
||||
drawLotteryRecord.setPartitionId(partitionId);
|
||||
return drawLotteryRecord;
|
||||
}
|
||||
|
||||
|
@@ -363,9 +363,15 @@
|
||||
key_price = #{keyPrice,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="dailyGroupStats" resultMap="BaseResultMap">
|
||||
SELECT uid,prize_type,prize_pool_type,key_price,count(1) prize_key_record_id, sum(key_price) reference_id, sum(platform_value) platform_value, sum(actual_value) actual_value FROM draw_lottery_record
|
||||
SELECT uid,prize_type,prize_pool_type,key_price,partition_id
|
||||
,count(1) prize_key_record_id,
|
||||
sum(key_price) reference_id,
|
||||
sum(platform_value) platform_value,
|
||||
sum(actual_value) actual_value
|
||||
FROM draw_lottery_record
|
||||
WHERE create_time BETWEEN #{startTime} AND #{endTime}
|
||||
GROUP BY uid,prize_type,prize_pool_type,key_price
|
||||
GROUP BY uid,prize_type,prize_pool_type,key_price,partition_id
|
||||
</select>
|
||||
</mapper>
|
@@ -23,7 +23,7 @@ public class DrawLotteryRecordDayTask extends BaseTask {
|
||||
/**
|
||||
* 每天0点统计昨天的许愿数据到数据库
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
@Scheduled(cron = "10 0 0 * * ?")
|
||||
public void addDataByDay() throws ParseException {
|
||||
logger.info("DrawLotteryRecordDayService start ===============");
|
||||
Date date = DateTimeUtil.addDays(new Date(), -1);
|
||||
|
Reference in New Issue
Block a user