From d6d4ef9b9275f166992de67aaf4f45109ccfcc25 Mon Sep 17 00:00:00 2001
From: "zhiyong.ning" <354350178@qq.com>
Date: Mon, 14 Sep 2020 17:13:00 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 20 +-
src/main/java/com/yipin/liuwanr/UserTest.java | 2 +-
.../liuwanr/controller/StaffController.java | 119 ++++-
.../controller/UserInfoController.java | 304 +++++++------
.../com/yipin/liuwanr/entity/StuStaff.java | 414 +++++++++---------
.../com/yipin/liuwanr/entity/UserInfo.java | 72 ++-
.../com/yipin/liuwanr/mapper/StaffMapper.java | 35 +-
.../yipin/liuwanr/mapper/UserInfoMapper.java | 10 +-
.../yipin/liuwanr/service/StaffService.java | 36 +-
.../liuwanr/service/UserInfoService.java | 28 +-
.../java/com/yipin/liuwanr/vo/UserInfoVO.java | 9 -
.../liuwanr/service/StaffServiceTest.java | 12 +-
12 files changed, 608 insertions(+), 453 deletions(-)
diff --git a/pom.xml b/pom.xml
index dc2a9f0..f0069d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,10 @@
org.springframework.boot
spring-boot-starter-logging
+
@@ -241,7 +245,7 @@
org.slf4j
slf4j-api
- 1.7.21
+ 1.7.12
commons-fileupload
@@ -249,10 +253,24 @@
1.4
test
+
+
+ javax.servlet
+ javax.servlet-api
+ provided
+
ROOT
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.20.1
+
+ true
+
+
org.springframework.boot
spring-boot-maven-plugin
diff --git a/src/main/java/com/yipin/liuwanr/UserTest.java b/src/main/java/com/yipin/liuwanr/UserTest.java
index ed9aba6..8839775 100644
--- a/src/main/java/com/yipin/liuwanr/UserTest.java
+++ b/src/main/java/com/yipin/liuwanr/UserTest.java
@@ -21,8 +21,8 @@ import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
+import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.tomcat.util.codec.binary.Base64;
import com.aliyun.oss.OSSClient;
import com.yipin.liuwanr.entity.Speed;
diff --git a/src/main/java/com/yipin/liuwanr/controller/StaffController.java b/src/main/java/com/yipin/liuwanr/controller/StaffController.java
index 157a1ec..1380f26 100644
--- a/src/main/java/com/yipin/liuwanr/controller/StaffController.java
+++ b/src/main/java/com/yipin/liuwanr/controller/StaffController.java
@@ -293,33 +293,128 @@ public class StaffController {
@PostMapping("/addStaff")
Response addStaff(@RequestBody UserInfoVO vo) {
Response resp = new Response();
+ //组织架构list
+ List ORList = vo.getOrganizationRelationshipList();
UserInfo userInfo = vo.getUserInfo();
+ Integer userId = userInfo.getUserId();
String account = userInfo.getAccount();
+ Integer isNewUser = userInfo.getIsNewUser();
if (account==null||account=="") {
resp.setStatus(300);
resp.setErrmessage("账号为空添加失败!");
} else {
- HashMap ret = userInfoService.logins(userInfo);
+ if (isNewUser==0){
+ HashMap sta = userInfoService.addStuStaff(ORList,userId);
+ int status = (int) sta.get("retcode");
+ if (status == 200){
+ resp.setStatus(status);
+ resp.setMessage(sta.get("retvalue"));
+ }else{
+ resp.setStatus(status);
+ resp.setErrmessage(sta.get("retvalue").toString());
+ throw new RuntimeException();
+ }
+ }else if(isNewUser==1){
+ HashMap ret = userInfoService.addUser(userInfo);
+ userId = (int) ret.get("userId");
+ int status = (int) ret.get("retcode");
+ if (status == 200){
+ HashMap sta = userInfoService.addStuStaff(ORList,userId);
+ int status1 = (int) sta.get("retcode");
+ if (status1 == 200){
+ resp.setStatus(status1);
+ resp.setMessage(sta.get("retvalue"));
+ }else{
+ resp.setStatus(status1);
+ resp.setErrmessage(sta.get("retvalue").toString());
+ throw new RuntimeException();
+ }
+ }else{
+ resp.setStatus(status);
+ resp.setErrmessage(ret.get("retvalue").toString());
+ throw new RuntimeException();
+ }
+ }else{
+ resp.setStatus(300);
+ resp.setErrmessage("新老用户为空添加失败!");
+ }
+ }
+ return resp;
+ }
+ /**
+ * 更新员工
+ */
+ @PostMapping("/updateStaff")
+ Response updateStaff(@RequestBody UserInfoVO vo) {
+ Response resp = new Response();
+ OrganizationRelationship or = vo.getOrganizationRelationship();
+ UserInfo userInfo = vo.getUserInfo();
+ if (or==null) {
+ resp.setStatus(300);
+ resp.setErrmessage("组织架构为空,修改失败!");
+ }else if (userInfo.getUserId()==null){
+ resp.setStatus(300);
+ resp.setErrmessage("用户为空,修改失败!");
+ } else {
+ HashMap ret = staffService.updateNewStaff(vo);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
- HashMap ret1 = userInfoService.addUser(userInfo);
- int status1 = (int) ret1.get("retcode");
- if (status1 == 200){
- resp.setStatus(status1);
- resp.setMessage(ret1.get("retvalue"));
- }else{
- resp.setStatus(status1);
- resp.setErrmessage(ret1.get("retvalue").toString());
- throw new RuntimeException();
- }
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
- throw new RuntimeException();
}
}
return resp;
}
+
+ /**
+ * 删除员工
+ */
+ @PostMapping("/deleteStaff")
+ Response deleteStaff(@RequestBody List OrganizationRelationshipList) {
+ Response resp = new Response();
+ if (OrganizationRelationshipList.isEmpty()){
+ resp.setStatus(300);
+ resp.setErrmessage("员工为空,删除失败!");
+ } else {
+ HashMap ret = staffService.deleteStaff(OrganizationRelationshipList);
+ 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;
+ }
+
+ /**
+ * 查询员工详情
+ */
+ @GetMapping("/queryStaffDetails")
+ Response queryStaffDetails(@RequestParam Integer userId,Integer roleId) {
+ Response resp = new Response();
+ if (userId==null) {
+ resp.setStatus(300);
+ resp.setErrmessage("用户id为空,查询失败!");
+ }else if (roleId==null){
+ resp.setStatus(300);
+ resp.setErrmessage("角色id为空,查询失败!");
+ } else {
+ HashMap ret = staffService.queryStaffDetails(userId,roleId);
+ 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;
+}
}
diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
index bc8a02d..117ce33 100644
--- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
+++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
@@ -1,13 +1,11 @@
package com.yipin.liuwanr.controller;
import com.yipin.liuwanr.entity.*;
-import com.yipin.liuwanr.helper.QueryStudentUtils;
import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.StudentService;
import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.vo.UserInfoVO;
-import jdk.nashorn.internal.ir.IfNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -15,7 +13,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -159,7 +156,7 @@ public class UserInfoController {
}
/**
- * 添加用户
+ * 添加用户
*/
@Transactional
@PostMapping("/addUser")
@@ -167,63 +164,54 @@ public class UserInfoController {
Response resp = new Response();
//个人档案实体
List userProfilesList = vo.getUserProfilesList();
- //学生员工实体list
- List stuStaffList = vo.getStuStaffList();
//组织架构list
List ORList = vo.getOrganizationRelationshipList();
//用户实体
UserInfo user = vo.getUserInfo();
//用户手机号
- String phone = user.getPhone();
+ String account = user.getAccount();
//用户名称
String name = user.getUserName();
- //省份id
- Integer provinceId = user.getProvinceId();
//用户角色id
Integer roleId = user.getRoleId();
- //城市id
- Integer cityId = user.getCityId();
//学校id
Integer schoolId = user.getSchoolId();
- if (name == null || name == "") {
+ if(name==null||name==""){
resp.setStatus(300);
resp.setErrmessage("姓名不能为空!");
- } else if (provinceId == null) {
- resp.setStatus(300);
- resp.setErrmessage("省份不能为空!");
- } else if (cityId == null) {
+ }else if(account==null||account==""){
resp.setStatus(300);
- resp.setErrmessage("城市不能为空!");
- } else if (schoolId == null) {
+ resp.setErrmessage("账号不能为空!");
+ }else if(schoolId==null){
resp.setStatus(300);
resp.setErrmessage("学校不能为空!");
- } else {
+ }else {
HashMap ret = userInfoService.addUser(user);
Integer userId = user.getUserId();
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
- HashMap stu = userInfoService.addPersonalFile(userProfilesList, userId);
- int stuStatus = (int) stu.get("retcode");
- if (stuStatus == 200) {
- resp.setStatus(stuStatus);
- resp.setMessage(stu.get("retvalue"));
- } else {
- resp.setStatus(stuStatus);
- resp.setErrmessage(stu.get("retvalue").toString());
- throw new RuntimeException();
- }
- HashMap sta = userInfoService.addStuStaff(ORList, userId);
- int staStatus = (int) sta.get("retcode");
- if (staStatus == 200) {
- resp.setStatus(staStatus);
- resp.setMessage(sta.get("retvalue"));
- } else {
- resp.setStatus(staStatus);
- resp.setErrmessage(sta.get("retvalue").toString());
- throw new RuntimeException();
- }
+ HashMap stu = userInfoService.addPersonalFile(userProfilesList,userId);
+ int stuStatus = (int) stu.get("retcode");
+ if (stuStatus == 200){
+ resp.setStatus(stuStatus);
+ resp.setMessage(stu.get("retvalue"));
+ }else {
+ resp.setStatus(stuStatus);
+ resp.setErrmessage(stu.get("retvalue").toString());
+ throw new RuntimeException();
+ }
+ HashMap sta = userInfoService.addStuStaff(ORList,userId);
+ int staStatus = (int) sta.get("retcode");
+ if (staStatus == 200){
+ resp.setStatus(staStatus);
+ resp.setMessage(sta.get("retvalue"));
+ }else {
+ resp.setStatus(staStatus);
+ resp.setErrmessage(sta.get("retvalue").toString());
+ throw new RuntimeException();
+ }
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
@@ -234,50 +222,49 @@ public class UserInfoController {
}
/**
- * 查询用户(根据国家、省份、城市)
+ * 查询用户(根据国家、省份、城市)
*/
@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 resp = new Response();
- UserInfo userInfo = new UserInfo();
+ UserInfo userInfo = new UserInfo();
//设置国家
- if (countries != null && countries != "") {
+ if (countries != null&&countries!="") {
userInfo.setCountries(countries);
}
//设置省份
- if (provinceId != null) {
+ if(provinceId!=null) {
userInfo.setProvinceId(provinceId);
}
//设置城市
- if (cityId != null) {
+ if(cityId!=null) {
userInfo.setCityId(cityId);
}
//学校
- if (schoolId != null) {
+ if (schoolId!=null) {
userInfo.setSchoolId(schoolId);
}
//角色
- if (roleId != null) {
+ if (roleId!=null) {
userInfo.setRoleId(roleId);
}
//搜索内容
- if (searchContent != null && searchContent != "") {
+ if (searchContent!=null&&searchContent!="") {
userInfo.setSearchContent(searchContent);
}
//月份
- if (month != null) {
- userInfo.setMonth(month);
- ;
+ if (month!=null) {
+ userInfo.setMonth(month);;
}
//创建时间
- if (creationTime != null && creationTime != "") {
+ if (creationTime!=null&&creationTime!="") {
userInfo.setCreationTime(creationTime);
}
//结束时间
- if (endTime != null && endTime != "") {
+ if (endTime!=null&&endTime!="") {
userInfo.setEndTime(endTime);
}
- HashMap ret = userInfoService.queryUserInfo(userInfo, pageNo, pageSize);
+ HashMap ret = userInfoService.queryUserInfo(userInfo,pageNo,pageSize);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@@ -290,49 +277,49 @@ public class UserInfoController {
}
/**
- * 删除用户(根据ID修改isdel状态,0可见 1不可见)
+ * 删除用户(根据ID修改isdel状态,0可见 1不可见)
*/
@Transactional
@PostMapping("/deleteUserInfo")
public Response deleteUserInfo(@RequestBody List userIdList) {
Response resp = new Response();
- if (userIdList == null) {
- resp.setStatus(300);
- resp.setErrmessage("用户id为空,删除用户失败!");
- } else {
- HashMap ret = userInfoService.deleteUserInfo(userIdList);
- int status = (int) ret.get("retcode");
- if (200 == status) {
- resp.setStatus(status);
- resp.setMessage(ret.get("retvalue"));
- HashMap sta = userInfoService.deleteOrganizationRelationship(userIdList);
- int staStatus = (int) sta.get("retcode");
- if (200 == staStatus) {
- resp.setStatus(staStatus);
- resp.setMessage(sta.get("retvalue"));
- } else {
- resp.setStatus(staStatus);
- resp.setErrmessage(sta.get("retvalue").toString());
+ if (userIdList==null) {
+ resp.setStatus(300);
+ resp.setErrmessage("用户id为空,删除用户失败!");
+ } else {
+ HashMap ret = userInfoService.deleteUserInfo(userIdList);
+ int status = (int) ret.get("retcode");
+ if (200 == status) {
+ resp.setStatus(status);
+ resp.setMessage(ret.get("retvalue"));
+ HashMap sta = userInfoService.deleteOrganizationRelationship(userIdList);
+ int staStatus = (int) sta.get("retcode");
+ if (200 == staStatus) {
+ resp.setStatus(staStatus);
+ resp.setMessage(sta.get("retvalue"));
+ }else{
+ resp.setStatus(staStatus);
+ resp.setErrmessage(sta.get("retvalue").toString());
+ throw new RuntimeException();
+ }
+ }else {
+ resp.setStatus(status);
+ resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
}
- } else {
- resp.setStatus(status);
- resp.setErrmessage(ret.get("retvalue").toString());
- throw new RuntimeException();
}
- }
return resp;
}
/**
- * 更新用户
+ * 更新用户
*/
@Transactional
@PostMapping("/updateUserInfo")
public Response updateUserInfo(@RequestBody UserInfo userInfo) {
Response resp = new Response();
Integer userId = userInfo.getUserId();
- if (userId == null) {
+ if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户ID为空,修改用户失败!");
} else {
@@ -351,7 +338,7 @@ public class UserInfoController {
}
/**
- * 更新用户个人档案
+ * 更新用户个人档案
*/
@Transactional
@PostMapping("/updateUserProfiles")
@@ -377,7 +364,7 @@ public class UserInfoController {
}
/**
- * 更新用户组织关系
+ * 更新用户组织关系
*/
@Transactional
@PostMapping("/updateOR")
@@ -402,19 +389,19 @@ public class UserInfoController {
}
/**
- * 登陆查询学校
+ * 登陆查询学校
*/
@GetMapping("/loginSchool")
Response loginSchool(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
- UserInfo userInfo = new UserInfo();
- if (account == null || account == "") {
+ UserInfo userInfo = new UserInfo();
+ if (account == null || account=="") {
resp.setStatus(300);
resp.setErrmessage("用户账号为空,登录失败!");
- } else if (password == null || password == "") {
+ }else if(password ==null || password=="") {
resp.setStatus(300);
resp.setErrmessage("用户密码为空,登录失败!");
- } else {
+ }else{
userInfo.setAccount(account);
userInfo.setPassword(password);
HashMap ret = userInfoService.loginSchool(userInfo);
@@ -431,22 +418,23 @@ public class UserInfoController {
}
/**
- * 登陆
+ * 登陆
*/
@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();
- UserInfo userInfo = new UserInfo();
+ UserInfo userInfo = new UserInfo();
if (userId == null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,登录失败!");
- } else if (schoolId == null) {
+ }else if(schoolId ==null) {
resp.setStatus(300);
resp.setErrmessage("用户学校id为空,登录失败!");
- } else if (roleId == null) {
+ }else if(roleId ==null) {
resp.setStatus(300);
resp.setErrmessage("用户角色id为空,登录失败!");
- } else {
+ }
+ else{
userInfo.setRoleId(roleId);
userInfo.setUserId(userId);
userInfo.setSchoolId(schoolId);
@@ -464,19 +452,19 @@ public class UserInfoController {
}
/**
- * 登陆查询角色
+ * 登陆查询角色
*/
@GetMapping("/loginRole")
Response loginRole(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
- OrganizationRelationship OR = new OrganizationRelationship();
+ OrganizationRelationship OR = new OrganizationRelationship();
if (userId == null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,登录失败!");
- } else if (schoolId == null) {
+ }else if(schoolId ==null) {
resp.setStatus(300);
resp.setErrmessage("角色id为空,登录失败!");
- } else {
+ }else{
OR.setUserId(userId);
OR.setSchoolId(schoolId);
HashMap ret = userInfoService.loginRole(OR);
@@ -493,15 +481,15 @@ public class UserInfoController {
}
/**
- * 查询用户详情(ID)
+ * 查询用户详情(ID)
*/
@GetMapping("/queryUserInfoDetails")
Response queryUserInfoDetails(@RequestParam Integer userId) {
Response resp = new Response();
- if (userId == null) {
+ if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!");
- } else {
+ }else {
HashMap ret = userInfoService.queryUserInfoDetails(userId);
int status = (int) ret.get("retcode");
if (200 == status) {
@@ -516,19 +504,19 @@ public class UserInfoController {
}
/**
- * 查询用户组织架构OR(organization relationship)
+ * 查询用户组织架构OR(organization relationship)
*/
@GetMapping("/queryUserOR")
- Response queryUserOR(@RequestParam Integer userId, Integer platformId) {
+ Response queryUserOR(@RequestParam Integer userId,Integer platformId) {
Response resp = new Response();
- if (userId == null) {
+ if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!");
- } else if (platformId == null) {
+ }else if (platformId==null){
resp.setStatus(300);
resp.setErrmessage("平台id为空!查询失败!");
} else {
- HashMap ret = userInfoService.queryUserOR(userId, platformId);
+ HashMap ret = userInfoService.queryUserOR(userId,platformId);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@@ -542,15 +530,15 @@ public class UserInfoController {
}
/**
- * 查询用户个人档案
+ * 查询用户个人档案
*/
@GetMapping("/queryUserProfiles")
Response queryUserProfiles(@RequestParam Integer userId) {
Response resp = new Response();
- if (userId == null) {
+ if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!");
- } else {
+ }else {
HashMap ret = userInfoService.queryUserProfiles(userId);
int status = (int) ret.get("retcode");
if (200 == status) {
@@ -567,11 +555,11 @@ public class UserInfoController {
@PostMapping("/uploadUserAvatars")
Response uploadUserAvatars(MultipartFile file, Integer userId) {
Response resp = new Response();
- if (userId == null) {//前台传来的值是否为空
+ if (userId==null) {//前台传来的值是否为空
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
- } else {
- HashMap ret = userInfoService.uploadUserAvatars(file, userId);
+ }else {
+ HashMap ret = userInfoService.uploadUserAvatars(file,userId);
int status = (int) ret.get("retcode");
if (200 == status) {
@@ -586,7 +574,7 @@ public class UserInfoController {
}
/**
- * 更新登录次数和时间
+ * 更新登录次数和时间
*/
@PostMapping("/updateLogInNumber")
Response updateLogInNumber(@RequestBody UserM user) {
@@ -594,13 +582,13 @@ public class UserInfoController {
Integer userId = user.getUserId();
String phone = user.getPhone();
Integer accountRole = user.getAccountRole();
- if (userId == null) {
+ if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户id不能为空!");
- } else if (phone == null || phone == "") {
+ }else if(phone==null||phone==""){
resp.setStatus(300);
resp.setErrmessage("用户电话不能为空!");
- } else if (accountRole == null) {
+ } else if(accountRole==null){
resp.setStatus(300);
resp.setErrmessage("用户角色不能为空!");
} else {
@@ -616,36 +604,62 @@ public class UserInfoController {
}
return resp;
}
-
/**
- * 用户模块查询客户
+ * 用户模块查询客户
*/
@GetMapping("/queryCustomer")
- Response queryCustomer(@RequestParam String searchContent, @RequestParam List customerIds) {
+ Response queryCustomer(@RequestParam String searchContent,@RequestParam List customerIds) {
Response resp = new Response();
- HashMap ret = userInfoService.queryCustomer(searchContent, customerIds);
- 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());
- }
+ HashMap ret = userInfoService.queryCustomer(searchContent,customerIds);
+ 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;
}
/**
- * 查询账号是否存在
+ * 查询账号是否存在
*/
@GetMapping("/queryAccountIsExist")
- Response queryAccountIsExist(@RequestParam String account) {
+ Response queryAccountIsExist(@RequestParam String account,Integer schoolId) {
Response resp = new Response();
if (account == null && account == "") {
resp.setStatus(300);
resp.setErrmessage("账号为空!");
+ }else if (schoolId==null){
+ resp.setStatus(300);
+ resp.setErrmessage("学校为空!");
+ }
+ else {
+ HashMap ret = userInfoService.queryAccountIsExist(account,schoolId);
+ 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;
+ }
+
+ /**
+ * 查询服务端账号是否存在
+ */
+ @GetMapping("/queryServerAccountIsExist")
+ Response queryServerAccountIsExist(@RequestParam String account) {
+ Response resp = new Response();
+ if (account==null&&account=="") {
+ resp.setStatus(300);
+ resp.setErrmessage("账号为空!");
} else {
- HashMap ret = userInfoService.queryAccountIsExist(account);
+ HashMap ret = userInfoService.queryServerAccountIsExist(account);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@@ -662,16 +676,17 @@ public class UserInfoController {
* 查询学号、工号是否存在
*/
@GetMapping("/queryWorkNumberIsExist")
- Response queryWorkNumberIsExist(@RequestParam String workNumber, Integer roleId, Integer schoolId) {
+ Response queryWorkNumberIsExist(@RequestParam String workNumber,Integer roleId,Integer schoolId) {
Response resp = new Response();
- if (workNumber == null) {
+ if (workNumber==null) {
resp.setStatus(300);
resp.setErrmessage("学号、工号为空!");
- } else if (roleId == null) {
- resp.setStatus(300);
- resp.setErrmessage("角色id为空!");
- } else {
- HashMap ret = userInfoService.queryWorkNumberIsExist(workNumber, roleId, schoolId);
+ }else if (roleId==null){
+ resp.setStatus(300);
+ resp.setErrmessage("角色id为空!");
+ }
+ else {
+ HashMap ret = userInfoService.queryWorkNumberIsExist(workNumber,roleId,schoolId);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@@ -685,17 +700,17 @@ public class UserInfoController {
}
/**
- * 查询平台
+ * 查询平台
*/
@GetMapping("/queryPlatform")
Response queryPlatform(@RequestParam String platformId) {
Response resp = new Response();
- UserInfo userInfo = new UserInfo();
+ UserInfo userInfo = new UserInfo();
//平台id
- if (platformId == null && platformId == "") {
+ if (platformId==null&&platformId=="") {
resp.setStatus(300);
resp.setErrmessage("平台id为空!");
- } else {
+ }else{
HashMap ret = userInfoService.queryPlatform(platformId);
int status = (int) ret.get("retcode");
if (200 == status) {
@@ -710,7 +725,7 @@ public class UserInfoController {
}
/**
- * 删除平台
+ * 删除平台
*/
@PostMapping("/deletePlatform")
Response deletePlatform(@RequestBody OrganizationRelationship OR) {
@@ -718,14 +733,15 @@ public class UserInfoController {
Integer platformId = OR.getPlatformId();
Integer userId = OR.getUserId();
//平台id
- if (platformId == null) {
+ if (platformId==null) {
resp.setStatus(300);
resp.setErrmessage("平台id为空!");
- } else if (userId == null) {
+ }else if(userId==null){
resp.setStatus(300);
resp.setErrmessage("用户id为空!");
- } else {
- HashMap ret = userInfoService.deletePlatform(platformId, userId);
+ }
+ else{
+ HashMap ret = userInfoService.deletePlatform(platformId,userId);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
diff --git a/src/main/java/com/yipin/liuwanr/entity/StuStaff.java b/src/main/java/com/yipin/liuwanr/entity/StuStaff.java
index 47538a4..585fb16 100644
--- a/src/main/java/com/yipin/liuwanr/entity/StuStaff.java
+++ b/src/main/java/com/yipin/liuwanr/entity/StuStaff.java
@@ -1,207 +1,207 @@
-package com.yipin.liuwanr.entity;
-
-import java.util.List;
-
-//学生和老师管理员组织关系信息实体
-public class StuStaff {
- //主键ID
- private Integer id;
- //账号
- private String account;
- //用户id
- private Integer userId;
- //名字
- private String name;
- //角色Id
- private Integer roleId;
- //工号
- private String workNumber;
- //电话
- private String phone;
- //邮件
- private String email;
- //绑定员工年级架构ID
- private Integer staffGradeId;
- //绑定专业ID
- private Integer staffProfessionalArchitectureId;
- //绑定专业名称
- private String staffProfessionalArchitectureName;
- //绑定员工年级名称
- private String staffGradeName;
- //唯一标示性账号
- private String uniqueIdentificationAccount;
- //绑定学校id
- private Integer schoolId;
- //绑定专业ID
- private Integer professionalId;
- //绑定年级ID
- private Integer gradeId;
- //绑定班级ID
- private Integer classId;
- //专业名称
- private String professionalName;
- //年级名称
- private String gradeName;
- //绑定班级名称
- private String className;
-
- public Integer getUserId() {
- return userId;
- }
-
- public void setUserId(Integer userId) {
- this.userId = userId;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getAccount() {
- return account;
- }
-
- public void setAccount(String account) {
- this.account = account;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getWorkNumber() {
- return workNumber;
- }
-
- public void setWorkNumber(String workNumber) {
- this.workNumber = workNumber;
- }
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public Integer getStaffGradeId() {
- return staffGradeId;
- }
-
- public void setStaffGradeId(Integer staffGradeId) {
- this.staffGradeId = staffGradeId;
- }
-
- public Integer getStaffProfessionalArchitectureId() {
- return staffProfessionalArchitectureId;
- }
-
- public void setStaffProfessionalArchitectureId(Integer staffProfessionalArchitectureId) {
- this.staffProfessionalArchitectureId = staffProfessionalArchitectureId;
- }
-
- public String getStaffProfessionalArchitectureName() {
- return staffProfessionalArchitectureName;
- }
-
- public void setStaffProfessionalArchitectureName(String staffProfessionalArchitectureName) {
- this.staffProfessionalArchitectureName = staffProfessionalArchitectureName;
- }
-
- public Integer getRoleId() {
- return roleId;
- }
-
- public void setRoleId(Integer roleId) {
- this.roleId = roleId;
- }
-
- public String getStaffGradeName() {
- return staffGradeName;
- }
-
- public void setStaffGradeName(String staffGradeName) {
- this.staffGradeName = staffGradeName;
- }
-
- public String getUniqueIdentificationAccount() {
- return uniqueIdentificationAccount;
- }
-
- public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
- this.uniqueIdentificationAccount = uniqueIdentificationAccount;
- }
-
- public Integer getSchoolId() {
- return schoolId;
- }
-
- public void setSchoolId(Integer schoolId) {
- this.schoolId = schoolId;
- }
-
- public Integer getProfessionalId() {
- return professionalId;
- }
-
- public void setProfessionalId(Integer professionalId) {
- this.professionalId = professionalId;
- }
-
- public Integer getGradeId() {
- return gradeId;
- }
-
- public void setGradeId(Integer gradeId) {
- this.gradeId = gradeId;
- }
-
- public Integer getClassId() {
- return classId;
- }
-
- public void setClassId(Integer classId) {
- this.classId = classId;
- }
-
- public String getProfessionalName() {
- return professionalName;
- }
-
- public void setProfessionalName(String professionalName) {
- this.professionalName = professionalName;
- }
-
- public String getGradeName() {
- return gradeName;
- }
-
- public void setGradeName(String gradeName) {
- this.gradeName = gradeName;
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-}
+//package com.yipin.liuwanr.entity;
+//
+//import java.util.List;
+//
+////学生和老师管理员组织关系信息实体
+//public class StuStaff {
+// //主键ID
+// private Integer id;
+// //账号
+// private String account;
+// //用户id
+// private Integer userId;
+// //名字
+// private String name;
+// //角色Id
+// private Integer roleId;
+// //工号
+// private String workNumber;
+// //电话
+// private String phone;
+// //邮件
+// private String email;
+// //绑定员工年级架构ID
+// private Integer staffGradeId;
+// //绑定专业ID
+// private Integer staffProfessionalArchitectureId;
+// //绑定专业名称
+// private String staffProfessionalArchitectureName;
+// //绑定员工年级名称
+// private String staffGradeName;
+// //唯一标示性账号
+// private String uniqueIdentificationAccount;
+// //绑定学校id
+// private Integer schoolId;
+// //绑定专业ID
+// private Integer professionalId;
+// //绑定年级ID
+// private Integer gradeId;
+// //绑定班级ID
+// private Integer classId;
+// //专业名称
+// private String professionalName;
+// //年级名称
+// private String gradeName;
+// //绑定班级名称
+// private String className;
+//
+// public Integer getUserId() {
+// return userId;
+// }
+//
+// public void setUserId(Integer userId) {
+// this.userId = userId;
+// }
+//
+// public Integer getId() {
+// return id;
+// }
+//
+// public void setId(Integer id) {
+// this.id = id;
+// }
+//
+// public String getAccount() {
+// return account;
+// }
+//
+// public void setAccount(String account) {
+// this.account = account;
+// }
+//
+// public String getName() {
+// return name;
+// }
+//
+// public void setName(String name) {
+// this.name = name;
+// }
+//
+// public String getWorkNumber() {
+// return workNumber;
+// }
+//
+// public void setWorkNumber(String workNumber) {
+// this.workNumber = workNumber;
+// }
+//
+// public String getPhone() {
+// return phone;
+// }
+//
+// public void setPhone(String phone) {
+// this.phone = phone;
+// }
+//
+// public String getEmail() {
+// return email;
+// }
+//
+// public void setEmail(String email) {
+// this.email = email;
+// }
+//
+// public Integer getStaffGradeId() {
+// return staffGradeId;
+// }
+//
+// public void setStaffGradeId(Integer staffGradeId) {
+// this.staffGradeId = staffGradeId;
+// }
+//
+// public Integer getStaffProfessionalArchitectureId() {
+// return staffProfessionalArchitectureId;
+// }
+//
+// public void setStaffProfessionalArchitectureId(Integer staffProfessionalArchitectureId) {
+// this.staffProfessionalArchitectureId = staffProfessionalArchitectureId;
+// }
+//
+// public String getStaffProfessionalArchitectureName() {
+// return staffProfessionalArchitectureName;
+// }
+//
+// public void setStaffProfessionalArchitectureName(String staffProfessionalArchitectureName) {
+// this.staffProfessionalArchitectureName = staffProfessionalArchitectureName;
+// }
+//
+// public Integer getRoleId() {
+// return roleId;
+// }
+//
+// public void setRoleId(Integer roleId) {
+// this.roleId = roleId;
+// }
+//
+// public String getStaffGradeName() {
+// return staffGradeName;
+// }
+//
+// public void setStaffGradeName(String staffGradeName) {
+// this.staffGradeName = staffGradeName;
+// }
+//
+// public String getUniqueIdentificationAccount() {
+// return uniqueIdentificationAccount;
+// }
+//
+// public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
+// this.uniqueIdentificationAccount = uniqueIdentificationAccount;
+// }
+//
+// public Integer getSchoolId() {
+// return schoolId;
+// }
+//
+// public void setSchoolId(Integer schoolId) {
+// this.schoolId = schoolId;
+// }
+//
+// public Integer getProfessionalId() {
+// return professionalId;
+// }
+//
+// public void setProfessionalId(Integer professionalId) {
+// this.professionalId = professionalId;
+// }
+//
+// public Integer getGradeId() {
+// return gradeId;
+// }
+//
+// public void setGradeId(Integer gradeId) {
+// this.gradeId = gradeId;
+// }
+//
+// public Integer getClassId() {
+// return classId;
+// }
+//
+// public void setClassId(Integer classId) {
+// this.classId = classId;
+// }
+//
+// public String getProfessionalName() {
+// return professionalName;
+// }
+//
+// public void setProfessionalName(String professionalName) {
+// this.professionalName = professionalName;
+// }
+//
+// public String getGradeName() {
+// return gradeName;
+// }
+//
+// public void setGradeName(String gradeName) {
+// this.gradeName = gradeName;
+// }
+//
+// public String getClassName() {
+// return className;
+// }
+//
+// public void setClassName(String className) {
+// this.className = className;
+// }
+//}
diff --git a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java
index c43d0d6..f52795a 100644
--- a/src/main/java/com/yipin/liuwanr/entity/UserInfo.java
+++ b/src/main/java/com/yipin/liuwanr/entity/UserInfo.java
@@ -28,8 +28,8 @@ public class UserInfo {
private String creationTime;
//登陆次数
private Integer logInNumber;
- //上次登陆时间
- private String lastTimeOfLanding;
+ //最后登陆时间
+ private String lastLoginTime;
//性别
private Integer sex;
//证件类型(1、身份证)
@@ -92,6 +92,26 @@ public class UserInfo {
private String oneDepartmentName;
//二级部门名称
private String twoDepartmentName;
+ //是否新用户
+ private Integer isNewUser;
+ //组织架构id
+ private Integer organizationRelationshipId;
+
+ public Integer getOrganizationRelationshipId() {
+ return organizationRelationshipId;
+ }
+
+ public void setOrganizationRelationshipId(Integer organizationRelationshipId) {
+ this.organizationRelationshipId = organizationRelationshipId;
+ }
+
+ public Integer getIsNewUser() {
+ return isNewUser;
+ }
+
+ public void setIsNewUser(Integer isNewUser) {
+ this.isNewUser = isNewUser;
+ }
public String getWorkNumber() {
return workNumber;
@@ -221,12 +241,12 @@ public class UserInfo {
this.logInNumber = logInNumber;
}
- public String getLastTimeOfLanding() {
- return lastTimeOfLanding;
+ public String getLastLoginTime() {
+ return lastLoginTime;
}
- public void setLastTimeOfLanding(String lastTimeOfLanding) {
- this.lastTimeOfLanding = lastTimeOfLanding;
+ public void setLastLoginTime(String lastLoginTime) {
+ this.lastLoginTime = lastLoginTime;
}
public Integer getSex() {
@@ -429,44 +449,4 @@ public class UserInfo {
this.roleId = roleId;
}
- @Override
- public String toString() {
- return "UserInfo{" +
- "userId=" + userId +
- ", roleId=" + roleId +
- ", userName='" + userName + '\'' +
- ", account='" + account + '\'' +
- ", password='" + password + '\'' +
- ", countries='" + countries + '\'' +
- ", provinceId=" + provinceId +
- ", cityId=" + cityId +
- ", creationTime='" + creationTime + '\'' +
- ", logInNumber=" + logInNumber +
- ", lastTimeOfLanding='" + lastTimeOfLanding + '\'' +
- ", sex=" + sex +
- ", documentType=" + documentType +
- ", IDNumber='" + IDNumber + '\'' +
- ", educationDegree=" + educationDegree +
- ", phone='" + phone + '\'' +
- ", WeChatID='" + WeChatID + '\'' +
- ", dateBirth='" + dateBirth + '\'' +
- ", email='" + email + '\'' +
- ", schoolId=" + schoolId +
- ", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' +
- ", searchContent='" + searchContent + '\'' +
- ", user=" + user +
- ", userAvatars='" + userAvatars + '\'' +
- ", schoolName='" + schoolName + '\'' +
- ", provinceName='" + provinceName + '\'' +
- ", cityName='" + cityName + '\'' +
- ", month=" + month +
- ", endTime='" + endTime + '\'' +
- ", professionalClassId=" + professionalClassId +
- ", professionalClassName='" + professionalClassName + '\'' +
- ", disciplineId=" + disciplineId +
- ", disciplineName='" + disciplineName + '\'' +
- ", professionalId=" + professionalId +
- ", professionalName='" + professionalName + '\'' +
- '}';
- }
}
diff --git a/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java b/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
index 5efd317..a7a6cb5 100644
--- a/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
+++ b/src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
@@ -17,7 +17,7 @@ public interface StaffMapper {
void addStaff(Staff staff);
@Select({" "})
- void deleteStaff(Integer staffId);
+ void deleteStaff(Integer organizationRelationshipId);
@Update({" "})
- List queryStaffDetails(Integer staffId);
+ List queryStaffDetails(Integer userId,Integer roleId);
- //查询学生详情
+ //查询员工用户详情
@Select({ " " })
- @Results({
- @Result(property = "staff", column = "staffId",one = @One(select = "com.yipin.liuwanr.mapper.StaffMapper.queryStaffDetails")),
- @Result(property = "user", column = "staffId",one = @One(select = "com.yipin.liuwanr.mapper.StaffMapper.queryStaffDetailsU"))
- })
- List queryStaffDetailsUser(Integer staffId);
+ List queryStaffDetailsU(Integer userId);
- //查询学生详情
+ //查询用户角色
@Select({ " " })
- List queryStaffDetailsU(Integer staffId);
+ List queryRole(Integer userId);
//修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
@@ -65,6 +61,15 @@ public interface StaffMapper {
@Update("UPDATE user SET phone = #{phone},name = #{name},userAccount = #{userAccount},workNumber = #{workNumber},provinceId = #{provinceId},cityId = #{cityId},email = #{email},schoolId = #{schoolId},uniqueIdentificationAccount = #{uniqueIdentificationAccount},disciplineId = #{disciplineId},professionalClassId = #{professionalClassId},professionalId = #{professionalId} where phone = #{phone}")
void updateUser(UserM user);
+ //修改员工
+ @Update("UPDATE hr_organization_relationship SET oneDepartmentId = #{oneDepartmentId},oneDepartmentName = #{oneDepartmentName},twoDepartmentId = #{twoDepartmentId},twoDepartmentName = #{twoDepartmentName},workNumber = #{workNumber}"
+ + "where organizationRelationshipId = #{organizationRelationshipId}")
+ void updateNewStaff(OrganizationRelationship organizationRelationship);
+
+ //修改用户
+ @Update("UPDATE hr_user_info SET userName = #{userName},uniqueIdentificationAccount = #{uniqueIdentificationAccount},account = #{account},phone = #{phone},email = #{email} where userId = #{userId}")
+ void updateNewUser(UserInfo userInfo);
+
/**
* 得到所有未删除的部门信息
* @return
diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
index 59b9022..14f57aa 100644
--- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
+++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
@@ -150,8 +150,8 @@ public interface UserInfoMapper{
List queryUserPlatform(Integer userId);
//查询用户手机
- @Select("SELECT u.* from user u where isdel=0 and phone = #{phone}")
- List queryPhone(String phone);
+ @Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}")
+ List queryPhone(String phone);
//查询用户详情
@Select({"