新增查看报告接口

pull/1/head
xiaoCJ 2 years ago
parent 464fc9256e
commit aa14b935bf

@ -1,28 +1,27 @@
package com.sztzjy.forex.trading_trading.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess;
import com.sztzjy.forex.trading_trading.annotation.Permission;
import com.sztzjy.forex.trading_trading.annotation.aspect.PermissionType;
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.ReportDto;
import com.sztzjy.forex.trading_trading.entity.ReportWithBLOBs;
import com.sztzjy.forex.trading_trading.mappers.ReportMapper;
import com.sztzjy.forex.trading_trading.service.MemberService;
import com.sztzjy.forex.trading_trading.service.ReportService;
import com.sztzjy.forex.trading_trading.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Api(tags = "实验报告")
@RestController
@ -32,7 +31,8 @@ public class ReportController {
private ReportService reportService;
@Autowired
private MemberService memberService;
@Autowired
private ReportMapper reportMapper;
@ApiOperation("学生端--上传实训报告")
@PostMapping("/uploadReport")
public ResultEntity uploadReport(@RequestParam("file") @RequestPart(name = "file") MultipartFile file,
@ -53,12 +53,18 @@ public class ReportController {
@GetMapping("/getReportDtos")
public ResultEntity<PageInfo<ReportDto>> getReportDtos(@ApiParam("学号") @RequestParam String studentNumber,
@ApiParam("学校") @RequestParam Integer schoolId,
@ApiParam("查询关键字") @RequestParam (required = false)String keyWord,
@ApiParam("查询关键字") @RequestParam(required = false) String keyWord,
@ApiParam("首页页码") @RequestParam Integer index,
@ApiParam("页面条数") @RequestParam Integer size) {
return new ResultEntity<>(reportService.gerReportDtos(studentNumber, schoolId, keyWord, index, size));
}
@ApiOperation("教师端--获取学生上传的报告")
@GetMapping("getReportById")
public ResultEntity<ReportWithBLOBs> getReportById(@RequestParam String id) {
return new ResultEntity<ReportWithBLOBs>(reportMapper.selectByPrimaryKey(id));
}
@ApiOperation("教师端--对实训报告评分")
@PostMapping("review")
@ -77,11 +83,11 @@ public class ReportController {
reportService.download(id, response);
}
@ApiOperation("教师端--获取学生上传的报告")
@GetMapping("getReportByMemberId")
public ResultEntity<ReportWithBLOBs> getReportByMemberId(@RequestParam String memberId
) {
public ResultEntity<ReportWithBLOBs> getReportByMemberId(@RequestParam String memberId) {
return new ResultEntity<>(reportService.findByMemberId(memberId));
}
}

@ -21,6 +21,6 @@ public class ReportDto {
private Date startTime;
@ApiModelProperty("实训结束日期")
private Date endTime;
// @ApiModelProperty("实验报告ID")
// private String reportID;
@ApiModelProperty("实验报告ID")
private String reportID;
}

@ -132,9 +132,11 @@ public class ReportService {
ReportDto reportDto = new ReportDto();
if (reports.isEmpty()) {
reportDto.setFileName(null);
reportDto.setReportID(null);
}
for (Report report : reports) {
reportDto.setFileName(report.getFileName());
reportDto.setReportID(report.getId());
}
Double reportScore = member.getReportScore();
if (keyWord != null && !keyWord.isEmpty()) {

Loading…
Cancel
Save