|
@@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
|
-import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -26,15 +25,15 @@ import java.util.List;
|
|
|
@Tag(name = "用户帐号页面")
|
|
@Tag(name = "用户帐号页面")
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/api/devops/account")
|
|
@RequestMapping("/api/devops/account")
|
|
|
-public class AccountPageController {
|
|
|
|
|
|
|
+public class AccountController {
|
|
|
private final AccountService accountService;
|
|
private final AccountService accountService;
|
|
|
private final AccountSessionService accountSessionService;
|
|
private final AccountSessionService accountSessionService;
|
|
|
private final UserMessageService userMessageService;
|
|
private final UserMessageService userMessageService;
|
|
|
private final LoginAttemptService loginAttemptService;
|
|
private final LoginAttemptService loginAttemptService;
|
|
|
private final int pageSize = 10;
|
|
private final int pageSize = 10;
|
|
|
|
|
|
|
|
- public AccountPageController(AccountService accountService, AccountSessionService accountSessionService,
|
|
|
|
|
- UserMessageService userMessageService, LoginAttemptService loginAttemptService) {
|
|
|
|
|
|
|
+ public AccountController(AccountService accountService, AccountSessionService accountSessionService,
|
|
|
|
|
+ UserMessageService userMessageService, LoginAttemptService loginAttemptService) {
|
|
|
this.accountService = accountService;
|
|
this.accountService = accountService;
|
|
|
this.accountSessionService = accountSessionService;
|
|
this.accountSessionService = accountSessionService;
|
|
|
this.userMessageService = userMessageService;
|
|
this.userMessageService = userMessageService;
|
|
@@ -42,7 +41,7 @@ public class AccountPageController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "修改帐号", description = "N")
|
|
@Operation(summary = "修改帐号", description = "N")
|
|
|
- @PostMapping(value = "/profile/update/username", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
|
|
|
+ @PostMapping(value = "/update/username", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String updateUsername(@Validated UpdateUsernameDto updateUsernameDto) {
|
|
public String updateUsername(@Validated UpdateUsernameDto updateUsernameDto) {
|
|
|
Result result = accountService.updateMyUsername(updateUsernameDto);
|
|
Result result = accountService.updateMyUsername(updateUsernameDto);
|
|
|
if (result.getCode() == ResultStatus.SUCCESS.getCode()) {
|
|
if (result.getCode() == ResultStatus.SUCCESS.getCode()) {
|
|
@@ -53,7 +52,7 @@ public class AccountPageController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Operation(summary = "修改密码", description = "N")
|
|
@Operation(summary = "修改密码", description = "N")
|
|
|
- @PostMapping(value = "/profile/update/passwd", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
|
|
|
+ @PostMapping(value = "/update/passwd", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String updatePasswd(@Validated UpdatePasswordDto updatePasswordDto) {
|
|
public String updatePasswd(@Validated UpdatePasswordDto updatePasswordDto) {
|
|
|
Result result = accountService.updateMyPassword(updatePasswordDto);
|
|
Result result = accountService.updateMyPassword(updatePasswordDto);
|
|
|
if (result.getCode() == ResultStatus.SUCCESS.getCode()) {
|
|
if (result.getCode() == ResultStatus.SUCCESS.getCode()) {
|
|
@@ -65,7 +64,7 @@ public class AccountPageController {
|
|
|
|
|
|
|
|
@Operation(summary = "帐号登入记录列表页面", description = "N")
|
|
@Operation(summary = "帐号登入记录列表页面", description = "N")
|
|
|
@GetMapping("/record")
|
|
@GetMapping("/record")
|
|
|
- public String loginRecordPage(Model model) {
|
|
|
|
|
|
|
+ public String loginRecordPage() {
|
|
|
List<LoginRecordInfo> list = loginAttemptService.getActiveLogin();
|
|
List<LoginRecordInfo> list = loginAttemptService.getActiveLogin();
|
|
|
return WebResult.success(list);
|
|
return WebResult.success(list);
|
|
|
}
|
|
}
|
|
@@ -93,17 +92,6 @@ public class AccountPageController {
|
|
|
return PageList.pageList(pageNumber, pageSize, (int) total, list);
|
|
return PageList.pageList(pageNumber, pageSize, (int) total, list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Operation(summary = "用户消息内容页面", description = "N")
|
|
|
|
|
- @GetMapping("/message/detail")
|
|
|
|
|
- public String messageDetail(@RequestParam("id") int id) {
|
|
|
|
|
- UserMessage userMessage = userMessageService.getMessage(id);
|
|
|
|
|
- String content = "";
|
|
|
|
|
- if (userMessage != null) {
|
|
|
|
|
- content = userMessage.getContent();
|
|
|
|
|
- }
|
|
|
|
|
- return WebResult.success(content);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Operation(summary = "删除用户所有消息", description = "N")
|
|
@Operation(summary = "删除用户所有消息", description = "N")
|
|
|
@PostMapping(value = "/message/clear", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
@PostMapping(value = "/message/clear", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String clearUserMessage() {
|
|
public String clearUserMessage() {
|