Merge branch 'test' into dev
This commit is contained in:
commit
81d823f6ce
|
|
@ -21,7 +21,6 @@ import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限(Token)验证
|
* 权限(Token)验证
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
@ -35,37 +34,41 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
Login annotation;
|
Login annotation;
|
||||||
if(handler instanceof HandlerMethod) {
|
if (handler instanceof HandlerMethod) {
|
||||||
annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class);
|
annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class);
|
||||||
}else{
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(annotation == null){
|
if (annotation == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取用户凭证
|
//获取用户凭证
|
||||||
String token = request.getHeader(jwtUtils.getHeader());
|
String token = request.getHeader(jwtUtils.getHeader());
|
||||||
if(StringUtils.isBlank(token)){
|
if (StringUtils.isBlank(token)) {
|
||||||
token = request.getParameter(jwtUtils.getHeader());
|
token = request.getParameter(jwtUtils.getHeader());
|
||||||
}
|
}
|
||||||
|
|
||||||
//凭证为空
|
//凭证为空
|
||||||
if(StringUtils.isBlank(token)){
|
if (StringUtils.isBlank(token)) {
|
||||||
throw new SqxException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
|
throw new SqxException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
Claims claims = jwtUtils.getClaimByToken(token);
|
Claims claims = jwtUtils.getClaimByToken(token);
|
||||||
if(claims == null || jwtUtils.isTokenExpired(claims.getExpiration())){
|
if (claims == null || jwtUtils.isTokenExpired(claims.getExpiration())) {
|
||||||
throw new SqxException(jwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value());
|
throw new SqxException(jwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置userId到request里,后续根据userId,获取用户信息
|
//设置userId到request里,后续根据userId,获取用户信息
|
||||||
long userId = Long.parseLong(claims.getSubject());
|
long userId = Long.parseLong(claims.getSubject());
|
||||||
|
UserEntity user = userService.selectUserById(userId);
|
||||||
|
if (user.getStatus().equals(0)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
request.setAttribute(USER_KEY, userId);
|
request.setAttribute(USER_KEY, userId);
|
||||||
//记录用户最后一次调用接口的时间
|
//记录用户最后一次调用接口的时间
|
||||||
UserEntity userEntity=new UserEntity();
|
UserEntity userEntity = new UserEntity();
|
||||||
userEntity.setUserId(userId);
|
userEntity.setUserId(userId);
|
||||||
userEntity.setOnLineTime(DateUtils.format(new Date()));
|
userEntity.setOnLineTime(DateUtils.format(new Date()));
|
||||||
userService.updateById(userEntity);
|
userService.updateById(userEntity);
|
||||||
|
|
|
||||||
|
|
@ -1472,7 +1472,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void firstBindAwardsMoney(UserEntity entity) {
|
public void firstBindAwardsMoney(UserEntity entity) {
|
||||||
reentrantReadWriteLock.writeLock().lock();
|
// reentrantReadWriteLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
CommonInfo one = commonRepository.findOne(920);
|
CommonInfo one = commonRepository.findOne(920);
|
||||||
BigDecimal money = new BigDecimal(one.getValue());
|
BigDecimal money = new BigDecimal(one.getValue());
|
||||||
|
|
@ -1489,17 +1489,17 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||||
userMoneyDetails.setCreateTime(DateUtil.format(new Date(System.currentTimeMillis() - 1000), "yyyy-MM-dd HH:mm:ss"));
|
userMoneyDetails.setCreateTime(DateUtil.format(new Date(System.currentTimeMillis() - 1000), "yyyy-MM-dd HH:mm:ss"));
|
||||||
userMoneyDetails.setMoneyType(1);
|
userMoneyDetails.setMoneyType(1);
|
||||||
boolean ret = userMoneyDetailsService.save(userMoneyDetails);
|
boolean ret = userMoneyDetailsService.save(userMoneyDetails);
|
||||||
if (ret) {
|
// if (ret) {
|
||||||
ThreadUtil.execAsync(()->{
|
// ThreadUtil.execAsync(()->{
|
||||||
discSpinningService.withdrawAsync(entity, money.doubleValue(), "[提现]");
|
// discSpinningService.withdrawAsync(entity, money.doubleValue(), "[提现]");
|
||||||
},true);
|
// },true);
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("首绑支付宝发放奖励异常,用户信息:{}", JSONUtil.toJsonStr(entity));
|
log.error("首绑支付宝发放奖励异常,用户信息:{}", JSONUtil.toJsonStr(entity));
|
||||||
log.error("首绑支付宝发放奖励异常:", e);
|
log.error("首绑支付宝发放奖励异常:", e);
|
||||||
throw new RuntimeException("首绑奖励失败");
|
throw new RuntimeException("首绑奖励失败");
|
||||||
} finally {
|
} finally {
|
||||||
reentrantReadWriteLock.writeLock().unlock();
|
// reentrantReadWriteLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,10 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
||||||
|
if (userInfo.getStatus().equals(0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||||
receive.getUserId(), null, null, "[现金大转盘]", 5, 1, 2,
|
receive.getUserId(), null, null, "[现金大转盘]", 5, 1, 2,
|
||||||
receive.getNumber(), "现金红包奖励" + receive.getNumber() + "元", 1);
|
receive.getNumber(), "现金红包奖励" + receive.getNumber() + "元", 1);
|
||||||
|
|
@ -91,10 +95,10 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
||||||
userMoneyService.updateAmount(1, receive.getUserId(), receive.getNumber().doubleValue());
|
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())) {
|
// if (receive.getNumber().compareTo(new BigDecimal("0.1")) > 0 && StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
||||||
//提现
|
// //提现
|
||||||
withdraw(userInfo, receive.getNumber().doubleValue());
|
// withdraw(userInfo, receive.getNumber().doubleValue());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.sqx.modules.pay.service.impl;
|
package com.sqx.modules.pay.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
|
|
@ -15,6 +16,7 @@ import com.sqx.modules.app.service.UserMoneyService;
|
||||||
import com.sqx.modules.app.service.UserService;
|
import com.sqx.modules.app.service.UserService;
|
||||||
import com.sqx.modules.common.entity.CommonInfo;
|
import com.sqx.modules.common.entity.CommonInfo;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
import com.sqx.modules.common.service.CommonInfoService;
|
||||||
|
import com.sqx.modules.course.entity.CourseCollect;
|
||||||
import com.sqx.modules.invite.entity.InviteMoney;
|
import com.sqx.modules.invite.entity.InviteMoney;
|
||||||
import com.sqx.modules.invite.service.InviteMoneyService;
|
import com.sqx.modules.invite.service.InviteMoneyService;
|
||||||
import com.sqx.modules.message.dao.MessageInfoDao;
|
import com.sqx.modules.message.dao.MessageInfoDao;
|
||||||
|
|
@ -427,6 +429,9 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||||
alipayName = sysUserEntity.getZhiFuBaoName();
|
alipayName = sysUserEntity.getZhiFuBaoName();
|
||||||
} else {
|
} else {
|
||||||
UserEntity userInfo = userService.queryByUserId(userId);
|
UserEntity userInfo = userService.queryByUserId(userId);
|
||||||
|
if (userInfo.getStatus().equals(0)) {
|
||||||
|
return Result.error(9999, "账号不存在!");
|
||||||
|
}
|
||||||
if (StringUtils.isBlank(userInfo.getZhiFuBao()) || StringUtils.isBlank(userInfo.getZhiFuBaoName())) {
|
if (StringUtils.isBlank(userInfo.getZhiFuBao()) || StringUtils.isBlank(userInfo.getZhiFuBaoName())) {
|
||||||
return Result.error(9999, "请先绑定支付宝账号!");
|
return Result.error(9999, "请先绑定支付宝账号!");
|
||||||
}
|
}
|
||||||
|
|
@ -479,15 +484,16 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||||
if (userMoney.getAmount().doubleValue() < money) {
|
if (userMoney.getAmount().doubleValue() < money) {
|
||||||
return Result.success("可提现余额不足!");
|
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) {
|
// BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||||
return Result.error(baseResp.getErrorMsg());
|
// 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());
|
||||||
|
// }
|
||||||
|
|
||||||
userMoneyDetailsService.save(userMoneyDetails);
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
baseMapper.insert(cashOut);
|
baseMapper.insert(cashOut);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue