|
|
@ -1,44 +1,17 @@ |
|
|
|
package com.keyware.htey.controller.user; |
|
|
|
package com.keyware.htey.controller.user; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Base64; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Iterator; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.keyware.htey.entity.department.Department; |
|
|
|
|
|
|
|
import com.keyware.htey.entity.user.AuditLog; |
|
|
|
|
|
|
|
import com.keyware.htey.entity.user.User; |
|
|
|
import com.keyware.htey.entity.user.User; |
|
|
|
import com.keyware.htey.entity.usersecret.UserSecret; |
|
|
|
|
|
|
|
import com.keyware.htey.listener.SessionCounter; |
|
|
|
|
|
|
|
import com.keyware.htey.service.itf.AuditLogService; |
|
|
|
|
|
|
|
import com.keyware.htey.service.itf.DepartmentService; |
|
|
|
|
|
|
|
import com.keyware.htey.service.itf.UserService; |
|
|
|
import com.keyware.htey.service.itf.UserService; |
|
|
|
import com.keyware.htey.service.itf.UsersecretService; |
|
|
|
|
|
|
|
import com.keyware.htey.service.itf.number.NumberBuilderService; |
|
|
|
|
|
|
|
import com.keyware.htey.utli.AjaxMessage; |
|
|
|
import com.keyware.htey.utli.AjaxMessage; |
|
|
|
import com.keyware.htey.utli.Constant; |
|
|
|
|
|
|
|
import com.keyware.htey.utli.DateUtils; |
|
|
|
|
|
|
|
import com.keyware.htey.utli.EncryptUtil; |
|
|
|
|
|
|
|
import com.keyware.htey.utli.IdComposeListUtil; |
|
|
|
|
|
|
|
import com.keyware.htey.utli.IdGenerator; |
|
|
|
|
|
|
|
import com.keyware.htey.utli.JsonUtils; |
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
|
|
|
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
|
|
|
|
import org.apache.shiro.session.Session; |
|
|
|
|
|
|
|
import org.apache.shiro.session.mgt.eis.SessionDAO; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
@ -47,9 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|
|
|
|
|
|
|
import org.springframework.web.util.WebUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author yangmengchuan |
|
|
@ -63,16 +33,6 @@ import org.springframework.web.util.WebUtils; |
|
|
|
public class UserController { |
|
|
|
public class UserController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private UserService userService; |
|
|
|
private UserService userService; |
|
|
|
@Autowired |
|
|
|
|
|
|
|
private AuditLogService auditLogService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private NumberBuilderService numberBuilderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private DepartmentService departmentService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private UsersecretService usersecretService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private SessionDAO sessionDAO; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author yangmengchuan |
|
|
@ -112,27 +72,23 @@ public class UserController { |
|
|
|
return userService.getById(id); |
|
|
|
return userService.getById(id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param id |
|
|
|
|
|
|
|
* @return java.lang.String |
|
|
|
|
|
|
|
* @description 查看用户信息 |
|
|
|
|
|
|
|
* @Author daijiajun |
|
|
|
|
|
|
|
* @date 2025/1/17 |
|
|
|
|
|
|
|
**/ |
|
|
|
@GetMapping("/viewInfo") |
|
|
|
@GetMapping("/viewInfo") |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@Operation(summary = "根据id查询用户", description = "返回查询用户信息") |
|
|
|
@Operation(summary = "查看用户信息", description = "返回查询用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功获取用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功获取用户信息") |
|
|
|
public String viewInfo(@RequestParam String id) { |
|
|
|
public String viewInfo(@RequestParam String id) { |
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
return userService.viewInfo(id); |
|
|
|
User user = this.userService.getById(id); |
|
|
|
|
|
|
|
String logName = "查看用户信息"; |
|
|
|
|
|
|
|
String logNameType = "用户密级"; |
|
|
|
|
|
|
|
//todo this.getUser_idFormSession("userName")登录人的用户名
|
|
|
|
|
|
|
|
//String comments = this.getUser_idFormSession("userName") + "查看了" + user.getUserName() + "的用户信息";
|
|
|
|
|
|
|
|
String comments = "查看了" + user.getUserName() + "的用户信息"; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
this.auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
return JsonUtils.objectToJsonString(user); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author daijiajun |
|
|
|
* @date 2025/1/7 |
|
|
|
* @date 2025/1/7 |
|
|
|
* @description 新增用户 |
|
|
|
* @description 新增用户 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -144,97 +100,12 @@ public class UserController { |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@Operation(summary = "新增用户", description = "返回新增用户信息") |
|
|
|
@Operation(summary = "新增用户", description = "返回新增用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功新增用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功新增用户信息") |
|
|
|
public AjaxMessage addUser(@RequestBody User user) { |
|
|
|
public AjaxMessage add(@RequestBody User user) { |
|
|
|
AjaxMessage ajaxMessage = new AjaxMessage(); |
|
|
|
return userService.add(user); |
|
|
|
try { |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
List<User> selectByUserNumber = this.userService.selectByUserNumber(user.getUserNumber()); |
|
|
|
|
|
|
|
if (selectByUserNumber.size() > 0) { |
|
|
|
|
|
|
|
ajaxMessage.setCode("0"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage("员工编号已存在"); |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Integer userCount = Constant.userCount; |
|
|
|
|
|
|
|
if (0 != userCount) { |
|
|
|
|
|
|
|
List<User> selectAll = this.userService.selectAll((String)null); |
|
|
|
|
|
|
|
if (userCount <= selectAll.size()) { |
|
|
|
|
|
|
|
ajaxMessage.setCode("0"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage("当前版本只允许新建" + Constant.userCount + "个用户"); |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
user.setPasswordOld(user.getPassword()); |
|
|
|
|
|
|
|
user.setPassword(EncryptUtil.md5(user.getPassword())); |
|
|
|
|
|
|
|
user.setUserCreationTime(DateUtils.getDate()); |
|
|
|
|
|
|
|
user.setUserPwdModifTime(DateUtils.getDate("yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
user.setUserStatus(0L); |
|
|
|
|
|
|
|
user.setUserLock(0L); |
|
|
|
|
|
|
|
user.setLogout(0L); |
|
|
|
|
|
|
|
user.setId(IdGenerator.uuid32()); |
|
|
|
|
|
|
|
String sort = DateUtils.getDateTimeInt(); |
|
|
|
|
|
|
|
user.setSort(sort); |
|
|
|
|
|
|
|
this.userService.insertSelective(user); |
|
|
|
|
|
|
|
this.numberBuilderService.updateNumber("user_code"); |
|
|
|
|
|
|
|
//todo 获取登录用户信息
|
|
|
|
|
|
|
|
//HttpSession session = this.request.getSession();
|
|
|
|
|
|
|
|
//String userName = (String)session.getAttribute("userName");
|
|
|
|
|
|
|
|
//String comments = userName + "添加了用户" + user.getUserName();
|
|
|
|
|
|
|
|
String comments = "添加了用户" + user.getUserName(); |
|
|
|
|
|
|
|
StringBuilder info = new StringBuilder(); |
|
|
|
|
|
|
|
info.append("员工编号:" + user.getUserNumber() + ";"); |
|
|
|
|
|
|
|
info.append("姓名:" + user.getUserName() + ";"); |
|
|
|
|
|
|
|
info.append("身份证号码:" + user.getUserNumber() + ";"); |
|
|
|
|
|
|
|
info.append("电子邮件:" + user.getUserNumber() + ";"); |
|
|
|
|
|
|
|
Department department1 = this.departmentService.selectByPrimaryKey(user.getDepartId()); |
|
|
|
|
|
|
|
info.append("所属部门:" + department1.getDeptName() + ";"); |
|
|
|
|
|
|
|
String sex = "女"; |
|
|
|
|
|
|
|
if ("0".equals(user.getSex())) { |
|
|
|
|
|
|
|
sex = "男"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info.append("性别:" + sex + ";"); |
|
|
|
|
|
|
|
info.append("手机:" + user.getMobilePhone() + ";"); |
|
|
|
|
|
|
|
info.append("办公电话:" + user.getOfficeTelephone() + ";"); |
|
|
|
|
|
|
|
info.append("家庭电话:" + user.getHomePhone() + ";"); |
|
|
|
|
|
|
|
String userRankId = "普通"; |
|
|
|
|
|
|
|
if ("d453bf52e571451996a8f5c251f7eb8d".equals(user.getUesrRankId())) { |
|
|
|
|
|
|
|
userRankId = "秘密"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
info.append("密码密级:" + userRankId + ";"); |
|
|
|
|
|
|
|
String leves = user.getSecretName(); |
|
|
|
|
|
|
|
info.append("人员密级:" + leves + ";"); |
|
|
|
|
|
|
|
String logName = "添加人员"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
//String numCode = this.getUser_idFormSession("customCode");
|
|
|
|
|
|
|
|
//if (numCode != null && numCode.equals("tianjin712suo")) {
|
|
|
|
|
|
|
|
// User safeUser = this.userService.selectUserByUserId("safesecret");
|
|
|
|
|
|
|
|
// this.messageService.insertMessage("添加用户" + user.getUserName() + "", "用户管理", (String)null, safeUser
|
|
|
|
|
|
|
|
// .getId(), "", "0", "K");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (numCode != null && (numCode.equals("siyuan17suo") || numCode.equals("guiyangshiyuan"))) {
|
|
|
|
|
|
|
|
UserSecret userSecret = new UserSecret(); |
|
|
|
|
|
|
|
userSecret.setId(user.getId()); |
|
|
|
|
|
|
|
userSecret.setSecret(user.getSecret()); |
|
|
|
|
|
|
|
this.usersecretService.insertSelective(userSecret); |
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
ajaxMessage.setCode("1"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage("保存成功"); |
|
|
|
|
|
|
|
} catch (Exception var16) { |
|
|
|
|
|
|
|
log.error("新增用户失败", var16); |
|
|
|
|
|
|
|
ajaxMessage.setCode("0"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage(Constant.ERROE_MESSAGE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author daijiajun |
|
|
|
* @date 2025/1/7 |
|
|
|
* @date 2025/1/7 |
|
|
|
* @description 用户注销 |
|
|
|
* @description 用户注销 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -247,71 +118,13 @@ public class UserController { |
|
|
|
@Operation(summary = "用户注销还原", description = "返回用户注销信息") |
|
|
|
@Operation(summary = "用户注销还原", description = "返回用户注销信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户注销信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户注销信息") |
|
|
|
public String updateUser(@RequestBody List<User> users, String logOut) { |
|
|
|
public String updateUser(@RequestBody List<User> users, String logOut) { |
|
|
|
String userNames = ""; |
|
|
|
return userService.updateUser(users, logOut); |
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
if (1L == new Long(logOut)) { |
|
|
|
|
|
|
|
for (User user : users) { |
|
|
|
|
|
|
|
User oneUser = userService.selectByPrimaryKey(user.getUserId()); |
|
|
|
|
|
|
|
oneUser.setLogout(1L); |
|
|
|
|
|
|
|
oneUser.setLogoutTime(DateUtils.getDateTime()); |
|
|
|
|
|
|
|
userService.updateById(oneUser); |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = oneUser.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + oneUser.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String logName = "注销人员"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "注销了用户" + userNames;
|
|
|
|
|
|
|
|
String comments = "注销了用户" + userNames; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!"1".equals(logOut)) { |
|
|
|
|
|
|
|
Integer userCount = Constant.userCount; |
|
|
|
|
|
|
|
if (0 != userCount) { |
|
|
|
|
|
|
|
List<User> selectAll = this.userService.selectAll((String)null); |
|
|
|
|
|
|
|
if (userCount < selectAll.size() + users.size()) { |
|
|
|
|
|
|
|
return "当前版本只允许新建" + Constant.userCount + "个用户"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.userService.recovery(IdComposeListUtil.listId(users)); |
|
|
|
|
|
|
|
userNames = ""; |
|
|
|
|
|
|
|
for (User user : users) { |
|
|
|
|
|
|
|
User u = this.userService.selectByPrimaryKey(user.getId()); |
|
|
|
|
|
|
|
String logName = "还原人员"; |
|
|
|
|
|
|
|
String logNameType = "注销用户列表"; |
|
|
|
|
|
|
|
//String comments = userName + "还原了用户" + u.getUserName();
|
|
|
|
|
|
|
|
//todo 获取登录人信息
|
|
|
|
|
|
|
|
String comments = "还原了用户" + u.getUserName(); |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = u.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + u.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
//if (numCode != null && numCode.equals("tianjin712suo")) {
|
|
|
|
|
|
|
|
// User safeUser = this.userService.selectUserByUserId("safesecret");
|
|
|
|
|
|
|
|
// this.messageService.insertMessage("还原用户" + userNames + "", "用户管理", (String)null, safeUser.getId
|
|
|
|
|
|
|
|
// (), "", "0", "K");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "0"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author daijiajun |
|
|
|
* @date 2025/1/7 |
|
|
|
* @date 2025/1/7 |
|
|
|
* @description 解锁 |
|
|
|
* @description 用户解锁 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RequestMapping( |
|
|
|
@RequestMapping( |
|
|
|
value = {"/updateLock"}, |
|
|
|
value = {"/updateLock"}, |
|
|
@ -322,33 +135,11 @@ public class UserController { |
|
|
|
@Operation(summary = "用户解锁", description = "返回用户解锁信息") |
|
|
|
@Operation(summary = "用户解锁", description = "返回用户解锁信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户解锁信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户解锁信息") |
|
|
|
public String updateLock(@RequestBody List<User> users) { |
|
|
|
public String updateLock(@RequestBody List<User> users) { |
|
|
|
List<String> listId = IdComposeListUtil.listId(users); |
|
|
|
return userService.updateLock(users); |
|
|
|
userService.unlock(listId); |
|
|
|
|
|
|
|
String userNames = ""; |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
for (User user : users) { |
|
|
|
|
|
|
|
User oneUser = userService.selectByPrimaryKey(user.getId()); |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = oneUser.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + oneUser.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String logName = "解锁"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "将用户" + userNames + "解锁";
|
|
|
|
|
|
|
|
String comments = "将用户" + userNames + "解锁"; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "解锁成功"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author daijiajun |
|
|
|
* @date 2025/1/7 |
|
|
|
* @date 2025/1/7 |
|
|
|
* @description 启用禁用 |
|
|
|
* @description 启用禁用 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -361,58 +152,13 @@ public class UserController { |
|
|
|
@Operation(summary = "用户启用禁用", description = "返回用户启用禁用信息") |
|
|
|
@Operation(summary = "用户启用禁用", description = "返回用户启用禁用信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户启用禁用信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户启用禁用信息") |
|
|
|
public AjaxMessage updateStatus(@RequestBody List<User> users) { |
|
|
|
public AjaxMessage updateStatus(@RequestBody List<User> users) { |
|
|
|
AjaxMessage ajaxMessage = new AjaxMessage(); |
|
|
|
return userService.updateStatus(users); |
|
|
|
String userNames = ""; |
|
|
|
|
|
|
|
String status = ""; |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
if (users.size() > 0) { |
|
|
|
|
|
|
|
for (User user : users) { |
|
|
|
|
|
|
|
User oneUser = userService.selectByPrimaryKey(user.getId()); |
|
|
|
|
|
|
|
oneUser.setUserStatus(user.getUserStatus()); |
|
|
|
|
|
|
|
userService.updateStatus(user); |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = oneUser.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + oneUser.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
status = "open"; |
|
|
|
|
|
|
|
if (user.getUserStatus() == 1L) { |
|
|
|
|
|
|
|
status = "close"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ("open".equals(status)) { |
|
|
|
|
|
|
|
String logName = "启用"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "启用了用户" + userNames;
|
|
|
|
|
|
|
|
String comments = "启用了用户" + userNames; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
ajaxMessage.setMessage("启用成功"); |
|
|
|
|
|
|
|
} else if ("close".equals(status)) { |
|
|
|
|
|
|
|
String logName = "禁用"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "禁用了用户" + userNames;
|
|
|
|
|
|
|
|
String comments = "禁用了用户" + userNames; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
ajaxMessage.setMessage("禁用成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yangmengchuan |
|
|
|
* @author daijiajun |
|
|
|
* @date 2025/1/7 |
|
|
|
* @date 2025/1/7 |
|
|
|
* @description 根据id进行删除 |
|
|
|
* @description 删除用户 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RequestMapping( |
|
|
|
@RequestMapping( |
|
|
|
value = {"/delete"}, |
|
|
|
value = {"/delete"}, |
|
|
@ -420,46 +166,21 @@ public class UserController { |
|
|
|
produces = {"application/json; charset=utf-8"} |
|
|
|
produces = {"application/json; charset=utf-8"} |
|
|
|
) |
|
|
|
) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@Operation(summary = "根据id删除用户", description = "返回删除用户信息") |
|
|
|
@Operation(summary = "删除用户", description = "返回删除用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功删除用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功删除用户信息") |
|
|
|
public String deleteUser(@RequestBody List<User> users) { |
|
|
|
public String deleteUser(@RequestBody List<User> users) { |
|
|
|
try { |
|
|
|
return userService.deleteUser(users); |
|
|
|
List<String> listId = IdComposeListUtil.listId(users); |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
String userNames = ""; |
|
|
|
|
|
|
|
for (User user : users) { |
|
|
|
|
|
|
|
User safeUser = this.userService.selectByPrimaryKey(user.getId()); |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = safeUser.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + safeUser.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.userService.deleteByPrimaryKey(listId); |
|
|
|
|
|
|
|
String logName = "删除人员"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
// String comments = userName + "删除了用户" + userNames;
|
|
|
|
|
|
|
|
String comments = "删除了用户" + userNames; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (numCode != null && (numCode.equals("siyuan17suo") || numCode.equals("guiyangshiyuan"))) {
|
|
|
|
|
|
|
|
this.usersecretService.deleteByPrimaryKey(listId); |
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
for (String id : listId) { |
|
|
|
|
|
|
|
this.userService.deleteUserRoleByUserId(id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "删除成功"; |
|
|
|
|
|
|
|
} catch (Exception var9) { |
|
|
|
|
|
|
|
log.error("删除用户失败", var9); |
|
|
|
|
|
|
|
return Constant.ERROE_MESSAGE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param user |
|
|
|
|
|
|
|
* @param pageNum |
|
|
|
|
|
|
|
* @param pageSize |
|
|
|
|
|
|
|
* @return java.util.List<com.keyware.htey.entity.user.User> |
|
|
|
|
|
|
|
* @description 用户列表 |
|
|
|
|
|
|
|
* @Author daijiajun |
|
|
|
|
|
|
|
* @date 2025/1/17 |
|
|
|
|
|
|
|
**/ |
|
|
|
@RequestMapping( |
|
|
|
@RequestMapping( |
|
|
|
value = {"/select"}, |
|
|
|
value = {"/select"}, |
|
|
|
method = {RequestMethod.POST}, |
|
|
|
method = {RequestMethod.POST}, |
|
|
@ -470,11 +191,7 @@ public class UserController { |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户列表信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "成功用户列表信息") |
|
|
|
public List<User> selectByUserInfo17suo(User user, @RequestParam(defaultValue = "0") int pageNum, |
|
|
|
public List<User> selectByUserInfo17suo(User user, @RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
user.setProjectSource(Constant.projectName); |
|
|
|
return userService.selectByUserInfo17suo(user, pageNum, pageSize); |
|
|
|
user.setUserStatus(1L); |
|
|
|
|
|
|
|
user.setPageSize(pageSize); |
|
|
|
|
|
|
|
user.setPageNum(pageNum); |
|
|
|
|
|
|
|
return userService.selectByUserInfo17suo(user); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -488,41 +205,7 @@ public class UserController { |
|
|
|
@Operation(summary = "密码重置", description = "返回密码重置信息") |
|
|
|
@Operation(summary = "密码重置", description = "返回密码重置信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "密码重置成功") |
|
|
|
@ApiResponse(responseCode = "200", description = "密码重置成功") |
|
|
|
public String PwdReset(@RequestParam String userIds) { |
|
|
|
public String PwdReset(@RequestParam String userIds) { |
|
|
|
String[] userIdArr = userIds.split(","); |
|
|
|
return userService.PwdReset(userIds); |
|
|
|
String userNames = ""; |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
for (String userId : userIdArr) { |
|
|
|
|
|
|
|
User user = new User(); |
|
|
|
|
|
|
|
String passsword = IdGenerator.random10Str(); |
|
|
|
|
|
|
|
user.setPassword(EncryptUtil.md5(passsword)); |
|
|
|
|
|
|
|
user.setPasswordOld(passsword); |
|
|
|
|
|
|
|
user.setUserPwdModifTime(DateUtils.getDate("yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
user.setInitPwdTime(DateUtils.formatDateTime(new Date())); |
|
|
|
|
|
|
|
user.setExitTime(DateUtils.getDate("yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
user.setId(userId); |
|
|
|
|
|
|
|
userService.updateByPrimaryKey(user); |
|
|
|
|
|
|
|
User oneUser = userService.selectByPrimaryKey(userId); |
|
|
|
|
|
|
|
if (oneUser == null) { |
|
|
|
|
|
|
|
log.error("不存在id为[" + userId + "]"); |
|
|
|
|
|
|
|
return Constant.ERROE_MESSAGE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = oneUser.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + oneUser.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String logName = "重置密码"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "将" + userNames + "用户的密码重置";
|
|
|
|
|
|
|
|
String comments = "将" + userNames + "用户的密码重置"; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
return "重置成功"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -539,38 +222,17 @@ public class UserController { |
|
|
|
public Page<User> selectLogOutUser(@RequestParam(required = false) String name, |
|
|
|
public Page<User> selectLogOutUser(@RequestParam(required = false) String name, |
|
|
|
@RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
if ("请输入姓名...".equals(name)) { |
|
|
|
return userService.selectLogOutUser(name, pageNum, pageSize); |
|
|
|
name = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 创建分页对象
|
|
|
|
|
|
|
|
Page<User> pageParam = new Page<>(pageNum, pageSize); |
|
|
|
|
|
|
|
// 创建查询条件
|
|
|
|
|
|
|
|
QueryWrapper<User> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(name)) { |
|
|
|
|
|
|
|
queryWrapper = queryWrapper.like("USER_NAME", name).orderByDesc("LOGOUT_TIME");// 模糊查询
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
queryWrapper = queryWrapper.orderByDesc("LOGOUT_TIME"); // 模糊查询
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
String logName = "查询注销用户列表"; |
|
|
|
|
|
|
|
String logNameType = "用户管理"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = this.getUser_idFormSession("userName") + "查询注销用户列表,查询关键字为:" + name == null ? "" : name;
|
|
|
|
|
|
|
|
String comments = "查询注销用户列表,查询关键字为:" + name == null ? "" : name; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
return userService.page(pageParam, queryWrapper); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询密码重置列表 |
|
|
|
* 初始密码列表 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param name |
|
|
|
* @param name |
|
|
|
* @param pageNum |
|
|
|
* @param pageNum |
|
|
|
* @param pageSize |
|
|
|
* @param pageSize |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
|
|
|
|
* @Author daijiajun |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@GetMapping("/userPwdResetList") |
|
|
|
@GetMapping("/userPwdResetList") |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -579,21 +241,7 @@ public class UserController { |
|
|
|
public List<User> userPwdResetList(@RequestParam(required = false) String name, |
|
|
|
public List<User> userPwdResetList(@RequestParam(required = false) String name, |
|
|
|
@RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
if ("请输入姓名...".equals(name)) { |
|
|
|
return userService.userPwdResetList(name, pageNum, pageSize); |
|
|
|
name = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<User> userList = userService.pwdResetList(name, pageNum, pageSize); |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
String logName = "查询密码重置列表"; |
|
|
|
|
|
|
|
String logNameType = "用户管理"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = this.getUser_idFormSession("userName") + "查询密码重置列表,查询关键字为:" + name == null ? "" : name;
|
|
|
|
|
|
|
|
String comments = "查询密码重置列表,查询关键字为:" + name == null ? "" : name; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
return userList; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -610,46 +258,18 @@ public class UserController { |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@Operation(summary = "删除用户", description = "返回删除用户信息") |
|
|
|
@Operation(summary = "删除用户", description = "返回删除用户信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "删除用户成功") |
|
|
|
@ApiResponse(responseCode = "200", description = "删除用户成功") |
|
|
|
public String delPwdResetList(@RequestParam String userIds, HttpServletRequest request) { |
|
|
|
public String delPwdResetList(@RequestParam String userIds) { |
|
|
|
try { |
|
|
|
return userService.delPwdResetList(userIds); |
|
|
|
List<String> listId = IdComposeListUtil.listId(userIds); |
|
|
|
|
|
|
|
String userNames = ""; |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
for (String userId : listId) { |
|
|
|
|
|
|
|
User user = this.userService.selectByPrimaryKey(userId); |
|
|
|
|
|
|
|
if (user == null) { |
|
|
|
|
|
|
|
log.error("不存在id为[" + userId + "]"); |
|
|
|
|
|
|
|
return Constant.ERROE_MESSAGE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ("".equals(userNames)) { |
|
|
|
|
|
|
|
userNames = user.getUserName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userNames = userNames + "," + user.getUserName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.userService.delPwdResetList(listId); |
|
|
|
|
|
|
|
String logName = "删除"; |
|
|
|
|
|
|
|
String logNameType = "初始密码"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "删除了用户" + userNames + "初始密码信息";
|
|
|
|
|
|
|
|
String comments = "删除了用户" + userNames + "初始密码信息"; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
//if (numCode != null && numCode.equals("tianjin712suo")) {
|
|
|
|
|
|
|
|
// safeUser = this.userService.selectUserByUserId("safesecret");
|
|
|
|
|
|
|
|
// this.messageService.insertMessage("删除用户" + userNames + "的重置密码", "用户管理", (String)null, safeUser
|
|
|
|
|
|
|
|
// .getId(), "", "0", "K");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
return "删除成功"; |
|
|
|
|
|
|
|
} catch (Exception var8) { |
|
|
|
|
|
|
|
log.error("删除失败", var8); |
|
|
|
|
|
|
|
return Constant.ERROE_MESSAGE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param user |
|
|
|
|
|
|
|
* @param request |
|
|
|
|
|
|
|
* @return com.keyware.htey.utli.AjaxMessage |
|
|
|
|
|
|
|
* @description 修改人员 |
|
|
|
|
|
|
|
* @Author daijiajun |
|
|
|
|
|
|
|
* @date 2025/1/17 |
|
|
|
|
|
|
|
**/ |
|
|
|
@RequestMapping( |
|
|
|
@RequestMapping( |
|
|
|
value = {"/edit"}, |
|
|
|
value = {"/edit"}, |
|
|
|
method = {RequestMethod.POST}, |
|
|
|
method = {RequestMethod.POST}, |
|
|
@ -659,218 +279,7 @@ public class UserController { |
|
|
|
@Operation(summary = "修改人员", description = "返回修改人员信息") |
|
|
|
@Operation(summary = "修改人员", description = "返回修改人员信息") |
|
|
|
@ApiResponse(responseCode = "200", description = "修改人员成功") |
|
|
|
@ApiResponse(responseCode = "200", description = "修改人员成功") |
|
|
|
public AjaxMessage edit(@RequestBody User user, HttpServletRequest request) { |
|
|
|
public AjaxMessage edit(@RequestBody User user, HttpServletRequest request) { |
|
|
|
AjaxMessage ajaxMessage = new AjaxMessage(); |
|
|
|
return userService.edit(user, request); |
|
|
|
User oldUser = this.userService.selectByPrimaryKey(user.getId()); |
|
|
|
|
|
|
|
byte[] fileData = null; |
|
|
|
|
|
|
|
AuditLog auditLog = new AuditLog(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<User> selectByUserNumber = this.userService.selectByUserNumber(user.getUserNumber()); |
|
|
|
|
|
|
|
if (selectByUserNumber.size() > 0) { |
|
|
|
|
|
|
|
if (selectByUserNumber.size() != 1) { |
|
|
|
|
|
|
|
ajaxMessage.setCode("0"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage("员工编号已存在"); |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User user2 = (User)selectByUserNumber.get(0); |
|
|
|
|
|
|
|
if (!user2.getId().equals(user.getId())) { |
|
|
|
|
|
|
|
ajaxMessage.setCode("0"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage("员工编号已存在"); |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String contentType = request.getContentType(); |
|
|
|
|
|
|
|
String comments; |
|
|
|
|
|
|
|
if (contentType != null && contentType.toLowerCase().startsWith("multipart/")) { |
|
|
|
|
|
|
|
MultipartHttpServletRequest multipartRequest |
|
|
|
|
|
|
|
= (MultipartHttpServletRequest)WebUtils.getNativeRequest(request, |
|
|
|
|
|
|
|
MultipartHttpServletRequest.class); |
|
|
|
|
|
|
|
MultipartFile file = multipartRequest.getFile("multipartfile"); |
|
|
|
|
|
|
|
comments = request.getParameter("changeFlg"); |
|
|
|
|
|
|
|
if (comments.equals("1")) { |
|
|
|
|
|
|
|
if (file != null) { |
|
|
|
|
|
|
|
fileData = file.getBytes(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String signatureUrl = request.getParameter("signatureUrl"); |
|
|
|
|
|
|
|
Base64.Decoder decoder = Base64.getDecoder(); |
|
|
|
|
|
|
|
signatureUrl = signatureUrl.substring(signatureUrl.indexOf(",", 1) + 1, |
|
|
|
|
|
|
|
signatureUrl.length()); |
|
|
|
|
|
|
|
fileData = decoder.decode(signatureUrl); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < fileData.length; ++i) { |
|
|
|
|
|
|
|
if (fileData[i] < 0) { |
|
|
|
|
|
|
|
fileData[i] = (byte)(fileData[i] + 256); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user.setImgData(fileData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.userService.updateByPrimaryKey(user); |
|
|
|
|
|
|
|
StringBuilder info = new StringBuilder(); |
|
|
|
|
|
|
|
if (oldUser.getUserNumber() == null) { |
|
|
|
|
|
|
|
oldUser.setUserNumber(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getUserNumber().equals(user.getUserNumber())) { |
|
|
|
|
|
|
|
info.append("员工编号从" + oldUser.getUserNumber() + "修改为" + user.getUserNumber() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getUserName() == null) { |
|
|
|
|
|
|
|
oldUser.setUserName(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getUserName().equals(user.getUserName())) { |
|
|
|
|
|
|
|
info.append("姓名从" + oldUser.getUserName() + "修改为" + user.getUserName() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getIdCard() == null) { |
|
|
|
|
|
|
|
oldUser.setIdCard(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getIdCard().equals(user.getIdCard())) { |
|
|
|
|
|
|
|
info.append("身份证号码从" + oldUser.getUserNumber() + "修改为" + user.getUserNumber() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getEmail() == null) { |
|
|
|
|
|
|
|
oldUser.setEmail(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getEmail().equals(user.getEmail())) { |
|
|
|
|
|
|
|
info.append("电子邮件从" + oldUser.getUserNumber() + "修改为" + user.getUserNumber() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getDepartId() == null) { |
|
|
|
|
|
|
|
oldUser.setDepartId(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!oldUser.getDepartId().equals(user.getDepartId())) { |
|
|
|
|
|
|
|
Department department; |
|
|
|
|
|
|
|
if (org.springframework.util.StringUtils.hasText(oldUser.getDepartId()) |
|
|
|
|
|
|
|
&& org.springframework.util.StringUtils.hasText(user.getDepartId())) { |
|
|
|
|
|
|
|
department = this.departmentService.selectByPrimaryKey(oldUser.getDepartId()); |
|
|
|
|
|
|
|
Department department1 = this.departmentService.selectByPrimaryKey(user.getDepartId()); |
|
|
|
|
|
|
|
if (department != null && department1 != null) { |
|
|
|
|
|
|
|
info.append( |
|
|
|
|
|
|
|
"所属部门从" + department.getDeptName() + "修改为" + department1.getDeptName() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (!org.springframework.util.StringUtils.hasText(oldUser.getDepartId()) |
|
|
|
|
|
|
|
&& org.springframework.util.StringUtils.hasText(user.getDepartId())) { |
|
|
|
|
|
|
|
department = this.departmentService.selectByPrimaryKey(user.getDepartId()); |
|
|
|
|
|
|
|
if (department != null) { |
|
|
|
|
|
|
|
info.append("所属部门从空修改为" + department.getDeptName() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if ( |
|
|
|
|
|
|
|
org.springframework.util.StringUtils.hasText(oldUser.getDepartId()) |
|
|
|
|
|
|
|
&& !org.springframework.util.StringUtils.hasText(user.getDepartId())) { |
|
|
|
|
|
|
|
department = this.departmentService.selectByPrimaryKey(oldUser.getDepartId()); |
|
|
|
|
|
|
|
if (department != null) { |
|
|
|
|
|
|
|
info.append("所属部门从" + department.getDeptName() + "修改为空;"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getSex() == null) { |
|
|
|
|
|
|
|
oldUser.setSex(0L); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String oldUserRankId; |
|
|
|
|
|
|
|
String userRankId; |
|
|
|
|
|
|
|
if (!oldUser.getSex().equals(user.getSex())) { |
|
|
|
|
|
|
|
oldUserRankId = "女"; |
|
|
|
|
|
|
|
userRankId = "女"; |
|
|
|
|
|
|
|
if (Constant.UESR_SEX_MAN.equals(oldUser.getSex())) { |
|
|
|
|
|
|
|
oldUserRankId = "男"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Constant.UESR_SEX_MAN.equals(user.getSex())) { |
|
|
|
|
|
|
|
userRankId = "男"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info.append("性别从" + oldUserRankId + "修改为" + userRankId + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getMobilePhone() == null) { |
|
|
|
|
|
|
|
oldUser.setMobilePhone(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getMobilePhone().equals(user.getMobilePhone())) { |
|
|
|
|
|
|
|
info.append("手机从" + oldUser.getMobilePhone() + "修改为" + user.getMobilePhone() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getOfficeTelephone() == null) { |
|
|
|
|
|
|
|
oldUser.setOfficeTelephone(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getOfficeTelephone().equals(user.getOfficeTelephone())) { |
|
|
|
|
|
|
|
info.append( |
|
|
|
|
|
|
|
"办公电话从" + oldUser.getOfficeTelephone() + "修改为" + user.getOfficeTelephone() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getHomePhone() == null) { |
|
|
|
|
|
|
|
oldUser.setHomePhone(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getHomePhone().equals(user.getHomePhone())) { |
|
|
|
|
|
|
|
info.append("家庭电话从" + oldUser.getHomePhone() + "修改为" + user.getHomePhone() + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldUser.getUesrRankId() == null) { |
|
|
|
|
|
|
|
oldUser.setUesrRankId(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!oldUser.getUesrRankId().equals(user.getUesrRankId())) { |
|
|
|
|
|
|
|
oldUserRankId = "普通"; |
|
|
|
|
|
|
|
userRankId = "普通"; |
|
|
|
|
|
|
|
if (Constant.UESR_RANK_ID_SECRET.equals(oldUser.getUesrRankId())) { |
|
|
|
|
|
|
|
oldUserRankId = "秘密"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Constant.UESR_RANK_ID_SECRET.equals(user.getUesrRankId())) { |
|
|
|
|
|
|
|
userRankId = "秘密"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info.append("密码密级从" + oldUserRankId + "修改为" + userRankId + ";"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
oldUserRankId = user.getSecret(); |
|
|
|
|
|
|
|
info.append("人员密级设置为" + oldUserRankId); |
|
|
|
|
|
|
|
String logName = "修改人员"; |
|
|
|
|
|
|
|
String logNameType = "用户列表"; |
|
|
|
|
|
|
|
//todo 登录人的用户名 userName
|
|
|
|
|
|
|
|
//String comments = userName + "修改了用户" + user.getUserName() + "的信息";
|
|
|
|
|
|
|
|
comments = "修改了用户" + user.getUserName() + "的信息"; |
|
|
|
|
|
|
|
auditLog.setLogName(logName); |
|
|
|
|
|
|
|
auditLog.setLogNameType(logNameType); |
|
|
|
|
|
|
|
auditLog.setComments(comments + ";" + info); |
|
|
|
|
|
|
|
auditLogService.addAuditLog(auditLog); |
|
|
|
|
|
|
|
//todo 添加MESSAGE_TABLE表
|
|
|
|
|
|
|
|
//if (userRankId != null && userRankId.equals("tianjin712suo")) {
|
|
|
|
|
|
|
|
// User safeUser = this.userService.selectUserByUserId("safesecret");
|
|
|
|
|
|
|
|
// this.messageService.insertMessage("修改用户" + user.getUserName() + "", "用户管理", (String)null,
|
|
|
|
|
|
|
|
// safeUser.getId(), "", "0", "K");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//todo customCode从Session中获取进行判断
|
|
|
|
|
|
|
|
//if (userRankId != null && (userRankId.equals("siyuan17suo") || userRankId.equals("guiyangshiyuan"))) {
|
|
|
|
|
|
|
|
UserSecret userSecret = this.usersecretService.selectByPrimaryKey(user.getId()); |
|
|
|
|
|
|
|
if (userSecret == null) { |
|
|
|
|
|
|
|
UserSecret secret = new UserSecret(); |
|
|
|
|
|
|
|
secret.setId(user.getId()); |
|
|
|
|
|
|
|
secret.setSecret(user.getSecret()); |
|
|
|
|
|
|
|
this.usersecretService.insertSelective(secret); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
userSecret.setSecret(user.getSecret()); |
|
|
|
|
|
|
|
this.usersecretService.updateByPrimaryKey(userSecret); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
ajaxMessage.setCode("1"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage("保存成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception var16) { |
|
|
|
|
|
|
|
log.error("修改用户失败", var16); |
|
|
|
|
|
|
|
ajaxMessage.setCode("0"); |
|
|
|
|
|
|
|
ajaxMessage.setMessage(Constant.ERROE_MESSAGE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ajaxMessage; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -889,35 +298,26 @@ public class UserController { |
|
|
|
public List<User> selectLoginList(@RequestParam(required = false) String userNameForSerch, |
|
|
|
public List<User> selectLoginList(@RequestParam(required = false) String userNameForSerch, |
|
|
|
@RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "0") int pageNum, |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
@RequestParam(defaultValue = "10") int pageSize) { |
|
|
|
Collection<Session> sessions = this.sessionDAO.getActiveSessions(); |
|
|
|
return userService.selectLoginList(userNameForSerch, pageNum, pageSize); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
} |
|
|
|
Map<String, String> maploginIp = new HashMap<>(); |
|
|
|
|
|
|
|
Map<String, String> maploginTime = new HashMap<>(); |
|
|
|
/** |
|
|
|
Iterator<Session> var7 = sessions.iterator(); |
|
|
|
* @param user |
|
|
|
while (var7.hasNext()) { |
|
|
|
* @param setDocumentDepartId |
|
|
|
Session session = var7.next(); |
|
|
|
* @return java.lang.String |
|
|
|
Date date = session.getStartTimestamp(); |
|
|
|
* @description 查询部门管理人 |
|
|
|
String loginIp = SessionCounter.sessionIpMap.get(session.getId()); |
|
|
|
* @Author daijiajun |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
* @date 2025/1/17 |
|
|
|
String loginTime = formatter.format(date); |
|
|
|
**/ |
|
|
|
String userId = (String)session.getAttribute("user_id"); |
|
|
|
@RequestMapping( |
|
|
|
if (userId != null) { |
|
|
|
value = {"/selectDepartUser"}, |
|
|
|
maploginIp.put(userId, loginIp); |
|
|
|
method = {RequestMethod.POST}, |
|
|
|
maploginTime.put(userId, loginTime); |
|
|
|
produces = {"application/json; charset=utf-8"} |
|
|
|
list.add(userId); |
|
|
|
) |
|
|
|
} |
|
|
|
@ResponseBody |
|
|
|
} |
|
|
|
@Operation(summary = "查询部门管理人", description = "返回查询部门管理人信息") |
|
|
|
if (list.size() == 0) { |
|
|
|
@ApiResponse(responseCode = "200", description = "查询部门管理人成功") |
|
|
|
return new ArrayList<>(); |
|
|
|
public String selectDepartUser(@RequestBody User user, @RequestParam(required = false) String setDocumentDepartId) { |
|
|
|
} |
|
|
|
return userService.selectDepartUser(user, setDocumentDepartId); |
|
|
|
List<User> userList = this.userService.selectAllLogin(list, userNameForSerch, pageNum, |
|
|
|
|
|
|
|
pageSize); |
|
|
|
|
|
|
|
Iterator<User> var15 = userList.iterator(); |
|
|
|
|
|
|
|
while (var15.hasNext()) { |
|
|
|
|
|
|
|
User user = var15.next(); |
|
|
|
|
|
|
|
user.setIP(maploginIp.get(user.getId())); |
|
|
|
|
|
|
|
user.setLoginTime(maploginTime.get(user.getId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return userList; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|