@ -1,11 +1,13 @@
package com.yipin.liuwanr.controller ;
package com.yipin.liuwanr.controller ;
import com.yipin.liuwanr.entity.* ;
import com.yipin.liuwanr.entity.* ;
import com.yipin.liuwanr.helper.QueryStudentUtils ;
import com.yipin.liuwanr.helper.RedisHelper ;
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.vo.UserInfoVO ;
import com.yipin.liuwanr.vo.UserInfoVO ;
import jdk.nashorn.internal.ir.IfNode ;
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 ;
import org.springframework.web.bind.annotation.* ;
import org.springframework.web.bind.annotation.* ;
@ -13,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse ;
import javax.servlet.http.HttpServletResponse ;
import java.util.Arrays ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.List ;
import java.util.List ;
@ -32,8 +35,131 @@ public class UserInfoController {
@Autowired
@Autowired
RedisHelper redisHelper ;
RedisHelper redisHelper ;
/ * *
/ * *
* 添加用户
* 接收参数 :
* UserInfo : account , userName , roleId , uniqueIdentificationAccount , phone , email
* OrganizationRelationship : workNumber , professionalClassId , gradeId , classId
* /
@PostMapping ( "/addStudent" )
Response addUserInfo ( @RequestBody UserInfoVO vo ) {
Response response = new Response ( ) ;
// Student student = vo.getStudent();
UserInfo userInfo = vo . getUserInfo ( ) ;
OrganizationRelationship organizationRelationship = vo . getOrganizationRelationship ( ) ;
String account = userInfo . getAccount ( ) ;
String userName = userInfo . getUserName ( ) ;
Integer roleId = userInfo . getRoleId ( ) ;
String uniqueIdentificationAccount = userInfo . getUniqueIdentificationAccount ( ) ;
String phone = userInfo . getPhone ( ) ;
String email = userInfo . getEmail ( ) ;
String workNumber = organizationRelationship . getWorkNumber ( ) ;
Integer professionalId = organizationRelationship . getProfessionalId ( ) ;
Integer gradeId = organizationRelationship . getGradeId ( ) ;
Integer classId = organizationRelationship . getClassId ( ) ;
// UserM user = vo.getUser();
if ( account = = null | | userName = = null | | roleId ! = 4 | | uniqueIdentificationAccount = = null | | workNumber = = null | | professionalId < = 0 | | gradeId < = 0 | | classId < = 0 ) {
response . setStatus ( 300 ) ;
response . setErrmessage ( "Parameter Invalid" ) ;
} else {
HashMap < String , Object > ret = userInfoService . addUserInfo ( userInfo ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
response . setStatus ( status ) ;
response . setMessage ( ret . get ( "retvalue" ) ) ;
HashMap < String , Object > ret1 = userInfoService . addOrganizationRelationship ( organizationRelationship ) ;
int status1 = ( int ) ret . get ( "retcode" ) ;
if ( status1 = = 200 ) {
response . setStatus ( status1 ) ;
response . setMessage ( ret1 . get ( "retvalue" ) ) ;
} else {
response . setStatus ( status1 ) ;
response . setErrmessage ( ret1 . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
}
} else {
response . setStatus ( status ) ;
response . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
}
}
return response ;
}
/ * *
* 查询学生信息
* @param schoolId
* @param professionalIds
* @param searchContent
* @param gradeIds
* @param classIds
* @param pageNo
* @param pageSize
* @return
* /
@GetMapping ( "/queryStudent" )
Response queryStudent ( @RequestParam Integer schoolId , Integer [ ] professionalIds , String searchContent , Integer [ ] gradeIds , Integer [ ] classIds , Integer pageNo , Integer pageSize ) {
Response response = new Response ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
OrganizationRelationship ship = new OrganizationRelationship ( ) ;
HashMap < Object , Object > ids = new HashMap < > ( 8 ) ;
if ( schoolId = = null ) {
response . setStatus ( 300 ) ;
response . setErrmessage ( "学校信息为空" ) ;
} else {
if ( searchContent ! = null & & searchContent ! = "" ) {
userInfo . setSearchContent ( searchContent ) ;
}
if ( professionalIds . length > 0 ) {
// List<Integer> professionalList = Arrays.asList(professionalId);
for ( Integer professionalId : professionalIds ) {
ship . setProfessionalId ( professionalId ) ;
}
}
if ( gradeIds . length > 0 ) {
// List<Integer> gradeList = Arrays.asList(gradeIds);
for ( Integer gradeId : gradeIds ) {
ship . setGradeId ( gradeId ) ;
}
}
if ( classIds . length > 0 ) {
// List<Integer> classList = Arrays.asList(classIds);
for ( Integer classId : classIds ) {
ship . setClassId ( classId ) ;
}
}
userInfo . setSchoolId ( schoolId ) ;
// HashMap map = userInfoService.queryStudent(userInfo,ship,pageNo,pageSize);
// QueryStudentUtils.statusInformationController(response,map, "retcode", "retvalue");
}
return response ;
}
/ * *
* 批量删除学生
*
* @param ids 用户id
* @return
* /
@GetMapping ( "/deleteStudent" )
Response deleteStudent ( Integer [ ] ids ) {
Response response = new Response ( ) ;
if ( ids . length > 0 ) {
userInfoService . deleteStudent ( ids ) ;
response . setStatus ( 200 ) ;
} else {
response . setStatus ( 500 ) ;
response . setErrmessage ( "学生id不能为空" ) ;
}
return response ;
}
/ * *
* 添加用户
* /
* /
@Transactional
@Transactional
@PostMapping ( "/addUser" )
@PostMapping ( "/addUser" )
@ -59,45 +185,45 @@ public class UserInfoController {
Integer cityId = user . getCityId ( ) ;
Integer cityId = user . getCityId ( ) ;
//学校id
//学校id
Integer schoolId = user . getSchoolId ( ) ;
Integer schoolId = user . getSchoolId ( ) ;
if ( name = = null | | name = = "" ) {
if ( name = = null | | name = = "" ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "姓名不能为空!" ) ;
resp . setErrmessage ( "姓名不能为空!" ) ;
} else if ( provinceId = = null ) {
} else if ( provinceId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "省份不能为空!" ) ;
resp . setErrmessage ( "省份不能为空!" ) ;
} else if ( cityId = = null ) {
} else if ( cityId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "城市不能为空!" ) ;
resp . setErrmessage ( "城市不能为空!" ) ;
} else if ( schoolId = = null ) {
} else if ( schoolId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "学校不能为空!" ) ;
resp . setErrmessage ( "学校不能为空!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . addUser ( user ) ;
HashMap < String , Object > ret = userInfoService . addUser ( user ) ;
Integer userId = user . getUserId ( ) ;
Integer userId = user . getUserId ( ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
resp . setMessage ( ret . get ( "retvalue" ) ) ;
resp . setMessage ( ret . get ( "retvalue" ) ) ;
HashMap < String , Object > stu = userInfoService . addPersonalFile ( userProfilesList , userId ) ;
HashMap < String , Object > stu = userInfoService . addPersonalFile ( userProfilesList , userId ) ;
int stuStatus = ( int ) stu . get ( "retcode" ) ;
int stuStatus = ( int ) stu . get ( "retcode" ) ;
if ( stuStatus = = 200 ) {
if ( stuStatus = = 200 ) {
resp . setStatus ( stuStatus ) ;
resp . setStatus ( stuStatus ) ;
resp . setMessage ( stu . get ( "retvalue" ) ) ;
resp . setMessage ( stu . get ( "retvalue" ) ) ;
} else {
} else {
resp . setStatus ( stuStatus ) ;
resp . setStatus ( stuStatus ) ;
resp . setErrmessage ( stu . get ( "retvalue" ) . toString ( ) ) ;
resp . setErrmessage ( stu . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
throw new RuntimeException ( ) ;
}
}
HashMap < String , Object > sta = userInfoService . addStuStaff ( ORList , userId ) ;
HashMap < String , Object > sta = userInfoService . addStuStaff ( ORList , userId ) ;
int staStatus = ( int ) sta . get ( "retcode" ) ;
int staStatus = ( int ) sta . get ( "retcode" ) ;
if ( staStatus = = 200 ) {
if ( staStatus = = 200 ) {
resp . setStatus ( staStatus ) ;
resp . setStatus ( staStatus ) ;
resp . setMessage ( sta . get ( "retvalue" ) ) ;
resp . setMessage ( sta . get ( "retvalue" ) ) ;
} else {
} else {
resp . setStatus ( staStatus ) ;
resp . setStatus ( staStatus ) ;
resp . setErrmessage ( sta . get ( "retvalue" ) . toString ( ) ) ;
resp . setErrmessage ( sta . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
throw new RuntimeException ( ) ;
}
}
} else {
} else {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
resp . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
resp . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
@ -108,49 +234,50 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 查询用户 ( 根据国家 、 省份 、 城市 )
* 查询用户 ( 根据国家 、 省份 、 城市 )
* /
* /
@GetMapping ( "/queryUserInfo" )
@GetMapping ( "/queryUserInfo" )
Response queryUserInfo ( @RequestParam String countries , Integer provinceId , Integer cityId , Integer pageNo , Integer pageSize , Integer schoolId , Integer roleId , String searchContent , Integer month , String creationTime , String endTime ) {
Response queryUserInfo ( @RequestParam String countries , Integer provinceId , Integer cityId , Integer pageNo , Integer pageSize , Integer schoolId , Integer roleId , String searchContent , Integer month , String creationTime , String endTime ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
//设置国家
//设置国家
if ( countries ! = null & & countries ! = "" ) {
if ( countries ! = null & & countries ! = "" ) {
userInfo . setCountries ( countries ) ;
userInfo . setCountries ( countries ) ;
}
}
//设置省份
//设置省份
if ( provinceId ! = null ) {
if ( provinceId ! = null ) {
userInfo . setProvinceId ( provinceId ) ;
userInfo . setProvinceId ( provinceId ) ;
}
}
//设置城市
//设置城市
if ( cityId ! = null ) {
if ( cityId ! = null ) {
userInfo . setCityId ( cityId ) ;
userInfo . setCityId ( cityId ) ;
}
}
//学校
//学校
if ( schoolId ! = null ) {
if ( schoolId ! = null ) {
userInfo . setSchoolId ( schoolId ) ;
userInfo . setSchoolId ( schoolId ) ;
}
}
//角色
//角色
if ( roleId ! = null ) {
if ( roleId ! = null ) {
userInfo . setRoleId ( roleId ) ;
userInfo . setRoleId ( roleId ) ;
}
}
//搜索内容
//搜索内容
if ( searchContent ! = null & & searchContent ! = "" ) {
if ( searchContent ! = null & & searchContent ! = "" ) {
userInfo . setSearchContent ( searchContent ) ;
userInfo . setSearchContent ( searchContent ) ;
}
}
//月份
//月份
if ( month ! = null ) {
if ( month ! = null ) {
userInfo . setMonth ( month ) ; ;
userInfo . setMonth ( month ) ;
;
}
}
//创建时间
//创建时间
if ( creationTime ! = null & & creationTime ! = "" ) {
if ( creationTime ! = null & & creationTime ! = "" ) {
userInfo . setCreationTime ( creationTime ) ;
userInfo . setCreationTime ( creationTime ) ;
}
}
//结束时间
//结束时间
if ( endTime ! = null & & endTime ! = "" ) {
if ( endTime ! = null & & endTime ! = "" ) {
userInfo . setEndTime ( endTime ) ;
userInfo . setEndTime ( endTime ) ;
}
}
HashMap < String , Object > ret = userInfoService . queryUserInfo ( userInfo , pageNo , pageSize ) ;
HashMap < String , Object > ret = userInfoService . queryUserInfo ( userInfo , pageNo , pageSize ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
@ -163,49 +290,49 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 删除用户 ( 根据ID修改isdel状态 , 0可见 1不可见 )
* 删除用户 ( 根据ID修改isdel状态 , 0可见 1不可见 )
* /
* /
@Transactional
@Transactional
@PostMapping ( "/deleteUserInfo" )
@PostMapping ( "/deleteUserInfo" )
public Response deleteUserInfo ( @RequestBody List < Integer > userIdList ) {
public Response deleteUserInfo ( @RequestBody List < Integer > userIdList ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( userIdList = = null ) {
if ( userIdList = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空,删除用户失败!" ) ;
resp . setErrmessage ( "用户id为空,删除用户失败!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . deleteUserInfo ( userIdList ) ;
HashMap < String , Object > ret = userInfoService . deleteUserInfo ( userIdList ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
resp . setMessage ( ret . get ( "retvalue" ) ) ;
resp . setMessage ( ret . get ( "retvalue" ) ) ;
HashMap < String , Object > sta = userInfoService . deleteOrganizationRelationship ( userIdList ) ;
HashMap < String , Object > sta = userInfoService . deleteOrganizationRelationship ( userIdList ) ;
int staStatus = ( int ) sta . get ( "retcode" ) ;
int staStatus = ( int ) sta . get ( "retcode" ) ;
if ( 200 = = staStatus ) {
if ( 200 = = staStatus ) {
resp . setStatus ( staStatus ) ;
resp . setStatus ( staStatus ) ;
resp . setMessage ( sta . get ( "retvalue" ) ) ;
resp . setMessage ( sta . get ( "retvalue" ) ) ;
} else {
} else {
resp . setStatus ( staStatus ) ;
resp . setStatus ( staStatus ) ;
resp . setErrmessage ( sta . get ( "retvalue" ) . toString ( ) ) ;
resp . setErrmessage ( sta . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
}
} else {
resp . setStatus ( status ) ;
resp . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
throw new RuntimeException ( ) ;
}
}
} else {
resp . setStatus ( status ) ;
resp . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
throw new RuntimeException ( ) ;
}
}
}
return resp ;
return resp ;
}
}
/ * *
/ * *
* 更新用户
* 更新用户
* /
* /
@Transactional
@Transactional
@PostMapping ( "/updateUserInfo" )
@PostMapping ( "/updateUserInfo" )
public Response updateUserInfo ( @RequestBody UserInfo userInfo ) {
public Response updateUserInfo ( @RequestBody UserInfo userInfo ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
Integer userId = userInfo . getUserId ( ) ;
Integer userId = userInfo . getUserId ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户ID为空,修改用户失败!" ) ;
resp . setErrmessage ( "用户ID为空,修改用户失败!" ) ;
} else {
} else {
@ -224,7 +351,7 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 更新用户个人档案
* 更新用户个人档案
* /
* /
@Transactional
@Transactional
@PostMapping ( "/updateUserProfiles" )
@PostMapping ( "/updateUserProfiles" )
@ -250,7 +377,7 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 更新用户组织关系
* 更新用户组织关系
* /
* /
@Transactional
@Transactional
@PostMapping ( "/updateOR" )
@PostMapping ( "/updateOR" )
@ -275,19 +402,19 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 登陆查询学校
* 登陆查询学校
* /
* /
@GetMapping ( "/loginSchool" )
@GetMapping ( "/loginSchool" )
Response loginSchool ( @RequestParam ( "account" ) String account , @RequestParam ( "password" ) String password , HttpServletRequest req , HttpServletResponse res ) {
Response loginSchool ( @RequestParam ( "account" ) String account , @RequestParam ( "password" ) String password , HttpServletRequest req , HttpServletResponse res ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
if ( account = = null | | account = = "" ) {
if ( account = = null | | account = = "" ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户账号为空,登录失败!" ) ;
resp . setErrmessage ( "用户账号为空,登录失败!" ) ;
} else if ( password = = null | | password = = "" ) {
} else if ( password = = null | | password = = "" ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户密码为空,登录失败!" ) ;
resp . setErrmessage ( "用户密码为空,登录失败!" ) ;
} else {
} else {
userInfo . setAccount ( account ) ;
userInfo . setAccount ( account ) ;
userInfo . setPassword ( password ) ;
userInfo . setPassword ( password ) ;
HashMap < String , Object > ret = userInfoService . loginSchool ( userInfo ) ;
HashMap < String , Object > ret = userInfoService . loginSchool ( userInfo ) ;
@ -304,23 +431,22 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 登陆
* 登陆
* /
* /
@GetMapping ( "/logins" )
@GetMapping ( "/logins" )
Response logins ( @RequestParam ( "userId" ) Integer userId , @RequestParam ( "schoolId" ) Integer schoolId , @RequestParam ( "roleId" ) Integer roleId , HttpServletRequest req , HttpServletResponse res ) {
Response logins ( @RequestParam ( "userId" ) Integer userId , @RequestParam ( "schoolId" ) Integer schoolId , @RequestParam ( "roleId" ) Integer roleId , HttpServletRequest req , HttpServletResponse res ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空,登录失败!" ) ;
resp . setErrmessage ( "用户id为空,登录失败!" ) ;
} else if ( schoolId = = null ) {
} else if ( schoolId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户学校id为空,登录失败!" ) ;
resp . setErrmessage ( "用户学校id为空,登录失败!" ) ;
} else if ( roleId = = null ) {
} else if ( roleId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户角色id为空,登录失败!" ) ;
resp . setErrmessage ( "用户角色id为空,登录失败!" ) ;
}
} else {
else {
userInfo . setRoleId ( roleId ) ;
userInfo . setRoleId ( roleId ) ;
userInfo . setUserId ( userId ) ;
userInfo . setUserId ( userId ) ;
userInfo . setSchoolId ( schoolId ) ;
userInfo . setSchoolId ( schoolId ) ;
@ -338,19 +464,19 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 登陆查询角色
* 登陆查询角色
* /
* /
@GetMapping ( "/loginRole" )
@GetMapping ( "/loginRole" )
Response loginRole ( @RequestParam ( "userId" ) Integer userId , @RequestParam ( "schoolId" ) Integer schoolId , HttpServletRequest req , HttpServletResponse res ) {
Response loginRole ( @RequestParam ( "userId" ) Integer userId , @RequestParam ( "schoolId" ) Integer schoolId , HttpServletRequest req , HttpServletResponse res ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
OrganizationRelationship OR = new OrganizationRelationship ( ) ;
OrganizationRelationship OR = new OrganizationRelationship ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空,登录失败!" ) ;
resp . setErrmessage ( "用户id为空,登录失败!" ) ;
} else if ( schoolId = = null ) {
} else if ( schoolId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "角色id为空,登录失败!" ) ;
resp . setErrmessage ( "角色id为空,登录失败!" ) ;
} else {
} else {
OR . setUserId ( userId ) ;
OR . setUserId ( userId ) ;
OR . setSchoolId ( schoolId ) ;
OR . setSchoolId ( schoolId ) ;
HashMap < String , Object > ret = userInfoService . loginRole ( OR ) ;
HashMap < String , Object > ret = userInfoService . loginRole ( OR ) ;
@ -367,15 +493,15 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 查询用户详情 ( ID )
* 查询用户详情 ( ID )
* /
* /
@GetMapping ( "/queryUserInfoDetails" )
@GetMapping ( "/queryUserInfoDetails" )
Response queryUserInfoDetails ( @RequestParam Integer userId ) {
Response queryUserInfoDetails ( @RequestParam Integer userId ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空!查询失败!" ) ;
resp . setErrmessage ( "用户id为空!查询失败!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . queryUserInfoDetails ( userId ) ;
HashMap < String , Object > ret = userInfoService . queryUserInfoDetails ( userId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
@ -390,19 +516,19 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 查询用户组织架构OR ( organization relationship )
* 查询用户组织架构OR ( organization relationship )
* /
* /
@GetMapping ( "/queryUserOR" )
@GetMapping ( "/queryUserOR" )
Response queryUserOR ( @RequestParam Integer userId , Integer platformId ) {
Response queryUserOR ( @RequestParam Integer userId , Integer platformId ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空!查询失败!" ) ;
resp . setErrmessage ( "用户id为空!查询失败!" ) ;
} else if ( platformId = = null ) {
} else if ( platformId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "平台id为空!查询失败!" ) ;
resp . setErrmessage ( "平台id为空!查询失败!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . queryUserOR ( userId , platformId ) ;
HashMap < String , Object > ret = userInfoService . queryUserOR ( userId , platformId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
@ -416,15 +542,15 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 查询用户个人档案
* 查询用户个人档案
* /
* /
@GetMapping ( "/queryUserProfiles" )
@GetMapping ( "/queryUserProfiles" )
Response queryUserProfiles ( @RequestParam Integer userId ) {
Response queryUserProfiles ( @RequestParam Integer userId ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空!查询失败!" ) ;
resp . setErrmessage ( "用户id为空!查询失败!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . queryUserProfiles ( userId ) ;
HashMap < String , Object > ret = userInfoService . queryUserProfiles ( userId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
@ -441,11 +567,11 @@ public class UserInfoController {
@PostMapping ( "/uploadUserAvatars" )
@PostMapping ( "/uploadUserAvatars" )
Response uploadUserAvatars ( MultipartFile file , Integer userId ) {
Response uploadUserAvatars ( MultipartFile file , Integer userId ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( userId = = null ) { //前台传来的值是否为空
if ( userId = = null ) { //前台传来的值是否为空
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "Parameter Invalid" ) ;
resp . setErrmessage ( "Parameter Invalid" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . uploadUserAvatars ( file , userId ) ;
HashMap < String , Object > ret = userInfoService . uploadUserAvatars ( file , userId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
@ -460,7 +586,7 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 更新登录次数和时间
* 更新登录次数和时间
* /
* /
@PostMapping ( "/updateLogInNumber" )
@PostMapping ( "/updateLogInNumber" )
Response updateLogInNumber ( @RequestBody UserM user ) {
Response updateLogInNumber ( @RequestBody UserM user ) {
@ -468,13 +594,13 @@ public class UserInfoController {
Integer userId = user . getUserId ( ) ;
Integer userId = user . getUserId ( ) ;
String phone = user . getPhone ( ) ;
String phone = user . getPhone ( ) ;
Integer accountRole = user . getAccountRole ( ) ;
Integer accountRole = user . getAccountRole ( ) ;
if ( userId = = null ) {
if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id不能为空!" ) ;
resp . setErrmessage ( "用户id不能为空!" ) ;
} else if ( phone = = null | | phone = = "" ) {
} else if ( phone = = null | | phone = = "" ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户电话不能为空!" ) ;
resp . setErrmessage ( "用户电话不能为空!" ) ;
} else if ( accountRole = = null ) {
} else if ( accountRole = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户角色不能为空!" ) ;
resp . setErrmessage ( "用户角色不能为空!" ) ;
} else {
} else {
@ -490,34 +616,35 @@ public class UserInfoController {
}
}
return resp ;
return resp ;
}
}
/ * *
/ * *
* 用户模块查询客户
* 用户模块查询客户
* /
* /
@GetMapping ( "/queryCustomer" )
@GetMapping ( "/queryCustomer" )
Response queryCustomer ( @RequestParam String searchContent , @RequestParam List < Integer > customerIds ) {
Response queryCustomer ( @RequestParam String searchContent , @RequestParam List < Integer > customerIds ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
HashMap < String , Object > ret = userInfoService . queryCustomer ( searchContent , customerIds ) ;
HashMap < String , Object > ret = userInfoService . queryCustomer ( searchContent , customerIds ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
resp . setMessage ( ret . get ( "retvalue" ) ) ;
resp . setMessage ( ret . get ( "retvalue" ) ) ;
} else {
} else {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
resp . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
resp . setErrmessage ( ret . get ( "retvalue" ) . toString ( ) ) ;
}
}
return resp ;
return resp ;
}
}
/ * *
/ * *
* 查询账号是否存在
* 查询账号是否存在
* /
* /
@GetMapping ( "/queryAccountIsExist" )
@GetMapping ( "/queryAccountIsExist" )
Response queryAccountIsExist ( @RequestParam String account ) {
Response queryAccountIsExist ( @RequestParam String account ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( account = = null & & account = = "" ) {
if ( account = = null & & account = = "" ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "账号为空!" ) ;
resp . setErrmessage ( "账号为空!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . queryAccountIsExist ( account ) ;
HashMap < String , Object > ret = userInfoService . queryAccountIsExist ( account ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
@ -532,20 +659,19 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 查询学号 、 工号是否存在
* 查询学号 、 工号是否存在
* /
* /
@GetMapping ( "/queryWorkNumberIsExist" )
@GetMapping ( "/queryWorkNumberIsExist" )
Response queryWorkNumberIsExist ( @RequestParam String workNumber , Integer roleId , Integer schoolId ) {
Response queryWorkNumberIsExist ( @RequestParam String workNumber , Integer roleId , Integer schoolId ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
if ( workNumber = = null ) {
if ( workNumber = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "学号、工号为空!" ) ;
resp . setErrmessage ( "学号、工号为空!" ) ;
} else if ( roleId = = null ) {
} else if ( roleId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "角色id为空!" ) ;
resp . setErrmessage ( "角色id为空!" ) ;
}
} else {
else {
HashMap < String , Object > ret = userInfoService . queryWorkNumberIsExist ( workNumber , roleId , schoolId ) ;
HashMap < String , Object > ret = userInfoService . queryWorkNumberIsExist ( workNumber , roleId , schoolId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;
@ -559,17 +685,17 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 查询平台
* 查询平台
* /
* /
@GetMapping ( "/queryPlatform" )
@GetMapping ( "/queryPlatform" )
Response queryPlatform ( @RequestParam String platformId ) {
Response queryPlatform ( @RequestParam String platformId ) {
Response resp = new Response ( ) ;
Response resp = new Response ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
UserInfo userInfo = new UserInfo ( ) ;
//平台id
//平台id
if ( platformId = = null & & platformId = = "" ) {
if ( platformId = = null & & platformId = = "" ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "平台id为空!" ) ;
resp . setErrmessage ( "平台id为空!" ) ;
} else {
} else {
HashMap < String , Object > ret = userInfoService . queryPlatform ( platformId ) ;
HashMap < String , Object > ret = userInfoService . queryPlatform ( platformId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
@ -584,7 +710,7 @@ public class UserInfoController {
}
}
/ * *
/ * *
* 删除平台
* 删除平台
* /
* /
@PostMapping ( "/deletePlatform" )
@PostMapping ( "/deletePlatform" )
Response deletePlatform ( @RequestBody OrganizationRelationship OR ) {
Response deletePlatform ( @RequestBody OrganizationRelationship OR ) {
@ -592,15 +718,14 @@ public class UserInfoController {
Integer platformId = OR . getPlatformId ( ) ;
Integer platformId = OR . getPlatformId ( ) ;
Integer userId = OR . getUserId ( ) ;
Integer userId = OR . getUserId ( ) ;
//平台id
//平台id
if ( platformId = = null ) {
if ( platformId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "平台id为空!" ) ;
resp . setErrmessage ( "平台id为空!" ) ;
} else if ( userId = = null ) {
} else if ( userId = = null ) {
resp . setStatus ( 300 ) ;
resp . setStatus ( 300 ) ;
resp . setErrmessage ( "用户id为空!" ) ;
resp . setErrmessage ( "用户id为空!" ) ;
}
} else {
else {
HashMap < String , Object > ret = userInfoService . deletePlatform ( platformId , userId ) ;
HashMap < String , Object > ret = userInfoService . deletePlatform ( platformId , userId ) ;
int status = ( int ) ret . get ( "retcode" ) ;
int status = ( int ) ret . get ( "retcode" ) ;
if ( 200 = = status ) {
if ( 200 = = status ) {
resp . setStatus ( status ) ;
resp . setStatus ( status ) ;