Browse Source

用户审核相关

master
DX 3 days ago
parent
commit
a5bb49ac4e
  1. 20
      ruoyi-admin/pom.xml
  2. 106
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/FileInfoController.java
  3. 54
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/MinioController.java
  4. 44
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FileInfoController.java
  5. 47
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  6. 82
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java
  7. 9
      ruoyi-common/pom.xml
  8. 12
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
  9. 87
      ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtils.java
  10. 27
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/MinioConfig.java
  11. 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
  12. 1
      ruoyi-system/pom.xml
  13. 45
      ruoyi-system/src/main/java/com/ruoyi/system/domain/Enterprises.java
  14. 90
      ruoyi-system/src/main/java/com/ruoyi/system/domain/UserAuditLog.java
  15. 14
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileInfoMapper.java
  16. 9
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileMapper.java
  17. 14
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserAuditLogMapper.java
  18. 14
      ruoyi-system/src/main/java/com/ruoyi/system/service/IFileInfoService.java
  19. 7
      ruoyi-system/src/main/java/com/ruoyi/system/service/IFileService.java
  20. 25
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  21. 14
      ruoyi-system/src/main/java/com/ruoyi/system/service/IUserAuditLogService.java
  22. 18
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileInfoServiceImpl.java
  23. 19
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java
  24. 51
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  25. 19
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserAuditLogServiceImpl.java
  26. 32
      ruoyi-system/src/main/resources/mapper/system/EnterprisesMapper.xml
  27. 6
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

20
ruoyi-admin/pom.xml

@ -80,17 +80,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</configuration>
</plugin><plugin><groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>
</project>

106
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/FileInfoController.java

@ -0,0 +1,106 @@
package com.ruoyi.web.controller.common;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.FileInfo;
import com.ruoyi.system.service.IFileInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 附件信息Controller
*
* @author ruoyi
* @date 2025-01-16
*/
@RestController
@RequestMapping("/system/fileInfo")
public class FileInfoController extends BaseController
{
@Autowired
private IFileInfoService fileInfoService;
/**
* 查询附件信息列表
*/
@PreAuthorize("@ss.hasPermi('system:fileInfo:list')")
@GetMapping("/list")
public TableDataInfo list(FileInfo fileInfo)
{
startPage();
List<FileInfo> list = fileInfoService.list(new QueryWrapper<FileInfo>());
return getDataTable(list);
}
// /**
// * 导出附件信息列表
// */
// @PreAuthorize("@ss.hasPermi('system:fileInfo:export')")
// @Log(title = "附件信息", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, FileInfo fileInfo)
// {
// List<FileInfo> list = fileInfoService.selectFileInfoList(fileInfo);
// ExcelUtil<FileInfo> util = new ExcelUtil<FileInfo>(FileInfo.class);
// util.exportExcel(response, list, "附件信息数据");
// }
/**
* 获取附件信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:fileInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(fileInfoService.getById(id));
}
/**
* 新增附件信息
*/
@PreAuthorize("@ss.hasPermi('system:fileInfo:add')")
@Log(title = "附件信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FileInfo fileInfo)
{
return toAjax(fileInfoService.save(fileInfo));
}
/**
* 修改附件信息
*/
@PreAuthorize("@ss.hasPermi('system:fileInfo:edit')")
@Log(title = "附件信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FileInfo fileInfo)
{
return toAjax(fileInfoService.updateById(fileInfo));
}
/**
* 删除附件信息
*/
@PreAuthorize("@ss.hasPermi('system:fileInfo:remove')")
@Log(title = "附件信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids)
{
return toAjax(fileInfoService.removeByIds(ids));
}
}

54
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/MinioController.java

@ -0,0 +1,54 @@
package com.ruoyi.web.controller.common;
import com.ruoyi.common.utils.MinioUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
@RestController
@RequestMapping("/minio")
public class MinioController {
@Autowired
private MinioUtils minioUtils;
/**
* 上传文件
*/
@PostMapping("/upload")
public String uploadFile(@RequestParam("file") MultipartFile file) {
String objectName = "uploads/" + System.currentTimeMillis() + "_" + file.getOriginalFilename();
try (InputStream inputStream = file.getInputStream()) {
minioUtils.uploadFile( objectName, inputStream, file.getSize(), file.getContentType());
} catch (Exception e) {
throw new RuntimeException("文件上传失败", e);
}
return minioUtils.generateShortUrl(objectName);
}
/**
* 下载文件
*/
@GetMapping("/download")
public ResponseEntity<byte[]> downloadFile(@RequestParam("fileName") String fileName) {
try {
InputStream inputStream = minioUtils.downloadFile(fileName);
return ResponseEntity.ok(inputStream.readAllBytes());
} catch (Exception e) {
return ResponseEntity.badRequest().body(e.getMessage().getBytes());
}
}
/**
* 获取存储桶中的文件列表
*/
@GetMapping("/listBuckets")
public ResponseEntity<?> listBuckets() {
return ResponseEntity.ok(minioUtils.listBuckets());
}
}

44
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FileInfoController.java

@ -1,44 +0,0 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.FileInfo;
import com.ruoyi.system.service.IFileService;
import com.ruoyi.system.utils.FileUploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Date;
@RestController
@RequestMapping("/system/file")
public class FileInfoController {
@Autowired
private FileUploadUtil fileUploadUtil;
@Autowired
private IFileService fileService;
/**
* 文件上传接口
*/
@PostMapping("/upload")
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file) throws IOException {
// 上传文件并获取访问 URL
String fileUrl = fileUploadUtil.uploadFile(file);
return AjaxResult.success("文件上传成功", fileUrl);
}
/**
* 保存文件信息接口
*/
@PostMapping("/save")
public AjaxResult saveFileRecord(@RequestBody FileInfo fileInfo) {
fileInfo.setCreateTime(new Date());
fileService.saveFileRecord(fileInfo);
return AjaxResult.success("文件信息保存成功");
}
}

47
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@ -3,6 +3,10 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.system.domain.UserAuditLog;
import com.ruoyi.system.service.*;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -27,10 +31,6 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
/**
* 用户信息
@ -52,16 +52,28 @@ public class SysUserController extends BaseController
@Autowired
private ISysPostService postService;
@Autowired
private IUserAuditLogService iUserAuditLogService;
/**
* 获取用户列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(SysUser user)
// @PreAuthorize("@ss.hasPermi('system:user:auditList')")
@GetMapping("/auditList")
public TableDataInfo auditList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
List<SysUser> list = userService.auditList(user);
list.forEach(item-> {
if ("3".equals(item.getAudit()) ) {
QueryWrapper<UserAuditLog> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", item.getUserId());
UserAuditLog userAuditLog = iUserAuditLogService.getOne(wrapper);
item.setContent(userAuditLog.getContent());
}
});
return getDataTable(list);
}
@ -73,6 +85,24 @@ public class SysUserController extends BaseController
return getDataTable(list);
}
/**
* 获取用户列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('system:user:audit')")
@PutMapping("/auditUser")
public AjaxResult auditUser(SysUser user) {
userService.auditUser(user);
return success("操作成功");
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@ -263,4 +293,5 @@ public class SysUserController extends BaseController
{
return success(deptService.selectDeptTreeList(dept));
}
}

82
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java

@ -61,33 +61,33 @@ public class TasksController extends BaseController
return AjaxResult.success("保存成功");
}
//
// /**
// * 导出任务,用于存储所有的任务信息,任务可由不同用户创建并管理。列表
// */
/**
* 导出任务用于存储所有的任务信息任务可由不同用户创建并管理列表
*/
// @PreAuthorize("@ss.hasPermi('system:tasks:export')")
// @Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, Tasks tasks)
// {
// List<Tasks> list = tasksService.selectTasksList(tasks);
// List<Tasks> list = tasksService.(tasks);
// ExcelUtil<Tasks> util = new ExcelUtil<Tasks>(Tasks.class);
// util.exportExcel(response, list, "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。数据");
// }
//
// /**
// * 获取任务,用于存储所有的任务信息,任务可由不同用户创建并管理。详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:tasks:query')")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") Long id)
// {
// return success(tasksService.selectTasksById(id));
// }
//
// /**
// * 新增任务,用于存储所有的任务信息,任务可由不同用户创建并管理。
// */
/**
* 获取任务用于存储所有的任务信息任务可由不同用户创建并管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:tasks:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tasksService.getOptById(id));
}
/**
* 新增任务用于存储所有的任务信息任务可由不同用户创建并管理
*/
@PreAuthorize("@ss.hasPermi('system:tasks:add')")
@Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.INSERT)
@PostMapping
@ -96,26 +96,26 @@ public class TasksController extends BaseController
tasksService.insertTasks(taskSaveVo);
return success("添加任务成功");
}
//
// /**
// * 修改任务,用于存储所有的任务信息,任务可由不同用户创建并管理。
// */
// @PreAuthorize("@ss.hasPermi('system:tasks:edit')")
// @Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody Tasks tasks)
// {
// return toAjax(tasksService.updateTasks(tasks));
// }
//
// /**
// * 删除任务,用于存储所有的任务信息,任务可由不同用户创建并管理。
// */
// @PreAuthorize("@ss.hasPermi('system:tasks:remove')")
// @Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(tasksService.deleteTasksByIds(ids));
// }
/**
* 修改任务用于存储所有的任务信息任务可由不同用户创建并管理
*/
@PreAuthorize("@ss.hasPermi('system:tasks:edit')")
@Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Tasks tasks)
{
return toAjax(tasksService.updateById(tasks));
}
/**
* 删除任务用于存储所有的任务信息任务可由不同用户创建并管理
*/
@PreAuthorize("@ss.hasPermi('system:tasks:remove')")
@Log(title = "任务,用于存储所有的任务信息,任务可由不同用户创建并管理。", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
return toAjax(tasksService.removeById(id));
}
}

9
ruoyi-common/pom.xml

@ -47,6 +47,7 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!--常用工具类 -->
<dependency>
<groupId>org.apache.commons</groupId>
@ -101,6 +102,14 @@
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- minio -->
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.2.1</version>
</dependency>
<!-- pool 对象池 -->
<dependency>
<groupId>org.apache.commons</groupId>

12
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@ -52,14 +52,22 @@ public class SysUser extends BaseEntity
@Excel(name = "用户真实姓名")
private String realName;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
@Excel(name= "审核状态")
private String audit;
@Excel(name= "邮件")
private String email;
@TableField(exist = false)
private String content;
/** 手机号码 */
@Excel(name = "手机号码", cellType = ColumnType.TEXT)
private String phonenumber;
@TableField(exist = false)
private List<String> time;
/** 用户性别 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;

87
ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtils.java

@ -0,0 +1,87 @@
package com.ruoyi.common.utils;
import io.minio.*;
import io.minio.http.Method;
import io.minio.messages.Bucket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.List;
@Component
public class MinioUtils {
@Autowired
private MinioClient minioClient;
@Value("${minio.bucketName}")
private String bucketName;
@Value("${minio.endpoint}")
private String endpoint;
/**
* 上传文件
*/
public void uploadFile(String objectName, InputStream fileInputStream, long size, String contentType) throws Exception {
minioClient.putObject(
PutObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.stream(fileInputStream, size, -1)
.contentType(contentType)
.build()
);
}
public String generateShortUrl(String objectName) {
// 返回自定义短链接地址
return endpoint + "/" +bucketName + "/" + objectName;
}
public String generatePresignedUrl(String objectName) {
try {
return minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.bucket(bucketName)
.object(objectName)
.expiry(3600) // 有效期1小时
.build()
);
} catch (Exception e) {
throw new RuntimeException("Failed to generate presigned URL", e);
}
}
/**
* 下载文件
*/
public InputStream downloadFile(String objectName) {
try {
return minioClient.getObject(
GetObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.build()
);
} catch (Exception e) {
throw new RuntimeException("文件下载失败:" + e.getMessage());
}
}
/**
* 列出存储桶中的所有文件
*/
public List<Bucket> listBuckets() {
try {
return minioClient.listBuckets();
} catch (Exception e) {
throw new RuntimeException("获取存储桶列表失败:" + e.getMessage());
}
}
}

27
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MinioConfig.java

@ -0,0 +1,27 @@
package com.ruoyi.framework.config;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MinioConfig {
@Value("${minio.endpoint}")
private String endpoint;
@Value("${minio.accessKey}")
private String accessKey;
@Value("${minio.secretKey}")
private String secretKey;
@Bean
public MinioClient minioClient() {
return MinioClient.builder()
.endpoint(endpoint)
.credentials(accessKey, secretKey)
.build();
}
}

3
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java

@ -252,7 +252,8 @@ public class SysLoginService
log.info("registerVo:{}", registerVo);
BeanUtils.copyProperties(registerVo, sysUser);
// sysUser.setStatus("1");
sysUser.setStatus("0");
sysUser.setAudit("1");
final int res = sysUserMapper.updateUser(sysUser);
if (res < 0) {
throw new ServiceException("添加失败");

1
ruoyi-system/pom.xml

@ -33,7 +33,6 @@
<version>3.5.9</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

45
ruoyi-system/src/main/java/com/ruoyi/system/domain/Enterprises.java

@ -62,17 +62,8 @@ public class Enterprises extends BaseEntity
@Excel(name = "企业成立时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date establishmentDate;
/** 创建人 */
@Excel(name = "创建人")
private String creator;
/** 修改人 */
@Excel(name = "修改人")
private String updater;
/** 是否删除 */
@Excel(name = "是否删除")
private Integer deleted;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
public void setId(Long id)
{
@ -164,33 +155,7 @@ public class Enterprises extends BaseEntity
{
return establishmentDate;
}
public void setCreator(String creator)
{
this.creator = creator;
}
public String getCreator()
{
return creator;
}
public void setUpdater(String updater)
{
this.updater = updater;
}
public String getUpdater()
{
return updater;
}
public void setDeleted(Integer deleted)
{
this.deleted = deleted;
}
public Integer getDeleted()
{
return deleted;
}
@Override
public String toString() {
@ -205,11 +170,7 @@ public class Enterprises extends BaseEntity
.append("registrationNumber", getRegistrationNumber())
.append("introduction", getIntroduction())
.append("establishmentDate", getEstablishmentDate())
.append("creator", getCreator())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("updater", getUpdater())
.append("deleted", getDeleted())
.toString();
}
}

90
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserAuditLog.java

@ -0,0 +1,90 @@
package com.ruoyi.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户审核日志对象 user_audit_log
*
* @author ruoyi
* @date 2025-01-16
*/
@TableName("user_audit_log")
@Data
public class UserAuditLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 驳回内容 */
@Excel(name = "驳回内容")
private String content;
/** 审批状态 */
@Excel(name = "审批状态")
private String status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("content", getContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

14
ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileInfoMapper.java

@ -0,0 +1,14 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.FileInfo;
/**
* 附件信息Mapper接口
*
* @author ruoyi
* @date 2025-01-16
*/
public interface FileInfoMapper extends BaseMapper<FileInfo> {
}

9
ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileMapper.java

@ -1,9 +0,0 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.FileInfo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FileMapper extends BaseMapper<FileInfo> {
}

14
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserAuditLogMapper.java

@ -0,0 +1,14 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.UserAuditLog;
/**
* 用户审核日志Mapper接口
*
* @author ruoyi
* @date 2025-01-16
*/
public interface UserAuditLogMapper extends BaseMapper<UserAuditLog> {
}

14
ruoyi-system/src/main/java/com/ruoyi/system/service/IFileInfoService.java

@ -0,0 +1,14 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.FileInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 附件信息Service接口
*
* @author ruoyi
* @date 2025-01-16
*/
public interface IFileInfoService extends IService<FileInfo> {
}

7
ruoyi-system/src/main/java/com/ruoyi/system/service/IFileService.java

@ -1,7 +0,0 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.FileInfo;
public interface IFileService {
void saveFileRecord(FileInfo fileInfo);
}

25
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@ -18,8 +18,33 @@ public interface ISysUserService
*/
public List<SysUser> selectUserList(SysUser user);
/**
*
* @param user
* @return java.util.List<com.ruoyi.common.core.domain.entity.SysUser>
* @Author djx
* @Date 2025-01-16 下午3:30
**/
public List<SysUser> listDeptUser(SysUser user);
/**
* 需要审核的列表
* @param user
* @return java.util.List<com.ruoyi.common.core.domain.entity.SysUser>
* @Author djx
* @Date 2025-01-16 下午3:31
**/
public List<SysUser> auditList(SysUser user);
/**
* 审核
* @param user
* @return
* @Author djx
* @Date 2025-01-16 下午4:10
**/
public void auditUser(SysUser user);
/**
* 根据条件分页查询已分配用户角色列表
*

14
ruoyi-system/src/main/java/com/ruoyi/system/service/IUserAuditLogService.java

@ -0,0 +1,14 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.UserAuditLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 用户审核日志Service接口
*
* @author ruoyi
* @date 2025-01-16
*/
public interface IUserAuditLogService extends IService<UserAuditLog> {
}

18
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileInfoServiceImpl.java

@ -0,0 +1,18 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FileInfoMapper;
import com.ruoyi.system.domain.FileInfo;
import com.ruoyi.system.service.IFileInfoService;
/**
* 附件信息Service业务层处理
*
* @author ruoyi
* @date 2025-01-16
*/
@Service
public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> implements IFileInfoService {
}

19
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java

@ -1,19 +0,0 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.FileInfo;
import com.ruoyi.system.mapper.FileMapper;
import com.ruoyi.system.service.IFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class FileServiceImpl implements IFileService {
@Autowired
private FileMapper fileMapper;
@Override
public void saveFileRecord(FileInfo fileInfo) {
fileMapper.insert(fileInfo);
}
}

51
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@ -7,7 +7,9 @@ import javax.validation.Validator;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.system.domain.UserAuditLog;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.IUserAuditLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -66,6 +68,9 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
private SysMyUserMapper sysMyUserMapper;
@Autowired
private IUserAuditLogService userAuditLogService;
/**
* 根据条件分页查询用户列表
*
@ -89,6 +94,52 @@ public class SysUserServiceImpl implements ISysUserService
return sysMyUserMapper.selectList(wrapper);
}
@Override
public List<SysUser> auditList(SysUser user) {
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(SysUser::getAudit, "2");
wrapper.ne(SysUser::getUserType, "02");
wrapper.eq(SysUser::getStatus, "0");
wrapper.eq(SysUser::getDelFlag, "0");
wrapper.eq(user.getAudit() != null, SysUser::getAudit, user.getAudit());
wrapper.eq(user.getUserType() != null, SysUser::getUserType, user.getAudit());
wrapper.like(user.getRealName() != null, SysUser::getRealName, user.getRealName());
if (user.getTime() != null && user.getTime().size() > 1) {
wrapper.between(SysUser::getCreateTime, user.getTime().get(0), user.getTime().get(1));
}
return userMapper.selectList(wrapper);
}
/**
* 审核
*
* @param user
* @return
* @Author dx
* @Date 2025-01-16 下午3:32
**/
@Override
@Transactional
public void auditUser(SysUser user) {
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", user.getUserId());
SysUser sysUser = userMapper.selectOne(wrapper);
if (sysUser == null) {
throw new ServiceException("用户不存在");
}
sysUser.setAudit(user.getAudit());
final int res = userMapper.updateUser(sysUser);
if (res > 0) {
UserAuditLog userAuditLog = new UserAuditLog();
userAuditLog.setUserId(sysUser.getUserId());
userAuditLog.setContent(sysUser.getContent());
userAuditLog.setStatus(sysUser.getAudit());
userAuditLogService.save(userAuditLog);
}
}
/**
* 根据条件分页查询已分配用户角色列表
*

19
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserAuditLogServiceImpl.java

@ -0,0 +1,19 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserAuditLogMapper;
import com.ruoyi.system.domain.UserAuditLog;
import com.ruoyi.system.service.IUserAuditLogService;
/**
* 用户审核日志Service业务层处理
*
* @author ruoyi
* @date 2025-01-16
*/
@Service
public class UserAuditLogServiceImpl extends ServiceImpl<UserAuditLogMapper, UserAuditLog> implements IUserAuditLogService {
}

32
ruoyi-system/src/main/resources/mapper/system/EnterprisesMapper.xml

@ -15,15 +15,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="registrationNumber" column="registration_number" />
<result property="introduction" column="introduction" />
<result property="establishmentDate" column="establishment_date" />
<result property="creator" column="creator" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updater" column="updater" />
<result property="deleted" column="deleted" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectEnterprisesVo">
select id, department_id, user_id, type, region, enterprises_name, address, registration_number, introduction, establishment_date, creator, create_time, update_time, updater, deleted from enterprises
select id, department_id, user_id, type, region, enterprises_name, address, registration_number, introduction, establishment_date, create_by, create_time, update_time, update_by, del_flag from enterprises
</sql>
<select id="selectEnterprisesList" parameterType="com.ruoyi.system.domain.Enterprises" resultMap="EnterprisesResult">
@ -38,9 +38,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="registrationNumber != null and registrationNumber != ''"> and registration_number = #{registrationNumber}</if>
<if test="introduction != null and introduction != ''"> and introduction = #{introduction}</if>
<if test="establishmentDate != null "> and establishment_date = #{establishmentDate}</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="updater != null and updater != ''"> and updater = #{updater}</if>
<if test="deleted != null "> and deleted = #{deleted}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="delFlag != null "> and del_flag = #{delFlag}</if>
</where>
</select>
@ -61,11 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="registrationNumber != null">registration_number,</if>
<if test="introduction != null">introduction,</if>
<if test="establishmentDate != null">establishment_date,</if>
<if test="creator != null">creator,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updater != null">updater,</if>
<if test="deleted != null">deleted,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="departmentId != null">#{departmentId},</if>
@ -79,11 +79,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="registrationNumber != null">#{registrationNumber},</if>
<if test="introduction != null">#{introduction},</if>
<if test="establishmentDate != null">#{establishmentDate},</if>
<if test="creator != null">#{creator},</if>
<if test="createBy != null">#{create_by},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updater != null">#{updater},</if>
<if test="deleted != null">#{deleted},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag!= null">#{delFlag},</if>
</trim>
</insert>
@ -99,11 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="registrationNumber != null">registration_number = #{registrationNumber},</if>
<if test="introduction != null">introduction = #{introduction},</if>
<if test="establishmentDate != null">establishment_date = #{establishmentDate},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updater != null">updater = #{updater},</if>
<if test="deleted != null">deleted = #{deleted},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>

6
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.real_name,u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.user_type,u.real_name,u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
@ -87,6 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<if test="userType != null and userType != 0">
AND u.user_type = #{userType}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
@ -198,6 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="realName != null and realName != ''">real_name = #{realName},</if>
<if test="email != null ">email = #{email},</if>
<if test="audit != null ">audit = #{audit},</if>
<if test="userType != null ">user_type = #{userType},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>

Loading…
Cancel
Save