guochao 5 éve
szülő
commit
24fd9c6c5b

+ 5 - 2
.idea/workspace.xml

@@ -2,7 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="c25ee83f-38b8-4a56-8a1f-62ecc8d6cec2" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/src/main/java/cn/iselab/mooctest/site/web/ctrl/UploadController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/iselab/mooctest/site/web/ctrl/UploadController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/cn/iselab/mooctest/site/service/impl/AutoReportProductServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/iselab/mooctest/site/service/impl/AutoReportProductServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/cn/iselab/mooctest/site/web/ctrl/HandleReportController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/iselab/mooctest/site/web/ctrl/HandleReportController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.yml" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -121,7 +124,7 @@
       <workItem from="1574148794239" duration="247000" />
       <workItem from="1574243622969" duration="17039000" />
       <workItem from="1574324790942" duration="17204000" />
-      <workItem from="1574392825833" duration="3599000" />
+      <workItem from="1574392825833" duration="5122000" />
     </task>
     <servers />
   </component>

+ 1 - 1
src/main/java/cn/iselab/mooctest/site/service/impl/AutoReportProductServiceImpl.java

@@ -83,7 +83,7 @@ public class AutoReportProductServiceImpl implements AutoReportProductService {
         long start = System.currentTimeMillis();
 
         String builderPath = copyReportBuilderToPath(orderId, reportType);
-        writeDataToJsonFile(new Gson().toJson(reportData), builderPath + REPORT_JSON_UPLOAD_PATH);
+        writeDataToJsonFile(new Gson().toJson(reportData), builderPath + "/" + reportType + REPORT_JSON_UPLOAD_PATH);
         System.out.println(builderPath + "/"+ reportType +"/");
         boolean bale = runBuilderToProductReport("npm run build", builderPath + "/"+ reportType +"/");
         String ossDownloadUrl;

+ 21 - 19
src/main/java/cn/iselab/mooctest/site/web/ctrl/HandleReportController.java

@@ -77,29 +77,31 @@ public class HandleReportController {
      * @return
      */
 //    @ResponseBody
-//    @RequestMapping(value = "/api/generate/report/order/{orderId}/owner/{ownerId}", method = RequestMethod.POST)
+//    @RequestMapping(value = "/api/report/generate/order/{orderId}/owner/{ownerId}/reportType/{reportType}", method = RequestMethod.POST)
 //    public Map handleReport(@PathVariable(value = "orderId") Long orderId,
-//                               @PathVariable(value = "ownerId") Long ownerId, @RequestBody VulReportDataVO vulReportDataVO) {
-    @ResponseBody
+//                            @PathVariable(value = "ownerId") Long ownerId,
+//                            @PathVariable(value = "reportType") String reportType) {
+//    @ResponseBody
     @RequestMapping(value = "/api/report/generate/order/{orderId}/owner/{ownerId}/reportType/{reportType}", method = RequestMethod.POST)
     public Map handleReport(@PathVariable(value = "orderId") Long orderId,
                             @PathVariable(value = "ownerId") Long ownerId,
-                            @PathVariable(value = "reportType") String reportType) {
-        List<String> menus = new ArrayList<>();
-        menus.add("APK扫描");
-        ProjectInfoVO projectInfoVO = new ProjectInfoVO();
-        projectInfoVO.setCostTime("2019/11/15");
-        projectInfoVO.setProjectName("途牛APP");
-        projectInfoVO.setStartTime(new Timestamp(new Date().getTime()));
-        projectInfoVO.setUserName("郭超");
-        List<VulnerabilityVo> vulnerabilityVos = new ArrayList<>();
-        VulStatisticsVO vulStatisticsVO = new VulStatisticsVO();
-
-        VulReportDataVO vulReportDataVO = new VulReportDataVO();
-        vulReportDataVO.setMenus(menus);
-        vulReportDataVO.setProjectInfo(projectInfoVO);
-        vulReportDataVO.setVulnerability(vulnerabilityVos);
-        vulReportDataVO.setVulStatistics(vulStatisticsVO);
+                            @PathVariable(value = "reportType") String reportType,
+                            @RequestBody VulReportDataVO vulReportDataVO) {
+//        List<String> menus = new ArrayList<>();
+//        menus.add("APK扫描");
+//        ProjectInfoVO projectInfoVO = new ProjectInfoVO();
+//        projectInfoVO.setCostTime("2019/11/15");
+//        projectInfoVO.setProjectName("途牛APP");
+//        projectInfoVO.setStartTime(new Timestamp(new Date().getTime()));
+//        projectInfoVO.setUserName("郭超");
+//        List<VulnerabilityVo> vulnerabilityVos = new ArrayList<>();
+//        VulStatisticsVO vulStatisticsVO = new VulStatisticsVO();
+//
+//        VulReportDataVO vulReportDataVO = new VulReportDataVO();
+//        vulReportDataVO.setMenus(menus);
+//        vulReportDataVO.setProjectInfo(projectInfoVO);
+//        vulReportDataVO.setVulnerability(vulnerabilityVos);
+//        vulReportDataVO.setVulStatistics(vulStatisticsVO);
 
         Future<String> stringFuture = autoReportProductService.generateReport(orderId, ownerId, vulReportDataVO, reportType);
         System.out.println(stringFuture.toString());

+ 2 - 2
src/main/resources/application.yml

@@ -62,7 +62,7 @@ order.autoReport.builder.copyPath: /Users/guochao/Desktop/project/enterprise-moo
 order.autoReport.service.path: /Users/guochao/Desktop/project/enterprise-mooctest-site/projects/mooctest-report-template/
 order.autoReport.service.template.path: /Users/guochao/Desktop/project/enterprise-mooctest-site/projects/mooctest-report-template/
 static.resource.autoReport.url: /reportFile/
-order.vulReport.json.upload.path: /static-scan-report/src/json/
+order.vulReport.json.upload.path: /src/json/
 host.ip: 106.14.81.62
 
 ---
@@ -78,5 +78,5 @@ order.autoReport.upload.path: /var/www/reportFile/
 order.autoReport.service.path: /root/mooctest-report-template/
 order.autoReport.service.template.path: /root/mooctest-report-template/
 order.autoReport.builder.copyPath: /var/www/reportBuilder/
-order.vulReport.json.upload.path: /static-scan-report/src/json/
+order.vulReport.json.upload.path: /src/json/
 host.ip: 106.14.81.62