|
|
|
@ -46,12 +46,12 @@ public class TrainingScoreController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/addScore")
|
|
|
|
|
private void addScore(@RequestBody JSONObject jsonObject){
|
|
|
|
|
private void addScore(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
String controlsName = jsonObject.getString("controlsName");
|
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
|
//检查状态是否提交且变更的值是否有数据 如果返回值为false 则执行更新操作
|
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.checkStatusAndControlsName(userId, controlsName);
|
|
|
|
|
if(sysTrainingScore!=null){
|
|
|
|
|
if (sysTrainingScore != null) {
|
|
|
|
|
//更新userid的进度和分数
|
|
|
|
|
sysTrainingScore.calculateDataScore();
|
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(sysTrainingScore);
|
|
|
|
@ -60,23 +60,23 @@ public class TrainingScoreController {
|
|
|
|
|
|
|
|
|
|
//查询实训进度
|
|
|
|
|
@PostMapping("/selectScore")
|
|
|
|
|
private List selectScore(@RequestBody JSONObject jsonObject){
|
|
|
|
|
private List selectScore(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.selectByUserId(userId);
|
|
|
|
|
TrainingScoreVo trainingScoreVo=new TrainingScoreVo(sysTrainingScore);
|
|
|
|
|
TrainingScoreVo trainingScoreVo = new TrainingScoreVo(sysTrainingScore);
|
|
|
|
|
List<Map> list = trainingScoreVo.ReturnTrainingScore(trainingScoreVo);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询实训成绩
|
|
|
|
|
@PostMapping("/selectTotalScore")
|
|
|
|
|
private List selectTotalScore(@RequestBody JSONObject jsonObject){
|
|
|
|
|
private List selectTotalScore(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.selectByUserId(userId);
|
|
|
|
|
if ("".equals(sysTrainingScore.getTrainingReportScore()) || sysTrainingScore.getTrainingReportScore()==null){
|
|
|
|
|
if ("".equals(sysTrainingScore.getTrainingReportScore()) || sysTrainingScore.getTrainingReportScore() == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
TrainingTotalScoreVo totalScoreVo=new TrainingTotalScoreVo(sysTrainingScore);
|
|
|
|
|
TrainingTotalScoreVo totalScoreVo = new TrainingTotalScoreVo(sysTrainingScore);
|
|
|
|
|
totalScoreVo.setTotalscore(sysTrainingScore.getTotalscore());
|
|
|
|
|
totalScoreVo.setTrainingReportScore(sysTrainingScore.getTrainingReportScore());
|
|
|
|
|
List<Map> list = totalScoreVo.ReturnTrainingTotalScore(totalScoreVo);
|
|
|
|
@ -85,7 +85,7 @@ public class TrainingScoreController {
|
|
|
|
|
|
|
|
|
|
//重新实训
|
|
|
|
|
@PostMapping("/restartTraining")
|
|
|
|
|
private String restartTraining(@RequestBody JSONObject jsonObject){
|
|
|
|
|
private String restartTraining(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
|
trainingScoreService.deleteByUserId(userId);
|
|
|
|
|
trainingScoreService.insertByUserId(userId);
|
|
|
|
@ -101,8 +101,11 @@ public class TrainingScoreController {
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < trainingScoreList.size(); i++) {
|
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreList.get(i);
|
|
|
|
|
if (sysTrainingScore.getReportContent()==null){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String reportContent = sysTrainingScore.getReportContent();
|
|
|
|
|
int wordCount = reportContent.replace(" ","").length(); // 获取文本的字数
|
|
|
|
|
int wordCount = reportContent.replace(" ", "").length(); // 获取文本的字数
|
|
|
|
|
|
|
|
|
|
int score;
|
|
|
|
|
if (wordCount <= 50) {
|
|
|
|
@ -114,7 +117,7 @@ public class TrainingScoreController {
|
|
|
|
|
} else {
|
|
|
|
|
score = 100; // 超过350字直接满分
|
|
|
|
|
}
|
|
|
|
|
SysTrainingScore trainingScore=new SysTrainingScore();
|
|
|
|
|
SysTrainingScore trainingScore = new SysTrainingScore();
|
|
|
|
|
trainingScore.setId(sysTrainingScore.getId());
|
|
|
|
|
trainingScore.setTrainingReportScore(score);
|
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(trainingScore);
|
|
|
|
@ -140,20 +143,20 @@ public class TrainingScoreController {
|
|
|
|
|
|
|
|
|
|
//学生端实验报告回显
|
|
|
|
|
@GetMapping("/getSubmitAndSaveReport")
|
|
|
|
|
public AjaxResult getSubmitAndSaveReport(@RequestParam Long userId){
|
|
|
|
|
public String getSubmitAndSaveReport(@RequestParam Long userId) {
|
|
|
|
|
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
|
|
|
|
|
trainingScoreExample.createCriteria().andUseridEqualTo(userId);
|
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExample(trainingScoreExample);
|
|
|
|
|
if (!sysTrainingScores.isEmpty()){
|
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExampleWithBLOBs(trainingScoreExample);
|
|
|
|
|
if (!sysTrainingScores.isEmpty()) {
|
|
|
|
|
SysTrainingScore sysTrainingScore = sysTrainingScores.get(0);
|
|
|
|
|
return AjaxResult.success(sysTrainingScore.getReportContent());
|
|
|
|
|
return sysTrainingScore.getReportContent();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 老师端文件下载
|
|
|
|
|
@GetMapping("/downloadReport")
|
|
|
|
|
public AjaxResult downloadReport(@RequestParam Long id,HttpServletResponse response) {
|
|
|
|
|
public AjaxResult downloadReport(@RequestParam Long id, HttpServletResponse response) {
|
|
|
|
|
return trainingScoreService.downloadReport(response, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -170,27 +173,23 @@ public class TrainingScoreController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 老师端按班级导出
|
|
|
|
|
@PostMapping("/exportByClass")
|
|
|
|
|
public void exportByClass(HttpServletResponse response,@RequestBody String className) {
|
|
|
|
|
@GetMapping("/exportByClass")
|
|
|
|
|
public void exportByClass(HttpServletResponse response, @RequestParam 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) {
|
|
|
|
|
for (SysUser sysUser : userList) {
|
|
|
|
|
if (sysUser.getUserId().equals(sysTrainingScore.getUserid())) {
|
|
|
|
|
ReportDto reportDto = new ReportDto();
|
|
|
|
|
reportDto.setFileName(sysTrainingScore.getReportFilename());
|
|
|
|
|
if (sysTrainingScore.getReportSubmissionScore() == null) {
|
|
|
|
|
reportDto.setTrainingReportScore(0.0);
|
|
|
|
|
}
|
|
|
|
|
if (sysTrainingScore.getTrainingOperationScore() == null) {
|
|
|
|
|
reportDto.setTrainingOperationScore(0.0);
|
|
|
|
|
}
|
|
|
|
|
reportDto.setTrainingReportScore(sysTrainingScore.getTrainingReportScore().doubleValue());
|
|
|
|
|
reportDto.setTrainingOperationScore(sysTrainingScore.getTrainingOperationScore().doubleValue());
|
|
|
|
|
reportDto.setTrainingReportScore(sysTrainingScore.getTrainingReportScore() == null ? 0.0 :
|
|
|
|
|
sysTrainingScore.getTrainingReportScore().doubleValue());
|
|
|
|
|
reportDto.setTrainingOperationScore(sysTrainingScore.getTrainingOperationScore() == null ? 0.0 :
|
|
|
|
|
sysTrainingScore.getTrainingOperationScore().doubleValue());
|
|
|
|
|
reportDto.setScoreTotal(sysTrainingScore.getTotalscore());
|
|
|
|
|
reportDto.setName(sysUser.getUserName());
|
|
|
|
|
reportDto.setStuClass(sysUser.getStuClass());
|
|
|
|
@ -260,16 +259,16 @@ public class TrainingScoreController {
|
|
|
|
|
|
|
|
|
|
// 老师端右侧成绩(为经过权重计算)
|
|
|
|
|
@GetMapping("/getReportScore")
|
|
|
|
|
public Map<Long,Integer> getWeightReport(){
|
|
|
|
|
public Map<Long, Integer> getWeightReport() {
|
|
|
|
|
SysTrainingScoreExample trainingScoreExample = new SysTrainingScoreExample();
|
|
|
|
|
List<SysTrainingScore> sysTrainingScores = trainingScoreMapper.selectByExample(trainingScoreExample);
|
|
|
|
|
Map<Long,Integer> resultScores= new HashMap<>();
|
|
|
|
|
if (!sysTrainingScores.isEmpty()){
|
|
|
|
|
Map<Long, Integer> resultScores = new HashMap<>();
|
|
|
|
|
if (!sysTrainingScores.isEmpty()) {
|
|
|
|
|
for (SysTrainingScore sysTrainingScore : sysTrainingScores) {
|
|
|
|
|
if (sysTrainingScore.getTrainingReportScore() != null) {
|
|
|
|
|
Integer trainingReportScore = sysTrainingScore.getTrainingReportScore();
|
|
|
|
|
Long userid = sysTrainingScore.getUserid();
|
|
|
|
|
resultScores.put(userid,trainingReportScore);
|
|
|
|
|
resultScores.put(userid, trainingReportScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resultScores;
|
|
|
|
|