重新实训接口

main
whb 1 year ago
parent b8b300ad1c
commit 3bcaba9c74

@ -62,15 +62,6 @@ public class IndustryDemandAnalysisController {
@Transactional(rollbackFor = Exception.class)
public ResultEntity uploadExcel(@RequestBody StuIndustryAnalysisDTO analysisDTO) {
//查询数据
HyxqfxStuAnswerExample example = new HyxqfxStuAnswerExample();
example.createCriteria().andUserIdEqualTo(analysisDTO.getUserId());
List<HyxqfxStuAnswer> hyxqfxStuAnswerList = hyxqfxStuAnswerMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(hyxqfxStuAnswerList)) {
return new ResultEntity<>(HttpStatus.OK);
}
//读取文件内容 批量导入excel中 以文件名区分
Map<String, Double> yearMap = new HashMap<>();
yearMap.put("2018年",0.28);
@ -116,37 +107,44 @@ public class IndustryDemandAnalysisController {
count ++;
}
}
BigDecimal subtract = BigDecimal.ZERO;
//查询数据
HyxqfxStuAnswerExample example = new HyxqfxStuAnswerExample();
example.createCriteria().andUserIdEqualTo(analysisDTO.getUserId());
//学生答案
String jsonString = JSONObject.toJSONString(analysisDTO);
HyxqfxStuAnswer hyxqfxStuAnswer = new HyxqfxStuAnswer();
hyxqfxStuAnswer.setId(IdUtil.randomUUID());
hyxqfxStuAnswer.setUserId(analysisDTO.getUserId());
hyxqfxStuAnswer.setAnswer(jsonString);
hyxqfxStuAnswer.setErrorNumber(count);
hyxqfxStuAnswerMapper.insertSelective(hyxqfxStuAnswer);
BigDecimal subtract = BigDecimal.valueOf(100).subtract(Convert.toBigDecimal(count));
List<HyxqfxStuAnswer> hyxqfxStuAnswerList = hyxqfxStuAnswerMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(hyxqfxStuAnswerList)) {
scoreService.selectByUserId(analysisDTO.getUserId(), Constant.PRO_SCXQWJ,Constant.MODULE_HYXQFX,subtract,analysisDTO.getContext());
HyxqfxStuAnswer hyxqfxStuAnswer = hyxqfxStuAnswerList.get(0);
hyxqfxStuAnswer.setErrorNumber(count);
String jsonString = JSONObject.toJSONString(analysisDTO);
hyxqfxStuAnswer.setAnswer(jsonString);
hyxqfxStuAnswerMapper.updateByPrimaryKeyWithBLOBs(hyxqfxStuAnswer);
// StuGrade stuGrade = new StuGrade(Constant.PRO_SCXQWJ,
// Constant.MODULE_HYXQFX,
// Convert.toBigDecimal(subtract),
// analysisDTO.getSchoolId(),
// analysisDTO.getUserId(),
// analysisDTO.getName(),
// analysisDTO.getClassId(),
// analysisDTO.getClassName(),
// analysisDTO.getContext());
}else {
//学生答案
String jsonString = JSONObject.toJSONString(analysisDTO);
HyxqfxStuAnswer hyxqfxStuAnswer = new HyxqfxStuAnswer();
hyxqfxStuAnswer.setId(IdUtil.randomUUID());
hyxqfxStuAnswer.setUserId(analysisDTO.getUserId());
hyxqfxStuAnswer.setAnswer(jsonString);
hyxqfxStuAnswer.setErrorNumber(count);
hyxqfxStuAnswerMapper.insertSelective(hyxqfxStuAnswer);
}
subtract = BigDecimal.valueOf(100).subtract(Convert.toBigDecimal(count));
Boolean aBoolean = scoreService.insertScore(analysisDTO.getUserId(), Constant.PRO_SCXQWJ,Constant.MODULE_HYXQFX,subtract,analysisDTO.getContext());
// scoreService.insertScore(userId, Constant.PRO_GYQDGL, Constant.MODULE_CGXQYC, BigDecimal.valueOf(100 - errorCount), null);
if(aBoolean){
return new ResultEntity<>(HttpStatus.OK, "提交成功");
}else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "提交失败");
}
return new ResultEntity<>(HttpStatus.OK, "上传成功");
}
@ -170,15 +168,17 @@ public class IndustryDemandAnalysisController {
}
public void jiaoYanCodeSize(String code){
String[] strings = code.split(",");
if (strings.length>=20)
{
//计分规则
@ApiOperation("重新实训")
@GetMapping("/restartExperment")
@AnonymousAccess
public ResultEntity restartExperment(@ApiParam("用户ID") String userId) {
}
//查询学生答题数据,删除成绩
HyxqfxStuAnswerExample example = new HyxqfxStuAnswerExample();
example.createCriteria().andUserIdEqualTo(userId);
hyxqfxStuAnswerMapper.deleteByExample(example);
return null;
}

Loading…
Cancel
Save