|
|
|
|
@ -6,11 +6,13 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.sztzjy.linkCommerce.annotation.AnonymousAccess;
|
|
|
|
|
import com.sztzjy.linkCommerce.config.Constant;
|
|
|
|
|
import com.sztzjy.linkCommerce.entity.*;
|
|
|
|
|
import com.sztzjy.linkCommerce.entity.dto.CompetitiveEnvDTO;
|
|
|
|
|
import com.sztzjy.linkCommerce.entity.dto.MonthlyCakeIndex;
|
|
|
|
|
import com.sztzjy.linkCommerce.entity.dto.StuIndustryAnalysisDTO;
|
|
|
|
|
import com.sztzjy.linkCommerce.entity.dto.YearCakeIndexDto;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.HyxqfxDataMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.HyxqfxStuAnswerMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.JzhyfxStuAnswerMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.StuGradeMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.service.IndustryDemandAnalysisService;
|
|
|
|
|
import com.sztzjy.linkCommerce.service.ScoreService;
|
|
|
|
|
@ -36,25 +38,13 @@ import java.util.*;
|
|
|
|
|
@RequestMapping("api/industryAnalysis")
|
|
|
|
|
public class IndustryDemandAnalysisController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IndustryDemandAnalysisService service;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HyxqfxDataMapper hyxqfxDataMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HyxqfxStuAnswerMapper hyxqfxStuAnswerMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuGradeMapper stuGradeMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ScoreService scoreService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//数据查询
|
|
|
|
|
@ApiOperation("行业需求分析提交")
|
|
|
|
|
@PostMapping("/analysisSubmit")
|
|
|
|
|
@ -115,13 +105,7 @@ public class IndustryDemandAnalysisController {
|
|
|
|
|
List<HyxqfxStuAnswer> hyxqfxStuAnswerList = hyxqfxStuAnswerMapper.selectByExample(example);
|
|
|
|
|
if (!CollectionUtils.isEmpty(hyxqfxStuAnswerList)) {
|
|
|
|
|
|
|
|
|
|
HyxqfxStuAnswer hyxqfxStuAnswer = hyxqfxStuAnswerList.get(0);
|
|
|
|
|
hyxqfxStuAnswer.setErrorNumber(count);
|
|
|
|
|
String jsonString = JSONObject.toJSONString(analysisDTO);
|
|
|
|
|
hyxqfxStuAnswer.setAnswer(jsonString);
|
|
|
|
|
|
|
|
|
|
hyxqfxStuAnswerMapper.updateByPrimaryKeyWithBLOBs(hyxqfxStuAnswer);
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.ACCEPTED,"请勿重复提交!");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//学生答案
|
|
|
|
|
@ -168,18 +152,100 @@ public class IndustryDemandAnalysisController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("重新实训")
|
|
|
|
|
@ApiOperation("重新实训接口")
|
|
|
|
|
@GetMapping("/restartExperment")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
public ResultEntity restartExperment(@ApiParam("用户ID") String userId) {
|
|
|
|
|
|
|
|
|
|
public ResultEntity restartExperment(@ApiParam("用户ID") String userId, @ApiParam("小模块") String module) {
|
|
|
|
|
Boolean b = false;
|
|
|
|
|
if (Constant.MODULE_HYXQFX.equals(module)) {
|
|
|
|
|
//查询学生答题数据,删除成绩
|
|
|
|
|
HyxqfxStuAnswerExample example = new HyxqfxStuAnswerExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
hyxqfxStuAnswerMapper.deleteByExample(example);
|
|
|
|
|
b = scoreService.deleteScore(userId, Constant.PRO_SCXQWJ, Constant.MODULE_HYXQFX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
if (Constant.MODULE_JZHJFX.equals(module)) {
|
|
|
|
|
//查询学生答题数据,删除成绩
|
|
|
|
|
JzhyfxStuAnswerExample jzhyfxStuAnswerExample = new JzhyfxStuAnswerExample();
|
|
|
|
|
jzhyfxStuAnswerExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
jzhyfxStuAnswerMapper.deleteByExample(jzhyfxStuAnswerExample);
|
|
|
|
|
b = scoreService.deleteScore(userId, Constant.PRO_SCXQWJ, Constant.MODULE_JZHJFX);
|
|
|
|
|
}
|
|
|
|
|
if (b) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "重新实训成功!");
|
|
|
|
|
} else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "重新实训失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private JzhyfxStuAnswerMapper jzhyfxStuAnswerMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("竞争环境分析提交")
|
|
|
|
|
@PostMapping("/competitiveEnvSubmit")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
public ResultEntity competitiveEnvSubmit(@RequestBody CompetitiveEnvDTO competitiveEnvDTO) {
|
|
|
|
|
|
|
|
|
|
//校验答案是否正确
|
|
|
|
|
|
|
|
|
|
Double answer = 0.116;
|
|
|
|
|
Double stuAnswer = competitiveEnvDTO.getAnswer();
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
|
|
if (answer!=stuAnswer) {
|
|
|
|
|
count ++ ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询数据库 是否已经答过题
|
|
|
|
|
JzhyfxStuAnswerExample example = new JzhyfxStuAnswerExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(competitiveEnvDTO.getUserId());
|
|
|
|
|
List<JzhyfxStuAnswer> stuAnswerList = jzhyfxStuAnswerMapper.selectByExample(example);
|
|
|
|
|
if (!CollectionUtils.isEmpty(stuAnswerList)) {
|
|
|
|
|
return new ResultEntity(HttpStatus.ACCEPTED,"请勿重复答题!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//首次提交
|
|
|
|
|
JzhyfxStuAnswer jzhyfxStuAnswer = new JzhyfxStuAnswer();
|
|
|
|
|
jzhyfxStuAnswer.setUserId(competitiveEnvDTO.getUserId());
|
|
|
|
|
jzhyfxStuAnswer.setAnswer(stuAnswer.toString());
|
|
|
|
|
jzhyfxStuAnswer.setId(IdUtil.randomUUID());
|
|
|
|
|
jzhyfxStuAnswerMapper.insertSelective(jzhyfxStuAnswer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boolean aBoolean = scoreService.insertScore(competitiveEnvDTO.getUserId(), Constant.PRO_SCXQWJ, Constant.MODULE_JZHJFX, BigDecimal.valueOf(100 - count), null);
|
|
|
|
|
// 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, "提交失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("竞争环境分析根据用户ID查询")
|
|
|
|
|
@GetMapping("/competitiveEnvSubmitByUserId")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
public ResultEntity competitiveEnvSubmitByUserId(@ApiParam("用户ID") String userId) {
|
|
|
|
|
//读取文件内容 批量导入excel中 以文件名区分\
|
|
|
|
|
|
|
|
|
|
//查询数据库 是否已经答过题
|
|
|
|
|
JzhyfxStuAnswerExample example = new JzhyfxStuAnswerExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<JzhyfxStuAnswer> stuAnswerList = jzhyfxStuAnswerMapper.selectByExample(example);
|
|
|
|
|
if (CollectionUtils.isEmpty(stuAnswerList)) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
} else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, stuAnswerList.get(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|