From 850f7c87e01ce327a97486bcffb86573985e447b Mon Sep 17 00:00:00 2001 From: mzh820631607 Date: Fri, 30 Oct 2020 15:16:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=92=8C=E5=AE=8C=E5=96=840.?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msdw/tms/api/ClassTeachingApi.java | 5 + .../ExperimentalTeachingControllerApi.java | 9 +- .../msdw/tms/api/UserInfoControllerApi.java | 11 +- .../tms/config/CheckCodeQuartzConfig.java | 31 ++++- .../tms/config/quartz/CheckCodeQuartz.java | 1 + .../msdw/tms/config/quartz/TimeOutQuartz.java | 38 +++++ .../controller/ClassTeachingController.java | 20 ++- .../ExperimentalTeachingController.java | 35 ++++- .../tms/controller/StudentController.java | 15 +- .../tms/controller/UserInfoController.java | 54 +++++++- .../com/msdw/tms/dao/ClassTeachingDao.java | 2 + .../msdw/tms/dao/ExperimentalReportDao.java | 13 ++ .../java/com/msdw/tms/dao/StudentDao.java | 2 +- .../com/msdw/tms/dao/SystemSetttingDao.java | 2 + .../java/com/msdw/tms/dao/UserInfoDao.java | 8 ++ .../tms/entity/ExperimentalReportEntity.java | 45 ++++++ .../tms/entity/vo/ExperimentalReportVo.java | 31 +++++ .../msdw/tms/entity/vo/ProjectRecordVo.java | 4 + .../com/msdw/tms/entity/vo/StudentVo.java | 2 + .../service/ExperimentalReportService.java | 12 ++ .../com/msdw/tms/service/UserInfoService.java | 5 + .../impl/ClassTeachingServiceImpl.java | 1 + .../impl/ExperimentalReportServiceImpl.java | 31 +++++ .../impl/ExperimentalTeachingServiceImpl.java | 19 +++ .../tms/service/impl/StudentServiceImpl.java | 3 +- .../impl/SystemSettingServiceImpl.java | 131 +++++++++++++++--- .../tms/service/impl/UserInfoServiceImpl.java | 18 +++ .../resources/mapper/tms/ClassTeachingDao.xml | 27 ++-- .../mapper/tms/ExperimentalReportDao.xml | 53 +++++++ .../mapper/tms/ExperimentalTeachingDao.xml | 3 +- .../resources/mapper/tms/ProjectRecordDao.xml | 8 +- src/main/resources/mapper/tms/StudentDao.xml | 12 +- .../resources/mapper/tms/SystemSetting.xml | 11 ++ src/main/resources/mapper/tms/UserInfoDao.xml | 70 +++++++++- .../java/com/msdw/tms/SnowflakeIdUtils.java | 2 +- src/test/java/com/msdw/tms/Test.java | 8 -- .../tms/service/ExperimentalTeachingTest.java | 27 ++++ .../tms/service/QuestionsServiceTest.java | 4 +- 38 files changed, 699 insertions(+), 74 deletions(-) create mode 100644 src/main/java/com/msdw/tms/config/quartz/TimeOutQuartz.java create mode 100644 src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java create mode 100644 src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java create mode 100644 src/main/java/com/msdw/tms/entity/vo/ExperimentalReportVo.java create mode 100644 src/main/java/com/msdw/tms/service/ExperimentalReportService.java create mode 100644 src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java create mode 100644 src/main/resources/mapper/tms/ExperimentalReportDao.xml delete mode 100644 src/test/java/com/msdw/tms/Test.java create mode 100644 src/test/java/com/msdw/tms/service/ExperimentalTeachingTest.java diff --git a/src/main/java/com/msdw/tms/api/ClassTeachingApi.java b/src/main/java/com/msdw/tms/api/ClassTeachingApi.java index ab705f2..435b437 100644 --- a/src/main/java/com/msdw/tms/api/ClassTeachingApi.java +++ b/src/main/java/com/msdw/tms/api/ClassTeachingApi.java @@ -1,9 +1,11 @@ package com.msdw.tms.api; import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ExperimentalReportEntity; import com.msdw.tms.entity.ExperimentalTeachingEntity; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.RequestBody; @Api(value = "用户端班级实验", tags = "用户端班级实验信息") public interface ClassTeachingApi { @@ -22,4 +24,7 @@ public interface ClassTeachingApi { @ApiOperation(value = "校验是否需要邀请码",notes = "校验是否需要邀请码") R check(Integer userId,Integer projectId); + + @ApiOperation(value = "查看实验报告",notes = "查看实验报告") + R queryExperimentalReport(ExperimentalReportEntity entity); } diff --git a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java index ac88375..2c9dcec 100644 --- a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java +++ b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java @@ -7,6 +7,9 @@ import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.GetMapping; + +import java.text.ParseException; @Api(value = "实验教学",tags = "实验教学") public interface ExperimentalTeachingControllerApi { @@ -22,10 +25,10 @@ public interface ExperimentalTeachingControllerApi { @ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent); @ApiOperation(value = "添加实验教学",notes = "添加实验教学") - R save(ExperimentalTeachingEntity experimentalTeachingEntity); + R save(ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException; @ApiOperation(value = "修改用户个人档案",notes = "修改用户个人档案") - R update(ExperimentalTeachingEntity experimentalTeachingEntity); + R update(ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException; @ApiOperation(value = "删除用户个人档案",notes = "删除用户个人档案") R delete(Integer[] ids); @@ -36,4 +39,6 @@ public interface ExperimentalTeachingControllerApi { @ApiOperation(value = "查询邀请码是否存在",notes = "查询邀请码是否存在") R getInvitationCode(Integer invitationCode); + @ApiOperation(value = "校验实验名称是否重复", notes = "校验实验名称是否重复") + R checkExperimentalName(String experimentalName); } diff --git a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java index 6415f74..739c8f5 100644 --- a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java +++ b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java @@ -4,16 +4,23 @@ import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.vo.UserEntityVo; +import com.msdw.tms.entity.vo.UserProsonalEntityVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PathVariable; @Api(value = "用户管理",tags = "用户管理") public interface UserInfoControllerApi { - @ApiOperation(value = "个人中心信息修改",notes = "个人中心信息修改") - R update(UserInfoEntity userEntity); +// @ApiOperation(value = "个人中心信息修改",notes = "个人中心信息修改") +// R update(UserInfoEntity userEntity); @ApiOperation(value = "注册",notes = "注册") R save(UserInfoEntity entity); + @ApiOperation(value = "个人中心信息展示",notes = "个人中心信息展示") + R userInfo(Integer id); + + @ApiOperation(value = "个人中心-信息修改",notes = "个人中心-信息修改") + R updateUser(UserProsonalEntityVo userProsonalEntityVo); } diff --git a/src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java b/src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java index 114dab9..4ddad00 100644 --- a/src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java +++ b/src/main/java/com/msdw/tms/config/CheckCodeQuartzConfig.java @@ -1,6 +1,7 @@ package com.msdw.tms.config; 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; @@ -10,19 +11,16 @@ public class CheckCodeQuartzConfig { //定义任务详情 @Bean public JobDetail orderjobDetail() { - //指定job的名称和持久化保存任务 return JobBuilder - .newJob(CheckCodeQuartz.class) //自定义任务 - .withIdentity("checkCodeQuartz") //为任务定义名称 + .newJob(CheckCodeQuartz.class) + .withIdentity("checkCodeQuartz") .storeDurably() .build(); } //定义触发器 @Bean public Trigger orderTrigger() { - //通知调度器,程序多久执行一次 CronScheduleBuilder scheduleBuilder -// = CronScheduleBuilder.cronSchedule("5/20 * * ? * *"); //时间表达式 每分钟的5,25秒执行任务 = CronScheduleBuilder.cronSchedule("0 0 18 * * ? "); //时间表达式,每天的18点执行任务 return TriggerBuilder .newTrigger() @@ -30,4 +28,27 @@ public class CheckCodeQuartzConfig { .withIdentity("checkCodeQuartz") .withSchedule(scheduleBuilder).build(); } + //定义任务详情 + @Bean + public JobDetail timeOutJob() { + //指定job的名称和持久化保存任务 + return JobBuilder + .newJob(TimeOutQuartz.class) //自定义任务 + .withIdentity("timeOut") //为任务定义名称 + .storeDurably() + .build(); + } + //定义触发器 + @Bean + public Trigger timeTrigger() { + //通知调度器,程序多久执行一次 + CronScheduleBuilder scheduleBuilder +// = CronScheduleBuilder.cronSchedule("5/20 * * ? * *"); //时间表达式 每分钟的5,25秒执行任务 + = CronScheduleBuilder.cronSchedule("0 */1 * * * ?"); //时间表达式,每分钟执行一次 + return TriggerBuilder + .newTrigger() + .forJob(timeOutJob()) + .withIdentity("timeOut") + .withSchedule(scheduleBuilder).build(); + } } diff --git a/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java b/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java index 34c73db..eb73365 100644 --- a/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java +++ b/src/main/java/com/msdw/tms/config/quartz/CheckCodeQuartz.java @@ -21,4 +21,5 @@ public class CheckCodeQuartz implements Job { log.info("清理过期验证码"); } + } diff --git a/src/main/java/com/msdw/tms/config/quartz/TimeOutQuartz.java b/src/main/java/com/msdw/tms/config/quartz/TimeOutQuartz.java new file mode 100644 index 0000000..5227bc9 --- /dev/null +++ b/src/main/java/com/msdw/tms/config/quartz/TimeOutQuartz.java @@ -0,0 +1,38 @@ +package com.msdw.tms.config.quartz; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.msdw.tms.entity.ExperimentalTeachingEntity; +import com.msdw.tms.service.ExperimentalTeachingService; +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; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; + +@Slf4j +@Component +public class TimeOutQuartz implements Job { + + @Autowired + private ExperimentalTeachingService service; + + /** + * 将超时/结束的实验状态修改为3(结束) + * @param jobExecutionContext + * @throws JobExecutionException + */ + @Override + @Transactional + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { +// log.info("查询并关闭超时/结束任务"); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.le("stop_time",new Date()).ge("stop_time","1970-11-29 00:00:00").set("status",3); + boolean result = service.update(updateWrapper); + + } + +} diff --git a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java index c38c7ab..98de3b0 100644 --- a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java @@ -3,11 +3,12 @@ package com.msdw.tms.controller; import com.msdw.tms.api.ClassTeachingApi; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; -import com.msdw.tms.entity.BroadcastEntity; +import com.msdw.tms.entity.ExperimentalReportEntity; import com.msdw.tms.entity.ExperimentalStudentEntity; import com.msdw.tms.entity.ExperimentalTeachingEntity; import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.service.ClassTeachingService; +import com.msdw.tms.service.ExperimentalReportService; import com.msdw.tms.service.ExperimentalStudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +25,9 @@ public class ClassTeachingController implements ClassTeachingApi { private ClassTeachingService classTeachingService; @Autowired private ExperimentalStudentService experimentalStudentService; + @Autowired + private ExperimentalReportService experimentalReportService; + /** * 用户端查看班级实验列表 @@ -140,4 +144,18 @@ public class ClassTeachingController implements ClassTeachingApi { PageUtils page1 = classTeachingService.querySimulationPlayList(page,size); return R.ok().put("data",page1); } + + /** + * 学生查看实验报告 + * @param entity + * @return + */ + @Override + @PostMapping("/queryExperimentalReport") + public R queryExperimentalReport(@RequestBody ExperimentalReportEntity entity){ + + R result = experimentalReportService.queryReport(entity); + + 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 c6288d0..1f75c9a 100644 --- a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java @@ -16,9 +16,9 @@ import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; @RestController @RequestMapping("tms/exp") @@ -74,6 +74,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr PageUtils list = experimentalTeachingService.queryExperimentalTeaching(page,size,vo); return R.ok().put("list",list); } + /** * 保存 */ @@ -87,7 +88,25 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr * 修改 */ @PostMapping("/update") - public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){ + public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException { + //添加实验结束时间 + ExperimentalTeachingEntity byId = experimentalTeachingService.getById(experimentalTeachingEntity.getId()); + if (byId.getType()==1){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String time = byId.getExperimentDuration(); + int d = time.indexOf("d"); + int h = time.indexOf("h"); + int m = time.indexOf("m"); + int dd = Integer.parseInt(time.substring(0, d)); + int hh = Integer.parseInt(time.substring(d + 1, h)); + int mm = Integer.parseInt(time.substring(h + 1, m)); + int newTime = dd*24*60 + hh*60 + mm; + Calendar nowTime = Calendar.getInstance(); + Date date = new Date(); + nowTime.setTime(date); + nowTime.add(Calendar.MINUTE,newTime); + experimentalTeachingEntity.setStopTime(sdf.format(nowTime.getTime())); + } experimentalTeachingService.updateById(experimentalTeachingEntity); return R.ok(); @@ -103,6 +122,14 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr return R.ok(); } + @Override + @GetMapping("/check") + public R checkExperimentalName(@RequestParam String experimentalName){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("experimental_name",experimentalName); + if (experimentalTeachingService.count(queryWrapper)>0){return R.error(200,"实验名称不能重复");} + return R.ok(); + } // /** // * 修改 // */ diff --git a/src/main/java/com/msdw/tms/controller/StudentController.java b/src/main/java/com/msdw/tms/controller/StudentController.java index 299bf14..eb36304 100644 --- a/src/main/java/com/msdw/tms/controller/StudentController.java +++ b/src/main/java/com/msdw/tms/controller/StudentController.java @@ -67,7 +67,7 @@ public class StudentController implements StudentControllerApi{ userInfoList.setAccount(account) .setPhone(phone) .setEmail(studentVo.getEmail()) - .setSchoolId(studentVo.getSchoolId()) + .setSchoolId(studentVo.getSchoolAppellationId()) .setUserName(studentVo.getUserName()); userInfoService.saveUserInfo(userInfoList); @@ -111,18 +111,27 @@ public class StudentController implements StudentControllerApi{ * @return */ @Override + @Transactional @PutMapping("/updateStudent") public R updateStudent(@RequestBody StudentVo studentVo) { studentVo.setSchoolId(ConstantUtils.Keda_schoolId);//设定学校id + Integer studentId = studentVo.getStudentId(); + String phone = studentVo.getPhone(); if (studentId==null){ return R.error(400,"studentId不能为空"); } + studentService.updateWorkNumber(studentId);//先将原本的学号重置为00,便于判重 + userInfoService.updateAccount(studentVo.getUserId());//将手机号码/账号重置 Integer result = studentService.queryStudentIdNumber(studentVo.getWorkNumber(),ConstantUtils.Keda_schoolId); Integer res = userInfoService.queryStudentAccount(studentVo.getAccount(),ConstantUtils.Keda_schoolId); - - + Integer re = userInfoService.queryStudentPhone(phone, ConstantUtils.Keda_schoolId); + if (phone!=null&&phone!=""){ + if (re==1){ + return R.error("手机号码不能重复"); + } + } if (result==1){ return R.error("学号不能重复"); }else if (res==1){ diff --git a/src/main/java/com/msdw/tms/controller/UserInfoController.java b/src/main/java/com/msdw/tms/controller/UserInfoController.java index 552db3d..ff324b3 100644 --- a/src/main/java/com/msdw/tms/controller/UserInfoController.java +++ b/src/main/java/com/msdw/tms/controller/UserInfoController.java @@ -6,7 +6,9 @@ import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserInfoEntity; +import com.msdw.tms.entity.UserPersonalFileEntity; import com.msdw.tms.entity.vo.UserEntityVo; +import com.msdw.tms.entity.vo.UserProsonalEntityVo; import com.msdw.tms.service.StudentService; import com.msdw.tms.service.UserInfoService; import com.msdw.tms.service.UserService; @@ -15,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,6 +30,9 @@ public class UserInfoController implements UserInfoControllerApi { @Autowired private StudentService studentService; + @Autowired + private UserService userService; + /** * 列表 */ @@ -78,7 +84,7 @@ public class UserInfoController implements UserInfoControllerApi { /** * 修改 */ - @Override +// @Override @PutMapping("/update") public R update(@RequestBody UserInfoEntity userEntity){ userInfoService.updateById(userEntity); @@ -95,4 +101,50 @@ public class UserInfoController implements UserInfoControllerApi { return R.ok(); } + + /** + * 查询个人信息 + * @param id + * @return + */ + @Override + @GetMapping("/userinfo/{id}") + public R userInfo(@PathVariable("id") Integer id){ + + HashMap userEntityVoList = userService.queryUserInfo(id); +// UserEntityVo userEntityVo = userService.queryUserId(id); + return R.ok().put("data",userEntityVoList); + } + + /** + * 修改 + */ + @Override + @Transactional + @PutMapping("/updateUser") + public R updateUser(@RequestBody UserProsonalEntityVo vo){ + List entityList = vo.getPersonalFileEntities(); + UserInfoEntity userInfo = vo.getUserInfoEntity(); + Integer userId = userInfo.getUserId(); + String password = userInfo.getPassword(); + String userPassword = userInfoService.queryPasword(userId); + if (userPassword.equals(password)==true){ + return R.error(400,"false,the password is the same!!!"); + }else{ + userInfoService.updateUserInfoById(userInfo); + for (int i = 0;i querySimulationPlayList(Page page1); + + void updateSurplusTimeUp(ProjectRecordVo recordVo); } diff --git a/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java b/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java new file mode 100644 index 0000000..387daf4 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/ExperimentalReportDao.java @@ -0,0 +1,13 @@ +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.ExperimentalReportVo; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ExperimentalReportDao extends BaseMapper { + + ExperimentalReportVo queryReport(ExperimentalReportEntity entity); +} diff --git a/src/main/java/com/msdw/tms/dao/StudentDao.java b/src/main/java/com/msdw/tms/dao/StudentDao.java index 320d1aa..ba5f2ee 100644 --- a/src/main/java/com/msdw/tms/dao/StudentDao.java +++ b/src/main/java/com/msdw/tms/dao/StudentDao.java @@ -24,7 +24,7 @@ public interface StudentDao extends BaseMapper { Integer updateStudent(StudentVo studentVo); - void updateWorkNumber(String workNumber); + void updateWorkNumber(String workNumber,Integer studentId); boolean addStudentInfo(UserInfoEntity userInfoEntity); diff --git a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java index 88b747a..091dfd9 100644 --- a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java +++ b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java @@ -53,4 +53,6 @@ public interface SystemSetttingDao { Integer queryDepartmentNameGrade(String staffGradeName,Integer organizationId); Integer queryDepartmentNameOrganization(String staffProfessionalArchitectureName,Integer schoolId); + + boolean judgmentGrade(String name,Integer schoolId); } diff --git a/src/main/java/com/msdw/tms/dao/UserInfoDao.java b/src/main/java/com/msdw/tms/dao/UserInfoDao.java index 44b9409..4840745 100644 --- a/src/main/java/com/msdw/tms/dao/UserInfoDao.java +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -5,6 +5,7 @@ import com.msdw.tms.entity.StudentEntity; import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.vo.StaffVo; import com.msdw.tms.entity.vo.StudentVo; +import com.msdw.tms.entity.vo.UserProsonalEntityVo; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -47,4 +48,11 @@ public interface UserInfoDao extends BaseMapper { boolean setNUM(Integer userId); List queryUserInfo(StaffVo staffVo); + + List queryPersonalInfo(Integer userid); + + List queryPersonalFileES(Integer userid); + + List queryEmail(String email); + } diff --git a/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java b/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java new file mode 100644 index 0000000..6c37136 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/ExperimentalReportEntity.java @@ -0,0 +1,45 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +@TableName("tms_experimental_report") +@Data +@Accessors(chain = true) +public class ExperimentalReportEntity { + + //实验报告主键 + @TableId(type = IdType.AUTO) + private Integer reportId; + //绑定实验id + private Integer projectId; + //实验原理 + private String principle; + //实验内容 + private String content; + //实验步骤 + private String step; + //实验数据 + private String data; + //实验分析 + private String analysis; + //实验结论 + private String conclusion; + //实验总结 + private String summarize; + //对本实验过程的方法及手段的改进建议 + private String improvement; + //老师评语 + private String comment; + //绑定学生id + private Integer studentId; + //绑定老师id + private Integer teacherId; + //学时 + private String period; + //实验室名称 + private String laboratory; +} diff --git a/src/main/java/com/msdw/tms/entity/vo/ExperimentalReportVo.java b/src/main/java/com/msdw/tms/entity/vo/ExperimentalReportVo.java new file mode 100644 index 0000000..4142b39 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/ExperimentalReportVo.java @@ -0,0 +1,31 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.entity.ExperimentalReportEntity; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ExperimentalReportVo extends ExperimentalReportEntity { + + //学生用户id + private int userId; + //学生姓名 + private String userName; + //学号 + private String workNumber; + //学生班级id + private int experimentId; + //学生班级 + private String experimentalClassName; + //项目名称 + private String projectName; + //实验目标 + private String experimentGoal; + //指导老师 + private String teacherName; + //实验时间(提交时间) + private String submitTime; + //实验成绩 + private Integer score; +} 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 6addbe0..b35683b 100644 --- a/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java @@ -84,6 +84,10 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable * 封装多个项目id */ private List projectIds; + /** + * 学生ID + */ + private Integer studentId; // /** // * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成 diff --git a/src/main/java/com/msdw/tms/entity/vo/StudentVo.java b/src/main/java/com/msdw/tms/entity/vo/StudentVo.java index 5983c85..1231bb2 100644 --- a/src/main/java/com/msdw/tms/entity/vo/StudentVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/StudentVo.java @@ -36,4 +36,6 @@ public class StudentVo extends StudentEntity { private String uniqueIdentificationAccount; //绑定所属院校名称 private String schoolAppellationName; + //绑定所属院校id + private Integer schoolAppellationId; } diff --git a/src/main/java/com/msdw/tms/service/ExperimentalReportService.java b/src/main/java/com/msdw/tms/service/ExperimentalReportService.java new file mode 100644 index 0000000..74f2f5a --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ExperimentalReportService.java @@ -0,0 +1,12 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.vo.ExperimentalReportVo; + +public interface ExperimentalReportService extends IService { + + R queryReport(ExperimentalReportEntity entity); +} diff --git a/src/main/java/com/msdw/tms/service/UserInfoService.java b/src/main/java/com/msdw/tms/service/UserInfoService.java index 1fda227..24631dc 100644 --- a/src/main/java/com/msdw/tms/service/UserInfoService.java +++ b/src/main/java/com/msdw/tms/service/UserInfoService.java @@ -5,7 +5,9 @@ import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.vo.StudentVo; +import com.msdw.tms.entity.vo.UserProsonalEntityVo; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,4 +31,7 @@ public interface UserInfoService extends IService { Integer queryStudentPhone(String phone,Integer schoolId); + HashMap queryUserInfo(Integer id); + + void updateAccount(Integer userId); } diff --git a/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java index f3b9f61..2b64460 100644 --- a/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java @@ -41,6 +41,7 @@ public class ClassTeachingServiceImpl implements ClassTeachingService { recordVo.setIsdel(Constant.IsDel.NOT_DEL.getType()); this.classMapper.updateSurplusTimeNull(recordVo);//将已结束的实验的倒计时重置为0 this.classMapper.updateSurplusTime(recordVo);//倒计时:设定倒计时的剩余时间 + this.classMapper.updateSurplusTimeUp(recordVo);//倒计时:设定距离实验开始的剩余时间 IPage schoolRecord = this.classMapper.getByClassRecord(page1, recordVo); PageUtils pageUtils = new PageUtils(schoolRecord); return pageUtils; diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java new file mode 100644 index 0000000..111f075 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java @@ -0,0 +1,31 @@ +package com.msdw.tms.service.impl; + +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.ExperimentalReportDao; +import com.msdw.tms.dao.ExperimentalTeachingDao; +import com.msdw.tms.entity.ExperimentalReportEntity; +import com.msdw.tms.entity.vo.ExperimentalReportVo; +import com.msdw.tms.service.ExperimentalReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ExperimentalReportServiceImpl extends ServiceImpl implements ExperimentalReportService { + + @Autowired + private ExperimentalReportDao reportDao; + + @Override + public R queryReport(ExperimentalReportEntity entity) { + + if (entity.getStudentId()==null|entity.getProjectId()==null){ + return R.error(400,"studentId / projectId不能为空"); + } + ExperimentalReportVo result = reportDao.queryReport(entity); + 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 7ec2f6b..b4df586 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java @@ -7,6 +7,7 @@ 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.Query; +import com.msdw.tms.dao.ClassTeachingDao; import com.msdw.tms.dao.ExperimentalTeachingDao; import com.msdw.tms.dao.UserDao; import com.msdw.tms.entity.ExperimentalTeachingEntity; @@ -17,7 +18,9 @@ import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.service.ExperimentalTeachingService; import com.msdw.tms.service.UserService; import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -25,6 +28,8 @@ import java.util.Map; @Service("experimentalTeachingService") public class ExperimentalTeachingServiceImpl extends ServiceImpl implements ExperimentalTeachingService { + @Autowired + private ClassTeachingDao classTeachingDao; // @Override // public PageUtils queryPage(Map params) { @@ -37,11 +42,25 @@ 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; } +// @Override +// public PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO vo) { +// Page 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/StudentServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java index 9526a47..20a030e 100644 --- a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java @@ -94,7 +94,6 @@ public class StudentServiceImpl extends ServiceImpl im } } - @Transactional @Override public boolean updateStudent(StudentVo studentVo) { try { @@ -108,7 +107,7 @@ public class StudentServiceImpl extends ServiceImpl im @Override public void updateWorkNumber(Integer studentId) { - studentDao.updateWorkNumber("00");//将学号重置为00 + studentDao.updateWorkNumber("00",studentId);//将学号重置为00 } @Override diff --git a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java index fb43f45..79b7531 100644 --- a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java @@ -60,6 +60,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService { staffVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPassword(ConstantUtils.INITIAL_PASSWORD); String account = staffVo.getAccount(); String phone = staffVo.getPhone(); + String email = staffVo.getEmail(); String workNumber = staffVo.getWorkNumber(); List staff = staffVo.getStaff(); if (phone!=null&&phone!=""){ @@ -68,6 +69,12 @@ public class SystemSettingServiceImpl implements SystemSetttingService { return R.error(400,"手机号不能重复"); } } + if (email!=null&&email!=""){ + List resultE = userInfoDao.queryEmail(email); + if (resultE.size()>0){ + return R.error(400,"手机号不能重复"); + } + } List resultA = userInfoDao.queryAccount(account); // List resultW = systemSetttingDao.queryWorkNumber(workNumber); if(resultA.size()>0){ @@ -122,18 +129,16 @@ public class SystemSettingServiceImpl implements SystemSetttingService { staffVo.setPlatformId(ConstantUtils.PLATFORMID); String account = staffVo.getAccount(); String phone = staffVo.getPhone(); + String email = staffVo.getEmail(); String workNumber = staffVo.getWorkNumber(); List staff = staffVo.getStaff();//获取员工数据 StaffVo result = userInfoDao.queryAccountUpdate(staffVo.getUserId()); -// String roleIds = result.get(0).getRoleId(); -// StaffVo staffVo1 = result.get(0); String roleIds = result.getRoleId(); String[] splitOld = staffVo.getRoleId().split(","); String[] splitNew = roleIds.split(","); - if (splitOld.length==splitNew.length&&splitNew.length<2){ + if (splitOld.length==splitNew.length&&splitNew.length<3){ for (int i = 0;i resultE = userInfoDao.queryEmail(email); + if (resultE.size()>0){ + return R.error(400,"手机号不能重复"); + } + } if(resultA.size()>0){ return R.error(400,"账号不能重复"); }else if (resultW.size()>0){ @@ -175,16 +186,16 @@ public class SystemSettingServiceImpl implements SystemSetttingService { // throw new RuntimeException(); // } // } - if (!resultUserInfo) { - throw new RuntimeException(); - } + if (!resultUserInfo) { + throw new RuntimeException(); + } return R.ok(); } @Override public boolean deleteStaff(Integer userId) { boolean result = systemSetttingDao.deleteStaff(userId); - return result; + return result; } @Override @@ -220,6 +231,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService { } @Override + @Transactional public Map upload(MultipartFile file) throws IOException { HashMap map = new HashMap<>(); List staffs = ExcelImportHelper.readStaff(file); @@ -233,10 +245,16 @@ public class SystemSettingServiceImpl implements SystemSetttingService { Long ii = 1L; try { for (int i = 0;i0){//重复的数据 StaffExportVo vo = new StaffExportVo(); vo.setFailureMsg("用户信息已存在"); - ++ii; vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); staffs.remove(i); i--; failVo1.add(vo); continue; - } - if (resultW.size()>0){ + }else if (resultW.size()>0){ StaffExportVo vo = new StaffExportVo(); vo.setFailureMsg("重复的工号"); - ++ii; vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); staffs.remove(i); i--; @@ -265,7 +280,6 @@ public class SystemSettingServiceImpl implements SystemSetttingService { }else if (resultA.size()>0){ StaffExportVo vo = new StaffExportVo(); vo.setFailureMsg("重复的账号"); - ++ii; vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); staffs.remove(i); i--; @@ -276,7 +290,17 @@ public class SystemSettingServiceImpl implements SystemSetttingService { if (resultP.size()>0){ StaffExportVo vo = new StaffExportVo(); vo.setFailureMsg("重复的手机号码"); - ++ii; + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + } + }else if (email!=null&&email!=""){ + List resultE = userInfoDao.queryEmail(email); + if (resultE.size()>0){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("重复的邮箱号"); vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); staffs.remove(i); i--; @@ -284,16 +308,89 @@ public class SystemSettingServiceImpl implements SystemSetttingService { continue; } } - ++ii; + if (!staffs.isEmpty()&&staffs.size()>0){ staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())); - userInfoDao.addUserinfo(staffVo); staff.setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId()); + staffVo.setPlatformId(ConstantUtils.PLATFORMID); String[] split = staffVo.getRoleId().split(","); + String s = ""; + for (String str : split) { + s=s+str; + } + if (s.indexOf("2")!=-1){ + if (architectureName!=null&&architectureName!=""){ + if (gradeName==null|gradeName==""){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("二级部门不能为空"); + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + }else{ + Integer b = systemSetttingDao.queryDepartmentNameOrganization(architectureName, ConstantUtils.Keda_schoolId); + if (b==null){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("不存在的一级部门"); + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + } + boolean a = systemSetttingDao.judgmentGrade(architectureName,ConstantUtils.Keda_schoolId); + if (!a){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("不存在此子级部门"); + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + } + } + } + }else if (s.indexOf("3")!=-1){ + if (architectureNameTwo!=null&&architectureNameTwo!=""){ + if (gradeNameTwo==null|gradeNameTwo==""){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("二级部门不能为空"); + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + }else{ + Integer b = systemSetttingDao.queryDepartmentNameOrganization(architectureNameTwo, ConstantUtils.Keda_schoolId); + if (b==null){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("不存在的一级部门"); + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + } + boolean a = systemSetttingDao.judgmentGrade(architectureNameTwo,ConstantUtils.Keda_schoolId); + if (!a){ + StaffExportVo vo = new StaffExportVo(); + vo.setFailureMsg("不存在此子级部门"); + vo.setIndex(ii).setUserName(staffVo.getUserName()).setAccount(staffVo.getAccount()).setRole(staffVo.getRole()).setWorkNumber(staffVo.getWorkNumber()).setStaffGradeName(staffVo.getStaffGradeName()).setStaffProfessionalArchitectureName(staffVo.getStaffProfessionalArchitectureName()).setStaffGradeNameTwo(staffVo.getStaffGradeNameTwo()).setStaffProfessionalArchitectureNameTwo(staffVo.getStaffProfessionalArchitectureNameTwo()).setPhone(staffVo.getPhone()).setEmail(staffVo.getEmail()).setSchoolAppellationName(staffVo.getSchoolAppellationName()); + staffs.remove(i); + i--; + failVo1.add(vo); + continue; + } + } + } + } + + userInfoDao.addUserinfo(staffVo); for (String str : split){ if (Integer.parseInt(str)==2){ - Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeName(),ConstantUtils.Keda_schoolId); Integer organizationId = systemSetttingDao.queryDepartmentNameOrganization(staffVo.getStaffProfessionalArchitectureName(),ConstantUtils.Keda_schoolId); + Integer gradeId = systemSetttingDao.queryDepartmentNameGrade(staffVo.getStaffGradeName(),organizationId); staffVo.setStaffGradeId(gradeId).setStaffProfessionalArchitectureId(organizationId); boolean b = systemSetttingDao.addStaffManager(staffVo); if(!b){throw new RuntimeException();} 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 a10b937..4513374 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java @@ -11,6 +11,7 @@ import com.msdw.tms.entity.response.CommonCode; import com.msdw.tms.entity.response.ResponseResult; import com.msdw.tms.entity.response.ResultCode; import com.msdw.tms.entity.vo.StudentVo; +import com.msdw.tms.entity.vo.UserProsonalEntityVo; import com.msdw.tms.service.UserInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -114,4 +115,21 @@ public class UserInfoServiceImpl extends ServiceImpl queryUserInfo(Integer id) { + HashMap map = new HashMap(); + //用户sql user + List userInfo = userInfoDao.queryPersonalInfo(id); + map.put("userInfo",userInfo); + + List prosonalEntityESVos = userInfoDao.queryPersonalFileES(id);//档案里无学校信息时 + map.put("userPersonalFile",prosonalEntityESVos); + + return map; + } + + @Override + public void updateAccount( Integer userId) { + userInfoDao.setNUM(userId); + } } diff --git a/src/main/resources/mapper/tms/ClassTeachingDao.xml b/src/main/resources/mapper/tms/ClassTeachingDao.xml index 5c02718..c715161 100644 --- a/src/main/resources/mapper/tms/ClassTeachingDao.xml +++ b/src/main/resources/mapper/tms/ClassTeachingDao.xml @@ -58,19 +58,28 @@ - UPDATE tms_experimental_teaching - SET surplus_time = TIMEDIFF( stop_time, NOW( ) ) - WHERE - now( ) >= start_time - AND stop_time >= now( ) - AND is_del=0 + UPDATE tms_experimental_teaching + SET surplus_time = TIMEDIFF( stop_time, NOW( ) ) + WHERE + now( ) >= start_time + AND stop_time >= now( ) + AND is_del = 0 + AND `status` !=3 + UPDATE tms_experimental_teaching + SET surplus_time = 0 + WHERE + is_del = 0 + AND ( now( ) >= stop_time OR `status` = 3 ) + + UPDATE tms_experimental_teaching - SET surplus_time = 0 + SET surplus_time = TIMEDIFF(start_time,NOW( ) ) WHERE - now( ) >= stop_time - AND is_del=0 + start_time > now() + AND is_del = 0 + AND `status` !=3 +SELECT + u.userId, + u.userName, + stu.workNumber, + tet.project_name, + tet.id AS experimentId, + tet.experimental_class_name, + 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 projectId = #{projectId} ) ) AS teacherName, + ter.period, + ter.laboratory, + ter.principle, + ter.content, + ter.step, + ter.`data`, + ter.analysis, + ter.conclusion, + ter.summarize, + ter.improvement, + ter.`comment` +FROM + hr_user_info u, + student stu, + tms_experimental_report ter, + hr_project_management hpm, + tms_experimental_teaching tet, + tms_project_record tpr +WHERE + u.userId = stu.userId + AND stu.studentId = ter.studentId + AND hpm.projectId = tet.project_id + AND ter.projectId = tet.project_id + AND stu.userId = tpr.userId + AND tet.project_id = tpr.projectId + AND tet.stop_time = tpr.endTime + AND ter.studentId = #{studentId} + AND ter.projectId = #{projectId} + AND ter.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 fc47806..01907bb 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -19,7 +19,8 @@ invitation_code, is_code, user_id, - creation_time + creation_time, + surplus_time FROM tms_experimental_teaching WHERE diff --git a/src/main/resources/mapper/tms/ProjectRecordDao.xml b/src/main/resources/mapper/tms/ProjectRecordDao.xml index 03d7d16..ef5f35d 100644 --- a/src/main/resources/mapper/tms/ProjectRecordDao.xml +++ b/src/main/resources/mapper/tms/ProjectRecordDao.xml @@ -28,7 +28,7 @@ recordState FROM tms_project_record tpr - LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId + LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId WHERE tpr.userId = #{pro.userid} AND @@ -48,7 +48,7 @@ tet.experimental_class_name as experimentalClassName FROM tms_project_record tpr - LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId + LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId LEFT JOIN tms_experimental_teaching tet ON tet.project_id = tpr.projectId WHERE tpr.userId = #{pro.userid} @@ -68,7 +68,7 @@ tet.experimental_class_name FROM tms_project_record tpr - LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId + LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId LEFT JOIN tms_experimental_teaching tet ON tpr.projectId = tet.project_id WHERE tpr.userId = #{userid} @@ -110,7 +110,7 @@ COUNT(DISTINCT CASE WHEN recordState = '0' THEN recordState END) as tobescored FROM tms_project_record tpr - LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId + LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId LEFT JOIN hr_user_info u ON tpr.userId = u.userId LEFT JOIN school sc ON u.schoolId = sc.schoolId WHERE diff --git a/src/main/resources/mapper/tms/StudentDao.xml b/src/main/resources/mapper/tms/StudentDao.xml index 82024eb..4cbd992 100644 --- a/src/main/resources/mapper/tms/StudentDao.xml +++ b/src/main/resources/mapper/tms/StudentDao.xml @@ -10,7 +10,7 @@ u.userName, u.account, u.logInNumber, - u.schoolAppellationId, + u.schoolId AS schoolAppellationId, u.disableAccount, u.lastLoginTime, s.roleId, @@ -47,7 +47,7 @@ SELECT * FROM school WHERE schoolName = #{schoolAppellationName} @@ -94,9 +94,9 @@ u.account = #{account}, u.phone = #{phone}, u.phone = NULL, - u.email = #{email} - u.email = NULL - u.schoolId = #{schoolAppellationId}> + u.email = #{email}, + u.email = NULL, + u.schoolId = #{schoolAppellationId} WHERE u.userId = s.userId @@ -106,7 +106,7 @@ - update student set workNumber = #{workNumber} + update student set workNumber = #{workNumber} where studentId = #{studentId} \ No newline at end of file diff --git a/src/main/resources/mapper/tms/SystemSetting.xml b/src/main/resources/mapper/tms/SystemSetting.xml index d71c596..8d5380d 100644 --- a/src/main/resources/mapper/tms/SystemSetting.xml +++ b/src/main/resources/mapper/tms/SystemSetting.xml @@ -159,4 +159,15 @@ + \ 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 9ffced5..4fcbef4 100644 --- a/src/main/resources/mapper/tms/UserInfoDao.xml +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -6,10 +6,10 @@ insert into hr_user_info( userName, uniqueIdentificationAccount, provinceId, - cityId, schoolId, phone,account,password,roleId,schoolAppellationId,creationTime) + cityId, schoolId, phone,account,password,roleId,schoolId,creationTime) values( #{userName}, #{uniqueIdentificationAccount}, #{provinceId}, - #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolAppellationId},now()) + #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolId},now()) @@ -123,7 +123,7 @@ INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,creationTime) VALUES - ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolAppellationId}, #{account}, #{password}, 4 ,0,now()) + ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,now()) @@ -185,7 +185,7 @@ email = #{email}, - schoolAppellationId = #{schoolAppellationId}, + schoolId = #{schoolAppellationId}, roleId = #{roleId} @@ -196,7 +196,67 @@ UPDATE hr_user_info u SET - u.account = '00',u.phone = '00' + u.account = '00',u.phone = null WHERE userId = #{userId} + + + + + \ No newline at end of file diff --git a/src/test/java/com/msdw/tms/SnowflakeIdUtils.java b/src/test/java/com/msdw/tms/SnowflakeIdUtils.java index cf43898..2a22da6 100644 --- a/src/test/java/com/msdw/tms/SnowflakeIdUtils.java +++ b/src/test/java/com/msdw/tms/SnowflakeIdUtils.java @@ -159,7 +159,7 @@ public class SnowflakeIdUtils { return System.currentTimeMillis(); } - //==============================Test============================================= + //==============================JustTest============================================= /** * 测试 diff --git a/src/test/java/com/msdw/tms/Test.java b/src/test/java/com/msdw/tms/Test.java deleted file mode 100644 index 58099d4..0000000 --- a/src/test/java/com/msdw/tms/Test.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.msdw.tms; - -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -public class Test { - -} diff --git a/src/test/java/com/msdw/tms/service/ExperimentalTeachingTest.java b/src/test/java/com/msdw/tms/service/ExperimentalTeachingTest.java new file mode 100644 index 0000000..6e6584e --- /dev/null +++ b/src/test/java/com/msdw/tms/service/ExperimentalTeachingTest.java @@ -0,0 +1,27 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.msdw.tms.entity.ExperimentalTeachingEntity; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.Date; + +@SpringBootTest +public class ExperimentalTeachingTest { + @Autowired + private ExperimentalTeachingService service; + + @Test + public void queryExperimentalName(){ +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("experimental_name","测试"); +// int count = service.count(queryWrapper); +//// System.out.println(new Date()); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.ge("stop_time",new Date()).set("status",3); + boolean result = service.update(updateWrapper); + } +} diff --git a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java index 58631db..99c068c 100644 --- a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java +++ b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java @@ -67,7 +67,7 @@ class QuestionsServiceTest { System.out.println(questionsService.updateQuestionById(questions)); } -// @Test +// @JustTest // @Transactional // void isnable() { // Integer id = 1; @@ -120,7 +120,7 @@ class QuestionsServiceTest { questionsService.downloadFiles(response); } -// @Test +// @JustTest // void evaluation() { // EvaluationVO evaluation = questionsService.evaluation(); // System.out.println(evaluation.toString());