diff --git a/src/main/java/com/rj/controller/AudioFileController.java b/src/main/java/com/rj/controller/AudioFileController.java index 9305849..9c7b3a7 100644 --- a/src/main/java/com/rj/controller/AudioFileController.java +++ b/src/main/java/com/rj/controller/AudioFileController.java @@ -303,14 +303,14 @@ public class AudioFileController { if (audioFile == null || audioFile.isEmpty()) { log.warn("处理Audio类型时文件为空,尝试重新获取"); if (request instanceof org.springframework.web.multipart.MultipartHttpServletRequest) { - org.springframework.web.multipart.MultipartHttpServletRequest multipartRequest = - (org.springframework.web.multipart.MultipartHttpServletRequest) request; + org.springframework.web.multipart.MultipartHttpServletRequest multipartRequest = + (org.springframework.web.multipart.MultipartHttpServletRequest) request; java.util.Iterator fileNames = multipartRequest.getFileNames(); if (fileNames.hasNext()) { String paramName = fileNames.next(); audioFile = multipartRequest.getFile(paramName); - log.info("重新获取到文件,参数名: {}, 文件名: {}, 大小: {} bytes", - paramName, audioFile != null ? audioFile.getOriginalFilename() : "null", + log.info("重新获取到文件,参数名: {}, 文件名: {}, 大小: {} bytes", + paramName, audioFile != null ? audioFile.getOriginalFilename() : "null", audioFile != null ? audioFile.getSize() : 0); } } diff --git a/src/main/java/com/rj/controller/IndustryTagsController.java b/src/main/java/com/rj/controller/IndustryTagsController.java new file mode 100644 index 0000000..279d9f6 --- /dev/null +++ b/src/main/java/com/rj/controller/IndustryTagsController.java @@ -0,0 +1,159 @@ +package com.rj.controller; + +import com.rj.entity.IndustryTags; +import com.rj.service.IIndustryTagsService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + *

+ * 行业标签表 前端控制器 + *

+ * + * @author Auto Generated + * @since 2025-01-29 + */ +@RestController +@RequestMapping("/api/industryTags") +@Tag(name = "行业标签", description = "行业标签相关接口") +@Slf4j +public class IndustryTagsController { + + @Autowired + private IIndustryTagsService industryTagsService; + + /** + * 根据条件分页查询行业标签列表 + */ + @GetMapping("/list") + @Operation(summary = "分页查询行业标签列表", description = "根据条件分页查询行业标签信息列表,支持按所属行业、标签分类、标签名称查询") + public ResponseEntity> getIndustryTagsList( + @Parameter(description = "页码", example = "1") + @RequestParam(defaultValue = "1") Integer current, + @Parameter(description = "每页大小", example = "10") + @RequestParam(defaultValue = "10") Integer size, + @Parameter(description = "所属行业(精确查询)") + @RequestParam(required = false) String industry, + @Parameter(description = "标签分类(精确查询)") + @RequestParam(required = false) String tagType, + @Parameter(description = "标签名称(模糊查询)") + @RequestParam(required = false) String tagName) { + Map result = industryTagsService.getIndustryTagsList( + current, size, industry, tagType, tagName); + + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return ResponseEntity.ok(result); + } else { + return ResponseEntity.internalServerError().body(result); + } + } + + /** + * 根据类型不分页查询行业标签列表 + */ + @GetMapping("/listByType") + @Operation(summary = "根据类型查询行业标签列表", description = "根据标签分类查询行业标签列表(不分页),可选择性按所属行业筛选") + public ResponseEntity> getIndustryTagsByType( + @Parameter(description = "标签分类", required = true) + @RequestParam String tagType, + @Parameter(description = "所属行业(可选,精确查询)") + @RequestParam(required = false) String industry) { + Map result = industryTagsService.getIndustryTagsByType(tagType, industry); + + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return ResponseEntity.ok(result); + } else { + String message = (String) result.get("message"); + if (message != null && message.contains("不能为空")) { + return ResponseEntity.badRequest().body(result); + } + return ResponseEntity.internalServerError().body(result); + } + } + + /** + * 根据ID查询行业标签 + */ + @GetMapping("/get/{id}") + @Operation(summary = "根据ID查询行业标签", description = "根据行业标签ID获取详细信息") + public ResponseEntity> getIndustryTagsById( + @Parameter(description = "行业标签ID", required = true) + @PathVariable String id) { + Map result = industryTagsService.getIndustryTagsById(id); + + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return ResponseEntity.ok(result); + } else { + return ResponseEntity.notFound().build(); + } + } + + /** + * 新增行业标签 + */ + @PostMapping("/add") + @Operation(summary = "新增行业标签", description = "添加新的行业标签信息") + public ResponseEntity> addIndustryTags( + @Parameter(description = "行业标签信息", required = true) + @RequestBody IndustryTags industryTags) { + Map result = industryTagsService.addIndustryTags(industryTags); + + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return ResponseEntity.ok(result); + } else { + return ResponseEntity.badRequest().body(result); + } + } + + /** + * 更新行业标签信息 + */ + @PutMapping("/update") + @Operation(summary = "更新行业标签信息", description = "更新行业标签详细信息") + public ResponseEntity> updateIndustryTags( + @Parameter(description = "行业标签信息", required = true) + @RequestBody IndustryTags industryTags) { + Map result = industryTagsService.updateIndustryTags(industryTags); + + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return ResponseEntity.ok(result); + } else { + String message = (String) result.get("message"); + if (message != null && message.contains("不能为空")) { + return ResponseEntity.badRequest().body(result); + } + return ResponseEntity.badRequest().body(result); + } + } + + /** + * 根据ID删除行业标签 + */ + @DeleteMapping("/delete/{id}") + @Operation(summary = "删除行业标签", description = "根据行业标签ID删除信息") + public ResponseEntity> deleteIndustryTags( + @Parameter(description = "行业标签ID", required = true) + @PathVariable String id) { + Map result = industryTagsService.deleteIndustryTags(id); + + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return ResponseEntity.ok(result); + } else { + return ResponseEntity.badRequest().body(result); + } + } +} + diff --git a/src/main/java/com/rj/entity/IndustryTags.java b/src/main/java/com/rj/entity/IndustryTags.java new file mode 100644 index 0000000..c1dc989 --- /dev/null +++ b/src/main/java/com/rj/entity/IndustryTags.java @@ -0,0 +1,61 @@ +package com.rj.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 行业标签表 + *

+ * + * @author Auto Generated + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("industry_tags") +@Schema(description = "行业标签表") +public class IndustryTags implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "UUID主键") + @TableId("id") + private String id; + + @Schema(description = "所属行业") + @TableField("industry") + private String industry; + + @Schema(description = "标签分类") + @TableField("tag_type") + private String tagType; + + @Schema(description = "标签名称") + @TableField("tag_name") + private String tagName; + + @Schema(description = "标签详情") + @TableField("tag_detail") + private String tagDetail; + + @Schema(description = "备注") + @TableField("remark") + private String remark; + + @Schema(description = "创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @TableField("update_time") + private LocalDateTime updateTime; + +} + diff --git a/src/main/java/com/rj/mapper/IndustryTagsMapper.java b/src/main/java/com/rj/mapper/IndustryTagsMapper.java new file mode 100644 index 0000000..c1b28e6 --- /dev/null +++ b/src/main/java/com/rj/mapper/IndustryTagsMapper.java @@ -0,0 +1,17 @@ +package com.rj.mapper; + +import com.rj.entity.IndustryTags; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 行业标签表 Mapper 接口 + *

+ * + * @author Auto Generated + * @since 2025-01-29 + */ +public interface IndustryTagsMapper extends BaseMapper { + +} + diff --git a/src/main/java/com/rj/service/IIndustryTagsService.java b/src/main/java/com/rj/service/IIndustryTagsService.java new file mode 100644 index 0000000..d0cd2fe --- /dev/null +++ b/src/main/java/com/rj/service/IIndustryTagsService.java @@ -0,0 +1,71 @@ +package com.rj.service; + +import com.rj.entity.IndustryTags; + +import java.util.Map; + +/** + *

+ * 行业标签表 服务类 + *

+ * + * @author Auto Generated + * @since 2025-01-29 + */ +public interface IIndustryTagsService extends com.baomidou.mybatisplus.extension.service.IService { + + /** + * 根据条件分页查询行业标签列表 + * + * @param current 页码 + * @param size 每页大小 + * @param industry 所属行业 + * @param tagType 标签分类 + * @param tagName 标签名称(模糊查询) + * @return 分页结果 + */ + Map getIndustryTagsList(Integer current, Integer size, String industry, + String tagType, String tagName); + + /** + * 根据类型不分页查询行业标签列表 + * + * @param tagType 标签分类 + * @param industry 所属行业(可选) + * @return 查询结果 + */ + Map getIndustryTagsByType(String tagType, String industry); + + /** + * 根据ID查询行业标签 + * + * @param id 行业标签ID + * @return 查询结果 + */ + Map getIndustryTagsById(String id); + + /** + * 新增行业标签 + * + * @param industryTags 行业标签信息 + * @return 操作结果 + */ + Map addIndustryTags(IndustryTags industryTags); + + /** + * 更新行业标签信息 + * + * @param industryTags 行业标签信息 + * @return 操作结果 + */ + Map updateIndustryTags(IndustryTags industryTags); + + /** + * 根据ID删除行业标签 + * + * @param id 行业标签ID + * @return 操作结果 + */ + Map deleteIndustryTags(String id); +} + diff --git a/src/main/java/com/rj/service/impl/IndustryTagsServiceImpl.java b/src/main/java/com/rj/service/impl/IndustryTagsServiceImpl.java new file mode 100644 index 0000000..ae677f8 --- /dev/null +++ b/src/main/java/com/rj/service/impl/IndustryTagsServiceImpl.java @@ -0,0 +1,262 @@ +package com.rj.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.rj.entity.IndustryTags; +import com.rj.mapper.IndustryTagsMapper; +import com.rj.service.IIndustryTagsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + *

+ * 行业标签表 服务实现类 + *

+ * + * @author Auto Generated + * @since 2025-01-29 + */ +@Slf4j +@Service +public class IndustryTagsServiceImpl extends ServiceImpl implements IIndustryTagsService { + + @Override + public Map getIndustryTagsList(Integer current, Integer size, String industry, + String tagType, String tagName) { + Map result = new HashMap<>(); + try { + Page page = new Page<>(current, size); + LambdaQueryWrapper queryWrapper = buildQueryWrapper(industry, tagType, tagName); + + Page industryTagsPage = this.page(page, queryWrapper); + + result.put("success", true); + result.put("message", "查询成功"); + result.put("data", industryTagsPage.getRecords()); + result.put("total", industryTagsPage.getTotal()); + result.put("current", industryTagsPage.getCurrent()); + result.put("size", industryTagsPage.getSize()); + result.put("pages", industryTagsPage.getPages()); + } catch (Exception e) { + log.error("查询行业标签列表异常", e); + result.put("success", false); + result.put("message", "查询异常:" + e.getMessage()); + } + return result; + } + + @Override + public Map getIndustryTagsByType(String tagType, String industry) { + Map result = new HashMap<>(); + try { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + + // 必须指定标签类型 + if (!StringUtils.hasText(tagType)) { + result.put("success", false); + result.put("message", "标签分类不能为空"); + return result; + } + + queryWrapper.eq(IndustryTags::getTagType, tagType); + + // 如果指定了行业,则添加行业条件 + if (StringUtils.hasText(industry)) { + queryWrapper.eq(IndustryTags::getIndustry, industry); + } + + // 按创建时间倒序排列 + queryWrapper.orderByDesc(IndustryTags::getCreateTime); + + List industryTagsList = this.list(queryWrapper); + + result.put("success", true); + result.put("message", "查询成功"); + result.put("data", industryTagsList); + result.put("count", industryTagsList.size()); + } catch (Exception e) { + log.error("根据类型查询行业标签异常", e); + result.put("success", false); + result.put("message", "查询异常:" + e.getMessage()); + } + return result; + } + + @Override + public Map getIndustryTagsById(String id) { + Map result = new HashMap<>(); + try { + IndustryTags industryTags = this.getById(id); + if (industryTags != null) { + result.put("success", true); + result.put("message", "查询成功"); + result.put("data", industryTags); + } else { + result.put("success", false); + result.put("message", "行业标签不存在"); + } + } catch (Exception e) { + log.error("查询行业标签异常", e); + result.put("success", false); + result.put("message", "查询异常:" + e.getMessage()); + } + return result; + } + + @Override + public Map addIndustryTags(IndustryTags industryTags) { + Map result = new HashMap<>(); + try { + // 验证必填字段 + if (!StringUtils.hasText(industryTags.getIndustry())) { + result.put("success", false); + result.put("message", "所属行业不能为空"); + return result; + } + if (!StringUtils.hasText(industryTags.getTagType())) { + result.put("success", false); + result.put("message", "标签分类不能为空"); + return result; + } + if (!StringUtils.hasText(industryTags.getTagName())) { + result.put("success", false); + result.put("message", "标签名称不能为空"); + return result; + } + if (!StringUtils.hasText(industryTags.getTagDetail())) { + result.put("success", false); + result.put("message", "标签详情不能为空"); + return result; + } + + LocalDateTime now = LocalDateTime.now(); + if (industryTags.getId() == null || industryTags.getId().trim().isEmpty()) { + industryTags.setId(UUID.randomUUID().toString()); + } + industryTags.setCreateTime(now); + industryTags.setUpdateTime(now); + + boolean success = this.save(industryTags); + if (success) { + result.put("success", true); + result.put("message", "行业标签添加成功"); + result.put("data", industryTags); + } else { + result.put("success", false); + result.put("message", "行业标签添加失败"); + } + } catch (Exception e) { + log.error("添加行业标签异常", e); + result.put("success", false); + result.put("message", "添加异常:" + e.getMessage()); + } + return result; + } + + @Override + public Map updateIndustryTags(IndustryTags industryTags) { + Map result = new HashMap<>(); + try { + if (industryTags.getId() == null || industryTags.getId().trim().isEmpty()) { + result.put("success", false); + result.put("message", "行业标签ID不能为空"); + return result; + } + + // 验证必填字段 + if (!StringUtils.hasText(industryTags.getIndustry())) { + result.put("success", false); + result.put("message", "所属行业不能为空"); + return result; + } + if (!StringUtils.hasText(industryTags.getTagType())) { + result.put("success", false); + result.put("message", "标签分类不能为空"); + return result; + } + if (!StringUtils.hasText(industryTags.getTagName())) { + result.put("success", false); + result.put("message", "标签名称不能为空"); + return result; + } + if (!StringUtils.hasText(industryTags.getTagDetail())) { + result.put("success", false); + result.put("message", "标签详情不能为空"); + return result; + } + + industryTags.setUpdateTime(LocalDateTime.now()); + boolean success = this.updateById(industryTags); + + if (success) { + result.put("success", true); + result.put("message", "行业标签信息更新成功"); + result.put("data", industryTags); + } else { + result.put("success", false); + result.put("message", "行业标签信息更新失败"); + } + } catch (Exception e) { + log.error("更新行业标签异常", e); + result.put("success", false); + result.put("message", "更新异常:" + e.getMessage()); + } + return result; + } + + @Override + public Map deleteIndustryTags(String id) { + Map result = new HashMap<>(); + try { + boolean success = this.removeById(id); + if (success) { + result.put("success", true); + result.put("message", "行业标签删除成功"); + } else { + result.put("success", false); + result.put("message", "行业标签删除失败"); + } + } catch (Exception e) { + log.error("删除行业标签异常", e); + result.put("success", false); + result.put("message", "删除异常:" + e.getMessage()); + } + return result; + } + + /** + * 构建查询条件 + */ + private LambdaQueryWrapper buildQueryWrapper(String industry, String tagType, String tagName) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + + // 添加所属行业查询条件 + if (StringUtils.hasText(industry)) { + queryWrapper.eq(IndustryTags::getIndustry, industry.trim()); + } + + // 添加标签分类查询条件 + if (StringUtils.hasText(tagType)) { + queryWrapper.eq(IndustryTags::getTagType, tagType.trim()); + } + + // 添加标签名称模糊查询条件 + if (StringUtils.hasText(tagName)) { + queryWrapper.like(IndustryTags::getTagName, tagName.trim()); + } + + // 按创建时间倒序排列 + queryWrapper.orderByDesc(IndustryTags::getCreateTime); + + return queryWrapper; + } +} + diff --git a/src/main/resources/mapper/IndustryTagsMapper.xml b/src/main/resources/mapper/IndustryTagsMapper.xml new file mode 100644 index 0000000..c88992d --- /dev/null +++ b/src/main/resources/mapper/IndustryTagsMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + id, industry, tag_type, tag_name, tag_detail, remark, create_time, update_time + + + diff --git a/src/main/sql/device_management_add_sales_fields.sql b/src/main/sql/device_management_add_sales_fields.sql new file mode 100644 index 0000000..c1e7645 --- /dev/null +++ b/src/main/sql/device_management_add_sales_fields.sql @@ -0,0 +1,8 @@ +-- 为 device_management 表添加销售相关字段 +-- Date: 2025-01-XX + +ALTER TABLE `device_management` +ADD COLUMN `sales_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '销售名称' AFTER `project_name`, +ADD COLUMN `sales_phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '销售电话' AFTER `sales_name`; + + diff --git a/src/main/sql/industry_tags.sql b/src/main/sql/industry_tags.sql new file mode 100644 index 0000000..56f7f13 --- /dev/null +++ b/src/main/sql/industry_tags.sql @@ -0,0 +1,43 @@ +/* + Navicat Premium Data Transfer + + Source Server Type : MySQL + Source Server Version : 80042 + Target Server Type : MySQL + Target Server Version : 80042 + File Encoding : 65001 + + Date: 2025-01-29 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for industry_tags +-- ---------------------------- +DROP TABLE IF EXISTS `industry_tags`; + +CREATE TABLE `industry_tags` ( + `id` VARCHAR(36) PRIMARY KEY COMMENT 'UUID主键', + `industry` VARCHAR(100) NOT NULL COMMENT '所属行业', + `tag_type` VARCHAR(100) NOT NULL COMMENT '标签分类', + `tag_name` VARCHAR(100) NOT NULL COMMENT '标签名称', + `tag_detail` VARCHAR(100) NOT NULL COMMENT '标签详情', + `remark` VARCHAR(500) COMMENT '备注', + `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='行业标签表'; + +-- 添加索引以提高查询性能 +ALTER TABLE `industry_tags` +ADD INDEX `idx_industry`(`industry`) USING BTREE COMMENT '所属行业索引'; + +ALTER TABLE `industry_tags` +ADD INDEX `idx_tag_type`(`tag_type`) USING BTREE COMMENT '标签分类索引'; + +ALTER TABLE `industry_tags` +ADD INDEX `idx_industry_tag_type`(`industry`, `tag_type`) USING BTREE COMMENT '所属行业和标签分类联合索引'; + +SET FOREIGN_KEY_CHECKS = 1; +