From 0bbfb24c85624d08a6505b3da0d934e47c57a466 Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Wed, 11 Nov 2020 17:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msdw/tms/api/ProjectControllerApi.java | 1 - .../tms/controller/StudentController.java | 9 ++- .../com/msdw/tms/entity/UserInfoEntity.java | 2 + .../tms/service/impl/StudentServiceImpl.java | 65 +------------------ src/main/resources/application.yml | 2 +- src/main/resources/mapper/tms/UserInfoDao.xml | 4 +- 6 files changed, 13 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/msdw/tms/api/ProjectControllerApi.java b/src/main/java/com/msdw/tms/api/ProjectControllerApi.java index 42b1042..09d215d 100644 --- a/src/main/java/com/msdw/tms/api/ProjectControllerApi.java +++ b/src/main/java/com/msdw/tms/api/ProjectControllerApi.java @@ -6,7 +6,6 @@ import io.swagger.annotations.ApiOperation; @Api(value = "用户_实验学习",tags = "用户_实验学习") public interface ProjectControllerApi { - @ApiOperation(value = "用户_实验学习实验项目",notes = "用户_实验学习实验项目") R list(Integer userid); } diff --git a/src/main/java/com/msdw/tms/controller/StudentController.java b/src/main/java/com/msdw/tms/controller/StudentController.java index eb36304..044d96e 100644 --- a/src/main/java/com/msdw/tms/controller/StudentController.java +++ b/src/main/java/com/msdw/tms/controller/StudentController.java @@ -13,6 +13,7 @@ import com.msdw.tms.service.StudentService; import com.msdw.tms.service.UserInfoService; import com.sun.xml.bind.v2.model.core.ID; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -22,6 +23,8 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; /** * 学生管理 @@ -64,11 +67,13 @@ public class StudentController implements StudentControllerApi{ } else{ UserInfoEntity userInfoList = new UserInfoEntity(); + String token ="UT_"+ UUID.randomUUID().toString().replace("-", ""); userInfoList.setAccount(account) .setPhone(phone) .setEmail(studentVo.getEmail()) .setSchoolId(studentVo.getSchoolAppellationId()) - .setUserName(studentVo.getUserName()); + .setUserName(studentVo.getUserName()) + .setToken(token); userInfoService.saveUserInfo(userInfoList); studentVo.setUserId(userInfoList.getUserId()).setPlatformId(ConstantUtils.PLATFORMID);//暂时写死平台id(PlatformId) @@ -211,7 +216,7 @@ public class StudentController implements StudentControllerApi{ } @Override - @GetMapping("/export_failure") + @GetMapping("/exportFailure") public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{ studentService.exportFailureRecord(response,token); diff --git a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java index 646ddb8..7a2b646 100644 --- a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java +++ b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java @@ -58,4 +58,6 @@ public class UserInfoEntity { private Integer disableAccount; //所属院校id private Integer schoolAppellationId; + //token + private String token; } 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 20a030e..833f288 100644 --- a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java @@ -145,7 +145,7 @@ public class StudentServiceImpl extends ServiceImpl im Map map = new HashMap<>(); Long ii = 1L;//用于记录序列号 try { - for (int i = 0;i im export(response, inputStream, parse, "学生信息导入失败表.xlsx"); } -// public HashMap readStudent(Integer schoolId, MultipartFile file) { -// HashMap resp = new HashMap(); -// try { -// // 读取excel文件中的学生信息 -// List students = ExcelImportHelper.readStudent(file); -// List users = new ArrayList(); -// // 循环员工信息,将员工信息与用户信息进行对比 -// for (int i = 0; i < students.size(); i++) { -// Student student = students.get(i); -// // 学校id -// student.setSchoolId(schoolId); -// -// Student stu=studentMapper.getStudent(student); -// -// if(stu!=null) { -// // 专业id -// student.setProfessionalId(stu.getProfessionalId()); -// // 年级 -// student.setGradeId(stu.getGradeId()); -// //班级 -// student.setClassId(stu.getClassId()); -// -// UserM user = new UserM(); -// // 用户名称 -// user.setName(student.getStudentName()); -// // 用户密码 -// user.setPassword("huoran123"); -// // 用户角色 -// user.setAccountRole(student.getRoleId()); -// // 工号 -// user.setWorkNumber(student.getWorkNumber()); -// // 手机号 -// user.setPhone(student.getPhone()); -// // 邮箱 -// user.setEmail(student.getEmail()); -// // 唯一标识性账号 -// user.setUniqueIdentificationAccount(student.getUniqueIdentificationAccount()); -// // 学校id -// user.setSchoolId(schoolId); -// -// users.add(user); -// -// }else { -// students.remove(i); -// i--; -// } -// } -// if (!students.isEmpty() && students.size() > 0) { -// // 批量添加学生 -// studentMapper.bacthAddStudent(students); -// // 批量添加用户 -// userMapper.addUserM(users); -// } -// resp.put("retcode", 200); -// } catch (RuntimeException e) { -// logger.error(e.getMessage()); -// resp.put("retcode", 500); -// resp.put("retvalue", "Inquiry Failed"); -// return resp; -// } -// return resp; -// } - } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5660afe..3bd9f98 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,7 +5,7 @@ spring: # url: jdbc:mysql://www.liuwanr.cn:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai # username: super # password: huoran888 - url: jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + url: jdbc:mysql://rm-wz9y13wf7u8q8610-fwo.mysql.rds.aliyuncs.com:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai username: super password: huoran888 # url: jdbc:mysql://localhost:3306/msdw_tms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai diff --git a/src/main/resources/mapper/tms/UserInfoDao.xml b/src/main/resources/mapper/tms/UserInfoDao.xml index 4fcbef4..20f1c46 100644 --- a/src/main/resources/mapper/tms/UserInfoDao.xml +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -121,9 +121,9 @@ - INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,creationTime) + INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,creationTime,token) VALUES - ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,now()) + ( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,now(),#{token})