新增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 = "用户_实验学习") @Api(value = "用户_实验学习",tags = "用户_实验学习")
public interface ProjectControllerApi { public interface ProjectControllerApi {
@ApiOperation(value = "用户_实验学习实验项目",notes = "用户_实验学习实验项目") @ApiOperation(value = "用户_实验学习实验项目",notes = "用户_实验学习实验项目")
R list(Integer userid); R list(Integer userid);
} }

@ -1,9 +1,16 @@
package com.msdw.tms.common.utils; package com.msdw.tms.common.utils;
import java.util.UUID;
/** /**
* 此类用于公用常量设置 * 此类用于公用 常量/变量 设置
*/ */
public class ConstantUtils { public class ConstantUtils {
//用户新增 token
public String token ="UT_"+ UUID.randomUUID().toString().replace("-", "");
//绑定电子科大的schoolId //绑定电子科大的schoolId
public static final Integer Keda_schoolId = 2105; 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.msdw.tms.service.UserInfoService;
import com.sun.xml.bind.v2.model.core.ID; import com.sun.xml.bind.v2.model.core.ID;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -22,6 +23,8 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/** /**
* 学生管理 * 学生管理
@ -64,11 +67,13 @@ public class StudentController implements StudentControllerApi{
} }
else{ else{
UserInfoEntity userInfoList = new UserInfoEntity(); UserInfoEntity userInfoList = new UserInfoEntity();
userInfoList.setAccount(account) userInfoList.setAccount(account)
.setPhone(phone) .setPhone(phone)
.setEmail(studentVo.getEmail()) .setEmail(studentVo.getEmail())
.setSchoolId(studentVo.getSchoolAppellationId()) .setSchoolId(studentVo.getSchoolAppellationId())
.setUserName(studentVo.getUserName()); .setUserName(studentVo.getUserName())
.setToken(new ConstantUtils().token);
userInfoService.saveUserInfo(userInfoList); userInfoService.saveUserInfo(userInfoList);
studentVo.setUserId(userInfoList.getUserId()).setPlatformId(ConstantUtils.PLATFORMID);//暂时写死平台id(PlatformId) studentVo.setUserId(userInfoList.getUserId()).setPlatformId(ConstantUtils.PLATFORMID);//暂时写死平台id(PlatformId)
@ -211,7 +216,7 @@ public class StudentController implements StudentControllerApi{
} }
@Override @Override
@GetMapping("/exportFailure") @GetMapping("/export_failure")
public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{ public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{
studentService.exportFailureRecord(response,token); studentService.exportFailureRecord(response,token);

@ -136,7 +136,7 @@ public class SystemSettingController implements SystemSetttingApi {
* @throws Exception * @throws Exception
*/ */
@Override @Override
@GetMapping("/exportFailure") @GetMapping("/export_failure")
public void exportFailureRecord(HttpServletResponse response, @RequestParam String token) throws Exception{ public void exportFailureRecord(HttpServletResponse response, @RequestParam String token) throws Exception{
systemSetttingService.exportFailureRecord(response,token); systemSetttingService.exportFailureRecord(response,token);
} }

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

@ -38,4 +38,6 @@ public class StudentVo extends StudentEntity {
private String schoolAppellationName; private String schoolAppellationName;
//绑定所属院校id //绑定所属院校id
private Integer schoolAppellationId; 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); List<Integer> result3 = studentDao.querySchoolName(schoolAppellationName);
// 唯一标示性账号 // 唯一标示性账号
studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())). 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) .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){ if (result1.size()>=1){
log.error("该学号已存在"); log.error("该学号已存在");

@ -58,7 +58,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
@Override @Override
@Transactional @Transactional
public R addStaff(StaffVo staffVo) { 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 account = staffVo.getAccount();
String phone = staffVo.getPhone(); String phone = staffVo.getPhone();
String email = staffVo.getEmail(); String email = staffVo.getEmail();
@ -312,7 +312,7 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
if (!staffs.isEmpty()&&staffs.size()>0){ if (!staffs.isEmpty()&&staffs.size()>0){
staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())); staffVo.setPassword(ConstantUtils.INITIAL_PASSWORD).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis()));
staff.setPlatformId(ConstantUtils.PLATFORMID).setUserId(staffVo.getUserId()); 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[] split = staffVo.getRoleId().split(",");
String s = ""; String s = "";
for (String str : split) { for (String str : split) {

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

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

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

Loading…
Cancel
Save