Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from opendx/0.7.8
Browse files Browse the repository at this point in the history
0.7.8
  • Loading branch information
jiangyitao authored Oct 2, 2020
2 parents 1a9b84c + c132051 commit 47f2a3a
Show file tree
Hide file tree
Showing 56 changed files with 1,358 additions and 1,235 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.daxiang</groupId>
<artifactId>server</artifactId>
<version>0.7.7</version>
<version>0.7.8</version>
<packaging>jar</packaging>

<properties>
Expand Down
28 changes: 21 additions & 7 deletions src/main/java/com/daxiang/controller/ActionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import com.daxiang.mbg.po.Action;
import com.daxiang.model.PageRequest;
import com.daxiang.model.PagedData;
import com.daxiang.model.Response;
import com.daxiang.model.dto.ActionTreeNode;
import com.daxiang.model.request.ActionDebugRequest;
import com.daxiang.model.vo.ActionVo;
import com.daxiang.service.ActionService;
import com.daxiang.validator.group.SaveActionGroup;
import com.daxiang.validator.group.UpdateGroup;
Expand All @@ -27,32 +30,43 @@ public class ActionController {

@PostMapping("/add")
public Response add(@RequestBody @Validated({SaveActionGroup.class}) Action action) {
return actionService.add(action);
actionService.add(action);
return Response.success("添加成功");
}

@PostMapping("/resetBasicAction")
public Response resetBasicAction(@RequestBody List<Action> actions) {
return actionService.resetBasicAction(actions);
actionService.resetBasicAction(actions);
return Response.success();
}

@DeleteMapping("/{actionId}")
public Response delete(@PathVariable Integer actionId) {
return actionService.delete(actionId);
actionService.delete(actionId);
return Response.success("删除成功");
}

@PostMapping("/update")
public Response update(@RequestBody @Validated({SaveActionGroup.class, UpdateGroup.class}) Action action) {
return actionService.update(action);
actionService.update(action);
return Response.success("更新成功");
}

@PostMapping("/list")
public Response list(Action action, PageRequest pageRequest) {
return actionService.list(action, pageRequest);
public Response list(Action query, String orderBy, PageRequest pageRequest) {
if (pageRequest.needPaging()) {
PagedData<ActionVo> pagedData = actionService.list(query, orderBy, pageRequest);
return Response.success(pagedData);
} else {
List<ActionVo> actionVos = actionService.getActionVos(query, orderBy);
return Response.success(actionVos);
}
}

@GetMapping("/cascader")
public Response cascader(Integer projectId, Integer platform, Integer type) {
return actionService.cascader(projectId, platform, type);
List<ActionTreeNode> tree = actionService.cascader(projectId, platform, type);
return Response.success(tree);
}

@PostMapping("/debug")
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/daxiang/controller/AgentController.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.daxiang.controller;

import com.daxiang.model.Response;
import com.daxiang.model.vo.AgentVo;
import com.daxiang.service.AgentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
* Created by jiangyitao.
Expand All @@ -18,14 +21,10 @@ public class AgentController {
@Autowired
private AgentService agentService;

/**
* 获取当前在线的agent信息
*
* @return
*/
@GetMapping("/online")
public Response getOnlineAgents() {
return agentService.getOnlineAgents();
List<AgentVo> agents = agentService.getOnlineAgents();
return Response.success(agents);
}

}
26 changes: 20 additions & 6 deletions src/main/java/com/daxiang/controller/AppController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import com.daxiang.mbg.po.App;
import com.daxiang.model.PageRequest;
import com.daxiang.model.PagedData;
import com.daxiang.model.Response;
import com.daxiang.model.vo.AppVo;
import com.daxiang.service.AppService;
import com.daxiang.validator.group.UpdateGroup;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -11,6 +13,7 @@
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.util.List;

/**
* Created by jiangyitao.
Expand All @@ -24,26 +27,37 @@ public class AppController {

@PostMapping("/upload")
public Response upload(@Valid App app, MultipartFile file) {
return appService.upload(app, file);
appService.upload(app, file);
return Response.success("上传成功");
}

@DeleteMapping("/{appId}")
public Response delete(@PathVariable Integer appId) {
return appService.delete(appId);
appService.delete(appId);
return Response.success("删除成功");
}

@PostMapping("/update")
public Response update(@Validated({UpdateGroup.class}) @RequestBody App app) {
return appService.update(app);
appService.update(app);
return Response.success("更新成功");
}

@PostMapping("/list")
public Response list(App app, PageRequest pageRequest) {
return appService.list(app, pageRequest);
public Response list(App query, String orderBy, PageRequest pageRequest) {
if (pageRequest.needPaging()) {
PagedData<AppVo> pagedData = appService.list(query, orderBy, pageRequest);
return Response.success(pagedData);
} else {
List<AppVo> appVos = appService.getAppVos(query, orderBy);
return Response.success(appVos);
}
}

@GetMapping("/{appId}/aaptDumpBadging")
public Response aaptDumpBadging(@PathVariable Integer appId) {
return appService.aaptDumpBadging(appId);
appService.aaptDumpBadging(appId);
return Response.success("获取成功");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ public class ApplicationController {
public Response version() {
return Response.success(ImmutableMap.of("version", version));
}

}
23 changes: 17 additions & 6 deletions src/main/java/com/daxiang/controller/BrowserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import com.daxiang.mbg.po.Browser;
import com.daxiang.model.PageRequest;
import com.daxiang.model.PagedData;
import com.daxiang.model.Response;
import com.daxiang.service.BrowserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* Created by jiangyitao.
Expand All @@ -21,22 +23,31 @@ public class BrowserController {

@PostMapping("/save")
public Response save(@RequestBody @Valid Browser browser) {
return browserService.save(browser);
browserService.save(browser);
return Response.success("保存成功");
}

@PostMapping("/list")
public Response list(Browser browser, PageRequest pageRequest) {
return browserService.list(browser, pageRequest);
public Response list(Browser query, String orderBy, PageRequest pageRequest) {
if (pageRequest.needPaging()) {
PagedData<Browser> pagedData = browserService.list(query, orderBy, pageRequest);
return Response.success(pagedData);
} else {
List<Browser> browsers = browserService.getBrowsers(query, orderBy);
return Response.success(browsers);
}
}

@GetMapping("/{browserId}/start")
public Response start(@PathVariable String browserId) {
return browserService.start(browserId);
Browser browser = browserService.start(browserId);
return Response.success(browser);
}

@GetMapping("/online")
public Response getOnlineBrowsers() {
return browserService.getOnlineBrowsers();
List<Browser> onlineBrowsers = browserService.getOnlineBrowsers();
return Response.success(onlineBrowsers);
}

}
}
28 changes: 21 additions & 7 deletions src/main/java/com/daxiang/controller/CategoryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

import com.daxiang.mbg.po.Category;
import com.daxiang.model.PageRequest;
import com.daxiang.model.PagedData;
import com.daxiang.model.Response;
import com.daxiang.model.vo.CategoryVo;
import com.daxiang.service.CategoryService;
import com.daxiang.utils.Tree;
import com.daxiang.validator.group.UpdateGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* Created by jiangyitao.
Expand All @@ -23,27 +27,37 @@ public class CategoryController {

@PostMapping("/add")
public Response add(@RequestBody @Valid Category category) {
return categoryService.add(category);
categoryService.add(category);
return Response.success("添加成功");
}

@DeleteMapping("/{categoryId}/type/{type}/project/{projectId}")
public Response delete(@PathVariable Integer categoryId, @PathVariable Integer type, @PathVariable Integer projectId) {
return categoryService.delete(categoryId, type, projectId);
categoryService.delete(categoryId, type, projectId);
return Response.success("删除成功");
}

@PostMapping("/update")
public Response update(@RequestBody @Validated({UpdateGroup.class}) Category category) {
return categoryService.update(category);
categoryService.update(category);
return Response.success("更新成功");
}

@PostMapping("/list")
public Response list(Category category, PageRequest pageRequest) {
return categoryService.list(category, pageRequest);
public Response list(Category query, String orderBy, PageRequest pageRequest) {
if (pageRequest.needPaging()) {
PagedData<CategoryVo> pagedData = categoryService.list(query, orderBy, pageRequest);
return Response.success(pagedData);
} else {
List<CategoryVo> categoryVos = categoryService.getCategoryVos(query, orderBy);
return Response.success(categoryVos);
}
}

@GetMapping("/tree")
public Response getCategoryTree(Integer projectId, Integer type) {
return categoryService.getCategoryTreeByProjectIdAndType(projectId, type);
List<Tree.TreeNode> tree = categoryService.getCategoryTreeByProjectIdAndType(projectId, type);
return Response.success(tree);
}

}
}
43 changes: 23 additions & 20 deletions src/main/java/com/daxiang/controller/DeviceTestTaskController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

import com.daxiang.model.PageRequest;
import com.daxiang.mbg.po.DeviceTestTask;
import com.daxiang.model.PagedData;
import com.daxiang.model.Response;
import com.daxiang.model.dto.Testcase;
import com.daxiang.service.DeviceTestTaskService;
import com.daxiang.validator.group.UpdateGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* Created by jiangyitao.
*/
Expand All @@ -19,40 +24,38 @@ public class DeviceTestTaskController {
private DeviceTestTaskService deviceTestTaskService;

@PostMapping("/update")
public Response update(@RequestBody DeviceTestTask deviceTestTask) {
return deviceTestTaskService.update(deviceTestTask);
public Response update(@RequestBody @Validated({UpdateGroup.class}) DeviceTestTask deviceTestTask) {
deviceTestTaskService.update(deviceTestTask);
return Response.success("更新成功");
}

@PostMapping("/list")
public Response list(DeviceTestTask testTaskDevice, PageRequest pageRequest) {
return deviceTestTaskService.list(testTaskDevice, pageRequest);
public Response list(DeviceTestTask query, String orderBy, PageRequest pageRequest) {
if (pageRequest.needPaging()) {
PagedData<DeviceTestTask> pagedData = deviceTestTaskService.list(query, orderBy, pageRequest);
return Response.success(pagedData);
} else {
List<DeviceTestTask> deviceTestTasks = deviceTestTaskService.getDeviceTestTasks(query, orderBy);
return Response.success(deviceTestTasks);
}
}

/**
* 更新device的测试用例运行信息
*
* @param deviceTestTaskId
* @param testcase
* @return
*/
@PostMapping("/{deviceTestTaskId}/updateTestcase")
public Response updateTestcase(@PathVariable Integer deviceTestTaskId, @RequestBody Testcase testcase) {
return deviceTestTaskService.updateTestcase(deviceTestTaskId, testcase);
deviceTestTaskService.updateTestcase(deviceTestTaskId, testcase);
return Response.success("更新成功");
}

/**
* 通过deviceId查询未开始的测试任务(最开始的一条)
*
* @return
*/
@GetMapping("/firstUnStart/device/{deviceId}")
public Response getFirstUnStartDeviceTestTask(@PathVariable String deviceId) {
return deviceTestTaskService.getFirstUnStartDeviceTestTask(deviceId);
DeviceTestTask deviceTestTask = deviceTestTaskService.getFirstUnStartDeviceTestTask(deviceId);
return Response.success(deviceTestTask);
}

@DeleteMapping("/{deviceTestTaskId}")
public Response delete(@PathVariable Integer deviceTestTaskId) {
return deviceTestTaskService.delete(deviceTestTaskId);
deviceTestTaskService.delete(deviceTestTaskId);
return Response.success("删除成功");
}

}
}
Loading

0 comments on commit 47f2a3a

Please sign in to comment.