Commit 19c48bbb authored by 赵啸非's avatar 赵啸非

修改构建api文档

parent f81184a7
......@@ -8,14 +8,15 @@ import org.apache.commons.lang3.StringUtils;
/**
* 自定义 p6spy sql输出格式
*
* @author: zxfei
* @date: 2022/4/19 9:01
*/
@CommonsLog
public class P6spySqlFormatConfig implements MessageFormattingStrategy {
@Override
public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) {
return StringUtils.isNotBlank(sql) ? DateUtils.getCurrStrDateTime()
+ " | 耗时 " + elapsed + " ms | SQL 语句:" + StringUtils.LF + sql.replaceAll("[\\s]+", StringUtils.SPACE) + ";" : "";
+ " | 耗时 " + elapsed + " ms | SQL:" + StringUtils.LF + sql.replaceAll("[\\s]+", StringUtils.SPACE) + ";" : "";
}
}
......@@ -23,7 +23,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
*
* @author zxfei
*/
@Component
//@Component
@CommonsLog
public class AuthTokenService {
// 令牌自定义标识
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.CookieService;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITokenService;
import com.mortals.framework.service.IUser;
......@@ -53,7 +54,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
@Autowired
private ICacheService cacheService;
@Autowired
private AuthTokenService authTokenService;
private IAuthTokenService authTokenService;
private static Log logger = LogFactory.getLog(LoginController.class);
......@@ -104,7 +105,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
String token = authTokenService.createToken(userEntity);
data.put("token", token);
//设置token 和过期时间
// CookieInfo loginCookie = CookieService.getLoginCookie(request);
//CookieInfo loginCookie = CookieService.getLoginCookie(request);
// if(!ObjectUtils.isEmpty(loginCookie)){
//
// }
......@@ -238,7 +239,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
@RequestMapping("parseToken")
public String parseToken() throws Exception {
UserEntity userEntity = authTokenService.getLoginUser(request);
UserEntity userEntity = (UserEntity)authTokenService.getLoginUser(request);
if (!ObjectUtils.isEmpty(userEntity)) {
authTokenService.verifyToken(userEntity);
return JSON.toJSONString(userEntity);
......
......@@ -112,11 +112,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
public UserEntity findByLoginName(String loginName) {
UserQuery params = new UserQuery();
params.setLoginName(loginName);
List<UserEntity> userList = super.dao.getList(params);
if (userList != null && userList.size() > 0) {
return userList.get(0);
}
return null;
return this.selectOne(params);
}
@Override
......
......@@ -67,6 +67,7 @@ token:
secret: abcd1234
# 令牌有效期(默认60分钟)
expireTime: 60
prefix: Bearer
# 防止XSS攻击
xss:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment