Merge branch 'test' into dev
This commit is contained in:
commit
81d823f6ce
|
|
@ -21,7 +21,6 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* 权限(Token)验证
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
||||
|
|
@ -35,37 +34,41 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
|
|||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
Login annotation;
|
||||
if(handler instanceof HandlerMethod) {
|
||||
if (handler instanceof HandlerMethod) {
|
||||
annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class);
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(annotation == null){
|
||||
if (annotation == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//获取用户凭证
|
||||
String token = request.getHeader(jwtUtils.getHeader());
|
||||
if(StringUtils.isBlank(token)){
|
||||
if (StringUtils.isBlank(token)) {
|
||||
token = request.getParameter(jwtUtils.getHeader());
|
||||
}
|
||||
|
||||
//凭证为空
|
||||
if(StringUtils.isBlank(token)){
|
||||
if (StringUtils.isBlank(token)) {
|
||||
throw new SqxException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
//设置userId到request里,后续根据userId,获取用户信息
|
||||
long userId = Long.parseLong(claims.getSubject());
|
||||
UserEntity user = userService.selectUserById(userId);
|
||||
if (user.getStatus().equals(0)) {
|
||||
return false;
|
||||
}
|
||||
request.setAttribute(USER_KEY, userId);
|
||||
//记录用户最后一次调用接口的时间
|
||||
UserEntity userEntity=new UserEntity();
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setUserId(userId);
|
||||
userEntity.setOnLineTime(DateUtils.format(new Date()));
|
||||
userService.updateById(userEntity);
|
||||
|
|
|
|||
|
|
@ -1472,7 +1472,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void firstBindAwardsMoney(UserEntity entity) {
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
// reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
CommonInfo one = commonRepository.findOne(920);
|
||||
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.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);
|
||||
throw new RuntimeException("首绑奖励失败");
|
||||
} finally {
|
||||
reentrantReadWriteLock.writeLock().unlock();
|
||||
// reentrantReadWriteLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
|||
return;
|
||||
}
|
||||
UserEntity userInfo = userService.queryByUserId(receive.getUserId());
|
||||
if (userInfo.getStatus().equals(0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
receive.getUserId(), null, null, "[现金大转盘]", 5, 1, 2,
|
||||
receive.getNumber(), "现金红包奖励" + receive.getNumber() + "元", 1);
|
||||
|
|
@ -91,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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.sqx.modules.pay.service.impl;
|
||||
|
||||
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.service.impl.ServiceImpl;
|
||||
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.common.entity.CommonInfo;
|
||||
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.service.InviteMoneyService;
|
||||
import com.sqx.modules.message.dao.MessageInfoDao;
|
||||
|
|
@ -427,6 +429,9 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||
alipayName = sysUserEntity.getZhiFuBaoName();
|
||||
} else {
|
||||
UserEntity userInfo = userService.queryByUserId(userId);
|
||||
if (userInfo.getStatus().equals(0)) {
|
||||
return Result.error(9999, "账号不存在!");
|
||||
}
|
||||
if (StringUtils.isBlank(userInfo.getZhiFuBao()) || StringUtils.isBlank(userInfo.getZhiFuBaoName())) {
|
||||
return Result.error(9999, "请先绑定支付宝账号!");
|
||||
}
|
||||
|
|
@ -479,15 +484,16 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||
if (userMoney.getAmount().doubleValue() < money) {
|
||||
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());
|
||||
}
|
||||
// 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());
|
||||
// }
|
||||
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
baseMapper.insert(cashOut);
|
||||
|
|
|
|||
Loading…
Reference in New Issue