新增退出时机表,完成投资报告页面接口

master
xiaoCJ 1 year ago
parent 230bda7eee
commit 9312056347

@ -6,6 +6,8 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface PerformanceScoreMapper { public interface PerformanceScoreMapper {
long countByExample(PerformanceScoreExample example); long countByExample(PerformanceScoreExample example);
@ -29,4 +31,7 @@ public interface PerformanceScoreMapper {
int updateByPrimaryKeySelective(PerformanceScore record); int updateByPrimaryKeySelective(PerformanceScore record);
int updateByPrimaryKey(PerformanceScore record); int updateByPrimaryKey(PerformanceScore record);
@Select("select class_id from performance_score group By class_id")
List<String> selectClassId();
} }

@ -38,14 +38,7 @@ public class Task {
// 查到单个班级下所有的已经在投资报告页面提交过的学生的总成绩 // 查到单个班级下所有的已经在投资报告页面提交过的学生的总成绩
// 算平均值,存表 // 算平均值,存表
//查出所有数据 //查出所有数据
PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample(); List<String> classIdList = performanceScoreMapper.selectClassId();
List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
List<String> classIdList = new ArrayList<>();
for (PerformanceScore performanceScore : performanceScores) {
//查询classID相同的所有数据
String classId = performanceScore.getClassId();
classIdList.add(classId);
}
for (String classId : classIdList) { for (String classId : classIdList) {
BigDecimal avgScore = BigDecimal.ZERO; BigDecimal avgScore = BigDecimal.ZERO;
BigDecimal count = BigDecimal.ZERO; BigDecimal count = BigDecimal.ZERO;
@ -70,6 +63,7 @@ public class Task {
schoolId = score.getSchoolId(); schoolId = score.getSchoolId();
//没提交报告的 算0分跳过 //没提交报告的 算0分跳过
if (score.getInvestmentReportScore() == null || score.getInvestmentReportScore().equals(BigDecimal.ZERO)) { if (score.getInvestmentReportScore() == null || score.getInvestmentReportScore().equals(BigDecimal.ZERO)) {
classMinScore = BigDecimal.ZERO;
continue; continue;
} }
@ -102,7 +96,7 @@ public class Task {
Date date = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); Date date = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
teaClassScore.setSchoolId(schoolId); teaClassScore.setSchoolId(schoolId);
teaClassScore.setStartTime(date); teaClassScore.setStartTime(date);
System.out.println("定时任务执行的时间为=========》》date"); System.out.println(new Date());
teaClassScore.setId(IdUtil.simpleUUID()); teaClassScore.setId(IdUtil.simpleUUID());
teaClassScore.setClassMaxScore(classMaxScore); teaClassScore.setClassMaxScore(classMaxScore);
teaClassScore.setClassMinScore(classMinScore); teaClassScore.setClassMinScore(classMinScore);
@ -125,5 +119,6 @@ public class Task {
teaClassScoreMapper.insert(teaClassScore); teaClassScoreMapper.insert(teaClassScore);
} }
} }
} }

Loading…
Cancel
Save