Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -84,6 +84,11 @@ public class RedisUtils {
|
||||
return this.fromJson(jsonStr, clazz);
|
||||
}
|
||||
|
||||
public <T> T getObjectDate(String key, Class<T> clazz) {
|
||||
String jsonStr = get(key);
|
||||
return this.fromJson(jsonStr, clazz);
|
||||
}
|
||||
|
||||
public String getDate(String key, String method) {
|
||||
if (!this.hasKey(key)) {
|
||||
try {
|
||||
|
||||
@@ -1495,11 +1495,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userMoneyDetails.setCreateTime(DateUtil.format(new Date(System.currentTimeMillis() - 1000), "yyyy-MM-dd HH:mm:ss"));
|
||||
userMoneyDetails.setMoneyType(1);
|
||||
boolean ret = userMoneyDetailsService.save(userMoneyDetails);
|
||||
// if (ret) {
|
||||
// ThreadUtil.execAsync(()->{
|
||||
// discSpinningService.withdrawAsync(entity, money.doubleValue(), "[提现]");
|
||||
// },true);
|
||||
// }
|
||||
if (ret) {
|
||||
ThreadUtil.execAsync(()->{
|
||||
discSpinningService.withdrawAsync(entity, money.doubleValue(), "[提现]");
|
||||
},true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("首绑支付宝发放奖励异常,用户信息:{}", JSONUtil.toJsonStr(entity));
|
||||
log.error("首绑支付宝发放奖励异常:", e);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.sqx.modules.course.controller.app;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.RedisKeys;
|
||||
import com.sqx.common.utils.RedisUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.course.entity.Course;
|
||||
import com.sqx.modules.course.service.CourseDetailsService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
@@ -24,6 +26,8 @@ public class AppCourseController extends AbstractController {
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseDetailsService courseDetailsService;
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
@GetMapping("/selectCourse")
|
||||
@ApiOperation("查询短剧信息")
|
||||
@@ -41,10 +45,19 @@ public class AppCourseController extends AbstractController {
|
||||
}
|
||||
|
||||
|
||||
@Login
|
||||
@GetMapping("/selectCourseDetailsById")
|
||||
@ApiOperation("根据id查询短剧详情")
|
||||
@Debounce(interval = 1000, value = "#id,#token")
|
||||
public Result selectCourseDetailsById(Long id, String token, String courseDetailsId) {
|
||||
public Result selectCourseDetailsById(@RequestAttribute("userId") Long userId, Long id, String token, String courseDetailsId) {
|
||||
String redisKey = RedisKeys.getDateKey("course:") + userId + "-" + id;
|
||||
Object week = redisUtils.getObjectDate(redisKey,Course.class);
|
||||
if (week != null) {
|
||||
return Result.success().put("data", week);
|
||||
}
|
||||
Result result = courseDetailsService.selectCourseDetailsById(id, token, courseDetailsId);
|
||||
if (result.get("code").equals(0)) {
|
||||
redisUtils.set(redisKey, result.get("data"), 3);
|
||||
}
|
||||
return courseDetailsService.selectCourseDetailsById(id, token, courseDetailsId);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,10 +95,10 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
||||
userMoneyService.updateAmount(1, receive.getUserId(), receive.getNumber().doubleValue());
|
||||
|
||||
|
||||
// if (receive.getNumber().compareTo(new BigDecimal("0.1")) > 0 && StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
||||
// //提现
|
||||
// withdraw(userInfo, receive.getNumber().doubleValue());
|
||||
// }
|
||||
if (receive.getNumber().compareTo(new BigDecimal("0.1")) > 0 && StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
||||
//提现
|
||||
withdraw(userInfo, receive.getNumber().doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component("CashOutTask2")
|
||||
@@ -35,10 +37,13 @@ public class CashOutTask2 implements ITask {
|
||||
@Override
|
||||
public void run(String params) {
|
||||
logger.info("提现开始");
|
||||
if (StringUtils.isBlank(params) || isValidDate(params)) {
|
||||
params = DateUtil.today();
|
||||
}
|
||||
List<CashOut> cashOuts = cashOutDao.selectList(new QueryWrapper<CashOut>()
|
||||
.eq("state", 0)
|
||||
.gt("create_at", DateUtil.today()+" 00:00:00")
|
||||
.lt("create_at",DateUtil.today()+" 23:59:59"));
|
||||
.gt("create_at", params + " 00:00:00")
|
||||
.lt("create_at", params + " 23:59:59"));
|
||||
System.out.println(cashOuts.size());
|
||||
for (CashOut cashOut : cashOuts) {
|
||||
if (WuyouPay.checkCanCash(cashOut.getUserId())) {
|
||||
@@ -50,20 +55,20 @@ public class CashOutTask2 implements ITask {
|
||||
} else {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配")||cashOut.getRefund().contains("已驳回")) {
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配") || cashOut.getRefund().contains("已驳回")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
}else {
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
cashOut.getUserId(),null,null,"提现失败",4,1,1,
|
||||
new BigDecimal(cashOut.getMoney()),"提现失败存入余额" + cashOut.getMoney() + "元", 1);
|
||||
cashOut.getUserId(), null, null, "提现失败", 4, 1, 1,
|
||||
new BigDecimal(cashOut.getMoney()), "提现失败存入余额" + cashOut.getMoney() + "元", 1);
|
||||
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, cashOut.getUserId(), Double.parseDouble(cashOut.getMoney()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
cashOut.setState(3);
|
||||
}
|
||||
|
||||
@@ -71,4 +76,14 @@ public class CashOutTask2 implements ITask {
|
||||
}
|
||||
logger.info("提现结束");
|
||||
}
|
||||
|
||||
public static boolean isValidDate(String dateString) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
sdf.parse(dateString);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user