|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.sztzjy.linkCommerce.controller.stu;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
@ -12,6 +13,7 @@ import com.sztzjy.linkCommerce.entity.dto.YearCakeIndexDto;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.HyxqfxAnswerMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.HyxqfxDataMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.HyxqfxStuAnswerMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.mapper.StuGradeMapper;
|
|
|
|
|
import com.sztzjy.linkCommerce.service.IndustryDemandAnalysisService;
|
|
|
|
|
import com.sztzjy.linkCommerce.util.ResultEntity;
|
|
|
|
|
import com.sztzjy.linkCommerce.util.excel.DataListener;
|
|
|
|
|
@ -28,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -49,6 +52,9 @@ public class IndustryDemandAnalysisController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private HyxqfxStuAnswerMapper hyxqfxStuAnswerMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuGradeMapper stuGradeMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -68,8 +74,7 @@ public class IndustryDemandAnalysisController {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//读取文件内容 批量导入excel中 以文件名区分\
|
|
|
|
|
|
|
|
|
|
//读取文件内容 批量导入excel中 以文件名区分
|
|
|
|
|
Map<String, Double> yearMap = new HashMap<>();
|
|
|
|
|
yearMap.put("2018年",0.28);
|
|
|
|
|
yearMap.put("2019年",0.25);
|
|
|
|
|
@ -125,6 +130,8 @@ public class IndustryDemandAnalysisController {
|
|
|
|
|
|
|
|
|
|
hyxqfxStuAnswerMapper.insertSelective(hyxqfxStuAnswer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//插入主观题
|
|
|
|
|
SubjectiveQuestions subjectiveQuestions = new SubjectiveQuestions();
|
|
|
|
|
subjectiveQuestions.setId(IdUtil.randomUUID());
|
|
|
|
|
@ -135,6 +142,44 @@ public class IndustryDemandAnalysisController {
|
|
|
|
|
subjectiveQuestions.setSubjectiveContent(analysisDTO.getContext());
|
|
|
|
|
subjectiveQuestions.setSubjectiveContent(analysisDTO.getContext());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询是否已经有成绩
|
|
|
|
|
StuGradeExample stuGradeExample = new StuGradeExample();
|
|
|
|
|
stuGradeExample.createCriteria().andUserIdEqualTo(analysisDTO.getUserId()).andProjectEqualTo("市场需求挖掘").andModuleEqualTo("行业需求分析");
|
|
|
|
|
List<StuGrade> stuGradeList = stuGradeMapper.selectByExample(stuGradeExample);
|
|
|
|
|
if (!CollectionUtils.isEmpty(stuGradeList)) {
|
|
|
|
|
StuGrade stuGrade = stuGradeList.get(0);
|
|
|
|
|
BigDecimal score = stuGrade.getScore();
|
|
|
|
|
BigDecimal error = Convert.toBigDecimal(count);
|
|
|
|
|
score = score.subtract(error);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (score.compareTo(BigDecimal.valueOf(100)) > 0)
|
|
|
|
|
{
|
|
|
|
|
stuGrade.setScore(BigDecimal.valueOf(100));
|
|
|
|
|
}else {
|
|
|
|
|
stuGrade.setScore(score);
|
|
|
|
|
}
|
|
|
|
|
stuGradeMapper.updateByPrimaryKeySelective(stuGrade);
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
//将分数写入成绩表
|
|
|
|
|
StuGrade stuGrade = new StuGrade();
|
|
|
|
|
stuGrade.setId(IdUtil.randomUUID());
|
|
|
|
|
stuGrade.setUserId(analysisDTO.getUserId());
|
|
|
|
|
stuGrade.setCreateTime(new Date());
|
|
|
|
|
stuGrade.setModule("行业需求分析");
|
|
|
|
|
stuGrade.setProject("市场需求挖掘");
|
|
|
|
|
stuGrade.setClassName(analysisDTO.getClassName());
|
|
|
|
|
stuGrade.setContent(analysisDTO.getContext());
|
|
|
|
|
stuGrade.setName(analysisDTO.getName());
|
|
|
|
|
stuGrade.setSchoolId(analysisDTO.getSchoolId());
|
|
|
|
|
stuGrade.setScore(BigDecimal.valueOf(100-count));
|
|
|
|
|
stuGradeMapper.insertSelective(stuGrade);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "上传成功");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|