diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 9617d01..95022c7 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -80,17 +80,23 @@ - - org.apache.maven.plugins - maven-war-plugin - 3.1.0 + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 false ${project.artifactId} - - + + org.apache.maven.plugins + maven-compiler-plugin + + 9 + 9 + + ${project.artifactId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/FileInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/FileInfoController.java new file mode 100644 index 0000000..1f19b67 --- /dev/null +++ b/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 list = fileInfoService.list(new QueryWrapper()); + return getDataTable(list); + } + +// /** +// * 导出附件信息列表 +// */ +// @PreAuthorize("@ss.hasPermi('system:fileInfo:export')") +// @Log(title = "附件信息", businessType = BusinessType.EXPORT) +// @PostMapping("/export") +// public void export(HttpServletResponse response, FileInfo fileInfo) +// { +// List list = fileInfoService.selectFileInfoList(fileInfo); +// ExcelUtil util = new ExcelUtil(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 ids) + { + return toAjax(fileInfoService.removeByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/MinioController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/MinioController.java new file mode 100644 index 0000000..0f6fdf3 --- /dev/null +++ b/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 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()); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FileInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FileInfoController.java deleted file mode 100644 index fb0e060..0000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FileInfoController.java +++ /dev/null @@ -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("文件信息保存成功"); - } -} - diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 0cbf016..deedc72 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/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 list = userService.selectUserList(user); + List list = userService.auditList(user); + + list.forEach(item-> { + if ("3".equals(item.getAudit()) ) { + QueryWrapper 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 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)); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java index 9bc33bb..cde06ce 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TasksController.java +++ b/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 list = tasksService.selectTasksList(tasks); +// List list = tasksService.(tasks); // ExcelUtil util = new ExcelUtil(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)); + } } diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 3b6d867..6ba12be 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -47,6 +47,7 @@ spring-boot-starter-validation + org.apache.commons @@ -101,6 +102,14 @@ spring-boot-starter-data-redis + + + io.minio + minio + 8.2.1 + + + org.apache.commons diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 415cb78..1893084 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/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 time; + /** 用户性别 */ @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") private String sex; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtils.java new file mode 100644 index 0000000..b22db41 --- /dev/null +++ b/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 listBuckets() { + try { + return minioClient.listBuckets(); + } catch (Exception e) { + throw new RuntimeException("获取存储桶列表失败:" + e.getMessage()); + } + } +} + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MinioConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MinioConfig.java new file mode 100644 index 0000000..63fe621 --- /dev/null +++ b/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(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 2a98cef..f73092f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/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("添加失败"); diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 28f4762..1a93b01 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -33,7 +33,6 @@ 3.5.9 compile - diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Enterprises.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Enterprises.java index 2f9dec9..cab3aea 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Enterprises.java +++ b/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(); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/UserAuditLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/UserAuditLog.java new file mode 100644 index 0000000..0dfd97b --- /dev/null +++ b/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(); +} +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileInfoMapper.java new file mode 100644 index 0000000..fb5425e --- /dev/null +++ b/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 { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileMapper.java deleted file mode 100644 index bc5cabf..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/FileMapper.java +++ /dev/null @@ -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 { -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserAuditLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserAuditLogMapper.java new file mode 100644 index 0000000..6046e61 --- /dev/null +++ b/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 { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IFileInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IFileInfoService.java new file mode 100644 index 0000000..412e935 --- /dev/null +++ b/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 { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IFileService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IFileService.java deleted file mode 100644 index 764988a..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IFileService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.ruoyi.system.service; - -import com.ruoyi.system.domain.FileInfo; - -public interface IFileService { - void saveFileRecord(FileInfo fileInfo); -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index ab1d87d..95552a8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -18,8 +18,33 @@ public interface ISysUserService */ public List selectUserList(SysUser user); + /** + * + * @param user + * @return java.util.List + * @Author djx + * @Date 2025-01-16 下午3:30 + **/ public List listDeptUser(SysUser user); + /** + * 需要审核的列表 + * @param user + * @return java.util.List + * @Author djx + * @Date 2025-01-16 下午3:31 + **/ + public List auditList(SysUser user); + + /** + * 审核 + * @param user + * @return + * @Author djx + * @Date 2025-01-16 下午4:10 + **/ + public void auditUser(SysUser user); + /** * 根据条件分页查询已分配用户角色列表 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IUserAuditLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUserAuditLogService.java new file mode 100644 index 0000000..daa77ac --- /dev/null +++ b/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 { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileInfoServiceImpl.java new file mode 100644 index 0000000..bc7a6b1 --- /dev/null +++ b/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 implements IFileInfoService { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java deleted file mode 100644 index a87eb4c..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java +++ /dev/null @@ -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); - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index c49741d..18cd8e3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/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 auditList(SysUser user) { + LambdaQueryWrapper 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 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); + } + } + /** * 根据条件分页查询已分配用户角色列表 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserAuditLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserAuditLogServiceImpl.java new file mode 100644 index 0000000..db4a262 --- /dev/null +++ b/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 implements IUserAuditLogService { + +} diff --git a/ruoyi-system/src/main/resources/mapper/system/EnterprisesMapper.xml b/ruoyi-system/src/main/resources/mapper/system/EnterprisesMapper.xml index 08f73c3..403e010 100644 --- a/ruoyi-system/src/main/resources/mapper/system/EnterprisesMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/EnterprisesMapper.xml @@ -15,15 +15,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - + + - 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 @@ -61,11 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" registration_number, introduction, establishment_date, - creator, + create_by, create_time, update_time, - updater, - deleted, + update_by, + del_flag #{departmentId}, @@ -79,11 +79,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{registrationNumber}, #{introduction}, #{establishmentDate}, - #{creator}, + #{create_by}, #{createTime}, #{updateTime}, - #{updater}, - #{deleted}, + #{updateBy}, + #{delFlag}, @@ -99,11 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" registration_number = #{registrationNumber}, introduction = #{introduction}, establishment_date = #{establishmentDate}, - creator = #{creator}, + create_by = #{createBy}, create_time = #{createTime}, update_time = #{updateTime}, - updater = #{updater}, - deleted = #{deleted}, + update_by = #{updateBy}, + del_flag = #{delFlag}, where id = #{id} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index ea6a912..636da69 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -198,6 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" nick_name = #{nickName}, real_name = #{realName}, email = #{email}, + audit = #{audit}, user_type = #{userType}, phonenumber = #{phonenumber}, sex = #{sex},