执行前需先用root权限登录服务器,或每步前加sudo。
```bash 1. 安装JDK 1.8.0_341 yum install -y java-1.8.0-openjdk-devel 验证安装:输出openjdk version "1.8.0_xxx"即成功 java -version 2. 安装MySQL 8.0.32 wget https://repo.mysql.com/mysql80-community-release-el7-7.noarch.rpm rpm -ivh mysql80-community-release-el7-7.noarch.rpm yum install -y mysql-community-server 启动MySQL并设置开机自启 systemctl start mysqld systemctl enable mysqld 获取初始root密码 grep 'temporary password' /var/log/mysqld.log 登录MySQL修改密码(替换temp_pwd为获取的初始密码,new_root_pwd为自定义8位以上含大小写字母+数字+符号的密码) mysql -uroot -p'temp_pwd' ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_root_pwd'; FLUSH PRIVILEGES; EXIT; 3. 安装Redis 6.2.7 yum install -y epel-release yum install -y redis6 启动Redis并设置开机自启 systemctl start redis6 systemctl enable redis6 验证Redis连接 redis6-cli ping 输出PONG即成功 ```下载模板后,找到“金华市档案馆元数据标准字段”sheet,自建档案的字段需与该sheet中必填字段(标注)完全对齐:
两种格式二选一,推荐用DA/T 48-2009 OFD+XML格式包(DA/T 48是档案行业标准,不可篡改):
使用Postman或curl调用获取令牌接口,有效期2小时,过期需重新获取:
```bash curl命令示例(替换下方app_id、app_secret、测试库地址) curl -X POST "https://test-jhda.jinhua.gov.cn/api/v1/auth/token" \ -H "Content-Type: application/json" \ -d '{ "app_id": "your_app_id", "app_secret": "your_app_secret" }' 返回结果示例(提取access_token字段备用) { "code": 200, "msg": "success", "data": { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expires_in": 7200 } } ```
继续用curl或Postman调用上传接口,测试库地址必须用提供的:
```bash curl命令示例(替换access_token、测试库地址、ZIP包本地路径) curl -X POST "https://test-jhda.jinhua.gov.cn/api/v1/archive/upload" \ -H "Authorization: Bearer your_access_token" \ -F "file=@/home/archive/test_archive.zip" 返回结果示例(返回archive_id说明上传成功,保存该ID用于后续查询) { "code": 200, "msg": "success", "data": { "archive_id": "JHD00123-2024-Y-W01-0001_20240520123456" } } ```上传后5分钟内调用查询接口:
```bash curl命令示例(替换archive_id、access_token、测试库地址) curl -X GET "https://test-jhda.jinhua.gov.cn/api/v1/archive/query?archive_id=your_archive_id" \ -H "Authorization: Bearer your_access_token" 验证通过返回:"status": "verified";验证失败返回:"status": "failed" + "error_msg"(按提示修改元数据或文件格式) ```测试通过3个批次(每批次至少100件)后,联系金华市档案馆信息技术科申请切换正式库,获取正式app_id、正式app_secret、正式库地址,替换步骤三的对应参数。
使用同步接口可以确认本地已上传的数据与正式库一致:
```bash curl命令示例(替换全宗号、起始年度、结束年度、access_token、正式库地址) curl -X GET "https://jhda.jinhua.gov.cn/api/v1/archive/sync?fonds_code=JHD00123&start_year=2024&end_year=2024" \ -H "Authorization: Bearer your_access_token" ```