refactor(消息管理): 修改机器人获取列表接口
This commit is contained in:
parent
1a9d36534a
commit
58966bda2f
|
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Tag(name = "项目管理-项目与权限-消息管理-机器人")
|
@Tag(name = "项目管理-消息管理-机器人")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/project/robot/")
|
@RequestMapping("/project/robot/")
|
||||||
public class ProjectRobotController {
|
public class ProjectRobotController {
|
||||||
|
@ -27,15 +27,15 @@ public class ProjectRobotController {
|
||||||
private ProjectRobotService projectRobotService;
|
private ProjectRobotService projectRobotService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/list/{projectId}")
|
@GetMapping("/list/{projectId}")
|
||||||
@Operation(summary = "项目管理-项目与权限-消息管理-获取机器人列表")
|
@Operation(summary = "项目管理-消息管理-获取机器人列表")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ)
|
||||||
public List<ProjectRobot> listResourcePools(@PathVariable(value = "projectId") String projectId) {
|
public List<ProjectRobot> listResourcePools(@PathVariable(value = "projectId") String projectId) {
|
||||||
return projectRobotService.getList(projectId);
|
return projectRobotService.getList(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("add")
|
@PostMapping("add")
|
||||||
@Operation(summary = "项目管理-项目与权限-消息管理-新增机器人")
|
@Operation(summary = "项目管理-消息管理-新增机器人")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_ADD)
|
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_ADD)
|
||||||
public void add(@Validated({Created.class}) @RequestBody ProjectRobotDTO projectRobotDTO) {
|
public void add(@Validated({Created.class}) @RequestBody ProjectRobotDTO projectRobotDTO) {
|
||||||
ProjectRobot projectRobot = new ProjectRobot();
|
ProjectRobot projectRobot = new ProjectRobot();
|
||||||
|
@ -48,7 +48,7 @@ public class ProjectRobotController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("update")
|
@PostMapping("update")
|
||||||
@Operation(summary = "项目管理-项目与权限-消息管理-更新机器人")
|
@Operation(summary = "项目管理-消息管理-更新机器人")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_UPDATE)
|
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_UPDATE)
|
||||||
public void update(@Validated({Updated.class}) @RequestBody ProjectRobotDTO projectRobotDTO) {
|
public void update(@Validated({Updated.class}) @RequestBody ProjectRobotDTO projectRobotDTO) {
|
||||||
ProjectRobot projectRobot = new ProjectRobot();
|
ProjectRobot projectRobot = new ProjectRobot();
|
||||||
|
@ -61,21 +61,21 @@ public class ProjectRobotController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("get/{id}")
|
@GetMapping("get/{id}")
|
||||||
@Operation(summary = "项目管理-项目与权限-消息管理-获取机器人详情")
|
@Operation(summary = "项目管理-消息管理-获取机器人详情")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ)
|
||||||
public ProjectRobotDTO getDetail(@PathVariable(value = "id") String id) {
|
public ProjectRobotDTO getDetail(@PathVariable(value = "id") String id) {
|
||||||
return projectRobotService.getDetail(id);
|
return projectRobotService.getDetail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("delete/{id}")
|
@GetMapping("delete/{id}")
|
||||||
@Operation(summary = "项目管理-项目与权限-消息管理-删除机器人")
|
@Operation(summary = "项目管理-消息管理-删除机器人")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_DELETE)
|
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_DELETE)
|
||||||
public void delete(@PathVariable(value = "id") String id) {
|
public void delete(@PathVariable(value = "id") String id) {
|
||||||
projectRobotService.delete(id);
|
projectRobotService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("enable/{id}")
|
@GetMapping("enable/{id}")
|
||||||
@Operation(summary = "项目管理-项目与权限-消息管理-禁用机器人")
|
@Operation(summary = "项目管理-消息管理-启禁用机器人")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_UPDATE)
|
@RequiresPermissions(PermissionConstants.PROJECT_MESSAGE_READ_UPDATE)
|
||||||
public void enable(@PathVariable(value = "id") String id) {
|
public void enable(@PathVariable(value = "id") String id) {
|
||||||
projectRobotService.enable(id, SessionUtils.getUserId(), System.currentTimeMillis());
|
projectRobotService.enable(id, SessionUtils.getUserId(), System.currentTimeMillis());
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class CleanupRobotResourceTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProjectRobot> getList() throws Exception {
|
private List<ProjectRobot> getList() throws Exception {
|
||||||
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(ROBOT_LIST + "test")
|
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(ROBOT_LIST + "test")
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class CreateRobotResourceTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProjectRobot> getList() throws Exception {
|
private List<ProjectRobot> getList() throws Exception {
|
||||||
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(ROBOT_LIST + "test")
|
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(ROBOT_LIST + "test")
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|
|
@ -363,7 +363,7 @@ public class ProjectRobotControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProjectRobot> getList(String projectId) throws Exception {
|
private List<ProjectRobot> getList(String projectId) throws Exception {
|
||||||
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(ROBOT_LIST + projectId)
|
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(ROBOT_LIST + projectId)
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|
Loading…
Reference in New Issue