diff --git a/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java b/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java index 08ff0f9..d0f8240 100644 --- a/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java +++ b/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java @@ -51,6 +51,9 @@ public interface AchievementManagementDao extends BaseMapper queryEvaluationReport(Page tPage, String searchContant, Integer projectId); + //实验成绩管理查看成绩 统计平均分 + String getAVG(Integer projectId); + List queryAchievement(@Param("ids") List ids); List queryFictitiousRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month, List projectIds); @@ -71,5 +74,5 @@ public interface AchievementManagementDao extends BaseMapper queryPythonTest(Integer eventId); - void updateSignatrue(Integer isSignature,Integer signatureId,Integer reportId,String comment); + void updateSignatrue(Integer isSignature, Integer signatureId, Integer reportId, String comment); } diff --git a/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java b/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java index d0c1029..5cbc435 100644 --- a/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java +++ b/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java @@ -23,4 +23,7 @@ public interface ClassTeachingDao { void updateSurplusTimeLe(ProjectRecordVo recordVo); void updateSurplusTimeGt(ProjectRecordVo recordVo); + + + int updateExperimentalNumber(Integer number, Integer id); } diff --git a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java index a0f2a63..095478d 100644 --- a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java +++ b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java @@ -17,7 +17,8 @@ public class UserInfoEntity { //用户姓名 private String userName; //用户账号 - @Pattern(regexp = "/^[1-9]([0-9]{1,5})?$/", message = "账号只能为数字!") + //@Pattern(regexp = "/^[1-9]([0-9]{1,5})?$/", message = "账号只能为数字!") + @Pattern(regexp = "^[0-9a-zA-Z]*$",message = "账号只能为数字或字母!") private String account; //用户密码 private String password; diff --git a/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java index 97bd1e8..f4cab69 100644 --- a/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java @@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.util.*; + @Slf4j @Service public class AchievementManagementServiceImpl extends ServiceImpl implements AchievementManagementService { @@ -58,39 +59,39 @@ public class AchievementManagementServiceImpl extends ServiceImpl score = baseMapper.getScore(userScoreVO); - obj.put("score",score); - obj.put("experimentalReportEntity",experimentalReportEntity1); + obj.put("score", score); + obj.put("experimentalReportEntity", experimentalReportEntity1); List tradingJudgmentPointsIds = baseMapper.queryTradingJudgmentPointsId(reportId); Integer size = tradingJudgmentPointsIds.size(); - for (int i = 0;i judgmentPointsRuleList = baseMapper.getUserAnswers(tradingJudgmentPointsId); - map.put("judgmentPointsRuleList"+i,judgmentPointsRuleList); + map.put("judgmentPointsRuleList" + i, judgmentPointsRuleList); } - obj.put("userAnswersList",map); - return R.ok().put("data",obj); + obj.put("userAnswersList", map); + return R.ok().put("data", obj); } @Override public R getTeacher(Integer projectId) { String name = baseMapper.getTeacher(projectId); - return R.ok().put("name",name); + return R.ok().put("name", name); } @Override - public List list(ResultsVo vo,Integer page,Integer size) { + public List list(ResultsVo vo, Integer page, Integer size) { List list = achievementManagementDao.list(vo); return list; } @Override - public List reportList(ResultsVo vo,Integer page,Integer size) { + public List reportList(ResultsVo vo, Integer page, Integer size) { List reportList = achievementManagementDao.reportList(vo); return reportList; } @Override - public List newList(ResultsVo vo,Integer page,Integer size) { + public List newList(ResultsVo vo, Integer page, Integer size) { List newList = achievementManagementDao.newList(vo); return newList; } @@ -152,20 +153,20 @@ public class AchievementManagementServiceImpl extends ServiceImpl data = achievementManagementDao.queryPythonTest(eventId); map.put("data", data); } report.setUserName(userName); - map.put("report",report); - map.put("record",record); - return R.ok().put("data",map); + map.put("report", report); + map.put("record", record); + return R.ok().put("data", map); } @Override @@ -176,12 +177,17 @@ public class AchievementManagementServiceImpl extends ServiceImpl tPage = new Page<>(page,size); - IPage data = achievementManagementDao.queryEvaluationReport(tPage,searchContant,projectId); + public R queryEvaluationReport(String searchContant, Integer projectId, Integer page, Integer size) { + Page tPage = new Page<>(page, size); + IPage data = achievementManagementDao.queryEvaluationReport(tPage, searchContant, projectId); + + + String avg = achievementManagementDao.getAVG(projectId); + + PageUtils result = new PageUtils(data); - return R.ok().put("data",result); + return R.ok().put("data", result).put("avg", avg); } @Override @@ -190,10 +196,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl list = new ArrayList<>(); String[] split = ids.split(","); - for (int i = 0;i achievement = achievementManagementDao.queryAchievement(list); + List achievement = achievementManagementDao.queryAchievement(list); //2.加载模板流数据 ClassPathResource resource = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板.xlsx"); @@ -205,7 +211,7 @@ public class AchievementManagementServiceImpl extends ServiceImpl fictitious; @@ -213,14 +219,16 @@ public class AchievementManagementServiceImpl extends ServiceImpl vo = new ArrayList<>(); List educationResult = achievementManagementDao.countEducationProjectId();//获取教学实验的主键id List fictitiousResult = achievementManagementDao.countFictitiousProjectId();//获取教学实验的主键id - if (projectPermissions==null){projectPermissions=-9999;} - if (projectPermissions==0){//只查询练习项目 + if (projectPermissions == null) { + projectPermissions = -9999; + } + if (projectPermissions == 0) {//只查询练习项目 fictitious = achievementManagementDao.queryFictitiousRecord(systemId, searchContant, startingtime, endtime, month, fictitiousResult); vo = fictitious; - }else if (projectPermissions==1){//只查询考核项目 + } else if (projectPermissions == 1) {//只查询考核项目 education = achievementManagementDao.queryEducationRecord(systemId, searchContant, startingtime, endtime, month, educationResult); vo = education; - }else {//查询练习+考核项目 + } else {//查询练习+考核项目 if (educationResult.size() == 0) { if (fictitiousResult.size() > 0) { fictitious = achievementManagementDao.queryFictitiousRecord(systemId, searchContant, startingtime, endtime, month, fictitiousResult); @@ -245,10 +253,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl implements ClassTeachingService { @Autowired private ClassTeachingDao classMapper; + + @Autowired + private ClassTeachingDao classTeachingDao; + @Override public ExperimentalTeachingEntity queryInvitationcode(ExperimentalTeachingEntity experimentEntity) { ExperimentalTeachingEntity ex = classMapper.queryInvitationCode(experimentEntity); @@ -44,8 +52,23 @@ public class ClassTeachingServiceImpl implements ClassTeachingService { this.classMapper.updateSurplusTimeUp(recordVo);//倒计时:设定距离实验开始的剩余时间 this.classMapper.updateSurplusTimeLe(recordVo); this.classMapper.updateSurplusTimeGt(recordVo); - IPage schoolRecord = this.classMapper.getByClassRecord(page1, recordVo); - PageUtils pageUtils = new PageUtils(schoolRecord); +// IPage schoolRecord = this.classMapper.getByClassRecord(page1, recordVo); +// PageUtils pageUtils = new PageUtils(schoolRecord); + ExperimentalTeachingVO vo = new ExperimentalTeachingVO(); + BeanUtils.copyProperties(recordVo,vo); + ExperimentalTeachingDao userDao = this.getBaseMapper(); + IPage list = userDao.queryExperimentalTeaching(page1, vo); + for (int i = 0; i < list.getRecords().size(); i++) { + Integer number = list.getRecords().get(i).getExperimentalNumber(); + Integer id = list.getRecords().get(i).getId(); + //读取另一个表,将数据更新进 tms_experimental_teaching + int isTure = classTeachingDao.updateExperimentalNumber(number,id); + if(isTure < 0){ + return null; + } + } + + PageUtils pageUtils = new PageUtils(list); return pageUtils; } diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java index 1265737..0e6843f 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java @@ -36,6 +36,16 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl page1 = new Page<>(page, size); ExperimentalTeachingDao userDao = this.getBaseMapper(); IPage list = userDao.queryExperimentalTeaching(page1, vo); + for (int i = 0; i < list.getRecords().size(); i++) { + Integer number = list.getRecords().get(i).getExperimentalNumber(); + Integer id = list.getRecords().get(i).getId(); + //读取另一个表,将数据更新进 tms_experimental_teaching + int isTure = classTeachingDao.updateExperimentalNumber(number,id); + if(isTure < 0){ + return null; + } + } + PageUtils pageUtils = new PageUtils(list); return pageUtils; } diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java index 8343694..211960c 100644 --- a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java @@ -75,10 +75,11 @@ public class ProjectRecordServiceImpl extends ServiceImpl + + SELECT hpm.creationTime,hpm.projectId,hpm.projectName,hpm.projectPermissions,hpm.systemId,(SELECT count(*) FROM - hr_experimental_report her where hpm.projectId = her.projectId ) as number + tms_project_record her where hpm.projectId = her.projectId ) as number FROM hr_project_management hpm WHERE systemId = #{systemId} AND hpm.isdel = 0 AND hpm.projectPermissions = @@ -380,7 +384,7 @@ SELECT et.id,et.experimental_class_name as experimentalClassName,et.experimental_name as experimentalName,et.project_id as projectId, pm.projectName,pm.projectPermissions,et.creation_time as creationTime,(SELECT count(*) FROM - hr_experimental_report her where et.project_id = her.projectId ) as number + tms_project_record her where et.project_id = her.projectId ) as number FROM tms_experimental_teaching et,hr_project_management pm WHERE user_id = #{userId} AND et.project_id = pm.projectId diff --git a/src/main/resources/mapper/tms/ClassTeachingDao.xml b/src/main/resources/mapper/tms/ClassTeachingDao.xml index 17756c1..3265d03 100644 --- a/src/main/resources/mapper/tms/ClassTeachingDao.xml +++ b/src/main/resources/mapper/tms/ClassTeachingDao.xml @@ -13,7 +13,8 @@ surplus_time, experiment_duration, experimental_name, - experimental_number, + (select count(*) + from tms_project_record WHERE projectId = project_id) as experimental_number, start_time, stop_time, `status`, @@ -109,4 +110,11 @@ + + + UPDATE tms_experimental_teaching + SET experimental_number = #{number} + WHERE + id = #{id} + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml index 3891647..05c0745 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -10,7 +10,8 @@ experimental_name, project_id, project_name, - experimental_number, + (select count(*) + from tms_project_record WHERE projectId = project_id) as experimental_number, experiment_duration, type, start_time,