新增token

hehai
mzh820631607 4 years ago
commit 8048632ec5
  1. 1
      src/main/java/com/msdw/tms/api/ProjectControllerApi.java
  2. 9
      src/main/java/com/msdw/tms/common/utils/ConstantUtils.java
  3. 9
      src/main/java/com/msdw/tms/controller/StudentController.java
  4. 2
      src/main/java/com/msdw/tms/controller/SystemSettingController.java
  5. 2
      src/main/java/com/msdw/tms/entity/UserInfoEntity.java
  6. 2
      src/main/java/com/msdw/tms/entity/vo/StudentVo.java
  7. 5
      src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java
  8. 4
      src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java
  9. 1
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  10. 2
      src/main/resources/mapper/tms/StudentDao.xml
  11. 22
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -6,7 +6,6 @@ import io.swagger.annotations.ApiOperation;
@Api(value = "用户_实验学习",tags = "用户_实验学习")
public interface ProjectControllerApi {
@ApiOperation(value = "用户_实验学习实验项目",notes = "用户_实验学习实验项目")
R list(Integer userid);
}

@ -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;

@ -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);

@ -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);
}

@ -58,4 +58,6 @@ public class UserInfoEntity {
private Integer disableAccount;
//所属院校id
private Integer schoolAppellationId;
//token
private String token;
}

@ -38,4 +38,6 @@ public class StudentVo extends StudentEntity {
private String schoolAppellationName;
//绑定所属院校id
private Integer schoolAppellationId;
//token
private String token;
}

@ -178,10 +178,11 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
List<Integer> 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("该学号已存在");

@ -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) {

@ -41,6 +41,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity
@Override
public int add(UserInfoEntity userInfoEntity) {
UserInfoDao userDao = this.getBaseMapper();
userInfoEntity.setToken(new ConstantUtils().token);
int userId = userDao.add(userInfoEntity);
return userId;

@ -42,6 +42,8 @@
workNumber = #{workNumber}
AND
schoolId = #{schoolId}
AND
isdel = 0
</select>
<select id="querySchoolName" resultType="java.lang.Integer">
SELECT * FROM school WHERE schoolName = #{schoolAppellationName}

@ -6,10 +6,10 @@
<insert id="add" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
insert into hr_user_info(
userName, uniqueIdentificationAccount, provinceId,
cityId, schoolId, phone,account,password,roleId,schoolId,creationTime)
cityId, schoolId, phone,account,password,roleId,creationTime)
values(
#{userName}, #{uniqueIdentificationAccount}, #{provinceId},
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolId},now())
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},now())
</insert>
<update id="userInfupdateUserInfoById" parameterType="com.msdw.tms.entity.UserInfoEntity">
@ -69,6 +69,8 @@
hr_user_info
WHERE
account = #{account}
AND
isdel = 0
</select>
<select id="queryStudentPhone" resultType="com.msdw.tms.entity.StudentEntity">
SELECT
@ -77,6 +79,8 @@
hr_user_info
WHERE
phone = #{phone}
AND
isdel = 0
</select>
<select id="queryPhone" resultType="java.lang.Integer">
SELECT
@ -117,12 +121,14 @@
WHERE
u.userId = s.userId
AND u.account = #{account} and u.phone = #{phone} and s.workNumber = #{workNumber}
AND
u.isdel = 0
</select>
<insert id="saveUserInfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
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})
</insert>
<!-- <insert id="bacthAddStudents">-->
<!-- insert into hr_user_info(-->
@ -136,16 +142,16 @@
<!-- </insert>-->
<insert id="batchSaveUserInfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
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>
<insert id="addUserinfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
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})
</insert>
<update id="initialPassword">

Loading…
Cancel
Save