Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -144,7 +144,7 @@ public class AppLoginController {
|
||||
@RequestMapping(value = "/registerCode", method = RequestMethod.POST)
|
||||
@ApiOperation("app或h5注册或登录")
|
||||
@ResponseBody
|
||||
// @Debounce(interval = 2500, value = "phone")
|
||||
@Debounce(interval = 2500, value = "#phone")
|
||||
public Result registerCode(@RequestParam String phone,String msg,String platform,Integer sysPhone,
|
||||
String password,String inviterCode,String wxId,String qdCode) {
|
||||
return userService.registerCode(phone,msg,platform,sysPhone,password,inviterCode,wxId,qdCode);
|
||||
|
||||
@@ -50,6 +50,8 @@ import com.sqx.modules.file.utils.Md5Utils;
|
||||
import com.sqx.modules.invite.service.InviteService;
|
||||
import com.sqx.modules.message.entity.MessageInfo;
|
||||
import com.sqx.modules.message.service.MessageService;
|
||||
import com.sqx.modules.sys.entity.SysUserEntity;
|
||||
import com.sqx.modules.sys.service.SysUserService;
|
||||
import com.sqx.modules.utils.HttpClientUtil;
|
||||
import com.sqx.modules.utils.InvitationCodeUtil;
|
||||
import com.sqx.modules.utils.MD5Util;
|
||||
@@ -110,6 +112,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
private CommonInfoService commonRepository;
|
||||
@Autowired
|
||||
private DiscSpinningService discSpinningService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||
|
||||
@Override
|
||||
@@ -896,12 +900,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (StringUtils.isEmpty(msg)) {
|
||||
return Result.error("验证码不能为空!");
|
||||
}
|
||||
Msg msg1 = null;
|
||||
if (!"147258".equals(msg)) {
|
||||
msg1 = msgDao.findByPhoneAndCode(phone, msg);
|
||||
if (msg1 == null) {
|
||||
return Result.error("验证码不正确!");
|
||||
}
|
||||
Msg msg1 = msgDao.findByPhoneAndCode(phone, msg);
|
||||
if (msg1 == null) {
|
||||
return Result.error("验证码不正确!");
|
||||
}
|
||||
userInfo = new UserEntity();
|
||||
UserEntity userEntity = null;
|
||||
@@ -921,6 +922,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
if (StringUtils.isEmpty(qdCode)) {
|
||||
qdCode = userEntity.getQdCode();
|
||||
} else {
|
||||
SysUserEntity sysUserEntity = sysUserService.selectSysUserByQdCode(qdCode);
|
||||
if (sysUserEntity == null) {
|
||||
return Result.error("请使用正确的渠道码!");
|
||||
}
|
||||
}
|
||||
userInfo.setQdCode(qdCode);
|
||||
userInfo.setPhone(phone);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.sqx.modules.discSpinning.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -28,7 +27,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.util.annotation.Nullable;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -49,7 +47,6 @@ public class DiscSpinningController {
|
||||
private final TaskCenterRecordService taskRecordService;
|
||||
private final UserService userService;
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@Autowired
|
||||
public DiscSpinningController(CommonInfoService commonRepository, DiscSpinningService discSpinningService,
|
||||
OrdersService ordersService, DiscSpinningRecordService recordService,
|
||||
|
||||
@@ -124,28 +124,38 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
||||
//最高提现金额
|
||||
CommonInfo one2 = commonRepository.findOne(910);
|
||||
if (one2 == null || money <= Double.parseDouble(one2.getValue())) {
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(userInfo.getUserId(), outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||
if (WuyouPay.checkCanCash(userInfo.getUserId())) {
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
userInfo.getUserId(), null, null, title, 4, 2, 1,
|
||||
new BigDecimal(money), "现金红包自动提现" + money + "元", 1);
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
//减去余额 钱
|
||||
userMoneyService.updateAmount(2, userInfo.getUserId(), money);
|
||||
|
||||
cashOut.setState(1);
|
||||
} else if (StringUtils.isNotBlank(baseResp.getErrorMsg())) {
|
||||
cashOut.setState(2);
|
||||
if (baseResp.getErrorMsg().contains("收款人账户号出款属性不匹配")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(baseResp.getMsg())) {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
}
|
||||
}else {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
userInfo.getUserId(), null, null, title, 4, 2, 1,
|
||||
new BigDecimal(money), "现金红包自动提现" + money + "元", 1);
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
//减去余额 钱
|
||||
userMoneyService.updateAmount(2, userInfo.getUserId(), money);
|
||||
|
||||
cashOut.setState(1);
|
||||
} else if (StringUtils.isNotBlank(baseResp.getErrorMsg())) {
|
||||
cashOut.setState(2);
|
||||
if (baseResp.getErrorMsg().contains("收款人账户号出款属性不匹配")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(baseResp.getMsg())) {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
cashOut.setState(3);
|
||||
}
|
||||
} else {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
|
||||
@@ -11,13 +11,10 @@ import com.sqx.modules.utils.AliPayOrderUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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("CashOutTask")
|
||||
@@ -37,26 +34,31 @@ public class CashOutTask implements ITask {
|
||||
logger.info("提现开始");
|
||||
List<CashOut> cashOuts = cashOutDao.selectYesterday();
|
||||
for (CashOut cashOut : cashOuts) {
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(cashOut.getUserId(), outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
} else {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配")||cashOut.getRefund().contains("已驳回")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
}else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
cashOut.getUserId(),null,null,"提现失败",4,1,1,
|
||||
new BigDecimal(cashOut.getMoney()),"提现失败存入余额" + cashOut.getMoney() + "元", 1);
|
||||
if (WuyouPay.checkCanCash(cashOut.getUserId())) {
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, cashOut.getUserId(), Double.parseDouble(cashOut.getMoney()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
} else {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配") || cashOut.getRefund().contains("已驳回")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
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 {
|
||||
cashOut.setState(3);
|
||||
}
|
||||
cashOutDao.updateById(cashOut);
|
||||
}
|
||||
|
||||
74
src/main/java/com/sqx/modules/job/task/CashOutTask2.java
Normal file
74
src/main/java/com/sqx/modules/job/task/CashOutTask2.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.sqx.modules.job.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import com.sqx.modules.banner.entity.Activity;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import com.sqx.modules.pay.wuyou.BaseResp;
|
||||
import com.sqx.modules.pay.wuyou.WuyouPay;
|
||||
import com.sqx.modules.utils.AliPayOrderUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Component("CashOutTask2")
|
||||
public class CashOutTask2 implements ITask {
|
||||
|
||||
@Resource
|
||||
private CashOutDao cashOutDao;
|
||||
@Resource
|
||||
private UserMoneyService userMoneyService;
|
||||
@Resource
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public void run(String params) {
|
||||
logger.info("提现开始");
|
||||
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"));
|
||||
System.out.println(cashOuts.size());
|
||||
for (CashOut cashOut : cashOuts) {
|
||||
if (WuyouPay.checkCanCash(cashOut.getUserId())) {
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
} else {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
if (cashOut.getRefund().contains("收款人账户号出款属性不匹配")||cashOut.getRefund().contains("已驳回")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
}else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
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 {
|
||||
cashOut.setState(3);
|
||||
}
|
||||
|
||||
cashOutDao.updateById(cashOut);
|
||||
}
|
||||
logger.info("提现结束");
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,9 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.ApiAccessLimitUtil;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.RedisKeys;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
@@ -34,6 +36,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -68,12 +71,13 @@ public class WuyouController {
|
||||
private final CashOutDao cashOutDao;
|
||||
private final CompletAwardService completAwardService;
|
||||
private final SysUserService sysUserService;
|
||||
private final ApplicationContext applicationContext;
|
||||
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5);
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
WuyouController(OrdersService ordersService, PayDetailsDao payDetailsDao, UserService userService, InviteService inviteService, CashOutDao cashOutDao,
|
||||
UserMoneyService userMoneyService, UserMoneyDetailsService userMoneyDetailsService, CommonInfoService commonRepository,
|
||||
InviteDao inviteDao,CompletAwardService completAwardService, SysUserService sysUserService) {
|
||||
InviteDao inviteDao, CompletAwardService completAwardService, SysUserService sysUserService, ApplicationContext applicationContext) {
|
||||
this.ordersService = ordersService;
|
||||
this.payDetailsDao = payDetailsDao;
|
||||
this.userService = userService;
|
||||
@@ -85,6 +89,7 @@ public class WuyouController {
|
||||
this.inviteDao = inviteDao;
|
||||
this.completAwardService = completAwardService;
|
||||
this.sysUserService = sysUserService;
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Debounce(interval = 1000, value = "#orderId")
|
||||
@@ -335,7 +340,11 @@ public class WuyouController {
|
||||
ordersService.updateById(order);
|
||||
ordersService.insertOrders(order);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
activities(user, byUser);
|
||||
ApiAccessLimitUtil.runFunAndCheckKey(() -> {
|
||||
WuyouController proxy = applicationContext.getBean(WuyouController.class);
|
||||
proxy.activities(user, byUser);
|
||||
return null;
|
||||
}, RedisKeys.getLockKey("activaties", user.getUserId(), byUser.getUserId()), 15);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -486,15 +486,20 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||
return Result.success("可提现余额不足!");
|
||||
}
|
||||
|
||||
// BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
// if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))){
|
||||
// userMoneyDetails.setContent("成功提现:" + money);
|
||||
// cashOut.setState(1);
|
||||
// }
|
||||
//
|
||||
// if (baseResp.getErrorMsg() != null) {
|
||||
// return Result.error(baseResp.getErrorMsg());
|
||||
// }
|
||||
if (WuyouPay.checkCanCash(userId)) {
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))){
|
||||
userMoneyDetails.setContent("成功提现:" + money);
|
||||
cashOut.setState(1);
|
||||
}
|
||||
|
||||
if (baseResp.getErrorMsg() != null) {
|
||||
return Result.error(baseResp.getErrorMsg());
|
||||
}
|
||||
}else {
|
||||
userMoneyDetails.setContent("成功提现:" + money);
|
||||
cashOut.setState(3);
|
||||
}
|
||||
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
baseMapper.insert(cashOut);
|
||||
|
||||
@@ -82,30 +82,30 @@ public class WuyouPay {
|
||||
return JSONObject.parseObject(body, BaseResp.class);
|
||||
}
|
||||
|
||||
public static boolean checkCanCash(long userId) {
|
||||
// 查询当日体现次数
|
||||
Integer successCashCount = cashOutDao.selectTodayCashCount(userId, 1);
|
||||
CommonInfo cashLimit = commonInfoService.findOne(922);
|
||||
if (cashLimit == null || StrUtil.isBlank(cashLimit.getValue())) {
|
||||
logger.warn("提现必要参数未配置,请联系管理员");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (successCashCount >= Integer.parseInt(cashLimit.getValue())) {
|
||||
logger.warn("提现必要参数未配置,请联系管理员");
|
||||
return false;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现
|
||||
* @param account 支付宝账号
|
||||
* @param userName 支付宝名称
|
||||
* @return
|
||||
*/
|
||||
public static BaseResp extractOrder(long userId, String outOrderNo, String amount, String account, String userName) {
|
||||
|
||||
// 查询当日体现次数
|
||||
Integer successCashCount = cashOutDao.selectTodayCashCount(userId, 1);
|
||||
CommonInfo cashLimit = commonInfoService.findOne(922);
|
||||
if (cashLimit == null || StrUtil.isBlank(cashLimit.getValue())) {
|
||||
BaseResp baseResp = new BaseResp();
|
||||
baseResp.setStatus(0);
|
||||
baseResp.setErrorMsg("提现必要参数未配置,请联系管理员");
|
||||
return baseResp;
|
||||
}
|
||||
|
||||
if (successCashCount >= Integer.parseInt(cashLimit.getValue())) {
|
||||
BaseResp baseResp = new BaseResp();
|
||||
baseResp.setStatus(0);
|
||||
baseResp.setErrorMsg("每日提现次数限制" + cashLimit.getValue() + "次, 您已超过上限");
|
||||
return baseResp;
|
||||
}
|
||||
public static BaseResp extractOrder(String outOrderNo, String amount, String account, String userName) {
|
||||
|
||||
Map<String, Object> params = getBaseParams();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user