Merge branch 'test' into dev
# Conflicts: # src/main/java/com/sqx/modules/taskCenter/controller/TaskCenterRewardController.java
This commit is contained in:
@@ -4,25 +4,35 @@ import com.sqx.common.utils.Result;
|
|||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
import com.sqx.modules.app.service.AdService;
|
import com.sqx.modules.app.service.AdService;
|
||||||
import com.sqx.modules.callback.service.UniAdCallbackRecordService;
|
import com.sqx.modules.callback.service.UniAdCallbackRecordService;
|
||||||
|
import com.sqx.modules.redisService.RedisService;
|
||||||
import com.sqx.modules.sys.controller.AbstractController;
|
import com.sqx.modules.sys.controller.AbstractController;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/ad")
|
@RequestMapping("/app/ad")
|
||||||
public class AdController extends AbstractController {
|
public class AdController extends AbstractController {
|
||||||
|
|
||||||
private final UniAdCallbackRecordService callbackRecordService;
|
private final UniAdCallbackRecordService callbackRecordService;
|
||||||
private final AdService adService;
|
private final AdService adService;
|
||||||
|
private final RedisService redisService;
|
||||||
|
|
||||||
public AdController(UniAdCallbackRecordService callbackRecordService, AdService adService) {
|
public AdController(UniAdCallbackRecordService callbackRecordService, AdService adService, RedisService redisService) {
|
||||||
this.callbackRecordService = callbackRecordService;
|
this.callbackRecordService = callbackRecordService;
|
||||||
this.adService = adService;
|
this.adService = adService;
|
||||||
|
this.redisService = redisService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
@GetMapping("/state")
|
@GetMapping("/state")
|
||||||
public Result getAdState(@RequestParam String extraKey, @RequestAttribute Long userId) {
|
public Result getAdState(@RequestParam String extraKey, @RequestAttribute Long userId) {
|
||||||
return Result.success(callbackRecordService.getStateByExtraKey(userId, extraKey));
|
HashMap<String, Integer> info = callbackRecordService.getStateByExtraKey(userId, extraKey);
|
||||||
|
if (info.get("isEnded") == 0 && !redisService.isCanCash(userId)) {
|
||||||
|
redisService.setCanCashFlag(userId, -1L);
|
||||||
|
info.put("isEnded", 1);
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.sqx.common.utils.DesensitizedUtil;
|
|||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
import com.sqx.modules.app.annotation.LoginUser;
|
import com.sqx.modules.app.annotation.LoginUser;
|
||||||
|
import com.sqx.modules.app.dto.AuthDTO;
|
||||||
import com.sqx.modules.app.dto.AuthRespDTO;
|
import com.sqx.modules.app.dto.AuthRespDTO;
|
||||||
import com.sqx.modules.app.entity.TbUserBlacklist;
|
import com.sqx.modules.app.entity.TbUserBlacklist;
|
||||||
import com.sqx.modules.app.entity.UserEntity;
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
@@ -112,7 +113,7 @@ public class AppController {
|
|||||||
if (StrUtil.isAllBlank(zhiFuBao, certName)) {
|
if (StrUtil.isAllBlank(zhiFuBao, certName)) {
|
||||||
return Result.error("支付宝账号或姓名不能为空");
|
return Result.error("支付宝账号或姓名不能为空");
|
||||||
}
|
}
|
||||||
if(zhiFuBao.contains("*") || certName.contains("*")){
|
if (zhiFuBao.contains("*") || certName.contains("*")) {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
UserEntity userEntity = userService.getById(userId);
|
UserEntity userEntity = userService.getById(userId);
|
||||||
@@ -146,12 +147,21 @@ public class AppController {
|
|||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Login
|
||||||
|
@PostMapping(value = "/realNameAuth/v2")
|
||||||
|
@ApiOperation("实名认证")
|
||||||
|
@ResponseBody
|
||||||
|
@Debounce(interval = 3000, value = "#userId")
|
||||||
|
public Result realNameAuth(@RequestAttribute("userId") Long userId, @RequestBody AuthDTO auth) {
|
||||||
|
return realNameAuth(userId, auth.getCertName(), auth.getCertNum(), auth.getAccountNo(), auth.getMobile());
|
||||||
|
}
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
@RequestMapping(value = "/realNameAuth", method = RequestMethod.POST)
|
@RequestMapping(value = "/realNameAuth", method = RequestMethod.POST)
|
||||||
@ApiOperation("实名认证")
|
@ApiOperation("实名认证")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@Debounce(interval = 3000, value = "#userId")
|
@Debounce(interval = 3000, value = "#userId")
|
||||||
public Result bindAlipay(@RequestAttribute("userId") Long userId,
|
public Result realNameAuth(@RequestAttribute("userId") Long userId,
|
||||||
@RequestParam String certName,
|
@RequestParam String certName,
|
||||||
@RequestParam String certNum,
|
@RequestParam String certNum,
|
||||||
@RequestParam String accountNo,
|
@RequestParam String accountNo,
|
||||||
@@ -160,7 +170,7 @@ public class AppController {
|
|||||||
if (StrUtil.isAllBlank(certName, certNum, accountNo, mobile)) {
|
if (StrUtil.isAllBlank(certName, certNum, accountNo, mobile)) {
|
||||||
return Result.error("真实姓名、身份证号码、银行卡号、银行预留手机号缺一不可");
|
return Result.error("真实姓名、身份证号码、银行卡号、银行预留手机号缺一不可");
|
||||||
}
|
}
|
||||||
if(certNum.contains("*") || accountNo.contains("*") || mobile.contains("*")){
|
if (certNum.contains("*") || accountNo.contains("*") || mobile.contains("*")) {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
int count = userInfoService.count(Wrappers.<UserInfo>lambdaQuery()
|
int count = userInfoService.count(Wrappers.<UserInfo>lambdaQuery()
|
||||||
@@ -268,7 +278,7 @@ public class AppController {
|
|||||||
}
|
}
|
||||||
Map<String, Object> map = BeanUtil.beanToMap(user);
|
Map<String, Object> map = BeanUtil.beanToMap(user);
|
||||||
map.putAll(BeanUtil.beanToMap(userInfo));
|
map.putAll(BeanUtil.beanToMap(userInfo));
|
||||||
map.put("userId",map.get("userId").toString());
|
map.put("userId", map.get("userId").toString());
|
||||||
if (StrUtil.isBlank(user.getZhiFuBaoName()) && StrUtil.isNotBlank(userInfo.getCertName())) {
|
if (StrUtil.isBlank(user.getZhiFuBaoName()) && StrUtil.isNotBlank(userInfo.getCertName())) {
|
||||||
map.put("zhiFuBaoName", userInfo.getCertName());
|
map.put("zhiFuBaoName", userInfo.getCertName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ public class AuthDTO {
|
|||||||
@NotBlank
|
@NotBlank
|
||||||
private String idNum;
|
private String idNum;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String certName;
|
||||||
|
@NotBlank
|
||||||
|
private String certNum;
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String accountNo;
|
private String accountNo;
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ public interface UniAdCallbackRecordService extends IService<UniAdCallbackRecord
|
|||||||
|
|
||||||
Map<String, Object> adCallBack(UniAdCallBackDTO callBackDTO);
|
Map<String, Object> adCallBack(UniAdCallBackDTO callBackDTO);
|
||||||
|
|
||||||
HashMap<String, Object> getStateByExtraKey(Long userId, String extraKey);
|
HashMap<String, Integer> getStateByExtraKey(Long userId, String extraKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,10 +129,10 @@ public class UniAdCallbackRecordServiceImpl extends ServiceImpl<UniAdCallbackRec
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, Object> getStateByExtraKey(Long userId, String extraKey) {
|
public HashMap<String, Integer> getStateByExtraKey(Long userId, String extraKey) {
|
||||||
UniAdCallbackRecord one = getOne(new LambdaQueryWrapper<UniAdCallbackRecord>().eq(UniAdCallbackRecord::getUserId, userId)
|
UniAdCallbackRecord one = getOne(new LambdaQueryWrapper<UniAdCallbackRecord>().eq(UniAdCallbackRecord::getUserId, userId)
|
||||||
.eq(UniAdCallbackRecord::getExtra, extraKey));
|
.eq(UniAdCallbackRecord::getExtra, extraKey));
|
||||||
return new HashMap<String, Object>(){{
|
return new HashMap<String, Integer>(){{
|
||||||
put("isEnded", one == null ? 0 : 1);
|
put("isEnded", one == null ? 0 : 1);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,6 +171,13 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
log.error("未找到该剧集 用户id:{} 剧集:{}", userId, courseId);
|
log.error("未找到该剧集 用户id:{} 剧集:{}", userId, courseId);
|
||||||
return Result.error("未找到该剧集");
|
return Result.error("未找到该剧集");
|
||||||
}
|
}
|
||||||
|
boolean isVip;
|
||||||
|
UserEntity userEntity = userService.selectUserById(userId);
|
||||||
|
if (userEntity.getMember() != null && userEntity.getMember() == 2) {
|
||||||
|
isVip = true;
|
||||||
|
}else{
|
||||||
|
isVip = false;
|
||||||
|
}
|
||||||
//查询用户是否购买了整集
|
//查询用户是否购买了整集
|
||||||
CourseUser courseUser = courseUserDao.selectCourseUser(courseId, userId);
|
CourseUser courseUser = courseUserDao.selectCourseUser(courseId, userId);
|
||||||
// 每天购买超过上限,获得免费时间段资格
|
// 每天购买超过上限,获得免费时间段资格
|
||||||
@@ -215,7 +222,7 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
current.set(s);
|
current.set(s);
|
||||||
}
|
}
|
||||||
// 不免费 3集以后 (已买的不为空 并不在已买的包含)
|
// 不免费 3集以后 (已买的不为空 并不在已买的包含)
|
||||||
if (!freeWatch && s.getSort() > 3 && (CollectionUtil.isEmpty(finalDetailsId) || !finalDetailsId.contains(s.getCourseDetailsId())) && courseUser == null) {
|
if (!freeWatch && s.getSort() > 3 && (CollectionUtil.isEmpty(finalDetailsId) || !finalDetailsId.contains(s.getCourseDetailsId())) && courseUser == null && !isVip) {
|
||||||
s.setVideoUrl(null);
|
s.setVideoUrl(null);
|
||||||
}
|
}
|
||||||
if (s.getSort() > finalStartSort && s.getSort() < finalEndSort) {
|
if (s.getSort() > finalStartSort && s.getSort() < finalEndSort) {
|
||||||
@@ -239,7 +246,7 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
map.put("list", courseDetailsSetVos);
|
map.put("list", courseDetailsSetVos);
|
||||||
return new Result().put("data", map);
|
return new Result().put("data", map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("请求剧集异常打印:",e);
|
log.error("请求剧集异常打印:", e);
|
||||||
return Result.error("请求剧集失败");
|
return Result.error("请求剧集失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.sqx.modules.discSpinning.controller;
|
package com.sqx.modules.discSpinning.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -129,9 +130,14 @@ public class DiscSpinningController {
|
|||||||
@ApiOperation("查询大转盘")
|
@ApiOperation("查询大转盘")
|
||||||
public Result selectDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
public Result selectDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||||
PageHelper.startPage(1, 20);
|
PageHelper.startPage(1, 20);
|
||||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(discSpinningService.list(
|
List<DiscSpinning> list = discSpinningService.list(
|
||||||
new QueryWrapper<DiscSpinning>().eq("disc_type", source).orderByAsc("disc_type", "odds"))), true)
|
new QueryWrapper<DiscSpinning>().eq("disc_type", source).orderByAsc("disc_type", "odds"));
|
||||||
);
|
for (DiscSpinning discSpinning : list) {
|
||||||
|
discSpinning.setOdds(null);
|
||||||
|
discSpinning.setNumber(null);
|
||||||
|
discSpinning.setDiscType(null);
|
||||||
|
}
|
||||||
|
return Result.success().put("data", PageUtils.page(new PageInfo<>(list), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -225,9 +231,16 @@ public class DiscSpinningController {
|
|||||||
}
|
}
|
||||||
redisKey = RedisKeys.getDateKey("spinning:draw:taskW") + userId;
|
redisKey = RedisKeys.getDateKey("spinning:draw:taskW") + userId;
|
||||||
} else if (source.equals(3)) {
|
} else if (source.equals(3)) {
|
||||||
|
Integer spinningCount = recordService.countSourceRecord(null, userId, "taskM");
|
||||||
|
if (spinningCount != null && spinningCount > 0) {
|
||||||
|
return Result.error("月抽奖用户仅可参加一次");
|
||||||
|
}
|
||||||
redisKey = RedisKeys.getDateKey("spinning:draw:taskM") + userId;
|
redisKey = RedisKeys.getDateKey("spinning:draw:taskM") + userId;
|
||||||
}
|
}
|
||||||
Map<String, Object> week = redisUtils.get(redisKey, Map.class);
|
Map<String, Object> week = redisUtils.get(redisKey, Map.class);
|
||||||
|
if (CollectionUtil.isEmpty(week)) {
|
||||||
|
return Result.error("请求失败,请联系管理员");
|
||||||
|
}
|
||||||
for (Map.Entry<String, Object> entry : week.entrySet()) {
|
for (Map.Entry<String, Object> entry : week.entrySet()) {
|
||||||
int value = new BigDecimal(entry.getValue().toString()).intValue();
|
int value = new BigDecimal(entry.getValue().toString()).intValue();
|
||||||
if (value > 1) {
|
if (value > 1) {
|
||||||
@@ -239,10 +252,10 @@ 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(sourceId);
|
centerRecord.setSourceId(sourceId);
|
||||||
}
|
// }
|
||||||
centerRecord.setName(source.equals(2) ? "周任务奖励" : "月任务奖励");
|
centerRecord.setName(source.equals(2) ? "周任务奖励" : "月任务奖励");
|
||||||
centerRecord.setType(9);
|
centerRecord.setType(9);
|
||||||
centerRecord.setNumber(1);
|
centerRecord.setNumber(1);
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||||||
private final WuyouPay wuyouPay;
|
private final WuyouPay wuyouPay;
|
||||||
private final PlatformTransactionManager transactionManager;
|
private final PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DiscSpinningServiceImpl(CommonInfoService commonRepository,
|
public DiscSpinningServiceImpl(CommonInfoService commonRepository,
|
||||||
@@ -116,8 +118,8 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||||||
recordService.save(record);
|
recordService.save(record);
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
Random random = new Random();
|
|
||||||
BigDecimal randomNum = new BigDecimal(random.nextInt(maxNumber.intValue()));
|
BigDecimal randomNum = new BigDecimal(getRandomInt(maxNumber.intValue()));
|
||||||
List<DiscSpinningAmount> amounts = new ArrayList<>();
|
List<DiscSpinningAmount> amounts = new ArrayList<>();
|
||||||
Map<String, List<DiscSpinningAmount>> amountMaps = redisUtils.getMapData(RedisKeys.getDateKey("spinning:amount:") + source, "setDiscSpinningAmounts", DiscSpinningAmount.class);
|
Map<String, List<DiscSpinningAmount>> amountMaps = redisUtils.getMapData(RedisKeys.getDateKey("spinning:amount:") + source, "setDiscSpinningAmounts", DiscSpinningAmount.class);
|
||||||
if (CollectionUtil.isNotEmpty(amountMaps)) {
|
if (CollectionUtil.isNotEmpty(amountMaps)) {
|
||||||
@@ -134,14 +136,12 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||||||
int maxAmount = Integer.parseInt(commonRepository.findOne(900).getValue());
|
int maxAmount = Integer.parseInt(commonRepository.findOne(900).getValue());
|
||||||
double resultAmount = 0;
|
double resultAmount = 0;
|
||||||
if (prize.getType() == 2) {
|
if (prize.getType() == 2) {
|
||||||
double baseRandom = RandomUtil.randomDouble(0.01, 1);
|
double baseRandom = getRandomDouble();
|
||||||
double baseAmount = 0;
|
|
||||||
for (DiscSpinningAmount amount : amounts) {
|
for (DiscSpinningAmount amount : amounts) {
|
||||||
if (baseRandom < amount.getRandom()) {
|
if (baseRandom < amount.getRandom()) {
|
||||||
resultAmount = baseAmount + RandomUtil.randomDouble(0.01, 1) * (amount.getMaxAmount() - baseAmount);
|
resultAmount = getRandomDouble() * amount.getMaxAmount();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
baseAmount = amount.getMaxAmount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultAmount < 0.01) {
|
if (resultAmount < 0.01) {
|
||||||
@@ -153,6 +153,7 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = new DiscSpinning(prize.getName(), 2, new BigDecimal(resultAmount).setScale(2, RoundingMode.HALF_UP));
|
result = new DiscSpinning(prize.getName(), 2, new BigDecimal(resultAmount).setScale(2, RoundingMode.HALF_UP));
|
||||||
|
result.setId(prize.getId());
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (source != 1) {
|
if (source != 1) {
|
||||||
@@ -192,5 +193,23 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||||||
int value = random.nextInt(maxValue) * random.nextInt(maxValue);
|
int value = random.nextInt(maxValue) * random.nextInt(maxValue);
|
||||||
return new BigDecimal(value / 100);
|
return new BigDecimal(value / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getRandomDouble() {
|
||||||
|
random.setSeed(UUID.randomUUID().hashCode());
|
||||||
|
return random.nextDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRandomInt(int maxValue) {
|
||||||
|
random.setSeed(UUID.randomUUID().hashCode());
|
||||||
|
return random.nextInt(maxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Random random = new Random();
|
||||||
|
for (int i = 0; i < 500; i++) {
|
||||||
|
random.setSeed(UUID.randomUUID().hashCode());
|
||||||
|
System.out.println(random.nextInt(100)*random.nextInt(100));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class SpinningTask3 {
|
|||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/1 * * * ? ")
|
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||||
public void record() {
|
public void record() {
|
||||||
record("1");
|
record("1");
|
||||||
}
|
}
|
||||||
@@ -45,8 +45,8 @@ public class SpinningTask3 {
|
|||||||
params = "1";
|
params = "1";
|
||||||
}
|
}
|
||||||
// 获取五分钟前的时间
|
// 获取五分钟前的时间
|
||||||
Date fiveMinutesAgo = DateUtil.offsetMinute(now, Integer.valueOf(params) * -6);
|
Date fiveMinutesAgo = DateUtil.offsetMinute(now, Integer.valueOf(params) * -5);
|
||||||
Date tenMinutesAgo = DateUtil.offsetMinute(now, (Integer.valueOf(params) * -6) - 6);
|
Date tenMinutesAgo = DateUtil.offsetMinute(now, (Integer.valueOf(params) * -5) - 15);
|
||||||
// 将五分钟前的时间转换为指定格式的时间字符串,这里采用常见的"yyyy-MM-dd HH:mm:ss"格式
|
// 将五分钟前的时间转换为指定格式的时间字符串,这里采用常见的"yyyy-MM-dd HH:mm:ss"格式
|
||||||
String fiveMinutesAgoStr = DateUtil.format(fiveMinutesAgo, "yyyy-MM-dd HH:mm:ss");
|
String fiveMinutesAgoStr = DateUtil.format(fiveMinutesAgo, "yyyy-MM-dd HH:mm:ss");
|
||||||
String tenMinutesAgoStr = DateUtil.format(tenMinutesAgo, "yyyy-MM-dd HH:mm:ss");
|
String tenMinutesAgoStr = DateUtil.format(tenMinutesAgo, "yyyy-MM-dd HH:mm:ss");
|
||||||
@@ -55,10 +55,10 @@ public class SpinningTask3 {
|
|||||||
recordQueryWrapper.isNull("target");
|
recordQueryWrapper.isNull("target");
|
||||||
recordQueryWrapper.isNull("target_id");
|
recordQueryWrapper.isNull("target_id");
|
||||||
recordQueryWrapper.eq("type", 2);
|
recordQueryWrapper.eq("type", 2);
|
||||||
//大于
|
//大于等于
|
||||||
recordQueryWrapper.lt("create_time", fiveMinutesAgoStr);
|
recordQueryWrapper.le("create_time", fiveMinutesAgoStr);
|
||||||
//小于
|
//小于等于
|
||||||
recordQueryWrapper.gt("create_time", tenMinutesAgoStr);
|
recordQueryWrapper.ge("create_time", tenMinutesAgoStr);
|
||||||
logger.info("大转盘到账补偿时间范围:{}-----{}", tenMinutesAgoStr, fiveMinutesAgoStr);
|
logger.info("大转盘到账补偿时间范围:{}-----{}", tenMinutesAgoStr, fiveMinutesAgoStr);
|
||||||
List<DiscSpinningRecord> list = recordService.list(recordQueryWrapper);
|
List<DiscSpinningRecord> list = recordService.list(recordQueryWrapper);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> {
|
||||||
|
|||||||
@@ -553,8 +553,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||||
userMoneyDetails.setMoney(orders.getPayDiamond());
|
userMoneyDetails.setMoney(orders.getPayDiamond());
|
||||||
userMoneyDetails.setUserId(orders.getUserId());
|
userMoneyDetails.setUserId(orders.getUserId());
|
||||||
userMoneyDetails.setContent("金币解锁视频");
|
userMoneyDetails.setContent("解锁成功");
|
||||||
userMoneyDetails.setTitle("解锁成功,订单号:" + orders.getOrdersNo());
|
userMoneyDetails.setTitle("金币解锁视频");
|
||||||
userMoneyDetails.setType(2);
|
userMoneyDetails.setType(2);
|
||||||
// ✅
|
// ✅
|
||||||
userMoneyDetails.setClassify(3);
|
userMoneyDetails.setClassify(3);
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ public class AppCashController {
|
|||||||
ret = cashOutService.withdraw(userId, amount, null, false);
|
ret = cashOutService.withdraw(userId, amount, null, false);
|
||||||
int code = Convert.toInt(ret.get("code"), -1);
|
int code = Convert.toInt(ret.get("code"), -1);
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
|
redisService.removeCanCashFlag(userId);
|
||||||
redisUtils.set(intervalKey, true, 60 * 3);
|
redisUtils.set(intervalKey, true, 60 * 3);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -32,4 +32,7 @@ public interface RedisService {
|
|||||||
boolean isCanCash(Long userId);
|
boolean isCanCash(Long userId);
|
||||||
|
|
||||||
boolean setCreateOrderFlagAndCheckLimit(Long userId, Long orderId);
|
boolean setCreateOrderFlagAndCheckLimit(Long userId, Long orderId);
|
||||||
|
|
||||||
|
void removeCanCashFlag(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
@Override
|
@Override
|
||||||
public void setCanCashFlag(Long userId, Long id) {
|
public void setCanCashFlag(Long userId, Long id) {
|
||||||
String key = "cash:canCash:" + userId;
|
String key = "cash:canCash:" + userId;
|
||||||
redisUtils.set(key, id, 30);
|
redisUtils.set(key, id, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -348,6 +348,12 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
return StrUtil.isNotBlank(s);
|
return StrUtil.isNotBlank(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeCanCashFlag(Long userId) {
|
||||||
|
String key = "cash:canCash:" + userId;
|
||||||
|
redisUtils.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setCreateOrderFlagAndCheckLimit(Long userId, Long orderId) {
|
public boolean setCreateOrderFlagAndCheckLimit(Long userId, Long orderId) {
|
||||||
String key = "createOrder:" + userId + ":" + orderId;
|
String key = "createOrder:" + userId + ":" + orderId;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class TaskCenterController {
|
|||||||
@ApiImplicitParam(name = "sourceId", value = "实物(物品Id)", dataTypeClass = Long.class, paramType = "body")
|
@ApiImplicitParam(name = "sourceId", value = "实物(物品Id)", dataTypeClass = Long.class, paramType = "body")
|
||||||
})
|
})
|
||||||
@Debounce(interval = 600000, value = "#userId,#record.taskId")
|
@Debounce(interval = 600000, value = "#userId,#record.taskId")
|
||||||
public Result receiveGoods(@ApiIgnore @RequestAttribute("userId") Long userId,@ApiIgnore TaskCenterRecord record) {
|
public Result receiveGoods(@ApiIgnore @RequestAttribute("userId") Long userId,@ApiIgnore @RequestBody TaskCenterRecord record) {
|
||||||
TaskCenter task = taskCenterService.getById(record.getTaskId());
|
TaskCenter task = taskCenterService.getById(record.getTaskId());
|
||||||
if (Objects.isNull(task)) {
|
if (Objects.isNull(task)) {
|
||||||
return Result.error("任务不存在。");
|
return Result.error("任务不存在。");
|
||||||
|
|||||||
@@ -2,18 +2,17 @@ package com.sqx.modules.taskCenter.controller;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.sqx.common.utils.DateUtils;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||||
import com.sqx.modules.taskCenter.entity.TaskCenterReward;
|
import com.sqx.modules.taskCenter.entity.TaskCenterReward;
|
||||||
import com.sqx.modules.taskCenter.service.TaskCenterRecordService;
|
import com.sqx.modules.taskCenter.service.TaskCenterRecordService;
|
||||||
import com.sqx.modules.taskCenter.service.TaskCenterRewardService;
|
import com.sqx.modules.taskCenter.service.TaskCenterRewardService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.sqx.common.utils.DateUtils;
|
|
||||||
import com.sqx.common.utils.Result;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@@ -83,9 +82,10 @@ public class TaskCenterRewardController {
|
|||||||
@GetMapping("/selectTaskCenterReward")
|
@GetMapping("/selectTaskCenterReward")
|
||||||
@ApiOperation("查询任务奖励")
|
@ApiOperation("查询任务奖励")
|
||||||
public Result selectTaskCenterReward(Integer page, Integer limit, TaskCenterReward taskCenterReward) {
|
public Result selectTaskCenterReward(Integer page, Integer limit, TaskCenterReward taskCenterReward) {
|
||||||
PageHelper.startPage(page,limit);
|
PageHelper.startPage(page == null ? 0 : page, limit == null ? 10 : limit);
|
||||||
List<TaskCenterReward> list = taskCenterRewardService.list(new QueryWrapper<>(taskCenterReward).orderByDesc("id"));
|
List<TaskCenterReward> list = taskCenterRewardService.list(new QueryWrapper<>(taskCenterReward).orderByDesc("id"));
|
||||||
return Result.success().put("data",PageUtils.page(new PageInfo<>(list),true));
|
PageInfo<TaskCenterReward> pageInfo = new PageInfo<>(list);
|
||||||
|
return Result.success().put("data", PageUtils.page(pageInfo, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
@@ -111,7 +111,7 @@ public class TaskCenterRewardController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.put("receive", record.getSourceId());
|
map.put("receive", record.getSourceId());
|
||||||
map.put("record", record.getId());
|
map.put("record", record.getId()+"");
|
||||||
}
|
}
|
||||||
map.put("data", list);
|
map.put("data", list);
|
||||||
return Result.success(map);
|
return Result.success(map);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class TaskCenterReward extends Model<TaskCenterReward> {
|
|||||||
private String img;
|
private String img;
|
||||||
@ApiModelProperty("奖励名称")
|
@ApiModelProperty("奖励名称")
|
||||||
private String name;
|
private String name;
|
||||||
@ApiModelProperty("奖励类型 1 金币 2 现金红包 3 4 5 9 大转盘抽奖次数")
|
@ApiModelProperty("奖励类型 1 金币 2 现金红包 3实物 4 5 9 大转盘抽奖次数")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
|||||||
@@ -100,10 +100,11 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
if (rewardMap.containsKey(9)) {
|
if (rewardMap.containsKey(9)) {
|
||||||
Integer spinningCount = discSpinningRecordService.countSourceRecord(null, userId, "taskW");
|
Integer spinningCount = discSpinningRecordService.countSourceRecord(null, userId, "taskW");
|
||||||
if (spinningCount != null && spinningCount > 0) {
|
if (spinningCount != null && spinningCount > 0) {
|
||||||
s.setButtonTitle("已领取");
|
// s.setButtonTitle("已领取");
|
||||||
s.setDisabled(false);
|
// s.setDisabled(false);
|
||||||
s.setNumber(null);
|
// s.setNumber(null);
|
||||||
break;
|
// break;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
boolean isBreak = false;
|
boolean isBreak = false;
|
||||||
//抽奖次数
|
//抽奖次数
|
||||||
@@ -127,9 +128,10 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
s.setDiscNumber(wSignCount == null ? 0 : wSignCount);
|
s.setDiscNumber(wSignCount == null ? 0 : wSignCount);
|
||||||
s.setDisabled(false);
|
s.setDisabled(false);
|
||||||
} else {
|
} else {
|
||||||
s.setButtonTitle("已领取");
|
// s.setButtonTitle("已领取");
|
||||||
s.setDisabled(false);
|
// s.setDisabled(false);
|
||||||
s.setNumber(null);
|
// s.setNumber(null);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//月任务
|
//月任务
|
||||||
@@ -148,10 +150,11 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
s.setNumber(null);
|
s.setNumber(null);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
s.setButtonTitle("已领取");
|
// s.setButtonTitle("已领取");
|
||||||
s.setDisabled(false);
|
// s.setDisabled(false);
|
||||||
s.setDiscNumber(null);
|
// s.setDiscNumber(null);
|
||||||
s.setNumber(null);
|
// s.setNumber(null);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (recordService.countTaskNum(userId, s.getId(), DateUtil.beginOfMonth(new Date()) + " 00:00:00") > 0) {
|
if (recordService.countTaskNum(userId, s.getId(), DateUtil.beginOfMonth(new Date()) + " 00:00:00") > 0) {
|
||||||
@@ -199,6 +202,9 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (recordService.countTaskNum(userId, s.getId(), null) > 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Integer sumOrderNum = 0;
|
Integer sumOrderNum = 0;
|
||||||
if (inviteAchievement != null) {
|
if (inviteAchievement != null) {
|
||||||
sumOrderNum = inviteAchievement.getCount();
|
sumOrderNum = inviteAchievement.getCount();
|
||||||
@@ -206,9 +212,6 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
if (sumOrderNum != null && sumOrderNum < s.getNumber()) {
|
if (sumOrderNum != null && sumOrderNum < s.getNumber()) {
|
||||||
s.setDiscNumber(sumOrderNum);
|
s.setDiscNumber(sumOrderNum);
|
||||||
s.setNumber(s.getNumber());
|
s.setNumber(s.getNumber());
|
||||||
}
|
|
||||||
if (recordService.countTaskNum(userId, s.getId(), null) > 0) {
|
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
s.setDiscNumber(null);
|
s.setDiscNumber(null);
|
||||||
s.setNumber(null);
|
s.setNumber(null);
|
||||||
@@ -251,6 +254,8 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
return Result.error("不可重复领取");
|
return Result.error("不可重复领取");
|
||||||
}
|
}
|
||||||
signRecordService.save(signRecord);
|
signRecordService.save(signRecord);
|
||||||
|
}else {
|
||||||
|
return Result.error("异常领取,已记录");
|
||||||
}
|
}
|
||||||
} else if (taskCenter.getType().equals(3) && taskCenter.getId().equals(1L)) {
|
} else if (taskCenter.getType().equals(3) && taskCenter.getId().equals(1L)) {
|
||||||
Integer sumOrderNum = 0;
|
Integer sumOrderNum = 0;
|
||||||
@@ -278,6 +283,8 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
if (recordService.countTaskNum(courseIds, taskCenter.getId(), null) > 0)
|
if (recordService.countTaskNum(courseIds, taskCenter.getId(), null) > 0)
|
||||||
return Result.error("同一实名算一个新用户,不可重复领取");
|
return Result.error("同一实名算一个新用户,不可重复领取");
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
return Result.error("异常领取,已记录");
|
||||||
}
|
}
|
||||||
List<TaskCenterRecord> records = new ArrayList<>();
|
List<TaskCenterRecord> records = new ArrayList<>();
|
||||||
Long targetId = null;
|
Long targetId = null;
|
||||||
|
|||||||
@@ -158,4 +158,4 @@ sqx:
|
|||||||
expire: 604800
|
expire: 604800
|
||||||
header: token
|
header: token
|
||||||
uni:
|
uni:
|
||||||
adSecret: 122e4ff1edc66dcf8761f7f7ffc81e0f8773cbfafb58aed29c72fbd092c77315
|
adSecret: cbc34e14ee6d64738557c96623dd6da89f77cac8ae519c6a5c87191d614d386a
|
||||||
|
|||||||
Reference in New Issue
Block a user