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/common/utils/ConstantUtils.java b/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java index f7f9adc..c5a9703 100644 --- a/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java +++ b/src/main/java/com/msdw/tms/common/utils/ConstantUtils.java @@ -1,9 +1,16 @@ package com.msdw.tms.common.utils; +import java.util.UUID; + /** - * 此类用于公用常量设置 + * 此类用于公用 常量/变量 设置 */ public class ConstantUtils { + //用户新增 token + public String token ="UT_"+ UUID.randomUUID().toString().replace("-", ""); + + + //绑定电子科大的schoolId public static final Integer Keda_schoolId = 2105; diff --git a/src/main/java/com/msdw/tms/controller/StudentController.java b/src/main/java/com/msdw/tms/controller/StudentController.java index dcc88c1..2a457ea 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(); + userInfoList.setAccount(account) .setPhone(phone) .setEmail(studentVo.getEmail()) .setSchoolId(studentVo.getSchoolAppellationId()) - .setUserName(studentVo.getUserName()); + .setUserName(studentVo.getUserName()) + .setToken(new ConstantUtils().token); userInfoService.saveUserInfo(userInfoList); studentVo.setUserId(userInfoList.getUserId()).setPlatformId(ConstantUtils.PLATFORMID);//暂时写死平台id(PlatformId) @@ -211,7 +216,7 @@ public class StudentController implements StudentControllerApi{ } @Override - @GetMapping("/exportFailure") + @GetMapping("/export_failure") public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{ studentService.exportFailureRecord(response,token); diff --git a/src/main/java/com/msdw/tms/controller/SystemSettingController.java b/src/main/java/com/msdw/tms/controller/SystemSettingController.java index 905ce2f..cf67939 100644 --- a/src/main/java/com/msdw/tms/controller/SystemSettingController.java +++ b/src/main/java/com/msdw/tms/controller/SystemSettingController.java @@ -136,7 +136,7 @@ public class SystemSettingController implements SystemSetttingApi { * @throws Exception */ @Override - @GetMapping("/exportFailure") + @GetMapping("/export_failure") public void exportFailureRecord(HttpServletResponse response, @RequestParam String token) throws Exception{ systemSetttingService.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/entity/vo/StudentVo.java b/src/main/java/com/msdw/tms/entity/vo/StudentVo.java index 1231bb2..4c477a3 100644 --- a/src/main/java/com/msdw/tms/entity/vo/StudentVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/StudentVo.java @@ -38,4 +38,6 @@ public class StudentVo extends StudentEntity { private String schoolAppellationName; //绑定所属院校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 b537532..4c984ed 100644 --- a/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java @@ -178,10 +178,11 @@ public class StudentServiceImpl extends ServiceImpl im List result3 = studentDao.querySchoolName(schoolAppellationName); // 唯一标示性账号 studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())). - setPassword(ConstantUtils.INITIAL_PASSWORD) + setPassword(ConstantUtils.INITIAL_PASSWORD).setToken(new ConstantUtils().token) .setSchoolId(ConstantUtils.Keda_schoolId).setRoleId(ConstantUtils.STUDENT_ROLE) ; - studentVo.setAccount(student.getAccount()).setSchoolAppellationName(schoolAppellationName).setUserName(student.getUserName()).setIsdel(Constant.IsDel.NOT_DEL.getType()); + studentVo.setAccount(student.getAccount()).setSchoolAppellationName(schoolAppellationName) + .setUserName(student.getUserName()).setIsdel(Constant.IsDel.NOT_DEL.getType()); if (result1.size()>=1){ log.error("该学号已存在"); 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 9898295..879d031 100644 --- a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java @@ -58,7 +58,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService { @Override @Transactional public R addStaff(StaffVo staffVo) { - staffVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPassword(ConstantUtils.INITIAL_PASSWORD); + staffVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPassword(ConstantUtils.INITIAL_PASSWORD).setToken(new ConstantUtils().token); String account = staffVo.getAccount(); String phone = staffVo.getPhone(); String email = staffVo.getEmail(); @@ -312,7 +312,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService { if (!staffs.isEmpty()&&staffs.size()>0){ staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())); staff.setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId()); - staffVo.setPlatformId(ConstantUtils.PLATFORMID); + staffVo.setPlatformId(ConstantUtils.PLATFORMID).setToken(new ConstantUtils().token); String[] split = staffVo.getRoleId().split(","); String s = ""; for (String str : split) { 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 68ce1f5..66ffad0 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java @@ -41,6 +41,7 @@ public class UserInfoServiceImpl extends ServiceImpl - 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}) @@ -136,16 +142,16 @@ insert into hr_user_info( - userName, uniqueIdentificationAccount, phone,account,password,roleId, schoolId,creationTime) + userName, uniqueIdentificationAccount, phone,account,password,roleId, schoolId,creationTime,token) values (#{userName}, #{uniqueIdentificationAccount}, #{phone}, #{account},#{password},#{roleId}, - (SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now()) + (SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now(),#{token}) - INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime,password) + INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime,password,token) VALUES - (#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now(),#{password}) + (#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now(),#{password},#{token})