修改bug ,新增学生提问接口

master
xiaoCJ 1 year ago
parent 975f204150
commit 7cd85b1af5

@ -15,7 +15,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@ -167,9 +167,9 @@ public class ClassScoreController {
@AnonymousAccess
@GetMapping("/getClassNameBySchoolId")
@ApiOperation("成绩管理&互动答疑/班级下拉框")
public ResultEntity<List<String>> getClassNameBySchoolId(@RequestParam String schoolId) {
List<String> className = userMapper.selectClassNameBySchoolId(schoolId);
return new ResultEntity<>(className);
public ResultEntity<List<Map<String,String>>> getClassNameBySchoolId(@RequestParam String schoolId) {
List<Map<String,String>> nameAndId = userMapper.selectClassNameBySchoolId(schoolId);
return new ResultEntity<>(nameAndId);
}

@ -1,5 +1,6 @@
package com.sztzjy.fund_investment.controller.tea;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.sztzjy.fund_investment.annotation.AnonymousAccess;
import com.sztzjy.fund_investment.entity.QuestionAnswerWithBLOBs;
@ -17,6 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
/**
* @Author xcj
* @Date 2023/12/1
@ -48,10 +53,10 @@ public class TeaTopicManageController {
@GetMapping("/getTopicsBySchoolId")
@ApiOperation("试题管理/页面搜索展示")
public ResultEntity<PageInfo<TopicsWithBLOBs>> getTopicsBySchoolId(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam String schoolId,
@ApiParam("module值同导入功能模块") @RequestParam String module,
@ApiParam("搜索框/题干") @RequestParam(required = false) String topicContent) {
@RequestParam Integer size,
@RequestParam String schoolId,
@ApiParam("module值同导入功能模块") @RequestParam String module,
@ApiParam("搜索框/题干") @RequestParam(required = false) String topicContent) {
return new ResultEntity<PageInfo<TopicsWithBLOBs>>(teaTopicManageService.getTopicsBySchoolId(index, size, schoolId, module, topicContent));
}
@ -97,16 +102,30 @@ public class TeaTopicManageController {
return new ResultEntity(HttpStatus.BAD_REQUEST, "请输入回复内容!");
}
questionAnswerWithBLOBs.setReplyContent(content);
questionAnswerMapper.updateByPrimaryKey(questionAnswerWithBLOBs);
questionAnswerMapper.updateByPrimaryKeyWithBLOBs(questionAnswerWithBLOBs);
return new ResultEntity(HttpStatus.OK, "回复成功!");
}
@AnonymousAccess
@GetMapping("/getQuestionById")
@ApiOperation("互动答疑/获取单互动数据")
@ApiOperation("互动答疑/获取单互动数据")
public ResultEntity<QuestionAnswerWithBLOBs> getQuestionById(@ApiParam("展示接口中的id字段") @RequestParam String questionId) {
return new ResultEntity<QuestionAnswerWithBLOBs>(questionAnswerMapper.selectByPrimaryKey(questionId));
}
@AnonymousAccess
@PostMapping("/addQuestion")
@ApiOperation("互动答疑/学生提问")
public ResultEntity<String> getQuestionById(@ApiParam("传flowId,提问内容,学校ID") @RequestBody QuestionAnswerWithBLOBs questionAnswerWithBLOBs) {
questionAnswerWithBLOBs.setId(IdUtil.simpleUUID());
questionAnswerWithBLOBs.setQuestionTime(new Date());
try {
questionAnswerMapper.insert(questionAnswerWithBLOBs);
}catch (Exception e){
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"提问失败,数据缺失!");
}
return new ResultEntity<>(HttpStatus.OK,"提问成功!");
}
}

@ -2,7 +2,6 @@ package com.sztzjy.fund_investment.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
public class QuestionAnswerExample {
@ -106,32 +105,6 @@ public class QuestionAnswerExample {
criteria.add(new Criterion(condition, value1, value2));
}
protected void addCriterionForJDBCDate(String condition, Date value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
addCriterion(condition, new java.sql.Date(value.getTime()), property);
}
protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {
if (values == null || values.size() == 0) {
throw new RuntimeException("Value list for " + property + " cannot be null or empty");
}
List<java.sql.Date> dateList = new ArrayList<>();
Iterator<Date> iter = values.iterator();
while (iter.hasNext()) {
dateList.add(new java.sql.Date(iter.next().getTime()));
}
addCriterion(condition, dateList, property);
}
protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
@ -353,52 +326,52 @@ public class QuestionAnswerExample {
}
public Criteria andQuestionTimeEqualTo(Date value) {
addCriterionForJDBCDate("question_time =", value, "questionTime");
addCriterion("question_time =", value, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeNotEqualTo(Date value) {
addCriterionForJDBCDate("question_time <>", value, "questionTime");
addCriterion("question_time <>", value, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeGreaterThan(Date value) {
addCriterionForJDBCDate("question_time >", value, "questionTime");
addCriterion("question_time >", value, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeGreaterThanOrEqualTo(Date value) {
addCriterionForJDBCDate("question_time >=", value, "questionTime");
addCriterion("question_time >=", value, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeLessThan(Date value) {
addCriterionForJDBCDate("question_time <", value, "questionTime");
addCriterion("question_time <", value, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeLessThanOrEqualTo(Date value) {
addCriterionForJDBCDate("question_time <=", value, "questionTime");
addCriterion("question_time <=", value, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeIn(List<Date> values) {
addCriterionForJDBCDate("question_time in", values, "questionTime");
addCriterion("question_time in", values, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeNotIn(List<Date> values) {
addCriterionForJDBCDate("question_time not in", values, "questionTime");
addCriterion("question_time not in", values, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeBetween(Date value1, Date value2) {
addCriterionForJDBCDate("question_time between", value1, value2, "questionTime");
addCriterion("question_time between", value1, value2, "questionTime");
return (Criteria) this;
}
public Criteria andQuestionTimeNotBetween(Date value1, Date value2) {
addCriterionForJDBCDate("question_time not between", value1, value2, "questionTime");
addCriterion("question_time not between", value1, value2, "questionTime");
return (Criteria) this;
}
}

@ -1,7 +1,9 @@
package com.sztzjy.fund_investment.entity.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@ -20,6 +22,7 @@ public class QuestionAnswerDto {
@ApiModelProperty("学校ID")
private String schoolid;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty("提问时间")
private Date questionTime;

@ -3,6 +3,7 @@ package com.sztzjy.fund_investment.mapper;
import com.sztzjy.fund_investment.entity.User;
import com.sztzjy.fund_investment.entity.UserExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -32,6 +33,6 @@ public interface UserMapper {
int updateByPrimaryKey(User record);
@Select("select class_name from wx_user where school_id = #{schoolId} group by class_name")
List<String> selectClassNameBySchoolId(@Param("schoolId") String schoolId);
@Select("select distinct(class_id),class_name from wx_user where school_id = #{schoolId}")
List<Map<String,String>> selectClassNameBySchoolId(@Param("schoolId") String schoolId);
}

@ -28,9 +28,13 @@ public class PerformanceScoreServiceImpl implements PerformanceScoreService {
public void calculateScoreByModule(String methodName, Integer score, String flowId) {
PerformanceScore performanceScore = getByFlowId(flowId);
Object o = performanceScore.get(methodName);
if (o==null){
if (o == null) {
performanceScore.set(methodName, BigDecimal.valueOf(score));
performanceScore.setTotalScore(performanceScore.getTotalScore().add(BigDecimal.valueOf(score)));
if (performanceScore.getTotalScore()== null) {
performanceScore.setTotalScore(BigDecimal.valueOf(score));
} else {
performanceScore.setTotalScore(performanceScore.getTotalScore().add(BigDecimal.valueOf(score)));
}
performanceScoreMapper.updateByPrimaryKey(performanceScore);
}
}
@ -39,13 +43,13 @@ public class PerformanceScoreServiceImpl implements PerformanceScoreService {
public void calculateScoreByModule2(String methodName, Integer score, String flowId) {
PerformanceScore performanceScore = getByFlowId(flowId);
Object o = performanceScore.get(methodName);
if(o==null){
if (o == null) {
performanceScore.set(methodName, BigDecimal.valueOf(score));
performanceScore.setTotalScore(performanceScore.getTotalScore().add(BigDecimal.valueOf(score)));
performanceScoreMapper.updateByPrimaryKey(performanceScore);
}else {
BigDecimal bigDecimal=(BigDecimal) performanceScore.get(methodName);
if(bigDecimal.compareTo(BigDecimal.valueOf(score))<0){
} else {
BigDecimal bigDecimal = (BigDecimal) performanceScore.get(methodName);
if (bigDecimal.compareTo(BigDecimal.valueOf(score)) < 0) {
performanceScore.set(methodName, BigDecimal.valueOf(score));
performanceScore.setTotalScore(performanceScore.getTotalScore().add(BigDecimal.valueOf(score)).subtract(bigDecimal));
performanceScoreMapper.updateByPrimaryKey(performanceScore);

@ -95,7 +95,7 @@ public class ClassScoreServiceImpl implements ClassScoreService {
int schoolGeneralCount = 0;
int schoolFailCount = 0;
BigDecimal maxScoreBySchoolId = BigDecimal.ZERO;
BigDecimal minScoreBySchoolId = null;
BigDecimal minScoreBySchoolId = BigDecimal.ZERO;
BigDecimal avgScoreBySchoolId = BigDecimal.ZERO;
for (TeaClassScore teaClassScore : teaClassScores) {
schoolExcellentCount = schoolExcellentCount + teaClassScore.getExcellentCount();
@ -104,13 +104,19 @@ public class ClassScoreServiceImpl implements ClassScoreService {
schoolFailCount = schoolFailCount + teaClassScore.getFailCount();
BigDecimal maxScore = teaClassScore.getClassMaxScore();
if (maxScore == null) {
maxScore = BigDecimal.ZERO;
}
BigDecimal minScore = teaClassScore.getClassMinScore();
if (minScore == null) {
minScore = BigDecimal.ZERO;
}
// 计算最高分
if (maxScore.compareTo(maxScoreBySchoolId) >= 0) {
maxScoreBySchoolId = maxScore;
}
// 计算最低分
if (minScoreBySchoolId == null || minScore.compareTo(minScoreBySchoolId) <= 0) {
if (minScoreBySchoolId.compareTo(BigDecimal.ZERO) == 0 || minScore.compareTo(minScoreBySchoolId) <= 0) {
minScoreBySchoolId = minScore;
}
//所有班级平均分累加
@ -172,11 +178,12 @@ public class ClassScoreServiceImpl implements ClassScoreService {
List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
if (!performanceScores.isEmpty()) {
PerformanceScore performanceScore = performanceScores.get(0);
if (!trainingReports.isEmpty()) {
for (TrainingReport trainingReport : trainingReports) {
userDto.setReportId(trainingReport.getId());
userDto.setReportName(trainingReport.getReportName());
}
if (trainingReports.isEmpty()) {
continue;
}
for (TrainingReport trainingReport : trainingReports) {
userDto.setReportId(trainingReport.getId());
userDto.setReportName(trainingReport.getReportName());
}
userDto.setFlowId(flowId);
userDto.setScore(performanceScore.getTotalScore());
@ -253,16 +260,45 @@ public class ClassScoreServiceImpl implements ClassScoreService {
PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample();
performanceScoreExample.createCriteria().andSchoolIdEqualTo(schoolId);
List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
List<String> list = new ArrayList();
if (!performanceScores.isEmpty()) {
for (PerformanceScore performanceScore : performanceScores) {
String flowId = performanceScore.getFlowId();
list.add(flowId);
FoundProject foundProject = foundProjectMapper.selectByPrimaryKey(flowId);
String foundProjectConclusion = foundProject.getFoundProjectConclusion(); // 寻找项目结论
String serviceDueDiligence = foundProject.getServiceDueDiligence(); // 业务尽调结论
String financialDueDiligence = foundProject.getFinancialDueDiligence(); //财务尽调结论
String projectValuationRelative = foundProject.getProjectValuationRelative();//相对估值结论得分
String projectValuationAbsolute = foundProject.getProjectValuationAbsolute();//绝对估值结论得分
if (foundProject == null) {
continue;
}
String serviceDueDiligence = "";
String financialDueDiligence = "";
String projectValuationRelative = "";
String projectValuationAbsolute = "";
String foundProjectConclusion = "";
if (foundProject.getFoundProjectConclusion() == null) {
performanceScoreService.calculateScoreByModule("projectSearchReportScore", 0, flowId);
} else {
foundProjectConclusion = foundProject.getFoundProjectConclusion(); // 寻找项目结论
}
if (foundProject.getServiceDueDiligence() == null) {
performanceScoreService.calculateScoreByModule("projectDueDiligenceBusinessReportScore", 0, flowId);
} else {
serviceDueDiligence = foundProject.getServiceDueDiligence(); // 业务尽调结论
}
if (foundProject.getFinancialDueDiligence() == null) {
performanceScoreService.calculateScoreByModule("projectDueDiligenceFinanceReportScore", 0, flowId);
} else {
financialDueDiligence = foundProject.getFinancialDueDiligence(); //财务尽调结论
}
if (foundProject.getProjectValuationRelative() == null) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 0, flowId);
} else {
projectValuationRelative = foundProject.getProjectValuationRelative();//相对估值结论得分
}
if (foundProject.getProjectValuationAbsolute() == null) {
performanceScoreService.calculateScoreByModule("projectValuationAbsoluteScore", 0, flowId);
} else {
projectValuationAbsolute = foundProject.getProjectValuationAbsolute();//绝对估值结论得分
}
foundProjectConclusion = foundProjectConclusion.replaceAll("[^a-zA-Z0-9]", "");
serviceDueDiligence = serviceDueDiligence.replaceAll("[^a-zA-Z0-9]", "");
financialDueDiligence = financialDueDiligence.replaceAll("[^a-zA-Z0-9]", "");
@ -278,21 +314,18 @@ public class ClassScoreServiceImpl implements ClassScoreService {
//未超过30结论报告是必填项到这里就给1分没有0
performanceScoreService.calculateScoreByModule("projectSearchReportScore", 1, flowId);
}
// 业务尽调结论
if (serviceDueDiligence.length() >= 30) {
performanceScoreService.calculateScoreByModule("projectDueDiligenceBusinessReportScore", 2, flowId);
} else {
performanceScoreService.calculateScoreByModule("projectDueDiligenceBusinessReportScore", 1, flowId);
}
//财务尽调结论
if (financialDueDiligence.length() >= 30) {
performanceScoreService.calculateScoreByModule("projectDueDiligenceFinanceReportScore", 2, flowId);
} else {
performanceScoreService.calculateScoreByModule("projectDueDiligenceFinanceReportScore", 1, flowId);
}
//项目相对估值结论
if (projectValuationRelative.length() >= 30) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 2, flowId);
@ -305,38 +338,46 @@ public class ClassScoreServiceImpl implements ClassScoreService {
} else {
performanceScoreService.calculateScoreByModule("projectValuationAbsoluteScore", 1, flowId);
}
}
for (String flowIdByList : list) {
TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowId);
trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowIdByList);
List<TrainingReport> trainingReports = trainingReportMapper.selectByExample(trainingReportExample);
if (!trainingReports.isEmpty()) {
TrainingReport trainingReport = trainingReports.get(0);
String experience = trainingReport.getExperience();
String url = trainingReport.getUrl();
String reportName = trainingReport.getReportName();
experience = experience.replaceAll("[^a-zA-Z0-9]", "");
url = url.replaceAll("[^a-zA-Z0-9]", "");
reportName = reportName.replaceAll("[^a-zA-Z0-9]", "");
//实训心得
if (experience.length() < 100) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 1, flowId); //todo 需要修改
trainingReport.setExperienceScore(BigDecimal.ONE);
}
if (experience.length() >= 100 && experience.length() < 300) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 2, flowId);//todo 需要修改
trainingReport.setExperienceScore(BigDecimal.valueOf(2));
}
if (experience.length() >= 300) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 3, flowId);//todo 需要修改
trainingReport.setExperienceScore(BigDecimal.valueOf(3));
}
//实验报告,未上传 0 分 上传得两分
if (!(url.isEmpty()) && !(reportName.isEmpty())) {
performanceScoreService.calculateScoreByModule("investmentReportScore", 2, flowId);//todo 需要修改
trainingReport.setReportScore(BigDecimal.valueOf(2));
}
trainingReportMapper.updateByPrimaryKey(trainingReport);
if (trainingReports.isEmpty()) {
continue;
}
String experience = "";
TrainingReport trainingReport = trainingReports.get(0);
if (trainingReport.getExperience() == null) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 0, flowIdByList);
trainingReport.setExperienceScore(BigDecimal.ZERO);
} else {
experience = trainingReport.getExperience();
}
//实训心得
if (experience.length() < 100) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 1, flowIdByList);
trainingReport.setExperienceScore(BigDecimal.ONE);
}
if (experience.length() >= 100 && experience.length() < 300) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 2, flowIdByList);
trainingReport.setExperienceScore(BigDecimal.valueOf(2));
}
if (experience.length() >= 300) {
performanceScoreService.calculateScoreByModule("projectValuationRelativeScore", 3, flowIdByList);
trainingReport.setExperienceScore(BigDecimal.valueOf(3));
}
//实验报告,未上传 0 分 上传得两分
if (trainingReport.getUrl() == null && trainingReport.getReportName() == null) {
performanceScoreService.calculateScoreByModule("investmentReportScore", 0, flowIdByList);//todo 需要修改
trainingReport.setReportScore(BigDecimal.ZERO);
}
if (!(trainingReport.getUrl().isEmpty()) && !(trainingReport.getReportName().isEmpty())) {
performanceScoreService.calculateScoreByModule("investmentReportScore", 2, flowIdByList);//todo 需要修改
trainingReport.setReportScore(BigDecimal.valueOf(2));
}
trainingReportMapper.updateByPrimaryKey(trainingReport);
}
return new ResultEntity<>(HttpStatus.OK);
}
@ -439,7 +480,7 @@ public class ClassScoreServiceImpl implements ClassScoreService {
}
// 实训成绩
// 实训成绩
@Override
public PerformanceTrainingScoreDto getStuTrainingScore(String flowId) {
PerformanceScoreExample example = new PerformanceScoreExample();

@ -1,5 +1,6 @@
package com.sztzjy.fund_investment.service.serviceImpl.tea;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.fund_investment.entity.*;
import com.sztzjy.fund_investment.entity.dto.QuestionAnswerDto;
@ -83,8 +84,9 @@ public class TeaTopicManageServiceImpl implements TeaTopicManageService {
*/
@Override
public PageInfo<TopicsWithBLOBs> getTopicsBySchoolId(Integer index, Integer size, String schoolId, String module, String topicContent) {
PageHelper.startPage(index, size);
List<TopicsWithBLOBs> topics = topicsMapper.getTopicsByCondition(schoolId, module, topicContent);
PageInfo pageInfo = PageUtil.pageHelper(topics, index, size);
PageInfo<TopicsWithBLOBs> pageInfo = new PageInfo<>(topics);
return pageInfo;
}
@ -99,7 +101,7 @@ public class TeaTopicManageServiceImpl implements TeaTopicManageService {
public PageInfo<QuestionAnswerDto> getQuestionAnswer(Integer index, Integer size, String schoolId, String className, String keyWord) {
QuestionAnswerExample questionAnswerExample = new QuestionAnswerExample();
questionAnswerExample.createCriteria().andSchoolidEqualTo(schoolId);
List<QuestionAnswer> questionAnswers = questionAnswerMapper.selectByExample(questionAnswerExample);
List<QuestionAnswerWithBLOBs> questionAnswers = questionAnswerMapper.selectByExampleWithBLOBs(questionAnswerExample);
UserExample userTableExample = new UserExample();
UserExample.Criteria criteria = userTableExample.createCriteria();
UserExample.Criteria or = userTableExample.createCriteria();

@ -5,6 +5,8 @@ import com.sztzjy.fund_investment.entity.TopicsWithBLOBs;
import com.sztzjy.fund_investment.entity.dto.QuestionAnswerDto;
import com.sztzjy.fund_investment.util.ResultEntity;
import java.util.List;
/**
* @Author xcj
* @Date 2023/12/1
@ -12,7 +14,7 @@ import com.sztzjy.fund_investment.util.ResultEntity;
public interface TeaTopicManageService {
ResultEntity<String> insertTopics(TopicsWithBLOBs topics);
PageInfo<TopicsWithBLOBs> getTopicsBySchoolId(Integer index, Integer size,String schoolId, String module,String topicContent);
PageInfo<TopicsWithBLOBs> getTopicsBySchoolId(Integer index, Integer size, String schoolId, String module, String topicContent);
PageInfo<QuestionAnswerDto> getQuestionAnswer(Integer index, Integer size,String schoolId, String className, String keyWord);

Loading…
Cancel
Save