支持不同域的前后端分离部署

This commit is contained in:
648540858
2023-03-15 19:05:56 +08:00
parent 95688e400b
commit 5fab97cf7e
23 changed files with 226 additions and 155 deletions

View File

@@ -28,6 +28,10 @@ public class WVPResult<T> implements Cloneable{
return new WVPResult<>(ErrorCode.SUCCESS.getCode(), msg, t);
}
public static WVPResult success() {
return new WVPResult<>(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null);
}
public static <T> WVPResult<T> success(T t) {
return success(t, ErrorCode.SUCCESS.getMsg());
}

View File

@@ -31,7 +31,6 @@ import java.text.ParseException;
import java.util.UUID;
@Tag(name = "国标设备配置")
@RestController
@RequestMapping("/api/device/config")
public class DeviceConfig {

View File

@@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.ibatis.annotations.Options;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -97,8 +98,10 @@ public class DeviceQuery {
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@GetMapping("/devices")
@Options()
public PageInfo<Device> devices(int page, int count){
// if (page == null) page = 0;
// if (count == null) count = 20;
return storager.queryVideoDeviceList(page, count,null);
}

View File

@@ -23,7 +23,6 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
@@ -70,9 +69,6 @@ public class ServerController {
private int serverPort;
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
@Autowired
private IRedisCatchStorage redisCatchStorage;

View File

@@ -27,7 +27,6 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Tag(name = "用户管理")
@RestController
@RequestMapping("/api/user")
public class UserController {
@@ -47,7 +46,7 @@ public class UserController {
@Parameter(name = "username", description = "用户名", required = true)
@Parameter(name = "password", description = "密码32位md5加密", required = true)
public LoginUser login(HttpServletRequest request, HttpServletResponse response, @RequestParam String username, @RequestParam String password){
LoginUser user = null;
LoginUser user;
try {
user = SecurityUtils.login(username, password, authenticationManager);
} catch (AuthenticationException e) {
@@ -62,6 +61,25 @@ public class UserController {
return user;
}
// @GetMapping("/logout")
// @PostMapping("/logout")
// @Operation(summary = "登出")
// public LoginUser logout(){
// LoginUser user;
// try {
// user = SecurityUtils.login(username, password, authenticationManager);
// } catch (AuthenticationException e) {
// throw new ControllerException(ErrorCode.ERROR100.getCode(), e.getMessage());
// }
// if (user == null) {
// throw new ControllerException(ErrorCode.ERROR100.getCode(), "用户名或密码错误");
// }else {
// String jwt = JwtUtils.createToken(username, password);
// response.setHeader(JwtUtils.getHeader(), jwt);
// }
// return user;
// }
@PostMapping("/changePassword")
@Operation(summary = "修改密码")
@Parameter(name = "username", description = "用户名", required = true)