Merge remote-tracking branch 'origin/master'

hehai
shijie 4 years ago
commit 834fcde002
  1. 4
      src/main/java/com/msdw/tms/api/AchievementManagementApi.java
  2. 8
      src/main/java/com/msdw/tms/controller/AchievementManagementController.java
  3. 5
      src/main/java/com/msdw/tms/dao/AchievementManagementDao.java
  4. 40
      src/main/java/com/msdw/tms/entity/request/ImportAssessmentRequest.java
  5. 4
      src/main/java/com/msdw/tms/service/AchievementManagementService.java
  6. 109
      src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java
  7. BIN
      src/main/resources/excel-template/川大成绩管理实验记录导出模板 (2).xlsx
  8. 24
      src/main/resources/mapper/tms/AchievementManagementDao.xml

@ -64,7 +64,7 @@ public interface AchievementManagementApi {
@ApiParam(value = "每页显示数据量", required = true) Integer size); @ApiParam(value = "每页显示数据量", required = true) Integer size);
@ApiOperation(value = "班级实验成绩导出", notes = "班级实验成绩导出") @ApiOperation(value = "班级实验成绩导出", notes = "班级实验成绩导出")
void exportAchievement(HttpServletResponse response, @ApiParam(value = "实验记录集合recordId(此处为ids字符串(1,2,3))") String ids) throws Exception; void exportAchievement(HttpServletResponse response, @ApiParam(value = "实验记录集合recordId(此处为ids字符串(1,2,3))") String ids, @ApiParam(value = "来源(1.练习2.考核)") Integer source) throws Exception;
@ApiOperation(value = "成绩管理列表", notes = "成绩管理列表筛选查询") @ApiOperation(value = "成绩管理列表", notes = "成绩管理列表筛选查询")
R queryAchievement(@ApiParam(value = "平台id", required = false) Integer systemId, R queryAchievement(@ApiParam(value = "平台id", required = false) Integer systemId,
@ -83,7 +83,7 @@ public interface AchievementManagementApi {
@ApiOperation(value = "成绩管理批量删除项目", notes = "将项目管理下的成绩管理批量删除") @ApiOperation(value = "成绩管理批量删除项目", notes = "将项目管理下的成绩管理批量删除")
R deleteReportByIds(@ApiParam(value = "项目id", required = true) List<Integer> projectIds, R deleteReportByIds(@ApiParam(value = "项目id", required = true) List<Integer> projectIds,
@ApiParam(value = "项目类型(0练习,1考核)", required = true) Integer projectPermissions, @ApiParam(value = "项目类型(0练习,1考核)", required = true) Integer projectPermissions,
@ApiParam(value = "教学实验id",required = false) List<Integer> ids); @ApiParam(value = "教学实验id", required = false) List<Integer> ids);
@ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理") @ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理")

@ -229,8 +229,8 @@ public class AchievementManagementController implements AchievementManagementApi
*/ */
@Override @Override
@GetMapping("/exportAchievement") @GetMapping("/exportAchievement")
public void exportAchievement(HttpServletResponse response, @RequestParam String ids) throws Exception { public void exportAchievement(HttpServletResponse response, @RequestParam String ids, @RequestParam Integer source) throws Exception {
service.exportAchievement(response, ids);//SearchAchievementVo vo service.exportAchievement(response, ids,source);//SearchAchievementVo vo
} }
//成绩管理列表 //成绩管理列表
@ -281,9 +281,9 @@ public class AchievementManagementController implements AchievementManagementApi
*/ */
@Override @Override
@PostMapping("/deleteReportById") @PostMapping("/deleteReportById")
public R deleteReportByIds(@RequestParam List<Integer> projectIds,@RequestParam Integer projectPermissions, public R deleteReportByIds(@RequestParam List<Integer> projectIds, @RequestParam Integer projectPermissions,
@RequestParam(required = false) List<Integer> ids) { @RequestParam(required = false) List<Integer> ids) {
return service.deleteReportById(projectIds,projectPermissions,ids); return service.deleteReportById(projectIds, projectPermissions, ids);
} }
/** /**

@ -8,6 +8,7 @@ import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.ReportEntity; import com.msdw.tms.entity.ReportEntity;
import com.msdw.tms.entity.ResultsEntity; import com.msdw.tms.entity.ResultsEntity;
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;
@ -51,8 +52,12 @@ public interface AchievementManagementDao extends BaseMapper<ExperimentalReportE
IPage<AchievementManagementVO> queryEvaluationReport(Page<T> tPage, String searchContant, Integer projectId); IPage<AchievementManagementVO> queryEvaluationReport(Page<T> tPage, String searchContant, Integer projectId);
//导出练习
List<AchievementImportRequest> queryAchievement(@Param("ids") List<Integer> ids); List<AchievementImportRequest> queryAchievement(@Param("ids") List<Integer> ids);
//导出考核
List<ImportAssessmentRequest> queryAchievementByAssessment(Integer id);
List<AchievementManagementVO> queryFictitiousRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month, List<Integer> projectIds); List<AchievementManagementVO> queryFictitiousRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month, List<Integer> projectIds);
List<AchievementManagementVO> queryEducationRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month, List<Integer> projectIds); List<AchievementManagementVO> queryEducationRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month, List<Integer> projectIds);

@ -0,0 +1,40 @@
package com.msdw.tms.entity.request;
import com.msdw.tms.common.utils.poi.ExcelAttribute;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 班级实验成绩导出模板数据
*/
@Data
@Accessors(chain = true)
public class ImportAssessmentRequest {
//学校
@ExcelAttribute(sort = 0)
private String schoolName;
//考核名称
@ExcelAttribute(sort = 1)
private String experimentalName;
//学生姓名
@ExcelAttribute(sort = 2)
private String userName;
//学号
@ExcelAttribute(sort = 3)
private String workNumber;
//分数
@ExcelAttribute(sort = 4)
private String score;
//提交时间
@ExcelAttribute(sort = 5)
private String submitTime;
}

@ -36,7 +36,7 @@ public interface AchievementManagementService extends IService<ExperimentalRepor
R queryEvaluationReport(String searchContant, Integer projectId, Integer page, Integer size); R queryEvaluationReport(String searchContant, Integer projectId, Integer page, Integer size);
void exportAchievement(HttpServletResponse response, String vo) throws Exception; void exportAchievement(HttpServletResponse response, String vo, Integer source) throws Exception;
R queryAchievement(Integer systemId, Integer projectPermissions, String searchContant, String startingtime, String endtime, Integer month); R queryAchievement(Integer systemId, Integer projectPermissions, String searchContant, String startingtime, String endtime, Integer month);
@ -44,7 +44,7 @@ public interface AchievementManagementService extends IService<ExperimentalRepor
void updateSignatrue(ExperimentalReportEntity entity); void updateSignatrue(ExperimentalReportEntity entity);
R deleteReportById(List<Integer> projectId,Integer projectPermissions, List<Integer> id); R deleteReportById(List<Integer> projectId, Integer projectPermissions, List<Integer> id);
List<AchievementManagementVO> getImitationAchievement(Integer projectId); List<AchievementManagementVO> getImitationAchievement(Integer projectId);

@ -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);
} }
} }
} }

@ -236,6 +236,30 @@
tcr.reportId tcr.reportId
ORDER BY tpr.submitTime DESC ORDER BY tpr.submitTime DESC
</select> </select>
<select id="queryAchievementByAssessment" resultType="com.msdw.tms.entity.request.ImportAssessmentRequest"
parameterType="java.lang.Integer">
SELECT schoolName,
experimental_class_name,
userName,
workNumber,
r.score,
r.recordId,
report.reportId,
r.submitTime,
stu.studentId,
t.id AS projectId,
experimental_name AS experimentalName
FROM tms_experimental_teaching t
INNER JOIN tms_experimental_report report ON report.projectId = t.id
INNER JOIN tms_project_record r ON r.recordId = report.eventId
INNER JOIN hr_user_info u ON u.userId = r.userId
INNER JOIN school s ON s.schoolId = u.schoolId
INNER JOIN student stu ON stu.userId = u.userId
WHERE t.id = #{id}
AND report.isdel = 0
</select>
<select id="queryFictitiousRecord" resultType="com.msdw.tms.entity.vo.AchievementManagementVO"> <select id="queryFictitiousRecord" resultType="com.msdw.tms.entity.vo.AchievementManagementVO">
SELECT SELECT
hpm.projectName, hpm.projectName,

Loading…
Cancel
Save