diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java index c41c6e0..d9b69d4 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.infra.api.file; +import java.util.Map; + /** * 文件 API 接口 * @@ -13,7 +15,7 @@ public interface FileApi { * @param content 文件内容 * @return 文件路径 */ - default String createFile(byte[] content) { + default Map createFile(byte[] content) { return createFile(null, null, content); } @@ -24,7 +26,7 @@ public interface FileApi { * @param content 文件内容 * @return 文件路径 */ - default String createFile(String path, byte[] content) { + default Map createFile(String path, byte[] content) { return createFile(null, path, content); } @@ -36,6 +38,6 @@ public interface FileApi { * @param content 文件内容 * @return 文件路径 */ - String createFile(String name, String path, byte[] content); + Map createFile(String name, String path, byte[] content); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java index 05fb946..1467985 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java @@ -5,6 +5,7 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.Map; /** * 文件 API 实现类 @@ -19,7 +20,7 @@ public class FileApiImpl implements FileApi { private FileService fileService; @Override - public String createFile(String name, String path, byte[] content) { + public Map createFile(String name, String path, byte[] content) { return fileService.createFile(name, path, content); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java index 8b2ce4f..9dfc7ab 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java @@ -25,6 +25,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.util.Map; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils.writeAttachment; @@ -40,7 +42,7 @@ public class FileController { @PostMapping("/upload") @Operation(summary = "上传文件", description = "模式一:后端上传文件") - public CommonResult uploadFile(FileUploadReqVO uploadReqVO) throws Exception { + public CommonResult> uploadFile(FileUploadReqVO uploadReqVO) throws Exception { MultipartFile file = uploadReqVO.getFile(); String path = uploadReqVO.getPath(); return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java index 0c568e5..4b46573 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java @@ -17,6 +17,8 @@ import javax.annotation.Resource; import javax.annotation.security.PermitAll; import javax.validation.Valid; +import java.util.Map; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "用户 App - 文件存储") @@ -32,7 +34,7 @@ public class AppFileController { @PostMapping("/upload") @Operation(summary = "上传文件") @PermitAll - public CommonResult uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception { + public CommonResult> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception { MultipartFile file = uploadReqVO.getFile(); String path = uploadReqVO.getPath(); return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java index 3ca9a24..8d6f404 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO; import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import java.util.Map; + /** * 文件 Service 接口 * @@ -29,7 +31,7 @@ public interface FileService { * @param content 文件内容 * @return 文件路径 */ - String createFile(String name, String path, byte[] content); + Map createFile(String name, String path, byte[] content); /** * 创建文件 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java index 8efa5fe..3f741f9 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java @@ -18,6 +18,9 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS; @@ -42,7 +45,7 @@ public class FileServiceImpl implements FileService { @Override @SneakyThrows - public String createFile(String name, String path, byte[] content) { + public Map createFile(String name, String path, byte[] content) { // 计算默认的 path 名 String type = FileTypeUtils.getMineType(content, name); if (StrUtil.isEmpty(path)) { @@ -67,7 +70,11 @@ public class FileServiceImpl implements FileService { file.setType(type); file.setSize(content.length); fileMapper.insert(file); - return url; + + Map map = new HashMap<>(); + map.put("url", url); + map.put("file_id", file.getId().toString()); + return map; } @Override diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 7ba08ee..af5ae8e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -164,8 +164,16 @@ public interface ErrorCodeConstants { // ========== 站内信发送 1-002-028-000 ========== ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失"); - //==========企业信息相关 1-002-029-000 + //==========企业信息相关 1-003-000-000 ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1-003-000-000, "企业不存在"); ErrorCode ENTERPRISE_QUALIFICATION_NOT_EXISTS = new ErrorCode(1-003-000-001, "企业资质不存在"); + ErrorCode INSERT_ERROR = new ErrorCode(1-003-000-001, "添加失败"); + + //===============文件相关====================/ + ErrorCode FILE_INFO_NOT_EXISTS = new ErrorCode(1-003-001-000, "文件不存在"); + + ErrorCode USER_AUDIT_LOG_NOT_EXISTS = new ErrorCode(1-003-001-001, "用户审核日志不存在"); + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index ae69716..dee9191 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java @@ -5,9 +5,11 @@ import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; import cn.iocoder.yudao.framework.security.config.SecurityProperties; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.system.api.social.dto.SocialWxQrcodeReqDTO; +import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; @@ -19,6 +21,7 @@ import cn.iocoder.yudao.module.system.service.permission.MenuService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.social.SocialClientService; +import cn.iocoder.yudao.module.system.service.social.SocialUserService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -63,6 +66,9 @@ public class AuthController { @Resource private SecurityProperties securityProperties; + @Resource + private SocialUserService socialUserService; + @PostMapping("/login") @PermitAll @Operation(summary = "使用账号密码登录") @@ -74,7 +80,21 @@ public class AuthController { @PostMapping("/app_login") @Operation(summary = "社交快捷登录,使用 code 授权码") public CommonResult login(@RequestBody @Valid AuthSocialLoginReqVO reqVO) { - return success(authService.miniAppLogin(reqVO)); + final AdminUserDO user = authService.miniAppLogin(reqVO); + + if (!user.getIsBand()) { + //添加绑定 + SocialUserBindReqDTO userBindReqDTO = new SocialUserBindReqDTO(); + userBindReqDTO.setUserId(user.getId()); + userBindReqDTO.setUserType(UserTypeEnum.MEMBER.getValue()); + userBindReqDTO.setCode(reqVO.getCode()); + userBindReqDTO.setSocialType(reqVO.getType()); + userBindReqDTO.setState(reqVO.getState()); + socialUserService.bindSocialUser(userBindReqDTO); + //给用户添加默认角色 + } + + return success(authService.createTokenAfterLoginSuccess2(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL)); } @PermitAll @@ -106,6 +126,7 @@ public class AuthController { @GetMapping("/get-permission-info") @Operation(summary = "获取登录用户的权限信息") + @DataPermission(enable = false) public CommonResult getPermissionInfo() { // 1.1 获得用户信息 AdminUserDO user = userService.getUser(getLoginUserId()); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java index c26acb8..bd34483 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java @@ -41,12 +41,24 @@ public class AuthPermissionInfoRespVO { @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") private String nickname; + @Schema(description = "用户真实姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") + private String realName; + @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.jpg") private String avatar; @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") private Long deptId; + @Schema(description = "用户手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") + private String mobile; + + @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") + private Integer sex; + + @Schema(description = "用户审核状态", example = "1") + private Integer audit; + } @Schema(description = "管理后台 - 登录用户的菜单信息 Response VO") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java index 86cdeed..3425c20 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.dept; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO; @@ -58,7 +59,7 @@ public class DeptController { @GetMapping("/list") @Operation(summary = "获取部门列表") - @PreAuthorize("@ss.hasPermission('system:dept:query')") +// @PreAuthorize("@ss.hasPermission('system:dept:query')") public CommonResult> getDeptList(DeptListReqVO reqVO) { List list = deptService.getDeptList(reqVO); return success(BeanUtils.toBean(list, DeptRespVO.class)); @@ -66,6 +67,7 @@ public class DeptController { @GetMapping(value = {"/list-all-simple", "/simple-list"}) @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项") + @DataPermission(enable = false) public CommonResult> getSimpleDeptList() { List list = deptService.getDeptList( new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java index d7402a1..0326343 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java @@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.system.service.dict.DictDataService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.ibatis.annotations.Param; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -25,6 +26,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -72,6 +74,15 @@ public class DictDataController { return success(BeanUtils.toBean(list, DictDataSimpleRespVO.class)); } + @GetMapping("/lists_dict_type") + @Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地") + // 无需添加权限认证,因为前端全局都需要 + public CommonResult>> getListDictType(@Param("type") String[] type) { + + Map> list = dictDataService.getDictTypeList(type); + return success(list); + } + @GetMapping("/page") @Operation(summary = "/获得字典类型的分页列表") @PreAuthorize("@ss.hasPermission('system:dict:query')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java index 8a33aaf..b413430 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java @@ -62,4 +62,7 @@ public class EnterpriseSaveReqVO { @Schema(description = "管理部门", example = "26433") private Long managerDeptId; + @Schema(description = "文件id", example = "26433") + private Long[] fileIds; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/FileInfoController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/FileInfoController.java new file mode 100644 index 0000000..ce719be --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/FileInfoController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.system.controller.admin.fileInfo; + +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 附件信息") +@RestController +@RequestMapping("/system/file-info") +@Validated +public class FileInfoController { + + @Resource + private FileInfoService fileInfoService; + + @PostMapping("/create") + @Operation(summary = "创建附件信息") + @PreAuthorize("@ss.hasPermission('system:file-info:create')") + public CommonResult createFileInfo(@Valid @RequestBody FileInfoSaveReqVO createReqVO) { + return success(fileInfoService.createFileInfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新附件信息") + @PreAuthorize("@ss.hasPermission('system:file-info:update')") + public CommonResult updateFileInfo(@Valid @RequestBody FileInfoSaveReqVO updateReqVO) { + fileInfoService.updateFileInfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除附件信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:file-info:delete')") + public CommonResult deleteFileInfo(@RequestParam("id") Long id) { + fileInfoService.deleteFileInfo(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得附件信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:file-info:query')") + public CommonResult getFileInfo(@RequestParam("id") Long id) { + FileInfoDO fileInfo = fileInfoService.getFileInfo(id); + return success(BeanUtils.toBean(fileInfo, FileInfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得附件信息分页") + @PreAuthorize("@ss.hasPermission('system:file-info:query')") + public CommonResult> getFileInfoPage(@Valid FileInfoPageReqVO pageReqVO) { + PageResult pageResult = fileInfoService.getFileInfoPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, FileInfoRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出附件信息 Excel") + @PreAuthorize("@ss.hasPermission('system:file-info:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportFileInfoExcel(@Valid FileInfoPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = fileInfoService.getFileInfoPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "附件信息.xls", "数据", FileInfoRespVO.class, + BeanUtils.toBean(list, FileInfoRespVO.class)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoPageReqVO.java new file mode 100644 index 0000000..780f2ce --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoPageReqVO.java @@ -0,0 +1,49 @@ +package cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 附件信息分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class FileInfoPageReqVO extends PageParam { + + @Schema(description = "关联ID(日报/案件/行动...)", example = "16715") + private String unitId; + + @Schema(description = "类型", example = "1") + private Long type; + + @Schema(description = "状态") + private Long dictData; + + @Schema(description = "部门ID", example = "2") + private Long dictType; + + @Schema(description = "文件分组ID", example = "10196") + private Long groupId; + + @Schema(description = "文件权限(英文分号分隔)") + private String permissions; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "关联IDString类型") + private String unitIdStr; + + @Schema(description = "目标ID", example = "13176") + private Long targetId; + + @Schema(description = "文件id", example = "19961") + private Long infraFileId; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoRespVO.java new file mode 100644 index 0000000..f3deea5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoRespVO.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 附件信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class FileInfoRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32022") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "关联ID(日报/案件/行动...)", example = "16715") + @ExcelProperty("关联ID(日报/案件/行动...)") + private String unitId; + + @Schema(description = "类型", example = "1") + @ExcelProperty("类型") + private Long type; + + @Schema(description = "状态") + @ExcelProperty("状态") + private Long dictData; + + @Schema(description = "部门ID", example = "2") + @ExcelProperty("部门ID") + private Long dictType; + + @Schema(description = "文件分组ID", example = "10196") + @ExcelProperty("文件分组ID") + private Long groupId; + + @Schema(description = "文件权限(英文分号分隔)") + @ExcelProperty("文件权限(英文分号分隔)") + private String permissions; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "关联IDString类型") + @ExcelProperty("关联IDString类型") + private String unitIdStr; + + @Schema(description = "目标ID", example = "13176") + @ExcelProperty("目标ID") + private Long targetId; + + @Schema(description = "文件id", example = "19961") + @ExcelProperty("文件id") + private Long infraFileId; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoSaveReqVO.java new file mode 100644 index 0000000..fdfe7e0 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/fileInfo/vo/FileInfoSaveReqVO.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +@Schema(description = "管理后台 - 附件信息新增/修改 Request VO") +@Data +public class FileInfoSaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32022") + private Long id; + + @Schema(description = "关联ID(日报/案件/行动...)", example = "16715") + private String unitId; + + @Schema(description = "类型", example = "1") + private Long type; + + @Schema(description = "状态") + private Long dictData; + + @Schema(description = "部门ID", example = "2") + private Long dictType; + + @Schema(description = "文件分组ID", example = "10196") + private Long groupId; + + @Schema(description = "文件权限(英文分号分隔)") + private String permissions; + + @Schema(description = "关联IDString类型") + private String unitIdStr; + + @Schema(description = "目标ID", example = "13176") + private Long targetId; + + @Schema(description = "文件id", example = "19961") + private Long infraFileId; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java index 3f7dc61..3b89970 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java @@ -8,12 +8,16 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO; import cn.iocoder.yudao.module.system.convert.user.UserConvert; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog.UserAuditLogDO; +import cn.iocoder.yudao.module.system.dal.mysql.userAuditlog.UserAuditLogMapper; import cn.iocoder.yudao.module.system.enums.common.SexEnum; import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -45,6 +49,8 @@ public class UserController { private AdminUserService userService; @Resource private DeptService deptService; + @Resource + private UserAuditLogMapper userAuditLogMapper; @PostMapping("/create") @Operation(summary = "新增用户") @@ -96,6 +102,19 @@ public class UserController { if (CollUtil.isEmpty(pageResult.getList())) { return success(new PageResult<>(pageResult.getTotal())); } + + pageResult.getList().forEach(item->{ + if (item.getAudit() == 3) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(UserAuditLogDO::getUserId, item.getId()); + wrapper.orderByDesc(UserAuditLogDO::getCreateTime); + wrapper.last("limit 1"); + UserAuditLogDO userAuditLogDO = userAuditLogMapper.selectOne(wrapper); + item.setContent(userAuditLogDO.getContent()); + } + }); + + // 拼接数据 Map deptMap = deptService.getDeptMap( convertList(pageResult.getList(), AdminUserDO::getDeptId)); @@ -169,4 +188,12 @@ public class UserController { return success(userService.importUserList(list, updateSupport)); } + @PutMapping("/user_audit") + @Operation(summary = "用户审核") + @PreAuthorize("@ss.hasPermission('system:user:update')") + public CommonResult userAudit(@Valid @RequestBody UserAuditLogSaveReqVO auditLogSaveReqVO) { + userService.userAudit(auditLogSaveReqVO); + return success(true); + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java index 5fc4cac..ecaa4d5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java @@ -61,6 +61,7 @@ public class UserProfileController { public CommonResult getUserProfile() { // 获得用户基本信息 AdminUserDO user = userService.getUser(getLoginUserId()); + // 获得用户角色 List userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId())); // 获得部门信息 @@ -74,6 +75,7 @@ public class UserProfileController { @PutMapping("/update") @Operation(summary = "修改用户个人信息") + @DataPermission(enable = false) public CommonResult updateUserProfile(@Valid @RequestBody UserProfileUpdateReqVO reqVO) { userService.updateUserProfile(getLoginUserId(), reqVO); return success(true); @@ -97,4 +99,17 @@ public class UserProfileController { return success(avatar); } +// @RequestMapping(value = "/update-avatar_new", +// method = {RequestMethod.POST, RequestMethod.PUT}) // 解决 uni-app 不支持 Put 上传文件的问题 +// @Operation(summary = "上传用户个人头像") +// public CommonResult updateUserAvatarNew(String file) throws Exception { +// if (file.isEmpty()) { +// throw exception(FILE_IS_EMPTY); +// } +// String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream()); +// return success(avatar); +// } + + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java index 4f7c71e..061f356 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java @@ -22,6 +22,9 @@ public class UserProfileRespVO { @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") private String nickname; + @Schema(description = "真实姓名", example = "芋艿") + private String realName; + @Schema(description = "用户邮箱", example = "yudao@iocoder.cn") private String email; @@ -43,6 +46,9 @@ public class UserProfileRespVO { @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") private LocalDateTime createTime; + @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long deptId; + /** * 所属角色 */ @@ -59,6 +65,10 @@ public class UserProfileRespVO { * 社交用户数组 */ private List socialUsers; + //用户类型 + private Integer userType; + //审核状态 + private Integer audit; @Schema(description = "社交用户") @Data diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java index f1e54ac..3b23944 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java @@ -12,10 +12,14 @@ import javax.validation.constraints.Size; @Data public class UserProfileUpdateReqVO { - @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @Schema(description = "用户昵称", example = "芋艿") @Size(max = 30, message = "用户昵称长度不能超过 30 个字符") private String nickname; + @Schema(description = "真实姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @Size(max = 50, message = "用户真实姓名长度不能超过 30 个字符") + private String realName; + @Schema(description = "用户邮箱", example = "yudao@iocoder.cn") @Email(message = "邮箱格式不正确") @Size(max = 50, message = "邮箱长度不能超过 50 个字符") @@ -28,4 +32,13 @@ public class UserProfileUpdateReqVO { @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") private Integer sex; + @Schema(description = "用户头像", example = "https://iocoder.cn") + private String avatar; + + @Schema(description = "部门", example = "1") + private Long deptId; + + @Schema(description = "审核状态", example = "1") + private Integer audit; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java index 7dadb51..5b01458 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java @@ -37,5 +37,10 @@ public class UserPageReqVO extends PageParam { @Schema(description = "角色编号", example = "1024") private Long roleId; + //用户类型 + private Long[] userType; + //审核状态 + private Integer[] audit; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java index 2837318..a9b9c6e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java @@ -72,4 +72,16 @@ public class UserRespVO{ @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") private LocalDateTime createTime; + @Schema(description = "审核状态", example = "1") + private Integer audit; + + @Schema(description = "不通过原因", example = "1") + private String content; + + @Schema(description = "真实姓名", example = "张三") + private String realName; + + @Schema(description = "用户类型", example = "1") + private Integer userType; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/UserAuditLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/UserAuditLogController.java new file mode 100644 index 0000000..c1a5a28 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/UserAuditLogController.java @@ -0,0 +1,98 @@ +package cn.iocoder.yudao.module.system.controller.admin.userAuditlog; + +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog.UserAuditLogDO; +import cn.iocoder.yudao.module.system.service.userAuditlog.UserAuditLogService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 用户审核日志") +@RestController +@RequestMapping("/system/user-audit-log") +@Validated +public class UserAuditLogController { + + @Resource + private UserAuditLogService userAuditLogService; + + @PostMapping("/create") + @Operation(summary = "创建用户审核日志") + @PreAuthorize("@ss.hasPermission('system:user-audit-log:create')") + public CommonResult createUserAuditLog(@Valid @RequestBody UserAuditLogSaveReqVO createReqVO) { + return success(userAuditLogService.createUserAuditLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新用户审核日志") + @PreAuthorize("@ss.hasPermission('system:user-audit-log:update')") + public CommonResult updateUserAuditLog(@Valid @RequestBody UserAuditLogSaveReqVO updateReqVO) { + userAuditLogService.updateUserAuditLog(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除用户审核日志") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:user-audit-log:delete')") + public CommonResult deleteUserAuditLog(@RequestParam("id") Long id) { + userAuditLogService.deleteUserAuditLog(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得用户审核日志") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:user-audit-log:query')") + public CommonResult getUserAuditLog(@RequestParam("id") Long id) { + UserAuditLogDO userAuditLog = userAuditLogService.getUserAuditLog(id); + return success(BeanUtils.toBean(userAuditLog, UserAuditLogRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得用户审核日志分页") + @PreAuthorize("@ss.hasPermission('system:user-audit-log:query')") + public CommonResult> getUserAuditLogPage(@Valid UserAuditLogPageReqVO pageReqVO) { + PageResult pageResult = userAuditLogService.getUserAuditLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, UserAuditLogRespVO.class)); + } + + + + + @GetMapping("/export-excel") + @Operation(summary = "导出用户审核日志 Excel") + @PreAuthorize("@ss.hasPermission('system:user-audit-log:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportUserAuditLogExcel(@Valid UserAuditLogPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = userAuditLogService.getUserAuditLogPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "用户审核日志.xls", "数据", UserAuditLogRespVO.class, + BeanUtils.toBean(list, UserAuditLogRespVO.class)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogPageReqVO.java new file mode 100644 index 0000000..a88e849 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogPageReqVO.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 用户审核日志分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class UserAuditLogPageReqVO extends PageParam { + + @Schema(description = "用户id", example = "31581") + private Long userId; + + @Schema(description = "驳回内容") + private String content; + + @Schema(description = "审批状态", example = "1") + private String status; + + @Schema(description = "用户类型", example = "1") + private Integer userType; + + @Schema(description = "审核状态", example = "1") + private Integer audit; + + @Schema(description = "创建者") + private String createBy; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "更新者") + private String updateBy; + + + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogRespVO.java new file mode 100644 index 0000000..9467f7e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogRespVO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 用户审核日志 Response VO") +@Data +@ExcelIgnoreUnannotated +public class UserAuditLogRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21155") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31581") + @ExcelProperty("用户id") + private Long userId; + + @Schema(description = "驳回内容") + @ExcelProperty("驳回内容") + private String content; + + @Schema(description = "审批状态", example = "1") + @ExcelProperty("审批状态") + private Integer audit; + + @Schema(description = "创建者") + @ExcelProperty("创建者") + private String createBy; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "更新者") + @ExcelProperty("更新者") + private String updateBy; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogSaveReqVO.java new file mode 100644 index 0000000..ac559b2 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/userAuditlog/vo/UserAuditLogSaveReqVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.NotNull; +import java.util.*; + +@Schema(description = "管理后台 - 用户审核日志新增/修改 Request VO") +@Data +public class UserAuditLogSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21155") + private Long id; + + @Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31581") + @NotNull(message = "用户id不能为空") + private Long userId; + + @Schema(description = "驳回内容") + private String content; + + @Schema(description = "审批状态", example = "1") + private Integer audit; + + @Schema(description = "创建者") + private String createBy; + + @Schema(description = "更新者") + private String updateBy; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/fileInfo/FileInfoDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/fileInfo/FileInfoDO.java new file mode 100644 index 0000000..0daddb6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/fileInfo/FileInfoDO.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.fileInfo; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 附件信息 DO + * + * @author 芋道源码 + */ +@TableName("file_info") +@KeySequence("file_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class FileInfoDO extends BaseDO { + + /** + * ID + */ + @TableId + private Long id; + /** + * 关联ID(日报/案件/行动...) + */ + private String unitId; + /** + * 类型 + */ + private Long type; + /** + * 状态 + */ + private Long dictData; + /** + * 部门ID + */ + private Long dictType; + /** + * 文件分组ID + */ + private Long groupId; + /** + * 文件权限(英文分号分隔) + */ + private String permissions; + /** + * 关联IDString类型 + */ + private String unitIdStr; + /** + * 目标ID + */ + private Long targetId; + /** + * 文件id + */ + private Long infraFileId; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialUserDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialUserDO.java index f3adf03..230a8d7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialUserDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialUserDO.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.dataobject.social; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java index 2f07a30..1580ecc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java @@ -47,6 +47,11 @@ public class AdminUserDO extends TenantBaseDO { * 用户昵称 */ private String nickname; + + /** + * 真是姓名 + */ + private String realName; /** * 备注 */ @@ -93,4 +98,16 @@ public class AdminUserDO extends TenantBaseDO { */ private LocalDateTime loginDate; + @TableField(exist = false) + private Boolean isBand; + + private Integer userType; + + //审核状态 + private Integer audit; + + //审核状态 + @TableField(exist = false) + private String content; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/userAuditlog/UserAuditLogDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/userAuditlog/UserAuditLogDO.java new file mode 100644 index 0000000..37a0abc --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/userAuditlog/UserAuditLogDO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 用户审核日志 DO + * + * @author 芋道源码 + */ +@TableName("user_audit_log") +@KeySequence("user_audit_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class UserAuditLogDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 用户id + */ + private Long userId; + /** + * 驳回内容 + */ + private String content; + /** + * 审批状态 + */ + private Integer audit; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/fileInfo/FileInfoMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/fileInfo/FileInfoMapper.java new file mode 100644 index 0000000..0eb7606 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/fileInfo/FileInfoMapper.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.system.dal.mysql.fileInfo; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*; + +/** + * 附件信息 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface FileInfoMapper extends BaseMapperX { + + default PageResult selectPage(FileInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(FileInfoDO::getUnitId, reqVO.getUnitId()) + .eqIfPresent(FileInfoDO::getType, reqVO.getType()) + .eqIfPresent(FileInfoDO::getDictData, reqVO.getDictData()) + .eqIfPresent(FileInfoDO::getDictType, reqVO.getDictType()) + .eqIfPresent(FileInfoDO::getGroupId, reqVO.getGroupId()) + .eqIfPresent(FileInfoDO::getPermissions, reqVO.getPermissions()) + .betweenIfPresent(FileInfoDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(FileInfoDO::getUnitIdStr, reqVO.getUnitIdStr()) + .eqIfPresent(FileInfoDO::getTargetId, reqVO.getTargetId()) + .eqIfPresent(FileInfoDO::getInfraFileId, reqVO.getInfraFileId()) + .orderByDesc(FileInfoDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java index c0c9be8..bd4dcd1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java @@ -33,6 +33,8 @@ public interface AdminUserMapper extends BaseMapperX { .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) .inIfPresent(AdminUserDO::getDeptId, deptIds) .inIfPresent(AdminUserDO::getId, userIds) + .inIfPresent(AdminUserDO::getAudit, reqVO.getAudit()) + .inIfPresent(AdminUserDO::getUserType, reqVO.getUserType()) .orderByDesc(AdminUserDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/userAuditlog/UserAuditLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/userAuditlog/UserAuditLogMapper.java new file mode 100644 index 0000000..c671b56 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/userAuditlog/UserAuditLogMapper.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.system.dal.mysql.userAuditlog; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog.UserAuditLogDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.*; + +/** + * 用户审核日志 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface UserAuditLogMapper extends BaseMapperX { + + default PageResult selectPage(UserAuditLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(UserAuditLogDO::getUserId, reqVO.getUserId()) + .eqIfPresent(UserAuditLogDO::getContent, reqVO.getContent()) + .eqIfPresent(UserAuditLogDO::getAudit, reqVO.getStatus()) + .betweenIfPresent(UserAuditLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(UserAuditLogDO::getId)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java index 4d86fda..ca766eb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.auth; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; import javax.validation.Valid; @@ -88,7 +89,9 @@ public interface AdminAuthService { * @param reqVO 登录信息 * @return 登录结果 */ - AuthLoginRespVO miniAppLogin(AuthSocialLoginReqVO reqVO); + AdminUserDO miniAppLogin(AuthSocialLoginReqVO reqVO); + + AuthLoginRespVO createTokenAfterLoginSuccess2(Long userId, String username, LoginLogTypeEnum logType); /** diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index 7d74da3..e354da5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -13,9 +13,11 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserBindDO; import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.social.SocialClientMapper; +import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper; import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper; import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum; @@ -74,6 +76,8 @@ public class AdminAuthServiceImpl implements AdminAuthService { private SmsCodeApi smsCodeApi; @Resource private SocialUserMapper socialUserMapper; + @Resource + private SocialUserBindMapper socialUserBindMapper; /** * 验证码的开关,默认为 true @@ -214,6 +218,17 @@ public class AdminAuthServiceImpl implements AdminAuthService { return AuthConvert.INSTANCE.convert(accessTokenDO); } + @Override + public AuthLoginRespVO createTokenAfterLoginSuccess2(Long userId, String username, LoginLogTypeEnum logType) { + // 插入登陆日志 + createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS); + // 创建访问令牌 + OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, getUserType().getValue(), + OAuth2ClientConstants.CLIENT_ID_DEFAULT, null); + // 构建返回结果 + return AuthConvert.INSTANCE.convert(accessTokenDO); + } + @Override public AuthLoginRespVO refreshToken(String refreshToken) { OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT); @@ -280,7 +295,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { */ @Override @Transactional - public AuthLoginRespVO miniAppLogin(AuthSocialLoginReqVO reqVO) { + public AdminUserDO miniAppLogin(AuthSocialLoginReqVO reqVO) { AuthUser authUser = socialClientService.getAuthUser( SocialTypeEnum.WECHAT_MINI_APP.getType(), @@ -289,49 +304,45 @@ public class AdminAuthServiceImpl implements AdminAuthService { reqVO.getState() ); - SocialUserRespDTO respDTO = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), UserTypeEnum.MEMBER.getValue(), - reqVO.getCode(), reqVO.getState()); + final SocialUserDO socialUserDO = socialUserService.selectBySocialTypeAndOpenId(SocialTypeEnum.WECHAT_MINI_APP.getType(), authUser.getUuid()); AdminUserDO user = null; - if (respDTO == null ) { + if (socialUserDO == null ) { // 未找到社交用户,插入记录 SocialUserDO socialUser = new SocialUserDO(); socialUser.setType(reqVO.getType()); socialUser.setOpenid(authUser.getUuid()); socialUser.setCode(reqVO.getCode()); socialUser.setAvatar(authUser.getAvatar()); - socialUser.setRawTokenInfo(authUser.getToken().getRefreshToken()); + socialUser.setRawTokenInfo(authUser.getToken().getRefreshToken() != null? authUser.getToken().getRefreshToken(): "default" ); socialUser.setNickname(authUser.getNickname()); - socialUser.setRawUserInfo(authUser.getRawUserInfo().toJSONString()); + socialUser.setState(reqVO.getState()); + socialUser.setRawUserInfo(authUser.getRawUserInfo() != null? authUser.getRawUserInfo().toString(): "default"); final int insert = socialUserMapper.insert(socialUser); if (insert < 0) { - throw exception(USER_NOT_EXISTS); + throw exception(INSERT_ERROR); } user = userService.autoRegisterUser(authUser); - //添加绑定 - SocialUserBindReqDTO userBindReqDTO = new SocialUserBindReqDTO(); - userBindReqDTO.setUserId(user.getId()); - userBindReqDTO.setUserType(SocialTypeEnum.WECHAT_MINI_APP.getType()); - userBindReqDTO.setCode(reqVO.getCode()); - userBindReqDTO.setSocialType(reqVO.getType()); - userBindReqDTO.setState(reqVO.getState()); - socialUserService.bindSocialUser(userBindReqDTO); + //给一个默认的普通用户的角色 - return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL); + user.setIsBand(false); } else { + + SocialUserBindDO bind = socialUserBindMapper.selectByUserTypeAndSocialUserId(UserTypeEnum.MEMBER.getValue(), socialUserDO.getId()); // 获得用户 - user = userService.getUser(respDTO.getUserId()); + user = userService.getUser(bind.getUserId()); + user.setIsBand(true); + if (user == null) { throw exception(USER_NOT_EXISTS); } - } - return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL); + return user; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java index fc2498f..3be08d5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java @@ -8,6 +8,7 @@ import org.springframework.lang.Nullable; import java.util.Collection; import java.util.List; +import java.util.Map; /** * 字典数据 Service 接口 @@ -107,4 +108,5 @@ public interface DictDataService { */ List getDictDataListByDictType(String dictType); + Map> getDictTypeList(String[] type); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java index e9f215d..57334d6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java @@ -15,10 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.Map; +import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; @@ -176,4 +173,13 @@ public class DictDataServiceImpl implements DictDataService { return list; } + @Override + public Map> getDictTypeList(String[] type) { + Map> dictTypeList = new HashMap<>(); + for (String dictType : type) { + dictTypeList.put( dictType,getDictDataListByDictType(dictType)); + } + return dictTypeList; + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index 803ad90..eedf2a9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -1,5 +1,9 @@ package cn.iocoder.yudao.module.system.service.enterprise; +import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; +import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; +import org.apache.tomcat.jni.FileInfo; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -29,12 +33,28 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Resource private EnterpriseMapper enterpriseMapper; + @Resource + private FileInfoService fileInfoService; + @Resource + private FileInfoMapper fileInfoMapper; @Override public Long createEnterprise(EnterpriseSaveReqVO createReqVO) { // 插入 EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); enterpriseMapper.insert(enterprise); + + if (createReqVO.getFileIds().length > 0) { + for (Long fileId : createReqVO.getFileIds()) { + FileInfoDO fileInfoDO = new FileInfoDO(); + fileInfoDO.setDictData(1l); //文件类型 + fileInfoDO.setDictType(644l); + fileInfoDO.setUnitId(enterprise.getId().toString()); + fileInfoDO.setInfraFileId(fileId); + fileInfoMapper.insert(fileInfoDO); + } + } + // 返回 return enterprise.getId(); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java new file mode 100644 index 0000000..99ac82a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.fileInfo; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 附件信息 Service 接口 + * + * @author 芋道源码 + */ +public interface FileInfoService { + + /** + * 创建附件信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createFileInfo(@Valid FileInfoSaveReqVO createReqVO); + + /** + * 更新附件信息 + * + * @param updateReqVO 更新信息 + */ + void updateFileInfo(@Valid FileInfoSaveReqVO updateReqVO); + + /** + * 删除附件信息 + * + * @param id 编号 + */ + void deleteFileInfo(Long id); + + /** + * 获得附件信息 + * + * @param id 编号 + * @return 附件信息 + */ + FileInfoDO getFileInfo(Long id); + + /** + * 获得附件信息分页 + * + * @param pageReqVO 分页查询 + * @return 附件信息分页 + */ + PageResult getFileInfoPage(FileInfoPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java new file mode 100644 index 0000000..1f78139 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.system.service.fileInfo; + +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 附件信息 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class FileInfoServiceImpl implements FileInfoService { + + @Resource + private FileInfoMapper fileInfoMapper; + + @Override + public Long createFileInfo(FileInfoSaveReqVO createReqVO) { + // 插入 + FileInfoDO fileInfo = BeanUtils.toBean(createReqVO, FileInfoDO.class); + fileInfoMapper.insert(fileInfo); + // 返回 + return fileInfo.getId(); + } + + @Override + public void updateFileInfo(FileInfoSaveReqVO updateReqVO) { + // 校验存在 + validateFileInfoExists(updateReqVO.getId()); + // 更新 + FileInfoDO updateObj = BeanUtils.toBean(updateReqVO, FileInfoDO.class); + fileInfoMapper.updateById(updateObj); + } + + @Override + public void deleteFileInfo(Long id) { + // 校验存在 + validateFileInfoExists(id); + // 删除 + fileInfoMapper.deleteById(id); + } + + private void validateFileInfoExists(Long id) { + if (fileInfoMapper.selectById(id) == null) { + throw exception(FILE_INFO_NOT_EXISTS); + } + } + + @Override + public FileInfoDO getFileInfo(Long id) { + return fileInfoMapper.selectById(id); + } + + @Override + public PageResult getFileInfoPage(FileInfoPageReqVO pageReqVO) { + return fileInfoMapper.selectPage(pageReqVO); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java index 1c78c43..b6be9ee 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportEx import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import com.xingyuv.jushauth.model.AuthUser; @@ -227,4 +228,5 @@ public interface AdminUserService { **/ AdminUserDO autoRegisterUser(AuthUser authUser); + void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index ae9cd74..d8b12a3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -21,17 +21,21 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportEx import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO; import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog.UserAuditLogDO; import cn.iocoder.yudao.module.system.dal.mysql.dept.UserPostMapper; import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; +import cn.iocoder.yudao.module.system.dal.mysql.userAuditlog.UserAuditLogMapper; import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.tenant.TenantService; +import cn.iocoder.yudao.module.system.service.userAuditlog.UserAuditLogService; import com.google.common.annotations.VisibleForTesting; import com.mzt.logapi.context.LogRecordContext; import com.mzt.logapi.service.impl.DiffParseFunction; @@ -87,6 +91,8 @@ public class AdminUserServiceImpl implements AdminUserService { private FileApi fileApi; @Resource private ConfigApi configApi; + @Resource + private UserAuditLogMapper userAuditLogMapper; @Override @Transactional(rollbackFor = Exception.class) @@ -188,6 +194,17 @@ public class AdminUserServiceImpl implements AdminUserService { validateUserExists(id); validateEmailUnique(id, reqVO.getEmail()); validateMobileUnique(id, reqVO.getMobile()); + + final AdminUserDO adminUserDO = userMapper.selectById(id); + + if (adminUserDO == null) { + throw exception(USER_NOT_EXISTS); + } + + if (adminUserDO.getAudit() == null) { + reqVO.setAudit(1); + } + // 执行更新 userMapper.updateById(BeanUtils.toBean(reqVO, AdminUserDO.class).setId(id)); } @@ -206,13 +223,13 @@ public class AdminUserServiceImpl implements AdminUserService { public String updateUserAvatar(Long id, InputStream avatarFile) { validateUserExists(id); // 存储文件 - String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); + final Map file = fileApi.createFile(IoUtil.readBytes(avatarFile)); // 更新路径 AdminUserDO sysUserDO = new AdminUserDO(); sysUserDO.setId(id); - sysUserDO.setAvatar(avatar); + sysUserDO.setAvatar(file.get("url")); userMapper.updateById(sysUserDO); - return avatar; + return file.get("url"); } @Override @@ -544,6 +561,23 @@ public class AdminUserServiceImpl implements AdminUserService { return user; } + @Override + @Transactional + public void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO) { + final AdminUserDO adminUserDO = userMapper.selectById(auditLogSaveReqVO.getUserId()); + if (adminUserDO == null) { + throw exception(USER_NOT_EXISTS); + } + adminUserDO.setAudit(auditLogSaveReqVO.getAudit()); + + final int insert = userMapper.updateById(adminUserDO); + + if (insert > 0) { + userAuditLogMapper.insert(BeanUtils.toBean(auditLogSaveReqVO, UserAuditLogDO.class)); + } + + } + public void bindSocialUser(Long userId, AuthUser authUser) { // SocialUserDO socialUser = new SocialUserDO(); // socialUser.setUserId(userId); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/userAuditlog/UserAuditLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/userAuditlog/UserAuditLogService.java new file mode 100644 index 0000000..5d704c5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/userAuditlog/UserAuditLogService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.userAuditlog; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog.UserAuditLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 用户审核日志 Service 接口 + * + * @author 芋道源码 + */ +public interface UserAuditLogService { + + /** + * 创建用户审核日志 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createUserAuditLog(@Valid UserAuditLogSaveReqVO createReqVO); + + /** + * 更新用户审核日志 + * + * @param updateReqVO 更新信息 + */ + void updateUserAuditLog(@Valid UserAuditLogSaveReqVO updateReqVO); + + /** + * 删除用户审核日志 + * + * @param id 编号 + */ + void deleteUserAuditLog(Long id); + + /** + * 获得用户审核日志 + * + * @param id 编号 + * @return 用户审核日志 + */ + UserAuditLogDO getUserAuditLog(Long id); + + /** + * 获得用户审核日志分页 + * + * @param pageReqVO 分页查询 + * @return 用户审核日志分页 + */ + PageResult getUserAuditLogPage(UserAuditLogPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/userAuditlog/UserAuditLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/userAuditlog/UserAuditLogServiceImpl.java new file mode 100644 index 0000000..1cabd47 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/userAuditlog/UserAuditLogServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.system.service.userAuditlog; + +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.userAuditlog.UserAuditLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.userAuditlog.UserAuditLogMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 用户审核日志 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class UserAuditLogServiceImpl implements UserAuditLogService { + + @Resource + private UserAuditLogMapper userAuditLogMapper; + + @Override + public Long createUserAuditLog(UserAuditLogSaveReqVO createReqVO) { + // 插入 + UserAuditLogDO userAuditLog = BeanUtils.toBean(createReqVO, UserAuditLogDO.class); + userAuditLogMapper.insert(userAuditLog); + // 返回 + return userAuditLog.getId(); + } + + @Override + public void updateUserAuditLog(UserAuditLogSaveReqVO updateReqVO) { + // 校验存在 + validateUserAuditLogExists(updateReqVO.getId()); + // 更新 + UserAuditLogDO updateObj = BeanUtils.toBean(updateReqVO, UserAuditLogDO.class); + userAuditLogMapper.updateById(updateObj); + } + + @Override + public void deleteUserAuditLog(Long id) { + // 校验存在 + validateUserAuditLogExists(id); + // 删除 + userAuditLogMapper.deleteById(id); + } + + private void validateUserAuditLogExists(Long id) { + if (userAuditLogMapper.selectById(id) == null) { + throw exception(USER_AUDIT_LOG_NOT_EXISTS); + } + } + + @Override + public UserAuditLogDO getUserAuditLog(Long id) { + return userAuditLogMapper.selectById(id); + } + + @Override + public PageResult getUserAuditLogPage(UserAuditLogPageReqVO pageReqVO) { + return userAuditLogMapper.selectPage(pageReqVO); + } + +}