浏览代码

Merge branch 'fix-144-score-result-save-path' into 'Test'

Fix 144 score result save path

保存在服务器上的文件路径修改

See merge request !1384

guochao 4 年之前
父节点
当前提交
d107f98862

+ 2 - 2
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/ctrl/CompetitionController.java

@@ -127,8 +127,8 @@ public class CompetitionController {
 
     // 导出当前比赛当前赛段的选手列表
     @RequiresRoles("admin")
-    @RequestMapping(value = UrlConstants.API + "/competition/particants")
-    public String getParticipantVO(@RequestParam("competitionId") long competitionId) throws Exception {
+    @RequestMapping(value = UrlConstants.API + "/competition/particants/{competitionId}")
+    public String getParticipantVO(@PathVariable("competitionId") long competitionId) throws Exception {
 
 
         List<ParticipantVO> participantVOS = competitionLogic.getCompetitionParticipants(competitionId, 1, 2000, "").getContent();

+ 5 - 5
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/impl/CompetitionLogicImpl.java

@@ -614,7 +614,7 @@ public class CompetitionLogicImpl implements CompetitionLogic {
     @Override
     public String getExcelPath(List<ParticipantVO> participantVOS) throws IOException {
         // 文件存储位置
-        String   savePath="D:\\excel1\\";
+        String   savePath="/var/www/download/excel";
 
         File savefile = new File(savePath);
         if (!savefile.exists()) {
@@ -623,14 +623,14 @@ public class CompetitionLogicImpl implements CompetitionLogic {
         //赛段名称
         String fileName = participantVOS.get(0).getContestName();
 
-        for (ParticipantVO participantVO : participantVOS) {
-            participantVO.setTeachers(participantVO.getTeachers());
-        }
+//        for (ParticipantVO participantVO : participantVOS) {
+//            participantVO.setTeachers(participantVO.getTeachers());
+//        }
         Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(fileName,fileName), ParticipantVO.class, participantVOS);
         FileOutputStream fos = new FileOutputStream(savePath +"/"+ fileName + ".xls");
         workbook.write(fos);
         fos.close();
-        return savePath + fileName + ".xls";
+        return "/download/excel/" + fileName + ".xls";
     }
 
 }