From 36fa58c0de255ad56f50a565cbe7a5d93604dd88 Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期五, 28 八月 2026 15:56:57 +0800
Subject: [PATCH] feat(quality): 新增质量管理-报告管理模块
---
src/main/java/com/ruoyi/project/quality/report/service/IInspectionReportService.java | 17 +++
src/main/java/com/ruoyi/project/quality/report/domain/InspectionReport.java | 82 ++++++++++++++++
sql/qms_inspection_report.sql | 21 ++++
src/main/java/com/ruoyi/project/quality/report/mapper/InspectionReportMapper.java | 12 ++
src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java | 2
src/main/java/com/ruoyi/project/quality/report/service/impl/InspectionReportServiceImpl.java | 52 ++++++++++
src/main/java/com/ruoyi/project/quality/report/controller/InspectionReportController.java | 73 ++++++++++++++
src/main/resources/mapper/quality/InspectionReportMapper.xml | 7 +
8 files changed, 265 insertions(+), 1 deletions(-)
diff --git a/sql/qms_inspection_report.sql b/sql/qms_inspection_report.sql
new file mode 100644
index 0000000..301e90f
--- /dev/null
+++ b/sql/qms_inspection_report.sql
@@ -0,0 +1,21 @@
+CREATE TABLE `qms_inspection_report` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '涓婚敭ID',
+ `product_name` varchar(100) NOT NULL COMMENT '浜у搧鍚嶇О',
+ `product_model` varchar(100) DEFAULT NULL COMMENT '浜у搧鍨嬪彿',
+ `report_no` varchar(100) NOT NULL COMMENT '鎶ュ憡缂栧彿',
+ `report_date` date NOT NULL COMMENT '鎶ュ憡鏃ユ湡',
+ `validity_period` int(11) NOT NULL COMMENT '鏈夋晥鏈�(鏈�)',
+ `expiration_time` date NOT NULL COMMENT '鍒版湡鏃堕棿',
+ `testing_agency` varchar(100) DEFAULT NULL COMMENT '妫�娴嬪崟浣�',
+ `report_type` varchar(50) DEFAULT NULL COMMENT '鎶ュ憡绫诲瀷(瀛楀吀椤�)',
+ `attachment_urls` varchar(2000) DEFAULT NULL COMMENT '闄勪欢涓婁紶(澶歎RL閫楀彿鍒嗛殧)',
+ `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+ `status` varchar(20) DEFAULT 'NORMAL' COMMENT '鐘舵��(NORMAL:姝e父, CANCELLED:娉ㄩ攢)',
+ `create_user` bigint(20) DEFAULT NULL COMMENT '鍒涘缓浜篒D',
+ `create_time` datetime DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `update_user` bigint(20) DEFAULT NULL COMMENT '鏇存柊浜篒D',
+ `update_time` datetime DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `tenant_id` bigint(20) DEFAULT NULL COMMENT '绉熸埛ID',
+ `dept_id` bigint(20) DEFAULT NULL COMMENT '閮ㄩ棬ID',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='妫�娴嬫姤鍛婄鐞嗚〃';
diff --git a/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java b/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java
index 3728aae..e46a4bb 100644
--- a/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java
+++ b/src/main/java/com/ruoyi/ai/config/EmbeddingStoreConfig.java
@@ -45,7 +45,7 @@
.createIndex(PineconeServerlessIndexConfig.builder()
.cloud("AWS")
.region("us-east-1")
- .dimension(embeddingModel.dimension()) // 涓存椂鍐欐缁村害(qwen涓�鑸槸1536)锛岄伩鍏嶉」鐩惎鍔ㄦ椂璋冪敤API瀵艰嚧娆犺垂鎶ラ敊
+ .dimension(1536) // 涓存椂鍐欐缁村害(qwen涓�鑸槸1536)锛岄伩鍏嶉」鐩惎鍔ㄦ椂璋冪敤API瀵艰嚧娆犺垂鎶ラ敊
.build())
.build();
}
diff --git a/src/main/java/com/ruoyi/project/quality/report/controller/InspectionReportController.java b/src/main/java/com/ruoyi/project/quality/report/controller/InspectionReportController.java
new file mode 100644
index 0000000..b444c5a
--- /dev/null
+++ b/src/main/java/com/ruoyi/project/quality/report/controller/InspectionReportController.java
@@ -0,0 +1,73 @@
+package com.ruoyi.project.quality.report.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.project.quality.report.domain.InspectionReport;
+import com.ruoyi.project.quality.report.service.IInspectionReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+
+/**
+ * 妫�娴嬫姤鍛� Controller
+ */
+@RestController
+@RequestMapping("/quality/inspectionReport")
+public class InspectionReportController {
+
+ @Autowired
+ private IInspectionReportService inspectionReportService;
+
+ /**
+ * 鏌ヨ妫�娴嬫姤鍛婂垪琛�
+ */
+ @GetMapping("/listPage")
+ public AjaxResult listPage(Page<InspectionReport> page, InspectionReport report) {
+ IPage<InspectionReport> iPage = inspectionReportService.listPage(page, report);
+ return AjaxResult.success(iPage);
+ }
+
+ /**
+ * 鑾峰彇妫�娴嬫姤鍛婅缁嗕俊鎭�
+ */
+ @GetMapping("/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return AjaxResult.success(inspectionReportService.getById(id));
+ }
+
+ /**
+ * 鏂板妫�娴嬫姤鍛�
+ */
+ @PostMapping
+ public AjaxResult add(@RequestBody InspectionReport report) {
+ // 榛樿鐘舵�佷负姝e父
+ if (report.getStatus() == null) {
+ report.setStatus("NORMAL");
+ }
+ return AjaxResult.success(inspectionReportService.save(report));
+ }
+
+ /**
+ * 淇敼妫�娴嬫姤鍛�
+ */
+ @PutMapping
+ public AjaxResult edit(@RequestBody InspectionReport report) {
+ return AjaxResult.success(inspectionReportService.updateById(report));
+ }
+
+ /**
+ * 娉ㄩ攢(杞垹闄�)妫�娴嬫姤鍛�
+ */
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ for (Long id : ids) {
+ InspectionReport report = new InspectionReport();
+ report.setId(id);
+ report.setStatus("CANCELLED");
+ inspectionReportService.updateById(report);
+ }
+ return AjaxResult.success();
+ }
+}
diff --git a/src/main/java/com/ruoyi/project/quality/report/domain/InspectionReport.java b/src/main/java/com/ruoyi/project/quality/report/domain/InspectionReport.java
new file mode 100644
index 0000000..27bfe24
--- /dev/null
+++ b/src/main/java/com/ruoyi/project/quality/report/domain/InspectionReport.java
@@ -0,0 +1,82 @@
+package com.ruoyi.project.quality.report.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 妫�娴嬫姤鍛婂璞� qms_inspection_report
+ */
+@Data
+@TableName("qms_inspection_report")
+public class InspectionReport implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /** 涓婚敭ID */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /** 浜у搧鍚嶇О */
+ private String productName;
+
+ /** 浜у搧鍨嬪彿 */
+ private String productModel;
+
+ /** 鎶ュ憡缂栧彿 */
+ private String reportNo;
+
+ /** 鎶ュ憡鏃ユ湡 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date reportDate;
+
+ /** 鏈夋晥鏈�(鏈�) */
+ private Integer validityPeriod;
+
+ /** 鍒版湡鏃堕棿 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date expirationTime;
+
+ /** 妫�娴嬪崟浣� */
+ private String testingAgency;
+
+ /** 鎶ュ憡绫诲瀷 */
+ private String reportType;
+
+ /** 闄勪欢涓婁紶(澶歎RL閫楀彿鍒嗛殧) */
+ private String attachmentUrls;
+
+ /** 澶囨敞 */
+ private String remark;
+
+ /** 鐘舵��(NORMAL:姝e父, CANCELLED:娉ㄩ攢) */
+ private String status;
+
+ /** 鍒涘缓浜� */
+ @TableField(fill = FieldFill.INSERT)
+ private Long createUser;
+
+ /** 鍒涘缓鏃堕棿 */
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ /** 鏇存柊浜� */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Long updateUser;
+
+ /** 鏇存柊鏃堕棿 */
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date updateTime;
+
+ /** 绉熸埛ID */
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+
+ /** 閮ㄩ棬ID */
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+}
diff --git a/src/main/java/com/ruoyi/project/quality/report/mapper/InspectionReportMapper.java b/src/main/java/com/ruoyi/project/quality/report/mapper/InspectionReportMapper.java
new file mode 100644
index 0000000..2ac149a
--- /dev/null
+++ b/src/main/java/com/ruoyi/project/quality/report/mapper/InspectionReportMapper.java
@@ -0,0 +1,12 @@
+package com.ruoyi.project.quality.report.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.project.quality.report.domain.InspectionReport;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 妫�娴嬫姤鍛奙apper鎺ュ彛
+ */
+@Mapper
+public interface InspectionReportMapper extends BaseMapper<InspectionReport> {
+}
diff --git a/src/main/java/com/ruoyi/project/quality/report/service/IInspectionReportService.java b/src/main/java/com/ruoyi/project/quality/report/service/IInspectionReportService.java
new file mode 100644
index 0000000..89da444
--- /dev/null
+++ b/src/main/java/com/ruoyi/project/quality/report/service/IInspectionReportService.java
@@ -0,0 +1,17 @@
+package com.ruoyi.project.quality.report.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.project.quality.report.domain.InspectionReport;
+
+/**
+ * 妫�娴嬫姤鍛奡ervice鎺ュ彛
+ */
+public interface IInspectionReportService extends IService<InspectionReport> {
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ */
+ IPage<InspectionReport> listPage(Page<InspectionReport> page, InspectionReport report);
+}
diff --git a/src/main/java/com/ruoyi/project/quality/report/service/impl/InspectionReportServiceImpl.java b/src/main/java/com/ruoyi/project/quality/report/service/impl/InspectionReportServiceImpl.java
new file mode 100644
index 0000000..42554e7
--- /dev/null
+++ b/src/main/java/com/ruoyi/project/quality/report/service/impl/InspectionReportServiceImpl.java
@@ -0,0 +1,52 @@
+package com.ruoyi.project.quality.report.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.project.quality.report.domain.InspectionReport;
+import com.ruoyi.project.quality.report.mapper.InspectionReportMapper;
+import com.ruoyi.project.quality.report.service.IInspectionReportService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+/**
+ * 妫�娴嬫姤鍛奡ervice涓氬姟灞傚鐞�
+ */
+@Service
+public class InspectionReportServiceImpl extends ServiceImpl<InspectionReportMapper, InspectionReport> implements IInspectionReportService {
+
+ @Override
+ public IPage<InspectionReport> listPage(Page<InspectionReport> page, InspectionReport report) {
+ LambdaQueryWrapper<InspectionReport> lqw = Wrappers.lambdaQuery();
+
+ if (report != null) {
+ if (StringUtils.isNotBlank(report.getProductName())) {
+ lqw.like(InspectionReport::getProductName, report.getProductName());
+ }
+ if (StringUtils.isNotBlank(report.getProductModel())) {
+ lqw.like(InspectionReport::getProductModel, report.getProductModel());
+ }
+ if (StringUtils.isNotBlank(report.getReportNo())) {
+ lqw.like(InspectionReport::getReportNo, report.getReportNo());
+ }
+ if (StringUtils.isNotBlank(report.getReportType())) {
+ lqw.eq(InspectionReport::getReportType, report.getReportType());
+ }
+ if (StringUtils.isNotBlank(report.getStatus())) {
+ lqw.eq(InspectionReport::getStatus, report.getStatus());
+ } else {
+ // 榛樿鏌ヨ姝e父鐨�
+ lqw.ne(InspectionReport::getStatus, "CANCELLED");
+ }
+ } else {
+ lqw.ne(InspectionReport::getStatus, "CANCELLED");
+ }
+
+ // 鎸夌収鍒版湡鏃堕棿姝e簭锛岃秺杩戝埌鏈熸帓鍦ㄨ秺鍓�
+ lqw.orderByAsc(InspectionReport::getExpirationTime);
+
+ return baseMapper.selectPage(page, lqw);
+ }
+}
diff --git a/src/main/resources/mapper/quality/InspectionReportMapper.xml b/src/main/resources/mapper/quality/InspectionReportMapper.xml
new file mode 100644
index 0000000..32a6321
--- /dev/null
+++ b/src/main/resources/mapper/quality/InspectionReportMapper.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.project.quality.report.mapper.InspectionReportMapper">
+
+</mapper>
--
Gitblit v1.9.3