上传代码

master
zhiyong.ning 4 years ago
parent 90b26c90ab
commit 11463cbb56
  1. 27
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  2. 350
      src/main/java/com/yipin/liuwanr/entity/UserInfo.java
  3. 10
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  4. 4
      src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
  5. 2
      src/main/java/com/yipin/liuwanr/service/StaffService.java
  6. 27
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java

@ -5,7 +5,6 @@ import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService; import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.StudentService; import com.yipin.liuwanr.service.StudentService;
import com.yipin.liuwanr.service.UserInfoService; import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.service.UserService;
import com.yipin.liuwanr.vo.UserInfoVO; import com.yipin.liuwanr.vo.UserInfoVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -30,9 +29,6 @@ public class UserInfoController {
@Autowired @Autowired
private UserInfoService userInfoService; private UserInfoService userInfoService;
@Autowired
private UserService userService;
@Autowired @Autowired
RedisHelper redisHelper; RedisHelper redisHelper;
@ -693,4 +689,27 @@ public class UserInfoController {
} }
return resp; return resp;
} }
/**
* 查询电话
*/
@GetMapping("/queryPhone")
Response queryPhone(@RequestParam String phone) {
Response resp = new Response();
if (phone==null||phone=="") {//前台传来的值是否为空
resp.setStatus(300);
resp.setErrmessage("手机号为空!查询失败!");
}else {
HashMap<String, Object> ret = userInfoService.queryPhone(phone);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
} }

@ -1,5 +1,7 @@
package com.yipin.liuwanr.entity; package com.yipin.liuwanr.entity;
import lombok.Data;
import java.util.List; import java.util.List;
/** /**
@ -7,9 +9,12 @@ import java.util.List;
* *
* @author Ning * @author Ning
*/ */
@Data
public class UserInfo { public class UserInfo {
//用户id //用户id
private Integer userId; private Integer userId;
//用户token
private String token;
//角色id //角色id
private String roleId; private String roleId;
//用户姓名 //用户姓名
@ -94,349 +99,4 @@ public class UserInfo {
private String twoDepartmentName; private String twoDepartmentName;
//组织架构id //组织架构id
private Integer organizationRelationshipId; private Integer organizationRelationshipId;
public Integer getOrganizationRelationshipId() {
return organizationRelationshipId;
}
public void setOrganizationRelationshipId(Integer organizationRelationshipId) {
this.organizationRelationshipId = organizationRelationshipId;
}
public String getWorkNumber() {
return workNumber;
}
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public String getOneDepartmentIds() {
return oneDepartmentIds;
}
public void setOneDepartmentIds(String oneDepartmentIds) {
this.oneDepartmentIds = oneDepartmentIds;
}
public String getTwoDepartmentIds() {
return twoDepartmentIds;
}
public void setTwoDepartmentIds(String twoDepartmentIds) {
this.twoDepartmentIds = twoDepartmentIds;
}
public String getOneDepartmentName() {
return oneDepartmentName;
}
public void setOneDepartmentName(String oneDepartmentName) {
this.oneDepartmentName = oneDepartmentName;
}
public String getTwoDepartmentName() {
return twoDepartmentName;
}
public void setTwoDepartmentName(String twoDepartmentName) {
this.twoDepartmentName = twoDepartmentName;
}
public Integer getOneDepartmentId() {
return oneDepartmentId;
}
public void setOneDepartmentId(Integer oneDepartmentId) {
this.oneDepartmentId = oneDepartmentId;
}
public Integer getTwoDepartmentId() {
return twoDepartmentId;
}
public void setTwoDepartmentId(Integer twoDepartmentId) {
this.twoDepartmentId = twoDepartmentId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCountries() {
return countries;
}
public void setCountries(String countries) {
this.countries = countries;
}
public Integer getProvinceId() {
return provinceId;
}
public void setProvinceId(Integer provinceId) {
this.provinceId = provinceId;
}
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public String getCreationTime() {
return creationTime;
}
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}
public Integer getLogInNumber() {
return logInNumber;
}
public void setLogInNumber(Integer logInNumber) {
this.logInNumber = logInNumber;
}
public String getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(String lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Integer getDocumentType() {
return documentType;
}
public void setDocumentType(Integer documentType) {
this.documentType = documentType;
}
public String getIDNumber() {
return IDNumber;
}
public void setIDNumber(String IDNumber) {
this.IDNumber = IDNumber;
}
public Integer getEducationDegree() {
return educationDegree;
}
public void setEducationDegree(Integer educationDegree) {
this.educationDegree = educationDegree;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getWeChatID() {
return WeChatID;
}
public void setWeChatID(String weChatID) {
WeChatID = weChatID;
}
public String getDateBirth() {
return dateBirth;
}
public void setDateBirth(String dateBirth) {
this.dateBirth = dateBirth;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount;
}
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount;
}
public String getSearchContent() {
return searchContent;
}
public void setSearchContent(String searchContent) {
this.searchContent = searchContent;
}
public List<UserInfo> getUser() {
return user;
}
public void setUser(List<UserInfo> user) {
this.user = user;
}
public String getUserAvatars() {
return userAvatars;
}
public void setUserAvatars(String userAvatars) {
this.userAvatars = userAvatars;
}
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Integer getProfessionalClassId() {
return professionalClassId;
}
public void setProfessionalClassId(Integer professionalClassId) {
this.professionalClassId = professionalClassId;
}
public String getProfessionalClassName() {
return professionalClassName;
}
public void setProfessionalClassName(String professionalClassName) {
this.professionalClassName = professionalClassName;
}
public Integer getDisciplineId() {
return disciplineId;
}
public void setDisciplineId(Integer disciplineId) {
this.disciplineId = disciplineId;
}
public String getDisciplineName() {
return disciplineName;
}
public void setDisciplineName(String disciplineName) {
this.disciplineName = disciplineName;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
} }

@ -26,8 +26,8 @@ public interface UserInfoMapper {
"</script>"}) "</script>"})
void update(User user); void update(User user);
@Insert("INSERT INTO hr_user_info(userName,uniqueIdentificationAccount,documentType,IDNumber,provinceId,cityId,countries,dateBirth,educationDegree,schoolId,phone,weChatID,email,account,password,creationTime,logInNumber,sex,userAvatars,isdel,roleId)" @Insert("INSERT INTO hr_user_info(userName,uniqueIdentificationAccount,documentType,IDNumber,provinceId,cityId,countries,dateBirth,educationDegree,schoolId,phone,weChatID,email,account,password,creationTime,logInNumber,sex,userAvatars,isdel,roleId,token)"
+ " VALUES(#{userName},#{uniqueIdentificationAccount},#{documentType},#{IDNumber},#{provinceId},#{cityId},#{countries},#{dateBirth},#{educationDegree},#{schoolId},#{phone},#{weChatID},#{email},#{account},#{password},now(),0,#{sex},#{userAvatars},0,#{roleId})") + " VALUES(#{userName},#{uniqueIdentificationAccount},#{documentType},#{IDNumber},#{provinceId},#{cityId},#{countries},#{dateBirth},#{educationDegree},#{schoolId},#{phone},#{weChatID},#{email},#{account},#{password},now(),0,#{sex},#{userAvatars},0,#{roleId},#{token})")
@Options(useGeneratedKeys = true, keyProperty = "userId", keyColumn = "userId") @Options(useGeneratedKeys = true, keyProperty = "userId", keyColumn = "userId")
void addUser(UserInfo user); void addUser(UserInfo user);
@ -124,11 +124,11 @@ public interface UserInfoMapper {
void updateStudent(Student student); void updateStudent(Student student);
//登陆 //登陆
@Select("SELECT hui.schoolId,hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ") @Select("SELECT hui.token,hui.schoolId,hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ")
UserInfo logins(UserInfo userInfo); UserInfo logins(UserInfo userInfo);
//登陆 //登陆
@Select("SELECT userId,userName,roleId from hr_user_info where isdel=0 and account = #{account} and password = #{password}") @Select("SELECT token,userId,userName,roleId from hr_user_info where isdel=0 and account = #{account} and password = #{password}")
UserInfo adminLogins(UserInfo userInfo); UserInfo adminLogins(UserInfo userInfo);
//登陆账号密码 //登陆账号密码
@ -171,7 +171,7 @@ public interface UserInfoMapper {
List<Platform> queryUserPlatformStaff(Integer userId); List<Platform> queryUserPlatformStaff(Integer userId);
//查询用户手机 //查询用户手机
@Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}") @Select("SELECT userId,phone from hr_user_info where isdel=0 and phone = #{phone}")
List<UserInfo> queryPhone(String phone); List<UserInfo> queryPhone(String phone);
//查询用户详情 //查询用户详情

@ -183,8 +183,8 @@ public interface UserMapper {
UserM logins(UserM user); UserM logins(UserM user);
//查询用户手机 //查询用户手机
@Select("SELECT u.* from user u where isdel=0 and phone = #{phone}") @Select("SELECT u.phone,u.userId from hr_user_info u where isdel=0 and phone = #{phone}")
List<UserM> queryPhone(String phone); List<UserInfo> queryPhone(String phone);
//查询用户详情 //查询用户详情
@Select({"<script>", @Select({"<script>",

@ -3,6 +3,7 @@ package com.yipin.liuwanr.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID;
import com.yipin.liuwanr.entity.*; import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.vo.UserInfoVO; import com.yipin.liuwanr.vo.UserInfoVO;
@ -40,7 +41,6 @@ public class StaffService {
public HashMap<String, Object> readStaff(MultipartFile file,Integer schoolId){ public HashMap<String, Object> readStaff(MultipartFile file,Integer schoolId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
//读取excel文件中的员工信息 //读取excel文件中的员工信息
List<Staff> staffs = ExcelImportHelper.readStaff(file); List<Staff> staffs = ExcelImportHelper.readStaff(file);
List<UserM> users = new ArrayList<UserM>(); List<UserM> users = new ArrayList<UserM>();

@ -15,16 +15,17 @@ import com.yipin.liuwanr.mapper.UserInfoMapper;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import redis.clients.jedis.JedisCluster; import redis.clients.jedis.JedisCluster;
import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.concurrent.TimeUnit;
import java.util.HashMap;
import java.util.List;
@Service @Service
@ -43,6 +44,8 @@ public class UserInfoService {
private UserInfoMapper userInfoMapper; private UserInfoMapper userInfoMapper;
@Autowired @Autowired
private JedisCluster jedis; private JedisCluster jedis;
@Resource
StringRedisTemplate stringRedisTemplate;
@Autowired @Autowired
private AliyunOssConfig config; private AliyunOssConfig config;
@Autowired @Autowired
@ -110,6 +113,8 @@ public class UserInfoService {
resp.put("retvalue", "用户组织架构为空,添加用户失败!"); resp.put("retvalue", "用户组织架构为空,添加用户失败!");
}else { }else {
user.setPassword("huoran123");//设置默认密码 user.setPassword("huoran123");//设置默认密码
String token ="UT_"+UUID.randomUUID().toString().replace("-", "");
user.setToken(token);
userInfoMapper.addUser(user); userInfoMapper.addUser(user);
Integer userId = user.getUserId(); Integer userId = user.getUserId();
if (studentWorkNumber!=null){ if (studentWorkNumber!=null){
@ -388,17 +393,21 @@ public class UserInfoService {
public HashMap<String, Object> logins(UserInfo userInfo){ public HashMap<String, Object> logins(UserInfo userInfo){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> obj = new HashMap<String, Object>();
Integer userId = userInfo.getUserId(); Integer id = userInfo.getUserId();
String roleId = userInfo.getRoleId(); String roleId = userInfo.getRoleId();
Integer schoolId = userInfo.getSchoolId(); Integer schoolId = userInfo.getSchoolId();
try { try {
UserInfo user=userInfoMapper.logins(userInfo); UserInfo user=userInfoMapper.logins(userInfo);
String token = user.getToken();
Integer userId = user.getUserId();
obj.put("user",user); obj.put("user",user);
if(userId!=null) { if(id!=null) {
List<Staff> staffList = userInfoMapper.queryStaffAll(userId,roleId,schoolId); List<Staff> staffList = userInfoMapper.queryStaffAll(id,roleId,schoolId);
obj.put("staffList",staffList); obj.put("staffList",staffList);
List<Student> studentList = userInfoMapper.queryStudentAll(userId,roleId,schoolId); List<Student> studentList = userInfoMapper.queryStudentAll(id,roleId,schoolId);
obj.put("studentList",studentList); obj.put("studentList",studentList);
ValueOperations<String, String> redis = stringRedisTemplate.opsForValue();
redis.set(token,userId+"", 30 * 60, TimeUnit.SECONDS);
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", obj); resp.put("retvalue", obj);
}else { }else {
@ -690,7 +699,7 @@ public class UserInfoService {
return resp; return resp;
} }
//删除平台 //查询员工信息和学生信息
public HashMap<String, Object> queryStuAndSta(Integer platformId,Integer userId){ public HashMap<String, Object> queryStuAndSta(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> obj = new HashMap<String, Object>();

Loading…
Cancel
Save