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 d9b69d4..46db718 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,6 @@ package cn.iocoder.yudao.module.infra.api.file; +import java.util.List; import java.util.Map; /** @@ -40,4 +41,6 @@ public interface FileApi { */ Map createFile(String name, String path, byte[] content); + List listFile(List ids); + } diff --git a/yudao-module-infra/yudao-module-infra-biz/pom.xml b/yudao-module-infra/yudao-module-infra-biz/pom.xml index 2416812..cee0f1a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/pom.xml +++ b/yudao-module-infra/yudao-module-infra-biz/pom.xml @@ -6,7 +6,7 @@ cn.iocoder.boot yudao-module-infra ${revision} - + org.apache.maven.pluginsmaven-compiler-plugin88 4.0.0 yudao-module-infra-biz jar 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 1467985..8dcdaf5 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.List; import java.util.Map; /** @@ -24,4 +25,10 @@ public class FileApiImpl implements FileApi { return fileService.createFile(name, path, content); } + @Override + public List listFile(List ids) { + return fileService.listFile(ids); + } + + } 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 8d6f404..d626575 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,7 @@ 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.List; import java.util.Map; /** @@ -65,4 +66,5 @@ public interface FileService { */ FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception; + List listFile(List ids); } 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 3f741f9..d51a61d 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 @@ -13,13 +13,17 @@ 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 cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.SneakyThrows; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS; @@ -121,4 +125,11 @@ public class FileServiceImpl implements FileService { object -> object.setConfigId(fileClient.getId())); } + @Override + public List listFile(List ids) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(FileDO::getId, ids); + return fileMapper.selectList(wrapper).stream().map(FileDO::getUrl).collect(Collectors.toList()); + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index ac7da65..63089a7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -1,7 +1,16 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise; import cn.iocoder.yudao.module.infra.api.file.FileApi; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper; +import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; +import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; +import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; @@ -12,6 +21,7 @@ import io.swagger.v3.oas.annotations.Operation; import java.util.*; import java.io.IOException; +import java.util.stream.Collectors; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -42,9 +52,13 @@ public class EnterpriseController { @Resource private EnterpriseService enterpriseService; @Resource - private FileInfoService fileInfoService; + private FileInfoMapper fileInfoMapper; @Resource private FileApi fileApi; + @Resource + private EnterpriseQualificationMapper enterpriseQualificationMapper; + @Resource + private EnterpriseAuditLogMapper enterpriseAuditLogMapper; @PostMapping("/create") @Operation(summary = "创建企业") @@ -73,9 +87,28 @@ public class EnterpriseController { @GetMapping("/get") @Operation(summary = "获得企业") @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('system:enterprise:query')") +// @PreAuthorize("@ss.hasPermission('system:enterprise:query')") public CommonResult getEnterprise(@RequestParam("id") Long id) { EnterpriseDO enterprise = enterpriseService.getEnterprise(id); + + //获取企业图片 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FileInfoDO::getDictType, 644l); + wrapper.eq(FileInfoDO::getDictData, 1l); + wrapper.eq(FileInfoDO::getUnitId, enterprise.getId()); + final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); + + if (!collect.isEmpty()) { + final List list = fileApi.listFile(collect); + enterprise.setFiles(list); + } + + //获取资质 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(EnterpriseQualificationDO::getEnterpriseId, enterprise.getId()); + final List enterpriseQualificationList = enterpriseQualificationMapper.selectList(queryWrapper); + enterprise.setQualificationList(enterpriseQualificationList); + return success(BeanUtils.toBean(enterprise, EnterpriseRespVO.class)); } @@ -90,11 +123,31 @@ public class EnterpriseController { @GetMapping("/getEnterpriseByUserId") @Operation(summary = "用户获得所属企业列表") - public CommonResult> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) { - List pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO); -// pageResult.forEach(item->{ -// -// }); + public CommonResult> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) { + final PageResult pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO); + + pageResult.getList().forEach(item->{ + //企业审核状态 + QueryWrapper auditLogDOQueryWrapper = new QueryWrapper<>(); + auditLogDOQueryWrapper.eq("enterprise_id", item.getId()); + EnterpriseAuditLogDO enterpriseAuditLogDO = enterpriseAuditLogMapper.selectOne(auditLogDOQueryWrapper); + if (enterpriseAuditLogDO != null) { + item.setAudit(enterpriseAuditLogDO.getAudit()); + } + + //企业图片 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FileInfoDO::getDictType, 644l); + wrapper.eq(FileInfoDO::getDictData, 1l); + wrapper.eq(FileInfoDO::getUnitId, item.getId()); + final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); + + if (!collect.isEmpty()) { + final List list = fileApi.listFile(collect); + item.setFiles(list); + } + + }); return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java index 05c4638..e460662 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise.vo; +import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -82,4 +83,14 @@ public class EnterpriseRespVO { @ExcelProperty("管理部门") private Long deptId; + @Schema(description = "审核状态", example = "26433") + @ExcelProperty("审核状态") + private Integer audit; + + @Schema(description = "企业图片", example = "26433") + private List files; + + @Schema(description = "企业资质列表", example = "26433") + private List qualificationList; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/EnterpriseAuditLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/EnterpriseAuditLogController.java new file mode 100644 index 0000000..fb6f986 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/EnterpriseAuditLogController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseauditlog; + +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.enterpriseauditlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO; +import cn.iocoder.yudao.module.system.service.enterpriseauditlog.EnterpriseAuditLogService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 企业审核") +@RestController +@RequestMapping("/system/enterprise-audit-log") +@Validated +public class EnterpriseAuditLogController { + + @Resource + private EnterpriseAuditLogService enterpriseAuditLogService; + + @PostMapping("/create") + @Operation(summary = "创建企业审核") + @PreAuthorize("@ss.hasPermission('system:enterprise-audit-log:create')") + public CommonResult createEnterpriseAuditLog(@Valid @RequestBody EnterpriseAuditLogSaveReqVO createReqVO) { + return success(enterpriseAuditLogService.createEnterpriseAuditLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业审核") + @PreAuthorize("@ss.hasPermission('system:enterprise-audit-log:update')") + public CommonResult updateEnterpriseAuditLog(@Valid @RequestBody EnterpriseAuditLogSaveReqVO updateReqVO) { + enterpriseAuditLogService.updateEnterpriseAuditLog(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除企业审核") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:enterprise-audit-log:delete')") + public CommonResult deleteEnterpriseAuditLog(@RequestParam("id") Long id) { + enterpriseAuditLogService.deleteEnterpriseAuditLog(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得企业审核") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:enterprise-audit-log:query')") + public CommonResult getEnterpriseAuditLog(@RequestParam("id") Long id) { + EnterpriseAuditLogDO enterpriseAuditLog = enterpriseAuditLogService.getEnterpriseAuditLog(id); + return success(BeanUtils.toBean(enterpriseAuditLog, EnterpriseAuditLogRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得企业审核分页") + @PreAuthorize("@ss.hasPermission('system:enterprise-audit-log:query')") + public CommonResult> getEnterpriseAuditLogPage(@Valid EnterpriseAuditLogPageReqVO pageReqVO) { + PageResult pageResult = enterpriseAuditLogService.getEnterpriseAuditLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EnterpriseAuditLogRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出企业审核 Excel") + @PreAuthorize("@ss.hasPermission('system:enterprise-audit-log:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportEnterpriseAuditLogExcel(@Valid EnterpriseAuditLogPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = enterpriseAuditLogService.getEnterpriseAuditLogPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "企业审核.xls", "数据", EnterpriseAuditLogRespVO.class, + BeanUtils.toBean(list, EnterpriseAuditLogRespVO.class)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogPageReqVO.java new file mode 100644 index 0000000..0db827e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogPageReqVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseauditlog.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 EnterpriseAuditLogPageReqVO extends PageParam { + + @Schema(description = "企业信息id", example = "28113") + private Long enterpriseId; + + @Schema(description = "审核状态") + private Integer audit; + + @Schema(description = "审核建议") + private String content; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ 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/enterpriseauditlog/vo/EnterpriseAuditLogRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogRespVO.java new file mode 100644 index 0000000..2609721 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogRespVO.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseauditlog.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.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 企业审核 Response VO") +@Data +@ExcelIgnoreUnannotated +public class EnterpriseAuditLogRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11258") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "企业信息id", example = "28113") + @ExcelProperty("企业信息id") + private Long enterpriseId; + + @Schema(description = "审核状态") + @ExcelProperty(value = "审核状态", converter = DictConvert.class) + @DictFormat("user_audit_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer audit; + + @Schema(description = "审核建议") + @ExcelProperty("审核建议") + private String content; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ 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/enterpriseauditlog/vo/EnterpriseAuditLogSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogSaveReqVO.java new file mode 100644 index 0000000..9e316df --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseauditlog/vo/EnterpriseAuditLogSaveReqVO.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseauditlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +@Schema(description = "管理后台 - 企业审核新增/修改 Request VO") +@Data +public class EnterpriseAuditLogSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11258") + private Long id; + + @Schema(description = "企业信息id", example = "28113") + private Long enterpriseId; + + @Schema(description = "审核状态") + private Integer audit; + + @Schema(description = "审核建议") + private String content; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java new file mode 100644 index 0000000..88d4a6b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java @@ -0,0 +1,80 @@ +package cn.iocoder.yudao.module.system.controller.admin.taglibrary; + +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.taglibrary.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; +import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 企业标签") +@RestController +@RequestMapping("/system/tag-library") +@Validated +public class TagLibraryController { + + @Resource + private TagLibraryService tagLibraryService; + + @PostMapping("/create") + @Operation(summary = "创建企业标签") + @PreAuthorize("@ss.hasPermission('system:tag-library:create')") + public CommonResult createTagLibrary(@Valid @RequestBody TagLibrarySaveReqVO createReqVO) { + return success(tagLibraryService.createTagLibrary(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业标签") + @PreAuthorize("@ss.hasPermission('system:tag-library:update')") + public CommonResult updateTagLibrary(@Valid @RequestBody TagLibrarySaveReqVO updateReqVO) { + tagLibraryService.updateTagLibrary(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除企业标签") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:tag-library:delete')") + public CommonResult deleteTagLibrary(@RequestParam("id") Integer id) { + tagLibraryService.deleteTagLibrary(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得企业标签") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:tag-library:query')") + public CommonResult getTagLibrary(@RequestParam("id") Integer id) { + TagLibraryDO tagLibrary = tagLibraryService.getTagLibrary(id); + return success(BeanUtils.toBean(tagLibrary, TagLibraryRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得企业标签分页") + @PreAuthorize("@ss.hasPermission('system:tag-library:query')") + public CommonResult> getTagLibraryPage(TagLibraryPageReqVO pageReqVO) { + List pageResult = tagLibraryService.getTagLibraryPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class)); + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java new file mode 100644 index 0000000..c54fd41 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.system.controller.admin.taglibrary.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 TagLibraryPageReqVO extends PageParam { + + @Schema(description = "标签的名称", example = "王五") + private String tagName; + + @Schema(description = "父标签的ID", example = "30648") + private Integer parentId; + + @Schema(description = "标签层级(一级、二级、三级)") + private Integer tagLevel; + + @Schema(description = "1、企业标签2、执法标签", example = "2") + private Integer tagType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java new file mode 100644 index 0000000..217fb8a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo; + +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; +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 TagLibraryRespVO { + + @Schema(description = "签的唯一标识,自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4578") + @ExcelProperty("签的唯一标识,自增主键") + private Integer id; + + @Schema(description = "标签的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("标签的名称") + private String tagName; + + @Schema(description = "父标签的ID", example = "30648") + @ExcelProperty("父标签的ID") + private Integer parentId; + + @Schema(description = "标签层级(一级、二级、三级)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("标签层级(一级、二级、三级)") + private Integer tagLevel; + + @Schema(description = "1、企业标签2、执法标签", example = "2") + @ExcelProperty("1、企业标签2、执法标签") + private Integer tagType; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + private List children = new ArrayList<>(); // 子标签列表 + + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java new file mode 100644 index 0000000..35a2f14 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.*; + +@Schema(description = "管理后台 - 企业标签新增/修改 Request VO") +@Data +public class TagLibrarySaveReqVO { + + @Schema(description = "签的唯一标识,自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4578") + private Integer id; + + @Schema(description = "标签的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "标签的名称不能为空") + private String tagName; + + @Schema(description = "父标签的ID", example = "30648") + private Integer parentId; + + @Schema(description = "标签层级(一级、二级、三级)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "标签层级(一级、二级、三级)不能为空") + private Integer tagLevel; + + @Schema(description = "1、企业标签2、执法标签", example = "2") + private Integer tagType; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java index 09c8b4a..a9ec972 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.dal.dataobject.enterprise; +import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; import lombok.*; import java.time.LocalDate; @@ -83,4 +84,13 @@ public class EnterpriseDO extends BaseDO { */ private Long deptId; + @TableField(exist = false) + private Integer audit; + + @TableField(exist = false) + private List files; + + @TableField(exist = false) + private List qualificationList; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseauditlog/EnterpriseAuditLogDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseauditlog/EnterpriseAuditLogDO.java new file mode 100644 index 0000000..f8bc67b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseauditlog/EnterpriseAuditLogDO.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog; + +import com.sun.xml.bind.v2.TODO; +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("enterprise_audit_log") +@KeySequence("enterprise_audit_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EnterpriseAuditLogDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 企业信息id + */ + private Long enterpriseId; + /** + * 审核状态 + * + * 枚举 {@link TODO user_audit_type 对应的类} + */ + private Integer audit; + /** + * 审核建议 + */ + private String content; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java index 0f86a44..66289a1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java @@ -53,4 +53,5 @@ public class EnterpriseQualificationDO extends BaseDO { */ private String enterpriseAuth; -} \ 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/taglibrary/TagLibraryDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java new file mode 100644 index 0000000..3c002fc --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java @@ -0,0 +1,51 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.taglibrary; + +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("tag_library") +@KeySequence("tag_library_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TagLibraryDO extends BaseDO { + + /** + * 签的唯一标识,自增主键 + */ + @TableId + private Integer id; + /** + * 标签的名称 + */ + private String tagName; + /** + * 父标签的ID + */ + private Integer parentId; + /** + * 标签层级(一级、二级、三级) + */ + private Integer tagLevel; + /** + * 1、企业标签2、执法标签 + */ + private Integer tagType; + + @TableField(exist = false) + private List children = new ArrayList<>(); // 子标签列表 + + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseauditlog/EnterpriseAuditLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseauditlog/EnterpriseAuditLogMapper.java new file mode 100644 index 0000000..787e07a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseauditlog/EnterpriseAuditLogMapper.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog; + +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.enterpriseauditlog.EnterpriseAuditLogDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseauditlog.vo.*; + +/** + * 企业审核 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface EnterpriseAuditLogMapper extends BaseMapperX { + + default PageResult selectPage(EnterpriseAuditLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(EnterpriseAuditLogDO::getEnterpriseId, reqVO.getEnterpriseId()) + .eqIfPresent(EnterpriseAuditLogDO::getAudit, reqVO.getAudit()) + .eqIfPresent(EnterpriseAuditLogDO::getContent, reqVO.getContent()) + .betweenIfPresent(EnterpriseAuditLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(EnterpriseAuditLogDO::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/taglibrary/TagLibraryMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taglibrary/TagLibraryMapper.java new file mode 100644 index 0000000..c252e3e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taglibrary/TagLibraryMapper.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.system.dal.mysql.taglibrary; + +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.taglibrary.TagLibraryDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*; + +/** + * 企业标签 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface TagLibraryMapper extends BaseMapperX { + + default PageResult selectPage(TagLibraryPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(TagLibraryDO::getTagName, reqVO.getTagName()) + .eqIfPresent(TagLibraryDO::getParentId, reqVO.getParentId()) + .eqIfPresent(TagLibraryDO::getTagLevel, reqVO.getTagLevel()) + .eqIfPresent(TagLibraryDO::getTagType, reqVO.getTagType()) + .betweenIfPresent(TagLibraryDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(TagLibraryDO::getId)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java index fcc1b98..ce5151d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseService.java @@ -53,5 +53,5 @@ public interface EnterpriseService { */ PageResult getEnterprisePage(EnterprisePageReqVO pageReqVO); - List getEnterpriseByUserId(EnterprisePageReqVO pageReqVO); + PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO); } 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 224dbe5..54945e7 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,6 +1,8 @@ package cn.iocoder.yudao.module.system.service.enterprise; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO; import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; @@ -42,6 +44,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { private FileInfoMapper fileInfoMapper; @Resource private AdminUserService adminUserService; + @Resource + private EnterpriseAuditLogMapper enterpriseAuditLogMapper; @Override @Transactional @@ -58,8 +62,11 @@ public class EnterpriseServiceImpl implements EnterpriseService { EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); enterpriseMapper.insert(enterprise); - //修改企业用户的审核状态为 审核中 - + //修改企业用户的审核状态为 审核中 新增企业审核表 + EnterpriseAuditLogDO enterpriseAuditLogDO = new EnterpriseAuditLogDO(); + enterpriseAuditLogDO.setEnterpriseId(enterprise.getId()); + enterpriseAuditLogDO.setAudit(1); + enterpriseAuditLogMapper.insert(enterpriseAuditLogDO); if (createReqVO.getFileIds().length > 0) { for (Long fileId : createReqVO.getFileIds()) { @@ -128,10 +135,9 @@ public class EnterpriseServiceImpl implements EnterpriseService { } @Override - public List getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { + public PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { pageReqVO.setCreate(getLoginUserId().toString()); - final PageResult enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); - return enterpriseDOPageResult.getList(); + return enterpriseMapper.selectPage(pageReqVO); } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseauditlog/EnterpriseAuditLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseauditlog/EnterpriseAuditLogService.java new file mode 100644 index 0000000..8ebc24d --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseauditlog/EnterpriseAuditLogService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.enterpriseauditlog; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseauditlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 企业审核 Service 接口 + * + * @author 芋道源码 + */ +public interface EnterpriseAuditLogService { + + /** + * 创建企业审核 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createEnterpriseAuditLog(@Valid EnterpriseAuditLogSaveReqVO createReqVO); + + /** + * 更新企业审核 + * + * @param updateReqVO 更新信息 + */ + void updateEnterpriseAuditLog(@Valid EnterpriseAuditLogSaveReqVO updateReqVO); + + /** + * 删除企业审核 + * + * @param id 编号 + */ + void deleteEnterpriseAuditLog(Long id); + + /** + * 获得企业审核 + * + * @param id 编号 + * @return 企业审核 + */ + EnterpriseAuditLogDO getEnterpriseAuditLog(Long id); + + /** + * 获得企业审核分页 + * + * @param pageReqVO 分页查询 + * @return 企业审核分页 + */ + PageResult getEnterpriseAuditLogPage(EnterpriseAuditLogPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseauditlog/EnterpriseAuditLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseauditlog/EnterpriseAuditLogServiceImpl.java new file mode 100644 index 0000000..1ebf637 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseauditlog/EnterpriseAuditLogServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.system.service.enterpriseauditlog; + +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.enterpriseauditlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO; +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.enterpriseauditlog.EnterpriseAuditLogMapper; + +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 EnterpriseAuditLogServiceImpl implements EnterpriseAuditLogService { + + @Resource + private EnterpriseAuditLogMapper enterpriseAuditLogMapper; + + @Override + public Long createEnterpriseAuditLog(EnterpriseAuditLogSaveReqVO createReqVO) { + // 插入 + EnterpriseAuditLogDO enterpriseAuditLog = BeanUtils.toBean(createReqVO, EnterpriseAuditLogDO.class); + enterpriseAuditLogMapper.insert(enterpriseAuditLog); + // 返回 + return enterpriseAuditLog.getId(); + } + + @Override + public void updateEnterpriseAuditLog(EnterpriseAuditLogSaveReqVO updateReqVO) { + // 校验存在 + validateEnterpriseAuditLogExists(updateReqVO.getId()); + // 更新 + EnterpriseAuditLogDO updateObj = BeanUtils.toBean(updateReqVO, EnterpriseAuditLogDO.class); + enterpriseAuditLogMapper.updateById(updateObj); + } + + @Override + public void deleteEnterpriseAuditLog(Long id) { + // 校验存在 + validateEnterpriseAuditLogExists(id); + // 删除 + enterpriseAuditLogMapper.deleteById(id); + } + + private void validateEnterpriseAuditLogExists(Long id) { + if (enterpriseAuditLogMapper.selectById(id) == null) { + throw exception(USER_COUNT_MAX); + } + } + + @Override + public EnterpriseAuditLogDO getEnterpriseAuditLog(Long id) { + return enterpriseAuditLogMapper.selectById(id); + } + + @Override + public PageResult getEnterpriseAuditLogPage(EnterpriseAuditLogPageReqVO pageReqVO) { + return enterpriseAuditLogMapper.selectPage(pageReqVO); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java new file mode 100644 index 0000000..a3ec43b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.taglibrary; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 企业标签 Service 接口 + * + * @author 芋道源码 + */ +public interface TagLibraryService { + + /** + * 创建企业标签 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createTagLibrary(@Valid TagLibrarySaveReqVO createReqVO); + + /** + * 更新企业标签 + * + * @param updateReqVO 更新信息 + */ + void updateTagLibrary(@Valid TagLibrarySaveReqVO updateReqVO); + + /** + * 删除企业标签 + * + * @param id 编号 + */ + void deleteTagLibrary(Integer id); + + /** + * 获得企业标签 + * + * @param id 编号 + * @return 企业标签 + */ + TagLibraryDO getTagLibrary(Integer id); + + /** + * 获得企业标签分页 + * + * @param pageReqVO 分页查询 + * @return 企业标签分页 + */ + List getTagLibraryPage(TagLibraryPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java new file mode 100644 index 0000000..e950530 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java @@ -0,0 +1,90 @@ +package cn.iocoder.yudao.module.system.service.taglibrary; + +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; + +import javax.annotation.Resource; + +import java.util.ArrayList; +import java.util.List; + +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 TagLibraryServiceImpl implements TagLibraryService { + + @Resource + private TagLibraryMapper tagLibraryMapper; + + @Override + public Integer createTagLibrary(TagLibrarySaveReqVO createReqVO) { + // 插入 + TagLibraryDO tagLibrary = BeanUtils.toBean(createReqVO, TagLibraryDO.class); + tagLibraryMapper.insert(tagLibrary); + // 返回 + return tagLibrary.getId(); + } + + @Override + public void updateTagLibrary(TagLibrarySaveReqVO updateReqVO) { + // 校验存在 + validateTagLibraryExists(updateReqVO.getId()); + // 更新 + TagLibraryDO updateObj = BeanUtils.toBean(updateReqVO, TagLibraryDO.class); + tagLibraryMapper.updateById(updateObj); + } + + @Override + public void deleteTagLibrary(Integer id) { + // 校验存在 + validateTagLibraryExists(id); + // 删除 + tagLibraryMapper.deleteById(id); + } + + private void validateTagLibraryExists(Integer id) { + if (tagLibraryMapper.selectById(id) == null) { + throw exception(USER_MOBILE_EXISTS); + } + } + + @Override + public TagLibraryDO getTagLibrary(Integer id) { + return tagLibraryMapper.selectById(id); + } + + @Override + public List getTagLibraryPage(TagLibraryPageReqVO pageReqVO) { + pageReqVO.setPageSize(-1); + final List list = tagLibraryMapper.selectPage(pageReqVO).getList(); + return buildTree(list, 0); + } + + // 递归构建树 + private List buildTree(List tags, Integer parentId) { + List tree = new ArrayList<>(); + for (TagLibraryDO tag : tags) { + if (tag.getParentId().equals(parentId)) { + // 递归查找子节点 + tag.setChildren(buildTree(tags, tag.getId())); + tree.add(tag); + } + } + return tree; + } + + +}