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