init: 信创文件安全传输系统内外网本地 Docker 部署
包含 s-file 后端、React 前端、MeshSafe 安全检测对接,以及内外网两套 compose/nginx/配置(仅前端 28180/28280 对外发布,其余端口不暴露)。 说明:deploy/config/application-iw.yml 与 application-ow.yml 按维护者 明确要求原样入库,其中含本机 Docker 用的库口令、RabbitMQ 口令与 JWT 密钥;上生产前需替换。
This commit is contained in:
201
frontend/src/apis/file.ts
Normal file
201
frontend/src/apis/file.ts
Normal file
@@ -0,0 +1,201 @@
|
||||
import { http, HTTP_CONTENT_TYPE } from "@/lib/http";
|
||||
|
||||
const baseUrl = import.meta.env.VITE_API_URL;
|
||||
|
||||
export const RootType = {
|
||||
// 1普通/2内穿外/3外传内/4我的分享
|
||||
MY: "1",
|
||||
INSIDE: "2",
|
||||
OUTSIDE: "3",
|
||||
SHARE: "4",
|
||||
} as const;
|
||||
|
||||
export type RootType = (typeof RootType)[keyof typeof RootType];
|
||||
|
||||
export const FileStatus = {
|
||||
// 1正常2失效11解析中12待审核13传输中14失败
|
||||
VALID: "1",
|
||||
INVALID: "2",
|
||||
PARSING: "11",
|
||||
AUDITING: "12",
|
||||
TRANSFERING: "13",
|
||||
FAILED: "14",
|
||||
} as const;
|
||||
|
||||
export type FileStatus = (typeof FileStatus)[keyof typeof FileStatus];
|
||||
|
||||
export const FileType = {
|
||||
// 1文件/2目录
|
||||
FILE: "1",
|
||||
DIRECTORY: "2",
|
||||
} as const;
|
||||
|
||||
export type FileType = (typeof FileType)[keyof typeof FileType];
|
||||
|
||||
// 获取文件下载地址
|
||||
export const getFileUrl = (code?: string, appendBaseUrl = true) => {
|
||||
if (!code) {
|
||||
return;
|
||||
}
|
||||
const url = `/file/download/${code}?time=` + Date.now();
|
||||
if (appendBaseUrl && baseUrl != "/") {
|
||||
return baseUrl + url;
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
// 下载
|
||||
export const downloadFile = ({ url, code, ...rest }: any) => {
|
||||
const newUrl = url ?? getFileUrl(code, false);
|
||||
if (!newUrl) {
|
||||
return;
|
||||
}
|
||||
return http.get(newUrl, { responseType: "blob", ...rest });
|
||||
};
|
||||
|
||||
// 上传
|
||||
export const uploadFile = (file: File) => {
|
||||
const data = new FormData();
|
||||
data.append("file", file);
|
||||
const headers = { "content-type": HTTP_CONTENT_TYPE.MULTIPART_FORM_DATA };
|
||||
return http.post("/file/upload", data, { headers });
|
||||
};
|
||||
|
||||
// 创建分享
|
||||
export const createShare = (data: any) => {
|
||||
return http.post("/share_user_file/create", data);
|
||||
};
|
||||
|
||||
// 查询
|
||||
export const getFile = (params: any) => {
|
||||
return http.get("/user_file/find", { params });
|
||||
};
|
||||
|
||||
// 失效
|
||||
export const invalidFile = (id: number) => {
|
||||
return http.put(`/user_file/invalid/${id}`);
|
||||
};
|
||||
|
||||
// 列表查询
|
||||
export const getFileList = (params: any) => {
|
||||
return http.get("/user_file/list", { params });
|
||||
};
|
||||
|
||||
// 修改
|
||||
export const modifyFile = (data: any) => {
|
||||
return http.post("/user_file/modify", data);
|
||||
};
|
||||
|
||||
// 分页查询
|
||||
export const getFilePage = (params: any) => {
|
||||
return http.get("/user_file/page", { params });
|
||||
};
|
||||
|
||||
// 彻底删除文件
|
||||
export const removeFile = (id: number) => {
|
||||
return http.delete(`/user_file/remove/${id}`);
|
||||
};
|
||||
|
||||
// 彻底删除文件
|
||||
export const removeFileByIds = (ids: number[]) => {
|
||||
return http.delete(`/user_file/remove_by_ids`, { data: ids });
|
||||
};
|
||||
|
||||
// 创建
|
||||
export const createFile = (data: any) => {
|
||||
return http.post("/normal_user_file/create", data);
|
||||
};
|
||||
|
||||
// 恢复
|
||||
export const recoverFile = (id: number) => {
|
||||
return http.put(`/normal_user_file/recover/${id}`);
|
||||
};
|
||||
|
||||
// 转移
|
||||
export const transferFile = (data: any) => {
|
||||
return http.post(`/transfer_user_file/create`, data);
|
||||
};
|
||||
|
||||
// 获取统计
|
||||
export const getStatistics = () => {
|
||||
return http.get(`/user_file/statistics/category`);
|
||||
};
|
||||
|
||||
// 获取风险等级列表
|
||||
export const getRiskLevel = (params?: any) => {
|
||||
return http.get("/file_risk/min_audit_risk_level", { params });
|
||||
};
|
||||
|
||||
// 保存风险等级数据
|
||||
export const saveRiskLevel = (data: any) => {
|
||||
return http.post("/file_risk/min_audit_risk_level", data);
|
||||
};
|
||||
|
||||
// 获取风险规则列表
|
||||
export const getRiskRule = (params?: any) => {
|
||||
return http.get("/file_risk/rule", { params });
|
||||
};
|
||||
|
||||
// 保存风险规则数据
|
||||
export const saveRiskRule = (data?: any) => {
|
||||
return http.post("/file_risk/rule", data);
|
||||
};
|
||||
|
||||
// 分页查询
|
||||
export const getFileRiskPage = (params?: any) => {
|
||||
return http.get("/file_risk/page", { params });
|
||||
};
|
||||
|
||||
// 分页查询
|
||||
export const getFilePageSuper = (params: any) => {
|
||||
return http.get("/user_file/page_super", { params });
|
||||
};
|
||||
|
||||
// 按手机号分页查询文件记录(上传/发送/接收,平台管理员)
|
||||
export const getFileRecordPageByPhone = (params: any) => {
|
||||
return http.get("/user_file/record/page_by_phone", { params });
|
||||
};
|
||||
|
||||
// 修改状态
|
||||
export const modifyFileStatus = (data: any) => {
|
||||
return http.put("/user_file/modify_status", data);
|
||||
};
|
||||
|
||||
export const getShareFileList = ({ shareId, ...params }: any) => {
|
||||
return http.get(`/share_user_file/${shareId}`, { params });
|
||||
};
|
||||
|
||||
export const getDiffRiskRule = (fileCode: string) => {
|
||||
return http.get(`/file_risk/dify_risk_rule`, { params: { fileCode } });
|
||||
};
|
||||
|
||||
// MeshSafe 安全检测状态:1检测中/2通过/3不通过/4检测失败
|
||||
export const SecurityScanStatus = {
|
||||
SCANNING: "1",
|
||||
PASSED: "2",
|
||||
REJECTED: "3",
|
||||
FAILED: "4",
|
||||
} as const;
|
||||
|
||||
export type SecurityScanStatus =
|
||||
(typeof SecurityScanStatus)[keyof typeof SecurityScanStatus];
|
||||
|
||||
// 查询文件最新安全检测结果
|
||||
export const getFileSecurityDetail = (fileCode: string) => {
|
||||
return http.get("/file_security/detail", { params: { fileCode } });
|
||||
};
|
||||
|
||||
// 人工复核修改检测结果(pass通过/reject不通过)
|
||||
export const reviewFileSecurity = (data: any) => {
|
||||
return http.post("/file_security/review", data);
|
||||
};
|
||||
|
||||
// 重新提交安全检测
|
||||
export const rescanFileSecurity = (fileCode: string) => {
|
||||
return http.post("/file_security/rescan", null, { params: { fileCode } });
|
||||
};
|
||||
|
||||
// 分享/传输预检:统计文件及子文件的安全检测拦截情况
|
||||
export const shareSecurityCheck = (userFileId: number) => {
|
||||
return http.get("/file_security/share_check", { params: { userFileId } });
|
||||
};
|
||||
17
frontend/src/apis/org.ts
Normal file
17
frontend/src/apis/org.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { http } from "@/lib/http";
|
||||
|
||||
export const getUserPage = (params: any) => {
|
||||
return http.get("/user/page/platform_user", { params });
|
||||
};
|
||||
|
||||
export const createOrg = (data: any) => {
|
||||
return http.post("/uc/org/create", data);
|
||||
};
|
||||
|
||||
export const modifyOrg = (data: any) => {
|
||||
return http.put("/uc/org/modify", data);
|
||||
};
|
||||
|
||||
export const getOrgPage = (params: any) => {
|
||||
return http.get("/uc/org/page", { params });
|
||||
};
|
||||
24
frontend/src/apis/upload-config.ts
Normal file
24
frontend/src/apis/upload-config.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { http } from "@/lib/http";
|
||||
|
||||
// 查询当前机构的上传配置(所有登录用户)
|
||||
export const getUploadConfig = () => {
|
||||
return http.get("/upload_config/info");
|
||||
};
|
||||
|
||||
// 保存机构的上传配置(机构管理员/平台超管,upsert)
|
||||
export const modifyUploadConfig = (data: {
|
||||
uploadEnabled: boolean;
|
||||
allowAllType: boolean;
|
||||
allowedSuffixes?: string[];
|
||||
maxFileSize?: number;
|
||||
}) => {
|
||||
return http.post("/upload_config/modify", data);
|
||||
};
|
||||
|
||||
// 上传预检:按文件名/大小校验当前机构配置,不通过时 success=false
|
||||
export const checkUploadConfig = (params: {
|
||||
fileName: string;
|
||||
fileSize?: number;
|
||||
}) => {
|
||||
return http.get("/upload_config/check", { params });
|
||||
};
|
||||
86
frontend/src/apis/user.ts
Normal file
86
frontend/src/apis/user.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import { http, HTTP_CONTENT_TYPE } from "@/lib/http";
|
||||
|
||||
// 账号登录
|
||||
export const login = (data = {}) => {
|
||||
return http.post("/login", data, {
|
||||
headers: {
|
||||
"content-type": HTTP_CONTENT_TYPE.APPLICATION_FORM_URLENCODED,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 多机构用户选择机构后二次登录(/login 返回 600 + 机构列表时使用)
|
||||
export const loginByOrg = (tempToken: string, orgId: string | number) => {
|
||||
return http.post(
|
||||
"/login_token_user",
|
||||
{ tempToken, orgId },
|
||||
{
|
||||
headers: {
|
||||
"content-type": HTTP_CONTENT_TYPE.APPLICATION_FORM_URLENCODED,
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// 登出
|
||||
export const logout = () => {
|
||||
return http.post("/logout");
|
||||
};
|
||||
|
||||
// 获取用户信息
|
||||
export const getUser = () => {
|
||||
return http.get("/user/info");
|
||||
};
|
||||
|
||||
export const createUser = (data: any, config?: any) => {
|
||||
return http.post("/user/create_org_user", data, config);
|
||||
};
|
||||
|
||||
// 批量创建用户(单条失败不影响其他条目,返回与入参顺序对应的逐条结果)
|
||||
export const batchCreateUser = (data: any[]) => {
|
||||
return http.post("/user/batch_create_org_user", data);
|
||||
};
|
||||
|
||||
export const getUserOrg = () => {
|
||||
return http.get("/uc/org/find");
|
||||
};
|
||||
|
||||
export const cancelUser = (userId: number) => {
|
||||
return http.post("/user/cancel", { userId });
|
||||
};
|
||||
|
||||
export const modifyUserInfo = (data: any) => {
|
||||
return http.post("/user/modify_org_user_info", data);
|
||||
};
|
||||
|
||||
export const resetUserPwd = (data: any) => {
|
||||
return http.post("/user/reset_org_user_pwd", data);
|
||||
};
|
||||
|
||||
export const initUserPassword = (data: any) => {
|
||||
return http.post("/unac/user/init_user_password", data);
|
||||
};
|
||||
|
||||
export const modifyPassword = (data: any) => {
|
||||
return http.post("/unac/user/modify_password", data);
|
||||
};
|
||||
|
||||
// 启用用户(平台管理员,幂等)
|
||||
export const enableUser = (userId: number) => {
|
||||
return http.post("/user/enable", { userId });
|
||||
};
|
||||
|
||||
// 禁用用户(平台管理员,幂等)
|
||||
export const disableUser = (userId: number) => {
|
||||
return http.post("/user/disable", { userId });
|
||||
};
|
||||
|
||||
// 管理员直接注销用户(平台管理员,不走注销审批流程,幂等)
|
||||
export const adminCancelUser = (userId: number) => {
|
||||
return http.post("/user/admin_cancel", { userId });
|
||||
};
|
||||
|
||||
// 分页查询机构账号(平台管理员,一行 = 一个机构下的一个账号)
|
||||
export const getOrgAccountPage = (params: any) => {
|
||||
return http.get("/user/page/org_account", { params });
|
||||
};
|
||||
Reference in New Issue
Block a user