|
|
|
@ -13,6 +13,7 @@ import com.msdw.tms.dao.ProjectRecordDao; |
|
|
|
|
import com.msdw.tms.dao.UserInfoDao; |
|
|
|
|
import com.msdw.tms.entity.*; |
|
|
|
|
import com.msdw.tms.entity.request.AchievementImportRequest; |
|
|
|
|
import com.msdw.tms.entity.request.ImportAssessmentRequest; |
|
|
|
|
import com.msdw.tms.entity.vo.AchievementManagementVO; |
|
|
|
|
import com.msdw.tms.entity.vo.JudgmentPointsRuleVO; |
|
|
|
|
import com.msdw.tms.entity.vo.ResultsVo; |
|
|
|
@ -121,47 +122,47 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan |
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public R addReport(ExperimentalReportEntity entity) { |
|
|
|
|
// RecordVo record = entity.getEntity();
|
|
|
|
|
// //1.信息校验
|
|
|
|
|
// String userName = entity.getUserName();
|
|
|
|
|
// Integer userid = record.getUserid();
|
|
|
|
|
// String teacherName = entity.getTeacherName();
|
|
|
|
|
// //获取学生id和用户id
|
|
|
|
|
// StudentEntity student = userInfoDao.queryStudentId(userName,userid);
|
|
|
|
|
// //获取学生姓名
|
|
|
|
|
// List<String> studentName = userInfoDao.queryStudentName(userid);
|
|
|
|
|
// if (studentName.size()==0){
|
|
|
|
|
// return R.error("不存在的学生姓名");
|
|
|
|
|
// }else if (student==null){
|
|
|
|
|
// log.info("学生姓名和用户id不匹配!!!");
|
|
|
|
|
// return R.error("错误的个人信息!");
|
|
|
|
|
// }
|
|
|
|
|
// RecordVo record = entity.getEntity();
|
|
|
|
|
// //1.信息校验
|
|
|
|
|
// String userName = entity.getUserName();
|
|
|
|
|
// Integer userid = record.getUserid();
|
|
|
|
|
// String teacherName = entity.getTeacherName();
|
|
|
|
|
// //获取学生id和用户id
|
|
|
|
|
// StudentEntity student = userInfoDao.queryStudentId(userName,userid);
|
|
|
|
|
// //获取学生姓名
|
|
|
|
|
// List<String> studentName = userInfoDao.queryStudentName(userid);
|
|
|
|
|
// if (studentName.size()==0){
|
|
|
|
|
// return R.error("不存在的学生姓名");
|
|
|
|
|
// }else if (student==null){
|
|
|
|
|
// log.info("学生姓名和用户id不匹配!!!");
|
|
|
|
|
// return R.error("错误的个人信息!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//2.根据实验得分 自动获取评语信息
|
|
|
|
|
|
|
|
|
|
//3.将评语对应的commentId放入entity以便一齐存入实验报告表
|
|
|
|
|
//(无判分系统暂写score=100)
|
|
|
|
|
// record.setScore(100);
|
|
|
|
|
// //根据成绩取出对应的评语和评语id
|
|
|
|
|
// Integer score = record.getScore();
|
|
|
|
|
// if (score!=null) {
|
|
|
|
|
// if (score<60){
|
|
|
|
|
// entity.setCommentId(1);//成绩不合格
|
|
|
|
|
// }else if (score>=60&&score<70){
|
|
|
|
|
// entity.setCommentId(2);//合格
|
|
|
|
|
// }else if (score>=70&&score<90){
|
|
|
|
|
// entity.setCommentId(3);//良好
|
|
|
|
|
// }else {
|
|
|
|
|
// entity.setCommentId(4);//优秀
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// return R.error("系统异常,成绩为空!");
|
|
|
|
|
// }
|
|
|
|
|
// record.setScore(100);
|
|
|
|
|
// //根据成绩取出对应的评语和评语id
|
|
|
|
|
// Integer score = record.getScore();
|
|
|
|
|
// if (score!=null) {
|
|
|
|
|
// if (score<60){
|
|
|
|
|
// entity.setCommentId(1);//成绩不合格
|
|
|
|
|
// }else if (score>=60&&score<70){
|
|
|
|
|
// entity.setCommentId(2);//合格
|
|
|
|
|
// }else if (score>=70&&score<90){
|
|
|
|
|
// entity.setCommentId(3);//良好
|
|
|
|
|
// }else {
|
|
|
|
|
// entity.setCommentId(4);//优秀
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// return R.error("系统异常,成绩为空!");
|
|
|
|
|
// }
|
|
|
|
|
//4.添加实验记录表信息
|
|
|
|
|
|
|
|
|
|
// projectRecordDao.addReport(record);//保存至tms_project_record并返回主键
|
|
|
|
|
// projectRecordDao.addReport(record);//保存至tms_project_record并返回主键
|
|
|
|
|
//5.添加实验报告表信息
|
|
|
|
|
// entity.setStudentId(student.getStudentId()).setEventId(record.getEventId());
|
|
|
|
|
// entity.setStudentId(student.getStudentId()).setEventId(record.getEventId());
|
|
|
|
|
achievementManagementDao.addReport(entity); |
|
|
|
|
|
|
|
|
|
return R.ok(); |
|
|
|
@ -209,23 +210,43 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void exportAchievement(HttpServletResponse response, String ids) throws Exception { |
|
|
|
|
//1.获取数据
|
|
|
|
|
public void exportAchievement(HttpServletResponse response, String ids, Integer source) throws Exception { |
|
|
|
|
|
|
|
|
|
List<Integer> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
String[] split = ids.split(","); |
|
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
|
list.add(Integer.parseInt(split[i])); |
|
|
|
|
} |
|
|
|
|
switch (source) { |
|
|
|
|
case 1: |
|
|
|
|
//1.获取数据
|
|
|
|
|
List<AchievementImportRequest> achievement = achievementManagementDao.queryAchievement(list); |
|
|
|
|
|
|
|
|
|
//2.加载模板流数据
|
|
|
|
|
ClassPathResource resource = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板 (1).xlsx"); |
|
|
|
|
InputStream inputStream = resource.getInputStream(); |
|
|
|
|
|
|
|
|
|
//3、通过工具类下载文件
|
|
|
|
|
new ExcelExportUtil(AchievementImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). |
|
|
|
|
export(response, inputStream, achievement, "班级实验成绩.xlsx"); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
//1.获取数据
|
|
|
|
|
|
|
|
|
|
Integer id = Integer.valueOf(list.get(0)); |
|
|
|
|
List<ImportAssessmentRequest> assessment = achievementManagementDao.queryAchievementByAssessment(id); |
|
|
|
|
|
|
|
|
|
//2.加载模板流数据
|
|
|
|
|
ClassPathResource resource1 = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板 (2).xlsx"); |
|
|
|
|
InputStream inputStream1 = resource1.getInputStream(); |
|
|
|
|
|
|
|
|
|
//3、通过工具类下载文件
|
|
|
|
|
new ExcelExportUtil(ImportAssessmentRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). |
|
|
|
|
export(response, inputStream1, assessment, "班级实验成绩.xlsx"); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -305,9 +326,9 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R deleteReportById(List<Integer> projectIds,Integer projectPermissions, List<Integer> ids) { |
|
|
|
|
if (projectPermissions == 1){//实验教学
|
|
|
|
|
for (Integer id: ids) { |
|
|
|
|
public R deleteReportById(List<Integer> projectIds, Integer projectPermissions, List<Integer> ids) { |
|
|
|
|
if (projectPermissions == 1) {//实验教学
|
|
|
|
|
for (Integer id : ids) { |
|
|
|
|
List<AchievementManagementVO> teachAchievements = achievementManagementDao.getTeachAchievement(id); |
|
|
|
|
for (AchievementManagementVO teachAchievement : teachAchievements) { |
|
|
|
|
Integer reportId = teachAchievement.getReportId(); |
|
|
|
@ -315,13 +336,13 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan |
|
|
|
|
achievementManagementDao.deleteReport(reportId, recordId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
for (Integer projectId: projectIds) {//虚仿实验
|
|
|
|
|
} else { |
|
|
|
|
for (Integer projectId : projectIds) {//虚仿实验
|
|
|
|
|
List<AchievementManagementVO> imitationAchievements = achievementManagementDao.getImitationAchievement(projectId); |
|
|
|
|
for (AchievementManagementVO imitationAchievement: imitationAchievements) { |
|
|
|
|
for (AchievementManagementVO imitationAchievement : imitationAchievements) { |
|
|
|
|
Integer reportId = imitationAchievement.getReportId(); |
|
|
|
|
Integer recordId = imitationAchievement.getRecordId(); |
|
|
|
|
achievementManagementDao.deleteReport(reportId,recordId); |
|
|
|
|
achievementManagementDao.deleteReport(reportId, recordId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|