|
|
@ -1,17 +1,17 @@
|
|
|
|
package com.ruoyi.biemo.business.controller;
|
|
|
|
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.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.system.domain.SysGradeWeight;
|
|
|
|
import com.ruoyi.system.domain.SysGradeWeight;
|
|
|
|
import com.ruoyi.system.domain.SysGradeWeightExample;
|
|
|
|
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScore;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScore;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScoreExample;
|
|
|
|
import com.ruoyi.system.domain.SysTrainingScoreExample;
|
|
|
|
import com.ruoyi.system.domain.vo.ReportDto;
|
|
|
|
import com.ruoyi.system.domain.vo.ReportDto;
|
|
|
|
|
|
|
|
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.service.ISysTrainingScoreService;
|
|
|
|
import com.ruoyi.system.service.ISysTrainingScoreService;
|
|
|
|
import org.apache.lucene.search.Weight;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@ -29,12 +29,12 @@ public class TrainingScoreController {
|
|
|
|
SysGradeWeightMapper gradeWeightMapper;
|
|
|
|
SysGradeWeightMapper gradeWeightMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@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,9 +42,41 @@ public class TrainingScoreController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/selectScore")
|
|
|
|
@PostMapping("/selectScore")
|
|
|
|
private SysTrainingScore selectScore(@RequestBody JSONObject jsonObject) {
|
|
|
|
private TrainingScoreVo selectScore(@RequestBody JSONObject jsonObject){
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
Long userId = jsonObject.getLong("userId");
|
|
|
|
return trainingScoreService.selectByUserId(userId);
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreService.selectByUserId(userId);
|
|
|
|
|
|
|
|
TrainingScoreVo trainingScoreVo=new TrainingScoreVo(sysTrainingScore);
|
|
|
|
|
|
|
|
return trainingScoreVo;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//一键审批
|
|
|
|
|
|
|
|
@PostMapping("/approvalAll")
|
|
|
|
|
|
|
|
private String approvalAll(){
|
|
|
|
|
|
|
|
List<SysTrainingScore> trainingScoreList=trainingScoreService.selectAllReportContent();
|
|
|
|
|
|
|
|
if (trainingScoreList.isEmpty()){
|
|
|
|
|
|
|
|
return "没有可审批的数据";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < trainingScoreList.size(); i++) {
|
|
|
|
|
|
|
|
SysTrainingScore sysTrainingScore = trainingScoreList.get(i);
|
|
|
|
|
|
|
|
String reportContent = sysTrainingScore.getReportContent();
|
|
|
|
|
|
|
|
int wordCount = reportContent.replace(" ","").length(); // 获取文本的字数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int score;
|
|
|
|
|
|
|
|
if (wordCount <= 50) {
|
|
|
|
|
|
|
|
score = 40;
|
|
|
|
|
|
|
|
} else if (wordCount <= 350) {
|
|
|
|
|
|
|
|
int extraWords = wordCount - 50; // 超出50字的额外字数
|
|
|
|
|
|
|
|
int extraScore = extraWords / 10 * 2; // 计算额外的得分
|
|
|
|
|
|
|
|
score = 40 + extraScore;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
score = 100; // 超过350字直接满分
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
SysTrainingScore trainingScore=new SysTrainingScore();
|
|
|
|
|
|
|
|
trainingScore.setId(sysTrainingScore.getId());
|
|
|
|
|
|
|
|
trainingScore.setTrainingReportScore(score);
|
|
|
|
|
|
|
|
trainingScoreService.updateByPrimaryKeySelective(trainingScore);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return "审批完毕";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//实训报告上传
|
|
|
|
//实训报告上传
|
|
|
|