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