|
|
@ -3,7 +3,12 @@ package com.ruoyi.biemo.business.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.system.domain.SysGradeWeight;
|
|
|
|
import com.ruoyi.system.domain.SysGradeWeight;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScore;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScore;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScoreExample;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScoreExample;
|
|
|
@ -11,11 +16,16 @@ import com.ruoyi.system.domain.vo.ReportDto;
|
|
|
|
import com.ruoyi.system.domain.vo.TrainingScoreVo;
|
|
|
|
import com.ruoyi.system.domain.vo.TrainingScoreVo;
|
|
|
|
import com.ruoyi.system.mapper.SysGradeWeightMapper;
|
|
|
|
import com.ruoyi.system.mapper.SysGradeWeightMapper;
|
|
|
|
import com.ruoyi.system.mapper.SysTrainingScoreMapper;
|
|
|
|
import com.ruoyi.system.mapper.SysTrainingScoreMapper;
|
|
|
|
|
|
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
|
import com.ruoyi.system.service.ISysTrainingScoreService;
|
|
|
|
import com.ruoyi.system.service.ISysTrainingScoreService;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
@ -27,14 +37,17 @@ public class TrainingScoreController {
|
|
|
|
SysTrainingScoreMapper trainingScoreMapper;
|
|
|
|
SysTrainingScoreMapper trainingScoreMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
SysGradeWeightMapper gradeWeightMapper;
|
|
|
|
SysGradeWeightMapper gradeWeightMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
SysUserMapper sysUserMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/addScore")
|
|
|
|
@PostMapping("/addScore")
|
|
|
|
private void addScore(@RequestBody JSONObject jsonObject){
|
|
|
|
private void addScore(@RequestBody JSONObject jsonObject) {
|
|
|
|
String controlsName = jsonObject.getString("controlsName");
|
|
|
|
String controlsName = jsonObject.getString("controlsName");
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
//检查状态是否提交且变更的值是否有数据 如果返回值为false 则执行更新操作
|
|
|
|
//检查状态是否提交且变更的值是否有数据 如果返回值为false 则执行更新操作
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.checkStatusAndControlsName(userId, controlsName);
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.checkStatusAndControlsName(userId, controlsName);
|
|
|
|
if(sysTrainingScore!=null){
|
|
|
|
if (sysTrainingScore != null) {
|
|
|
|
//更新userid的进度和分数
|
|
|
|
//更新userid的进度和分数
|
|
|
|
sysTrainingScore.calculateDataScore();
|
|
|
|
sysTrainingScore.calculateDataScore();
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
@ -42,24 +55,24 @@ public class TrainingScoreController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/selectScore")
|
|
|
|
@PostMapping("/selectScore")
|
|
|
|
private TrainingScoreVo selectScore(@RequestBody JSONObject jsonObject){
|
|
|
|
private TrainingScoreVo selectScore(@RequestBody JSONObject jsonObject) {
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.selectByUserId(userId);
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.selectByUserId(userId);
|
|
|
|
TrainingScoreVo trainingScoreVo=new TrainingScoreVo(sysTrainingScore);
|
|
|
|
TrainingScoreVo trainingScoreVo = new TrainingScoreVo(sysTrainingScore);
|
|
|
|
return trainingScoreVo;
|
|
|
|
return trainingScoreVo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//一键审批
|
|
|
|
//一键审批
|
|
|
|
@PostMapping("/approvalAll")
|
|
|
|
@PostMapping("/approvalAll")
|
|
|
|
private String approvalAll(){
|
|
|
|
private String approvalAll() {
|
|
|
|
List<SysTrainingScore> trainingScoreList=trainingScoreService.selectAllReportContent();
|
|
|
|
List<SysTrainingScore> trainingScoreList = trainingScoreService.selectAllReportContent();
|
|
|
|
if (trainingScoreList.isEmpty()){
|
|
|
|
if (trainingScoreList.isEmpty()) {
|
|
|
|
return "没有可审批的数据";
|
|
|
|
return "没有可审批的数据";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < trainingScoreList.size(); i++) {
|
|
|
|
for (int i = 0; i < trainingScoreList.size(); i++) {
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreList.get(i);
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreList.get(i);
|
|
|
|
String reportContent = sysTrainingScore.getReportContent();
|
|
|
|
String reportContent = sysTrainingScore.getReportContent();
|
|
|
|
int wordCount = reportContent.replace(" ","").length(); // 获取文本的字数
|
|
|
|
int wordCount = reportContent.replace(" ", "").length(); // 获取文本的字数
|
|
|
|
|
|
|
|
|
|
|
|
int score;
|
|
|
|
int score;
|
|
|
|
if (wordCount <= 50) {
|
|
|
|
if (wordCount <= 50) {
|
|
|
@ -71,7 +84,7 @@ public class TrainingScoreController {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
score = 100; // 超过350字直接满分
|
|
|
|
score = 100; // 超过350字直接满分
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SysTrainingScore trainingScore=new SysTrainingScore();
|
|
|
|
SysTrainingScore trainingScore = new SysTrainingScore();
|
|
|
|
trainingScore.setId(sysTrainingScore.getId());
|
|
|
|
trainingScore.setId(sysTrainingScore.getId());
|
|
|
|
trainingScore.setTrainingReportScore(score);
|
|
|
|
trainingScore.setTrainingReportScore(score);
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(trainingScore);
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(trainingScore);
|
|
|
@ -79,7 +92,7 @@ public class TrainingScoreController {
|
|
|
|
return "审批完毕";
|
|
|
|
return "审批完毕";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//实训报告上传
|
|
|
|
//学生端实训报告上传
|
|
|
|
@PostMapping("/uploadReport")
|
|
|
|
@PostMapping("/uploadReport")
|
|
|
|
private AjaxResult uploadReport(@RequestParam("file") @RequestPart(name = "file") MultipartFile file,
|
|
|
|
private AjaxResult uploadReport(@RequestParam("file") @RequestPart(name = "file") MultipartFile file,
|
|
|
|
@RequestParam Long id,
|
|
|
|
@RequestParam Long id,
|
|
|
@ -87,24 +100,69 @@ public class TrainingScoreController {
|
|
|
|
return trainingScoreService.uploadReport(file, fileName, id);
|
|
|
|
return trainingScoreService.uploadReport(file, fileName, id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//实训报告提交
|
|
|
|
//学生端实训报告提交
|
|
|
|
@PostMapping("/submitReport")
|
|
|
|
@PostMapping("/submitReport")
|
|
|
|
public AjaxResult submitReport(@RequestParam String content,
|
|
|
|
public AjaxResult submitReport(@RequestParam String content,
|
|
|
|
@RequestParam Long userId) {
|
|
|
|
@RequestParam Long userId) {
|
|
|
|
return trainingScoreService.submitReport(content, userId);
|
|
|
|
return trainingScoreService.submitReport(content, userId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 老师端文件下载
|
|
|
|
|
|
|
|
@GetMapping("/downloadReport")
|
|
|
|
|
|
|
|
public AjaxResult downloadReport(@RequestParam HttpServletResponse response, @RequestParam Long id) {
|
|
|
|
|
|
|
|
return trainingScoreService.downloadReport(response, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 老师端按班级导出
|
|
|
|
|
|
|
|
@PostMapping("/exportByClass")
|
|
|
|
|
|
|
|
public void exportByClass(HttpServletResponse response, String className) {
|
|
|
|
|
|
|
|
// 根据班级名称查询对应的用户列表
|
|
|
|
|
|
|
|
List<SysUser> userList = sysUserMapper.selectClassStuNumberNameByClass(className);
|
|
|
|
|
|
|
|
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
|
|
|
|
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExample(trainingScoreExample);
|
|
|
|
|
|
|
|
List<ReportDto> reportDtoList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (!userList.isEmpty()) {
|
|
|
|
|
|
|
|
for (SysUser sysUser : userList) {
|
|
|
|
|
|
|
|
if (!sysTrainingScores.isEmpty()) {
|
|
|
|
|
|
|
|
for (SysTrainingScore sysTrainingScore : sysTrainingScores) {
|
|
|
|
|
|
|
|
ReportDto reportDto = new ReportDto();
|
|
|
|
|
|
|
|
reportDto.setFileName(sysTrainingScore.getReportFilename());
|
|
|
|
|
|
|
|
if (sysTrainingScore.getReportSubmissionScore() == null) {
|
|
|
|
|
|
|
|
reportDto.setReportSubmissionScore(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysTrainingScore.getTrainingOperationScore() == null) {
|
|
|
|
|
|
|
|
reportDto.setTrainingOperationScore(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
reportDto.setReportSubmissionScore(sysTrainingScore.getReportSubmissionScore());
|
|
|
|
|
|
|
|
reportDto.setTrainingOperationScore(sysTrainingScore.getTrainingOperationScore());
|
|
|
|
|
|
|
|
reportDto.setScoreTotal(sysTrainingScore.getTotalscore());
|
|
|
|
|
|
|
|
reportDto.setName(sysUser.getUserName());
|
|
|
|
|
|
|
|
reportDto.setStuClass(sysUser.getStuClass());
|
|
|
|
|
|
|
|
reportDto.setStuNumber(sysUser.getStudentNumber());
|
|
|
|
|
|
|
|
reportDtoList.add(reportDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 创建Excel工具类实例,指定Excel中需要导出的字段与对应的实体类属性
|
|
|
|
|
|
|
|
ExcelUtil<ReportDto> util = new ExcelUtil<>(ReportDto.class);
|
|
|
|
|
|
|
|
// 导出Excel文件
|
|
|
|
|
|
|
|
util.exportExcel(response, reportDtoList, "班级数据");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 老师端报告提交页面查询
|
|
|
|
// 老师端报告提交页面查询
|
|
|
|
@GetMapping("/teacherGetReport")
|
|
|
|
@GetMapping("/teacherGetReport")
|
|
|
|
public PageInfo<ReportDto> getReport(@RequestParam Integer index, @RequestParam Integer size,
|
|
|
|
public PageInfo<ReportDto> getReport(@RequestParam Integer index, @RequestParam Integer size,
|
|
|
|
@RequestParam(required = false) Double operatorWeight,
|
|
|
|
@RequestParam(required = false) Double operatorWeight,
|
|
|
|
@RequestParam(required = false) Double reportWeight,
|
|
|
|
@RequestParam(required = false) Double reportWeight,
|
|
|
|
@RequestParam(required = false) String keyWord,
|
|
|
|
@RequestParam(required = false) String keyWord,
|
|
|
|
@RequestParam(required = false) String stuClass
|
|
|
|
@RequestParam(required = false) String stuClass) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
return trainingScoreService.teacherGetReport(index, size, reportWeight, operatorWeight, keyWord, stuClass);
|
|
|
|
return trainingScoreService.teacherGetReport(index, size, reportWeight, operatorWeight, keyWord, stuClass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 老师端下拉查询班级
|
|
|
|
// 老师端下拉查询班级
|
|
|
|
@GetMapping("/selectClass")
|
|
|
|
@GetMapping("/selectClass")
|
|
|
|
public List<String> selectClass() {
|
|
|
|
public List<String> selectClass() {
|
|
|
@ -114,7 +172,9 @@ public class TrainingScoreController {
|
|
|
|
|
|
|
|
|
|
|
|
// 老师端报告评分
|
|
|
|
// 老师端报告评分
|
|
|
|
@PostMapping("/reportGrade")
|
|
|
|
@PostMapping("/reportGrade")
|
|
|
|
public void reportGrade(@RequestParam int reportScore, @RequestParam Long userId) {
|
|
|
|
public void reportGrade(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
|
|
|
Integer reportScore = jsonObject.getInteger("reportScore");
|
|
|
|
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
|
|
|
|
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
|
|
|
|
trainingScoreExample.createCriteria().andUseridEqualTo(userId);
|
|
|
|
trainingScoreExample.createCriteria().andUseridEqualTo(userId);
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExample(trainingScoreExample);
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExample(trainingScoreExample);
|
|
|
@ -140,4 +200,6 @@ public class TrainingScoreController {
|
|
|
|
public SysGradeWeight getWeight() {
|
|
|
|
public SysGradeWeight getWeight() {
|
|
|
|
return gradeWeightMapper.selectByPrimaryKey(1L);
|
|
|
|
return gradeWeightMapper.selectByPrimaryKey(1L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|