|
|
@ -1,9 +1,14 @@
|
|
|
|
package com.sztzjy.forex.trading_trading.controller;
|
|
|
|
package com.sztzjy.forex.trading_trading.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess;
|
|
|
|
import com.sztzjy.forex.trading_trading.annotation.Permission;
|
|
|
|
import com.sztzjy.forex.trading_trading.annotation.Permission;
|
|
|
|
import com.sztzjy.forex.trading_trading.annotation.aspect.PermissionType;
|
|
|
|
import com.sztzjy.forex.trading_trading.annotation.aspect.PermissionType;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.config.security.JwtUser;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.config.security.TokenProvider;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.Member;
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.Report;
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.Report;
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.ReportWithBLOBs;
|
|
|
|
import com.sztzjy.forex.trading_trading.entity.ReportWithBLOBs;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.service.MemberService;
|
|
|
|
import com.sztzjy.forex.trading_trading.service.ReportService;
|
|
|
|
import com.sztzjy.forex.trading_trading.service.ReportService;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ResultEntity;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ResultEntity;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
@ -22,15 +27,19 @@ import java.io.IOException;
|
|
|
|
public class ReportController {
|
|
|
|
public class ReportController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ReportService reportService;
|
|
|
|
private ReportService reportService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MemberService memberService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("学生端--上传实训报告")
|
|
|
|
@PostMapping("/uploadReport")
|
|
|
|
@PostMapping("/uploadReport")
|
|
|
|
public ResultEntity<String> uploadReport(@RequestParam("file") MultipartFile file,
|
|
|
|
public ResultEntity uploadReport(@RequestParam("file")@RequestPart(name = "file") MultipartFile file,
|
|
|
|
@RequestParam String memberId,
|
|
|
|
@RequestParam String memberId,
|
|
|
|
@RequestParam String fileName,
|
|
|
|
@RequestParam String fileName) {
|
|
|
|
@RequestParam String tariningId) throws IOException {
|
|
|
|
Member member = memberService.selectByPrimaryKey(memberId);
|
|
|
|
return new ResultEntity<>(reportService.uploadReport(file.getInputStream(), fileName, memberId, tariningId));
|
|
|
|
reportService.uploadReport(file, fileName, member);
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("学生端--提交实训报告")
|
|
|
|
@PostMapping("/submitReport")
|
|
|
|
@PostMapping("/submitReport")
|
|
|
|
public ResultEntity<String> submitReport(@RequestBody ReportWithBLOBs report) {
|
|
|
|
public ResultEntity<String> submitReport(@RequestBody ReportWithBLOBs report) {
|
|
|
|
return new ResultEntity<>(reportService.submitReport(report));
|
|
|
|
return new ResultEntity<>(reportService.submitReport(report));
|
|
|
@ -46,9 +55,11 @@ public class ReportController {
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
@ApiOperation("教师端--实训报告下载")
|
|
|
|
@ApiOperation("教师端--实训报告下载")
|
|
|
|
@GetMapping("download")
|
|
|
|
@GetMapping("download")
|
|
|
|
public void download(@RequestParam String id, HttpServletResponse response) {
|
|
|
|
public void download(@RequestParam String id, String TOKEN,HttpServletResponse response) {
|
|
|
|
|
|
|
|
TokenProvider.getJWTUser(TOKEN);
|
|
|
|
reportService.download(id, response);
|
|
|
|
reportService.download(id, response);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|