diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 2f81c63..16350c5 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -525,7 +525,6 @@ com.google.inject guice - ${guice.version} @@ -583,11 +582,6 @@ - - com.github.binarywang - weixin-java-pay - ${weixin-java.version} - com.github.binarywang wx-java-mp-spring-boot-starter @@ -599,26 +593,6 @@ ${weixin-java.version} - - - org.jeecgframework.jimureport - jimureport-spring-boot-starter - ${jimureport.version} - - - com.alibaba - druid - - - - - - - org.eclipse.paho - org.eclipse.paho.client.mqttv3 - ${mqtt.version} - - ch.qos.logback 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 46db718..d322a86 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 @@ -41,6 +41,6 @@ public interface FileApi { */ Map createFile(String name, String path, byte[] content); - List listFile(List ids); + List> listFile(List ids); } 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 8dcdaf5..467574a 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 @@ -26,7 +26,7 @@ public class FileApiImpl implements FileApi { } @Override - public List listFile(List ids) { + 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 d626575..e9078f3 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 @@ -66,5 +66,5 @@ public interface FileService { */ FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception; - List listFile(List ids); + 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 d51a61d..67a56eb 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 @@ -126,10 +126,17 @@ public class FileServiceImpl implements FileService { } @Override - public List listFile(List ids) { + 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()); + + final List fileDOS = fileMapper.selectList(wrapper); + return fileDOS.stream().map(fileDO -> { + Map map = new HashMap<>(); + map.put("id", fileDO.getId().toString()); + map.put("url", fileDO.getUrl()); + return map; + }).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 63089a7..4895cc6 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 @@ -2,13 +2,18 @@ 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.enterprisetag.EnterpriseTagDO; 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.dataobject.taglibrary.TagLibraryDO; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper; +import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; 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.dal.mysql.taglibrary.TagLibraryMapper; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService; +import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.extern.slf4j.Slf4j; @@ -59,6 +64,10 @@ public class EnterpriseController { private EnterpriseQualificationMapper enterpriseQualificationMapper; @Resource private EnterpriseAuditLogMapper enterpriseAuditLogMapper; + @Resource + private TagLibraryMapper tagLibraryMapper; + @Resource + private EnterpriseTagMapper enterpriseTagMapper; @PostMapping("/create") @Operation(summary = "创建企业") @@ -90,24 +99,25 @@ public class EnterpriseController { // @PreAuthorize("@ss.hasPermission('system:enterprise:query')") public CommonResult getEnterprise(@RequestParam("id") Long id) { EnterpriseDO enterprise = enterpriseService.getEnterprise(id); + if (enterprise != null) { + 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()); - //获取企业图片 - 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); + } - 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); } - - //获取资质 - 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)); } @@ -117,6 +127,39 @@ public class EnterpriseController { @PreAuthorize("@ss.hasPermission('system:enterprise:query')") public CommonResult> getEnterprisePage(@Valid EnterprisePageReqVO pageReqVO) { PageResult pageResult = enterpriseService.getEnterprisePage(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); + } + // 企业标签 + LambdaQueryWrapper tagDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + tagDOLambdaQueryWrapper.eq(EnterpriseTagDO::getEnterpriseId, item.getId()); + List enterpriseTagDOS = enterpriseTagMapper.selectList(tagDOLambdaQueryWrapper); + if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) { + List tagIds = enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList()); + List tagLibraryDOS = tagLibraryMapper.selectList(new LambdaQueryWrapper().in(TagLibraryDO::getId, tagIds)); + if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) { + List tagNames = tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList()); + item.setTagList(tagNames); + } + } + }); + return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class)); } @@ -143,7 +186,7 @@ public class EnterpriseController { final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); if (!collect.isEmpty()) { - final List list = fileApi.listFile(collect); + final List> list = fileApi.listFile(collect); item.setFiles(list); } 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 e460662..140fa3c 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,6 +1,7 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise.vo; import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -88,9 +89,13 @@ public class EnterpriseRespVO { private Integer audit; @Schema(description = "企业图片", example = "26433") - private List files; + private List> files; @Schema(description = "企业资质列表", example = "26433") private List qualificationList; + @Schema(description = "企业标签", example = "26433") + private List> tagList; + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/EnterpriseTagController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/EnterpriseTagController.java new file mode 100644 index 0000000..8ff1cfd --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/EnterpriseTagController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterprisetag; + +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.enterprisetag.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; +import cn.iocoder.yudao.module.system.service.enterprisetag.EnterpriseTagService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 企业标签") +@RestController +@RequestMapping("/system/enterprise-tag") +@Validated +public class EnterpriseTagController { + + @Resource + private EnterpriseTagService enterpriseTagService; + + @PostMapping("/create") + @Operation(summary = "创建企业标签") + @PreAuthorize("@ss.hasPermission('system:enterprise-tag:create')") + public CommonResult createEnterpriseTag(@Valid @RequestBody EnterpriseTagSaveReqVO createReqVO) { + return success(enterpriseTagService.createEnterpriseTag(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业标签") + @PreAuthorize("@ss.hasPermission('system:enterprise-tag:update')") + public CommonResult updateEnterpriseTag(@Valid @RequestBody EnterpriseTagSaveReqVO updateReqVO) { + enterpriseTagService.updateEnterpriseTag(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除企业标签") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:enterprise-tag:delete')") + public CommonResult deleteEnterpriseTag(@RequestParam("id") Long id) { + enterpriseTagService.deleteEnterpriseTag(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得企业标签") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:enterprise-tag:query')") + public CommonResult getEnterpriseTag(@RequestParam("id") Long id) { + EnterpriseTagDO enterpriseTag = enterpriseTagService.getEnterpriseTag(id); + return success(BeanUtils.toBean(enterpriseTag, EnterpriseTagRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得企业标签分页") + @PreAuthorize("@ss.hasPermission('system:enterprise-tag:query')") + public CommonResult> getEnterpriseTagPage(@Valid EnterpriseTagPageReqVO pageReqVO) { + PageResult pageResult = enterpriseTagService.getEnterpriseTagPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EnterpriseTagRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出企业标签 Excel") + @PreAuthorize("@ss.hasPermission('system:enterprise-tag:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportEnterpriseTagExcel(@Valid EnterpriseTagPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = enterpriseTagService.getEnterpriseTagPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "企业标签.xls", "数据", EnterpriseTagRespVO.class, + BeanUtils.toBean(list, EnterpriseTagRespVO.class)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagPageReqVO.java new file mode 100644 index 0000000..a19dda9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterprisetag.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 EnterpriseTagPageReqVO extends PageParam { + + @Schema(description = "企业id", example = "32136") + private Long enterpriseId; + + @Schema(description = "标签id", example = "13027") + private Long tagId; + + @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/enterprisetag/vo/EnterpriseTagRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagRespVO.java new file mode 100644 index 0000000..a4d15d5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagRespVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterprisetag.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 EnterpriseTagRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19630") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "企业id", example = "32136") + @ExcelProperty("企业id") + private Long enterpriseId; + + @Schema(description = "标签id", example = "13027") + @ExcelProperty("标签id") + private Long tagId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @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/enterprisetag/vo/EnterpriseTagSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagSaveReqVO.java new file mode 100644 index 0000000..1f785db --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprisetag/vo/EnterpriseTagSaveReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterprisetag.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +@Schema(description = "管理后台 - 企业标签新增/修改 Request VO") +@Data +public class EnterpriseTagSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19630") + private Long id; + + @Schema(description = "企业id", example = "32136") + private Long enterpriseId; + + @Schema(description = "标签id", example = "13027") + private Long tagId; + +} 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 index 217fb8a..1b8e579 100644 --- 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 @@ -33,6 +33,10 @@ public class TagLibraryRespVO { @ExcelProperty("1、企业标签2、执法标签") private Integer tagType; + @Schema(description = "排序", example = "2") + @ExcelProperty("排序") + private Integer sort; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") 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/TagLibrarySaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java index 35a2f14..1be6466 100644 --- 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 @@ -21,10 +21,12 @@ public class TagLibrarySaveReqVO { @Schema(description = "父标签的ID", example = "30648") private Integer parentId; - @Schema(description = "标签层级(一级、二级、三级)", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "标签层级(一级、二级、三级)不能为空") + @Schema(description = "标签层级(一级、二级、三级)") private Integer tagLevel; + @Schema(description = "排序") + private Integer sort; + @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 a9ec972..2ca89dd 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,6 +1,7 @@ package cn.iocoder.yudao.module.system.dal.dataobject.enterprise; import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; import lombok.*; import java.time.LocalDate; @@ -88,9 +89,12 @@ public class EnterpriseDO extends BaseDO { private Integer audit; @TableField(exist = false) - private List files; + private List> files; @TableField(exist = false) private List qualificationList; + @TableField(exist = false) + private List tagList; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprisetag/EnterpriseTagDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprisetag/EnterpriseTagDO.java new file mode 100644 index 0000000..3573f86 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprisetag/EnterpriseTagDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag; + +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_tag") +@KeySequence("enterprise_tag_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EnterpriseTagDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 企业id + */ + private Long enterpriseId; + /** + * 标签id + */ + private Long tagId; + +} \ 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 index 3c002fc..442a934 100644 --- 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 @@ -43,6 +43,8 @@ public class TagLibraryDO extends BaseDO { * 1、企业标签2、执法标签 */ private Integer tagType; + //排序 + private Integer sort; @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/enterprisetag/EnterpriseTagMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprisetag/EnterpriseTagMapper.java new file mode 100644 index 0000000..7ebf3f0 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprisetag/EnterpriseTagMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.system.dal.mysql.enterprisetag; + +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.enterprisetag.EnterpriseTagDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.enterprisetag.vo.*; + +/** + * 企业标签 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface EnterpriseTagMapper extends BaseMapperX { + + default PageResult selectPage(EnterpriseTagPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(EnterpriseTagDO::getEnterpriseId, reqVO.getEnterpriseId()) + .eqIfPresent(EnterpriseTagDO::getTagId, reqVO.getTagId()) + .betweenIfPresent(EnterpriseTagDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(EnterpriseTagDO::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 index c252e3e..d62d2f3 100644 --- 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 @@ -24,7 +24,7 @@ public interface TagLibraryMapper extends BaseMapperX { .eqIfPresent(TagLibraryDO::getTagLevel, reqVO.getTagLevel()) .eqIfPresent(TagLibraryDO::getTagType, reqVO.getTagType()) .betweenIfPresent(TagLibraryDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(TagLibraryDO::getId)); + .orderByDesc(TagLibraryDO::getSort)); } } 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 54945e7..b446dea 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 @@ -2,6 +2,7 @@ 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.dataobject.user.AdminUserDO; 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; @@ -57,7 +58,12 @@ public class EnterpriseServiceImpl implements EnterpriseService { if (enterpriseDO != null) { throw exception(ENTERPRISE_EXISTS); } - + //专管员所属部门 +// final AdminUserDO user = adminUserService.getUser(createReqVO.getUserId()); +// if (user == null) { +// throw exception(USER_NOT_EXISTS); +// } +// createReqVO.setDeptId(user.getDeptId()); // 插入 EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); enterpriseMapper.insert(enterprise); @@ -68,7 +74,7 @@ public class EnterpriseServiceImpl implements EnterpriseService { enterpriseAuditLogDO.setAudit(1); enterpriseAuditLogMapper.insert(enterpriseAuditLogDO); - if (createReqVO.getFileIds().length > 0) { + if (createReqVO.getFileIds() != null && createReqVO.getFileIds().length > 0) { for (Long fileId : createReqVO.getFileIds()) { FileInfoDO fileInfoDO = new FileInfoDO(); fileInfoDO.setDictData(1l); //文件类型 @@ -95,7 +101,6 @@ public class EnterpriseServiceImpl implements EnterpriseService { fileInfoMapper.delete(wrapper); } - for (Long fileId : updateReqVO.getFileIds()) { FileInfoDO fileInfoDO = new FileInfoDO(); fileInfoDO.setDictData(1l); //文件类型 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprisetag/EnterpriseTagService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprisetag/EnterpriseTagService.java new file mode 100644 index 0000000..793649a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprisetag/EnterpriseTagService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.enterprisetag; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.enterprisetag.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 企业标签 Service 接口 + * + * @author 芋道源码 + */ +public interface EnterpriseTagService { + + /** + * 创建企业标签 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createEnterpriseTag(@Valid EnterpriseTagSaveReqVO createReqVO); + + /** + * 更新企业标签 + * + * @param updateReqVO 更新信息 + */ + void updateEnterpriseTag(@Valid EnterpriseTagSaveReqVO updateReqVO); + + /** + * 删除企业标签 + * + * @param id 编号 + */ + void deleteEnterpriseTag(Long id); + + /** + * 获得企业标签 + * + * @param id 编号 + * @return 企业标签 + */ + EnterpriseTagDO getEnterpriseTag(Long id); + + /** + * 获得企业标签分页 + * + * @param pageReqVO 分页查询 + * @return 企业标签分页 + */ + PageResult getEnterpriseTagPage(EnterpriseTagPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprisetag/EnterpriseTagServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprisetag/EnterpriseTagServiceImpl.java new file mode 100644 index 0000000..f31994b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprisetag/EnterpriseTagServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.system.service.enterprisetag; + +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.enterprisetag.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; +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.enterprisetag.EnterpriseTagMapper; + +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 EnterpriseTagServiceImpl implements EnterpriseTagService { + + @Resource + private EnterpriseTagMapper enterpriseTagMapper; + + @Override + public Long createEnterpriseTag(EnterpriseTagSaveReqVO createReqVO) { + // 插入 + EnterpriseTagDO enterpriseTag = BeanUtils.toBean(createReqVO, EnterpriseTagDO.class); + enterpriseTagMapper.insert(enterpriseTag); + // 返回 + return enterpriseTag.getId(); + } + + @Override + public void updateEnterpriseTag(EnterpriseTagSaveReqVO updateReqVO) { + // 校验存在 + validateEnterpriseTagExists(updateReqVO.getId()); + // 更新 + EnterpriseTagDO updateObj = BeanUtils.toBean(updateReqVO, EnterpriseTagDO.class); + enterpriseTagMapper.updateById(updateObj); + } + + @Override + public void deleteEnterpriseTag(Long id) { + // 校验存在 + validateEnterpriseTagExists(id); + // 删除 + enterpriseTagMapper.deleteById(id); + } + + private void validateEnterpriseTagExists(Long id) { + if (enterpriseTagMapper.selectById(id) == null) { + throw exception(USER_MOBILE_EXISTS); + } + } + + @Override + public EnterpriseTagDO getEnterpriseTag(Long id) { + return enterpriseTagMapper.selectById(id); + } + + @Override + public PageResult getEnterpriseTagPage(EnterpriseTagPageReqVO pageReqVO) { + return enterpriseTagMapper.selectPage(pageReqVO); + } + +}