diff --git a/pom.xml b/pom.xml index d1e2781..0d3ac1b 100644 --- a/pom.xml +++ b/pom.xml @@ -219,6 +219,12 @@ easyexcel 2.1.1 + + + com.github.pagehelper + pagehelper + 5.1.2 + diff --git a/src/main/java/com/msdw/tms/api/AchievementManagementApi.java b/src/main/java/com/msdw/tms/api/AchievementManagementApi.java new file mode 100644 index 0000000..3375509 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/AchievementManagementApi.java @@ -0,0 +1,55 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.vo.AchievementManagementVo; +import com.msdw.tms.entity.vo.AchievementVo; +import com.msdw.tms.entity.vo.SearchAchievementVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api(value = "成绩管理",tags = "成绩管理") +public interface AchievementManagementApi { + + @ApiOperation(value = "川大新增实验记录",notes = "川大新增实验记录") + R addReport(AchievementVo vo); + + @ApiOperation(value = "查询实验记录",notes = "查询实验记录") + R queryReport(@ApiParam(value = "实验报告主键id",required = true) Integer reportId); + +// @ApiOperation(value = "直接修改实验记录分数",notes = "直接修改实验记录分数") +// R updateScore(@ApiParam(value = "recordid和score") ProjectRecordEntity entity); + + @ApiOperation(value = "删除实验报告",notes = "根据实验记录主键reportId和实验报告主键recordId删除实验报告") + R deleteReport(@ApiParam(value = "实验记录主键reportId(此处为ids集合)",required = true) AchievementManagementVo vo); + + @ApiOperation(value = "班级实验报告列表查询",notes = "班级实验报告列表查询") + R queryEvaluationReport(@ApiParam(value = "搜索内容(学校名称/学生姓名)",required = false) String searchContant, + @ApiParam(value = "项目",required = true) Integer projectId, + @ApiParam(value = "当前页码",required = true) Integer page, + @ApiParam(value = "每页显示数据量",required = true) Integer size); + + @ApiOperation(value = "班级实验成绩导出",notes = "班级实验成绩导出") + void exportAchievement(HttpServletResponse response, @ApiParam(value = "实验记录集合recordId(此处为ids字符串(1,2,3))")String ids) throws Exception; + + @ApiOperation(value = "成绩管理列表",notes = "成绩管理列表筛选查询") + R queryAchievement(@ApiParam(value = "平台id",required = false) Integer systemId, + @ApiParam(value = "项目类型",required = false) Integer projectPermissions, + @ApiParam(value = "搜索内容",required = false) String searchContant, + @ApiParam(value = "开始时间",required = false) String startingtime, + @ApiParam(value = "结束时间",required = false) String endtime, + @ApiParam(value = "最近几月",required = false) Integer month); + + @ApiOperation(value = "修改教师评语",notes = "修改教师评语:评语comment和实验报告主键reportId") + R updateComment(@ApiParam(value = "评语comment和实验报告主键reportId",required = true) ExperimentalReportEntity entity); + + @ApiOperation(value = "发布成绩",notes = "发布成绩--修改教师签名") + R updateSignatrue(@ApiParam(value = "实验报告主键reportId+是否使用教师签名isSignature+教师签名id signatureId") ExperimentalReportEntity entity); +} diff --git a/src/main/java/com/msdw/tms/api/ClassTeachingApi.java b/src/main/java/com/msdw/tms/api/ClassTeachingApi.java index 4efd927..7ddc02e 100644 --- a/src/main/java/com/msdw/tms/api/ClassTeachingApi.java +++ b/src/main/java/com/msdw/tms/api/ClassTeachingApi.java @@ -30,7 +30,7 @@ public interface ClassTeachingApi { @ApiOperation(value = "查看教学实验报告",notes = "查看教学实验报告") R queryExperimentalReport(@ApiParam(value = "学生id",required = true) Integer studentId, - @ApiParam(value = "项目id",required = true) Integer projectId, + @ApiParam(value = "实验id",required = true) Integer projectId, @ApiParam(value = "实验记录主键",required = true) Integer recordId, @ApiParam(value = "实验报告主键",required = true) Integer reportId); diff --git a/src/main/java/com/msdw/tms/api/CommentApi.java b/src/main/java/com/msdw/tms/api/CommentApi.java new file mode 100644 index 0000000..7508803 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/CommentApi.java @@ -0,0 +1,22 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.CommentEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@Api(value = "教师评语",tags = "教师评语") +public interface CommentApi { + @ApiOperation(value = "添加老师评语",notes = "添加老师评语") + R addComment(@ApiParam(value = "老师评语comment和评级level") CommentEntity entity); + + @ApiOperation(value = "修改老师评语",notes = "根据主键id修改评语") + R updateComment(@ApiParam(value = "主键id+老师评语comment+评级level") CommentEntity entity); + + @ApiOperation(value ="查询所有评语",notes = "查询所有评语") + R queryComment(); +} diff --git a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java index 2c9dcec..e5c9351 100644 --- a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java +++ b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java @@ -22,7 +22,8 @@ public interface ExperimentalTeachingControllerApi { @ApiParam(name = "status", value = "状态:1、待开始 2、进行中 3、已结束", required = false) Integer status, @ApiParam(name = "startTime", value = "开始时间", required = false) String startTime, @ApiParam(name = "stopTime", value = "结束时间", required = false) String stopTime, - @ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent); + @ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent, + @ApiParam(name = "schoolId", value = "学校id", required = true) Integer schoolId); @ApiOperation(value = "添加实验教学",notes = "添加实验教学") R save(ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException; diff --git a/src/main/java/com/msdw/tms/api/SignatureApi.java b/src/main/java/com/msdw/tms/api/SignatureApi.java new file mode 100644 index 0000000..4ce5d70 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/SignatureApi.java @@ -0,0 +1,24 @@ +package com.msdw.tms.api; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.SignatureEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +@Api(value = "老师签名照", tags = "老师签名照") +public interface SignatureApi { + + @ApiOperation(value = "上传老师签名照",notes = "上传老师签名照") + R uploadSignature(MultipartFile file,@ApiParam(value = "用户id",required = true) Integer userId) throws IOException; + + @ApiOperation(value = "查询老师签名照",notes = "查询老师签名照") + R querySignature(@ApiParam(value = "用户id",required = true) Integer userId); + + @ApiOperation(value = "删除教师签名照",notes = "根据主键id删除教师签名照") + R daleteSignature(@ApiParam(value = "签名名称signatureName和主键id",required = true) SignatureEntity entity); +} diff --git a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java index 9454264..0d6096e 100644 --- a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java +++ b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java @@ -9,6 +9,7 @@ import com.msdw.tms.entity.vo.UserProsonalEntityVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @@ -28,14 +29,19 @@ public interface UserInfoControllerApi { @ApiOperation(value = "个人中心-信息修改",notes = "个人中心-信息修改") R updateUser(UserProsonalEntityVo userProsonalEntityVo); - @ApiOperation(value = "发送验证码",notes = "发送验证码") - R findPassword(@ApiParam(value = "账号",required = true) String account, - @ApiParam(value = "发送类型(1邮箱,2手机)",required = true) Integer type); + @ApiOperation(value = "发送手机验证码",notes = "发送手机验证码") + R findPasswordByPhone(@ApiParam(value = "手机号",required = true) String email); + + @ApiOperation(value = "发送邮箱验证码",notes = "发送邮箱验证码") + R findPasswordByEmail(@ApiParam(value = "邮箱号",required = true) String phone); @ApiOperation(value = "校验验证码",notes = "校验验证码") // R checkCode(@ApiParam(value = "用户id和验证码") String code,@ApiParam(value = "用户id和验证码")String opener); - R checkCode(@ApiParam(value = "用户id和验证码") CheckVo checkVo); + R checkCode(@ApiParam(value = "用户id+验证码+取值码") CheckVo checkVo); @ApiOperation(value = "设置新密码",notes = "设置新密码") R resetPassword(@ApiParam(value = "用户id和密码") CheckVo checkVo); + + @ApiOperation(value = "专家账号",notes = "根据登录次数和时间从20个账号中循环提取") + R GMAccount(); } diff --git a/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java b/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java index 164137b..78dd0b3 100644 --- a/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java +++ b/src/main/java/com/msdw/tms/common/utils/ExcelImportHelper.java @@ -103,10 +103,15 @@ public class ExcelImportHelper { if (hssfSheet == null) { continue; } + int lastRowNum = hssfSheet.getLastRowNum(); + if (lastRowNum==2){ + break; + } // 循环行Row//开始行2 for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { Row row = hssfSheet.getRow(rowNum); + Cell userName; Cell phone; Cell email; Cell staffGradeName; @@ -115,8 +120,14 @@ public class ExcelImportHelper { Cell staffProfessionalArchitectureNameTwo; if (row != null) { staff = new StaffVo(); - row.getCell(0).setCellType(CellType.STRING); - Cell userName = row.getCell(0); + + if (row.getCell(0)!=null){ + row.getCell(0).setCellType(CellType.STRING); + userName = row.getCell(0); + }else { + continue; + } + row.getCell(1).setCellType(CellType.STRING); Cell account = row.getCell(1); row.getCell(2).setCellType(CellType.STRING); diff --git a/src/main/java/com/msdw/tms/config/PageResult.java b/src/main/java/com/msdw/tms/config/PageResult.java new file mode 100644 index 0000000..0c58965 --- /dev/null +++ b/src/main/java/com/msdw/tms/config/PageResult.java @@ -0,0 +1,54 @@ +package com.msdw.tms.config; + +import java.io.Serializable; +import java.util.List; + +public class PageResult implements Serializable { + + // 总记录数 + private Long total; + // 总记录 + private List rows; + private int totalPages; + + public PageResult(Long total, List rows, int totalPages) { + this.total = total; + this.rows = rows; + this.totalPages = totalPages; + } + + public int getTotalPages() { + return totalPages; + } + + + public void setTotalPages(int totalPages) { + this.totalPages = totalPages; + } + + + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + @Override + public String toString() { + return "PageResult{" + + "total=" + total + + ", rows=" + rows + + ", totalPages=" + totalPages + + '}'; + } +} diff --git a/src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java b/src/main/java/com/msdw/tms/config/QuartzConfig.java similarity index 59% rename from src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java rename to src/main/java/com/msdw/tms/config/QuartzConfig.java index 4ddad00..a5d3c02 100644 --- a/src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java +++ b/src/main/java/com/msdw/tms/config/QuartzConfig.java @@ -1,33 +1,14 @@ package com.msdw.tms.config; -import com.msdw.tms.config.quartz.CheckCodeQuartz; +//import com.msdw.tms.config.quartz.CheckCodeQuartz; import com.msdw.tms.config.quartz.TimeOutQuartz; import org.quartz.*; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration -public class CheckCodeQuartzConfig { - //定义任务详情 - @Bean - public JobDetail orderjobDetail() { - return JobBuilder - .newJob(CheckCodeQuartz.class) - .withIdentity("checkCodeQuartz") - .storeDurably() - .build(); - } - //定义触发器 - @Bean - public Trigger orderTrigger() { - CronScheduleBuilder scheduleBuilder - = CronScheduleBuilder.cronSchedule("0 0 18 * * ? "); //时间表达式,每天的18点执行任务 - return TriggerBuilder - .newTrigger() - .forJob(orderjobDetail()) - .withIdentity("checkCodeQuartz") - .withSchedule(scheduleBuilder).build(); - } +public class QuartzConfig { + //定义任务详情 @Bean public JobDetail timeOutJob() { diff --git a/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java b/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java deleted file mode 100644 index eb73365..0000000 --- a/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.msdw.tms.config.quartz; - -import com.msdw.tms.service.UserService; -import lombok.extern.slf4j.Slf4j; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Slf4j -@Component -public class CheckCodeQuartz implements Job { - - @Autowired - private UserService userService; - - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - boolean clean = userService.cleanUp(); - log.info("清理过期验证码"); - - } - -} diff --git a/src/main/java/com/msdw/tms/controller/AchievementManagementController.java b/src/main/java/com/msdw/tms/controller/AchievementManagementController.java index e35cb28..e5ae595 100644 --- a/src/main/java/com/msdw/tms/controller/AchievementManagementController.java +++ b/src/main/java/com/msdw/tms/controller/AchievementManagementController.java @@ -1,13 +1,131 @@ package com.msdw.tms.controller; +import com.msdw.tms.api.AchievementManagementApi; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.vo.AchievementManagementVo; +import com.msdw.tms.entity.vo.AchievementVo; import com.msdw.tms.service.AchievementManagementService; +import com.msdw.tms.service.ProjectRecordService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; + +/** + * 成绩管理 + */ @RestController @RequestMapping("/Achievement") -public class AchievementManagementController { +public class AchievementManagementController implements AchievementManagementApi { + + @Autowired + private AchievementManagementService service; @Autowired - private AchievementManagementService achievementManagementService; + private ProjectRecordService projectRecordService; + + /** + * 提交实验结果--川大 + */ + @Override + @PostMapping("/addReport") + public R addReport(@RequestBody AchievementVo vo){ + R result = service.addReport(vo); + return result; + } + + /** + * 查询实验记录 + */ + @Override + @GetMapping("/queryReport") + public R queryReport(@RequestParam(required = true) Integer reportId){ + R result = service.queryReport(reportId); + return result; + } + + //直接修改实验记录分数 +// @Override + @Transactional + @PostMapping("/updateReport") + public R updateScore(@RequestBody ProjectRecordEntity entity){ + ProjectRecordEntity vo = new ProjectRecordEntity() + .setRecordid(entity.getRecordid()).setScore(entity.getScore()); + projectRecordService.updateScore(vo); + return R.ok(); + } + + /** + * 需求:删除实验记录====管理端删除,但是学生端仍需保留 + * 将isdel属性设置为0 + * @param vo (recordid 、reportId) + * @return + */ + @Override + @PostMapping("/deleteReport") + public R deleteReport(@RequestBody AchievementManagementVo vo){ + R result = service.deleteReport(vo); + return result; + } + + /** + * 班级实验报告列表查询 + * @param searchContant + * @return + */ + @Override + @GetMapping("/queryEvaluationReport") + public R queryEvaluationReport(@RequestParam(required = false) String searchContant, + @RequestParam(required = true) Integer projectId, + @RequestParam(required = true) Integer page, + @RequestParam(required = true) Integer size){ + R result = service.queryEvaluationReport(searchContant,projectId,page,size); + return result; + } + + /** + * 班级实验成绩导出 + * @param response + * @param ids (ids:recordId) + * @throws Exception + */ + @Override + @GetMapping("/exportAchievement") + public void exportAchievement(HttpServletResponse response, @RequestParam String ids) throws Exception { + service.exportAchievement(response,ids);//SearchAchievementVo vo + } + + @Override + @GetMapping("/queryAchievement") + public R queryAchievement(@RequestParam(required = false) Integer systemId, + @RequestParam(required = false) Integer projectPermissions, + @RequestParam(required = false) String searchContant, + @RequestParam(required = false) String startingtime, + @RequestParam(required = false) String endtime, + @RequestParam(required = false) Integer month){ + R result = service.queryAchievement(systemId,projectPermissions,searchContant,startingtime,endtime,month); + return result; + } + + /** + * 修改评语 + * @param entity + * @return + */ + @Override + @PostMapping("/updateComment") + public R updateComment(@RequestBody ExperimentalReportEntity entity){ + R result = service.updateComment(entity); + return result; + } + + @Override + @PostMapping("/release") + public R updateSignatrue(@RequestBody ExperimentalReportEntity entity){ + service.updateSignatrue(entity); + return R.ok(); + } } diff --git a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java index fea92d9..a373260 100644 --- a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java @@ -121,10 +121,6 @@ public class ClassTeachingController implements ClassTeachingApi { return R.error(400,"邀请码格式错误!!!"); } } -// else{ -// return R.error("输入有误,无需邀请码"); -// } -// } //查看成绩 @Override @@ -148,13 +144,12 @@ public class ClassTeachingController implements ClassTeachingApi { /** * 学生查看实验报告 - * @param entity + * @param * @return */ @Override @GetMapping("/queryExperimentalReport") public R queryExperimentalReport(@RequestParam Integer studentId,@RequestParam Integer projectId,@RequestParam Integer recordId,@RequestParam Integer reportId){ -// public R queryExperimentalReport(@RequestBody ExperimentalReportVo entity){ ExperimentalReportVo entity = new ExperimentalReportVo(); R result = experimentalReportService.queryReport(studentId,projectId,recordId,reportId); @@ -163,7 +158,7 @@ public class ClassTeachingController implements ClassTeachingApi { /** * 学生查看虚拟实验报告 - * @param entity + * @param * @return */ @Override diff --git a/src/main/java/com/msdw/tms/controller/Commentcontroller.java b/src/main/java/com/msdw/tms/controller/Commentcontroller.java new file mode 100644 index 0000000..dd9b6a7 --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/Commentcontroller.java @@ -0,0 +1,50 @@ +package com.msdw.tms.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.msdw.tms.api.CommentApi; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.CommentEntity; +import com.msdw.tms.service.CommentService; +import com.sun.xml.bind.v2.model.core.ID; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 此类为老师评语 + */ +@RestController +@RequestMapping("/comment") +public class Commentcontroller implements CommentApi { + + @Autowired + private CommentService commentService; + + @Override + @PostMapping("/addComment") + @Transactional + public R addComment(@RequestBody CommentEntity entity){ + commentService.save(entity); + return R.ok(); + } + + @Override + @Transactional + @PostMapping("/updateComment") + public R updateComment(@RequestBody CommentEntity entity){ + if (entity.getId()==null){ + return R.error("id不能为空!!!"); + } + commentService.updateById(entity); + return R.ok(); + } + + @Override + @GetMapping("/queryComment") + public R queryComment(){ + List result = commentService.list(); + return R.ok().put("data",result); + } +} diff --git a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java index 1f75c9a..7dd84ce 100644 --- a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java @@ -9,6 +9,7 @@ import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.ExperimentalTeachingEntity; import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; +import com.msdw.tms.entity.vo.ExperimentalTeachingVO; import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.service.ExperimentalTeachingService; import com.msdw.tms.service.UserService; @@ -51,8 +52,9 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr @GetMapping("/list") public R list(@RequestParam Integer page, @RequestParam Integer size, - Integer month, Integer type, Integer status, String startTime, String stopTime, String searchContent){ - ExperimentalTeachingEntityVO vo = new ExperimentalTeachingEntityVO(); + Integer month, Integer type, Integer status, String startTime, String stopTime, String searchContent,@RequestParam Integer schoolId){ + ExperimentalTeachingVO vo = new ExperimentalTeachingVO(); + vo.setSchoolId(schoolId); if (month!=null){ vo.setMonth(month); } diff --git a/src/main/java/com/msdw/tms/controller/ProjectRecordController.java b/src/main/java/com/msdw/tms/controller/ProjectRecordController.java index e8967c5..cba98ec 100644 --- a/src/main/java/com/msdw/tms/controller/ProjectRecordController.java +++ b/src/main/java/com/msdw/tms/controller/ProjectRecordController.java @@ -95,19 +95,6 @@ public class ProjectRecordController implements ProjectRcordControllerApi { return R.ok().put("data", projectRecord); } - -// /** -// * 导出个人项目记录 -// * @param response -// * @throws Exception -// */ -// @Override -// @PostMapping("/user/exportProjectRecord") -// public void exportProjectRecord(HttpServletResponse response,@RequestBody ProjectRecordVo list)throws Exception{ -// projectRecordService.exportProjectRecord(response,list); -// } - - /** * 导出个人虚拟仿真实验记录 * @param response diff --git a/src/main/java/com/msdw/tms/controller/SignatureController.java b/src/main/java/com/msdw/tms/controller/SignatureController.java new file mode 100644 index 0000000..3d7e462 --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/SignatureController.java @@ -0,0 +1,69 @@ +package com.msdw.tms.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.msdw.tms.api.SignatureApi; +import com.msdw.tms.common.utils.FilesResult; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.SignatureEntity; +import com.msdw.tms.service.AliyunOssService; +import com.msdw.tms.service.SignatureService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.List; + +/** + * 此类为老师签名 + */ +@RestController +@RequestMapping("/signature") +public class SignatureController implements SignatureApi { + + @Autowired + private SignatureService signatureService; + + @Autowired + private AliyunOssService ossService; + + /** + * 上传老师签名照 + * @param file 文件 + * @param userId 用户id + * @return + */ + @Override + @PostMapping("/uploadSignature") + public R uploadSignature(@RequestParam MultipartFile file, @RequestParam Integer userId) throws IOException { + R result = signatureService.uploadSignature(file,userId); + return result; + } + + /** + * 查询老师签名照 + * @param userId + * @return + */ + @Override + @GetMapping("/querySignature") + public R querySignature(@RequestParam Integer userId){ + R result = signatureService.querySignature(userId); + return result; + } + + /** + * 删除老师签名照 + * @param entity + * @return + */ + @Override + @Transactional + @PostMapping("/daleteSignature") + public R daleteSignature(@RequestBody SignatureEntity entity){ + R result = signatureService.daleteSignature(entity); + + return result; + } +} diff --git a/src/main/java/com/msdw/tms/controller/UserController.java b/src/main/java/com/msdw/tms/controller/UserController.java index 7c8bf9b..2fac63b 100644 --- a/src/main/java/com/msdw/tms/controller/UserController.java +++ b/src/main/java/com/msdw/tms/controller/UserController.java @@ -141,57 +141,39 @@ public class UserController implements UserControllerApi { /** * 发送邮箱验证码 - * @param checkVo - * @return + * @param checkVo (email) + * @return R (参数 opener) */ @Override @PostMapping("/sendEmailCode") public R sendEmailCode(@RequestBody CheckVo checkVo){ - boolean re = userService.queryEmial(checkVo); + boolean re = userService.queryEmial(checkVo);//查询新邮箱号是否存在重复 if (re){ return R.error(403,"邮箱号不能重复"); }else{ - boolean save = userService.saveCheckCode(checkVo); - return save ? R.ok() : R.error(); + R save = userService.saveCheckCode(checkVo); + return save; } } /** * 校验邮箱验证码,通过则更新邮箱 - * @param checkVo - * @return + * @param checkVo (useId 、email 、code 、opener) + * @return R */ @Override @PutMapping("/bingEmail") - public R bindEmail(@RequestBody CheckVo checkVo){ - - String email = checkVo.getEmail(); - Integer types = checkVo.getTypes(); - List emailCode = userService.findEmailCode(email,types);//获取最近的验证码 - if (emailCode.size()==1){ - String checkCode = emailCode.get(0); - List result = userService.findEmailSetTime(email,checkCode,types);//验证最近验证码是否过期 - if (result.size()==1){ - String code = checkVo.getCode(); - if (code.equals(checkCode)){ - boolean bind = userService.bindEmail(checkVo); - return bind ? R.ok() : R.error(); - }else{ - return R.error(403,"验证失败!!!"); - } - }else{ - return R.error(403,"验证码过期!!!"); - } - }else{ - return R.error(403,"请发送验证码!!!"); - } + public R bindEmail(@RequestBody CheckVo checkVo) { + R result = userService.bindEmail(checkVo); + return result; } - /** - * 发送手机验证码 - * @param checkVo - * @return - */ + + /** + * 发送手机验证码 + * @param checkVo + * @return + */ @Override @PostMapping("/sendPhoneCode") public R sendPhoneCode(@RequestBody CheckVo checkVo){ @@ -199,37 +181,21 @@ public class UserController implements UserControllerApi { if (re){ return R.error(403,"电话号码不能重复"); }else { - boolean save = userService.sendCheckPhoneCode(checkVo); - return save ? R.ok() : R.error(); + R result = userService.sendCheckPhoneCode(checkVo); + return result; } } /** * 绑定手机 - * @param checkVo + * @param checkVo (userId 、phone、code、opener) * @return */ @Override @PutMapping("/bindPhone") public R bindPhone(@RequestBody CheckVo checkVo){ - String phone = checkVo.getPhone(); - Integer types = checkVo.getTypes(); - List phoneCode = userService.findPhoneCode(phone,types);//获取最近的验证码 - if (phoneCode.size()==1){ - String checkCode = phoneCode.get(0); - List result = userService.findPhoneSetTime(phone,checkCode,types);//验证最近验证码是否过期 - if (result.size()==1){ - if (checkVo.getCode().equals(checkCode)){ - boolean bind = userService.bindPhone(checkVo); - return bind ? R.ok() : R.error(); - }else{ - return R.error(403,"验证失败!!!"); - } - }else{ - return R.error(403,"验证码过期!!!"); - } - }else{ - return R.error(403,"请发送验证码!!!"); - } + + R result = userService.bindPhone(checkVo); + return result; } } diff --git a/src/main/java/com/msdw/tms/controller/UserInfoController.java b/src/main/java/com/msdw/tms/controller/UserInfoController.java index 3de55fa..f3efee3 100644 --- a/src/main/java/com/msdw/tms/controller/UserInfoController.java +++ b/src/main/java/com/msdw/tms/controller/UserInfoController.java @@ -112,7 +112,6 @@ public class UserInfoController implements UserInfoControllerApi { public R userInfo(@PathVariable("id") Integer id){ HashMap userEntityVoList = userService.queryUserInfo(id); -// UserEntityVo userEntityVo = userService.queryUserId(id); return R.ok().put("data",userEntityVoList); } @@ -149,15 +148,25 @@ public class UserInfoController implements UserInfoControllerApi { } /** - * 找回密码---发送验证码 - * @param account - * @param type + * 找回密码---发送验证码---手机 + * @param phone * @return */ @Override - @GetMapping("/findPassword") - public R findPassword(@RequestParam String account,@RequestParam Integer type){ - R result = userInfoService.findPassword(account,type); + @GetMapping("/findPasswordByPhone") + public R findPasswordByPhone(@RequestParam String phone){ + R result = userInfoService.findPasswordByPhone(phone); + return result; + } + /** + * 找回密码---发送验证码---手机 + * @param email + * @return + */ + @Override + @GetMapping("/findPasswordByEmail") + public R findPasswordByEmail(@RequestParam String email){ + R result = userInfoService.findPasswordByEmail(email); return result; } @@ -185,4 +194,10 @@ public class UserInfoController implements UserInfoControllerApi { return result; } + @Override + @GetMapping("/GMAccount") + public R GMAccount(){ + R result = userInfoService.queryAccount(); + return result; + } } diff --git a/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java b/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java index 9702e6e..d6bb45b 100644 --- a/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java +++ b/src/main/java/com/msdw/tms/dao/AchievementManagementDao.java @@ -1,7 +1,50 @@ package com.msdw.tms.dao; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.request.AchievementImportRequest; +import com.msdw.tms.entity.vo.AchievementManagementVo; +import com.msdw.tms.entity.vo.AchievementVo; +import com.msdw.tms.entity.vo.SearchAchievementVo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.poi.ss.formula.functions.T; + +import java.util.List; @Mapper -public interface AchievementManagementDao { +public interface AchievementManagementDao extends BaseMapper { + + void addReport(AchievementVo entity); + + AchievementManagementVo queryReport(Integer reportId); + + void deleteReport(AchievementManagementVo vo); + + IPage queryEvaluationReport(Page tPage, String searchContant, Integer projectId); + + List queryAchievement(@Param("ids") List ids); + + List queryFictitiousRecord(Integer systemId,String searchContant, String startingtime, String endtime, Integer month,List projectIds); + + List queryEducationRecord(Integer systemId, String searchContant, String startingtime, String endtime, Integer month,List projectIds); + + //qiyong + List queryFictitiousReport(String searchContant, Integer projectId); + + List countEducationProjectId(); + + List countFictitiousProjectId(); + + + String queryEvaluationName(Integer projectId); + + void updateComment(ExperimentalReportEntity entity); + + List queryPythonTest(Integer eventId); + + void updateSignatrue(Integer isSignature,Integer signatureId,Integer reportId); } diff --git a/src/main/java/com/msdw/tms/dao/CommentDao.java b/src/main/java/com/msdw/tms/dao/CommentDao.java new file mode 100644 index 0000000..31bf66c --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/CommentDao.java @@ -0,0 +1,9 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.CommentEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface CommentDao extends BaseMapper { +} diff --git a/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java b/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java index f30aa92..3e593b4 100644 --- a/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java +++ b/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java @@ -3,6 +3,7 @@ package com.msdw.tms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.vo.AchievementManagementVo; import com.msdw.tms.entity.vo.ExperimentalReportVo; import org.apache.ibatis.annotations.Mapper; @@ -12,4 +13,6 @@ public interface ExperimentalReportDao extends BaseMapper { - IPage queryExperimentalTeaching(Page page1,@Param("exp") ExperimentalTeachingEntityVO request); + IPage queryExperimentalTeaching(Page page1,@Param("exp") ExperimentalTeachingVO request); + + Integer queryProjectId(Integer evaluationId); } diff --git a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java index 0473934..387d825 100644 --- a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java +++ b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.RecordVo; import com.msdw.tms.entity.vo.ProjectRecordExportVo; import com.msdw.tms.entity.vo.ProjectRecordVo; import org.apache.ibatis.annotations.Mapper; @@ -34,4 +35,10 @@ public interface ProjectRecordDao extends BaseMapper { boolean updateUserRecord(ProjectRecordEntity projectRecord); List getByRecordImport(ProjectRecordEntity projectRecord); + + void addReport(RecordVo entity); + + ProjectRecordEntity queryReport(Integer recordId); + + void updateScore(ProjectRecordEntity vo); } diff --git a/src/main/java/com/msdw/tms/dao/SignatureDao.java b/src/main/java/com/msdw/tms/dao/SignatureDao.java new file mode 100644 index 0000000..a66b85c --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/SignatureDao.java @@ -0,0 +1,10 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.SignatureEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SignatureDao extends BaseMapper { + String queryRoleIds(Integer userId); +} diff --git a/src/main/java/com/msdw/tms/dao/UserDao.java b/src/main/java/com/msdw/tms/dao/UserDao.java index acae17d..20c28b6 100644 --- a/src/main/java/com/msdw/tms/dao/UserDao.java +++ b/src/main/java/com/msdw/tms/dao/UserDao.java @@ -13,8 +13,6 @@ import java.util.List; @Mapper public interface UserDao extends BaseMapper { - boolean cleanUp(); - List queryEmial(CheckVo checkVo); boolean saveCheckCode(CheckVo checkVo); diff --git a/src/main/java/com/msdw/tms/dao/UserInfoDao.java b/src/main/java/com/msdw/tms/dao/UserInfoDao.java index 5ac2c26..778eb11 100644 --- a/src/main/java/com/msdw/tms/dao/UserInfoDao.java +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -3,10 +3,7 @@ package com.msdw.tms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.msdw.tms.entity.StudentEntity; import com.msdw.tms.entity.UserInfoEntity; -import com.msdw.tms.entity.vo.CheckVo; -import com.msdw.tms.entity.vo.StaffVo; -import com.msdw.tms.entity.vo.StudentVo; -import com.msdw.tms.entity.vo.UserProsonalEntityVo; +import com.msdw.tms.entity.vo.*; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -56,7 +53,16 @@ public interface UserInfoDao extends BaseMapper { List queryUser(String account); - String checkCode(CheckVo checkVo); - void resetPassword(CheckVo checkVo); + + UserInfoEntity queryUserAccount(); + + void updateUserDetail(); + + String queryUserReport(Integer userId); + + StudentEntity queryStudentId(String userName, Integer userId); + + List queryStudentName(Integer userId); + } diff --git a/src/main/java/com/msdw/tms/entity/AchievementManagementEntity.java b/src/main/java/com/msdw/tms/entity/AchievementManagementEntity.java deleted file mode 100644 index 35523c2..0000000 --- a/src/main/java/com/msdw/tms/entity/AchievementManagementEntity.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.msdw.tms.entity; - -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 成绩管理/川大 - */ -@Data -@Accessors(chain = true) -public class AchievementManagementEntity { - - -} diff --git a/src/main/java/com/msdw/tms/entity/CommentEntity.java b/src/main/java/com/msdw/tms/entity/CommentEntity.java new file mode 100644 index 0000000..93511bc --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/CommentEntity.java @@ -0,0 +1,22 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 老师评语 + */ +@Data +@Accessors(chain = true) +@TableName("tms_comment") +public class CommentEntity { + + //主键id + private Integer id; + //评语 + private String comment; + //评语层级id + private Integer level; +} diff --git a/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java b/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java index 6c37136..cffea8e 100644 --- a/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java +++ b/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java @@ -33,13 +33,21 @@ public class ExperimentalReportEntity { //对本实验过程的方法及手段的改进建议 private String improvement; //老师评语 + private Integer commentId; + //教师评语 private String comment; //绑定学生id private Integer studentId; - //绑定老师id - private Integer teacherId; +// 绑定老师id +// private Integer teacherId; //学时 private String period; //实验室名称 private String laboratory; + //绑定教师签名id + private Integer signatureId; + //是否启用教师签名照 + private Integer isSignature; + //绑定项目id + private Integer eventId; } diff --git a/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java b/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java index 2ef118b..700d7b0 100644 --- a/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java +++ b/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java @@ -3,8 +3,10 @@ package com.msdw.tms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -46,6 +48,8 @@ public class ProjectRecordEntity implements Serializable { /** * 起始时间 */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startingtime; /** * 结束时间 @@ -58,6 +62,8 @@ public class ProjectRecordEntity implements Serializable { /** * 提交时间 */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date submittime; /** * 删除(0未删除 1已删除) diff --git a/src/main/java/com/msdw/tms/entity/SignatureEntity.java b/src/main/java/com/msdw/tms/entity/SignatureEntity.java new file mode 100644 index 0000000..1df9cff --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/SignatureEntity.java @@ -0,0 +1,22 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 老师签名 + */ +@Data +@Accessors(chain = true) +@TableName("tms_signature") +public class SignatureEntity { + //主键id + private Integer id; + //老师签名 存放路径 + private String signatureUrl; + //签名名称 + private String signatureName; + //绑定用户id + private Integer userId; +} diff --git a/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java b/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java new file mode 100644 index 0000000..eb3bf1f --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java @@ -0,0 +1,38 @@ +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 AchievementImportRequest { + + //学校 + @ExcelAttribute(sort = 0) + private String schoolName; + + //实验班级 + @ExcelAttribute(sort = 1) + private String experimentalClassName; + + //学生姓名 + @ExcelAttribute(sort = 2) + private String userName; + + //学号 + @ExcelAttribute(sort = 3) + private String workNumber; + + //分数 + @ExcelAttribute(sort = 4) + private String score; + + //提交时间 + @ExcelAttribute(sort = 5) + private String submitTime; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/AchievementManagementVo.java b/src/main/java/com/msdw/tms/entity/vo/AchievementManagementVo.java new file mode 100644 index 0000000..79132f8 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/AchievementManagementVo.java @@ -0,0 +1,86 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.common.utils.poi.ExcelAttribute; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.ProjectRecordEntity; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class AchievementManagementVo extends ExperimentalReportEntity { + + //=========================================================== 返回参数 + // + private ProjectRecordEntity entity; + + //学校 + private String schoolName; + + //实验班级 + private String experimentalClassName; + + //学生姓名 + private String userName; + + //学号 + private String workNumber; + + //分数 + private String score; + + //提交时间 + private String submitTime; + +//=========================================================== 返回参数 + //项目名称 + private String projectName; + + //分类 + private Integer evaluation; + + //成绩报告数量 + private Integer resportNumber; + + //创建时间 + private String creationTime; + + //类型(1虚拟仿真,2教学实验) + private Integer type; + // + private Integer projectPermissions; + //创建时间 + private String foundTime; + + //实验记录id(tms_experimental_report主键) + private Integer recordId; + + //老师签名 存放路径 + private String signatureUrl; + //签名名称 + private String signatureName; + //评语 + private String comment; + //评语层级id + private Integer level; + //成绩报告数量 + private Integer reportNumber; + //指导老师姓名 + private String teacherName; + //实验名称 + private String evaluationName; + //平台id + private Integer systemId; + +//=========================================================== python实验数据 + //判分点id + private Integer codeId; + //判分点-得分 + private Integer codeScore; + //学生答案 + private String userAnswer; + //参考答案 + private String answer; + //判分点名称 + private String judgmentPointsName; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/AchievementVo.java b/src/main/java/com/msdw/tms/entity/vo/AchievementVo.java new file mode 100644 index 0000000..0a9f371 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/AchievementVo.java @@ -0,0 +1,26 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.RecordVo; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class AchievementVo extends ExperimentalReportEntity { + + private RecordVo entity; + + //指导老师姓名 + private String teacherName; + + //学生姓名 + private String userName; + + //学号 + private String workNumber; + // + private Integer eventId; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/CheckVo.java b/src/main/java/com/msdw/tms/entity/vo/CheckVo.java index b695754..9f419f2 100644 --- a/src/main/java/com/msdw/tms/entity/vo/CheckVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/CheckVo.java @@ -32,6 +32,6 @@ public class CheckVo implements Serializable { //密码 private String password; @ApiParam(value = "用户账号") - private String account; + private String opener; } diff --git a/src/main/java/com/msdw/tms/entity/vo/EvaluationDataVo.java b/src/main/java/com/msdw/tms/entity/vo/EvaluationDataVo.java new file mode 100644 index 0000000..7621478 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/EvaluationDataVo.java @@ -0,0 +1,14 @@ +package com.msdw.tms.entity.vo; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +public class EvaluationDataVo { + //分数 + private Integer score; + //判分点名称 + private String judgmentPointsName; + //学生答案 + private String userAnswer; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java b/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java new file mode 100644 index 0000000..270246f --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java @@ -0,0 +1,21 @@ +package com.msdw.tms.entity.vo; + +import lombok.Data; + +@Data +public class ExperimentalTeachingVO { + //发布类型 + private Integer type; + //启动时间 + private String startTime; + //结束时间 + private String stopTime; + //月份 + private Integer month; + //搜索内容 + private String searchContent; + //状态 + private Integer status; + //学校id + private Integer schoolId; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java index 2ed4e36..09c0fbb 100644 --- a/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java @@ -39,7 +39,7 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable /** * 总耗时 */ - private Integer totalTime; + private Double totalTime; /** * 平均分 */ diff --git a/src/main/java/com/msdw/tms/entity/vo/RecordVo.java b/src/main/java/com/msdw/tms/entity/vo/RecordVo.java new file mode 100644 index 0000000..d568033 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/RecordVo.java @@ -0,0 +1,74 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@Data +@Accessors(chain = true) +public class RecordVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 记录id + */ + private Integer recordid; + /** + * 用户id + */ + private Integer userid; + /** + * 实验项目id + */ + private Integer projectid; + /** + * 得分 + */ + private Integer score; + /** + * 记录状态 + */ + private Integer recordstate; + /** + * 起始时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startingtime; + /** + * 结束时间 + */ + private Date endtime; + /** + * 耗时 + */ + private Integer timeSum; + /** + * 提交时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date submittime; + /** + * 删除(0未删除 1已删除) + */ + @TableLogic(value = "0",delval = "1") + private Integer isdel; + + private Integer eventId; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/SearchAchievementVo.java b/src/main/java/com/msdw/tms/entity/vo/SearchAchievementVo.java new file mode 100644 index 0000000..66ae40f --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/SearchAchievementVo.java @@ -0,0 +1,18 @@ +package com.msdw.tms.entity.vo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +@Data +@Accessors(chain = true) +public class SearchAchievementVo { + + // + private List ids; + + //项目id + private Integer projectId; + +} diff --git a/src/main/java/com/msdw/tms/service/AchievementManagementService.java b/src/main/java/com/msdw/tms/service/AchievementManagementService.java index 77109c5..f195256 100644 --- a/src/main/java/com/msdw/tms/service/AchievementManagementService.java +++ b/src/main/java/com/msdw/tms/service/AchievementManagementService.java @@ -1,4 +1,31 @@ package com.msdw.tms.service; -public interface AchievementManagementService { +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.vo.AchievementManagementVo; +import com.msdw.tms.entity.vo.AchievementVo; +import com.msdw.tms.entity.vo.SearchAchievementVo; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +public interface AchievementManagementService extends IService { + + R addReport(AchievementVo entity); + + R queryReport(Integer reportId ); + + R deleteReport(AchievementManagementVo vo); + + R queryEvaluationReport(String searchContant,Integer projectId,Integer page,Integer size); + + void exportAchievement(HttpServletResponse response, String vo) throws Exception; + + R queryAchievement(Integer systemId,Integer projectPermissions, String searchContant, String startingtime, String endtime, Integer month); + + R updateComment(ExperimentalReportEntity entity); + + void updateSignatrue(ExperimentalReportEntity entity); } diff --git a/src/main/java/com/msdw/tms/service/CommentService.java b/src/main/java/com/msdw/tms/service/CommentService.java new file mode 100644 index 0000000..7126fe5 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/CommentService.java @@ -0,0 +1,7 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.entity.CommentEntity; + +public interface CommentService extends IService { +} diff --git a/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java b/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java index 9c9777a..3bea116 100644 --- a/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java +++ b/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java @@ -5,6 +5,7 @@ import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.entity.ExperimentalTeachingEntity; import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; +import com.msdw.tms.entity.vo.ExperimentalTeachingVO; import com.msdw.tms.entity.vo.UserEntityVo; import org.springframework.web.bind.annotation.RequestParam; @@ -13,6 +14,6 @@ import java.util.Map; public interface ExperimentalTeachingService extends IService { - PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO vo); + PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingVO vo); } diff --git a/src/main/java/com/msdw/tms/service/ProjectRecordService.java b/src/main/java/com/msdw/tms/service/ProjectRecordService.java index 957200e..b0588e2 100644 --- a/src/main/java/com/msdw/tms/service/ProjectRecordService.java +++ b/src/main/java/com/msdw/tms/service/ProjectRecordService.java @@ -30,5 +30,7 @@ public interface ProjectRecordService extends IService { PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord); boolean updateUserRecord(ProjectRecordEntity projectRecord); + + void updateScore(ProjectRecordEntity vo); } diff --git a/src/main/java/com/msdw/tms/service/SignatureService.java b/src/main/java/com/msdw/tms/service/SignatureService.java new file mode 100644 index 0000000..76c4211 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/SignatureService.java @@ -0,0 +1,18 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.common.utils.FilesResult; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.SignatureEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +public interface SignatureService extends IService { + + R uploadSignature(MultipartFile file, Integer userId) throws IOException; + + R querySignature(Integer userId); + + R daleteSignature(SignatureEntity entity); +} diff --git a/src/main/java/com/msdw/tms/service/UserInfoService.java b/src/main/java/com/msdw/tms/service/UserInfoService.java index c4323ff..a0b5def 100644 --- a/src/main/java/com/msdw/tms/service/UserInfoService.java +++ b/src/main/java/com/msdw/tms/service/UserInfoService.java @@ -36,9 +36,16 @@ public interface UserInfoService extends IService { void updateAccount(Integer userId); - R findPassword(String account,Integer type); +// R findPassword(String account,Integer type); R checkCode(CheckVo checkVo); R resetPassword(CheckVo checkVo); + + R findPasswordByPhone(String phone); + + R findPasswordByEmail(String email); + + R queryAccount(); + } diff --git a/src/main/java/com/msdw/tms/service/UserService.java b/src/main/java/com/msdw/tms/service/UserService.java index 4821d31..ff8a84d 100644 --- a/src/main/java/com/msdw/tms/service/UserService.java +++ b/src/main/java/com/msdw/tms/service/UserService.java @@ -28,13 +28,17 @@ public interface UserService extends IService { void insertPersonalInfo(UserPersonalFileEntity personalFile); - boolean bindEmail(CheckVo checkVo); +// boolean bindEmail(CheckVo checkVo); + + R bindEmail(CheckVo checkVo); List findEmailCode(String email,Integer types); List findEmailSetTime(String email,String checkCode,Integer types); - boolean bindPhone(CheckVo checkVo); +// boolean bindPhone(CheckVo checkVo); + + R bindPhone(CheckVo checkVo); List findPhoneCode(String phone,Integer types); @@ -44,11 +48,12 @@ public interface UserService extends IService { boolean queryPhone(CheckVo checkVo); - boolean saveCheckCode(CheckVo checkVo); +// boolean saveCheckCode(CheckVo checkVo); + + R saveCheckCode(CheckVo checkVo); - boolean sendCheckPhoneCode(CheckVo checkVo); +// boolean sendCheckPhoneCode(CheckVo checkVo); - //清空过期验证码 - boolean cleanUp(); + R sendCheckPhoneCode(CheckVo checkVo); } 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 f699b41..0f70d98 100644 --- a/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java @@ -1,14 +1,211 @@ package com.msdw.tms.service.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.common.utils.Constant; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.common.utils.poi.ExcelExportUtil; import com.msdw.tms.dao.AchievementManagementDao; +import com.msdw.tms.dao.ExperimentalTeachingDao; +import com.msdw.tms.dao.ProjectRecordDao; +import com.msdw.tms.dao.UserInfoDao; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.RecordVo; +import com.msdw.tms.entity.StudentEntity; +import com.msdw.tms.entity.request.AchievementImportRequest; +import com.msdw.tms.entity.vo.AchievementManagementVo; +import com.msdw.tms.entity.vo.AchievementVo; import com.msdw.tms.service.AchievementManagementService; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.util.*; +@Slf4j @Service -public class AchievementManagementServiceImpl implements AchievementManagementService { +public class AchievementManagementServiceImpl extends ServiceImpl implements AchievementManagementService { @Autowired private AchievementManagementDao achievementManagementDao; + @Autowired + private ProjectRecordDao projectRecordDao; + + @Autowired + private ExperimentalTeachingDao experimentalTeachingDao; + + @Autowired + private UserInfoDao userInfoDao; + + @Override + @Transactional + public R addReport(AchievementVo 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 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以便一齐存入实验报告表 + //(无判分系统暂写commentId=4,score=100) + entity.setCommentId(4); + record.setScore(100); + //4.添加实验记录表信息 + + projectRecordDao.addReport(record);//保存至tms_project_record并返回主键 + //5.添加实验报告表信息 + entity.setStudentId(student.getStudentId()).setEventId(record.getEventId()); + achievementManagementDao.addReport(entity); + + return R.ok(); + } + + @Override + public R queryReport(Integer reportId) { + HashMap map = new HashMap<>(); + AchievementManagementVo report = achievementManagementDao.queryReport(reportId); + Integer eventId = report.getEventId(); + ProjectRecordEntity record = projectRecordDao.queryReport(eventId); + String userName = userInfoDao.queryUserReport(record.getUserid()); + if (report.getProjectId()!=null){ + String evaluationName = achievementManagementDao.queryEvaluationName(report.getProjectId()); + report.setEvaluationName(evaluationName); + } + //python实验数据 + Integer systemId = report.getSystemId(); + if (systemId==1|systemId==4|systemId==5) { + List 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); + } + + @Override + @Transactional + public R deleteReport(AchievementManagementVo vo) { + achievementManagementDao.deleteReport(vo); + return R.ok(); + } + + @Override + public R queryEvaluationReport(String searchContant,Integer projectId,Integer page,Integer size) { + Page tPage = new Page<>(page,size); + IPage data = achievementManagementDao.queryEvaluationReport(tPage,searchContant,projectId); + PageUtils result = new PageUtils(data); + + return R.ok().put("data",result); + } + + @Override + public void exportAchievement(HttpServletResponse response, String ids) throws Exception { + //1.获取数据 + List list = new ArrayList<>(); + + String[] split = ids.split(","); + for (int i = 0;i achievement = achievementManagementDao.queryAchievement(list); + + //2.加载模板流数据 + ClassPathResource resource = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板.xlsx"); + InputStream inputStream = resource.getInputStream(); + + //3、通过工具类下载文件 + new ExcelExportUtil(AchievementImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + export(response, inputStream, achievement, "班级实验成绩.xlsx"); + } + + @Override + public R queryAchievement(Integer systemId,Integer projectPermissions, String searchContant, String startingtime, + String endtime, Integer month) { + try { + List fictitious; + List education; + List vo = new ArrayList<>(); + List educationResult = achievementManagementDao.countEducationProjectId();//获取教学实验的主键id + List fictitiousResult = achievementManagementDao.countFictitiousProjectId();//获取教学实验的主键id + if (projectPermissions==null){projectPermissions=-9999;} + if (projectPermissions==0){//只查询练习项目 + fictitious = achievementManagementDao.queryFictitiousRecord(systemId, searchContant, startingtime, endtime, month, fictitiousResult); + vo = fictitious; + }else if (projectPermissions==1){//只查询考核项目 + education = achievementManagementDao.queryEducationRecord(systemId, searchContant, startingtime, endtime, month, educationResult); + vo = education; + }else {//查询练习+考核项目 + if (educationResult.size() == 0) { + if (fictitiousResult.size() > 0) { + fictitious = achievementManagementDao.queryFictitiousRecord(systemId, searchContant, startingtime, endtime, month, fictitiousResult); + vo = fictitious; + } + } else { + education = achievementManagementDao.queryEducationRecord(systemId, searchContant, startingtime, endtime, month, educationResult); + vo = education; + if (fictitiousResult.size() > 0) { + fictitious = achievementManagementDao.queryFictitiousRecord(systemId, searchContant, startingtime, endtime, month, fictitiousResult); + for (int i = 0; i < fictitious.size(); i++) { + vo.add(fictitious.get(i)); + } + //按创建时间时间排序 + Collections.sort(vo, new Comparator() { + @Override + public int compare(AchievementManagementVo o1, AchievementManagementVo o2) { + int flag = o2.getCreationTime().compareTo(o1.getCreationTime()); + return flag; + } + }); + } + } + } + return R.ok().put("data",vo); + }catch (RuntimeException e){ + log.info(e.getMessage()); + return R.error(500,"系统异常!!!"); + } + } + + @Override + @Transactional + public R updateComment(ExperimentalReportEntity entity) { + + achievementManagementDao.updateComment(entity); + return R.ok(); + } + + @Override + @Transactional + public void updateSignatrue(ExperimentalReportEntity entity) { + Integer isSignature = entity.getIsSignature(); + Integer signatureId = entity.getSignatureId(); + Integer reportId = entity.getReportId(); + if (isSignature==1){ + achievementManagementDao.updateSignatrue(1,signatureId,reportId); + }else { + achievementManagementDao.updateSignatrue(0,null,reportId); + } + } + } diff --git a/src/main/java/com/msdw/tms/service/impl/CommentServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/CommentServiceImpl.java new file mode 100644 index 0000000..cdc2466 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/CommentServiceImpl.java @@ -0,0 +1,11 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.dao.CommentDao; +import com.msdw.tms.entity.CommentEntity; +import com.msdw.tms.service.CommentService; +import org.springframework.stereotype.Service; + +@Service +public class CommentServiceImpl extends ServiceImpl implements CommentService { +} diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java index 3ce92b1..ddd5af7 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java @@ -4,33 +4,60 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; +import com.msdw.tms.dao.AchievementManagementDao; import com.msdw.tms.dao.ExperimentalReportDao; import com.msdw.tms.dao.ExperimentalTeachingDao; import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.vo.AchievementManagementVo; import com.msdw.tms.entity.vo.ExperimentalReportVo; import com.msdw.tms.service.ExperimentalReportService; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; +import java.util.List; + @Service public class ExperimentalReportServiceImpl extends ServiceImpl implements ExperimentalReportService { @Autowired private ExperimentalReportDao reportDao; + @Autowired + private AchievementManagementDao achievementManagementDao; + @Override public R queryReport(Integer studentId,Integer projectId,Integer recordId,Integer reportId) { + Integer systemId =reportDao.querySystemId(recordId); ExperimentalReportVo entity = new ExperimentalReportVo(); entity.setRecordId(recordId).setStudentId(studentId).setProjectId(projectId).setReportId(reportId); ExperimentalReportVo result = reportDao.queryReport(entity); - return R.ok().put("data",result); - + //python实验 + HashMap map = new HashMap<>(); + map.put("report",result); + if(systemId==1|systemId==4|systemId==5){ + List data = achievementManagementDao.queryPythonTest(recordId); + map.put("data",data); + return R.ok().put("data",map); + } + return R.ok().put("data",map); } @Override public R queryVirtualReport(Integer recordId) { ExperimentalReportVo result = reportDao.queryVirtualReport(recordId); + Integer systemId =reportDao.querySystemId(recordId); + + //python实验 + if(systemId==1|systemId==4|systemId==5){ + List data = achievementManagementDao.queryPythonTest(recordId); + HashMap map = new HashMap<>(); + map.put("data",data); + map.put("report",result); + return R.ok().put("data",map); + } + return R.ok().put("data",result); } } 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 acaf061..140fa2c 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java @@ -13,6 +13,7 @@ import com.msdw.tms.dao.UserDao; import com.msdw.tms.entity.ExperimentalTeachingEntity; import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; +import com.msdw.tms.entity.vo.ExperimentalTeachingVO; import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.service.ExperimentalTeachingService; @@ -31,19 +32,9 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl params) { -// -// IPage page = this.page( -// new Query().getPage(params), -// new QueryWrapper() -// ); -// return new PageUtils(page); -// } - @Override @Transactional - public PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO vo) { + public PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingVO vo) { ProjectRecordVo recordVo = new ProjectRecordVo(); recordVo.setStartTime(vo.getStartTime()).setEndTime(vo.getStopTime()); classTeachingDao.updateSurplusTimeNull(recordVo);//将已结束的实验的倒计时重置为0 @@ -59,12 +50,5 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl page1 = new Page<>(page, size); -// ExperimentalTeachingDao userDao = this.getBaseMapper(); -// IPage list = userDao.queryExperimentalTeaching(page1, vo); -// 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 e27ed14..8a92e16 100644 --- a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; +import java.text.DecimalFormat; import java.util.List; import java.util.stream.Collectors; @@ -66,11 +67,18 @@ public class ProjectRecordServiceImpl extends ServiceImpl importRequests = projectRecordVos.stream().map(project -> { ExperimentProjectRecordImportRequest request = new ExperimentProjectRecordImportRequest(); BeanUtils.copyProperties(project, request); -// request.setUserRecordstate(project.getRecordstate().equals(1) ? "已完成":"待评分"); return request; }).collect(Collectors.toList()); @@ -143,4 +150,9 @@ public class ProjectRecordServiceImpl extends ServiceImpl implements SignatureService { + + @Autowired + private SignatureDao signatureDao; + + @Autowired + AliyunOssServiceImpl ossService; + + @Override + @Transactional + public R uploadSignature(MultipartFile file, Integer userId) throws IOException { + String roleIds = signatureDao.queryRoleIds(userId); + if (roleIds==null){ + return R.error("不存在的角色"); + }else if (!roleIds.contains("3")){ + return R.error("您的身份不是老师,不能进行此操作!"); + } + //图片格式校验 +// String reg = ".+(.JPEG|.jpeg|.JPG|.jpg|.GIF|.gif|.BMP|.bmp|.PNG|.png)$"; +// if (StringUtils.isBlank(file.getOriginalFilename()) +// || !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).matches(reg)) { +// return R.error("图片格式不对!!!"); +// } + FilesResult result = ossService.uploadFiles(file);//上传图片 + SignatureEntity entity = new SignatureEntity().setSignatureUrl(result.getFileUrl()).setSignatureName(result.getFileName()).setUserId(userId); + this.save(entity); + return R.ok(); + } + + @Override + public R querySignature(Integer userId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_id",userId); + List entity = signatureDao.selectList(queryWrapper); + return R.ok().put("data",entity); + } + + @Override + @Transactional + public R daleteSignature(SignatureEntity entity) { + Integer id = entity.getId(); + SignatureEntity result = this.getById(id); + if (result==null){ + return R.error("不存在的图片"); + } + ossService.deleteFile(result.getSignatureName()); + this.removeById(id); + return R.ok(); + } +} diff --git a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java index bf9e347..34f45ed 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java @@ -152,69 +152,11 @@ public class UserInfoServiceImpl extends ServiceImpl vos = userInfoDao.queryUser(account); - int size = vos.size(); - UserInfoEntity entity = vos.get(0); - if (vos.size()==0){ - return R.error("账号不存在"); - }else if (vos.size()>1){ - log.info("存在多个相同账号"); - return R.error("账号异常,请联系管理员!!!"); - } - CheckCodeUtils utils = new CheckCodeUtils(); - String code = utils.sendCode(); - CheckVo checkVo = new CheckVo(); - String key = account+UUID.randomUUID().toString().replace("-", ""); - - if (type==1){//通过邮箱验证 - EmailUtils.sendEmail(entity.getEmail(),code); - ValueOperations ops = stringRedisTemplate.opsForValue(); - ops.set(account, code, 5*60, TimeUnit.SECONDS);//5分钟 - return R.ok().put("data",entity); - - - -// checkVo.setCheckCode(code).setSetTime(utils.letTimes(5)).setUserId(entity.getUserId()).setTypes(1); -// boolean result = userDao.saveCheckCode(checkVo); -// -// if (result) { -// return R.ok().put("data",entity); -// }else { -// return R.error("保存验证码异常"); -// } - }else if (type==2){//通过手机验证 - SendSMS.sendCode(entity.getPhone(),code); - ValueOperations ops = stringRedisTemplate.opsForValue(); - ops.set(account, code, 5*60, TimeUnit.SECONDS);//5分钟 - return R.ok().put("data",entity); - -// checkVo.setCheckCode(code).setSetTime(utils.letTimes(5)).setUserId(entity.getUserId()).setTypes(2); -// boolean result = userDao.saveCheckPhoneCode(checkVo); -// if (result) { -// return R.ok().put("data",entity); -// }else { -// return R.error("保存验证码异常"); -// } - }else { - return R.error("请求验证类型不对!!!"); - } - }catch (RuntimeException e){ - e.printStackTrace(); - return R.error("请求异常!!!"); - } - - } - @Override public R checkCode(CheckVo checkVo) { -// String checkCode = userInfoDao.checkCode(checkVo); ValueOperations ops = stringRedisTemplate.opsForValue(); - String opener = ops.get(checkVo.getAccount()); + String opener = ops.get(checkVo.getOpener()); if (opener==null){ return R.error("验证码已过期或不存在,请重新发送验证码"); }else if (opener.equals(checkVo.getCode())){ @@ -231,4 +173,52 @@ public class UserInfoServiceImpl extends ServiceImpl list = userInfoDao.queryPhone(phone); + switch (list.size()){ + case 0:return R.error("该手机号未绑定账号!!!"); + case 1: + String code = new CheckCodeUtils().sendCode(); + String opener = UUID.randomUUID().toString().replace("-", ""); + SendSMS.sendCode(phone,code); + ValueOperations ops = stringRedisTemplate.opsForValue(); + ops.set(opener, code, 5*60, TimeUnit.SECONDS);//5分钟 + CheckVo checkVo = new CheckVo(); + checkVo.setUserId(list.get(0)).setOpener(opener); + return R.ok().put("data",checkVo); + default: + log.info("该手机号存在绑定多个账号!!!"); + return R.error("该手机号号绑定异常,请联系管理员!"); + } + } + + @Override + public R findPasswordByEmail(String email) { + List list = userInfoDao.queryEmail(email); + switch (list.size()){ + case 0:return R.error("该邮箱未绑定账号!!!"); + case 1: + String code = new CheckCodeUtils().sendCode(); + String opener = UUID.randomUUID().toString().replace("-", ""); + EmailUtils.sendEmail(email,code); + ValueOperations ops = stringRedisTemplate.opsForValue(); + ops.set(opener, code, 5*60, TimeUnit.SECONDS);//5分钟 + CheckVo checkVo = new CheckVo(); + checkVo.setUserId(list.get(0)).setOpener(opener); + return R.ok().put("data",checkVo); + default: + log.info("该邮箱存在绑定多个账号!!!"); + return R.error("该邮箱号绑定异常,请联系管理员!"); + + } + } + + @Override + public R queryAccount() { + userInfoDao.updateUserDetail();//将已被删除的账号恢复 + UserInfoEntity result = userInfoDao.queryUserAccount();//取一个账号 + return R.ok().put("data",result); + } } diff --git a/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java index 7adf2f7..a4503d1 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java @@ -18,24 +18,22 @@ import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.entity.vo.UserProsonalEntityVo; import com.msdw.tms.service.UserService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.concurrent.TimeUnit; @Service("userService") public class UserServiceImpl extends ServiceImpl implements UserService { @Autowired private UserDao userMapper; - @Override - public boolean cleanUp(){ - boolean clean = userMapper.cleanUp(); - return clean; - } + @Autowired + private StringRedisTemplate stringRedisTemplate; + @Override public PageUtils queryPage(Map params) { @@ -81,12 +79,25 @@ public class UserServiceImpl extends ServiceImpl implements userMapper.insertPersonalInfo(personalFile); } - @Transactional @Override - public boolean bindEmail(CheckVo checkVo) { - boolean bind = userMapper.bindEmail(checkVo); - return bind; + public R bindEmail(CheckVo checkVo) { + + ValueOperations ops = stringRedisTemplate.opsForValue(); + String opener = ops.get(checkVo.getOpener());//获取验证码 + + if (opener==null){ + return R.error("验证码已过期或不存在,请重新发送验证码"); + } else if (opener.equals(checkVo.getCode())){ + boolean bind = userMapper.bindEmail(checkVo); + if (bind){ + return R.ok(); + }else { + return R.error("更新失败"); + } + } + return R.error("验证失败"); } + @Transactional @Override public List findEmailCode(String email,Integer types) { @@ -118,38 +129,53 @@ public class UserServiceImpl extends ServiceImpl implements return false; } } - @Override - public boolean saveCheckCode(CheckVo checkVo) { + public R saveCheckCode(CheckVo checkVo) { CheckCodeUtils checkCodeUtils = new CheckCodeUtils(); //获取六位随机数验证码 String code = checkCodeUtils.sendCode(); - EmailUtils.sendEmail(checkVo.getEmail(),code);//发送邮箱验证码 + EmailUtils.sendEmail(checkVo.getEmail(),code);//邮箱验证码,发送至新邮箱 + + String opener = UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + ops.set(opener, code, 5*60, TimeUnit.SECONDS);//5分钟 - String letTimes = checkCodeUtils.letTimes(5);//设定验证码5分钟内有效 - checkVo.setCheckCode(code).setSetTime(letTimes); - boolean save = userMapper.saveCheckCode(checkVo); - return save; + return R.ok().put("data",opener); } @Override - public boolean sendCheckPhoneCode(CheckVo checkVo) { + public R sendCheckPhoneCode(CheckVo checkVo) { CheckCodeUtils checkCodeUtils = new CheckCodeUtils(); //获取六位随机数验证码 String code = checkCodeUtils.sendCode(); SendSMS.sendCode(checkVo.getPhone(),code);//发送邮箱验证码 - String letTimes = checkCodeUtils.letTimes(5);//设定验证码5分钟内有效 - checkVo.setCheckCode(code).setSetTime(letTimes); - boolean save = userMapper.saveCheckPhoneCode(checkVo); - return save; + String opener = UUID.randomUUID().toString().replace("-", ""); + ValueOperations ops = stringRedisTemplate.opsForValue(); + ops.set(opener, code, 5*60, TimeUnit.SECONDS);//5分钟 + + return R.ok().put("data",opener); + } @Transactional @Override - public boolean bindPhone(CheckVo checkVo) { - boolean bind = userMapper.bindPhone(checkVo); - return bind; + public R bindPhone(CheckVo checkVo) { + ValueOperations ops = stringRedisTemplate.opsForValue(); + String opener = ops.get(checkVo.getOpener());//获取验证码 + if (opener==null){ + return R.error("验证码已过期或不存在,请重新发送验证码"); + } else if (opener.equals(checkVo.getCode())){ + boolean bind = userMapper.bindPhone(checkVo); + if (bind){ + return R.ok(); + }else { + return R.error("更新失败"); + } + + } + return R.error("验证失败"); + } @Transactional @Override diff --git a/src/main/resources/excel-template/川大成绩管理实验记录导出模板.xlsx b/src/main/resources/excel-template/川大成绩管理实验记录导出模板.xlsx new file mode 100644 index 0000000..12f3360 Binary files /dev/null and b/src/main/resources/excel-template/川大成绩管理实验记录导出模板.xlsx differ diff --git a/src/main/resources/mapper/tms/AchievementManagementDao.xml b/src/main/resources/mapper/tms/AchievementManagementDao.xml index b0fd2f0..bf54fa8 100644 --- a/src/main/resources/mapper/tms/AchievementManagementDao.xml +++ b/src/main/resources/mapper/tms/AchievementManagementDao.xml @@ -2,4 +2,277 @@ + + + + + + INSERT INTO tms_experimental_report ( projectId, content, principle, step, analysis, summarize, improvement, commentId, studentId, teacherName, period, laboratory,eventId ) +VALUES + (#{projectId},#{content}, #{principle}, #{step}, #{analysis}, #{summarize}, #{improvement}, #{commentId}, #{studentId}, #{teacherName}, #{period}, #{laboratory},#{eventId}) + + + UPDATE tms_project_record tpr,tms_experimental_report tcr SET tpr.isdel = 1 , tcr.isdel = 1 WHERE tpr.recordid = tcr.eventId AND tcr.reportId = #{reportId} + + + UPDATE tms_experimental_report SET `comment` = #{comment} WHERE reportId = #{reportId} + + + +UPDATE tms_experimental_report SET isSignature = #{isSignature} , signatureId = #{signatureId} WHERE reportId = #{reportId} + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ExperimentalReportDao.xml b/src/main/resources/mapper/tms/ExperimentalReportDao.xml index a46cb80..6052511 100644 --- a/src/main/resources/mapper/tms/ExperimentalReportDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalReportDao.xml @@ -19,7 +19,7 @@ SELECT hpm.experimentalGoal AS experiment_goal, tpr.submitTime, tpr.score, - ( SELECT userName FROM hr_user_info WHERE userId = ( SELECT teacherId FROM tms_experimental_report WHERE studentId = #{studentId} AND reportId = #{reportId} AND isdel=0 GROUP BY teacherId) ) AS teacherName, + ter.teacherName, ter.period, ter.laboratory, ter.principle, @@ -30,7 +30,7 @@ SELECT ter.conclusion, ter.summarize, ter.improvement, - ter.`comment` + IFNULL( ter.`comment`, ( SELECT `comment` FROM tms_comment WHERE id = commentId ) ) AS comment FROM hr_user_info u, student stu, @@ -72,4 +72,14 @@ WHERE AND tpr.recordId = #{recordId} AND tpr.isdel = 0 + \ 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 01907bb..654330e 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -31,15 +31,7 @@ AND `status`=#{exp.status,jdbcType=INTEGER} - - - - - - - - - + AND creation_time between #{exp.startTime} and #{exp.stopTime} diff --git a/src/main/resources/mapper/tms/ProjectRecordDao.xml b/src/main/resources/mapper/tms/ProjectRecordDao.xml index c256b36..8d2a04a 100644 --- a/src/main/resources/mapper/tms/ProjectRecordDao.xml +++ b/src/main/resources/mapper/tms/ProjectRecordDao.xml @@ -16,6 +16,11 @@ + +INSERT INTO tms_project_record ( userId, projectId, score, startingTime, endTime, timeSum, submitTime ) +VALUES + (#{userid}, #{projectid}, #{score}, #{startingtime}, now(), #{timeSum}, now()) + @@ -156,6 +167,9 @@ AND tp.projectPermissions =0 + update tms_project_record @@ -164,4 +178,7 @@ where recordId=#{recordid} + + UPDATE tms_project_record SET score = #{score} WHERE recordId = #{recordid} + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/SignatureDao.xml b/src/main/resources/mapper/tms/SignatureDao.xml new file mode 100644 index 0000000..71be7cb --- /dev/null +++ b/src/main/resources/mapper/tms/SignatureDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/UserDao.xml b/src/main/resources/mapper/tms/UserDao.xml index d969685..ba71046 100644 --- a/src/main/resources/mapper/tms/UserDao.xml +++ b/src/main/resources/mapper/tms/UserDao.xml @@ -2,9 +2,6 @@ - - DELETE FROM tms_checkcode WHERE now() > setTime - @@ -203,14 +200,14 @@ VALUES (#{userId},#{personalCareerId},#{schoolId},#{schoolName},#{disciplineId},#{disciplineName},#{professionalId},#{professionalName},#{professionalClassId},#{professionalClassName},NOW()) - - INSERT INTO tms_checkcode ( userId, email, types, checkCode, setTime ) - VALUES - (#{userId},#{email},#{types},#{checkCode},#{setTime}) - - - INSERT INTO tms_checkcode ( userId, phone, types, checkCode, setTime ) - VALUES - (#{userId},#{phone},#{types},#{checkCode},#{setTime}) - + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/UserInfoDao.xml b/src/main/resources/mapper/tms/UserInfoDao.xml index d4c1089..d214bfd 100644 --- a/src/main/resources/mapper/tms/UserInfoDao.xml +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -210,6 +210,9 @@ update hr_user_info set `password` = #{password} WHERE userId = #{userId} AND isdel = 0 + + UPDATE hr_user_info SET isdel = 0 ,disableAccount = 0 WHERE userId BETWEEN 519 AND 538 AND (isdel = 1 OR disableAccount = 1) + - + SELECT userId,account,`password` FROM hr_user_info WHERE userId BETWEEN 519 AND 538 AND isdel = 0 AND disableAccount = 0 ORDER BY logInNumber , lastLoginTime LIMIT 1 + + + + \ No newline at end of file diff --git a/src/test/java/com/msdw/tms/service/AchievementManagementTest.java b/src/test/java/com/msdw/tms/service/AchievementManagementTest.java new file mode 100644 index 0000000..be68d00 --- /dev/null +++ b/src/test/java/com/msdw/tms/service/AchievementManagementTest.java @@ -0,0 +1,145 @@ +package com.msdw.tms.service; + +import com.msdw.tms.common.utils.R; +import com.msdw.tms.dao.AchievementManagementDao; +import com.msdw.tms.entity.ProjectEntity; +import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.request.AchievementImportRequest; +import com.msdw.tms.entity.vo.AchievementManagementVo; +import com.msdw.tms.entity.vo.SearchAchievementVo; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@SpringBootTest +public class AchievementManagementTest { + + @Autowired + private AchievementManagementService achievementManagementService; + + @Autowired + private ProjectRecordService projectRecordService; + + @Autowired + AchievementManagementDao achievementManagementDao; + + //测试新增实验记录 +// @Test +// public void addReport(){ +// AchievementManagementVo vo = new AchievementManagementVo(); +// ProjectRecordEntity entity = new ProjectRecordEntity(); +// Date date = new Date(); +// //用户id +// Integer userId = 385; +// +// entity.setUserid(userId) +// .setProjectid(368) +// .setScore(100) +// .setRecordstate(0) +// .setStartingtime(date) +// .setEndtime(date) +// .setSubmittime(date) +// .setTimeSum(0) +// .setIsdel(0); +// vo.setUserId(userId) +// .setEvaluationId(158) +// .setExperimentalGoal("目标2") +// .setPrinciple("原理2") +// .setStep("步骤2") +// .setAnalysis("实验分析2") +// .setSummarize("实验总结2") +// .setImprovement("实验建议2") +// .setCommentId(3) +// .setTeacherId(178) +// .setPeriod("学时") +// .setLaboratory("实验室名称2") +// .setIsSignature(0) +// .setSignatureId(4) +// .setIsdel(0); +// vo.setEntity(entity); +// R r = achievementManagementService.addReport(vo); +// System.out.println(r); +// } + + @Test + public void queryReport(){ + Integer reportId = 4; + Integer recordId = 100; + R r = achievementManagementService.queryReport(reportId); + System.out.println(r); + } + + @Test + public void updateScore(){ + ProjectRecordEntity vo = new ProjectRecordEntity(); + Integer recordId = 100; + Integer score = 99; + vo.setRecordid(recordId).setScore(score); + projectRecordService.updateScore(vo); + } + + @Test + public void daleteReport(){ + Integer reportId = 4; + Integer recordId = 100; + AchievementManagementVo vo = new AchievementManagementVo(); + ProjectRecordEntity entity = new ProjectRecordEntity(); + entity.setRecordid(recordId); + vo.setReportId(reportId); + vo.setEntity(entity); + R r = achievementManagementService.deleteReport(vo); + System.out.println(r); + } + + //测试查询班级实验成绩列表 + @Test + public void queryEvaluationReport(){ + String searchContant = "michonne"; + // String searchContant = ""; + Integer projectId = 368; + Integer page = 1; + Integer size = 2; + R r = achievementManagementService.queryEvaluationReport(searchContant,projectId,page,size); + System.out.println(r); +} + + //筛选查询-教学实验 + @Test + public void queryEvaluationReportByRecordId(){ + Integer month = 1; + Integer systemId = 1; + String searchContent= ""; + String staingTime = ""; + String endTime = ""; + List list = achievementManagementDao.countEducationProjectId(); + List result = achievementManagementDao.queryEducationRecord(systemId, searchContent, staingTime, endTime, month, list); + System.out.println(result); + } + //筛选查询-虚拟实验 + @Test + public void queryFictitiousReportByRecordId(){ + Integer month = null; + Integer systemId = 1; + String searchContent= ""; + String staingTime = ""; + String endTime = ""; + List list = achievementManagementDao.countFictitiousProjectId(); + List result = achievementManagementDao.queryFictitiousRecord(systemId, searchContent, staingTime, endTime, month, list); + System.out.println(result); + } + + @Test + public void testQuery(){ +// String str = "184,185"; + ArrayList integers = new ArrayList<>(); + integers.add(184); + integers.add(185); + + List achievementImportRequests = achievementManagementDao.queryAchievement(integers); + System.out.println(achievementImportRequests); + } +}