开发
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.delivery.framework.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 配送定位上报规则配置 */
|
||||
@Data
|
||||
@Component("locationReportProperties")
|
||||
@ConfigurationProperties(prefix = "delivery.location")
|
||||
public class LocationReportProperties {
|
||||
private long minPersistIntervalMs;
|
||||
private long stateTtlHours;
|
||||
private long lockSeconds;
|
||||
}
|
||||
@@ -32,6 +32,10 @@ public class ResourcesConfig implements WebMvcConfigurer
|
||||
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
|
||||
.addResourceLocations("file:" + DeliveryConfig.getProfile() + "/");
|
||||
|
||||
/** D:\delivery 的静态映射 */
|
||||
registry.addResourceHandler("/delivery/**")
|
||||
.addResourceLocations("file:D:/delivery/");
|
||||
|
||||
/** swagger配置 */
|
||||
registry.addResourceHandler("/swagger-ui/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
||||
|
||||
@@ -114,7 +114,14 @@ public class SecurityConfig
|
||||
requests.antMatchers(
|
||||
"/login",
|
||||
"/register",
|
||||
"/app/**",
|
||||
"/delivery/**",
|
||||
"/document/vehicle/**",
|
||||
"/document/type/**",
|
||||
"/document/location/**",
|
||||
"/document/mtd/**",
|
||||
"/document/info/**",
|
||||
"/delivery/location/**",
|
||||
"/document/attachment/**",
|
||||
"/document/order/**",
|
||||
// "/document/info/bill/groups",
|
||||
|
||||
@@ -173,4 +173,28 @@ public class SysLoginService
|
||||
{
|
||||
userService.updateLoginInfo(userId, IpUtils.getIpAddr(), DateUtils.getNowDate());
|
||||
}
|
||||
|
||||
public LoginUser loginWithoutCaptcha(String username, String password) {
|
||||
loginPreCheck(username, password);
|
||||
|
||||
Authentication authentication;
|
||||
|
||||
try {
|
||||
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
|
||||
|
||||
AuthenticationContextHolder.setContext(token);
|
||||
|
||||
authentication = authenticationManager.authenticate(token);
|
||||
}catch (Exception e){
|
||||
throw new ServiceException("登录失败");
|
||||
}finally {
|
||||
AuthenticationContextHolder.clearContext();
|
||||
}
|
||||
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
|
||||
return loginUser;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user