|
@@ -5,10 +5,9 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.mooctest.data.BugDTO;
|
|
import com.mooctest.data.BugDTO;
|
|
import com.mooctest.data.SimpleResponse;
|
|
import com.mooctest.data.SimpleResponse;
|
|
import com.mooctest.data.TaskDTO;
|
|
import com.mooctest.data.TaskDTO;
|
|
-import com.mooctest.model.BugData;
|
|
|
|
-import com.mooctest.model.MasterReport;
|
|
|
|
-import com.mooctest.model.Task;
|
|
|
|
|
|
+import com.mooctest.model.*;
|
|
import com.mooctest.service.*;
|
|
import com.mooctest.service.*;
|
|
|
|
+import com.mooctest.service.impl.ConfigurationService;
|
|
import com.mooctest.util.ImportDataMap;
|
|
import com.mooctest.util.ImportDataMap;
|
|
import com.mooctest.util.ReportUtil;
|
|
import com.mooctest.util.ReportUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -31,6 +30,9 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import static java.util.stream.Collectors.toMap;
|
|
import static java.util.stream.Collectors.toMap;
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 任务相关接口
|
|
|
|
+ */
|
|
@Controller
|
|
@Controller
|
|
public class TaskController {
|
|
public class TaskController {
|
|
|
|
|
|
@@ -48,9 +50,13 @@ public class TaskController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
BugDataService bugDataService;
|
|
BugDataService bugDataService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
JobService jobService;
|
|
JobService jobService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ ConfigurationService configurationService;
|
|
|
|
+
|
|
@Value("${report.host}")
|
|
@Value("${report.host}")
|
|
String reportHost;
|
|
String reportHost;
|
|
|
|
|
|
@@ -59,6 +65,11 @@ public class TaskController {
|
|
@Value("${urlPath}")
|
|
@Value("${urlPath}")
|
|
String urlPrefix;
|
|
String urlPrefix;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取任务列表 /crowdTask
|
|
|
|
+ * @param model
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@GetMapping("/crowdTask")
|
|
@GetMapping("/crowdTask")
|
|
public String home(Model model) {
|
|
public String home(Model model) {
|
|
// 获得所有taskDTO,包括本地和慕测端
|
|
// 获得所有taskDTO,包括本地和慕测端
|
|
@@ -155,7 +166,9 @@ public class TaskController {
|
|
|
|
|
|
// 从json中获得的task数据保存到TaskDTO中返回
|
|
// 从json中获得的task数据保存到TaskDTO中返回
|
|
TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
|
|
TaskDTO task = taskService.getByExamIdAndCaseId(examId, caseId);
|
|
|
|
+ // 返回服务序列号
|
|
String encodedUrl = taskService.getEncodeTaskReportUrl(examId, caseId) ;
|
|
String encodedUrl = taskService.getEncodeTaskReportUrl(examId, caseId) ;
|
|
|
|
+ // 返回大图信息
|
|
model.addAttribute("dtUrl",taskService.getTaskDaPanUrl(examId,caseId));
|
|
model.addAttribute("dtUrl",taskService.getTaskDaPanUrl(examId,caseId));
|
|
model.addAttribute("aggregated", aggregated);
|
|
model.addAttribute("aggregated", aggregated);
|
|
// allReport是ButDTO集合
|
|
// allReport是ButDTO集合
|
|
@@ -183,7 +196,15 @@ public class TaskController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 添加任务 /addCrowdTask
|
|
|
|
+ * @param name 任务名称
|
|
|
|
+ * @param description 任务描述
|
|
|
|
+ * @param os 任务的操作系统
|
|
|
|
+ * @param threePage 测试大纲表格
|
|
|
|
+ * @param model
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@PostMapping("/addCrowdTask")
|
|
@PostMapping("/addCrowdTask")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public SimpleResponse addCrowdTask2(@RequestParam("name")String name, @RequestParam("description")String description,
|
|
public SimpleResponse addCrowdTask2(@RequestParam("name")String name, @RequestParam("description")String description,
|
|
@@ -191,7 +212,28 @@ public class TaskController {
|
|
Model model){
|
|
Model model){
|
|
return taskService.addCrowdTask(name, description, os, threePage);
|
|
return taskService.addCrowdTask(name, description, os, threePage);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/addCrowdTaskDefault")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public SimpleResponse addCrowdTaskDefault(@RequestParam("name")String name, @RequestParam("description")String description,
|
|
|
|
+ @RequestParam("threePage") MultipartFile threePage){
|
|
|
|
+ Map<String, String> configurationMap = configurationService.getConfigurationMap();
|
|
|
|
+ String os = configurationMap.get("os");
|
|
|
|
+ // 后边generatePaperType方法中会根据;进行split
|
|
|
|
+ os = os.replaceAll(",", ";");
|
|
|
|
+
|
|
|
|
+ if(threePage ==null || threePage.isEmpty()) {
|
|
|
|
+ return new SimpleResponse(400,"请提交三级页面");
|
|
|
|
+ }
|
|
|
|
+ long caseId = taskService.addCrowdTaskDefault(name, description, os, threePage);
|
|
|
|
+ long examId = caseId;
|
|
|
|
+ // 返回服务序列号
|
|
|
|
+ String encodedUrl = taskService.getEncodeTaskReportUrl(examId, caseId);
|
|
|
|
+ encodedUrl = encodedUrl.replaceAll("%3D", "=");
|
|
|
|
+ // 返回大图url
|
|
|
|
+ String taskDaPanUrl = taskService.getTaskDaPanUrl(examId, caseId);
|
|
|
|
+ taskDaPanUrl = taskDaPanUrl.replaceAll("%3D", "=");
|
|
|
|
+ TaskExtend taskExtend = new TaskExtend(examId, caseId, encodedUrl, taskDaPanUrl);
|
|
|
|
+ return caseId != -1 ? new SimpleResponse(200,"创建成功", taskExtend) : new SimpleResponse(400,"创建失败");
|
|
|
|
+ }
|
|
}
|
|
}
|