用户管理中用户列表功能包括页面初始化,条件查询,添加人员,注销人员,密码重置,批量导入,人员的解锁,人员的启用,人员的禁用以,页面中的分页,配置文件变更数据库名

main
admin 5 days ago
parent d91a3174f4
commit ec839b84e7
  1. 32
      pom.xml
  2. 2
      src/main/java/com/keyware/htey/HteyApplication.java
  3. 104
      src/main/java/com/keyware/htey/controller/Department/DepartmentController.java
  4. 41
      src/main/java/com/keyware/htey/controller/Usersecret/UsersecretController.java
  5. 62
      src/main/java/com/keyware/htey/controller/humanResourceManagement/HumanResourceManagementController.java
  6. 40
      src/main/java/com/keyware/htey/controller/organizeassets/OFourColumController.java
  7. 47
      src/main/java/com/keyware/htey/controller/user/AuditLogController.java
  8. 395
      src/main/java/com/keyware/htey/controller/user/UserController.java
  9. 31
      src/main/java/com/keyware/htey/entity/department/Department.java
  10. 18
      src/main/java/com/keyware/htey/entity/number/NumberBuilder.java
  11. 24
      src/main/java/com/keyware/htey/entity/organizeassets/OFourColum.java
  12. 34
      src/main/java/com/keyware/htey/entity/user/AuditLog.java
  13. 44
      src/main/java/com/keyware/htey/entity/user/User.java
  14. 18
      src/main/java/com/keyware/htey/entity/usersecret/Usersecret.java
  15. 15
      src/main/java/com/keyware/htey/mybatis/itf/AuditLogMapper.java
  16. 20
      src/main/java/com/keyware/htey/mybatis/itf/DepartmentMapper.java
  17. 15
      src/main/java/com/keyware/htey/mybatis/itf/OFourColumMapper.java
  18. 23
      src/main/java/com/keyware/htey/mybatis/itf/UserMapper.java
  19. 15
      src/main/java/com/keyware/htey/mybatis/itf/UsersecretMapper.java
  20. 20
      src/main/java/com/keyware/htey/mybatis/itf/number/NumberBuilderMapper.java
  21. 41
      src/main/java/com/keyware/htey/service/impl/AuditLogServiceImpl.java
  22. 29
      src/main/java/com/keyware/htey/service/impl/DepartmentServiceImpl.java
  23. 69
      src/main/java/com/keyware/htey/service/impl/NumberBuilderServiceImpl.java
  24. 17
      src/main/java/com/keyware/htey/service/impl/OFourColumServiceImpl.java
  25. 61
      src/main/java/com/keyware/htey/service/impl/UserServiceImpl.java
  26. 21
      src/main/java/com/keyware/htey/service/impl/UsersecretServiceImpl.java
  27. 8
      src/main/java/com/keyware/htey/service/itf/AuditLogService.java
  28. 12
      src/main/java/com/keyware/htey/service/itf/DepartmentService.java
  29. 8
      src/main/java/com/keyware/htey/service/itf/OFourColumService.java
  30. 22
      src/main/java/com/keyware/htey/service/itf/UserService.java
  31. 8
      src/main/java/com/keyware/htey/service/itf/UsersecretService.java
  32. 13
      src/main/java/com/keyware/htey/service/itf/number/NumberBuilderService.java
  33. 17
      src/main/java/com/keyware/htey/utli/AjaxMessage.java
  34. 14
      src/main/java/com/keyware/htey/utli/Constant.java
  35. 545
      src/main/java/com/keyware/htey/utli/DateUtils.java
  36. 68
      src/main/java/com/keyware/htey/utli/EncryptUtil.java
  37. 360
      src/main/java/com/keyware/htey/utli/ExcelUtils.java
  38. 26
      src/main/java/com/keyware/htey/utli/IdComposeListUtil.java
  39. 63
      src/main/java/com/keyware/htey/utli/IdGenerator.java
  40. 25
      src/main/java/com/keyware/htey/utli/IpUtil.java
  41. 135
      src/main/java/com/keyware/htey/utli/JsonUtils.java
  42. 2
      src/main/resources/application.yml
  43. 18
      src/main/resources/mapper/AuditLogMapper.xml
  44. 42
      src/main/resources/mapper/DepartmentMapper.xml
  45. 14
      src/main/resources/mapper/OFourColumMapper.xml
  46. 381
      src/main/resources/mapper/UserMapper.xml
  47. 12
      src/main/resources/mapper/UsersecretMapper.xml
  48. 46
      src/main/resources/mapper/number/NumberBuilderMapper.xml

@ -86,6 +86,38 @@
<artifactId>ojdbc8</artifactId>
<version>19.8.0.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
<dependency>
<groupId>com.keyware</groupId>
<artifactId>HTEY</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
</dependencies>
<build>

@ -1,9 +1,11 @@
package com.keyware.htey;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan({"com.keyware.htey.mybatis.itf"})
public class HteyApplication {
public static void main(String[] args) {

@ -0,0 +1,104 @@
package com.keyware.htey.controller.Department;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.keyware.htey.entity.department.Department;
import com.keyware.htey.service.itf.DepartmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author daijj8
* @version V1.0
* @description 组织资产4列的所有数据
* @Package com.keyware.htey.controller.user
* @date 2025/1/10 11:29
*/
@Controller
@RequestMapping("/Department")
@Tag(name = "DEPARTMENT API", description = "部门表数据接口")
@Slf4j
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
@GetMapping("/selectById")
@ResponseBody
@Operation(summary = "部门表查询", description = "返回部门表信息")
@ApiResponse(responseCode = "200", description = "成功部门表信息")
public Department selectById(@RequestParam String id) {
return departmentService.getById(id);
}
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 新增部门表
*/
@RequestMapping(
value = {"/addDepartment"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "新增部门表", description = "返回新增部门信息")
@ApiResponse(responseCode = "200", description = "成功新增部门信息")
public boolean addDepartment(@RequestBody Department department) {
Department oneDepartment = departmentService.getOne(
new QueryWrapper<Department>().eq("id", department.getId()));
if (oneDepartment != null) {
return false;
}
return departmentService.save(department);
}
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 修改部门
*/
@RequestMapping(
value = {"/updateDepartment"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "修改部门", description = "返回修改部门信息")
@ApiResponse(responseCode = "200", description = "成功修改部门信息")
public boolean updateDepartment(@RequestBody List<Department> departments) {
boolean flag = true;
for (Department department : departments) {
boolean update = departmentService.updateById(department);
if (!update) {
flag = false;
break;
}
}
return flag;
}
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 根据id进行删除
*/
@GetMapping("/deleteDepartment")
@ResponseBody
@Operation(summary = "根据id删除部门", description = "返回删除部门信息")
@ApiResponse(responseCode = "200", description = "成功删除部门信息")
public boolean deleteDepartment(@RequestParam String id) {
return departmentService.removeById(id);
}
}

@ -0,0 +1,41 @@
package com.keyware.htey.controller.Usersecret;
import com.keyware.htey.entity.usersecret.Usersecret;
import com.keyware.htey.service.itf.UsersecretService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author daijiajun
* @date 2025/1/7
* @description 用户登录日志
*/
@Controller
@RequestMapping("/usersecret")
@Slf4j
@Tag(name = "Usersecret API", description = "用户登录秘密管理接口")
public class UsersecretController {
@Autowired
private UsersecretService usersecretService;
/**
* @author daijiajun
* @date 2025/1/7
* @description 根据id获取用户信息
*/
@GetMapping("/selectById")
@ResponseBody
@Operation(summary = "根据id查询秘密", description = "返回查询秘密信息")
@ApiResponse(responseCode = "200", description = "成功获取用户信息")
public Usersecret selectById(@RequestParam String id) {
return usersecretService.getById(id);
}
}

@ -0,0 +1,62 @@
package com.keyware.htey.controller.humanResourceManagement;
import com.keyware.htey.entity.user.AuditLog;
import com.keyware.htey.service.itf.AuditLogService;
import com.keyware.htey.utli.AjaxMessage;
import com.keyware.htey.utli.ExcelUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
@Controller
@RequestMapping("/humanResourceManagement")
@Tag(name = "Excl API", description = "表格接口")
@Slf4j
public class HumanResourceManagementController {
@Autowired
private AuditLogService auditLogService;
@RequestMapping(value = {"/analysisExcl"},method = {RequestMethod.POST},produces = {"application/json; charset=utf-8"})
@ResponseBody
@Operation(summary = "用户列表导入", description = "返回导入信息")
@ApiResponse(responseCode = "200", description = "成功导入信息")
public AjaxMessage analysisExcl(@RequestParam MultipartFile multipartfile) {
AjaxMessage ajaxMessage = new AjaxMessage();
try {
Workbook workbook = WorkbookFactory.create(multipartfile.getInputStream());
Sheet sheet = workbook.getSheetAt(0);
ExcelUtils.checkFirstRowName(ajaxMessage, sheet);
if ("0".equals(ajaxMessage.getCode())) {
return ajaxMessage;
}
AuditLog auditLog = new AuditLog();
String message = new ExcelUtils().insertUser(auditLog, sheet);
ajaxMessage.setCode("1");
ajaxMessage.setMessage(message);
// String comments = this.getUser_idFormSession("userName") + message;
String comments = message;
String logName = "批量导入";
String logNameType = "用户列表";
auditLog.setLogName(logName);
auditLog.setLogNameType(logNameType);
auditLog.setComments(comments);
auditLogService.addAuditLog(auditLog);
} catch (Exception var8) {
log.error("导入失败", var8);
var8.printStackTrace();
ajaxMessage.setCode("0");
}
return ajaxMessage;
}
}

@ -0,0 +1,40 @@
package com.keyware.htey.controller.organizeassets;
import com.keyware.htey.entity.organizeassets.OFourColum;
import com.keyware.htey.service.itf.OFourColumService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author daijj8
* @version V1.0
* @description 组织资产4列的所有数据
* @Package com.keyware.htey.controller.user
* @date 2025/1/10 11:29
*/
@Controller
@RequestMapping("/oFourColum")
@Tag(name = "OFourColum API", description = "组织资产4列的所有数据接口")
@Slf4j
public class OFourColumController {
@Qualifier("newOFourColumService")
@Autowired
private OFourColumService oFourColumService;
@GetMapping("/selectByUserInfo17suo")
@ResponseBody
@Operation(summary = "用户密级查询", description = "返回用户密级信息")
@ApiResponse(responseCode = "200", description = "成功用户密级信息")
public OFourColum selectOFourColumById(@RequestParam String id) {
return oFourColumService.getById(id);
}
}

@ -0,0 +1,47 @@
package com.keyware.htey.controller.user;
import com.keyware.htey.entity.user.AuditLog;
import com.keyware.htey.service.itf.AuditLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author daijiajun
* @date 2025/1/7
* @description 用户登录日志
*/
@Controller
@RequestMapping("/auditLog")
@Slf4j
@Tag(name = "AuditLog API", description = "用户登录日志管理接口")
public class AuditLogController {
@Autowired
private AuditLogService auditLogService;
/**
* @author daijiajun
* @date 2025/1/7
* @description 新增用户登录日志
*/
@RequestMapping(
value = {"/addAuditLog"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "新增用户登录日志", description = "返回添加成功失败信息")
@ApiResponse(responseCode = "200", description = "成功用户登录日志信息")
public boolean addAuditLog(@RequestBody AuditLog auditLog) {
return auditLogService.save(auditLog);
}
}

@ -1,15 +1,38 @@
package com.keyware.htey.controller.user;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.usersecret.Usersecret;
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.UsersecretService;
import com.keyware.htey.service.itf.number.NumberBuilderService;
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.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@ -20,10 +43,20 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/
@Controller
@RequestMapping("/user")
@Slf4j
@Tag(name = "User API", description = "用户管理接口")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private AuditLogService auditLogService;
@Autowired
private NumberBuilderService numberBuilderService;
@Autowired
private DepartmentService departmentService;
@Autowired
private UsersecretService usersecretService;
/**
* @author yangmengchuan
* @date 2025/1/7
@ -33,7 +66,8 @@ public class UserController {
@ResponseBody
@Operation(summary = "分页查询用户", description = "返回查询用户信息")
@ApiResponse(responseCode = "200", description = "成功获取用户信息")
public Page<User> selectAll(@RequestParam(defaultValue = "1") int pageNum,@RequestParam(defaultValue = "10") int pageSize){
public Page<User> selectAll(@RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) {
// 创建分页对象
Page<User> pageParam = new Page<>(pageNum, pageSize);
@ -47,6 +81,7 @@ public class UserController {
return userService.page(pageParam, queryWrapper);*/
return userService.page(pageParam);
}
/**
* @author yangmengchuan
* @date 2025/1/7
@ -59,30 +94,304 @@ public class UserController {
public User selectById(@RequestParam String id) {
return userService.getById(id);
}
@GetMapping("/viewInfo")
@ResponseBody
@Operation(summary = "根据id查询用户", description = "返回查询用户信息")
@ApiResponse(responseCode = "200", description = "成功获取用户信息")
public String viewInfo(@RequestParam String id) {
AuditLog auditLog = new AuditLog();
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
* @date 2025/1/7
* @description 新增用户
*/
@GetMapping("/addUser")
@RequestMapping(
value = {"/add"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "新增用户", description = "返回新增用户信息")
@ApiResponse(responseCode = "200", description = "成功新增用户信息")
public boolean addUser(@RequestParam User user){
return userService.save(user);
public AjaxMessage addUser(@RequestBody User user) {
AjaxMessage ajaxMessage = new AjaxMessage();
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
* @date 2025/1/7
* @description 修改用户
* @description 用户注销
*/
@GetMapping("/updateUser")
@RequestMapping(
value = {"/updateLogout"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "修改用户", description = "返回修改用户信息")
@ApiResponse(responseCode = "200", description = "成功修改用户信息")
public boolean updateUser(@RequestParam User user){
return userService.updateById(user);
@Operation(summary = "用户注销", description = "返回用户注销信息")
@ApiResponse(responseCode = "200", description = "成功用户注销信息")
public String updateUser(@RequestBody List<User> users, String logOut) {
String userNames = "";
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.getUserId());
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
* @date 2025/1/7
* @description 解锁
*/
@RequestMapping(
value = {"/updateLock"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "用户解锁", description = "返回用户解锁信息")
@ApiResponse(responseCode = "200", description = "成功用户解锁信息")
public String updateLock(@RequestBody List<User> users) {
List<String> listId = IdComposeListUtil.listId(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
* @date 2025/1/7
* @description 启用禁用
*/
@RequestMapping(
value = {"/updateStatus"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "用户启用禁用", description = "返回用户启用禁用信息")
@ApiResponse(responseCode = "200", description = "成功用户启用禁用信息")
public AjaxMessage updateStatus(@RequestBody List<User> users) {
AjaxMessage ajaxMessage = new AjaxMessage();
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
* @date 2025/1/7
@ -95,4 +404,70 @@ public class UserController {
public boolean deleteUser(@RequestParam String id) {
return userService.removeById(id);
}
@RequestMapping(
value = {"/select"},
method = {RequestMethod.POST},
produces = {"application/json; charset=utf-8"}
)
@ResponseBody
@Operation(summary = "用户列表", description = "返回用户列表信息")
@ApiResponse(responseCode = "200", description = "成功用户列表信息")
public List<User> selectByUserInfo17suo(User user, @RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) {
user.setProjectSource(Constant.projectName);
user.setUserStatus(1L);
List<User> userList = userService.selectByUserInfo17suo(user);
int startIndex = (pageNum - 1) * pageSize;
int endIndex = Math.min(startIndex + pageSize, userList.size());
if (startIndex >= userList.size()) {
return Collections.emptyList(); // 如果起始索引超出列表范围,则返回空列表
} else {
return userList.subList(startIndex, endIndex);
}
}
/**
* @return null
* @description 密码重置
* @Author daijj8
* @Date 2025/1/13 17:50
**/
@GetMapping("/PwdReset")
@ResponseBody
@Operation(summary = "密码重置", description = "返回密码重置信息")
@ApiResponse(responseCode = "200", description = "密码重置成功")
public String PwdReset(@RequestParam String userIds) {
String[] userIdArr = userIds.split(",");
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 ("".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 "重置成功";
}
}

@ -0,0 +1,31 @@
package com.keyware.htey.entity.department;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("DEPARTMENT")
public class Department implements Serializable {
private static final long serialVersionUID = -1292417487409772488L;
private String id;
private String deptName;
private String parentId;
private Integer orderNo;
private String comments;
private String deptCreateTime;
private String deptNumber;
private String manager;
private Integer totalWorkers;
private String superLeader;
private String interfacePerson;
private String departAbbrevia;
private String charge;
private String isSys;
private String projectSource;
}

@ -0,0 +1,18 @@
package com.keyware.htey.entity.number;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("NUMBER_BUILDER")
public class NumberBuilder implements Serializable {
private static final long serialVersionUID = -1292417487409772488L;
private String numberId;
private String number;
}

@ -0,0 +1,24 @@
package com.keyware.htey.entity.organizeassets;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("KT_O_FOUR_COLUM")
public class OFourColum implements Serializable {
private static final long serialVersionUID = 1663815585294731536L;
private String id;
private String name;
private String code;
private String describe;
private String parentId;
private Integer seq;
private String formLevel;
private String isDefault;
}

@ -0,0 +1,34 @@
package com.keyware.htey.entity.user;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("K_USER_AUDIT_LOG")
public class AuditLog implements Serializable {
private static final long serialVersionUID = -1292417487409772488L;
private String id;
private String logName;
private String logNameType;
private String userName;
private String deptName;
private String ipAddress;
private String operTime;
private String comments;
private String userId;
private String projectSource;
private String status;
@TableField(exist = false)
private String fileTime;
@TableField(exist = false)
private String startTime;
@TableField(exist = false)
private String endTime;
}

@ -1,15 +1,57 @@
package com.keyware.htey.entity.user;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("K_USER")
public class User implements Serializable {
private static final long serialVersionUID = -1292417487409772488L;
private String id;
private String userId;
private String userName;
private String password;
private String departId;
private String userCreationTime;
private String userPwdModifTime;
private Long userStatus;
private Long userLock;
private Long userPwdError;
private String userPwdErrorDate;
private String exitTime;
private String passwordOld;
private String post;
private String email;
private String officeTelephone;
private String userNumber;
private String idCard;
private String mobilePhone;
private Long sex;
private String homePhone;
private Long logout;
private String initPwdTime;
private String sort;
private String isSys;
private String logoutTime;
private String projectSource;
private String uesrRankId;
@TableField(exist = false)
private String deptName;
@TableField(exist = false)
private String userNameForSerch;
@TableField(exist = false)
private String flag;
@TableField(exist = false)
private String secret;
@TableField(exist = false)
private String ids;
@TableField(exist = false)
private String secretName;
}

@ -0,0 +1,18 @@
package com.keyware.htey.entity.usersecret;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("USERSECRET")
public class Usersecret implements Serializable {
private static final long serialVersionUID = -1292417487409772488L;
private String id;
private String secret;
}

@ -0,0 +1,15 @@
package com.keyware.htey.mybatis.itf;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keyware.htey.entity.user.AuditLog;
import org.apache.ibatis.annotations.Mapper;
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 用户与数据库交互
*/
@Mapper
public interface AuditLogMapper extends BaseMapper<AuditLog> {
}

@ -0,0 +1,20 @@
package com.keyware.htey.mybatis.itf;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keyware.htey.entity.department.Department;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 用户与数据库交互
*/
@Mapper
public interface DepartmentMapper extends BaseMapper<Department> {
List<Department> selectByDeparmentName(@Param("deptName") String var1, @Param("projectSource") String var2);
Department selectByPrimaryKey(String var1);
}

@ -0,0 +1,15 @@
package com.keyware.htey.mybatis.itf;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keyware.htey.entity.organizeassets.OFourColum;
import org.apache.ibatis.annotations.Mapper;
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 用户与数据库交互
*/
@Mapper
public interface OFourColumMapper extends BaseMapper<OFourColum> {
}

@ -1,8 +1,11 @@
package com.keyware.htey.mybatis.itf;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keyware.htey.entity.user.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author yangmengchuan
@ -11,4 +14,24 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface UserMapper extends BaseMapper<User> {
List<User> selectByUserInfo17suo(@Param("user") User user);
int updateByPrimaryKey(User user);
int unlock(List<?> list);
int updateStatus(User var1);
List<User> selectByUserId(@Param("userId") String var1, @Param("projectSource") String var2);
List<User> selectByUserNumber(@Param("userNumber") String var1, @Param("projectSource") String var2);
List<User> selectAll(@Param("userId") String var1, @Param("projectSource") String var2);
int insertSelective(User var1);
User selectByPrimaryKey(String var1);
int recovery(List var1);
}

@ -0,0 +1,15 @@
package com.keyware.htey.mybatis.itf;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keyware.htey.entity.usersecret.Usersecret;
import org.apache.ibatis.annotations.Mapper;
/**
* @author yangmengchuan
* @date 2025/1/7
* @description 用户与数据库交互
*/
@Mapper
public interface UsersecretMapper extends BaseMapper<Usersecret> {
int insertSelective(Usersecret var1);
}

@ -0,0 +1,20 @@
package com.keyware.htey.mybatis.itf.number;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.keyware.htey.entity.number.NumberBuilder;
import org.apache.ibatis.annotations.Mapper;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.mybatis.itf.number
* @date 2025/1/14 9:32
*/
@Mapper
public interface NumberBuilderMapper extends BaseMapper<NumberBuilder> {
NumberBuilder selectByPrimaryKey(String var1);
int insertSelective(NumberBuilder var1);
int updateByPrimaryKeySelective(NumberBuilder var1);
}

@ -0,0 +1,41 @@
package com.keyware.htey.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keyware.htey.entity.user.AuditLog;
import com.keyware.htey.mybatis.itf.AuditLogMapper;
import com.keyware.htey.service.itf.AuditLogService;
import com.keyware.htey.utli.Constant;
import com.keyware.htey.utli.DateUtils;
import com.keyware.htey.utli.IdGenerator;
import com.keyware.htey.utli.IpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog> implements AuditLogService {
@Autowired
private AuditLogMapper auditLogMapper;
public boolean insertLog(AuditLog auditLog) {
//todo 登录人信息
//String userName = (String)session.getAttribute("userName");
//String departName = (String)session.getAttribute("departName");
//String userId = (String)session.getAttribute("userId");
auditLog.setId(IdGenerator.uuid32());
auditLog.setOperTime(DateUtils.getDateTime());
auditLog.setIpAddress(IpUtil.getLocalIP());
//auditLog.setUserName(userName);
//auditLog.setDeptName(departName);
//auditLog.setUserId(userId);
return this.save(auditLog);
}
@Override
public boolean addAuditLog(AuditLog auditLog) {
auditLog.setProjectSource(Constant.projectName);
return insertLog(auditLog);
}
}

@ -0,0 +1,29 @@
package com.keyware.htey.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keyware.htey.entity.department.Department;
import com.keyware.htey.mybatis.itf.DepartmentMapper;
import com.keyware.htey.service.itf.DepartmentService;
import com.keyware.htey.utli.Constant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
@Autowired
private DepartmentMapper departmentMapper;
@Override
public List<Department> selectByDeparmentName(String deptName) {
return this.departmentMapper.selectByDeparmentName(deptName, Constant.projectName);
}
@Override
public Department selectByPrimaryKey(String id) {
return this.departmentMapper.selectByPrimaryKey(id);
}
}

@ -0,0 +1,69 @@
package com.keyware.htey.service.impl;
import com.keyware.htey.entity.number.NumberBuilder;
import com.keyware.htey.mybatis.itf.number.NumberBuilderMapper;
import com.keyware.htey.service.itf.number.NumberBuilderService;
import com.keyware.htey.utli.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.service.impl
* @date 2025/1/14 9:24
*/
@Service
public class NumberBuilderServiceImpl implements NumberBuilderService {
@Autowired
private NumberBuilderMapper numberBuilderMapper;
@Override
public String getUserNumber() {
Integer userNumber = this.getNumber("user_code");
NumberBuilder selectByPrimaryKey = this.numberBuilderMapper.selectByPrimaryKey("userCodePre");
if (userNumber == 1) {
return selectByPrimaryKey != null ? selectByPrimaryKey.getNumber() + "0001" : Constant.RULE_NUMBER + "0001";
} else {
return selectByPrimaryKey != null ? selectByPrimaryKey.getNumber() + this.getStringNumber(userNumber)
: Constant.RULE_NUMBER + this.getStringNumber(userNumber);
}
}
public Integer getNumber(String codeType) {
NumberBuilder numberBuilder = this.numberBuilderMapper.selectByPrimaryKey(codeType);
if (numberBuilder == null) {
return "seq_code".equals(codeType) ? 2 : 1;
} else {
return Integer.valueOf(numberBuilder.getNumber()) + 1;
}
}
private String getStringNumber(Integer number) {
String strNumber;
for (strNumber = number.toString(); strNumber.length() < 4; strNumber = "0" + strNumber) {
}
return strNumber;
}
public Integer updateNumber(String codeType) {
NumberBuilder numberBuilder = this.numberBuilderMapper.selectByPrimaryKey(codeType);
if (numberBuilder == null) {
NumberBuilder numberBuilder2 = new NumberBuilder();
if ("seq_code".equals(codeType)) {
numberBuilder2.setNumber("2");
} else {
numberBuilder2.setNumber("1");
}
numberBuilder2.setNumberId(codeType);
this.numberBuilderMapper.insertSelective(numberBuilder2);
return "seq_code".equals(codeType) ? 2 : 1;
} else {
Integer codeValue = Integer.valueOf(numberBuilder.getNumber()) + 1;
numberBuilder.setNumber(codeValue.toString());
this.numberBuilderMapper.updateByPrimaryKeySelective(numberBuilder);
return Integer.valueOf(numberBuilder.getNumber());
}
}
}

@ -0,0 +1,17 @@
package com.keyware.htey.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keyware.htey.entity.organizeassets.OFourColum;
import com.keyware.htey.mybatis.itf.OFourColumMapper;
import com.keyware.htey.service.itf.OFourColumService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("newOFourColumService")
@Slf4j
public class OFourColumServiceImpl extends ServiceImpl<OFourColumMapper, OFourColum> implements OFourColumService {
@Autowired
private OFourColumMapper oFourColumMapper;
}

@ -1,15 +1,74 @@
package com.keyware.htey.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keyware.htey.entity.user.User;
import com.keyware.htey.mybatis.itf.UserMapper;
import com.keyware.htey.service.itf.UserService;
import com.keyware.htey.utli.Constant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("userService")
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Autowired
private UserMapper userMapper;
private static String projectName = "kdtr";
@Override
public List<User> selectByUserInfo17suo(User user) {
user.setProjectSource(projectName);
user.setUserStatus(1L);
return userMapper.selectByUserInfo17suo(user);
}
@Override
public int updateByPrimaryKey(User user) {
return this.userMapper.updateByPrimaryKey(user);
}
@Override
public int unlock(List<?> record) {
return this.userMapper.unlock(record);
}
@Override
public int updateStatus(User user) {
return this.userMapper.updateStatus(user);
}
@Override
public List<User> selectByUserNumber(String userNumber) {
return this.userMapper.selectByUserNumber(userNumber, Constant.projectName);
}
@Override
public int insert(User record) {
record.setProjectSource(Constant.projectName);
return this.userMapper.insert(record);
}
@Override
public List<User> selectAll(String userId) {
return this.userMapper.selectAll(userId, Constant.projectName);
}
@Override
public int insertSelective(User record) {
record.setProjectSource(Constant.projectName);
return this.userMapper.insertSelective(record);
}
@Override
public User selectByPrimaryKey(String id) {
return this.userMapper.selectByPrimaryKey(id);
}
@Override
public int recovery(List record) {
return this.userMapper.recovery(record);
}
}

@ -0,0 +1,21 @@
package com.keyware.htey.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keyware.htey.entity.usersecret.Usersecret;
import com.keyware.htey.mybatis.itf.UsersecretMapper;
import com.keyware.htey.service.itf.UsersecretService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class UsersecretServiceImpl extends ServiceImpl<UsersecretMapper, Usersecret> implements UsersecretService {
@Autowired
private UsersecretMapper usersecretMapper;
@Override
public int insertSelective(Usersecret userSecret) {
return this.usersecretMapper.insertSelective(userSecret);
}
}

@ -0,0 +1,8 @@
package com.keyware.htey.service.itf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.keyware.htey.entity.user.AuditLog;
public interface AuditLogService extends IService<AuditLog> {
public boolean addAuditLog(AuditLog auditLog);
}

@ -0,0 +1,12 @@
package com.keyware.htey.service.itf;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.keyware.htey.entity.department.Department;
public interface DepartmentService extends IService<Department> {
List<Department> selectByDeparmentName(String var1);
Department selectByPrimaryKey(String var1);
}

@ -0,0 +1,8 @@
package com.keyware.htey.service.itf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.keyware.htey.entity.organizeassets.OFourColum;
public interface OFourColumService extends IService<OFourColum> {
}

@ -1,7 +1,29 @@
package com.keyware.htey.service.itf;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.keyware.htey.entity.user.User;
public interface UserService extends IService<User> {
List<User> selectByUserInfo17suo(User user);
int updateByPrimaryKey(User user);
int unlock(List<?> list);
int updateStatus(User var1);
List<User> selectByUserNumber(String var1);
int insert(User var1);
List<User> selectAll(String var1);
int insertSelective(User var1);
User selectByPrimaryKey(String var1);
int recovery(List var1);
}

@ -0,0 +1,8 @@
package com.keyware.htey.service.itf;
import com.baomidou.mybatisplus.extension.service.IService;
import com.keyware.htey.entity.usersecret.Usersecret;
public interface UsersecretService extends IService<Usersecret> {
int insertSelective(Usersecret var1);
}

@ -0,0 +1,13 @@
package com.keyware.htey.service.itf.number;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.service.itf.number
* @date 2025/1/14 9:23
*/
public interface NumberBuilderService {
String getUserNumber();
Integer updateNumber(String var1);
}

@ -0,0 +1,17 @@
package com.keyware.htey.utli;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AjaxMessage {
private static final long serialVersionUID = 1680802699076731536L;
private String code;
private String message;
private String data;
private String token;
}

@ -0,0 +1,14 @@
package com.keyware.htey.utli;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/13 14:54
*/
public class Constant {
public static String projectName = "kdtr";
public static String RULE_NUMBER = "kw";
public static Integer userCount = 0;
public static String ERROE_MESSAGE = "系统错误,请联系管理员";
}

@ -0,0 +1,545 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.keyware.htey.utli;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
@Slf4j
public class DateUtils extends org.apache.commons.lang.time.DateUtils {
private static GregorianCalendar gc;
private static String[] parsePatterns;
public static String DEFAULT_DATE_FORMAT;
public DateUtils() {
}
public static String getDate() {
return getDate("yyyy-MM-dd");
}
public static String getDate(String pattern) {
return DateFormatUtils.format(new Date(), pattern);
}
public static String formatDate(Date date, Object[] pattern) {
String formatDate = null;
if (pattern != null && pattern.length > 0) {
formatDate = DateFormatUtils.format(date, pattern[0].toString());
} else {
formatDate = DateFormatUtils.format(date, "yyyy-MM-dd");
}
return formatDate;
}
public static String formatDateTime(Date date) {
return formatDate(date, new Object[] {"yyyy-MM-dd HH:mm:ss"});
}
public static String getTime() {
return formatDate(new Date(), new Object[] {"HH:mm:ss"});
}
public static String getDateTime() {
return formatDate(new Date(), new Object[] {"yyyy-MM-dd HH:mm:ss"});
}
public static String getYear() {
return formatDate(new Date(), new Object[] {"yyyy"});
}
public static String getMonth() {
return formatDate(new Date(), new Object[] {"MM"});
}
public static String getDay() {
return formatDate(new Date(), new Object[] {"dd"});
}
public static String getWeek() {
return formatDate(new Date(), new Object[] {"E"});
}
public static Date parseDate(Object str) {
if (str == null) {
return null;
} else {
try {
return parseDate(str.toString(), parsePatterns);
} catch (Exception var2) {
log.error("日期转换失败", var2);
return null;
}
}
}
public static long pastDays(Date date) {
long t = (new Date()).getTime() - date.getTime();
return t / 86400000L;
}
public static Date getDateStart(Date date) {
if (date == null) {
return null;
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
date = sdf.parse(formatDate(date, new Object[] {"yyyy-MM-dd"}) + " 00:00:00");
} catch (ParseException var3) {
log.error("获取日期失败", var3);
var3.printStackTrace();
}
return date;
}
}
public static Date getDateEnd(Date date) {
if (date == null) {
return null;
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
date = sdf.parse(formatDate(date, new Object[] {"yyyy-MM-dd"}) + " 23:59:59");
} catch (ParseException var3) {
log.error("获取日期失败", var3);
var3.printStackTrace();
}
return date;
}
}
public static Date getCurrentDate() {
Date date = new Date(System.currentTimeMillis());
return date;
}
public static int getCurrentTime(TimeFormatType timeFormatType) {
return getTime(getCurrentDate(), timeFormatType);
}
public static int getTime(Date date, TimeFormatType timeFormatType) {
try {
Calendar c = Calendar.getInstance();
c.setTime(date);
int type = timeFormatType.getValue();
int i = c.get(type);
return type == 2 ? i + 1 : i;
} catch (Exception var5) {
log.error("获取日期失败", var5);
throw new RuntimeException("获取失败", var5);
}
}
public static long getMillis(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.getTimeInMillis();
}
public static int operationDate(Date date, Date diffDate, DateOperationType dateOperationType) {
long add = getMillis(date) + getMillis(diffDate);
long diff = getMillis(date) - getMillis(diffDate);
return (int)((dateOperationType.getValue() ? add : diff) / 86400000L);
}
public static Date operationDateOfMonth(Date date, int month, DateOperationType dateOperationType) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(2, dateOperationType.getValue() ? month : month - month * 2);
return c.getTime();
}
public static Date operationDateOfDay(Date date, int day, DateOperationType dateOperationType) {
Calendar c = Calendar.getInstance();
c.setTime(date);
long millis = c.getTimeInMillis();
long millisOfday = (long)(day * 24 * 3600 * 1000);
long sumMillis = dateOperationType.getValue() ? millis + millisOfday : millis - millisOfday;
c.setTimeInMillis(sumMillis);
return c.getTime();
}
private static Object OpearationDate(Object object, String formatStr) {
if (object != null && null != formatStr && !"".equals(formatStr)) {
SimpleDateFormat format = new SimpleDateFormat(formatStr);
try {
return object instanceof Date ? format.format(object) : format.parse(object.toString());
} catch (Exception var4) {
log.error("操作失败", var4);
throw new RuntimeException("操作失败", var4);
}
} else {
throw new RuntimeException("参数不能为空");
}
}
public static Date getLastWorkDay(Date curDate, int n) {
Date endDate = curDate;
for (int i = 0; i < n; ++i) {
endDate = new Date(endDate.getTime() - 86400000L);
int day_of_week = getDayOfWeek(endDate);
if (day_of_week == 1) {
endDate = new Date(endDate.getTime() - 172800000L);
} else if (day_of_week == 7) {
endDate = new Date(endDate.getTime() - 86400000L);
}
}
return endDate;
}
public static Integer getDayOfWeek(Date date) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
return cal.get(7);
}
private static void initCalendar(Date date) {
if (date == null) {
throw new IllegalArgumentException("argument date must be not null");
} else {
gc.clear();
gc.setTime(date);
}
}
public static Date getAfterDate(Date date, int days) {
initCalendar(date);
gc.set(6, gc.get(6) + days);
return gc.getTime();
}
public static boolean before(String first, String second) {
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd");
Date a = null;
Date b = null;
try {
a = dfs.parse(first);
b = dfs.parse(second);
} catch (ParseException var6) {
log.error("操作失败", var6);
var6.printStackTrace();
}
return a.before(b);
}
public static final String getDateStr(Date aDate) {
SimpleDateFormat df = null;
String returnValue = "";
if (aDate != null) {
df = new SimpleDateFormat(parsePatterns[0]);
returnValue = df.format(aDate);
}
return returnValue;
}
public static final String getTimeStr(Date aDate) {
SimpleDateFormat df = null;
String returnValue = "";
if (aDate != null) {
df = new SimpleDateFormat(parsePatterns[1]);
returnValue = df.format(aDate);
}
return returnValue;
}
public static Date convertStringToDate(String strDate) {
Date aDate = null;
try {
String pattern = "\\d{4}[-|/]\\d{2}[-|/]\\d{2}[ ]\\d{2}[:]\\d{2}[:]\\d{2}";
if (strDate.matches(pattern)) {
if (strDate.contains("/")) {
aDate = convertStringToDate("yyyy/MM/dd HH:mm:ss", strDate);
} else {
aDate = convertStringToDate(parsePatterns[1], strDate);
}
} else if (strDate.contains("/")) {
aDate = convertStringToDate("yyyy/MM/dd", strDate);
} else {
aDate = convertStringToDate(parsePatterns[0], strDate);
}
} catch (ParseException var3) {
log.error("操作失败", var3);
log.error("Could not convert '" + strDate + "' to a date, throwing exception");
var3.printStackTrace();
}
return aDate;
}
public static final Date convertStringToDate(String aMask, String strDate) throws ParseException {
SimpleDateFormat df = null;
Date date = null;
df = new SimpleDateFormat(aMask);
try {
date = df.parse(strDate);
return date;
} catch (ParseException var5) {
log.error("日期转换失败", var5);
throw new ParseException(var5.getMessage(), var5.getErrorOffset());
}
}
public static final String getTimeStr(String format, Date aDate) {
SimpleDateFormat df = null;
String returnValue = "";
if (aDate != null) {
df = new SimpleDateFormat(format);
returnValue = df.format(aDate);
}
return returnValue;
}
public static String beforNumDay(Date date, int day) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(6, day);
return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(c.getTime());
}
public static String strToDate(String strDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(new Date(Long.parseLong(strDate)));
}
public static String formatTime(Date date, String formats) {
if (StringUtils.isEmpty(formats)) {
formats = "yyyy-MM-dd HH:mm:ss";
}
String time = "";
DateFormat format = new SimpleDateFormat(formats);
if (date != null) {
time = format.format(date);
return time;
} else {
throw new RuntimeException("Empty date!");
}
}
public static long betweenDays(String startDate, String endDate) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date enddate = simpleDateFormat.parse(endDate);
Date startdate = simpleDateFormat.parse(startDate);
Calendar cal = Calendar.getInstance();
cal.setTime(enddate);
long endTime = cal.getTimeInMillis();
cal.setTime(startdate);
long startTime = cal.getTimeInMillis();
long between_days = (endTime - startTime) / 86400000L;
return between_days;
}
public static long betweenSecond(String startDate, String endDate) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date enddate = simpleDateFormat.parse(endDate);
Date startdate = simpleDateFormat.parse(startDate);
Calendar cal = Calendar.getInstance();
cal.setTime(enddate);
long endTime = cal.getTimeInMillis();
cal.setTime(startdate);
long startTime = cal.getTimeInMillis();
long between_second = (endTime - startTime) / 1000L;
return between_second;
}
public static String getDateTimeInt() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateTime = simpleDateFormat.format(new Date()).trim();
return dateTime;
}
public static String[] getTimeInterval(Date date) {
String[] date1 = new String[2];
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int dayWeek = cal.get(7);
if (1 == dayWeek) {
cal.add(5, -1);
}
System.out.println("要计算日期为:" + sdf.format(cal.getTime()));
cal.setFirstDayOfWeek(2);
int day = cal.get(7);
cal.add(5, cal.getFirstDayOfWeek() - day);
String imptimeBegin = sdf.format(cal.getTime());
System.out.println("所在周星期一的日期:" + imptimeBegin);
cal.add(5, 6);
String imptimeEnd = sdf.format(cal.getTime());
System.out.println("所在周星期日的日期:" + imptimeEnd);
date1[0] = imptimeBegin;
date1[1] = imptimeEnd;
return date1;
}
private static String[] showResult(String[] dateArray) {
Map<String, Integer> dateMap = new TreeMap();
int arrayLen = dateArray.length;
for (int i = 0; i < arrayLen; ++i) {
String dateKey = dateArray[i];
if (dateMap.containsKey(dateKey)) {
int value = (Integer)dateMap.get(dateKey) + 1;
dateMap.put(dateKey, value);
} else {
dateMap.put(dateKey, 1);
}
}
Set<String> keySet = dateMap.keySet();
String[] sorttedArray = new String[keySet.size()];
Iterator<String> iter = keySet.iterator();
String key;
for (int index = 0; iter.hasNext(); sorttedArray[index++] = key) {
key = (String)iter.next();
}
int sorttedArrayLen = sorttedArray.length;
System.out.println("最小日期是:" + sorttedArray[0] + ", 天数为" + dateMap.get(sorttedArray[0]));
System.out.println("最大日期是:" + sorttedArray[sorttedArrayLen - 1] + ", 天数为" + dateMap.get(
sorttedArray[sorttedArrayLen - 1]));
return new String[] {sorttedArray[0], sorttedArray[sorttedArrayLen - 1]};
}
public static int countTwoDayWeek(Date startDate, Date endDate) {
String[] startWeek = getTimeInterval(startDate);
String[] endWeek = getTimeInterval(endDate);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
try {
cal.setTime(dateFormat.parse(startWeek[0]));
long time1 = cal.getTimeInMillis();
cal.setTime(dateFormat.parse(endWeek[1]));
long time2 = cal.getTimeInMillis();
long between_days = (time2 - time1) / 86400000L;
Double days = Double.parseDouble(String.valueOf(between_days));
if (days / 7.0 > 0.0 && days / 7.0 <= 1.0) {
return 1;
} else if (days / 7.0 > 1.0) {
int day = days.intValue();
return day % 7 > 0 ? day / 7 + 1 : day / 7;
} else {
return days / 7.0 == 0.0 ? 0 : 0;
}
} catch (Exception var14) {
log.error("日期计算失败", var14);
var14.printStackTrace();
return 0;
}
}
public static long calculateTimeDifferenceByCalendar(String startDate, String endDate) {
if (startDate != null && endDate != null) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date d1 = df.parse(startDate);
Date d2 = df.parse(endDate);
long diff = d2.getTime() - d1.getTime();
long min = diff / 60000L;
return min;
} catch (Exception var9) {
log.error("计算两个日期相差多少分钟时出错!", var9);
var9.printStackTrace();
return 0L;
}
} else {
return 0L;
}
}
static {
gc = new GregorianCalendar(Locale.CHINA);
DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
gc.setLenient(true);
gc.setFirstDayOfWeek(2);
parsePatterns = new String[] {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy/MM/dd",
"yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm"};
}
public static enum DateOperationType {
ADD(true),
DIFF(false);
private final boolean value;
private DateOperationType(boolean operation) {
this.value = operation;
}
public boolean getValue() {
return this.value;
}
}
public static enum TimeFormatType {
YEAR(1),
MONTH(2),
DAY(5),
HOUR(11),
MINUTE(12),
SECOND(13);
private final int value;
private TimeFormatType(int formatStr) {
this.value = formatStr;
}
public int getValue() {
return this.value;
}
}
public static enum DateFormatType {
DATE_FORMAT_STR("yyyy-MM-dd HH:mm:ss"),
SIMPLE_DATE_TIME_FORMAT_STR("yyyyMMddHHmmss"),
SIMPLE_DATE_FORMAT_STR("yyyy-MM-dd"),
SIMPLE_DATE_FORMAT_VIRGULE_STR("yyyy/MM/dd"),
HOUR_MINUTE_SECOND("HH:mm:ss"),
HOUR_MINUTE("HH:mm");
private final String value;
private DateFormatType(String formatStr) {
this.value = formatStr;
}
public String getValue() {
return this.value;
}
}
}

@ -0,0 +1,68 @@
package com.keyware.htey.utli;
import java.security.MessageDigest;
import lombok.extern.slf4j.Slf4j;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/13 16:46
*/
@Slf4j
public class EncryptUtil {
public EncryptUtil() {
}
public static String md5AndSha(String inputText) {
return sha(md5(inputText));
}
public static String md5(String inputText) {
return encrypt(inputText, "md5");
}
public static String sha(String inputText) {
return encrypt(inputText, "sha-1");
}
private static String encrypt(String inputText, String algorithmName) {
if (inputText != null && !"".equals(inputText.trim())) {
if (algorithmName == null || "".equals(algorithmName.trim())) {
algorithmName = "md5";
}
String encryptText = null;
try {
MessageDigest m = MessageDigest.getInstance(algorithmName);
m.update(inputText.getBytes("UTF8"));
byte[] s = m.digest();
return hex(s);
} catch (Exception var6) {
log.error("操作失败", var6);
var6.printStackTrace();
}
return encryptText;
} else {
throw new IllegalArgumentException("请输入要加密的内容");
}
}
private static String hex(byte[] arr) {
StringBuffer sb = new StringBuffer();
for (byte b : arr) {
sb.append(Integer.toHexString(b & 255 | 256).substring(1, 3));
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println(md5("123456"));
}
}

@ -0,0 +1,360 @@
package com.keyware.htey.utli;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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.mybatis.itf.UserMapper;
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.number.NumberBuilderService;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/14 8:51
*/
public class ExcelUtils {
@Autowired
private UserMapper userMapper;
@Autowired
private UserService userService;
@Autowired
private DepartmentService departmentService;
@Autowired
private NumberBuilderService numberBuilderService;
@Autowired
private AuditLogService auditLogService;
public static void checkFirstRowName(AjaxMessage ajaxMessage, Sheet sheet) {
Row row = sheet.getRow(0);
List<String> columnName = new ArrayList();
columnName.add("用户账号*");
//if ("huayin".equals(customer)) {
// columnName.add("用户编号*");
//} else {
columnName.add("员工编号*");
//}
columnName.add("姓名*");
//if ("huayin".equals(customer)) {
// columnName.add("证件");
//} else {
columnName.add("身份证号码");
//}
columnName.add("所属部门");
columnName.add("电子邮件");
columnName.add("性别");
columnName.add("手机");
columnName.add("办公电话");
columnName.add("家庭电话");
columnName.add("职务");
if (null == row) {
ajaxMessage.setCode("0");
ajaxMessage.setMessage("上传文档与批量导入平台用户的标准模板不一致,请下载excel模板进行编辑。");
} else {
for (int i = 0; i < columnName.size(); ++i) {
Cell cell = row.getCell(i);
String cellValue = getCellValue(cell);
cellValue = cellValue.replaceAll(" ", "");
if (!((String)columnName.get(i)).equals(cellValue)) {
ajaxMessage.setCode("0");
ajaxMessage.setMessage("上传文档与批量导入平台用户的标准模板不一致,请下载excel模板进行编辑。");
break;
}
}
}
}
private static String getCellValue(org.apache.poi.ss.usermodel.Cell cell) {
String cellValue = "";
if (cell == null) {
return cellValue;
} else {
try {
switch (cell.getCellType()) {
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
cellValue = DateUtils.formatDateTime(cell.getDateCellValue());
} else {
cell.setCellType(CellType.NUMERIC);
cellValue = String.valueOf(cell.getNumericCellValue());
}
break;
case STRING:
cellValue = cell.getStringCellValue();
break;
case FORMULA:
cell.setCellType(CellType.FORMULA);
cellValue = String.valueOf(cell.getCellFormula());
break;
case BLANK:
cellValue = "";
break;
case BOOLEAN:
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case ERROR:
cellValue = "错误";
break;
default:
cellValue = "";
}
} catch (Exception e) {
e.printStackTrace();
}
return cellValue;
}
}
public String insertUser(AuditLog auditLog, Sheet sheet) {
int inserted = 0;
int skip = 0;
String userNames = "";
int rowNum = sheet.getPhysicalNumberOfRows();
List<String> userList = new ArrayList();
List<String> userList3 = new ArrayList();
List<String> userList4 = new ArrayList();
List<String> userList5 = new ArrayList();
int i;
Row row;
String userId;
String userNumber;
for (i = 1; i < rowNum; ++i) {
row = sheet.getRow(i);
if (null == row) {
return "导入失败:请在中间空白行输入必填项";
}
userId = this.getCellValue(row.getCell(0));
userNumber = this.getCellValue(row.getCell(1));
userList.add(userId);
userList4.add(userNumber);
}
int j;
for (i = 0; i < userList.size() - 1; ++i) {
for (j = userList.size() - 1; j > i; --j) {
if (((String)userList.get(j)).equals(userList.get(i))) {
userList3.add(userList.get(j));
}
}
}
for (i = 0; i < userList4.size() - 1; ++i) {
for (j = userList4.size() - 1; j > i; --j) {
if (((String)userList4.get(j)).equals(userList4.get(i))) {
userList5.add(userList4.get(j));
}
}
}
String userName;
String idCard;
String email;
String mobilePhone;
String officeTelephone;
String homePhone;
String regEx;
for (i = 1; i < rowNum; ++i) {
row = sheet.getRow(i);
userId = this.getCellValue(row.getCell(0));
userNumber = this.getCellValue(row.getCell(1));
userName = this.getCellValue(row.getCell(2));
int var29;
if ("".equals(userId) && "".equals(userName) && "".equals(userNumber)) {
var29 = skip + 1;
return "导入失败:必填项不能为空";
}
if (!StringUtils.hasText(userId)) {
var29 = skip + 1;
return "导入失败:登录账号不能为空";
}
if ("".equals(userNumber)) {
var29 = skip + 1;
return "导入失败:员工编号不能为空";
}
if ("".equals(userName)) {
var29 = skip + 1;
return "导入失败:姓名不能为空";
}
idCard = this.getCellValue(row.getCell(3));
email = this.getCellValue(row.getCell(5));
mobilePhone = this.getCellValue(row.getCell(7));
officeTelephone = this.getCellValue(row.getCell(8));
homePhone = this.getCellValue(row.getCell(9));
String post = this.getCellValue(row.getCell(10));
if (userId.length() > 25 || userNumber.length() > 20 || userName.length() > 25 || email.length() > 100
|| officeTelephone.length() > 50 || homePhone.length() > 50 || post.length() > 50) {
var29 = skip + 1;
return "导入失败:输入信息长度入有误";
}
if (StringUtils.hasText(officeTelephone) && officeTelephone.length() < 2) {
var29 = skip + 1;
return "导入失败:办公电话输入长度有误";
}
if (StringUtils.hasText(homePhone) && homePhone.length() < 2) {
var29 = skip + 1;
return "导入失败:家庭电话输入长度有误";
}
Pattern pattern;
Matcher matcher;
boolean rs;
if (StringUtils.hasText(userId)) {
regEx = "[0-9a-zA-Z\\_\\-\\(\\)]+";
pattern = Pattern.compile(regEx);
matcher = pattern.matcher(userId);
rs = matcher.matches();
if (!rs) {
var29 = skip + 1;
return "导入失败:账号" + userId + "输入有误";
}
}
User user = new User();
user.setUserId(userId);
List<User> selectByUserId = userMapper.selectByUserId(userId, Constant.projectName);
if (selectByUserId != null && selectByUserId.size() > 0) {
var29 = skip + 1;
return "导入失败:登录账号" + userId + "不能重复添加";
}
if (userList3.contains(userId)) {
var29 = skip + 1;
return "导入失败:登录账号" + userId + "不能重复添加";
}
if (userList5.contains(userNumber)) {
var29 = skip + 1;
return "导入失败:员工编号" + userNumber + "不能重复添加";
}
if (StringUtils.hasText(userNumber)) {
user.setUserId((String)null);
user.setUserNumber(userNumber);
List<User> users = userService.selectByUserNumber(userNumber);
if (users != null && users.size() > 0) {
var29 = skip + 1;
return "导入失败:用户编号" + userNumber + "不能重复添加";
}
}
}
for (i = 1; i < rowNum; ++i) {
row = sheet.getRow(i);
userId = this.getCellValue(row.getCell(0));
userNumber = this.getCellValue(row.getCell(1));
userName = this.getCellValue(row.getCell(2));
idCard = this.getCellValue(row.getCell(3));
email = this.getCellValue(row.getCell(4));
mobilePhone = null;
officeTelephone = this.getCellValue(row.getCell(5));
homePhone = this.getCellValue(row.getCell(6));
Long sexLong = null;
regEx = this.getCellValue(row.getCell(7));
officeTelephone = this.getCellValue(row.getCell(8));
homePhone = this.getCellValue(row.getCell(9));
String post = this.getCellValue(row.getCell(10));
if (!"男".equals(homePhone) && !"女".equals(homePhone)) {
sexLong = null;
}
if ("男".equals(homePhone)) {
sexLong = 0L;
}
if ("女".equals(homePhone)) {
sexLong = 1L;
}
User user = new User();
user.setUserId(userId);
List<Department> selectByDeparmentName = this.departmentService.selectByDeparmentName(email);
if (selectByDeparmentName != null && selectByDeparmentName.size() > 0) {
mobilePhone = ((Department)selectByDeparmentName.get(0)).getId();
}
if (!StringUtils.hasText(userNumber)) {
userNumber = this.numberBuilderService.getUserNumber();
this.numberBuilderService.updateNumber("user_code");
}
user.setId(IdGenerator.uuid32());
user.setUserId(userId);
user.setUserName(userName);
user.setPassword(EncryptUtil.md5("11AAaa"));
user.setDepartId(mobilePhone);
user.setUserCreationTime(DateUtils.getDate());
user.setUserPwdModifTime(DateUtils.getDate("yyyy-MM-dd HH:mm"));
user.setUserStatus(0L);
user.setUserLock(0L);
user.setUserPwdError(0L);
user.setUserPwdErrorDate(DateUtils.getDate());
user.setPost(post);
user.setEmail(officeTelephone);
user.setOfficeTelephone(officeTelephone);
user.setUserNumber(userNumber);
user.setIdCard(idCard);
user.setMobilePhone(regEx);
user.setSex(sexLong);
user.setHomePhone(homePhone);
user.setLogout(0L);
userNames = userNames + userName + ",";
user.setSort(String.valueOf(Long.parseLong(DateUtils.getDateTimeInt()) + (long)i));
user.setIsSys("0");
userService.insert(user);
++inserted;
}
if (!"".equals(userNames) && null != userNames) {
//todo 登录人的用户名 userName
// String comments = sUserName + "新增了用户" + userNames.substring(0, userNames.length() - 1);
String comments = "新增了用户" + userNames.substring(0, userNames.length() - 1);
String logName = "批量添加人员";
String logNameType = "用户列表";
auditLog.setLogName(logName);
auditLog.setLogNameType(logNameType);
auditLog.setComments(comments);
auditLogService.addAuditLog(auditLog);
//todo 添加MESSAGE_TABLE表
//String numCode = (String)request.getSession().getAttribute("customCode");
//if (numCode != null && numCode.equals("tianjin712suo")) {
// User safeUser = userService.selectUserByUserId("safesecret");
// /**
// * @Description:新增发送人ID及消息简短描述
// * Modify Name:WangChenyu
// * Modify DateTime:2022年10月25日
// */
// String loginUserId = (String)request.getSession().getAttribute("user_id");
// this.messageService.insertMessage("批量用户添加", "批量添加" + inserted + "个用户", "用户管理", null,
// loginUserId, safeUser.getId(), "", "0", "K");
//}
}
return "操作成功,添加" + inserted + "条数据," + skip + "条数据未添加成功";
}
}

@ -0,0 +1,26 @@
package com.keyware.htey.utli;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import com.keyware.htey.entity.user.User;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/13 17:15
*/
public class IdComposeListUtil {
public static List<String> listId(List<User> userList) {
String userIds = stringId(userList);
return Arrays.asList(userIds.split(","));
}
public static String stringId(List<User> userList) {
return userList.stream()
.map(User::getId)
.map(String::valueOf) // 将ID转换为字符串
.collect(Collectors.joining(", ")); // 使用逗号分隔
}
}

@ -0,0 +1,63 @@
package com.keyware.htey.utli;
import java.security.SecureRandom;
import java.util.UUID;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/13 14:56
*/
public class IdGenerator {
private static SecureRandom random = new SecureRandom();
private static String[] BASE_CHARACTER = new String[] {"2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D",
"E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
public IdGenerator() {
}
public static String uuid32() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
public static String uuid36() {
return UUID.randomUUID().toString();
}
public static long randomLong() {
return Math.abs(random.nextLong());
}
public static String random12Str() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 12; ++i) {
sb.append(BASE_CHARACTER[(int)(32.0 * Math.random())]);
}
return sb.toString();
}
public static String random10Str() {
char[] ss = new char[10];
for (int i = 0; i < 10; ++i) {
int f = (int)(Math.random() * 3.0);
if (f == 0) {
ss[i] = (char)((int)(65.0 + Math.random() * 26.0));
} else if (f == 1) {
ss[i] = (char)((int)(97.0 + Math.random() * 26.0));
} else {
ss[i] = (char)((int)(48.0 + Math.random() * 10.0));
}
}
String is = new String(ss);
return is;
}
public static void main(String[] args) {
System.out.println(uuid32() + "11");
}
}

@ -0,0 +1,25 @@
package com.keyware.htey.utli;
import java.net.InetAddress;
import lombok.extern.slf4j.Slf4j;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/13 13:56
*/
@Slf4j
public class IpUtil {
public static String getLocalIP() {
try {
InetAddress inetAddress = InetAddress.getLocalHost();
return inetAddress.getHostAddress();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}

@ -0,0 +1,135 @@
package com.keyware.htey.utli;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
/**
* @author daijj8
* @version V1.0
* @Package com.keyware.htey.utli
* @date 2025/1/13 15:29
*/
@Slf4j
public class JsonUtils {
public static final String EMPTY = "";
public static final String EMPTY_JSON = "{}";
public static final String EMPTY_JSON_ARRAY = "[]";
public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final Double SINCE_VERSION_10 = 1.0;
public static final Double SINCE_VERSION_11 = 1.1;
public static final Double SINCE_VERSION_12 = 1.2;
public JsonUtils() {
}
public static String arrayListToJsonString(List menusParent) {
JSONArray jsonArray = new JSONArray(menusParent);
return jsonArray.toJSONString();
}
public static String objectToJsonString(Object obj) {
return JSON.toJSON(obj).toString();
}
public static Object jsonStringToObject(String jsonString, Class clazz) {
return JSONObject.parseObject(jsonString, clazz);
}
public static List jsonStringToList(String jsonString, Class clazz) {
return JSON.parseArray(jsonString, clazz);
}
public static <T> String listToJson(List<T> list) {
Gson gson = (new GsonBuilder()).setDateFormat("yyyy-MM-dd HH:mm:ss").create();
return gson.toJson(list);
}
public static String toJson(Object target) {
return toJson(target, (Type)null, false, (Double)null, (String)null, false);
}
public static String toJson(Object target, Type targetType, boolean isSerializeNulls, Double version,
String datePattern, boolean excludesFieldsWithoutExpose) {
if (target == null) {
return "{}";
} else {
GsonBuilder builder = new GsonBuilder();
builder.disableHtmlEscaping();
if (isSerializeNulls) {
builder.serializeNulls();
}
if (version != null) {
builder.setVersion(version);
}
if (StringUtils.isEmpty(datePattern)) {
datePattern = "yyyy-MM-dd HH:mm:ss";
}
builder.setDateFormat(datePattern);
if (excludesFieldsWithoutExpose) {
builder.excludeFieldsWithoutExposeAnnotation();
}
String result = "";
Gson gson = builder.create();
try {
if (targetType != null) {
result = gson.toJson(target, targetType);
} else {
result = gson.toJson(target);
}
} catch (Exception var10) {
log.error("操作失败", var10);
if (!(target instanceof Collection) && !(target instanceof Iterator) && !(target instanceof Enumeration)
&& !target.getClass().isArray()) {
result = "{}";
} else {
result = "[]";
}
}
return result;
}
}
public static <T> T fromJson(String json, Class<T> clazz) {
return fromJson(json, clazz, (String)null);
}
public static <T> T fromJson(String json, Class<T> clazz, String datePattern) {
if (StringUtils.isEmpty(json)) {
return null;
} else {
GsonBuilder builder = new GsonBuilder();
if (StringUtils.isEmpty(datePattern)) {
datePattern = "yyyy-MM-dd HH:mm:ss";
}
builder.setDateFormat(datePattern);
Gson gson = builder.create();
try {
return gson.fromJson(json, clazz);
} catch (Exception var6) {
log.error("操作失败", var6);
return null;
}
}
}
}

@ -3,7 +3,7 @@ spring:
name: HTEY
datasource:
url: jdbc:oscar://172.16.36.140:2003/OSRDB
username: tykd
username: HTEY
password: 123456
driver-class-name: com.oscar.Driver
# url: jdbc:oracle:thin:@172.16.36.140:1521:orcl

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.keyware.htey.mybatis.itf.AuditLogMapper">
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.user.AuditLog">
<id column="ID" property="id" jdbcType="VARCHAR"/>
<result column="LOG_NAME" property="logName" jdbcType="VARCHAR"/>
<result column="LOG_NAME_TYPE" property="logNameType" jdbcType="VARCHAR"/>
<result column="USER_NAME" property="userName" jdbcType="VARCHAR"/>
<result column="DEPT_NAME" property="deptName" jdbcType="VARCHAR"/>
<result column="IP_ADDRESS" property="ipAddress" jdbcType="VARCHAR"/>
<result column="OPER_TIME" property="operTime" jdbcType="VARCHAR"/>
<result column="COMMENTS" property="comments" jdbcType="VARCHAR"/>
<result column="USER_ID" property="userId" jdbcType="VARCHAR"/>
<result column="PROJECT_SOURCE" property="projectSource" jdbcType="VARCHAR"/>
<result column="STATUS" property="status" jdbcType="VARCHAR"/>
</resultMap>
</mapper>

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.keyware.htey.mybatis.itf.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.department.Department">
<id column="ID" property="id" jdbcType="VARCHAR"/>
<result column="DEPT_NAME" property="deptName" jdbcType="VARCHAR"/>
<result column="PARENT_ID" property="parentId" jdbcType="VARCHAR"/>
<result column="ORDER_NO" property="orderNo" jdbcType="INTEGER"/>
<result column="COMMENTS" property="comments" jdbcType="VARCHAR"/>
<result column="DEPT_CREATE_TIME" property="deptCreateTime" jdbcType="VARCHAR"/>
<result column="DEPT_NUMBER" property="deptNumber" jdbcType="VARCHAR"/>
<result column="MANAGER" property="manager" jdbcType="VARCHAR"/>
<result column="TOTAL_WORKERS" property="totalWorkers" jdbcType="INTEGER"/>
<result column="SUPER_LEADER" property="superLeader" jdbcType="VARCHAR"/>
<result column="INTERFACE_PERSON" property="interfacePerson" jdbcType="VARCHAR"/>
<result column="DEPART_ABBREVIA" property="departAbbrevia" jdbcType="VARCHAR"/>
<result column="CHARGE" property="charge" jdbcType="VARCHAR"/>
<result column="IS_SYS" property="isSys" jdbcType="VARCHAR"/>
<result column="PROJECT_SOURCE" property="projectSource" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID
, DEPT_NAME, PARENT_ID, ORDER_NO, COMMENTS, DEPT_CREATE_TIME, DEPT_NUMBER, MANAGER,
TOTAL_WORKERS, SUPER_LEADER, INTERFACE_PERSON, DEPART_ABBREVIA, CHARGE, IS_SYS, PROJECT_SOURCE
</sql>
<select id="selectByDeparmentName" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from DEPARTMENT
where DEPT_NAME = #{deptName,jdbcType=VARCHAR}
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from DEPARTMENT
where ID = #{id,jdbcType=VARCHAR}
</select>
</mapper>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.keyware.htey.mybatis.itf.OFourColumMapper">
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.organizeassets.OFourColum">
<id column="ID" property="id" jdbcType="VARCHAR"/>
<result column="NAME" property="name" jdbcType="VARCHAR"/>
<result column="CODE" property="code" jdbcType="VARCHAR"/>
<result column="DESCRIBE" property="describe" jdbcType="VARCHAR"/>
<result column="PARENT_ID" property="parentId" jdbcType="VARCHAR"/>
<result column="SEQ" property="seq" jdbcType="INTEGER"/>
<result column="IS_DEFAULT" property="formLevel" jdbcType="VARCHAR"/>
<result column="FORM_LEVEL" property="isDefault" jdbcType="VARCHAR"/>
</resultMap>
</mapper>

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.keyware.htey.mybatis.itf.UserMapper">
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.user.User">
<id column="ID" property="id" jdbcType="VARCHAR"/>
<result column="USER_ID" property="userId" jdbcType="VARCHAR"/>
<result column="USER_NAME" property="userName" jdbcType="VARCHAR"/>
<result column="PASSWORD" property="password" jdbcType="VARCHAR"/>
<result column="DEPART_ID" property="departId" jdbcType="VARCHAR"/>
<result column="USER_CREATION_TIME" property="userCreationTime" jdbcType="VARCHAR"/>
<result column="USER_PWD_MODIF_TIME" property="userPwdModifTime" jdbcType="VARCHAR"/>
<result column="USER_STATUS" property="userStatus" jdbcType="DECIMAL"/>
<result column="USER_LOCK" property="userLock" jdbcType="DECIMAL"/>
<result column="USER_PWD_ERROR" property="userPwdError" jdbcType="DECIMAL"/>
<result column="USER_PWD_ERROR_DATE" property="userPwdErrorDate" jdbcType="VARCHAR"/>
<result column="EXIT_TIME" jdbcType="VARCHAR" property="exitTime"/>
<result column="PASSWORD_OLD" jdbcType="VARCHAR" property="passwordOld"/>
<result column="POST" property="post" jdbcType="VARCHAR"/>
<result column="EMAIL" property="email" jdbcType="VARCHAR"/>
<result column="OFFICE_TELEPHONE" property="officeTelephone" jdbcType="VARCHAR"/>
<result column="USER_NUMBER" property="userNumber" jdbcType="VARCHAR"/>
<result column="ID_CARD" property="idCard" jdbcType="VARCHAR"/>
<result column="MOBILE_PHONE" property="mobilePhone" jdbcType="VARCHAR"/>
<result column="SEX" property="sex" jdbcType="DECIMAL"/>
<result column="HOME_PHONE" property="homePhone" jdbcType="VARCHAR"/>
<result column="LOGOUT" property="logout" jdbcType="DECIMAL"/>
<result column="INIT_PWD_TIME" property="initPwdTime" jdbcType="VARCHAR"/>
<result column="SORT" property="sort" jdbcType="VARCHAR"/>
<result column="LOGOUT_TIME" property="logoutTime" jdbcType="VARCHAR"/>
<result column="DEPT_NAME" property="deptName" jdbcType="VARCHAR"/>
<result column="UESR_RANK_ID" property="uesrRankId" jdbcType="VARCHAR"/>
<result column="secret" property="secret" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID
, USER_ID, USER_NAME, PASSWORD, DEPART_ID, USER_CREATION_TIME, USER_PWD_MODIF_TIME,
USER_STATUS, USER_LOCK, USER_PWD_ERROR, USER_PWD_ERROR_DATE, EXIT_TIME, PASSWORD_OLD,
POST, EMAIL, OFFICE_TELEPHONE, USER_NUMBER, ID_CARD, MOBILE_PHONE, SEX, HOME_PHONE,
LOGOUT, INIT_PWD_TIME, SORT, IS_SYS, LOGOUT_TIME, PROJECT_SOURCE, UESR_RANK_ID,IMG_DATA
</sql>
<select id="selectByUserInfo17suo" resultType="com.keyware.htey.entity.user.User"
parameterType="com.keyware.htey.entity.user.User">
select
K_USER.ID,
K_USER.USER_ID,
K_USER.USER_NAME,
K_USER.PASSWORD,
K_USER.DEPART_ID,
K_USER.USER_CREATION_TIME,
K_USER.USER_PWD_MODIF_TIME,
K_USER.USER_STATUS,
K_USER.USER_LOCK,
K_USER.USER_PWD_ERROR,
K_USER.USER_PWD_ERROR_DATE,
K_USER.EXIT_TIME,
K_USER.PASSWORD_OLD,
K_USER.POST,
K_USER.EMAIL,
K_USER.OFFICE_TELEPHONE,
K_USER.USER_NUMBER,
K_USER.ID_CARD,
K_USER.MOBILE_PHONE,
K_USER.SEX,
K_USER.HOME_PHONE,
K_USER.LOGOUT,
K_USER.INIT_PWD_TIME,
K_USER.SORT ,
K_USER.LOGOUT_TIME,
K_USER.UESR_RANK_ID,
DEPARTMENT.DEPT_NAME,
USERSECRET.SECRET
from K_USER
left join DEPARTMENT on K_USER.DEPART_ID = DEPARTMENT.ID
left join USERSECRET on K_USER.ID = USERSECRET.ID
where K_USER.LOGOUT != '1'
and K_USER.PROJECT_SOURCE = #{user.projectSource,jdbcType=VARCHAR}
<if test="user.flag != null">
and K_USER.USER_ID != 'safesecret'
and K_USER.USER_ID != 'safeaudit'
and K_USER.USER_ID != 'admin'
</if>
<if test="user.id != null">
and K_USER.ID = #{user.id,jdbcType=VARCHAR}
</if>
<if test="user.userId != null">
and K_USER.USER_ID = #{user.userId,jdbcType=VARCHAR}
</if>
<if test="user.isSys != 'sysadmin'">
and K_USER.IS_SYS = '0'
</if>
<if test="user.userNameForSerch != null">
and (K_USER.USER_NAME like '%'||#{user.userNameForSerch,jdbcType=VARCHAR}||'%' )
</if>
<if test="user.departId != null and user.departId != ''">
and K_USER.DEPART_ID=#{user.departId,jdbcType=VARCHAR}
</if>
<if test="user.post != null and post != ''">
and K_USER.POST=#{user.post,jdbcType=VARCHAR}
</if>
<if test="user.userStatus == null">
and K_USER.USER_STATUS = '0'
</if>
<if test="user.userNumber != null and user.userNumber != ''">
and K_USER.USER_NUMBER = #{user.userNumber,jdbcType=VARCHAR}
</if>
order by SORT asc
</select>
<update id="updateByPrimaryKey" parameterType="com.keyware.htey.entity.user.User">
update K_USER
<set>
<if test="userId!=null">USER_ID = #{userId,jdbcType=VARCHAR},</if>
<if test="userName!=null">USER_NAME = #{userName,jdbcType=VARCHAR},</if>
<if test="password!=null">PASSWORD = #{password,jdbcType=VARCHAR},</if>
<if test="departId!=null">DEPART_ID = #{departId,jdbcType=VARCHAR},</if>
<if test="userCreationTime!=null">USER_CREATION_TIME = #{userCreationTime,jdbcType=VARCHAR},</if>
<if test="userPwdModifTime!=null">USER_PWD_MODIF_TIME = #{userPwdModifTime,jdbcType=VARCHAR},</if>
<if test="userStatus!=null">USER_STATUS= #{userStatus,jdbcType=INTEGER},</if>
<if test="userLock!=null">USER_LOCK= #{userLock,jdbcType=INTEGER},</if>
<if test="userPwdError!=null">USER_PWD_ERROR = #{userPwdError,jdbcType=INTEGER},</if>
<if test="userPwdErrorDate!=null">USER_PWD_ERROR_DATE = #{userPwdErrorDate,jdbcType=VARCHAR},</if>
<if test="exitTime!=null">EXIT_TIME = #{exitTime,jdbcType=VARCHAR},</if>
<if test="passwordOld!=null">PASSWORD_OLD = #{passwordOld,jdbcType=VARCHAR},</if>
<if test="post!=null">POST = #{post,jdbcType=VARCHAR},</if>
<if test="email!=null">EMAIL = #{email,jdbcType=VARCHAR},</if>
<if test="officeTelephone!=null">OFFICE_TELEPHONE = #{officeTelephone,jdbcType=VARCHAR},</if>
<if test="userNumber!=null">USER_NUMBER = #{userNumber,jdbcType=VARCHAR},</if>
<if test="idCard!=null">ID_CARD = #{idCard,jdbcType=VARCHAR},</if>
<if test="mobilePhone!=null">MOBILE_PHONE = #{mobilePhone,jdbcType=VARCHAR},</if>
<if test="sex!=null">SEX = #{sex,jdbcType=DECIMAL},</if>
<if test="homePhone!=null">HOME_PHONE = #{homePhone,jdbcType=VARCHAR},</if>
<if test="logout!=null">LOGOUT = #{logout,jdbcType=DECIMAL},</if>
<if test="initPwdTime!=null">INIT_PWD_TIME = #{initPwdTime,jdbcType=VARCHAR},</if>
<if test="sort!=null">SORT = #{sort,jdbcType=VARCHAR},</if>
<if test="logoutTime !=null ">
LOGOUT_TIME = #{logoutTime,jdbcType=VARCHAR},
</if>
<if test="uesrRankId != null">
UESR_RANK_ID = #{uesrRankId,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=VARCHAR}
</update>
<update id="unlock" parameterType="com.keyware.htey.entity.user.User">
update K_USER
set USER_LOCK= '0',
USER_PWD_ERROR = '0',
USER_PWD_ERROR_DATE = ''
where ID in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateStatus" parameterType="com.keyware.htey.entity.user.User">
update K_USER
set USER_STATUS= #{userStatus,jdbcType=INTEGER}
where ID = #{id,jdbcType=VARCHAR}
</update>
<select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from K_USER
where USER_ID= #{userId,jdbcType=VARCHAR}
and PROJECT_SOURCE = #{projectSource}
</select>
<select id="selectByUserNumber" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from K_USER
where USER_NUMBER = #{userNumber,jdbcType=VARCHAR}
and PROJECT_SOURCE = #{projectSource}
</select>
<select id="selectAll" resultMap="BaseResultMap" parameterType="java.lang.String">
select ID, USER_ID, USER_NAME,
PASSWORD, DEPART_ID, USER_CREATION_TIME,
USER_PWD_MODIF_TIME, USER_STATUS, USER_LOCK,
USER_PWD_ERROR, USER_PWD_ERROR_DATE,EXIT_TIME,PASSWORD_OLD,
POST, EMAIL, OFFICE_TELEPHONE, USER_NUMBER, ID_CARD, MOBILE_PHONE, SEX, HOME_PHONE,LOGOUT,INIT_PWD_TIME,SORT
from K_USER where LOGOUT != '1'
and PROJECT_SOURCE = #{projectSource,jdbcType=VARCHAR}
<if test="userId != 'sysadmin'">
and IS_SYS = '0'
</if>
order by SORT asc
</select>
<insert id="insertSelective" parameterType="com.keyware.htey.entity.user.User">
insert into K_USER
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="userId != null">
USER_ID,
</if>
<if test="userName != null">
USER_NAME,
</if>
<if test="password != null">
PASSWORD,
</if>
<if test="departId != null">
DEPART_ID,
</if>
<if test="userCreationTime != null">
USER_CREATION_TIME,
</if>
<if test="userPwdModifTime != null">
USER_PWD_MODIF_TIME,
</if>
<if test="userStatus != null">
USER_STATUS,
</if>
<if test="userLock != null">
USER_LOCK,
</if>
<if test="userPwdError != null">
USER_PWD_ERROR,
</if>
<if test="userPwdErrorDate != null">
USER_PWD_ERROR_DATE,
</if>
<if test="exitTime != null">
EXIT_TIME,
</if>
<if test="passwordOld != null">
PASSWORD_OLD,
</if>
<if test="post != null">
POST,
</if>
<if test="email != null">
EMAIL,
</if>
<if test="officeTelephone != null">
OFFICE_TELEPHONE,
</if>
<if test="userNumber != null">
USER_NUMBER,
</if>
<if test="idCard != null">
ID_CARD,
</if>
<if test="mobilePhone != null">
MOBILE_PHONE,
</if>
<if test="sex != null">
SEX,
</if>
<if test="homePhone != null">
HOME_PHONE,
</if>
<if test="logout != null">
LOGOUT,
</if>
<if test="initPwdTime != null">
INIT_PWD_TIME,
</if>
<if test="sort != null">
SORT,
</if>
<if test="isSys != null">
IS_SYS,
</if>
<if test="logoutTime != null">
LOGOUT_TIME,
</if>
<if test="projectSource != null">
PROJECT_SOURCE,
</if>
<if test="uesrRankId != null">
UESR_RANK_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="departId != null">
#{departId,jdbcType=VARCHAR},
</if>
<if test="userCreationTime != null">
#{userCreationTime,jdbcType=VARCHAR},
</if>
<if test="userPwdModifTime != null">
#{userPwdModifTime,jdbcType=VARCHAR},
</if>
<if test="userStatus != null">
#{userStatus,jdbcType=DECIMAL},
</if>
<if test="userLock != null">
#{userLock,jdbcType=DECIMAL},
</if>
<if test="userPwdError != null">
#{userPwdError,jdbcType=DECIMAL},
</if>
<if test="userPwdErrorDate != null">
#{userPwdErrorDate,jdbcType=VARCHAR},
</if>
<if test="exitTime != null">
#{exitTime,jdbcType=VARCHAR},
</if>
<if test="passwordOld != null">
#{passwordOld,jdbcType=VARCHAR},
</if>
<if test="post != null">
#{post,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="officeTelephone != null">
#{officeTelephone,jdbcType=VARCHAR},
</if>
<if test="userNumber != null">
#{userNumber,jdbcType=VARCHAR},
</if>
<if test="idCard != null">
#{idCard,jdbcType=VARCHAR},
</if>
<if test="mobilePhone != null">
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="sex != null">
#{sex,jdbcType=DECIMAL},
</if>
<if test="homePhone != null">
#{homePhone,jdbcType=VARCHAR},
</if>
<if test="logout != null">
#{logout,jdbcType=DECIMAL},
</if>
<if test="initPwdTime != null">
#{initPwdTime,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=VARCHAR},
</if>
<if test="isSys != null">
#{isSys,jdbcType=VARCHAR},
</if>
<if test="logoutTime != null">
#{logoutTime,jdbcType=VARCHAR},
</if>
<if test="projectSource != null">
#{projectSource,jdbcType=VARCHAR},
</if>
<if test="uesrRankId != null">
#{uesrRankId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from K_USER
where ID = #{id,jdbcType=VARCHAR}
</select>
<update id="recovery" parameterType="com.keyware.htey.entity.user.User">
update K_USER
set LOGOUT='0' ,LOGOUT_TIME = null
where ID in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.keyware.htey.mybatis.itf.UsersecretMapper">
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.usersecret.Usersecret">
<id column="ID" property="id" jdbcType="VARCHAR"/>
<result column="SECRET" property="secret" jdbcType="VARCHAR"/>
</resultMap>
<insert id="insertSelective" parameterType="com.keyware.htey.entity.usersecret.Usersecret">
insert into USERSECRET (ID, SECRET)
values (#{id,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR})
</insert>
</mapper>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.keyware.htey.mybatis.itf.number.NumberBuilderMapper">
<resultMap id="BaseResultMap" type="com.keyware.htey.entity.number.NumberBuilder">
<id column="NUMBER_ID" property="numberId" jdbcType="VARCHAR"/>
<result column="NUMBER_" property="number" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
NUMBER_ID
, NUMBER_
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from NUMBER_BUILDER
where NUMBER_ID = #{numberId,jdbcType=VARCHAR}
</select>
<insert id="insertSelective" parameterType="com.keyware.htey.entity.number.NumberBuilder">
insert into NUMBER_BUILDER
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="numberId != null">
NUMBER_ID,
</if>
<if test="number != null">
NUMBER_,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="numberId != null">
#{numberId,jdbcType=VARCHAR},
</if>
<if test="number != null">
#{number,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.keyware.htey.entity.number.NumberBuilder">
update NUMBER_BUILDER
<set>
<if test="number != null">
NUMBER_ = #{number,jdbcType=VARCHAR},
</if>
</set>
where NUMBER_ID = #{numberId,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save