月抽奖
抽奖记录 增加 图片
This commit is contained in:
@@ -187,11 +187,11 @@ public class DiscSpinningController {
|
|||||||
}
|
}
|
||||||
amount = orders.getPayMoney().doubleValue();
|
amount = orders.getPayMoney().doubleValue();
|
||||||
sourceId = orders.getOrdersId();
|
sourceId = orders.getOrdersId();
|
||||||
} else {
|
} else {
|
||||||
String redisKey = "";
|
String redisKey = "";
|
||||||
if (source.equals(2)){
|
if (source.equals(2)) {
|
||||||
redisKey = RedisKeys.getDateKey("spinning:amount:taskW") + userId;
|
redisKey = RedisKeys.getDateKey("spinning:amount:taskW") + userId;
|
||||||
}else if(source.equals(3)){
|
} else if (source.equals(3)) {
|
||||||
redisKey = RedisKeys.getDateKey("spinning:amount:taskM") + userId;
|
redisKey = RedisKeys.getDateKey("spinning:amount:taskM") + userId;
|
||||||
}
|
}
|
||||||
Map<String, Object> week = redisUtils.get(redisKey, Map.class);
|
Map<String, Object> week = redisUtils.get(redisKey, Map.class);
|
||||||
@@ -206,7 +206,7 @@ public class DiscSpinningController {
|
|||||||
TaskCenterRecord centerRecord = new TaskCenterRecord();
|
TaskCenterRecord centerRecord = new TaskCenterRecord();
|
||||||
centerRecord.setUserId(userId);
|
centerRecord.setUserId(userId);
|
||||||
centerRecord.setTaskId(Long.valueOf(entry.getKey()));
|
centerRecord.setTaskId(Long.valueOf(entry.getKey()));
|
||||||
if(source.equals(2)){
|
if (source.equals(2)) {
|
||||||
sourceId = Long.valueOf(entry.getKey());
|
sourceId = Long.valueOf(entry.getKey());
|
||||||
centerRecord.setSourceId(Long.getLong(entry.getKey()));
|
centerRecord.setSourceId(Long.getLong(entry.getKey()));
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ public class DiscSpinningController {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redisUtils.set(redisKey,week,DateUtils.todayAfterSecond());
|
redisUtils.set(redisKey, week, DateUtils.todayAfterSecond());
|
||||||
}
|
}
|
||||||
return new Result().put("data",
|
return new Result().put("data",
|
||||||
discSpinningService.draws(i == null ? 1 : i + 1, amount, sourceId, userId, source));
|
discSpinningService.draws(i == null ? 1 : i + 1, amount, sourceId, userId, source));
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class DiscSpinningRecord extends Model<DiscSpinningRecord> {
|
|||||||
private Long sourceId;
|
private Long sourceId;
|
||||||
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
private String imgUrl;
|
||||||
//描述
|
//描述
|
||||||
private String name;
|
private String name;
|
||||||
//类型 1谢谢惠顾 2 红包 9 其它
|
//类型 1谢谢惠顾 2 红包 9 其它
|
||||||
@@ -46,11 +47,12 @@ public class DiscSpinningRecord extends Model<DiscSpinningRecord> {
|
|||||||
public DiscSpinningRecord() {
|
public DiscSpinningRecord() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscSpinningRecord(String name, Long sourceId, Long userId, Integer type, BigDecimal number,
|
public DiscSpinningRecord(String name, Long sourceId, Long userId,String imgUrl, Integer type, BigDecimal number,
|
||||||
String drawDay, String createTime, Integer source) {
|
String drawDay, String createTime, Integer source) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.sourceId = sourceId;
|
this.sourceId = sourceId;
|
||||||
|
this.imgUrl = imgUrl;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.number = number;
|
this.number = number;
|
||||||
this.drawDay = drawDay;
|
this.drawDay = drawDay;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class DiscSpinningRecordServiceImpl extends ServiceImpl<DiscSpinningRecor
|
|||||||
public Integer countSourceRecord(Long sourceId) {
|
public Integer countSourceRecord(Long sourceId) {
|
||||||
QueryWrapper<DiscSpinningRecord> recordQuery = new QueryWrapper<>();
|
QueryWrapper<DiscSpinningRecord> recordQuery = new QueryWrapper<>();
|
||||||
recordQuery.eq("source_id", sourceId);
|
recordQuery.eq("source_id", sourceId);
|
||||||
|
recordQuery.eq("source", "taskM");
|
||||||
recordQuery.gt("create_time", DateUtil.beginOfMonth(new Date()));
|
recordQuery.gt("create_time", DateUtil.beginOfMonth(new Date()));
|
||||||
return discSpinningRecordDao.selectCount(recordQuery);
|
return discSpinningRecordDao.selectCount(recordQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,12 +216,13 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||||||
} else {
|
} else {
|
||||||
if (source != 1) {
|
if (source != 1) {
|
||||||
result = prize;
|
result = prize;
|
||||||
|
result.setNumber(BigDecimal.ONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscSpinningRecord record = new DiscSpinningRecord(result.getName(), sourceId, userId, result.getType(),
|
DiscSpinningRecord record = new DiscSpinningRecord(result.getName(), sourceId, userId,result.getUrl(), result.getType(),
|
||||||
result.getNumber(), DateUtils.formatYMD(new Date()), DateUtils.format(new Date()), source);
|
result.getNumber(), DateUtils.formatYMD(new Date()), DateUtils.format(new Date()), source);
|
||||||
recordService.save(record);
|
recordService.save(record);
|
||||||
return record;
|
return record;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class TaskCenterRewardServiceImpl extends ServiceImpl<TaskCenterRewardDao
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, Integer> getRewardMap(Long taskId) {
|
public Map<Integer, Integer> getRewardMap(Long taskId) {
|
||||||
List<TaskCenterReward> rewards = baseMapper.getRewardMap(taskId);
|
List<TaskCenterReward> rewards = baseMapper.getRewardMap(taskId);
|
||||||
|
|
||||||
Map<Integer, Integer> map = rewards.stream()
|
Map<Integer, Integer> map = rewards.stream()
|
||||||
|
|||||||
@@ -97,11 +97,11 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
if (CollectionUtil.isNotEmpty(taskWCount)) {
|
if (CollectionUtil.isNotEmpty(taskWCount)) {
|
||||||
for (Integer value : taskWCount.values()) {
|
for (Integer value : taskWCount.values()) {
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
isBreak=true;
|
isBreak = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isBreak){
|
if (isBreak) {
|
||||||
s.setDiscNumber(null);
|
s.setDiscNumber(null);
|
||||||
s.setNumber(null);
|
s.setNumber(null);
|
||||||
break;
|
break;
|
||||||
@@ -129,7 +129,7 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
} else {
|
} else {
|
||||||
if (rewardMap.containsKey(9)) {
|
if (rewardMap.containsKey(9)) {
|
||||||
Integer spinningCount = discSpinningRecordService.countSourceRecord(s.getId());
|
Integer spinningCount = discSpinningRecordService.countSourceRecord(s.getId());
|
||||||
if (spinningCount == null || spinningCount > 0) {
|
if (spinningCount == null || rewardMap.get(9) - spinningCount > 0) {
|
||||||
s.setDiscNumber(null);
|
s.setDiscNumber(null);
|
||||||
s.setNumber(null);
|
s.setNumber(null);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user