日志修改
This commit is contained in:
@@ -7,15 +7,17 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.context.request.WebRequest;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
/**
|
||||
* 异常处理器
|
||||
*
|
||||
* @author GYJ
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class SqxExceptionHandler {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* 处理自定义异常
|
||||
@@ -30,25 +32,33 @@ public class SqxExceptionHandler {
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public Result handlerNoFoundException(Exception e) {
|
||||
public Result handlerNoFoundException(Exception e, WebRequest webRequest) {
|
||||
String requestUrl = webRequest.getDescription(false).split(" ")[1];
|
||||
logger.error("请求路径不存在:{}", requestUrl);
|
||||
logger.error(e.getMessage(), e);
|
||||
return Result.error(404, "路径不存在,请检查路径是否正确");
|
||||
}
|
||||
|
||||
@ExceptionHandler(DuplicateKeyException.class)
|
||||
public Result handleDuplicateKeyException(DuplicateKeyException e){
|
||||
public Result handleDuplicateKeyException(DuplicateKeyException e, WebRequest webRequest) {
|
||||
String requestUrl = webRequest.getDescription(false).split(" ")[1];
|
||||
logger.error("请求路径:{},数据库中已存在该记录", requestUrl);
|
||||
logger.error(e.getMessage(), e);
|
||||
return Result.error("数据库中已存在该记录");
|
||||
}
|
||||
|
||||
@ExceptionHandler(AuthorizationException.class)
|
||||
public Result handleAuthorizationException(AuthorizationException e){
|
||||
public Result handleAuthorizationException(AuthorizationException e, WebRequest webRequest) {
|
||||
String requestUrl = webRequest.getDescription(false).split(" ")[1];
|
||||
logger.error("请求路径:{},没有权限", requestUrl);
|
||||
logger.error(e.getMessage(), e);
|
||||
return Result.error("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result handleException(Exception e){
|
||||
public Result handleException(Exception e, WebRequest webRequest) {
|
||||
String requestUrl = webRequest.getDescription(false).split(" ")[1];
|
||||
logger.error("请求路径:{},发生异常", requestUrl);
|
||||
logger.error(e.getMessage(), e);
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
return getResult(userInfo);
|
||||
} else {
|
||||
if(StringUtils.isEmpty(msg)){
|
||||
return Result.error("手机号未注册!");
|
||||
return Result.error("验证码不能为空!");
|
||||
}
|
||||
Msg msg1 = msgDao.findByPhoneAndCode(phone, msg);
|
||||
if(msg1==null){
|
||||
|
||||
@@ -148,18 +148,24 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
|
||||
user.setInviterCode(userEntity.getInvitationCode());
|
||||
userService.updateById(user);
|
||||
String value = commonInfoService.findOne(813).getValue();
|
||||
if("是".equals(value)){
|
||||
if (!"是".equals(value)) {
|
||||
return 0;
|
||||
}
|
||||
//获取邀请人的邀请数量
|
||||
int inviterCount = userService.queryInviterCount(userEntity.getInvitationCode());
|
||||
InviteAward inviteAward = inviteAwardService.getOne(new QueryWrapper<InviteAward>().eq("invite_count", inviterCount));
|
||||
if(inviteAward!=null){
|
||||
if (inviteAward == null) {
|
||||
return 0;
|
||||
}
|
||||
if (inviteAward.getInviteMonth() == 0) {
|
||||
userVipService.update(null, Wrappers.<UserVip>lambdaUpdate()
|
||||
.set(UserVip::getIsVip, 2)
|
||||
.set(UserVip::getEndTime, null)
|
||||
.set(UserVip::getVipType, 1)
|
||||
.eq(UserVip::getUserId, userEntity.getUserId()));
|
||||
}else{
|
||||
|
||||
return 1;
|
||||
}
|
||||
UserVip userVip = userVipService.selectUserVipByUserId(userEntity.getUserId());
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
if (userVip != null && userVip.getIsVip() == 2) {
|
||||
@@ -179,9 +185,6 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
|
||||
} else {
|
||||
userVipService.save(userVip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -16,5 +16,6 @@ public class Constants {
|
||||
final static String EXTRACT_QUERY_URL = BASE_URL + "/api/querySalary";
|
||||
|
||||
final static String NOTIFY_URL = "https://video.hnsiyao.cn/sqx_fast/app/wuyou/notify";
|
||||
final static String EXTRACT_NOTIFY_URL = "https://video.hnsiyao.cn/sqx_fast/app/wuyou/notify";
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sqx.modules.pay.wuyou;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -53,7 +54,7 @@ public class WuyouPay {
|
||||
params.put("bank_branch", "1");
|
||||
params.put("province", "1");
|
||||
params.put("city", "1");
|
||||
params.put("notify_url", "1");
|
||||
params.put("notify_url", Constants.EXTRACT_NOTIFY_URL);
|
||||
|
||||
String sign = Encrypt.getParamsSign(params);
|
||||
params.put("sign", sign);
|
||||
@@ -93,7 +94,7 @@ public class WuyouPay {
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
logger.info("request url: {}, params: {}, response: {}", url, params, body);
|
||||
logger.info("无忧支付 request url: {}, params: {}, response: {}", url, params, body);
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user