页面优化 数据采集 优化 / 提示 / 提纯
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.banben.modules.collect.controller;
|
||||
|
||||
import com.banben.common.Result;
|
||||
import com.banben.modules.collect.dto.CollectTableVO;
|
||||
import com.banben.modules.collect.entity.CollectTask;
|
||||
import com.banben.modules.collect.service.CollectService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -29,11 +30,16 @@ public class CollectController {
|
||||
return Result.success(collectService.createTask(task));
|
||||
}
|
||||
|
||||
@Operation(summary = "执行采集任务")
|
||||
@Operation(summary = "测试来源库连接,并查看表字段如何写入版本资源表")
|
||||
@PostMapping("/preview")
|
||||
public Result<CollectTableVO> preview(@RequestBody CollectTask source) {
|
||||
return Result.success(collectService.previewSource(source));
|
||||
}
|
||||
|
||||
@Operation(summary = "执行采集任务:按来源表读取并写入版本资源表")
|
||||
@PostMapping("/task/{id}/start")
|
||||
public Result<Void> startTask(@PathVariable Long id) {
|
||||
collectService.startTask(id);
|
||||
return Result.success();
|
||||
public Result<CollectTask> startTask(@PathVariable Long id) {
|
||||
return Result.success(collectService.startTask(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "采集任务列表")
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.banben.modules.collect.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 来源表的一列,以及它会写入版本资源表的哪个字段。
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "采集字段对应关系")
|
||||
public class CollectColumnVO {
|
||||
|
||||
@Schema(description = "来源列名")
|
||||
private String columnName;
|
||||
|
||||
@Schema(description = "写入 version_resource 的字段名,无法对应时为空")
|
||||
private String targetField;
|
||||
|
||||
@Schema(description = "写入字段的中文名")
|
||||
private String targetLabel;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.banben.modules.collect.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 可采集的数据库表。
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "可采集数据表")
|
||||
public class CollectTableVO {
|
||||
|
||||
@Schema(description = "表名")
|
||||
private String tableName;
|
||||
|
||||
@Schema(description = "当前行数")
|
||||
private long rowCount;
|
||||
|
||||
@Schema(description = "列与版本资源字段的对应关系")
|
||||
private List<CollectColumnVO> columns = new ArrayList<>();
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -32,6 +33,25 @@ public class CollectTask implements Serializable {
|
||||
@Schema(description = "数据源类型:MARC/EXCEL/DB/API")
|
||||
private String sourceType;
|
||||
|
||||
@Schema(description = "数据库地址,如 10.1.1.14")
|
||||
private String dbHost;
|
||||
|
||||
@Schema(description = "数据库端口,瀚高默认 5866,PostgreSQL 默认 5432")
|
||||
private Integer dbPort;
|
||||
|
||||
@Schema(description = "数据库名")
|
||||
private String dbName;
|
||||
|
||||
@Schema(description = "数据库用户名")
|
||||
private String dbUsername;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
@Schema(description = "数据库密码,只用于连接,接口不回传")
|
||||
private String dbPassword;
|
||||
|
||||
@Schema(description = "要采集的表名,可写 schema.table")
|
||||
private String sourceTable;
|
||||
|
||||
@Schema(description = "目标采集量")
|
||||
private Integer targetCount;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.banben.modules.collect.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.banben.modules.collect.dto.CollectTableVO;
|
||||
import com.banben.modules.collect.entity.CollectTask;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,9 +17,14 @@ public interface CollectService extends IService<CollectTask> {
|
||||
Long createTask(CollectTask task);
|
||||
|
||||
/**
|
||||
* 执行采集任务(异步)。
|
||||
* 执行采集任务,返回执行后的任务(含采集条数和结果说明)。
|
||||
*/
|
||||
void startTask(Long taskId);
|
||||
CollectTask startTask(Long taskId);
|
||||
|
||||
/**
|
||||
* 按填写的地址、账号和表名连接来源库,返回行数和字段对应关系。
|
||||
*/
|
||||
CollectTableVO previewSource(CollectTask source);
|
||||
|
||||
/**
|
||||
* 查询任务列表。
|
||||
|
||||
+18
-7
@@ -3,6 +3,7 @@ package com.banben.modules.collect.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.banben.common.BusinessException;
|
||||
import com.banben.modules.collect.dto.CollectTableVO;
|
||||
import com.banben.modules.collect.entity.CollectTask;
|
||||
import com.banben.modules.collect.mapper.CollectTaskMapper;
|
||||
import com.banben.modules.collect.service.CollectService;
|
||||
@@ -37,11 +38,14 @@ public class CollectServiceImpl extends ServiceImpl<CollectTaskMapper, CollectTa
|
||||
/** 数据源类型 → 采集适配器 的映射(key 统一大写)。 */
|
||||
private final Map<String, Collector> collectorMap;
|
||||
|
||||
private final DbTableCollector dbTableCollector;
|
||||
|
||||
/**
|
||||
* 构造注入所有 Collector 实现。
|
||||
* 若当前没有任何实现类,Spring 注入空集合,运行时会提示「未找到适配器」并跳过实际采集。
|
||||
*/
|
||||
public CollectServiceImpl(List<Collector> collectors) {
|
||||
public CollectServiceImpl(List<Collector> collectors, DbTableCollector dbTableCollector) {
|
||||
this.dbTableCollector = dbTableCollector;
|
||||
this.collectorMap = collectors.stream()
|
||||
.collect(Collectors.toMap(c -> c.sourceType().toUpperCase(), Function.identity(), (a, b) -> a));
|
||||
}
|
||||
@@ -60,7 +64,12 @@ public class CollectServiceImpl extends ServiceImpl<CollectTaskMapper, CollectTa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTask(Long taskId) {
|
||||
public CollectTableVO previewSource(CollectTask source) {
|
||||
return dbTableCollector.preview(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectTask startTask(Long taskId) {
|
||||
CollectTask task = this.getById(taskId);
|
||||
if (task == null) {
|
||||
throw new BusinessException("采集任务不存在");
|
||||
@@ -78,22 +87,24 @@ public class CollectServiceImpl extends ServiceImpl<CollectTaskMapper, CollectTa
|
||||
Collector collector = collectorMap.get(sourceType);
|
||||
int count;
|
||||
if (collector == null) {
|
||||
log.warn("未找到数据源类型 [{}] 的采集适配器,任务 {} 跳过实际采集", sourceType, taskId);
|
||||
count = 0;
|
||||
} else {
|
||||
count = collector.collect(task);
|
||||
throw new BusinessException("未找到数据源类型 " + sourceType + " 的采集适配器");
|
||||
}
|
||||
count = collector.collect(task);
|
||||
task.setCollectedCount(count);
|
||||
task.setStatus("SUCCESS");
|
||||
task.setMessage("采集完成");
|
||||
if (task.getMessage() == null || task.getMessage().isBlank()) {
|
||||
task.setMessage("采集完成,写入 " + count + " 条");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("采集任务执行失败: {}", e.getMessage(), e);
|
||||
task.setStatus("FAILED");
|
||||
task.setCollectedCount(0);
|
||||
task.setMessage(e.getMessage());
|
||||
} finally {
|
||||
task.setEndTime(LocalDateTime.now());
|
||||
this.updateById(task);
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
package com.banben.modules.collect.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.banben.common.BusinessException;
|
||||
import com.banben.modules.collect.dto.CollectColumnVO;
|
||||
import com.banben.modules.collect.dto.CollectTableVO;
|
||||
import com.banben.modules.collect.entity.CollectTask;
|
||||
import com.banben.modules.collect.service.Collector;
|
||||
import com.banben.modules.resource.entity.VersionResource;
|
||||
import com.banben.modules.resource.enums.GovernStatus;
|
||||
import com.banben.modules.resource.mapper.VersionResourceMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* 从当前数据库的指定表采集记录,按版本资源表的字段写入 {@code version_resource}。
|
||||
*
|
||||
* <p>列名与版本资源字段一致时直接填入;书名、作者、出版社等常见别名也会识别。
|
||||
* 对不上的列不写入。治理状态统一记为原始数据。</p>
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class DbTableCollector implements Collector {
|
||||
|
||||
private static final DateTimeFormatter DAY = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
private static final int MAX_ROWS = 200000;
|
||||
|
||||
private static final Map<String, String> FIELD_BY_COLUMN = new HashMap<>();
|
||||
private static final Map<String, String> FIELD_LABEL = new LinkedHashMap<>();
|
||||
private static final Map<String, BiConsumer<VersionResource, String>> SETTERS = new HashMap<>();
|
||||
|
||||
static {
|
||||
label("processNo", "加工编号");
|
||||
label("title", "正题名");
|
||||
label("clcCode", "中图分类号");
|
||||
label("keywords", "主题词或关键词");
|
||||
label("summary", "摘要");
|
||||
label("publishYear", "出版年份");
|
||||
label("processDate", "加工日期");
|
||||
label("contentForm", "内容形式");
|
||||
label("mediaType", "媒体类型");
|
||||
label("format", "格式");
|
||||
label("pageCount", "页码");
|
||||
label("language", "语种");
|
||||
label("submitOrg", "数据提交单位");
|
||||
label("taskYear", "所属任务年份");
|
||||
label("sourceLibrary", "来源馆");
|
||||
label("sourceLibraryAddr", "来源馆地址");
|
||||
label("fulltextUrl", "全文地址");
|
||||
label("otherTitle", "其他题名");
|
||||
label("author", "责任者");
|
||||
label("responsibility", "责任方式");
|
||||
label("note", "附注");
|
||||
label("publisher", "出版者");
|
||||
label("publishPlace", "出版地");
|
||||
label("publishDate", "出版日期");
|
||||
label("edition", "版本");
|
||||
label("isbn", "ISBN");
|
||||
label("unifiedBookNo", "统一书号");
|
||||
label("cdoi", "CDOI");
|
||||
label("publishUrl", "发布地址");
|
||||
|
||||
alias("processNo", "process_no", "processno", "加工编号");
|
||||
alias("title", "title", "name", "book_name", "bookname", "resource_title", "题名", "正题名", "书名");
|
||||
alias("clcCode", "clc_code", "clccode", "clc", "class_no", "classno", "分类号", "中图分类号");
|
||||
alias("keywords", "keywords", "keyword", "subject", "关键词", "主题词");
|
||||
alias("summary", "summary", "abstract", "intro", "摘要", "简介");
|
||||
alias("publishYear", "publish_year", "publishyear", "pub_year", "pubyear", "出版年", "出版年份");
|
||||
alias("processDate", "process_date", "processdate", "加工日期");
|
||||
alias("contentForm", "content_form", "contentform", "内容形式");
|
||||
alias("mediaType", "media_type", "mediatype", "媒体类型", "资源类型");
|
||||
alias("format", "format", "格式");
|
||||
alias("pageCount", "page_count", "pagecount", "pages", "页码", "页数");
|
||||
alias("language", "language", "lang", "语种");
|
||||
alias("submitOrg", "submit_org", "submitorg", "org_name", "orgname", "数据提交单位", "提交单位");
|
||||
alias("taskYear", "task_year", "taskyear", "所属任务年份", "任务年份");
|
||||
alias("sourceLibrary", "source_library", "sourcelibrary", "library_name", "libraryname", "来源馆", "馆藏单位");
|
||||
alias("sourceLibraryAddr", "source_library_addr", "sourcelibraryaddr", "来源馆地址");
|
||||
alias("fulltextUrl", "fulltext_url", "fulltexturl", "file_url", "fileurl", "ebook_url", "ebookurl", "全文地址");
|
||||
alias("otherTitle", "other_title", "othertitle", "其他题名");
|
||||
alias("author", "author", "writer", "作者", "责任者");
|
||||
alias("responsibility", "responsibility", "责任方式");
|
||||
alias("note", "note", "remark", "附注", "备注");
|
||||
alias("publisher", "publisher", "press", "出版者", "出版社");
|
||||
alias("publishPlace", "publish_place", "publishplace", "出版地");
|
||||
alias("publishDate", "publish_date", "publishdate", "出版日期");
|
||||
alias("edition", "edition", "版本", "版次");
|
||||
alias("isbn", "isbn");
|
||||
alias("unifiedBookNo", "unified_book_no", "unifiedbookno", "统一书号");
|
||||
alias("cdoi", "cdoi");
|
||||
alias("publishUrl", "publish_url", "publishurl", "发布地址");
|
||||
|
||||
setter("processNo", VersionResource::setProcessNo, 128);
|
||||
setter("title", VersionResource::setTitle, 512);
|
||||
setter("clcCode", VersionResource::setClcCode, 64);
|
||||
setter("keywords", VersionResource::setKeywords, 512);
|
||||
setter("summary", VersionResource::setSummary, 0);
|
||||
setter("publishYear", VersionResource::setPublishYear, 8);
|
||||
setter("processDate", VersionResource::setProcessDate, 16);
|
||||
setter("contentForm", VersionResource::setContentForm, 64);
|
||||
setter("mediaType", VersionResource::setMediaType, 32);
|
||||
setter("format", VersionResource::setFormat, 64);
|
||||
setter("pageCount", VersionResource::setPageCount, 64);
|
||||
setter("language", VersionResource::setLanguage, 16);
|
||||
setter("submitOrg", VersionResource::setSubmitOrg, 256);
|
||||
setter("taskYear", VersionResource::setTaskYear, 8);
|
||||
setter("sourceLibrary", VersionResource::setSourceLibrary, 256);
|
||||
setter("sourceLibraryAddr", VersionResource::setSourceLibraryAddr, 256);
|
||||
setter("fulltextUrl", VersionResource::setFulltextUrl, 1024);
|
||||
setter("otherTitle", VersionResource::setOtherTitle, 512);
|
||||
setter("author", VersionResource::setAuthor, 512);
|
||||
setter("responsibility", VersionResource::setResponsibility, 256);
|
||||
setter("note", VersionResource::setNote, 0);
|
||||
setter("publisher", VersionResource::setPublisher, 256);
|
||||
setter("publishPlace", VersionResource::setPublishPlace, 128);
|
||||
setter("publishDate", VersionResource::setPublishDate, 32);
|
||||
setter("edition", VersionResource::setEdition, 128);
|
||||
setter("isbn", VersionResource::setIsbn, 64);
|
||||
setter("unifiedBookNo", VersionResource::setUnifiedBookNo, 64);
|
||||
setter("cdoi", VersionResource::setCdoi, 256);
|
||||
setter("publishUrl", VersionResource::setPublishUrl, 1024);
|
||||
}
|
||||
|
||||
private final VersionResourceMapper resourceMapper;
|
||||
|
||||
@Override
|
||||
public String sourceType() {
|
||||
return "DB";
|
||||
}
|
||||
|
||||
/**
|
||||
* 用页面填写的地址、账号和表名连接来源库,返回行数以及列如何写入版本资源表。
|
||||
*/
|
||||
public CollectTableVO preview(CollectTask task) {
|
||||
String[] qualified = qualify(task.getSourceTable());
|
||||
try (Connection connection = openConnection(task)) {
|
||||
ensureTable(connection, qualified[0], qualified[1]);
|
||||
CollectTableVO table = new CollectTableVO();
|
||||
table.setTableName(qualified[0] + "." + qualified[1]);
|
||||
table.setRowCount(countRows(connection, qualified[0], qualified[1]));
|
||||
table.setColumns(readColumns(connection, qualified[0], qualified[1]));
|
||||
return table;
|
||||
} catch (SQLException e) {
|
||||
throw new BusinessException(sqlMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int collect(CollectTask task) {
|
||||
String[] qualified = qualify(task.getSourceTable());
|
||||
int limit = task.getTargetCount() == null ? MAX_ROWS : Math.min(Math.max(task.getTargetCount(), 1), MAX_ROWS);
|
||||
List<Map<String, Object>> rows;
|
||||
try (Connection connection = openConnection(task)) {
|
||||
ensureTable(connection, qualified[0], qualified[1]);
|
||||
rows = readRows(connection, qualified[0], qualified[1], limit);
|
||||
} catch (SQLException e) {
|
||||
throw new BusinessException(sqlMessage(e));
|
||||
}
|
||||
String table = qualified[1];
|
||||
|
||||
Set<String> existing = loadProcessNos();
|
||||
int inserted = 0;
|
||||
int duplicated = 0;
|
||||
int missingTitle = 0;
|
||||
int sequence = 0;
|
||||
String today = LocalDate.now().format(DAY);
|
||||
String year = String.valueOf(LocalDate.now().getYear());
|
||||
|
||||
for (Map<String, Object> row : rows) {
|
||||
VersionResource resource = new VersionResource();
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
String field = FIELD_BY_COLUMN.get(normalize(entry.getKey()));
|
||||
if (field == null || entry.getValue() == null) {
|
||||
continue;
|
||||
}
|
||||
String value = stringify(entry.getValue());
|
||||
if (value.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
SETTERS.get(field).accept(resource, value);
|
||||
}
|
||||
if (blank(resource.getTitle())) {
|
||||
missingTitle++;
|
||||
continue;
|
||||
}
|
||||
if (blank(resource.getProcessNo())) {
|
||||
Object sourceId = first(row, "id");
|
||||
sequence++;
|
||||
String suffix = sourceId == null ? String.valueOf(sequence) : stringify(sourceId);
|
||||
String prefix = blank(task.getLibraryCode()) ? "DB" : task.getLibraryCode().trim();
|
||||
resource.setProcessNo(truncate(prefix + "-" + table + "-" + suffix, 128));
|
||||
}
|
||||
if (existing.contains(resource.getProcessNo())) {
|
||||
duplicated++;
|
||||
continue;
|
||||
}
|
||||
if (blank(resource.getSourceLibrary())) {
|
||||
resource.setSourceLibrary(truncate(task.getLibraryName(), 256));
|
||||
}
|
||||
if (blank(resource.getSubmitOrg())) {
|
||||
resource.setSubmitOrg(truncate(blank(task.getLibraryName()) ? resource.getSourceLibrary() : task.getLibraryName(), 256));
|
||||
}
|
||||
if (blank(resource.getTaskYear())) {
|
||||
resource.setTaskYear(year);
|
||||
}
|
||||
if (blank(resource.getProcessDate())) {
|
||||
resource.setProcessDate(today);
|
||||
}
|
||||
resource.setGovernStatus(GovernStatus.RAW.getCode());
|
||||
resource.setAbnormalFlag(0);
|
||||
resource.setSensitiveFlag(0);
|
||||
resource.setIsSpecial(0);
|
||||
resource.setManageStatus(0);
|
||||
resource.setDeleted(0);
|
||||
resourceMapper.insert(resource);
|
||||
existing.add(resource.getProcessNo());
|
||||
inserted++;
|
||||
}
|
||||
|
||||
task.setMessage(String.format(
|
||||
"已从 %s:%s/%s 的表 %s.%s 读取 %d 条,按版本资源字段写入 %d 条,跳过重复 %d 条,缺少正题名 %d 条",
|
||||
task.getDbHost(), task.getDbPort(), task.getDbName(), qualified[0], qualified[1],
|
||||
rows.size(), inserted, duplicated, missingTitle));
|
||||
return inserted;
|
||||
}
|
||||
|
||||
private Connection openConnection(CollectTask task) {
|
||||
if (blank(task.getDbHost()) || !task.getDbHost().trim().matches("[A-Za-z0-9._-]+")) {
|
||||
throw new BusinessException("请填写合法的数据库地址");
|
||||
}
|
||||
int port = task.getDbPort() == null ? 5432 : task.getDbPort();
|
||||
if (port < 1 || port > 65535) {
|
||||
throw new BusinessException("数据库端口应在 1 到 65535 之间");
|
||||
}
|
||||
if (blank(task.getDbName()) || !task.getDbName().trim().matches("[A-Za-z0-9_]+")) {
|
||||
throw new BusinessException("请填写合法的数据库名");
|
||||
}
|
||||
if (blank(task.getDbUsername())) {
|
||||
throw new BusinessException("请填写数据库用户名");
|
||||
}
|
||||
if (blank(task.getDbPassword())) {
|
||||
throw new BusinessException("请填写数据库密码");
|
||||
}
|
||||
String url = "jdbc:postgresql://" + task.getDbHost().trim() + ":" + port + "/"
|
||||
+ task.getDbName().trim() + "?connectTimeout=8&socketTimeout=30";
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("user", task.getDbUsername().trim());
|
||||
properties.setProperty("password", task.getDbPassword());
|
||||
try {
|
||||
return DriverManager.getConnection(url, properties);
|
||||
} catch (SQLException e) {
|
||||
throw new BusinessException(sqlMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
private String[] qualify(String raw) {
|
||||
if (blank(raw)) {
|
||||
throw new BusinessException("请填写要采集的表名");
|
||||
}
|
||||
String[] parts = raw.trim().split("\\.");
|
||||
if (parts.length > 2) {
|
||||
throw new BusinessException("表名格式应为表名,或模式名.表名");
|
||||
}
|
||||
String schema = parts.length == 2 ? parts[0] : "public";
|
||||
String table = parts.length == 2 ? parts[1] : parts[0];
|
||||
if (!schema.matches("[A-Za-z_][A-Za-z0-9_]*") || !table.matches("[A-Za-z_][A-Za-z0-9_]*")) {
|
||||
throw new BusinessException("表名只能包含字母、数字和下划线");
|
||||
}
|
||||
return new String[]{schema.toLowerCase(Locale.ROOT), table.toLowerCase(Locale.ROOT)};
|
||||
}
|
||||
|
||||
private void ensureTable(Connection connection, String schema, String table) throws SQLException {
|
||||
try (PreparedStatement statement = connection.prepareStatement("""
|
||||
SELECT COUNT(*) FROM information_schema.tables
|
||||
WHERE table_schema = ? AND table_name = ?
|
||||
""")) {
|
||||
statement.setString(1, schema);
|
||||
statement.setString(2, table);
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
resultSet.next();
|
||||
if (resultSet.getInt(1) == 0) {
|
||||
throw new BusinessException("来源库中不存在表:" + schema + "." + table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long countRows(Connection connection, String schema, String table) throws SQLException {
|
||||
try (PreparedStatement statement = connection.prepareStatement(
|
||||
"SELECT COUNT(*) FROM \"" + schema + "\".\"" + table + "\"");
|
||||
ResultSet resultSet = statement.executeQuery()) {
|
||||
resultSet.next();
|
||||
return resultSet.getLong(1);
|
||||
}
|
||||
}
|
||||
|
||||
private List<CollectColumnVO> readColumns(Connection connection, String schema, String table) throws SQLException {
|
||||
List<CollectColumnVO> columns = new ArrayList<>();
|
||||
try (PreparedStatement statement = connection.prepareStatement("""
|
||||
SELECT column_name FROM information_schema.columns
|
||||
WHERE table_schema = ? AND table_name = ?
|
||||
ORDER BY ordinal_position
|
||||
""")) {
|
||||
statement.setString(1, schema);
|
||||
statement.setString(2, table);
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
while (resultSet.next()) {
|
||||
String columnName = resultSet.getString(1);
|
||||
CollectColumnVO item = new CollectColumnVO();
|
||||
item.setColumnName(columnName);
|
||||
String field = FIELD_BY_COLUMN.get(normalize(columnName));
|
||||
item.setTargetField(field);
|
||||
item.setTargetLabel(field == null ? null : FIELD_LABEL.get(field));
|
||||
columns.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> readRows(Connection connection, String schema, String table, int limit)
|
||||
throws SQLException {
|
||||
List<Map<String, Object>> rows = new ArrayList<>();
|
||||
try (PreparedStatement statement = connection.prepareStatement(
|
||||
"SELECT * FROM \"" + schema + "\".\"" + table + "\" LIMIT " + limit);
|
||||
ResultSet resultSet = statement.executeQuery()) {
|
||||
ResultSetMetaData meta = resultSet.getMetaData();
|
||||
while (resultSet.next()) {
|
||||
Map<String, Object> row = new LinkedHashMap<>();
|
||||
for (int i = 1; i <= meta.getColumnCount(); i++) {
|
||||
row.put(meta.getColumnLabel(i), resultSet.getObject(i));
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
private String sqlMessage(SQLException exception) {
|
||||
String message = exception.getMessage() == null ? "" : exception.getMessage();
|
||||
String lower = message.toLowerCase(Locale.ROOT);
|
||||
if (lower.contains("password authentication failed") || lower.contains("authentication failed")) {
|
||||
return "数据库用户名或密码错误";
|
||||
}
|
||||
if (lower.contains("does not exist") && lower.contains("database")) {
|
||||
return "数据库不存在";
|
||||
}
|
||||
if (lower.contains("connection refused")) {
|
||||
return "连接被拒绝,请检查数据库地址和端口";
|
||||
}
|
||||
if (lower.contains("timeout") || lower.contains("timed out")) {
|
||||
return "连接超时,请检查数据库地址和端口";
|
||||
}
|
||||
String brief = message.replaceAll("\\s+", " ").trim();
|
||||
if (brief.length() > 180) {
|
||||
brief = brief.substring(0, 180);
|
||||
}
|
||||
return brief.isEmpty() ? "连接数据库失败" : "连接数据库失败:" + brief;
|
||||
}
|
||||
|
||||
private Set<String> loadProcessNos() {
|
||||
LambdaQueryWrapper<VersionResource> query = new LambdaQueryWrapper<>();
|
||||
query.select(VersionResource::getProcessNo).isNotNull(VersionResource::getProcessNo);
|
||||
Set<String> nos = new HashSet<>();
|
||||
for (VersionResource resource : resourceMapper.selectList(query)) {
|
||||
if (!blank(resource.getProcessNo())) {
|
||||
nos.add(resource.getProcessNo());
|
||||
}
|
||||
}
|
||||
return nos;
|
||||
}
|
||||
|
||||
private static void label(String field, String text) {
|
||||
FIELD_LABEL.put(field, text);
|
||||
}
|
||||
|
||||
private static void alias(String field, String... names) {
|
||||
for (String name : names) {
|
||||
FIELD_BY_COLUMN.put(normalize(name), field);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setter(String field, BiConsumer<VersionResource, String> setter, int maxLength) {
|
||||
SETTERS.put(field, (resource, value) -> setter.accept(resource, maxLength > 0 ? truncate(value, maxLength) : value));
|
||||
}
|
||||
|
||||
private static String normalize(String name) {
|
||||
if (name == null) {
|
||||
return "";
|
||||
}
|
||||
return name.trim().toLowerCase(Locale.ROOT).replace("_", "").replace("-", "");
|
||||
}
|
||||
|
||||
private static Object first(Map<String, Object> row, String key) {
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
if (key.equalsIgnoreCase(entry.getKey())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String stringify(Object value) {
|
||||
return value == null ? "" : String.valueOf(value).trim();
|
||||
}
|
||||
|
||||
private static String truncate(String value, int maxLength) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String text = value.trim();
|
||||
if (text.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return text.length() <= maxLength ? text : text.substring(0, maxLength);
|
||||
}
|
||||
|
||||
private static boolean blank(String value) {
|
||||
return value == null || value.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
+30
-8
@@ -1,12 +1,17 @@
|
||||
package com.banben.modules.governance.controller;
|
||||
|
||||
import com.banben.common.Result;
|
||||
import com.banben.modules.governance.dto.GovernanceHintVO;
|
||||
import com.banben.modules.governance.entity.GovernanceJob;
|
||||
import com.banben.modules.governance.service.GovernanceService;
|
||||
import com.banben.modules.resource.entity.VersionResource;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,6 +19,11 @@ import java.util.List;
|
||||
* 数据治理接口。
|
||||
*
|
||||
* <p>对应「数据治理」四动作:聚同、优化、提示、提纯。</p>
|
||||
* <ul>
|
||||
* <li>优化:整合聚同文献的不同描述元数据,生成质量更高、要素更完整的元数据。</li>
|
||||
* <li>提示:生成疑似同一文献提示清单、疑似元数据错漏提示清单。</li>
|
||||
* <li>提纯:将相关纸电图书数据从全部图书数据中提取出来,形成版本资源数据集。</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Tag(name = "数据治理", description = "聚同 / 优化 / 提示 / 提纯")
|
||||
@RestController
|
||||
@@ -29,22 +39,34 @@ public class GovernanceController {
|
||||
return Result.success(governanceService.runJob("MERGE"));
|
||||
}
|
||||
|
||||
@Operation(summary = "优化:整合优化元数据描述")
|
||||
@Operation(summary = "优化:整合聚同文献的不同描述,生成更完整的元数据")
|
||||
@PostMapping("/optimize")
|
||||
public Result<GovernanceJob> optimize() {
|
||||
return Result.success(governanceService.runJob("OPTIMIZE"));
|
||||
return Result.success(governanceService.optimize());
|
||||
}
|
||||
|
||||
@Operation(summary = "提示:生成疑似同一文献/错漏提示清单")
|
||||
@Operation(summary = "提示:生成疑似同一文献清单与疑似元数据错漏清单")
|
||||
@PostMapping("/hint")
|
||||
public Result<GovernanceJob> hint() {
|
||||
return Result.success(governanceService.runJob("HINT"));
|
||||
public Result<GovernanceHintVO> hint() {
|
||||
return Result.success(governanceService.hint());
|
||||
}
|
||||
|
||||
@Operation(summary = "提纯:提取版本资源数据集")
|
||||
@Operation(summary = "查看当前疑似同一文献清单与错漏清单")
|
||||
@GetMapping("/hints")
|
||||
public Result<GovernanceHintVO> hints() {
|
||||
return Result.success(governanceService.previewHints());
|
||||
}
|
||||
|
||||
@Operation(summary = "提纯:从全部图书数据中提取纸电图书,形成版本资源数据集")
|
||||
@PostMapping("/purify")
|
||||
public Result<GovernanceJob> purify() {
|
||||
return Result.success(governanceService.runJob("PURIFY"));
|
||||
return Result.success(governanceService.purify());
|
||||
}
|
||||
|
||||
@Operation(summary = "版本资源数据集(已提纯的纸电图书)")
|
||||
@GetMapping("/dataset")
|
||||
public Result<List<VersionResource>> dataset() {
|
||||
return Result.success(governanceService.listDataset());
|
||||
}
|
||||
|
||||
@Operation(summary = "治理任务历史")
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.banben.modules.governance.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 疑似元数据错漏清单中的一条资源。
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "疑似元数据错漏条目")
|
||||
public class DefectItemVO {
|
||||
|
||||
@Schema(description = "资源ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "加工编号")
|
||||
private String processNo;
|
||||
|
||||
@Schema(description = "正题名")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "责任者")
|
||||
private String author;
|
||||
|
||||
@Schema(description = "来源馆")
|
||||
private String sourceLibrary;
|
||||
|
||||
@Schema(description = "媒体类型")
|
||||
private String mediaType;
|
||||
|
||||
@Schema(description = "错漏说明")
|
||||
private List<String> issues = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.banben.modules.governance.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 一组疑似同一文献。
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "疑似同一文献分组")
|
||||
public class DuplicateGroupVO {
|
||||
|
||||
@Schema(description = "判定原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "分组依据,如 ISBN 或归一题名")
|
||||
private String matchKey;
|
||||
|
||||
@Schema(description = "组内记录")
|
||||
private List<DuplicateItemVO> records = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.banben.modules.governance.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 疑似同一文献清单中的一条资源。
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "疑似同一文献条目")
|
||||
public class DuplicateItemVO {
|
||||
|
||||
@Schema(description = "资源ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "加工编号")
|
||||
private String processNo;
|
||||
|
||||
@Schema(description = "正题名")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "责任者")
|
||||
private String author;
|
||||
|
||||
@Schema(description = "出版者")
|
||||
private String publisher;
|
||||
|
||||
@Schema(description = "出版年份")
|
||||
private String publishYear;
|
||||
|
||||
@Schema(description = "ISBN")
|
||||
private String isbn;
|
||||
|
||||
@Schema(description = "媒体类型")
|
||||
private String mediaType;
|
||||
|
||||
@Schema(description = "来源馆")
|
||||
private String sourceLibrary;
|
||||
|
||||
@Schema(description = "治理状态")
|
||||
private String governStatus;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.banben.modules.governance.dto;
|
||||
|
||||
import com.banben.modules.governance.entity.GovernanceJob;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提示动作的两份清单。
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "治理提示清单")
|
||||
public class GovernanceHintVO {
|
||||
|
||||
@Schema(description = "本次任务;预览时为空")
|
||||
private GovernanceJob job;
|
||||
|
||||
@Schema(description = "疑似同一文献组数")
|
||||
private int duplicateGroupCount;
|
||||
|
||||
@Schema(description = "疑似错漏条数")
|
||||
private int defectCount;
|
||||
|
||||
@Schema(description = "疑似同一文献提示清单")
|
||||
private List<DuplicateGroupVO> duplicateGroups = new ArrayList<>();
|
||||
|
||||
@Schema(description = "疑似元数据错漏提示清单")
|
||||
private List<DefectItemVO> defects = new ArrayList<>();
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.banben.modules.governance.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.banben.modules.governance.dto.GovernanceHintVO;
|
||||
import com.banben.modules.governance.entity.GovernanceJob;
|
||||
import com.banben.modules.resource.entity.VersionResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,6 +19,31 @@ public interface GovernanceService extends IService<GovernanceJob> {
|
||||
*/
|
||||
GovernanceJob runJob(String jobType);
|
||||
|
||||
/**
|
||||
* 优化:整合已聚同文献的不同描述,生成更完整的元数据。
|
||||
*/
|
||||
GovernanceJob optimize();
|
||||
|
||||
/**
|
||||
* 提示:生成疑似同一文献清单、疑似元数据错漏清单,并标记错漏记录。
|
||||
*/
|
||||
GovernanceHintVO hint();
|
||||
|
||||
/**
|
||||
* 按当前数据预览两份提示清单,不写任务、不改标记。
|
||||
*/
|
||||
GovernanceHintVO previewHints();
|
||||
|
||||
/**
|
||||
* 提纯:从全部图书数据中提取纸电图书,形成版本资源数据集。
|
||||
*/
|
||||
GovernanceJob purify();
|
||||
|
||||
/**
|
||||
* 已纳入版本资源数据集的记录(治理状态为已提纯)。
|
||||
*/
|
||||
List<VersionResource> listDataset();
|
||||
|
||||
/**
|
||||
* 治理任务历史。
|
||||
*/
|
||||
|
||||
+698
-107
@@ -6,6 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.banben.common.BusinessException;
|
||||
import com.banben.modules.governance.dto.DefectItemVO;
|
||||
import com.banben.modules.governance.dto.DuplicateGroupVO;
|
||||
import com.banben.modules.governance.dto.DuplicateItemVO;
|
||||
import com.banben.modules.governance.dto.GovernanceHintVO;
|
||||
import com.banben.modules.governance.entity.GovernanceJob;
|
||||
import com.banben.modules.governance.mapper.GovernanceJobMapper;
|
||||
import com.banben.modules.governance.service.GovernanceService;
|
||||
@@ -18,35 +22,40 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 数据治理服务实现(聚同 / 优化 / 提示 / 提纯)。
|
||||
*
|
||||
* <pre>
|
||||
* 【状态流转】每一步都会真实推进 record 的 govern_status:
|
||||
*
|
||||
* 采集入库 ──▶ RAW 原始
|
||||
* │ ① 聚同(MERGE):同组保留 id 最小者 → MERGED 已聚同
|
||||
* │ 同组其余记录 → MERGED_OUT 已合并(mergedToId 指向主记录)
|
||||
* 【状态流转】
|
||||
* RAW 原始
|
||||
* │ ① 聚同:同组 id 最小者 → MERGED,其余 → MERGED_OUT
|
||||
* ▼
|
||||
* MERGED 已聚同
|
||||
* │ ② 优化(OPTIMIZE):无错漏的已聚同记录 → OPTIMIZED 已优化
|
||||
* │ ② 优化:把同组各来源的描述补进主记录 → OPTIMIZED
|
||||
* ▼
|
||||
* OPTIMIZED 已优化
|
||||
* │ ③ 提纯(PURIFY):纸电资源纳入数据集 → FINAL 已提纯
|
||||
* │ ③ 提纯:纸电图书纳入数据集 → FINAL
|
||||
* ▼
|
||||
* FINAL 已提纯
|
||||
*
|
||||
* ④ 提示(HINT):不改变状态,只产出清单,并把命中错漏的记录标记 abnormal_flag=1
|
||||
* ④ 提示:不改变治理状态。产出「疑似同一文献」「疑似错漏」两份清单,
|
||||
* 并把错漏记录标记 abnormal_flag = 1。
|
||||
* </pre>
|
||||
*
|
||||
* <p><b>说明:</b>本实现是可运行的「轻量算法」——聚同判定规则:
|
||||
* <b>ISBN 相同</b>即同一文献;<b>无 ISBN 时</b>,以「书名 + 作者 + 出版社 + 出版年份」
|
||||
* 四要素完全一致判定同一文献。批处理逐条提交,任务失败时已处理部分保留、
|
||||
* 任务记录标记为 FAILED,可重跑(已合并记录不会重复处理)。</p>
|
||||
* <p>聚同判定:ISBN 相同;无 ISBN 时「书名 + 作者 + 出版社 + 出版年份」完全一致。
|
||||
* 提示比聚同更宽,用来列出还不能自动合并、但疑似同一文献的记录。</p>
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -54,31 +63,34 @@ import java.util.Set;
|
||||
public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, GovernanceJob>
|
||||
implements GovernanceService {
|
||||
|
||||
/** 支持的治理类型。 */
|
||||
private static final Set<String> JOB_TYPES = Set.of("MERGE", "OPTIMIZE", "HINT", "PURIFY");
|
||||
|
||||
/** 这些内容形式不是纸电图书,提纯时留在全库、不进入版本资源数据集。 */
|
||||
private static final Set<String> NON_BOOK_FORMS = Set.of("音频", "视频", "图像", "图片", "缩微", "期刊");
|
||||
|
||||
private static final Pattern YEAR = Pattern.compile("\\d{4}");
|
||||
private static final Pattern LANGUAGE = Pattern.compile("[A-Za-z]{3}");
|
||||
private static final Pattern PAGE = Pattern.compile("\\d+");
|
||||
private static final Pattern ISBN = Pattern.compile("97[89](?:-\\d+){4}");
|
||||
private static final Pattern EDITION = Pattern.compile(
|
||||
"[((]第[0-90-9一二三四五六七八九十]+版[))]|第[0-90-9一二三四五六七八九十]+版|修订版|增订本|增补本");
|
||||
private static final Pattern PUNCT = Pattern.compile("[·—\\-::,,.。;;、/\\\\'\"“”‘’《》<>\\s\\u3000]+");
|
||||
|
||||
private static final int BATCH = 500;
|
||||
|
||||
private final VersionResourceMapper resourceMapper;
|
||||
|
||||
@Override
|
||||
public GovernanceJob runJob(String jobType) {
|
||||
if (jobType == null || !JOB_TYPES.contains(jobType.toUpperCase())) {
|
||||
throw new BusinessException("不支持的治理类型:" + jobType);
|
||||
String type = requireType(jobType);
|
||||
if ("HINT".equals(type)) {
|
||||
return hint().getJob();
|
||||
}
|
||||
String type = jobType.toUpperCase();
|
||||
|
||||
// 1) 先落一条 RUNNING 的任务记录,便于前端看到「执行中」
|
||||
GovernanceJob job = new GovernanceJob();
|
||||
job.setJobType(type);
|
||||
job.setStatus("RUNNING");
|
||||
job.setStartTime(LocalDateTime.now());
|
||||
this.save(job);
|
||||
|
||||
GovernanceJob job = begin(type);
|
||||
try {
|
||||
// 2) 按类型分派
|
||||
switch (type) {
|
||||
case "MERGE" -> runMerge(job);
|
||||
case "OPTIMIZE" -> runOptimize(job);
|
||||
case "HINT" -> runHint(job);
|
||||
case "PURIFY" -> runPurify(job);
|
||||
default -> job.setResultSummary("未实现");
|
||||
}
|
||||
@@ -88,13 +100,58 @@ public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, Gove
|
||||
job.setStatus("FAILED");
|
||||
job.setResultSummary(e.getMessage());
|
||||
} finally {
|
||||
// 3) 无论成败都回写任务结果
|
||||
job.setEndTime(LocalDateTime.now());
|
||||
this.updateById(job);
|
||||
finish(job);
|
||||
}
|
||||
return job;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GovernanceJob optimize() {
|
||||
return runJob("OPTIMIZE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GovernanceHintVO hint() {
|
||||
GovernanceJob job = begin("HINT");
|
||||
GovernanceHintVO vo = emptyHint(job);
|
||||
try {
|
||||
vo = buildHints(true);
|
||||
job.setAffectedCount(vo.getDuplicateGroupCount() + vo.getDefectCount());
|
||||
job.setResultSummary(String.format(
|
||||
"疑似同一文献 %d 组;疑似元数据错漏 %d 条(错漏记录已标记,请人工核验)",
|
||||
vo.getDuplicateGroupCount(), vo.getDefectCount()));
|
||||
job.setStatus("SUCCESS");
|
||||
vo.setJob(job);
|
||||
} catch (Exception e) {
|
||||
log.error("提示清单生成失败: {}", e.getMessage(), e);
|
||||
job.setStatus("FAILED");
|
||||
job.setResultSummary(e.getMessage());
|
||||
vo.setJob(job);
|
||||
} finally {
|
||||
finish(job);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GovernanceHintVO previewHints() {
|
||||
return buildHints(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GovernanceJob purify() {
|
||||
return runJob("PURIFY");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VersionResource> listDataset() {
|
||||
LambdaQueryWrapper<VersionResource> query = new LambdaQueryWrapper<>();
|
||||
query.eq(VersionResource::getGovernStatus, GovernStatus.FINAL.getCode())
|
||||
.orderByDesc(VersionResource::getUpdateTime)
|
||||
.orderByAsc(VersionResource::getId);
|
||||
return resourceMapper.selectList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GovernanceJob> listJobs() {
|
||||
LambdaQueryWrapper<GovernanceJob> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -105,32 +162,21 @@ public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, Gove
|
||||
// ==================== ① 聚同 ====================
|
||||
|
||||
/**
|
||||
* 聚同:将「不同来源 / 不同媒体类型」的同一文献元数据聚合为一条,并标注来源。
|
||||
*
|
||||
* <p>判定规则(两级):</p>
|
||||
* <ol>
|
||||
* <li><b>ISBN 相同</b>(非空)即视为同一文献;</li>
|
||||
* <li>ISBN 为空时,<b>「书名 + 作者 + 出版社 + 出版年份」四要素完全一致</b>
|
||||
* 即视为同一文献。</li>
|
||||
* </ol>
|
||||
* <p>同组内按 id 升序取第一条为主记录 → 标记 {@code MERGED};
|
||||
* 其余记录 → 标记 {@code MERGED_OUT} 并把 {@code merged_to_id} 指向主记录。
|
||||
* 已 {@code MERGED_OUT} 的记录不参与再次聚同,因此任务可重复执行而结果稳定。</p>
|
||||
* 聚同:将不同来源、不同媒体类型的同一文献聚合为一条,并标注来源。
|
||||
* 同组 id 最小者为主记录(MERGED),其余标记 MERGED_OUT 并指向主记录。
|
||||
*/
|
||||
private void runMerge(GovernanceJob job) {
|
||||
int[] counters = {0, 0}; // [0]=聚同组数, [1]=影响条数
|
||||
int[] counters = {0, 0};
|
||||
|
||||
// 规则一:ISBN 相同(非空)→ 同一文献
|
||||
for (Map<String, Object> group : isbnDuplicateGroups()) {
|
||||
Object isbn = group.get("isbn");
|
||||
LambdaQueryWrapper<VersionResource> query = new LambdaQueryWrapper<>();
|
||||
query.eq(VersionResource::getIsbn, isbn)
|
||||
.ne(VersionResource::getGovernStatus, GovernStatus.MERGED_OUT.getCode())
|
||||
.and(this::notMergedOut)
|
||||
.orderByAsc(VersionResource::getId);
|
||||
mergeGroup(resourceMapper.selectList(query), counters);
|
||||
}
|
||||
|
||||
// 规则二:无 ISBN →「书名 + 作者 + 出版社 + 出版年份」完全一致 → 同一文献
|
||||
for (Map<String, Object> group : fieldDuplicateGroups()) {
|
||||
LambdaQueryWrapper<VersionResource> query = new LambdaQueryWrapper<>();
|
||||
query.eq(VersionResource::getTitle, group.get("title"));
|
||||
@@ -138,7 +184,7 @@ public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, Gove
|
||||
eqOrIsNull(query, VersionResource::getPublisher, group.get("publisher"));
|
||||
eqOrIsNull(query, VersionResource::getPublishYear, group.get("publish_year"));
|
||||
query.and(x -> x.isNull(VersionResource::getIsbn).or().eq(VersionResource::getIsbn, ""))
|
||||
.ne(VersionResource::getGovernStatus, GovernStatus.MERGED_OUT.getCode())
|
||||
.and(this::notMergedOut)
|
||||
.orderByAsc(VersionResource::getId);
|
||||
mergeGroup(resourceMapper.selectList(query), counters);
|
||||
}
|
||||
@@ -146,26 +192,20 @@ public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, Gove
|
||||
job.setAffectedCount(counters[1]);
|
||||
job.setResultSummary(String.format(
|
||||
"聚同 %d 组、影响 %d 条(ISBN 相同,或无 ISBN 时「书名+作者+出版社+出版年份」"
|
||||
+ "完全一致的记录聚合:组内 id 最小者保留为「已聚同」,其余标记「已合并」并指向主记录)",
|
||||
+ "完全一致:组内 id 最小者保留为「已聚同」,其余标记「已合并」并指向主记录)",
|
||||
counters[0], counters[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
* 组内聚同:id 最小者为主记录(MERGED),其余标记 MERGED_OUT 并指向主记录。
|
||||
*/
|
||||
private void mergeGroup(List<VersionResource> list, int[] counters) {
|
||||
if (list == null || list.size() < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 主记录:保留为「已聚同」
|
||||
VersionResource master = list.get(0);
|
||||
master.setGovernStatus(GovernStatus.MERGED.getCode());
|
||||
master.setMergedToId(null);
|
||||
resourceMapper.updateById(master);
|
||||
counters[1]++;
|
||||
|
||||
// 从记录:标记「已合并」并指向主记录
|
||||
for (int i = 1; i < list.size(); i++) {
|
||||
VersionResource slave = list.get(i);
|
||||
slave.setGovernStatus(GovernStatus.MERGED_OUT.getCode());
|
||||
@@ -176,7 +216,6 @@ public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, Gove
|
||||
counters[0]++;
|
||||
}
|
||||
|
||||
/** 值为空时按 IS NULL 匹配,否则按等值匹配(分组键可能为 NULL 的字段用) */
|
||||
private void eqOrIsNull(LambdaQueryWrapper<VersionResource> query,
|
||||
SFunction<VersionResource, ?> column, Object value) {
|
||||
if (value == null || "".equals(value)) {
|
||||
@@ -189,102 +228,654 @@ public class GovernanceServiceImpl extends ServiceImpl<GovernanceJobMapper, Gove
|
||||
// ==================== ② 优化 ====================
|
||||
|
||||
/**
|
||||
* 优化:把「已聚同」且无错漏的元数据推进为「已优化」。
|
||||
*
|
||||
* <p>真正的字段级整合优化(多来源描述合并、要素补全)可在此基础上扩展,
|
||||
* 当前实现负责状态推进与统计。</p>
|
||||
* 优化:整合已聚同主记录与其来源记录上的不同描述。
|
||||
* 空缺字段用组内非空值补齐,摘要取更完整的一条,主题词去重合并,
|
||||
* 附注中写明各来源馆和媒体类型。补全后不再错漏的记录清除疑似标记。
|
||||
*/
|
||||
private void runOptimize(GovernanceJob job) {
|
||||
LambdaUpdateWrapper<VersionResource> update = new LambdaUpdateWrapper<>();
|
||||
update.set(VersionResource::getGovernStatus, GovernStatus.OPTIMIZED.getCode())
|
||||
.eq(VersionResource::getGovernStatus, GovernStatus.MERGED.getCode())
|
||||
.eq(VersionResource::getAbnormalFlag, 0);
|
||||
int rows = resourceMapper.update(null, update);
|
||||
LambdaQueryWrapper<VersionResource> mastersQuery = new LambdaQueryWrapper<>();
|
||||
mastersQuery.eq(VersionResource::getGovernStatus, GovernStatus.MERGED.getCode())
|
||||
.orderByAsc(VersionResource::getId);
|
||||
List<VersionResource> masters = resourceMapper.selectList(mastersQuery);
|
||||
if (masters.isEmpty()) {
|
||||
job.setAffectedCount(0);
|
||||
job.setResultSummary("没有可优化的「已聚同」记录,请先执行聚同");
|
||||
return;
|
||||
}
|
||||
|
||||
job.setAffectedCount(rows);
|
||||
job.setResultSummary("已将 " + rows + " 条「已聚同」且无错漏的元数据推进为「已优化」");
|
||||
int filled = 0;
|
||||
for (VersionResource master : masters) {
|
||||
LambdaQueryWrapper<VersionResource> slaveQuery = new LambdaQueryWrapper<>();
|
||||
slaveQuery.eq(VersionResource::getMergedToId, master.getId())
|
||||
.eq(VersionResource::getGovernStatus, GovernStatus.MERGED_OUT.getCode())
|
||||
.orderByAsc(VersionResource::getId);
|
||||
List<VersionResource> group = new ArrayList<>();
|
||||
group.add(master);
|
||||
group.addAll(resourceMapper.selectList(slaveQuery));
|
||||
|
||||
int[] counter = {0};
|
||||
integrate(master, group, counter);
|
||||
List<String> issues = defectsOf(master);
|
||||
master.setAbnormalFlag(issues.isEmpty() ? 0 : 1);
|
||||
master.setGovernStatus(GovernStatus.OPTIMIZED.getCode());
|
||||
resourceMapper.updateById(master);
|
||||
filled += counter[0];
|
||||
}
|
||||
|
||||
job.setAffectedCount(masters.size());
|
||||
job.setResultSummary(String.format(
|
||||
"已优化 %d 条聚同主记录,补全或合并 %d 处描述要素"
|
||||
+ "(空缺取组内非空值,摘要取更完整者,主题词去重合并,附注标注各来源馆与媒体类型)",
|
||||
masters.size(), filled));
|
||||
}
|
||||
|
||||
private void integrate(VersionResource master, List<VersionResource> group, int[] filled) {
|
||||
List<VersionResource> donors = group.subList(1, group.size());
|
||||
fillIfBlank(master, donors, VersionResource::getClcCode, VersionResource::setClcCode, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getPublishYear, VersionResource::setPublishYear, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getProcessDate, VersionResource::setProcessDate, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getContentForm, VersionResource::setContentForm, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getFormat, VersionResource::setFormat, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getPageCount, VersionResource::setPageCount, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getLanguage, VersionResource::setLanguage, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getSubmitOrg, VersionResource::setSubmitOrg, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getTaskYear, VersionResource::setTaskYear, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getSourceLibraryAddr, VersionResource::setSourceLibraryAddr, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getFulltextUrl, VersionResource::setFulltextUrl, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getAuthor, VersionResource::setAuthor, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getResponsibility, VersionResource::setResponsibility, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getPublisher, VersionResource::setPublisher, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getPublishPlace, VersionResource::setPublishPlace, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getPublishDate, VersionResource::setPublishDate, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getRelation, VersionResource::setRelation, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getTimeRange, VersionResource::setTimeRange, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getSpaceRange, VersionResource::setSpaceRange, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getEdition, VersionResource::setEdition, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getIsbn, VersionResource::setIsbn, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getUnifiedBookNo, VersionResource::setUnifiedBookNo, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getCdoi, VersionResource::setCdoi, filled);
|
||||
fillIfBlank(master, donors, VersionResource::getPublishUrl, VersionResource::setPublishUrl, filled);
|
||||
mergeKeywords(master, group, filled);
|
||||
mergeSummary(master, group, filled);
|
||||
mergeOtherTitles(master, group, filled);
|
||||
mergeNotes(master, group, filled);
|
||||
}
|
||||
|
||||
private void fillIfBlank(VersionResource master, List<VersionResource> donors,
|
||||
Function<VersionResource, String> getter,
|
||||
BiConsumer<VersionResource, String> setter,
|
||||
int[] filled) {
|
||||
if (!blank(getter.apply(master))) {
|
||||
return;
|
||||
}
|
||||
for (VersionResource donor : donors) {
|
||||
if (!blank(getter.apply(donor))) {
|
||||
setter.accept(master, getter.apply(donor).trim());
|
||||
filled[0]++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeKeywords(VersionResource master, List<VersionResource> group, int[] filled) {
|
||||
LinkedHashSet<String> words = new LinkedHashSet<>();
|
||||
for (VersionResource resource : group) {
|
||||
if (blank(resource.getKeywords())) {
|
||||
continue;
|
||||
}
|
||||
for (String part : resource.getKeywords().split("[;;,,]")) {
|
||||
if (!blank(part)) {
|
||||
words.add(part.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (words.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String merged = String.join(";", words);
|
||||
if (!merged.equals(text(master.getKeywords()))) {
|
||||
master.setKeywords(merged);
|
||||
filled[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeSummary(VersionResource master, List<VersionResource> group, int[] filled) {
|
||||
String best = null;
|
||||
for (VersionResource resource : group) {
|
||||
if (blank(resource.getSummary())) {
|
||||
continue;
|
||||
}
|
||||
String summary = resource.getSummary().trim();
|
||||
if (best == null || summary.length() > best.length()) {
|
||||
best = summary;
|
||||
}
|
||||
}
|
||||
if (best == null) {
|
||||
return;
|
||||
}
|
||||
if (text(master.getSummary()).length() < best.length()) {
|
||||
master.setSummary(best);
|
||||
filled[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeOtherTitles(VersionResource master, List<VersionResource> group, int[] filled) {
|
||||
LinkedHashSet<String> titles = new LinkedHashSet<>();
|
||||
for (VersionResource resource : group) {
|
||||
if (!blank(resource.getOtherTitle())) {
|
||||
for (String part : resource.getOtherTitle().split("[;;]")) {
|
||||
if (!blank(part)) {
|
||||
titles.add(part.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resource != master && !blank(resource.getTitle())
|
||||
&& !text(resource.getTitle()).equals(text(master.getTitle()))) {
|
||||
titles.add(resource.getTitle().trim());
|
||||
}
|
||||
}
|
||||
if (titles.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String merged = String.join(";", titles);
|
||||
if (!merged.equals(text(master.getOtherTitle()))) {
|
||||
master.setOtherTitle(merged);
|
||||
filled[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeNotes(VersionResource master, List<VersionResource> group, int[] filled) {
|
||||
LinkedHashSet<String> notes = new LinkedHashSet<>();
|
||||
for (VersionResource resource : group) {
|
||||
if (blank(resource.getNote())) {
|
||||
continue;
|
||||
}
|
||||
for (String line : resource.getNote().split("\\n")) {
|
||||
String trimmed = line.trim();
|
||||
if (!trimmed.isEmpty() && !trimmed.startsWith("聚同来源:")) {
|
||||
notes.add(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
String sources = group.stream()
|
||||
.map(resource -> (blank(resource.getSourceLibrary()) ? "未知来源馆" : resource.getSourceLibrary().trim())
|
||||
+ "(" + (blank(resource.getMediaType()) ? "未知媒体" : resource.getMediaType().trim()) + ")")
|
||||
.distinct()
|
||||
.reduce((a, b) -> a + ";" + b)
|
||||
.orElse("未知来源馆");
|
||||
StringBuilder merged = new StringBuilder();
|
||||
for (String note : notes) {
|
||||
if (!merged.isEmpty()) {
|
||||
merged.append('\n');
|
||||
}
|
||||
merged.append(note);
|
||||
}
|
||||
if (!merged.isEmpty()) {
|
||||
merged.append('\n');
|
||||
}
|
||||
merged.append("聚同来源:").append(sources);
|
||||
if (!merged.toString().equals(text(master.getNote()))) {
|
||||
master.setNote(merged.toString());
|
||||
filled[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== ③ 提示 ====================
|
||||
|
||||
/**
|
||||
* 提示:生成「疑似同一文献」与「疑似元数据错漏」清单。
|
||||
*
|
||||
* <p>这是唯一<b>不改变治理状态</b>的动作:它把命中错漏的记录标记
|
||||
* {@code abnormal_flag = 1},供人工核验;清单本身体现在任务的 resultSummary 中。</p>
|
||||
* 疑似同一文献:ISBN 相同,或题名归一后与责任者相同,或题名互相包含且责任者相同。
|
||||
* 已经合并掉的从记录不重复进入清单。
|
||||
* 疑似错漏:必备要素缺失、摘要不足 100 字、年份/语种/页码/ISBN 格式不正确。
|
||||
*/
|
||||
private void runHint(GovernanceJob job) {
|
||||
// 疑似同一文献:题名 + 责任者 相同且多于 1 条
|
||||
int dupGroups = findDuplicateGroups().size();
|
||||
private GovernanceHintVO buildHints(boolean persistFlag) {
|
||||
List<VersionResource> active = loadActive();
|
||||
GovernanceHintVO vo = new GovernanceHintVO();
|
||||
vo.setDuplicateGroups(findSuspectedDuplicates(active));
|
||||
vo.setDuplicateGroupCount(vo.getDuplicateGroups().size());
|
||||
|
||||
// 疑似错漏:必备字段缺失(中图分类 / 摘要)→ 标记 abnormal_flag = 1
|
||||
LambdaUpdateWrapper<VersionResource> missUpdate = new LambdaUpdateWrapper<>();
|
||||
missUpdate.set(VersionResource::getAbnormalFlag, 1)
|
||||
.and(x -> x.isNull(VersionResource::getClcCode)
|
||||
.or().eq(VersionResource::getClcCode, "")
|
||||
.or().isNull(VersionResource::getSummary)
|
||||
.or().eq(VersionResource::getSummary, ""));
|
||||
int missCount = resourceMapper.update(null, missUpdate);
|
||||
List<DefectItemVO> defects = new ArrayList<>();
|
||||
List<Long> badIds = new ArrayList<>();
|
||||
List<Long> clearIds = new ArrayList<>();
|
||||
for (VersionResource resource : active) {
|
||||
List<String> issues = defectsOf(resource);
|
||||
if (!issues.isEmpty()) {
|
||||
defects.add(toDefect(resource, issues));
|
||||
badIds.add(resource.getId());
|
||||
} else if (flagged(resource)) {
|
||||
clearIds.add(resource.getId());
|
||||
}
|
||||
}
|
||||
vo.setDefects(defects);
|
||||
vo.setDefectCount(defects.size());
|
||||
if (persistFlag) {
|
||||
updateFlag(badIds, 1);
|
||||
updateFlag(clearIds, 0);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
job.setAffectedCount(dupGroups + missCount);
|
||||
job.setResultSummary(String.format(
|
||||
"疑似同一文献 %d 组;疑似元数据错漏 %d 条(已标记 abnormalFlag=1,请人工核验)",
|
||||
dupGroups, missCount));
|
||||
private List<DuplicateGroupVO> findSuspectedDuplicates(List<VersionResource> active) {
|
||||
List<DuplicateGroupVO> groups = new ArrayList<>();
|
||||
Set<Long> emitted = new HashSet<>();
|
||||
|
||||
Map<String, List<VersionResource>> byIsbn = new LinkedHashMap<>();
|
||||
for (VersionResource resource : active) {
|
||||
if (!blank(resource.getIsbn())) {
|
||||
byIsbn.computeIfAbsent(resource.getIsbn().trim(), key -> new ArrayList<>()).add(resource);
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, List<VersionResource>> entry : byIsbn.entrySet()) {
|
||||
if (entry.getValue().size() < 2) {
|
||||
continue;
|
||||
}
|
||||
groups.add(toDuplicateGroup("ISBN 相同,疑似同一文献", entry.getKey(), entry.getValue()));
|
||||
entry.getValue().forEach(resource -> emitted.add(resource.getId()));
|
||||
}
|
||||
|
||||
Map<String, List<VersionResource>> byTitleAuthor = new LinkedHashMap<>();
|
||||
for (VersionResource resource : active) {
|
||||
String key = normalizeTitle(resource.getTitle()) + "\u0001" + normalizeTitle(resource.getAuthor());
|
||||
if ("\u0001".equals(key) || key.startsWith("\u0001") || key.endsWith("\u0001")) {
|
||||
continue;
|
||||
}
|
||||
byTitleAuthor.computeIfAbsent(key, ignored -> new ArrayList<>()).add(resource);
|
||||
}
|
||||
for (Map.Entry<String, List<VersionResource>> entry : byTitleAuthor.entrySet()) {
|
||||
List<VersionResource> members = entry.getValue();
|
||||
if (members.size() < 2 || sameNonBlankIsbn(members)) {
|
||||
continue;
|
||||
}
|
||||
String reason = sameFourFields(members)
|
||||
? "书名、责任者、出版社、出版年份一致,疑似同一文献"
|
||||
: "题名归一后与责任者相同,但 ISBN 或出版信息不一致,疑似同一文献";
|
||||
String key = normalizeTitle(members.get(0).getTitle());
|
||||
groups.add(toDuplicateGroup(reason, key, members));
|
||||
members.forEach(resource -> emitted.add(resource.getId()));
|
||||
}
|
||||
|
||||
groups.addAll(containmentGroups(active, emitted));
|
||||
return groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同一责任者下,题名互相包含(如「联合作战指挥」与「联合作战指挥学」)视为疑似同一文献。
|
||||
*/
|
||||
private List<DuplicateGroupVO> containmentGroups(List<VersionResource> active, Set<Long> emitted) {
|
||||
Map<String, List<VersionResource>> byAuthor = new LinkedHashMap<>();
|
||||
for (VersionResource resource : active) {
|
||||
if (emitted.contains(resource.getId()) || blank(resource.getAuthor()) || blank(resource.getTitle())) {
|
||||
continue;
|
||||
}
|
||||
byAuthor.computeIfAbsent(normalizeTitle(resource.getAuthor()), key -> new ArrayList<>()).add(resource);
|
||||
}
|
||||
|
||||
List<DuplicateGroupVO> groups = new ArrayList<>();
|
||||
for (List<VersionResource> bucket : byAuthor.values()) {
|
||||
if (bucket.size() < 2) {
|
||||
continue;
|
||||
}
|
||||
Map<Long, Long> parent = new HashMap<>();
|
||||
for (int i = 0; i < bucket.size(); i++) {
|
||||
String left = normalizeTitle(bucket.get(i).getTitle());
|
||||
for (int j = i + 1; j < bucket.size(); j++) {
|
||||
String right = normalizeTitle(bucket.get(j).getTitle());
|
||||
if (titleContains(left, right)) {
|
||||
union(parent, bucket.get(i).getId(), bucket.get(j).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<Long, List<VersionResource>> clustered = new LinkedHashMap<>();
|
||||
for (VersionResource resource : bucket) {
|
||||
if (!parent.containsKey(resource.getId())) {
|
||||
continue;
|
||||
}
|
||||
clustered.computeIfAbsent(find(parent, resource.getId()), key -> new ArrayList<>()).add(resource);
|
||||
}
|
||||
for (List<VersionResource> members : clustered.values()) {
|
||||
if (members.size() < 2) {
|
||||
continue;
|
||||
}
|
||||
members.sort(Comparator.comparing(VersionResource::getId));
|
||||
groups.add(toDuplicateGroup(
|
||||
"题名互相包含且责任者相同,疑似同一文献",
|
||||
normalizeTitle(members.get(0).getTitle()),
|
||||
members));
|
||||
}
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
private boolean titleContains(String left, String right) {
|
||||
if (left.equals(right) || left.length() < 4 || right.length() < 4) {
|
||||
return false;
|
||||
}
|
||||
String shorter = left.length() <= right.length() ? left : right;
|
||||
String longer = left.length() <= right.length() ? right : left;
|
||||
return longer.contains(shorter) && shorter.length() * 2 >= longer.length();
|
||||
}
|
||||
|
||||
private List<String> defectsOf(VersionResource resource) {
|
||||
List<String> issues = new ArrayList<>();
|
||||
if (blank(resource.getClcCode())) {
|
||||
issues.add("缺少中图分类号");
|
||||
}
|
||||
if (blank(resource.getKeywords())) {
|
||||
issues.add("缺少主题词或关键词");
|
||||
}
|
||||
if (blank(resource.getSummary())) {
|
||||
issues.add("缺少摘要");
|
||||
} else if (resource.getSummary().trim().length() < 100) {
|
||||
issues.add("摘要不足100字");
|
||||
}
|
||||
if (blank(resource.getPublishYear())) {
|
||||
issues.add("缺少出版年份");
|
||||
} else if (!YEAR.matcher(resource.getPublishYear().trim()).matches()) {
|
||||
issues.add("出版年份不是4位年份");
|
||||
}
|
||||
if (blank(resource.getMediaType())) {
|
||||
issues.add("缺少媒体类型");
|
||||
} else if (!"纸质".equals(resource.getMediaType().trim()) && !"电子".equals(resource.getMediaType().trim())) {
|
||||
issues.add("媒体类型不是纸质或电子");
|
||||
}
|
||||
if (blank(resource.getLanguage()) || !LANGUAGE.matcher(resource.getLanguage().trim()).matches()) {
|
||||
issues.add("语种不是3位代码");
|
||||
}
|
||||
if (blank(resource.getPageCount()) || !PAGE.matcher(resource.getPageCount().trim()).matches()) {
|
||||
issues.add("页码缺失或不是数字");
|
||||
}
|
||||
if (blank(resource.getAuthor())) {
|
||||
issues.add("缺少责任者");
|
||||
}
|
||||
if (blank(resource.getFulltextUrl())) {
|
||||
issues.add("缺少全文地址");
|
||||
}
|
||||
if (blank(resource.getSourceLibrary())) {
|
||||
issues.add("缺少来源馆");
|
||||
}
|
||||
if (!blank(resource.getIsbn()) && !ISBN.matcher(resource.getIsbn().trim()).matches()) {
|
||||
issues.add("ISBN格式疑似有误");
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
|
||||
// ==================== ④ 提纯 ====================
|
||||
|
||||
/**
|
||||
* 提纯:将相关纸电图书数据提取出来,形成版本资源数据集。
|
||||
*
|
||||
* <p>把媒体类型为「纸质 / 电子」且已聚同或已优化的记录标记为 {@code FINAL},
|
||||
* 即「已纳入版本资源数据集」。</p>
|
||||
* 提纯:从全部在库图书中抽出纸质、电子图书,形成版本资源数据集。
|
||||
* 不纳入:已合并的从记录、音频/视频/图像/缩微/期刊、敏感或已屏蔽数据、
|
||||
* 尚未聚同的重复文献、已聚同但还没优化的主记录、仍有错漏的记录。
|
||||
*/
|
||||
private void runPurify(GovernanceJob job) {
|
||||
LambdaUpdateWrapper<VersionResource> update = new LambdaUpdateWrapper<>();
|
||||
update.set(VersionResource::getGovernStatus, GovernStatus.FINAL.getCode())
|
||||
.in(VersionResource::getMediaType, List.of("纸质", "电子"))
|
||||
.in(VersionResource::getGovernStatus,
|
||||
List.of(GovernStatus.MERGED.getCode(), GovernStatus.OPTIMIZED.getCode()));
|
||||
int rows = resourceMapper.update(null, update);
|
||||
List<VersionResource> active = loadActive();
|
||||
Set<Long> unresolved = unresolvedDuplicateIds(active);
|
||||
|
||||
job.setAffectedCount(rows);
|
||||
job.setResultSummary("已将 " + rows + " 条纸电版本资源纳入版本资源数据集(标记为「已提纯」)");
|
||||
int nonBook = 0;
|
||||
int sensitive = 0;
|
||||
int blocked = 0;
|
||||
int duplicated = 0;
|
||||
int waitOptimize = 0;
|
||||
int defect = 0;
|
||||
List<Long> accepted = new ArrayList<>();
|
||||
|
||||
for (VersionResource resource : active) {
|
||||
if (GovernStatus.FINAL.getCode().equals(resource.getGovernStatus())) {
|
||||
continue;
|
||||
}
|
||||
if (!paperElectronicBook(resource)) {
|
||||
nonBook++;
|
||||
continue;
|
||||
}
|
||||
if (resource.getSensitiveFlag() != null && resource.getSensitiveFlag() == 1) {
|
||||
sensitive++;
|
||||
continue;
|
||||
}
|
||||
if (resource.getManageStatus() != null && resource.getManageStatus() != 0) {
|
||||
blocked++;
|
||||
continue;
|
||||
}
|
||||
if (unresolved.contains(resource.getId())) {
|
||||
duplicated++;
|
||||
continue;
|
||||
}
|
||||
if (GovernStatus.MERGED.getCode().equals(resource.getGovernStatus())) {
|
||||
waitOptimize++;
|
||||
continue;
|
||||
}
|
||||
if (!defectsOf(resource).isEmpty()) {
|
||||
defect++;
|
||||
continue;
|
||||
}
|
||||
accepted.add(resource.getId());
|
||||
}
|
||||
|
||||
updateStatus(accepted, GovernStatus.FINAL.getCode());
|
||||
job.setAffectedCount(accepted.size());
|
||||
job.setResultSummary(String.format(
|
||||
"已将 %d 条纸电图书纳入版本资源数据集。"
|
||||
+ "未纳入:非纸电图书 %d 条,敏感 %d 条,已屏蔽或下架 %d 条,"
|
||||
+ "尚未聚同的重复文献 %d 条,已聚同但未优化 %d 条,仍有错漏 %d 条",
|
||||
accepted.size(), nonBook, sensitive, blocked, duplicated, waitOptimize, defect));
|
||||
}
|
||||
|
||||
/**
|
||||
* 仍有多条在库记录指向同一文献(聚同还没把它们收成一条)的资源 ID。
|
||||
*/
|
||||
private Set<Long> unresolvedDuplicateIds(List<VersionResource> active) {
|
||||
Set<Long> ids = new HashSet<>();
|
||||
Map<String, List<VersionResource>> byIsbn = new LinkedHashMap<>();
|
||||
Map<String, List<VersionResource>> byField = new LinkedHashMap<>();
|
||||
for (VersionResource resource : active) {
|
||||
if (!blank(resource.getIsbn())) {
|
||||
byIsbn.computeIfAbsent(resource.getIsbn().trim(), key -> new ArrayList<>()).add(resource);
|
||||
} else {
|
||||
String key = text(resource.getTitle()) + "\u0001" + text(resource.getAuthor())
|
||||
+ "\u0001" + text(resource.getPublisher()) + "\u0001" + text(resource.getPublishYear());
|
||||
byField.computeIfAbsent(key, ignored -> new ArrayList<>()).add(resource);
|
||||
}
|
||||
}
|
||||
byIsbn.values().stream().filter(group -> group.size() > 1)
|
||||
.forEach(group -> group.forEach(resource -> ids.add(resource.getId())));
|
||||
byField.values().stream().filter(group -> group.size() > 1)
|
||||
.forEach(group -> group.forEach(resource -> ids.add(resource.getId())));
|
||||
return ids;
|
||||
}
|
||||
|
||||
private boolean paperElectronicBook(VersionResource resource) {
|
||||
String media = text(resource.getMediaType());
|
||||
if (!"纸质".equals(media) && !"电子".equals(media)) {
|
||||
return false;
|
||||
}
|
||||
String form = text(resource.getContentForm());
|
||||
return form.isEmpty() || !NON_BOOK_FORMS.contains(form);
|
||||
}
|
||||
|
||||
// ==================== 公共方法 ====================
|
||||
|
||||
/**
|
||||
* 查询「疑似同一文献」的重复组 = ISBN 重复组 + 四要素重复组(聚同与「提示」共用)。
|
||||
* 排除已被合并的记录,保证重复执行时不重复处理。
|
||||
*/
|
||||
private List<Map<String, Object>> findDuplicateGroups() {
|
||||
List<Map<String, Object>> groups = new ArrayList<>(isbnDuplicateGroups());
|
||||
groups.addAll(fieldDuplicateGroups());
|
||||
return groups;
|
||||
private List<VersionResource> loadActive() {
|
||||
LambdaQueryWrapper<VersionResource> query = new LambdaQueryWrapper<>();
|
||||
query.and(this::notMergedOut).orderByAsc(VersionResource::getId);
|
||||
return resourceMapper.selectList(query);
|
||||
}
|
||||
|
||||
private void notMergedOut(LambdaQueryWrapper<VersionResource> query) {
|
||||
query.isNull(VersionResource::getGovernStatus)
|
||||
.or()
|
||||
.ne(VersionResource::getGovernStatus, GovernStatus.MERGED_OUT.getCode());
|
||||
}
|
||||
|
||||
/** ISBN 相同(非空)且多于 1 条的重复组 */
|
||||
private List<Map<String, Object>> isbnDuplicateGroups() {
|
||||
QueryWrapper<VersionResource> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("isbn")
|
||||
.isNotNull("isbn")
|
||||
.ne("isbn", "")
|
||||
.ne("govern_status", GovernStatus.MERGED_OUT.getCode())
|
||||
.and(x -> x.isNull("govern_status").or().ne("govern_status", GovernStatus.MERGED_OUT.getCode()))
|
||||
.groupBy("isbn")
|
||||
.having("COUNT(*) > 1");
|
||||
return resourceMapper.selectMaps(wrapper);
|
||||
}
|
||||
|
||||
/** 无 ISBN 时,「书名 + 作者 + 出版社 + 出版年份」完全一致且多于 1 条的重复组 */
|
||||
private List<Map<String, Object>> fieldDuplicateGroups() {
|
||||
QueryWrapper<VersionResource> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("title", "author", "publisher", "publish_year")
|
||||
.isNotNull("title")
|
||||
.and(x -> x.isNull("isbn").or().eq("isbn", ""))
|
||||
.ne("govern_status", GovernStatus.MERGED_OUT.getCode())
|
||||
.and(x -> x.isNull("govern_status").or().ne("govern_status", GovernStatus.MERGED_OUT.getCode()))
|
||||
.groupBy("title", "author", "publisher", "publish_year")
|
||||
.having("COUNT(*) > 1");
|
||||
return resourceMapper.selectMaps(wrapper);
|
||||
}
|
||||
|
||||
private void updateFlag(List<Long> ids, int flag) {
|
||||
for (int i = 0; i < ids.size(); i += BATCH) {
|
||||
List<Long> part = ids.subList(i, Math.min(i + BATCH, ids.size()));
|
||||
LambdaUpdateWrapper<VersionResource> update = new LambdaUpdateWrapper<>();
|
||||
update.set(VersionResource::getAbnormalFlag, flag).in(VersionResource::getId, part);
|
||||
resourceMapper.update(null, update);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatus(List<Long> ids, String status) {
|
||||
for (int i = 0; i < ids.size(); i += BATCH) {
|
||||
List<Long> part = ids.subList(i, Math.min(i + BATCH, ids.size()));
|
||||
LambdaUpdateWrapper<VersionResource> update = new LambdaUpdateWrapper<>();
|
||||
update.set(VersionResource::getGovernStatus, status).in(VersionResource::getId, part);
|
||||
resourceMapper.update(null, update);
|
||||
}
|
||||
}
|
||||
|
||||
private DuplicateGroupVO toDuplicateGroup(String reason, String matchKey, List<VersionResource> members) {
|
||||
DuplicateGroupVO group = new DuplicateGroupVO();
|
||||
group.setReason(reason);
|
||||
group.setMatchKey(matchKey);
|
||||
List<DuplicateItemVO> records = new ArrayList<>();
|
||||
for (VersionResource resource : members) {
|
||||
records.add(toDuplicateItem(resource));
|
||||
}
|
||||
group.setRecords(records);
|
||||
return group;
|
||||
}
|
||||
|
||||
private DuplicateItemVO toDuplicateItem(VersionResource resource) {
|
||||
DuplicateItemVO item = new DuplicateItemVO();
|
||||
item.setId(resource.getId());
|
||||
item.setProcessNo(resource.getProcessNo());
|
||||
item.setTitle(resource.getTitle());
|
||||
item.setAuthor(resource.getAuthor());
|
||||
item.setPublisher(resource.getPublisher());
|
||||
item.setPublishYear(resource.getPublishYear());
|
||||
item.setIsbn(resource.getIsbn());
|
||||
item.setMediaType(resource.getMediaType());
|
||||
item.setSourceLibrary(resource.getSourceLibrary());
|
||||
item.setGovernStatus(resource.getGovernStatus());
|
||||
return item;
|
||||
}
|
||||
|
||||
private DefectItemVO toDefect(VersionResource resource, List<String> issues) {
|
||||
DefectItemVO item = new DefectItemVO();
|
||||
item.setId(resource.getId());
|
||||
item.setProcessNo(resource.getProcessNo());
|
||||
item.setTitle(resource.getTitle());
|
||||
item.setAuthor(resource.getAuthor());
|
||||
item.setSourceLibrary(resource.getSourceLibrary());
|
||||
item.setMediaType(resource.getMediaType());
|
||||
item.setIssues(issues);
|
||||
return item;
|
||||
}
|
||||
|
||||
private boolean sameNonBlankIsbn(List<VersionResource> members) {
|
||||
String isbn = null;
|
||||
for (VersionResource resource : members) {
|
||||
if (blank(resource.getIsbn())) {
|
||||
return false;
|
||||
}
|
||||
if (isbn == null) {
|
||||
isbn = resource.getIsbn().trim();
|
||||
} else if (!isbn.equals(resource.getIsbn().trim())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return isbn != null;
|
||||
}
|
||||
|
||||
private boolean sameFourFields(List<VersionResource> members) {
|
||||
VersionResource first = members.get(0);
|
||||
for (int i = 1; i < members.size(); i++) {
|
||||
VersionResource other = members.get(i);
|
||||
if (!text(first.getTitle()).equals(text(other.getTitle()))
|
||||
|| !text(first.getAuthor()).equals(text(other.getAuthor()))
|
||||
|| !text(first.getPublisher()).equals(text(other.getPublisher()))
|
||||
|| !text(first.getPublishYear()).equals(text(other.getPublishYear()))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String normalizeTitle(String value) {
|
||||
if (blank(value)) {
|
||||
return "";
|
||||
}
|
||||
String normalized = EDITION.matcher(value.trim()).replaceAll("");
|
||||
normalized = PUNCT.matcher(normalized).replaceAll("");
|
||||
return normalized.toLowerCase();
|
||||
}
|
||||
|
||||
private void union(Map<Long, Long> parent, Long left, Long right) {
|
||||
long rootLeft = find(parent, left);
|
||||
long rootRight = find(parent, right);
|
||||
if (rootLeft != rootRight) {
|
||||
parent.put(rootLeft, rootRight);
|
||||
}
|
||||
}
|
||||
|
||||
private long find(Map<Long, Long> parent, Long id) {
|
||||
parent.putIfAbsent(id, id);
|
||||
long current = parent.get(id);
|
||||
if (current != id) {
|
||||
current = find(parent, current);
|
||||
parent.put(id, current);
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
private boolean flagged(VersionResource resource) {
|
||||
return resource.getAbnormalFlag() != null && resource.getAbnormalFlag() == 1;
|
||||
}
|
||||
|
||||
private boolean blank(String value) {
|
||||
return value == null || value.trim().isEmpty();
|
||||
}
|
||||
|
||||
private String text(String value) {
|
||||
return blank(value) ? "" : value.trim();
|
||||
}
|
||||
|
||||
private String requireType(String jobType) {
|
||||
if (jobType == null || !JOB_TYPES.contains(jobType.toUpperCase())) {
|
||||
throw new BusinessException("不支持的治理类型:" + jobType);
|
||||
}
|
||||
return jobType.toUpperCase();
|
||||
}
|
||||
|
||||
private GovernanceJob begin(String type) {
|
||||
GovernanceJob job = new GovernanceJob();
|
||||
job.setJobType(type);
|
||||
job.setStatus("RUNNING");
|
||||
job.setStartTime(LocalDateTime.now());
|
||||
this.save(job);
|
||||
return job;
|
||||
}
|
||||
|
||||
private void finish(GovernanceJob job) {
|
||||
job.setEndTime(LocalDateTime.now());
|
||||
this.updateById(job);
|
||||
}
|
||||
|
||||
private GovernanceHintVO emptyHint(GovernanceJob job) {
|
||||
GovernanceHintVO vo = new GovernanceHintVO();
|
||||
vo.setJob(job);
|
||||
vo.setDuplicateGroups(new ArrayList<>());
|
||||
vo.setDefects(new ArrayList<>());
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
-- =====================================================================
|
||||
-- 治理演示数据(可重复执行)
|
||||
-- 覆盖:同一文献多来源纸电、无 ISBN 的四要素重复、疑似同一文献、
|
||||
-- 元数据错漏、非纸电图书、敏感图书、可直接提纯的独立纸电图书
|
||||
-- =====================================================================
|
||||
|
||||
ALTER TABLE version_resource ADD COLUMN IF NOT EXISTS merged_to_id BIGINT;
|
||||
ALTER TABLE version_resource ADD COLUMN IF NOT EXISTS abnormal_flag SMALLINT DEFAULT 0;
|
||||
UPDATE version_resource SET abnormal_flag = 0 WHERE abnormal_flag IS NULL;
|
||||
|
||||
-- 010x ISBN 相同:纸质著录缺摘要长度和版次,电子本描述更完整,供聚同后优化补全
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0101', '信息化战争概论', 'E81', '信息化;战争', '概述信息化战争的基本特点。', '2023', '20261018',
|
||||
'文本', '纸质', 'PDF', '286', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0101',
|
||||
'王磊', '著', NULL,
|
||||
'解放军出版社', NULL, '20230101', NULL, '978-7-80237-1101-1',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0101' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0102', '信息化战争概论', NULL, '信息化战争;联合作战',
|
||||
'本书从信息化战争的基本概念、作战力量构成和指挥控制方式出发,结合近期局部战争案例,说明信息主导、体系对抗和精确打击对现代作战的影响。书中对战场态势感知、数据链路运用和后装保障协同作了教学化整理,适合军队院校生长军官课程与部队指挥员自学使用。',
|
||||
'2023', '20261018',
|
||||
'文本', '电子', 'PDF', '302', 'chi', '陆军步兵学院', '2026',
|
||||
'国防大学图书馆', '10.0.0.31:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0102',
|
||||
'王磊', '著', '电子版附教学课件。',
|
||||
'解放军出版社', '北京', '20230301', '第2版', '978-7-80237-1101-1',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0102' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0103', '信息化战争概论', 'E81', '指挥;信息化', NULL, '2023', '20261018',
|
||||
'文本', '纸质', 'PDF', '286', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军指挥学院图书馆', '10.0.0.41:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0103',
|
||||
'王磊', '著', '纸本另有复本,藏于阅览室。',
|
||||
'解放军出版社', '南京', '20230101', NULL, '978-7-80237-1101-1',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0103' AND deleted = 0);
|
||||
|
||||
-- 020x 无 ISBN,书名+作者+出版社+出版年份一致,供聚同;主题词与分类号分别缺在两条上,供优化互为补充
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0201', '陆军战术学教程', 'E83', NULL,
|
||||
'本教程依据现行战斗条令,按进攻、防御和行军宿营的顺序讲解陆军战术的基本原则、兵力部署和协同动作。各章配有想定作业与思考题,便于院校教学和分队干部自学,也可作为合同战术训练的基础读本。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2022', '20261018',
|
||||
'文本', '纸质', 'PDF', '248', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0201',
|
||||
'赵明', '编著', NULL,
|
||||
'军事科学出版社', '北京', '20220601', '第1版', NULL,
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0201' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0202', '陆军战术学教程', NULL, '战术学;陆军', '简介陆军战术基本原则。', '2022', '20261018',
|
||||
'文本', '电子', 'PDF', '248', 'chi', '陆军步兵学院', '2026',
|
||||
'南京陆军指挥学院图书馆', '10.0.0.21:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0202',
|
||||
'赵明', '编著', '电子版由纸本数字化加工。',
|
||||
'军事科学出版社', '北京', '20220601', NULL, NULL,
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0202' AND deleted = 0);
|
||||
|
||||
-- 030x 题名相近但 ISBN、版次不同,聚同不会自动合并,只出现在疑似同一文献清单
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0301', '合成营战术', 'E83', '合成营;战术',
|
||||
'本书围绕合成营进攻与防御的组织实施,说明兵力编成、火力计划和步坦协同的基本方法。内容按课堂教学进度编排,并附有班组讨论题目,供陆军院校合成指挥专业学员使用。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2021', '20261018',
|
||||
'文本', '纸质', 'PDF', '196', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0301',
|
||||
'陈刚', '著', NULL,
|
||||
'解放军出版社', '北京', '20210901', '第1版', '978-7-111-2201-6',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0301' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0302', '合成营战术(第二版)', 'E83', '合成营;无人装备',
|
||||
'第二版在原有合成营战术框架上补充了无人装备协同和城镇战斗的内容,对指挥流程、通信组织和战损评估作了修订。全书仍面向生长军官培训,可作为部队分队战术训练的配套教材。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2024', '20261018',
|
||||
'文本', '电子', 'PDF', '228', 'chi', '陆军步兵学院', '2026',
|
||||
'国防大学图书馆', '10.0.0.31:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0302',
|
||||
'陈刚', '著', NULL,
|
||||
'解放军出版社', '北京', '20240301', '第2版', '978-7-111-2202-3',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0302' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0303', '联合作战指挥', 'E81', '联合作战;指挥',
|
||||
'本书讲述联合作战指挥的职责区分、计划拟制和情况处置,强调情报、火力与后装保障的一体运用。案例选自院校想定作业,适合指挥员任职培训和参谋业务教学参考。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2020', '20261018',
|
||||
'文本', '纸质', 'PDF', '264', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军指挥学院图书馆', '10.0.0.41:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0303',
|
||||
'刘洋', '主编', NULL,
|
||||
'国防大学出版社', '北京', '20200501', '第1版', '978-7-5065-3301-4',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0303' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0304', '联合作战指挥学', 'E81', '联合作战;指挥机构',
|
||||
'本书在联合作战指挥的基础上,进一步讨论指挥机构编成、命令文书和跨军种协同的方法。各章附有思考题,可供中级指挥培训班和相关专业研究生教学使用。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2023', '20261018',
|
||||
'文本', '电子', 'PDF', '310', 'chi', '陆军步兵学院', '2026',
|
||||
'南京陆军指挥学院图书馆', '10.0.0.21:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0304',
|
||||
'刘洋', '主编', NULL,
|
||||
'国防大学出版社', '北京', '20230901', '第1版', '978-7-5065-3304-5',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0304' AND deleted = 0);
|
||||
|
||||
-- 040x 错漏:缺分类号/摘要过短/年份和语种、ISBN、页码、责任者不规范,或全文地址、主题词缺失
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0401', '边防侦察教材', NULL, '边防;侦察', '介绍边防侦察的一般方法。', '202x', '20261018',
|
||||
'文本', '纸质', 'PDF', NULL, '中文', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0401',
|
||||
NULL, '编', '著录信息残缺,供错漏提示演示。',
|
||||
'解放军出版社', '昆明', NULL, NULL, '978-错误',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0401' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0402', '军事地形学基础', 'E991', NULL,
|
||||
'讲解军事地形图识读、距离判定和简易测图,供分队干部短训使用。',
|
||||
'2019', '20261018',
|
||||
'文本', '电子', 'PDF', '96', 'chi', '陆军步兵学院', '2026',
|
||||
'国防大学图书馆', '10.0.0.31:8080', NULL,
|
||||
'孙伟', '著', NULL,
|
||||
'军事科学出版社', '北京', '20190801', '第1版', '978-7-80237-5102-7',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0402' AND deleted = 0);
|
||||
|
||||
-- 050x 非纸电图书:字段完整,提纯时应留在全库之外
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0501', '队列条令讲解录音', 'E22', '队列;条令',
|
||||
'本录音按照队列条令的章节顺序讲解单个军人队列动作和班队列动作,供新兵入伍训练阶段对照收听,也可作为队列教学的辅助材料。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2024', '20261018',
|
||||
'音频', '电子', 'MP3', '48', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0501',
|
||||
'队列教研室', '讲解', NULL,
|
||||
'解放军出版社', '北京', '20240101', NULL, '978-7-80237-6101-2',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0501' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0502', '战术动作示范', 'E83', '战术动作;教学片',
|
||||
'本片以分队战术动作为主线,演示利用地形、冲击发起和伤员救护的基本动作,供战术课直观教学和班排训练对照使用。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2023', '20261018',
|
||||
'视频', '电子', 'MP4', '36', 'chi', '陆军步兵学院', '2026',
|
||||
'国防大学图书馆', '10.0.0.31:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0502',
|
||||
'战术教研室', '演示', NULL,
|
||||
'军事科学出版社', '北京', '20230601', NULL, '978-7-80237-6102-9',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0502' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0503', '军事学术2024年合订本', 'E0', '军事学术;期刊',
|
||||
'本合订本汇集当年军事学术论文,内容涉及作战理论、训练方法和院校教育。作为连续出版物样例入库,用于区分期刊与纸电图书。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2024', '20261018',
|
||||
'期刊', '纸质', 'PDF', '480', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军指挥学院图书馆', '10.0.0.41:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0503',
|
||||
'军事学术编辑部', '辑', NULL,
|
||||
'军事科学出版社', '北京', '20241201', NULL, '978-7-80237-6103-6',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0503' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0504', '民国军事旧籍选', 'E296', '民国;缩微',
|
||||
'本书为馆藏缩微复制的民国时期军事旧籍,保留原书题名与出版信息,介质为缩微胶片,仅作非纸电图书对照样例。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'1948', '20261018',
|
||||
'缩微', '纸质', 'TIF', '120', 'chi', '陆军步兵学院', '2026',
|
||||
'南京陆军指挥学院图书馆', '10.0.0.21:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0504',
|
||||
'佚名', '辑', NULL,
|
||||
'军事科学出版社', '南京', '19480101', NULL, '978-7-80237-6104-3',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0504' AND deleted = 0);
|
||||
|
||||
-- 060x 敏感图书:字段完整,但不得进入版本资源数据集
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0601', '部队内部编制手册', 'E15', '编制;实力',
|
||||
'本手册整理部队编制和实力统计的一般格式,字段完整,但内容已标记为敏感,提纯时应当从版本资源数据集中剔除。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2025', '20261018',
|
||||
'文本', '纸质', 'PDF', '86', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0601',
|
||||
'训练部', '编', NULL,
|
||||
'解放军出版社', '北京', '20250101', '内部', '978-7-80237-7101-5',
|
||||
'RAW', 1, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0601' AND deleted = 0);
|
||||
|
||||
-- 070x 独立、著录完整的纸电图书,提纯时可直接纳入数据集
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0701', '步兵班战术', 'E83', '步兵班;战术',
|
||||
'本书按班进攻、班防御和夜间战斗的顺序,说明步兵班的战斗队形、火器配置和指挥口令。文字通俗,配有要图说明,适合预提指挥士官和新兵骨干训练使用。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2022', '20261018',
|
||||
'文本', '纸质', 'PDF', '168', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0701',
|
||||
'周强', '著', NULL,
|
||||
'解放军出版社', '北京', '20220401', '第1版', '978-7-80237-4101-8',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0701' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0702', '电子对抗基础', 'TN97', '电子对抗;干扰',
|
||||
'本书介绍电子对抗的侦察、干扰和防护基础,说明常见装备的运用时机和分队协同要求。内容面向初级任职教育,可作为电子对抗和指挥专业的入门教材。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2021', '20261018',
|
||||
'文本', '电子', 'PDF', '214', 'chi', '陆军步兵学院', '2026',
|
||||
'国防大学图书馆', '10.0.0.31:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0702',
|
||||
'吴敏', '著', NULL,
|
||||
'国防大学出版社', '北京', '20211101', '第1版', '978-7-80237-4102-5',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0702' AND deleted = 0);
|
||||
|
||||
INSERT INTO version_resource (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn,
|
||||
govern_status, sensitive_flag, is_special, abnormal_flag, manage_status, deleted)
|
||||
SELECT 'BB-DEMO-0703', '合同战术演习指南', 'E83', '合同战术;演习',
|
||||
'本指南说明合同战术演习的筹划、导调和裁决方法,包括情况设想、演习文书和复盘讲评的一般步骤。可供院校导演人员和部队训练机构组织实兵或兵棋演习时参考。著录要素按版本资源元数据标准整理,可供治理演示时对照不同来源、不同媒体记录之间的字段差异与补全效果。',
|
||||
'2024', '20261018',
|
||||
'文本', '纸质', 'PDF', '176', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军指挥学院图书馆', '10.0.0.41:8080', 'http://cdio.example.org/fulltext/BB-DEMO-0703',
|
||||
'郑凯', '编著', NULL,
|
||||
'军事科学出版社', '北京', '20240201', '第1版', '978-7-80237-4103-2',
|
||||
'RAW', 0, 0, 0, 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM version_resource WHERE process_no = 'BB-DEMO-0703' AND deleted = 0);
|
||||
@@ -24,4 +24,6 @@ VALUES
|
||||
|
||||
-- 样例数据用显式 id 插入,需同步自增序列起点,避免后续新增主键冲突
|
||||
SELECT setval('version_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM version_resource), 0), 1), true);
|
||||
|
||||
-- 治理演示数据(多来源重复、疑似同一文献、错漏、非纸电图书)见 data-governance-demo.sql
|
||||
SELECT setval('special_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM special_resource), 0), 1), true);
|
||||
|
||||
@@ -52,6 +52,12 @@ CREATE TABLE IF NOT EXISTS collect_task
|
||||
library_code VARCHAR(64) NOT NULL, -- 单位编码
|
||||
library_name VARCHAR(256), -- 单位名称
|
||||
source_type VARCHAR(64), -- 数据源类型:MARC/EXCEL/DB/API
|
||||
db_host VARCHAR(256), -- 来源库地址
|
||||
db_port INTEGER, -- 来源库端口
|
||||
db_name VARCHAR(128), -- 来源库名
|
||||
db_username VARCHAR(128), -- 来源库用户名
|
||||
db_password VARCHAR(256), -- 来源库密码
|
||||
source_table VARCHAR(128), -- 数据库采集的来源表名
|
||||
target_count INTEGER DEFAULT 200000, -- 目标采集量
|
||||
collected_count INTEGER DEFAULT 0, -- 已采集量
|
||||
status VARCHAR(32) DEFAULT 'PENDING', -- PENDING/RUNNING/SUCCESS/FAILED
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
-- =====================================================================
|
||||
-- v8:数据采集按表名入库
|
||||
-- 1. 采集任务记录来源表名
|
||||
-- 2. 馆藏源表 src_library_catalog,字段与 version_resource 著录项对齐
|
||||
-- =====================================================================
|
||||
|
||||
ALTER TABLE collect_task ADD COLUMN IF NOT EXISTS source_table VARCHAR(128);
|
||||
COMMENT ON COLUMN collect_task.source_table IS '数据库采集时的来源表名';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS src_library_catalog
|
||||
(
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
process_no VARCHAR(128),
|
||||
title VARCHAR(512) NOT NULL,
|
||||
clc_code VARCHAR(64),
|
||||
keywords VARCHAR(512),
|
||||
summary TEXT,
|
||||
publish_year VARCHAR(8),
|
||||
process_date VARCHAR(16),
|
||||
content_form VARCHAR(64),
|
||||
media_type VARCHAR(32),
|
||||
format VARCHAR(64),
|
||||
page_count VARCHAR(64),
|
||||
language VARCHAR(16),
|
||||
submit_org VARCHAR(256),
|
||||
task_year VARCHAR(8),
|
||||
source_library VARCHAR(256),
|
||||
source_library_addr VARCHAR(256),
|
||||
fulltext_url VARCHAR(1024),
|
||||
author VARCHAR(512),
|
||||
responsibility VARCHAR(256),
|
||||
note TEXT,
|
||||
publisher VARCHAR(256),
|
||||
publish_place VARCHAR(128),
|
||||
publish_date VARCHAR(32),
|
||||
edition VARCHAR(128),
|
||||
isbn VARCHAR(64)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE src_library_catalog IS '馆藏源表,供数据采集按表名读取后写入 version_resource';
|
||||
|
||||
INSERT INTO src_library_catalog (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn)
|
||||
SELECT 'SRC-2026-1001', '合同进攻战斗教材', 'E83', '合同进攻;战斗;战术',
|
||||
'本教材讲解合同进攻战斗的任务区分、火力组织和步坦协同,供陆军院校分队战术课使用。',
|
||||
'2022', '20261020', '文本', '纸质', 'PDF', '246', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/SRC-2026-1001',
|
||||
'何军', '编著', '馆藏源表样例,采集后写入版本资源表。',
|
||||
'解放军出版社', '北京', '20220301', '第1版', '978-7-80237-8101-6'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM src_library_catalog WHERE process_no = 'SRC-2026-1001');
|
||||
|
||||
INSERT INTO src_library_catalog (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn)
|
||||
SELECT 'SRC-2026-1002', '防空兵战术学', 'E84', '防空兵;战术;对空射击',
|
||||
'本书说明防空兵兵力部署、对空射击指挥和与被掩护部队的协同方法。',
|
||||
'2021', '20261020', '文本', '电子', 'PDF', '318', 'chi', '陆军防空兵学院', '2026',
|
||||
'陆军防空兵学院图书馆', '10.0.0.61:8080', 'http://cdio.example.org/fulltext/SRC-2026-1002',
|
||||
'马林', '著', '电子本由纸本数字化加工。',
|
||||
'军事科学出版社', '北京', '20210901', '第2版', '978-7-80237-8102-3'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM src_library_catalog WHERE process_no = 'SRC-2026-1002');
|
||||
|
||||
INSERT INTO src_library_catalog (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn)
|
||||
SELECT 'SRC-2026-1003', '军事后勤学概论', 'E13', '军事后勤;保障;供应',
|
||||
'概论军事后勤的体制、供应方式和战时保障组织,适合生长军官基础课阅读。',
|
||||
'2019', '20261020', '文本', '纸质', 'PDF', '402', 'chi', '陆军勤务学院', '2026',
|
||||
'陆军勤务学院图书馆', '10.0.0.71:8080', 'http://cdio.example.org/fulltext/SRC-2026-1003',
|
||||
'周宁', '主编', NULL,
|
||||
'国防大学出版社', '北京', '20190501', '第1版', '978-7-80237-8103-0'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM src_library_catalog WHERE process_no = 'SRC-2026-1003');
|
||||
|
||||
INSERT INTO src_library_catalog (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn)
|
||||
SELECT 'SRC-2026-1004', '外军陆军编制研究', 'E1-3', '外军;编制;陆军',
|
||||
'比较若干国家陆军师旅营编制和装备编成,供指挥院校外军研究课程参考。',
|
||||
'2018', '20261020', '文本', '纸质', 'PDF', '276', 'chi', '陆军指挥学院', '2026',
|
||||
'陆军指挥学院图书馆', '10.0.0.41:8080', 'http://cdio.example.org/fulltext/SRC-2026-1004',
|
||||
'韩雪', '著', NULL,
|
||||
'军事科学出版社', '北京', '20181101', '第1版', '978-7-80237-8104-7'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM src_library_catalog WHERE process_no = 'SRC-2026-1004');
|
||||
|
||||
INSERT INTO src_library_catalog (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn)
|
||||
SELECT 'SRC-2026-1005', '战场电磁环境', 'TN97', '电磁环境;电子对抗;频谱',
|
||||
'介绍战场电磁环境的构成、测量和分队用频管理,可作为电子对抗入门读物。',
|
||||
'2023', '20261020', '文本', '电子', 'PDF', '188', 'chi', '国防科技大学', '2026',
|
||||
'国防科技大学图书馆', '10.0.0.91:8080', 'http://cdio.example.org/fulltext/SRC-2026-1005',
|
||||
'吴敏', '编著', NULL,
|
||||
'国防工业出版社', '北京', '20230601', '第1版', '978-7-118-12005-8'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM src_library_catalog WHERE process_no = 'SRC-2026-1005');
|
||||
|
||||
INSERT INTO src_library_catalog (
|
||||
process_no, title, clc_code, keywords, summary, publish_year, process_date,
|
||||
content_form, media_type, format, page_count, language, submit_org, task_year,
|
||||
source_library, source_library_addr, fulltext_url, author, responsibility, note,
|
||||
publisher, publish_place, publish_date, edition, isbn)
|
||||
SELECT 'SRC-2026-1006', '陆军院校图书馆纸电目录规范', 'G254', '纸电目录;著录;图书馆',
|
||||
'规范陆军院校图书馆纸质书与电子书目录的著录项目和交换格式,供联合采集对照。',
|
||||
'2024', '20261020', '文本', '电子', 'PDF', '132', 'chi', '陆军步兵学院', '2026',
|
||||
'陆军步兵学院图书馆', '10.0.0.11:8080', 'http://cdio.example.org/fulltext/SRC-2026-1006',
|
||||
'目录组', '编', '字段名与版本资源表一致,采集时按同名字段写入。',
|
||||
'解放军出版社', '南昌', '20240101', '第1版', '978-7-80237-8106-1'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM src_library_catalog WHERE process_no = 'SRC-2026-1006');
|
||||
@@ -0,0 +1,12 @@
|
||||
-- 采集任务保存来源库连接信息。密码只用于再次执行采集,接口不回传。
|
||||
ALTER TABLE collect_task ADD COLUMN IF NOT EXISTS db_host VARCHAR(256);
|
||||
ALTER TABLE collect_task ADD COLUMN IF NOT EXISTS db_port INTEGER;
|
||||
ALTER TABLE collect_task ADD COLUMN IF NOT EXISTS db_name VARCHAR(128);
|
||||
ALTER TABLE collect_task ADD COLUMN IF NOT EXISTS db_username VARCHAR(128);
|
||||
ALTER TABLE collect_task ADD COLUMN IF NOT EXISTS db_password VARCHAR(256);
|
||||
|
||||
COMMENT ON COLUMN collect_task.db_host IS '来源数据库地址';
|
||||
COMMENT ON COLUMN collect_task.db_port IS '来源数据库端口';
|
||||
COMMENT ON COLUMN collect_task.db_name IS '来源数据库名';
|
||||
COMMENT ON COLUMN collect_task.db_username IS '来源数据库用户名';
|
||||
COMMENT ON COLUMN collect_task.db_password IS '来源数据库密码';
|
||||
@@ -4,6 +4,12 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>版本资源联合服务系统</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -5,6 +5,13 @@ export interface CollectTask {
|
||||
libraryCode: string
|
||||
libraryName?: string
|
||||
sourceType?: string
|
||||
dbHost?: string
|
||||
dbPort?: number
|
||||
dbName?: string
|
||||
dbUsername?: string
|
||||
/** 只在提交时发送,列表接口不会返回 */
|
||||
dbPassword?: string
|
||||
sourceTable?: string
|
||||
targetCount?: number
|
||||
collectedCount?: number
|
||||
status?: string
|
||||
@@ -14,6 +21,18 @@ export interface CollectTask {
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface CollectColumn {
|
||||
columnName: string
|
||||
targetField?: string
|
||||
targetLabel?: string
|
||||
}
|
||||
|
||||
export interface CollectTable {
|
||||
tableName: string
|
||||
rowCount: number
|
||||
columns: CollectColumn[]
|
||||
}
|
||||
|
||||
/** 创建采集任务 */
|
||||
export function createCollectTask(data: CollectTask) {
|
||||
return request.post<never, number>('/collect/task', data)
|
||||
@@ -21,7 +40,7 @@ export function createCollectTask(data: CollectTask) {
|
||||
|
||||
/** 执行采集任务 */
|
||||
export function startCollectTask(id: number) {
|
||||
return request.post<never, void>(`/collect/task/${id}/start`)
|
||||
return request.post<never, CollectTask>(`/collect/task/${id}/start`)
|
||||
}
|
||||
|
||||
/** 任务列表 */
|
||||
@@ -29,7 +48,7 @@ export function listCollectTasks() {
|
||||
return request.get<never, CollectTask[]>('/collect/tasks')
|
||||
}
|
||||
|
||||
/** 某单位最新进度 */
|
||||
export function getCollectProgress(libraryCode: string) {
|
||||
return request.get<never, CollectTask>(`/collect/progress/${libraryCode}`)
|
||||
/** 按填写的连接信息测试来源库,并返回字段对应关系 */
|
||||
export function previewCollectSource(data: CollectTask) {
|
||||
return request.post<never, CollectTable>('/collect/preview', data)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,56 @@ export interface GovernanceJob {
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface DuplicateItem {
|
||||
id?: number
|
||||
processNo?: string
|
||||
title?: string
|
||||
author?: string
|
||||
publisher?: string
|
||||
publishYear?: string
|
||||
isbn?: string
|
||||
mediaType?: string
|
||||
sourceLibrary?: string
|
||||
governStatus?: string
|
||||
}
|
||||
|
||||
export interface DuplicateGroup {
|
||||
reason: string
|
||||
matchKey?: string
|
||||
records: DuplicateItem[]
|
||||
}
|
||||
|
||||
export interface DefectItem {
|
||||
id?: number
|
||||
processNo?: string
|
||||
title?: string
|
||||
author?: string
|
||||
sourceLibrary?: string
|
||||
mediaType?: string
|
||||
issues: string[]
|
||||
}
|
||||
|
||||
export interface GovernanceHint {
|
||||
job?: GovernanceJob
|
||||
duplicateGroupCount: number
|
||||
defectCount: number
|
||||
duplicateGroups: DuplicateGroup[]
|
||||
defects: DefectItem[]
|
||||
}
|
||||
|
||||
export interface DatasetItem {
|
||||
id?: number
|
||||
processNo?: string
|
||||
title?: string
|
||||
author?: string
|
||||
mediaType?: string
|
||||
contentForm?: string
|
||||
sourceLibrary?: string
|
||||
publishYear?: string
|
||||
isbn?: string
|
||||
governStatus?: string
|
||||
}
|
||||
|
||||
/** 聚同 */
|
||||
export function runMerge() {
|
||||
return request.post<never, GovernanceJob>('/governance/merge')
|
||||
@@ -21,9 +71,14 @@ export function runOptimize() {
|
||||
return request.post<never, GovernanceJob>('/governance/optimize')
|
||||
}
|
||||
|
||||
/** 提示 */
|
||||
/** 提示:生成两份清单并标记错漏 */
|
||||
export function runHint() {
|
||||
return request.post<never, GovernanceJob>('/governance/hint')
|
||||
return request.post<never, GovernanceHint>('/governance/hint')
|
||||
}
|
||||
|
||||
/** 预览当前两份提示清单 */
|
||||
export function previewHints() {
|
||||
return request.get<never, GovernanceHint>('/governance/hints')
|
||||
}
|
||||
|
||||
/** 提纯 */
|
||||
@@ -31,6 +86,11 @@ export function runPurify() {
|
||||
return request.post<never, GovernanceJob>('/governance/purify')
|
||||
}
|
||||
|
||||
/** 版本资源数据集 */
|
||||
export function listDataset() {
|
||||
return request.get<never, DatasetItem[]>('/governance/dataset')
|
||||
}
|
||||
|
||||
/** 治理任务历史 */
|
||||
export function listGovernanceJobs() {
|
||||
return request.get<never, GovernanceJob[]>('/governance/jobs')
|
||||
|
||||
@@ -105,7 +105,7 @@ function openAdmin() {
|
||||
gap: 36px;
|
||||
padding: 0 36px;
|
||||
/* 与首页检索面板完全一致的半透明绿 + 同款毛玻璃 */
|
||||
background: rgba(16, 38, 28, 0.58);
|
||||
background: var(--header-glass);
|
||||
backdrop-filter: blur(22px) saturate(140%);
|
||||
-webkit-backdrop-filter: blur(22px) saturate(140%);
|
||||
color: #fff;
|
||||
@@ -122,7 +122,7 @@ function openAdmin() {
|
||||
bottom: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
|
||||
opacity: 0.6;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ function openAdmin() {
|
||||
width: 1px;
|
||||
height: 30px;
|
||||
transform: translateY(-50%);
|
||||
background: rgba(210, 229, 214, 0.35);
|
||||
background: var(--header-line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,14 +165,14 @@ function openAdmin() {
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
line-height: 1;
|
||||
color: #eef6f0;
|
||||
color: var(--text-on-dark);
|
||||
}
|
||||
|
||||
.logo-sub {
|
||||
font-size: 9px;
|
||||
line-height: 1;
|
||||
letter-spacing: 1px;
|
||||
color: rgba(210, 229, 214, 0.72);
|
||||
color: var(--brand-gold-light);
|
||||
}
|
||||
|
||||
.nav {
|
||||
@@ -237,7 +237,7 @@ function openAdmin() {
|
||||
width: 1px;
|
||||
height: 30px;
|
||||
transform: translateY(-50%);
|
||||
background: rgba(210, 229, 214, 0.3);
|
||||
background: var(--header-line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,11 +258,11 @@ function openAdmin() {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgba(210, 229, 214, 0.5);
|
||||
border: 1px solid var(--brand-gold-light);
|
||||
}
|
||||
|
||||
.user {
|
||||
color: #eef6f0;
|
||||
color: var(--text-on-dark);
|
||||
}
|
||||
|
||||
.quit {
|
||||
|
||||
+209
-32
@@ -1,4 +1,5 @@
|
||||
/* 全局样式 */
|
||||
/* 全局样式:组件视觉统一走主题变量 */
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -9,35 +10,44 @@ body,
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
|
||||
'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 14px;
|
||||
color: var(--text-main);
|
||||
background-color: var(--page-bg);
|
||||
}
|
||||
|
||||
/* 标题使用衬线字体,呼应版本馆的文化气质 */
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
.serif {
|
||||
font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong',
|
||||
'SimSun', serif;
|
||||
h4,
|
||||
.serif,
|
||||
.page-title {
|
||||
font-family: var(--font-serif);
|
||||
}
|
||||
|
||||
/* ---------- 通用卡片:白底 + 细边 + 直角,无浮夸阴影 ---------- */
|
||||
a {
|
||||
color: var(--brand-primary-deep);
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--brand-gold);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ---------- 通用卡片:白底 + 细金边 + 极浅投影 ---------- */
|
||||
.page-card {
|
||||
background-color: var(--card-bg);
|
||||
border: 1px solid var(--card-border);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 20px 22px;
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
/* ---------- 通用区块标题:左侧金线 + 细分隔线 ---------- */
|
||||
/* ---------- 区块标题:左侧烫金竖条 + 衬线 ---------- */
|
||||
.page-title {
|
||||
position: relative;
|
||||
margin: 0 0 18px;
|
||||
padding-left: 13px;
|
||||
padding-left: 14px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
@@ -49,17 +59,26 @@ h3,
|
||||
left: 0;
|
||||
top: 50%;
|
||||
width: 3px;
|
||||
height: 17px;
|
||||
height: 16px;
|
||||
transform: translateY(-50%);
|
||||
background: linear-gradient(180deg, var(--brand-gold), var(--brand-primary));
|
||||
background: linear-gradient(180deg, var(--brand-gold-light), var(--brand-gold-deep));
|
||||
}
|
||||
}
|
||||
|
||||
.section-kicker {
|
||||
margin: 4px 0 12px;
|
||||
padding-left: 10px;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 14px;
|
||||
letter-spacing: 1px;
|
||||
color: var(--brand-primary-deep);
|
||||
border-left: 2px solid var(--brand-gold);
|
||||
}
|
||||
|
||||
.mb-16 {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* 细雅的分隔线 */
|
||||
.hair-line {
|
||||
height: 1px;
|
||||
background: var(--hair-line);
|
||||
@@ -67,20 +86,178 @@ h3,
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
/* Element Plus 细节校准 */
|
||||
/* ---------- 按钮 ---------- */
|
||||
.el-button {
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.4px;
|
||||
transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
|
||||
}
|
||||
|
||||
.el-card {
|
||||
border-color: var(--card-border);
|
||||
.el-button--primary:not(.is-link):not(.is-text):not(.is-plain) {
|
||||
--el-button-bg-color: transparent;
|
||||
--el-button-border-color: var(--brand-primary-deep);
|
||||
--el-button-hover-bg-color: transparent;
|
||||
--el-button-hover-border-color: var(--brand-primary-ink);
|
||||
color: #fff;
|
||||
background: var(--btn-primary-bg);
|
||||
border-color: var(--brand-primary-deep);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: #fff;
|
||||
background: var(--btn-primary-hover);
|
||||
border-color: var(--brand-primary-ink);
|
||||
}
|
||||
}
|
||||
|
||||
.el-button--primary.is-plain:not(.is-link):not(.is-text) {
|
||||
--el-button-bg-color: var(--card-bg);
|
||||
color: var(--brand-primary-deep);
|
||||
background: var(--card-bg);
|
||||
border-color: var(--brand-gold);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: var(--brand-primary-ink);
|
||||
background: var(--brand-light);
|
||||
border-color: var(--brand-gold-deep);
|
||||
}
|
||||
}
|
||||
|
||||
.el-button--default:not(.is-link):not(.is-text) {
|
||||
color: var(--brand-primary-deep);
|
||||
background: var(--card-bg);
|
||||
border-color: var(--card-gold-border);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: var(--brand-primary-ink);
|
||||
border-color: var(--brand-gold);
|
||||
background: var(--paper-warm);
|
||||
}
|
||||
}
|
||||
|
||||
.el-button.is-link {
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
/* ---------- 输入与焦点 ---------- */
|
||||
.el-input__wrapper,
|
||||
.el-select__wrapper,
|
||||
.el-textarea__inner {
|
||||
border-radius: var(--radius-sm);
|
||||
transition: box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.el-input__wrapper.is-focus,
|
||||
.el-select__wrapper.is-focused,
|
||||
.el-textarea__inner:focus {
|
||||
box-shadow: 0 0 0 1px var(--brand-gold) inset !important;
|
||||
}
|
||||
|
||||
/* ---------- 表格 ---------- */
|
||||
.el-table {
|
||||
--el-table-header-bg-color: var(--table-header-bg);
|
||||
--el-table-header-text-color: var(--text-main);
|
||||
--el-table-border-color: var(--hair-line);
|
||||
--el-table-row-hover-bg-color: var(--row-hover);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.el-table th.el-table__cell {
|
||||
background: #faf6ef;
|
||||
background: var(--table-header-bg) !important;
|
||||
color: var(--text-main);
|
||||
font-family: var(--font-serif);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
|
||||
.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
|
||||
background: var(--row-stripe);
|
||||
}
|
||||
|
||||
.el-table__body tr:hover > td.el-table__cell {
|
||||
background: var(--row-hover) !important;
|
||||
}
|
||||
|
||||
/* ---------- 卡片 / 弹窗 / 抽屉 / 页签 ---------- */
|
||||
.el-card {
|
||||
border-color: var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.el-dialog {
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.el-dialog__header,
|
||||
.el-drawer__header {
|
||||
margin-right: 0;
|
||||
padding-bottom: 14px;
|
||||
border-bottom: 1px solid var(--brand-gold);
|
||||
font-family: var(--font-serif);
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.el-drawer__title,
|
||||
.el-dialog__title {
|
||||
font-family: var(--font-serif);
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.el-tabs__item {
|
||||
font-family: var(--font-serif);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.el-tabs__item.is-active {
|
||||
color: var(--brand-primary-deep);
|
||||
}
|
||||
|
||||
.el-tabs__active-bar {
|
||||
height: 2px;
|
||||
background-color: var(--brand-gold);
|
||||
}
|
||||
|
||||
.el-descriptions__label {
|
||||
font-family: var(--font-serif);
|
||||
color: var(--text-sub) !important;
|
||||
background: var(--table-header-bg) !important;
|
||||
}
|
||||
|
||||
.el-divider__text {
|
||||
font-family: var(--font-serif);
|
||||
color: var(--brand-primary-deep);
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.el-pagination.is-background .el-pager li.is-active {
|
||||
background-color: var(--brand-primary-deep);
|
||||
}
|
||||
|
||||
.el-alert--info {
|
||||
background: var(--brand-light);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
|
||||
.el-alert__title,
|
||||
.el-alert__description {
|
||||
color: var(--text-main);
|
||||
}
|
||||
}
|
||||
|
||||
.el-empty__description p {
|
||||
font-family: var(--font-serif);
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* 滚动条 */
|
||||
@@ -90,11 +267,11 @@ h3,
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #d8cbb9;
|
||||
background: var(--brand-gold-light);
|
||||
border-radius: 5px;
|
||||
|
||||
&:hover {
|
||||
background: #c3b29b;
|
||||
background: var(--brand-gold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +279,7 @@ h3,
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* ---------- 页面切换过渡 ---------- */
|
||||
/* ---------- 页面切换 ---------- */
|
||||
.page-enter-active,
|
||||
.page-leave-active {
|
||||
transition: opacity 0.26s ease, transform 0.26s ease;
|
||||
@@ -117,16 +294,16 @@ h3,
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* ---------- 通用交互过渡 ---------- */
|
||||
.el-button {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.page-enter-active,
|
||||
.page-leave-active,
|
||||
.el-button,
|
||||
.el-card {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.el-input__wrapper,
|
||||
.el-select__wrapper {
|
||||
transition: box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.el-card {
|
||||
transition: box-shadow 0.24s ease, transform 0.24s ease, border-color 0.24s ease;
|
||||
.page-enter-from,
|
||||
.page-leave-to {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +1,127 @@
|
||||
/* ============================================================
|
||||
版本资源联合服务系统 · 视觉主题
|
||||
参考「吉林大学图书馆」:全屏实景背景 + 半透明层叠面板
|
||||
配色:浅绿(不用蓝色/棕色作为主基调)
|
||||
新中式 + 现代政务:浅绿底、墨绿主色、温润烫金点缀
|
||||
颜色只在这里定义,页面通过 CSS 变量取用
|
||||
============================================================ */
|
||||
|
||||
/* ---------- 主站点:浅绿 ---------- */
|
||||
:root,
|
||||
:root.theme-main {
|
||||
/* 品牌色 */
|
||||
--brand-primary: #5b9a78;
|
||||
--brand-primary-soft: #6fa88a;
|
||||
--brand-primary-deep: #2f5d47;
|
||||
--brand-gold: #a9c9ad;
|
||||
--brand-gold-light: #d2e5d6;
|
||||
--brand-primary-ink: #1e3d2e;
|
||||
--brand-light: #eaf4ed;
|
||||
|
||||
/* 烫金:只用于竖线、选中、描边、图标,不做大面积铺底 */
|
||||
--brand-gold: #b8862d;
|
||||
--brand-gold-light: #e8d7a8;
|
||||
--brand-gold-deep: #8a6420;
|
||||
|
||||
/* 框架 */
|
||||
--header-bg: #2f5d47;
|
||||
--header-bg-deep: #244837;
|
||||
--header-glass: rgba(16, 38, 28, 0.62);
|
||||
--header-line: rgba(232, 215, 168, 0.45);
|
||||
--side-bg: #24483a;
|
||||
--page-bg: #f4f8f5;
|
||||
--hero-scrim: rgba(10, 28, 20, 0.55);
|
||||
|
||||
/* 文字 */
|
||||
--text-main: #23362c;
|
||||
--text-sub: #5c6f63;
|
||||
--text-muted: #8fa396;
|
||||
--text-sub: #4e6358;
|
||||
--text-muted: #7d9186;
|
||||
--text-on-dark: #f7fbf8;
|
||||
|
||||
/* 卡片与线条 */
|
||||
--card-bg: #ffffff;
|
||||
--card-border: #dfeae2;
|
||||
--hair-line: #e4ede7;
|
||||
--paper-warm: #fffdf8;
|
||||
--card-border: #e3ebe6;
|
||||
--card-gold-border: #e4d7b4;
|
||||
--hair-line: #e6eee8;
|
||||
--shadow-card: 0 8px 22px rgba(47, 93, 71, 0.06);
|
||||
--shadow-lift: 0 10px 24px rgba(47, 93, 71, 0.12);
|
||||
|
||||
/* 圆角 */
|
||||
--radius-sm: 2px;
|
||||
--radius-md: 3px;
|
||||
/* 表格 */
|
||||
--table-header-bg: #f8f4ea;
|
||||
--row-hover: #f3f8f5;
|
||||
--row-stripe: #fbfcfb;
|
||||
|
||||
/* Element Plus 主色对齐 */
|
||||
/* 命中高亮 */
|
||||
--hl-bg: #f6e7c1;
|
||||
--hl-text: #6b4e16;
|
||||
|
||||
/* 按钮 */
|
||||
--btn-primary-bg: linear-gradient(180deg, #4f8a6b 0%, #2f5d47 100%);
|
||||
--btn-primary-hover: linear-gradient(180deg, #3f7358 0%, #244837 100%);
|
||||
|
||||
/* 字体 */
|
||||
--font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
|
||||
--font-sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;
|
||||
--font-kai: 'Kaiti SC', 'STKaiti', 'KaiTi', '楷体', serif;
|
||||
|
||||
/* 圆角:方正、书卷气 */
|
||||
--radius-sm: 4px;
|
||||
--radius-md: 4px;
|
||||
|
||||
/* Element Plus */
|
||||
--el-color-primary: #5b9a78;
|
||||
--el-color-primary-light-3: #7cb094;
|
||||
--el-color-primary-light-5: #9dc4ac;
|
||||
--el-color-primary-light-7: #c3dccb;
|
||||
--el-color-primary-light-8: #d5e7db;
|
||||
--el-color-primary-light-9: #ecf4ef;
|
||||
--el-color-primary-dark-2: #4a7c5f;
|
||||
--el-border-radius-base: 2px;
|
||||
--el-border-radius-small: 2px;
|
||||
--el-color-primary-dark-2: #2f5d47;
|
||||
--el-color-success: #3e7a5c;
|
||||
--el-color-warning: #c47d2a;
|
||||
--el-color-danger: #c2453a;
|
||||
--el-color-error: #c2453a;
|
||||
--el-border-radius-base: 4px;
|
||||
--el-border-radius-small: 4px;
|
||||
--el-border-radius-round: 4px;
|
||||
--el-font-family: var(--font-sans);
|
||||
--el-text-color-primary: #23362c;
|
||||
--el-text-color-regular: #4a5c51;
|
||||
--el-border-color: #d8e5dc;
|
||||
--el-border-color-light: #dfeae2;
|
||||
--el-text-color-regular: #4e6358;
|
||||
--el-text-color-secondary: #7d9186;
|
||||
--el-text-color-placeholder: #8fa396;
|
||||
--el-border-color: #d7e3db;
|
||||
--el-border-color-light: #e3ebe6;
|
||||
--el-border-color-lighter: #eaf1ec;
|
||||
--el-fill-color-blank: #ffffff;
|
||||
--el-fill-color-light: #f8f4ea;
|
||||
--el-bg-color: #ffffff;
|
||||
--el-bg-color-page: #f4f8f5;
|
||||
--el-mask-color: rgba(22, 40, 32, 0.45);
|
||||
|
||||
--nav-bg-img: none;
|
||||
--hero-filter: none;
|
||||
}
|
||||
|
||||
/* ---------- 分站点:深一档的墨绿 ---------- */
|
||||
/* 分站点:更深的墨绿,烫金略亮一档,保证在深底上仍能看见 */
|
||||
:root.theme-brown {
|
||||
--brand-primary: #4a7c5f;
|
||||
--brand-primary-soft: #6d9a82;
|
||||
--brand-primary-deep: #1f3f2f;
|
||||
--brand-gold: #97b89c;
|
||||
--brand-gold-light: #c6dccb;
|
||||
--brand-primary-ink: #14281e;
|
||||
--brand-gold: #c9a227;
|
||||
--brand-gold-light: #ead9a2;
|
||||
--brand-gold-deep: #8d6b1f;
|
||||
--brand-light: #e6f1ea;
|
||||
|
||||
--header-bg: #1f3f2f;
|
||||
--header-bg-deep: #162e22;
|
||||
--header-glass: rgba(12, 28, 20, 0.72);
|
||||
--header-line: rgba(234, 217, 162, 0.5);
|
||||
--side-bg: #162e22;
|
||||
--page-bg: #f2f7f3;
|
||||
--hero-scrim: rgba(8, 22, 16, 0.62);
|
||||
|
||||
--text-main: #1c2e25;
|
||||
--card-gold-border: #e2d4ae;
|
||||
--table-header-bg: #f6f1e4;
|
||||
--row-hover: #eef5f0;
|
||||
--btn-primary-bg: linear-gradient(180deg, #3f6b52 0%, #1f3f2f 100%);
|
||||
--btn-primary-hover: linear-gradient(180deg, #345843 0%, #162e22 100%);
|
||||
|
||||
--el-color-primary: #4a7c5f;
|
||||
--el-color-primary-light-3: #6e9b84;
|
||||
@@ -73,5 +129,7 @@
|
||||
--el-color-primary-light-7: #bdd4c6;
|
||||
--el-color-primary-light-8: #d1e2d7;
|
||||
--el-color-primary-light-9: #eaf2ec;
|
||||
--el-color-primary-dark-2: #3b634c;
|
||||
--el-color-primary-dark-2: #1f3f2f;
|
||||
--el-bg-color-page: #f2f7f3;
|
||||
--el-text-color-primary: #1c2e25;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ const sources = [
|
||||
]
|
||||
|
||||
/* ---------- 3D 书架:一本书对应一条特藏,点击进入特藏详情 ---------- */
|
||||
const bookColors = ['#2c4d40', '#7a2e2e', '#2b3a67', '#b3862d', '#5a2e42']
|
||||
const bookColors = ['#2c4d40', '#7a2e2e', '#2b3a67', '#8a6420', '#5a2e42']
|
||||
|
||||
const specials = ref<SpecialRecommendItem[]>([])
|
||||
const bookMeta = ref<
|
||||
@@ -326,10 +326,10 @@ onBeforeUnmount(pause)
|
||||
/* ---------- 半透明检索面板 ---------- */
|
||||
.panel {
|
||||
display: flex;
|
||||
background: rgba(16, 38, 28, 0.58);
|
||||
background: var(--header-glass);
|
||||
backdrop-filter: blur(22px) saturate(140%);
|
||||
-webkit-backdrop-filter: blur(22px) saturate(140%);
|
||||
border: 1px solid rgba(255, 255, 255, 0.16);
|
||||
border: 1px solid rgba(232, 215, 168, 0.35);
|
||||
border-radius: var(--radius-sm);
|
||||
overflow: hidden;
|
||||
box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
|
||||
@@ -423,22 +423,22 @@ onBeforeUnmount(pause)
|
||||
|
||||
.btn.primary {
|
||||
color: #fff;
|
||||
background: linear-gradient(180deg, #6aa889, #4f8a6b);
|
||||
background: var(--btn-primary-bg);
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(180deg, #78b697, #57956f);
|
||||
background: var(--btn-primary-hover);
|
||||
}
|
||||
}
|
||||
|
||||
.btn.ghost {
|
||||
color: var(--brand-primary-deep);
|
||||
background: #fff;
|
||||
border: 1px solid #cfe0d5;
|
||||
border: 1px solid var(--brand-gold);
|
||||
letter-spacing: 1px;
|
||||
|
||||
&:hover {
|
||||
background: var(--brand-light);
|
||||
border-color: var(--brand-primary);
|
||||
background: var(--paper-warm);
|
||||
border-color: var(--brand-gold-deep);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@ onBeforeUnmount(pause)
|
||||
font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', '楷体', serif;
|
||||
font-size: 15px;
|
||||
letter-spacing: 5px;
|
||||
color: #b8862d;
|
||||
color: var(--brand-gold);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding: 10px 0;
|
||||
@@ -702,6 +702,17 @@ onBeforeUnmount(pause)
|
||||
}
|
||||
|
||||
/* ---------- 响应式 ---------- */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.book-inner,
|
||||
.book-shadow::before,
|
||||
.hero-text h1,
|
||||
.progress span,
|
||||
.bg-slide {
|
||||
animation: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1080px) {
|
||||
.shelf {
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -45,9 +45,14 @@ async function handleLogin() {
|
||||
|
||||
<template>
|
||||
<div class="login-page">
|
||||
<aside class="login-visual" aria-hidden="true">
|
||||
<p class="visual-kicker">纸电一体 · 版本馆藏</p>
|
||||
<h1>典藏中华版本<br />赓续中华文脉</h1>
|
||||
</aside>
|
||||
<div class="login-panel">
|
||||
<div class="login-box">
|
||||
<div class="login-title">
|
||||
<el-icon :size="30" color="#9ec7ae"><Collection /></el-icon>
|
||||
<el-icon class="login-mark" :size="28"><Collection /></el-icon>
|
||||
<h2>版本资源联合服务系统</h2>
|
||||
<p>数据集成库 · 检索发现 · 大数据分析</p>
|
||||
</div>
|
||||
@@ -75,28 +80,76 @@ async function handleLogin() {
|
||||
|
||||
<div class="login-tip">默认账号:admin / admin123</div>
|
||||
</div>
|
||||
<p class="copyright">版本馆 · 纸电版本资源联合服务</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.login-page {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
background: var(--page-bg);
|
||||
}
|
||||
|
||||
.login-visual {
|
||||
position: relative;
|
||||
flex: 1.15;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
padding: 64px 56px;
|
||||
color: var(--text-on-dark);
|
||||
background:
|
||||
linear-gradient(180deg, rgba(16, 38, 28, 0.2) 0%, rgba(16, 38, 28, 0.72) 100%),
|
||||
url('../assets/banner/b2.jpg') center 30% / cover no-repeat;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 28px;
|
||||
right: 28px;
|
||||
bottom: 28px;
|
||||
left: 28px;
|
||||
border: 1px solid rgba(232, 215, 168, 0.45);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
position: relative;
|
||||
margin: 12px 0 0;
|
||||
font-size: 40px;
|
||||
line-height: 1.35;
|
||||
letter-spacing: 4px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.visual-kicker {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
letter-spacing: 4px;
|
||||
color: var(--brand-gold-light);
|
||||
}
|
||||
|
||||
.login-panel {
|
||||
flex: 0.85;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background:
|
||||
radial-gradient(760px 420px at 50% -12%, rgba(190, 225, 200, 0.3), transparent 62%),
|
||||
radial-gradient(520px 320px at 88% 108%, rgba(169, 201, 173, 0.16), transparent 70%),
|
||||
linear-gradient(180deg, #3a6b52 0%, #1f3f2f 100%);
|
||||
padding: 40px 24px;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
width: 386px;
|
||||
width: 400px;
|
||||
max-width: 100%;
|
||||
padding: 40px 34px 26px;
|
||||
background: #fff;
|
||||
border: 1px solid rgba(180, 214, 190, 0.5);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 20px 56px rgba(0, 0, 0, 0.32);
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow-card);
|
||||
|
||||
.login-title {
|
||||
text-align: center;
|
||||
@@ -104,27 +157,53 @@ async function handleLogin() {
|
||||
|
||||
h2 {
|
||||
margin: 14px 0 8px;
|
||||
font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong',
|
||||
'SimSun', serif;
|
||||
font-size: 20px;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
color: #23362c;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
color: #a1937f;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #c3b5a1;
|
||||
color: var(--text-muted);
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-mark {
|
||||
color: var(--brand-gold);
|
||||
}
|
||||
|
||||
.copyright {
|
||||
margin: 18px 0 0;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.login-page {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.login-visual {
|
||||
min-height: 220px;
|
||||
flex: none;
|
||||
padding: 36px 28px;
|
||||
|
||||
h1 {
|
||||
font-size: 26px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,19 +5,59 @@ const router = useRouter()
|
||||
|
||||
<template>
|
||||
<div class="not-found">
|
||||
<el-result icon="warning" title="404" sub-title="页面不存在">
|
||||
<template #extra>
|
||||
<div class="seal" aria-hidden="true">未录</div>
|
||||
<p class="code">404</p>
|
||||
<h1>页面不在馆藏目录中</h1>
|
||||
<p class="sub">您访问的地址没有对应页面,可返回首页继续检索。</p>
|
||||
<el-button type="primary" @click="router.push('/')">返回首页</el-button>
|
||||
</template>
|
||||
</el-result>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
.not-found {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32px;
|
||||
background:
|
||||
radial-gradient(420px 180px at 50% 0%, rgba(184, 134, 45, 0.08), transparent 70%),
|
||||
var(--page-bg);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.seal {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 12px;
|
||||
border: 2px solid var(--brand-gold);
|
||||
color: var(--brand-gold-deep);
|
||||
font-family: var(--font-kai);
|
||||
letter-spacing: 2px;
|
||||
transform: rotate(-8deg);
|
||||
}
|
||||
|
||||
.code {
|
||||
margin: 0;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 72px;
|
||||
line-height: 1;
|
||||
letter-spacing: 6px;
|
||||
color: var(--brand-primary-deep);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 8px 0 8px;
|
||||
font-size: 22px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.sub {
|
||||
margin: 0 0 22px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -534,17 +534,16 @@ onMounted(() => {
|
||||
|
||||
.page-title {
|
||||
margin: 0 0 12px;
|
||||
font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
|
||||
font-size: 22px;
|
||||
letter-spacing: 2px;
|
||||
color: #1d3a2a;
|
||||
}
|
||||
|
||||
.admin-tabs {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 8px 20px 20px;
|
||||
box-shadow: 0 2px 10px rgba(20, 45, 30, 0.06);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
@@ -592,8 +591,11 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
font-family: var(--font-serif);
|
||||
font-weight: 600;
|
||||
color: #1d3a2a;
|
||||
color: var(--text-main);
|
||||
padding-left: 10px;
|
||||
border-left: 2px solid var(--brand-gold);
|
||||
}
|
||||
|
||||
.link {
|
||||
@@ -608,6 +610,6 @@ onMounted(() => {
|
||||
.form-tip {
|
||||
margin-left: 10px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -22,6 +22,11 @@ const contribRef = ref<HTMLElement>()
|
||||
const hotRef = ref<HTMLElement>()
|
||||
const charts: echarts.ECharts[] = []
|
||||
|
||||
function cssVar(name: string, fallback: string) {
|
||||
const value = getComputedStyle(document.documentElement).getPropertyValue(name).trim()
|
||||
return value || fallback
|
||||
}
|
||||
|
||||
function initChart(el?: HTMLElement) {
|
||||
if (!el) return null
|
||||
const c = echarts.init(el)
|
||||
@@ -34,11 +39,20 @@ async function loadAll() {
|
||||
hotKeywords.value = await getHotKeywords(20)
|
||||
recent.value = await getRecentActivity()
|
||||
|
||||
const ink = cssVar('--brand-primary-deep', '#2f5d47')
|
||||
const leaf = cssVar('--brand-primary', '#5b9a78')
|
||||
const mist = cssVar('--brand-primary-soft', '#6fa88a')
|
||||
const gold = cssVar('--brand-gold', '#b8862d')
|
||||
const goldDeep = cssVar('--brand-gold-deep', '#8a6420')
|
||||
const paper = cssVar('--text-main', '#23362c')
|
||||
const axis = { axisLabel: { color: paper, fontFamily: 'PingFang SC, Microsoft YaHei, sans-serif' } }
|
||||
const tip = { textStyle: { fontFamily: 'PingFang SC, Microsoft YaHei, sans-serif', color: paper } }
|
||||
|
||||
const ratio = await getResourceRatio()
|
||||
initChart(ratioRef.value)?.setOption({
|
||||
color: ['#5b9a78', '#9dc4ac', '#2f5d47', '#cfe3d3', '#7cb094', '#b4cdbd'],
|
||||
tooltip: { trigger: 'item' },
|
||||
legend: { bottom: 0 },
|
||||
color: [ink, gold, leaf, goldDeep, mist, cssVar('--brand-light', '#eaf4ed')],
|
||||
tooltip: { trigger: 'item', ...tip },
|
||||
legend: { bottom: 0, textStyle: { color: paper } },
|
||||
series: [
|
||||
{
|
||||
name: '资源比例',
|
||||
@@ -51,17 +65,25 @@ async function loadAll() {
|
||||
|
||||
const year = await getYearDistribution()
|
||||
initChart(yearRef.value)?.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
color: ['#5b9a78'],
|
||||
tooltip: { trigger: 'axis', ...tip },
|
||||
color: [goldDeep],
|
||||
grid: { left: 45, right: 20, top: 30, bottom: 30 },
|
||||
xAxis: { type: 'category', data: year.map((y) => y.year) },
|
||||
yAxis: { type: 'value' },
|
||||
xAxis: { type: 'category', data: year.map((y) => y.year), ...axis },
|
||||
yAxis: { type: 'value', ...axis },
|
||||
series: [
|
||||
{
|
||||
name: '资源量',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
areaStyle: { opacity: 0.15 },
|
||||
symbol: 'circle',
|
||||
lineStyle: { color: goldDeep, width: 2 },
|
||||
itemStyle: { color: gold },
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: gold },
|
||||
{ offset: 1, color: 'rgba(47, 93, 71, 0.02)' }
|
||||
])
|
||||
},
|
||||
data: year.map((y) => y.count)
|
||||
}
|
||||
]
|
||||
@@ -69,39 +91,50 @@ async function loadAll() {
|
||||
|
||||
const contrib = await getLibraryContribution()
|
||||
initChart(contribRef.value)?.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
tooltip: { trigger: 'axis', ...tip },
|
||||
grid: { left: 45, right: 20, top: 30, bottom: 60 },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: contrib.map((c) => c.name),
|
||||
axisLabel: { rotate: 25, fontSize: 10 }
|
||||
axisLabel: { rotate: 25, fontSize: 10, color: paper }
|
||||
},
|
||||
yAxis: { type: 'value' },
|
||||
yAxis: { type: 'value', ...axis },
|
||||
series: [
|
||||
{
|
||||
name: '资源量',
|
||||
type: 'bar',
|
||||
barMaxWidth: 36,
|
||||
itemStyle: { color: '#5b9a78' },
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: gold },
|
||||
{ offset: 1, color: ink }
|
||||
])
|
||||
},
|
||||
data: contrib.map((c) => c.value)
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
initChart(hotRef.value)?.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
tooltip: { trigger: 'axis', ...tip },
|
||||
grid: { left: 90, right: 20, top: 20, bottom: 30 },
|
||||
xAxis: { type: 'value' },
|
||||
xAxis: { type: 'value', ...axis },
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
inverse: true,
|
||||
data: hotKeywords.value.slice(0, 10).map((k) => k.name)
|
||||
data: hotKeywords.value.slice(0, 10).map((k) => k.name),
|
||||
axisLabel: { color: paper }
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '检索次数',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#9dc4ac' },
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
||||
{ offset: 0, color: ink },
|
||||
{ offset: 1, color: gold }
|
||||
])
|
||||
},
|
||||
data: hotKeywords.value.slice(0, 10).map((k) => k.value)
|
||||
}
|
||||
]
|
||||
@@ -186,16 +219,31 @@ onBeforeUnmount(() => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.mini {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: linear-gradient(180deg, var(--brand-gold-light), var(--brand-gold-deep));
|
||||
}
|
||||
|
||||
.v {
|
||||
font-size: 22px;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
color: var(--brand-primary-deep);
|
||||
}
|
||||
|
||||
.l {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
margin-top: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,52 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { createCollectTask, listCollectTasks, startCollectTask, type CollectTask } from '@/api/collect'
|
||||
import {
|
||||
createCollectTask,
|
||||
listCollectTasks,
|
||||
previewCollectSource,
|
||||
startCollectTask,
|
||||
type CollectTable,
|
||||
type CollectTask
|
||||
} from '@/api/collect'
|
||||
|
||||
const loading = ref(false)
|
||||
const startingId = ref<number | null>(null)
|
||||
const previewing = ref(false)
|
||||
const list = ref<CollectTask[]>([])
|
||||
const preview = ref<CollectTable | null>(null)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formRef = ref<FormInstance>()
|
||||
const form = reactive<CollectTask>({
|
||||
libraryCode: '',
|
||||
libraryName: '',
|
||||
sourceType: 'MARC',
|
||||
sourceType: 'DB',
|
||||
dbHost: '',
|
||||
dbPort: 5432,
|
||||
dbName: '',
|
||||
dbUsername: '',
|
||||
dbPassword: '',
|
||||
sourceTable: '',
|
||||
targetCount: 200000
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
libraryCode: [{ required: true, message: '请输入单位编码', trigger: 'blur' }],
|
||||
libraryName: [{ required: true, message: '请输入单位名称', trigger: 'blur' }]
|
||||
libraryName: [{ required: true, message: '请输入单位名称', trigger: 'blur' }],
|
||||
dbHost: [{ required: true, message: '请输入数据库地址', trigger: 'blur' }],
|
||||
dbPort: [{ required: true, message: '请输入端口', trigger: 'blur' }],
|
||||
dbName: [{ required: true, message: '请输入数据库名', trigger: 'blur' }],
|
||||
dbUsername: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||
dbPassword: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
||||
sourceTable: [{ required: true, message: '请输入表名', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const mappedColumns = computed(() => (preview.value?.columns || []).filter((item) => item.targetField))
|
||||
const unmappedColumns = computed(() =>
|
||||
(preview.value?.columns || []).filter((item) => !item.targetField).map((item) => item.columnName)
|
||||
)
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -30,22 +57,61 @@ async function fetchList() {
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
form.libraryCode = ''
|
||||
form.libraryName = ''
|
||||
form.sourceType = 'DB'
|
||||
form.dbHost = ''
|
||||
form.dbPort = 5432
|
||||
form.dbName = ''
|
||||
form.dbUsername = ''
|
||||
form.dbPassword = ''
|
||||
form.sourceTable = ''
|
||||
form.targetCount = 200000
|
||||
preview.value = null
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handlePreview() {
|
||||
await formRef.value?.validateField(['dbHost', 'dbPort', 'dbName', 'dbUsername', 'dbPassword', 'sourceTable'])
|
||||
previewing.value = true
|
||||
preview.value = null
|
||||
try {
|
||||
preview.value = await previewCollectSource(form)
|
||||
ElMessage.success(`连接成功,表中共 ${preview.value.rowCount} 条`)
|
||||
} finally {
|
||||
previewing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreate() {
|
||||
await formRef.value?.validate()
|
||||
form.sourceType = 'DB'
|
||||
await createCollectTask(form)
|
||||
ElMessage.success('采集任务已创建')
|
||||
ElMessage.success('采集任务已创建,可在列表中执行')
|
||||
dialogVisible.value = false
|
||||
formRef.value?.resetFields()
|
||||
fetchList()
|
||||
}
|
||||
|
||||
async function handleStart(row: CollectTask) {
|
||||
await startCollectTask(row.id as number)
|
||||
ElMessage.success('采集任务已执行')
|
||||
fetchList()
|
||||
startingId.value = row.id as number
|
||||
try {
|
||||
const task = await startCollectTask(row.id as number)
|
||||
if (task.status === 'FAILED') {
|
||||
ElMessage.error(task.message || '采集失败')
|
||||
} else {
|
||||
ElMessage.success(task.message || '采集完成')
|
||||
}
|
||||
await fetchList()
|
||||
} finally {
|
||||
startingId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function wrotePercent(row: CollectTask) {
|
||||
const target = Number(row.targetCount) || 0
|
||||
const got = Number(row.collectedCount) || 0
|
||||
if (target <= 0) return '0%'
|
||||
return `${Math.min(100, Math.round((got / target) * 100))}%`
|
||||
}
|
||||
|
||||
function statusTag(status?: string) {
|
||||
@@ -55,6 +121,11 @@ function statusTag(status?: string) {
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function sourceText(row: CollectTask) {
|
||||
if (!row.dbHost) return row.sourceTable || '-'
|
||||
return `${row.dbHost}:${row.dbPort || ''}/${row.dbName || ''} / ${row.sourceTable || ''}`
|
||||
}
|
||||
|
||||
onMounted(fetchList)
|
||||
</script>
|
||||
|
||||
@@ -66,7 +137,7 @@ onMounted(fetchList)
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
title="采集 4 家单位图书馆纸电版本资源元数据,各馆不低于 20 万条,优先采集纸书元数据"
|
||||
title="填写来源数据库的地址、用户名、密码和表名。测试连接后可看到每列写入版本资源表的哪个字段;执行后按这些字段入库。"
|
||||
type="info"
|
||||
:closable="false"
|
||||
class="mb-16"
|
||||
@@ -74,16 +145,25 @@ onMounted(fetchList)
|
||||
|
||||
<el-table v-loading="loading" :data="list" border stripe>
|
||||
<el-table-column prop="libraryCode" label="单位编码" width="110" />
|
||||
<el-table-column prop="libraryName" label="单位名称" min-width="160" />
|
||||
<el-table-column prop="sourceType" label="数据源" width="100" />
|
||||
<el-table-column prop="targetCount" label="目标量" width="100" />
|
||||
<el-table-column prop="collectedCount" label="已采集" width="100" />
|
||||
<el-table-column prop="libraryName" label="单位名称" min-width="140" />
|
||||
<el-table-column label="来源库 / 表" min-width="240" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ sourceText(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbUsername" label="用户名" width="110" />
|
||||
<el-table-column label="本次写入" width="120">
|
||||
<template #default="{ row }">
|
||||
<div class="wrote">
|
||||
<span>{{ row.collectedCount ?? 0 }}</span>
|
||||
<i class="wrote-bar"><b :style="{ width: wrotePercent(row) }" /></i>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTag(row.status)" size="small">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="message" label="信息" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="message" label="结果" min-width="240" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" width="170" />
|
||||
<el-table-column label="操作" width="110" fixed="right">
|
||||
<template #default="{ row }">
|
||||
@@ -91,7 +171,8 @@ onMounted(fetchList)
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="row.status === 'RUNNING'"
|
||||
:loading="startingId === row.id"
|
||||
:disabled="row.status === 'RUNNING' || !row.dbHost"
|
||||
@click="handleStart(row)"
|
||||
>
|
||||
执行
|
||||
@@ -100,24 +181,59 @@ onMounted(fetchList)
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog v-model="dialogVisible" title="新建采集任务" width="480px">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-dialog v-model="dialogVisible" title="新建采集任务" width="720px">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="16">
|
||||
<el-form-item label="数据库地址" prop="dbHost">
|
||||
<el-input v-model="form.dbHost" placeholder="如 10.1.1.14 或 db.example.com" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="端口" prop="dbPort" label-width="60px">
|
||||
<el-input-number v-model="form.dbPort" :min="1" :max="65535" controls-position="right" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="数据库名" prop="dbName">
|
||||
<el-input v-model="form.dbName" placeholder="如 banben" />
|
||||
</el-form-item>
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名" prop="dbUsername">
|
||||
<el-input v-model="form.dbUsername" placeholder="数据库账号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="密码" prop="dbPassword" label-width="60px">
|
||||
<el-input v-model="form.dbPassword" type="password" show-password placeholder="数据库密码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="表名" prop="sourceTable">
|
||||
<el-input v-model="form.sourceTable" placeholder="如 src_library_catalog,或 public.src_library_catalog" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :loading="previewing" @click="handlePreview">测试连接并查看字段</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="preview" label="字段对应">
|
||||
<div class="map-box">
|
||||
<p class="unmap">{{ preview.tableName }} 共 {{ preview.rowCount }} 条。同名或常见别名会写入版本资源表。</p>
|
||||
<el-tag v-for="col in mappedColumns" :key="col.columnName" size="small" class="map-tag">
|
||||
{{ col.columnName }} → {{ col.targetLabel }}
|
||||
</el-tag>
|
||||
<p v-if="unmappedColumns.length" class="unmap">不写入:{{ unmappedColumns.join('、') }}</p>
|
||||
<p v-if="!mappedColumns.length" class="unmap">这张表没有能对应到版本资源字段的列。</p>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位编码" prop="libraryCode">
|
||||
<el-input v-model="form.libraryCode" placeholder="如 NC-01" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" prop="libraryName">
|
||||
<el-input v-model="form.libraryName" placeholder="如 江西南昌某馆" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源类型">
|
||||
<el-select v-model="form.sourceType" style="width: 100%">
|
||||
<el-option label="MARC" value="MARC" />
|
||||
<el-option label="Excel" value="EXCEL" />
|
||||
<el-option label="数据库" value="DB" />
|
||||
<el-option label="接口" value="API" />
|
||||
</el-select>
|
||||
<el-input v-model="form.libraryName" placeholder="如 陆军步兵学院图书馆" />
|
||||
</el-form-item>
|
||||
<el-form-item label="目标采集量">
|
||||
<el-input-number v-model="form.targetCount" :min="0" :step="10000" style="width: 100%" />
|
||||
<el-input-number v-model="form.targetCount" :min="1" :step="1000" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -134,4 +250,40 @@ onMounted(fetchList)
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.map-box {
|
||||
width: 100%;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.map-tag {
|
||||
margin: 0 8px 8px 0;
|
||||
}
|
||||
|
||||
.unmap {
|
||||
margin: 0 0 8px;
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wrote {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.wrote-bar {
|
||||
display: block;
|
||||
height: 3px;
|
||||
background: var(--brand-light);
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wrote-bar b {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, var(--brand-primary-deep), var(--brand-gold));
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -104,8 +104,9 @@ onMounted(() => {
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
style="max-width: 660px"
|
||||
style="max-width: 720px"
|
||||
>
|
||||
<p class="section-kicker">呈缴单位</p>
|
||||
<el-form-item label="单位名称" prop="orgName">
|
||||
<el-input v-model="form.orgName" placeholder="请输入呈缴单位名称" />
|
||||
</el-form-item>
|
||||
@@ -118,6 +119,7 @@ onMounted(() => {
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
||||
</el-form-item>
|
||||
<p class="section-kicker">资源信息</p>
|
||||
<el-form-item label="资源名称" prop="resourceTitle">
|
||||
<el-input v-model="form.resourceTitle" placeholder="请输入版本资源名称" />
|
||||
</el-form-item>
|
||||
|
||||
@@ -1,26 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
listDataset,
|
||||
listGovernanceJobs,
|
||||
previewHints,
|
||||
runHint,
|
||||
runMerge,
|
||||
runOptimize,
|
||||
runPurify,
|
||||
type DatasetItem,
|
||||
type DefectItem,
|
||||
type DuplicateItem,
|
||||
type GovernanceHint,
|
||||
type GovernanceJob
|
||||
} from '@/api/governance'
|
||||
import { governStatusLabel, governStatusTagType } from '@/constants/dict'
|
||||
|
||||
const loading = ref(false)
|
||||
const running = ref('')
|
||||
const jobs = ref<GovernanceJob[]>([])
|
||||
const hintReport = ref<GovernanceHint>({
|
||||
duplicateGroupCount: 0,
|
||||
defectCount: 0,
|
||||
duplicateGroups: [],
|
||||
defects: []
|
||||
})
|
||||
const dataset = ref<DatasetItem[]>([])
|
||||
|
||||
const actions = [
|
||||
{ type: 'MERGE', title: '聚同', desc: '将不同来源、不同媒体类型的同一文献元数据聚合为一条,并标注来源。', fn: runMerge },
|
||||
{ type: 'OPTIMIZE', title: '优化', desc: '整合聚同文献的不同描述元数据,生成质量更高、要素更完整的元数据。', fn: runOptimize },
|
||||
{ type: 'HINT', title: '提示', desc: '生成疑似同一文献提示清单、疑似元数据错漏提示清单。', fn: runHint },
|
||||
{ type: 'PURIFY', title: '提纯', desc: '将相关纸电图书数据从全部图书数据中提取出来,形成版本资源数据集。', fn: runPurify }
|
||||
{ type: 'MERGE', title: '聚同', desc: '将不同来源、不同媒体类型的同一文献元数据聚合为一条,并标注来源。' },
|
||||
{ type: 'OPTIMIZE', title: '优化', desc: '整合聚同文献的不同描述元数据,生成质量更高、要素更完整的元数据。' },
|
||||
{ type: 'HINT', title: '提示', desc: '生成疑似同一文献提示清单、疑似元数据错漏提示清单。' },
|
||||
{ type: 'PURIFY', title: '提纯', desc: '将相关纸电图书数据从全部图书数据中提取出来,形成版本资源数据集。' }
|
||||
]
|
||||
|
||||
const duplicateRows = computed(() => {
|
||||
const rows: Array<DuplicateItem & { reason: string }> = []
|
||||
for (const group of hintReport.value.duplicateGroups || []) {
|
||||
for (const record of group.records || []) {
|
||||
rows.push({ ...record, reason: group.reason })
|
||||
}
|
||||
}
|
||||
return rows
|
||||
})
|
||||
|
||||
async function fetchJobs() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -30,11 +54,33 @@ async function fetchJobs() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadHints() {
|
||||
hintReport.value = await previewHints()
|
||||
}
|
||||
|
||||
async function loadDataset() {
|
||||
dataset.value = await listDataset()
|
||||
}
|
||||
|
||||
async function handleRun(action: (typeof actions)[number]) {
|
||||
running.value = action.type
|
||||
try {
|
||||
const job = await action.fn()
|
||||
if (action.type === 'HINT') {
|
||||
hintReport.value = await runHint()
|
||||
ElMessage.success(hintReport.value.job?.resultSummary || '提示完成')
|
||||
} else if (action.type === 'MERGE') {
|
||||
const job = await runMerge()
|
||||
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
|
||||
await loadHints()
|
||||
} else if (action.type === 'OPTIMIZE') {
|
||||
const job = await runOptimize()
|
||||
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
|
||||
await loadHints()
|
||||
} else {
|
||||
const job = await runPurify()
|
||||
ElMessage.success(`${action.title}完成:${job.resultSummary || ''}`)
|
||||
await loadDataset()
|
||||
}
|
||||
fetchJobs()
|
||||
} finally {
|
||||
running.value = ''
|
||||
@@ -48,14 +94,30 @@ function statusTag(status?: string) {
|
||||
return 'info'
|
||||
}
|
||||
|
||||
onMounted(fetchJobs)
|
||||
function issueText(row: DefectItem) {
|
||||
return (row.issues || []).join(';')
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchJobs()
|
||||
try {
|
||||
await loadHints()
|
||||
} catch {
|
||||
// 错误已由响应拦截器提示
|
||||
}
|
||||
try {
|
||||
await loadDataset()
|
||||
} catch {
|
||||
// 错误已由响应拦截器提示
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-card">
|
||||
<h3 class="page-title">数据治理</h3>
|
||||
<el-alert
|
||||
title="治理四动作:聚同 / 优化 / 提示 / 提纯"
|
||||
title="建议顺序:先看提示清单,再对完全一致的重复文献执行聚同、优化,最后提纯。疑似同一文献只出清单,不自动合并。"
|
||||
type="info"
|
||||
:closable="false"
|
||||
class="mb-16"
|
||||
@@ -63,7 +125,7 @@ onMounted(fetchJobs)
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col v-for="a in actions" :key="a.type" :xs="24" :sm="12">
|
||||
<el-card shadow="hover" class="gov-card">
|
||||
<el-card shadow="hover" class="gov-card" :class="'tone-' + a.type">
|
||||
<h4>{{ a.title }}</h4>
|
||||
<p>{{ a.desc }}</p>
|
||||
<el-button type="primary" :loading="running === a.type" @click="handleRun(a)">
|
||||
@@ -73,6 +135,58 @@ onMounted(fetchJobs)
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<h3 class="page-title" style="margin-top: 8px">
|
||||
疑似同一文献提示清单({{ hintReport.duplicateGroupCount }} 组)
|
||||
</h3>
|
||||
<el-table :data="duplicateRows" border stripe empty-text="暂无疑似同一文献">
|
||||
<el-table-column prop="reason" label="提示原因" min-width="280" show-overflow-tooltip />
|
||||
<el-table-column prop="processNo" label="加工编号" width="140" />
|
||||
<el-table-column prop="title" label="正题名" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="author" label="责任者" width="100" />
|
||||
<el-table-column prop="isbn" label="ISBN" width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="mediaType" label="媒体" width="80" />
|
||||
<el-table-column prop="sourceLibrary" label="来源馆" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="治理状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="governStatusTagType(row.governStatus)" size="small">
|
||||
{{ governStatusLabel(row.governStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<h3 class="page-title" style="margin-top: 20px">
|
||||
疑似元数据错漏提示清单({{ hintReport.defectCount }} 条)
|
||||
</h3>
|
||||
<el-table :data="hintReport.defects" border stripe empty-text="暂无疑似错漏">
|
||||
<el-table-column prop="processNo" label="加工编号" width="140" />
|
||||
<el-table-column prop="title" label="正题名" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="author" label="责任者" width="100" />
|
||||
<el-table-column prop="sourceLibrary" label="来源馆" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="mediaType" label="媒体" width="80" />
|
||||
<el-table-column label="错漏说明" min-width="280" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ issueText(row) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<h3 class="page-title" style="margin-top: 20px">版本资源数据集({{ dataset.length }} 条)</h3>
|
||||
<el-table :data="dataset" border stripe empty-text="尚未提纯">
|
||||
<el-table-column prop="processNo" label="加工编号" width="140" />
|
||||
<el-table-column prop="title" label="正题名" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="author" label="责任者" width="100" />
|
||||
<el-table-column prop="mediaType" label="媒体" width="80" />
|
||||
<el-table-column prop="contentForm" label="内容形式" width="100" />
|
||||
<el-table-column prop="sourceLibrary" label="来源馆" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="publishYear" label="出版年份" width="100" />
|
||||
<el-table-column label="治理状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="governStatusTagType(row.governStatus)" size="small">
|
||||
{{ governStatusLabel(row.governStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<h3 class="page-title" style="margin-top: 20px">治理任务历史</h3>
|
||||
<el-table v-loading="loading" :data="jobs" border stripe>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
@@ -92,16 +206,24 @@ onMounted(fetchJobs)
|
||||
<style scoped lang="scss">
|
||||
.gov-card {
|
||||
margin-bottom: 16px;
|
||||
border-top: 3px solid var(--brand-primary);
|
||||
|
||||
h4 {
|
||||
margin: 0 0 8px;
|
||||
font-family: var(--font-serif);
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
color: var(--text-muted);
|
||||
min-height: 38px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.tone-MERGE { border-top-color: var(--brand-primary-deep); }
|
||||
.tone-OPTIMIZE { border-top-color: var(--brand-gold); }
|
||||
.tone-HINT { border-top-color: var(--brand-primary); }
|
||||
.tone-PURIFY { border-top-color: var(--brand-gold-deep); }
|
||||
</style>
|
||||
|
||||
@@ -329,8 +329,9 @@ onMounted(fetchData)
|
||||
|
||||
.special-tag {
|
||||
margin-right: 6px;
|
||||
background: #8a6d3b;
|
||||
border-color: #8a6d3b;
|
||||
background: var(--brand-gold-deep);
|
||||
border-color: var(--brand-gold-deep);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
|
||||
@@ -19,7 +19,8 @@ function search() {
|
||||
|
||||
<template>
|
||||
<div class="adv">
|
||||
<h2>高级检索</h2>
|
||||
<h2 class="page-title">高级检索</h2>
|
||||
<p class="section-kicker">检索条件</p>
|
||||
<div v-for="(r, i) in rows" :key="i" class="row">
|
||||
<el-select v-model="r.field" style="width: 140px">
|
||||
<el-option v-for="f in fields" :key="f" :label="f" :value="f" />
|
||||
@@ -41,12 +42,11 @@ function search() {
|
||||
.adv {
|
||||
max-width: 820px;
|
||||
margin: 20px auto;
|
||||
background: #fff;
|
||||
border: 1px solid var(--card-border);
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 24px;
|
||||
|
||||
h2 { margin: 0 0 20px; font-size: 19px; letter-spacing: 1px; }
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.row {
|
||||
|
||||
@@ -57,7 +57,6 @@ const totalCount = computed(() =>
|
||||
const cloudRef = ref<HTMLDivElement | null>(null)
|
||||
const stageRef = ref<HTMLDivElement | null>(null)
|
||||
|
||||
const colors = ['#5c7c9e', '#c96b6b', '#4a7a8c', '#b39b8b', '#8c9aaf', '#d19b9b']
|
||||
const FONT_FAMILY = '"Microsoft YaHei", "PingFang SC", sans-serif'
|
||||
const MAX_WEIGHT = 120
|
||||
|
||||
@@ -77,7 +76,7 @@ function render() {
|
||||
weightFactor: (size: number) => 17 + 44 * (size / MAX_WEIGHT),
|
||||
fontFamily: FONT_FAMILY,
|
||||
fontWeight: 'bold',
|
||||
color: (word: string) => colors[Math.abs(hash(word)) % colors.length],
|
||||
color: (word: string) => cloudColor(word),
|
||||
// 给每个词加上类名,便于用 CSS 实现悬停放大
|
||||
classes: 'cloud-word',
|
||||
rotateRatio: 0,
|
||||
@@ -86,6 +85,15 @@ function render() {
|
||||
})
|
||||
}
|
||||
|
||||
/** 词云配色取自主题变量,保证两套主题一致且在白底上可读 */
|
||||
function cloudColor(word: string) {
|
||||
const names = ['--brand-primary-deep', '--brand-primary', '--brand-gold-deep', '--brand-primary-ink']
|
||||
const value = getComputedStyle(document.documentElement)
|
||||
.getPropertyValue(names[Math.abs(hash(word)) % names.length])
|
||||
.trim()
|
||||
return value || '#2f5d47'
|
||||
}
|
||||
|
||||
/** 字符串散列,让每个词的配色固定 */
|
||||
function hash(str: string) {
|
||||
let h = 0
|
||||
@@ -201,16 +209,17 @@ function go(keyword: string) {
|
||||
em {
|
||||
font-style: normal;
|
||||
margin-left: 10px;
|
||||
color: #b3a48f;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 词云 ---------- */
|
||||
.field {
|
||||
padding: 24px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--card-border);
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.stage {
|
||||
|
||||
@@ -254,10 +254,15 @@ onMounted(() => {
|
||||
.bar {
|
||||
max-width: 860px;
|
||||
margin: 8px auto 20px;
|
||||
padding: 10px;
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: var(--shadow-card);
|
||||
|
||||
:deep(.el-input-group__append) {
|
||||
background: var(--brand-primary);
|
||||
border-color: var(--brand-primary);
|
||||
background: var(--brand-primary-deep);
|
||||
border-color: var(--brand-primary-deep);
|
||||
color: #fff;
|
||||
padding: 0;
|
||||
|
||||
@@ -279,37 +284,45 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.side {
|
||||
width: 210px;
|
||||
width: 220px;
|
||||
flex: none;
|
||||
background: #fff;
|
||||
border: 1px solid var(--card-border);
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 12px;
|
||||
height: fit-content;
|
||||
box-shadow: var(--shadow-card);
|
||||
|
||||
.side-title {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin: 10px 0 6px;
|
||||
padding-left: 8px;
|
||||
border-left: 2px solid var(--brand-gold);
|
||||
}
|
||||
|
||||
.side-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 13px;
|
||||
color: #5b6472;
|
||||
padding: 4px 6px;
|
||||
border-radius: 4px;
|
||||
color: var(--text-sub);
|
||||
padding: 6px 8px;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover { background: var(--brand-light); }
|
||||
&.on { background: var(--brand-light); color: var(--brand-primary); }
|
||||
em { color: #9aa3b2; font-style: normal; }
|
||||
&.on {
|
||||
background: var(--paper-warm);
|
||||
color: var(--brand-gold-deep);
|
||||
box-shadow: inset 2px 0 0 var(--brand-gold);
|
||||
}
|
||||
em { color: var(--text-muted); font-style: normal; }
|
||||
}
|
||||
}
|
||||
|
||||
.list { flex: 1; }
|
||||
.meta { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
|
||||
.list { flex: 1; min-width: 0; }
|
||||
.meta { font-size: 13px; color: var(--text-sub); margin-bottom: 10px; }
|
||||
|
||||
.cards {
|
||||
display: flex;
|
||||
@@ -319,41 +332,56 @@ onMounted(() => {
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--card-border);
|
||||
gap: 14px;
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 14px;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s;
|
||||
transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
|
||||
|
||||
&:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
|
||||
&:hover {
|
||||
border-color: var(--brand-gold);
|
||||
box-shadow: var(--shadow-lift);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 56px;
|
||||
height: 76px;
|
||||
height: 78px;
|
||||
flex: none;
|
||||
border-radius: 4px;
|
||||
background: var(--brand-primary);
|
||||
color: #fff;
|
||||
border-radius: 2px 4px 4px 2px;
|
||||
background:
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 18%),
|
||||
var(--brand-primary-deep);
|
||||
color: var(--brand-gold-light);
|
||||
border: 1px solid var(--brand-gold);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
font-family: var(--font-kai);
|
||||
font-size: 16px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.info {
|
||||
min-width: 0;
|
||||
|
||||
.t { font-size: 14px; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
|
||||
.d { font-size: 12px; color: #8b93a1; }
|
||||
.t {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--text-main);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.d { font-size: 12px; color: var(--text-muted); }
|
||||
}
|
||||
|
||||
/* 命中关键词高亮(v-html 动态插入的节点不带 scoped 属性,需用 :deep 穿透) */
|
||||
:deep(.hl) {
|
||||
background: #ffe6a3;
|
||||
color: #8a4b00;
|
||||
background: var(--hl-bg);
|
||||
color: var(--hl-text);
|
||||
border-radius: 2px;
|
||||
padding: 0 1px;
|
||||
}
|
||||
@@ -361,13 +389,14 @@ onMounted(() => {
|
||||
.snippet {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #7b8493;
|
||||
color: var(--text-sub);
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.snippet-label {
|
||||
color: #4b5563;
|
||||
font-family: var(--font-serif);
|
||||
color: var(--brand-primary-deep);
|
||||
}
|
||||
|
||||
.pager {
|
||||
@@ -378,6 +407,18 @@ onMounted(() => {
|
||||
/* 页码较多时自动换行,保证页码按钮与跳转框都能点到 */
|
||||
:deep(.el-pagination__jump) { margin-left: 12px; }
|
||||
}
|
||||
.dt { margin: 0 0 12px; font-size: 17px; }
|
||||
.sim-item { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eee; cursor: pointer; }
|
||||
.dt { margin: 0 0 12px; font-size: 18px; letter-spacing: 1px; }
|
||||
.sim-item {
|
||||
font-size: 13px;
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid var(--hair-line);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover { color: var(--brand-gold-deep); }
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.body { flex-direction: column; }
|
||||
.side { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -188,7 +188,7 @@ onMounted(async () => {
|
||||
.sub-desc {
|
||||
margin: -6px 0 18px;
|
||||
font-size: 13px;
|
||||
color: #a09480;
|
||||
color: var(--text-muted);
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
@@ -214,19 +214,20 @@ onMounted(async () => {
|
||||
align-items: center;
|
||||
gap: 22px;
|
||||
padding: 14px 20px;
|
||||
background: #faf7ee;
|
||||
border: 1px solid #f0e9d8;
|
||||
border-radius: 6px;
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
|
||||
|
||||
&:hover {
|
||||
background: #f5efdf;
|
||||
box-shadow: 0 6px 18px rgba(90, 70, 20, 0.12);
|
||||
background: var(--paper-warm);
|
||||
border-color: var(--brand-gold);
|
||||
box-shadow: var(--shadow-lift);
|
||||
transform: translateY(-2px);
|
||||
|
||||
.goto {
|
||||
color: #8a6d3b;
|
||||
color: var(--brand-gold-deep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,7 +238,7 @@ onMounted(async () => {
|
||||
width: 150px;
|
||||
height: 100px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(135deg, #2c4d40 0%, #1f3a30 100%);
|
||||
background: linear-gradient(135deg, var(--brand-primary-deep) 0%, var(--brand-primary-ink) 100%);
|
||||
box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.25);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -253,7 +254,7 @@ onMounted(async () => {
|
||||
.cover-frame {
|
||||
width: 56px;
|
||||
height: 84px;
|
||||
border: 1px solid rgba(184, 134, 45, 0.85);
|
||||
border: 1px solid var(--brand-gold);
|
||||
border-radius: 2px;
|
||||
box-shadow: inset 0 0 0 2px rgba(184, 134, 45, 0.25);
|
||||
display: flex;
|
||||
@@ -263,10 +264,10 @@ onMounted(async () => {
|
||||
|
||||
.cover-title {
|
||||
writing-mode: vertical-rl;
|
||||
font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', '楷体', serif;
|
||||
font-family: var(--font-kai);
|
||||
font-size: 15px;
|
||||
letter-spacing: 4px;
|
||||
color: #d8b25e;
|
||||
color: var(--brand-gold-light);
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
}
|
||||
@@ -277,9 +278,10 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.name {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #8a6d3b;
|
||||
color: var(--text-main);
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -291,11 +293,11 @@ onMounted(async () => {
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid #e7dfc8;
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--card-gold-border);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 14px;
|
||||
line-height: 1.7;
|
||||
color: #666;
|
||||
color: var(--text-sub);
|
||||
|
||||
.desc-text {
|
||||
min-width: 0;
|
||||
@@ -312,21 +314,22 @@ onMounted(async () => {
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
font-size: 14px;
|
||||
color: #a9832f;
|
||||
color: var(--brand-gold-deep);
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
color: #8a6d3b;
|
||||
color: var(--brand-gold-deep);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* 删除:红色示警 */
|
||||
&.del {
|
||||
color: #c0392b;
|
||||
color: var(--el-color-danger);
|
||||
|
||||
&:hover {
|
||||
color: #96281b;
|
||||
color: var(--el-color-danger);
|
||||
opacity: 0.82;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>untitled</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Archetype - untitled</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
</project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<archetype>
|
||||
<id>untitled</id>
|
||||
<sources>
|
||||
<source>src/main/java/App.java</source>
|
||||
</sources>
|
||||
<testSources>
|
||||
<source>src/test/java/AppTest.java</source>
|
||||
</testSources>
|
||||
</archetype>
|
||||
@@ -0,0 +1,15 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>$org.example</groupId>
|
||||
<artifactId>$untitled</artifactId>
|
||||
<version>$1.0-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
package $org.example;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package $org.example;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user