初始化数据库
This commit is contained in:
@@ -21,7 +21,7 @@ jetty:
|
||||
#结合ftp使用,或用nginx代理ftp路径
|
||||
#staticPath: /Users/wizzer/temp/files
|
||||
#开发模式静态资源
|
||||
staticPathLocal: E:/projects/zhgh_cug_v4/src/main/resources/static
|
||||
staticPathLocal: E:/DevOpsCode/zhgh_cug_v4/src/main/resources/static
|
||||
|
||||
security:
|
||||
tokenName: saToken
|
||||
@@ -71,9 +71,9 @@ redis:
|
||||
#nodes=192.168.6.31:6377,192.168.6.31:6378,192.168.6.28:6377,192.168.6.28:6378,192.168.6.34:6377,192.168.6.34:6378
|
||||
|
||||
jdbc:
|
||||
url: jdbc:mysql://192.168.21.215:3306/zhgh_cug_v4?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/zhgh_cug_v4?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: root
|
||||
password: Root@123456
|
||||
validationQuery: select 1
|
||||
maxActive: 1000
|
||||
testWhileIdle: true
|
||||
@@ -87,7 +87,7 @@ xsssql:
|
||||
beetl:
|
||||
RESOURCE:
|
||||
#本地路径,开发时设置本地路径,便于调试
|
||||
rootLocal: E:/projects/zhgh_cug_v4/src/main/resources/views/
|
||||
rootLocal: E:/DevOpsCode/zhgh_cug_v4/src/main/resources/views/
|
||||
root: views/
|
||||
DELIMITER_STATEMENT_START: "<!--#"
|
||||
DELIMITER_STATEMENT_END: "#-->"
|
||||
@@ -160,9 +160,9 @@ quartz:
|
||||
class: com.budwk.app.task.conn.NutConnectionProvider
|
||||
|
||||
minio:
|
||||
accessKey: minioadmin
|
||||
secretKey: minioadmin
|
||||
endPoint: http://192.168.21.214:9000
|
||||
accessKey: o1MwuzixNqAXh5zqEfMH
|
||||
secretKey: RVnZum91JmGO79qtzWy2gKMBsF6OxAaibGrr7ets
|
||||
endPoint: http://localhost:9000
|
||||
bucket: njupt
|
||||
|
||||
data-center:
|
||||
|
||||
@@ -0,0 +1,512 @@
|
||||
-- Points mall tables for zhgh_cug_v4.
|
||||
-- MySQL 8.x / InnoDB / utf8mb4.
|
||||
-- Naming follows the current zhgh_cug_v4 style: varchar(32) id, camelCase columns,
|
||||
-- createdBy/createdAt/updatedBy/updatedAt/delFlag audit fields.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_supplier` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`supplierName` varchar(100) NOT NULL COMMENT '供应商名称',
|
||||
`supplierUrl` varchar(1000) DEFAULT NULL COMMENT '供应商首页跳转地址',
|
||||
`supplierOrderUrl` varchar(1000) DEFAULT NULL COMMENT '供应商订单详情地址',
|
||||
`supplierReturnOrderUrl` varchar(1000) DEFAULT NULL COMMENT '供应商售后订单地址',
|
||||
`supplierApiUrl` varchar(1000) DEFAULT NULL COMMENT '供应商接口地址',
|
||||
`supplierPic` varchar(1000) DEFAULT NULL COMMENT '供应商图片访问地址',
|
||||
`supplierPicPath` varchar(1000) DEFAULT NULL COMMENT '供应商图片文件路径',
|
||||
`contactInfo` varchar(500) DEFAULT NULL COMMENT '联系人信息',
|
||||
`sroNo` varchar(100) DEFAULT NULL COMMENT '服务商编号',
|
||||
`cooperationExpTime` datetime DEFAULT NULL COMMENT '合作到期时间',
|
||||
`clientId` varchar(128) DEFAULT NULL COMMENT '客户端ID',
|
||||
`clientSecret` varchar(256) DEFAULT NULL COMMENT '客户端密钥',
|
||||
`sortCode` int DEFAULT 0 COMMENT '排序号',
|
||||
`mallType` int DEFAULT 1 COMMENT '商城类型:1积分商城,2电影商城',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_supplier_supplier` (`supplierId`),
|
||||
KEY `idx_points_mall_supplier_type_sort` (`mallType`, `sortCode`),
|
||||
KEY `idx_points_mall_supplier_exp_time` (`cooperationExpTime`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城供应商';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_supplier_auth_client` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`clientId` varchar(128) NOT NULL COMMENT '客户端ID',
|
||||
`clientSecret` varchar(256) DEFAULT NULL COMMENT '客户端密钥',
|
||||
`code` varchar(128) DEFAULT NULL COMMENT '授权码',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_supplier_auth_client` (`supplierId`, `clientId`),
|
||||
KEY `idx_points_mall_supplier_auth_code` (`code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城供应商授权客户端';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_supplier_token_store` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`clientId` varchar(128) NOT NULL COMMENT '客户端ID',
|
||||
`accessToken` varchar(1000) DEFAULT NULL COMMENT '访问令牌',
|
||||
`refreshToken` varchar(1000) DEFAULT NULL COMMENT '刷新令牌',
|
||||
`accessExpireTime` datetime DEFAULT NULL COMMENT '访问令牌过期时间',
|
||||
`refreshExpireTime` datetime DEFAULT NULL COMMENT '刷新令牌过期时间',
|
||||
`isValid` tinyint(1) DEFAULT 1 COMMENT '是否有效',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_supplier_token_client` (`supplierId`, `clientId`, `isValid`),
|
||||
KEY `idx_points_mall_supplier_token_expire` (`accessExpireTime`, `refreshExpireTime`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城供应商Token';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_user_points` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`userId` varchar(64) NOT NULL COMMENT '用户ID',
|
||||
`totalPoints` decimal(18,2) DEFAULT 0.00 COMMENT '总积分',
|
||||
`usedPoints` decimal(18,2) DEFAULT 0.00 COMMENT '已用积分',
|
||||
`availablePoints` decimal(18,2) DEFAULT 0.00 COMMENT '可用积分',
|
||||
`lockPoints` decimal(18,2) DEFAULT 0.00 COMMENT '锁定积分',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_user_points_user` (`userId`),
|
||||
KEY `idx_points_mall_user_points_user` (`userId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城用户积分';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_user_points_log` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`userId` varchar(64) NOT NULL COMMENT '用户ID',
|
||||
`changeAmount` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '变动积分',
|
||||
`changeType` varchar(50) DEFAULT NULL COMMENT '变动类型',
|
||||
`subOrderId` varchar(64) DEFAULT NULL COMMENT '子订单ID',
|
||||
`templateId` varchar(32) DEFAULT NULL COMMENT '消息模板ID',
|
||||
`remark` varchar(1000) DEFAULT NULL COMMENT '备注',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_points_log_user` (`userId`),
|
||||
KEY `idx_points_mall_points_log_order` (`subOrderId`),
|
||||
KEY `idx_points_mall_points_log_template` (`templateId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城用户积分流水';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_main_points_lock` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`userId` varchar(64) NOT NULL COMMENT '用户ID',
|
||||
`orderId` varchar(64) NOT NULL COMMENT '主订单ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`lockAmount` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '锁定积分',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0锁定中,1已释放,2已扣减',
|
||||
`lockTime` datetime DEFAULT NULL COMMENT '锁定时间',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_main_lock_order` (`orderId`, `supplierId`, `userId`),
|
||||
KEY `idx_points_mall_main_lock_user_status` (`userId`, `status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城主订单积分锁定';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_sub_points_lock` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`userId` varchar(64) NOT NULL COMMENT '用户ID',
|
||||
`mainOrderId` varchar(64) NOT NULL COMMENT '主订单ID',
|
||||
`subOrderId` varchar(64) NOT NULL COMMENT '子订单ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`changePoints` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '变动积分',
|
||||
`orderSubStatus` int DEFAULT NULL COMMENT '子订单状态',
|
||||
`lockTime` datetime DEFAULT NULL COMMENT '锁定时间',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_sub_lock_order` (`subOrderId`, `supplierId`, `userId`),
|
||||
KEY `idx_points_mall_sub_lock_main` (`mainOrderId`, `supplierId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城子订单积分锁定';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_user_points_grant_plan` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`planName` varchar(100) NOT NULL COMMENT '计划名称',
|
||||
`planDescription` varchar(1000) DEFAULT NULL COMMENT '计划描述',
|
||||
`grantMode` varchar(20) DEFAULT NULL COMMENT '发放模式:1手动,2定时',
|
||||
`grantTime` varchar(50) DEFAULT NULL COMMENT '发放时间',
|
||||
`cronExp` varchar(100) DEFAULT NULL COMMENT 'Cron表达式',
|
||||
`status` varchar(20) DEFAULT NULL COMMENT '计划状态',
|
||||
`userIdList` mediumtext COMMENT '发放用户ID列表',
|
||||
`grantPoints` decimal(18,2) DEFAULT 0.00 COMMENT '发放积分',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_grant_plan_status` (`status`),
|
||||
KEY `idx_points_mall_grant_plan_mode` (`grantMode`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城积分发放计划';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_import_template_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`templateName` varchar(200) DEFAULT NULL COMMENT '模板名称',
|
||||
`fileName` varchar(200) DEFAULT NULL COMMENT '文件名称',
|
||||
`fileUrl` varchar(1000) DEFAULT NULL COMMENT '文件地址',
|
||||
`totalCount` int DEFAULT 0 COMMENT '导入总数',
|
||||
`successCount` int DEFAULT 0 COMMENT '成功数量',
|
||||
`failCount` int DEFAULT 0 COMMENT '失败数量',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0处理中,1成功,2失败,3部分成功',
|
||||
`failReason` mediumtext COMMENT '失败原因',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_import_template_status` (`status`),
|
||||
KEY `idx_points_mall_import_template_created` (`createdAt`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城积分导入记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_order_main` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`orderId` varchar(64) NOT NULL COMMENT '主订单ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`orderNumberId` varchar(64) DEFAULT NULL COMMENT '订单编号',
|
||||
`userId` varchar(64) DEFAULT NULL COMMENT '用户ID',
|
||||
`aplName` varchar(100) DEFAULT NULL COMMENT '应用名称',
|
||||
`orderCreateTime` datetime DEFAULT NULL COMMENT '订单创建时间',
|
||||
`orderUpdateTime` datetime DEFAULT NULL COMMENT '订单更新时间',
|
||||
`deliveryTime` datetime DEFAULT NULL COMMENT '发货时间',
|
||||
`orderFinishTime` datetime DEFAULT NULL COMMENT '确认收货时间',
|
||||
`orderCompleteTime` datetime DEFAULT NULL COMMENT '完成时间',
|
||||
`deliveryStatus` varchar(20) DEFAULT NULL COMMENT '发货状态',
|
||||
`freightCost` decimal(18,2) DEFAULT 0.00 COMMENT '运费积分',
|
||||
`refund` decimal(18,2) DEFAULT 0.00 COMMENT '退款积分',
|
||||
`logisticsOrderId` varchar(100) DEFAULT NULL COMMENT '物流单号',
|
||||
`crrgBsnNm` varchar(100) DEFAULT NULL COMMENT '物流承运商',
|
||||
`orderState` int DEFAULT NULL COMMENT '订单状态',
|
||||
`totalPrice` decimal(18,2) DEFAULT 0.00 COMMENT '订单总金额',
|
||||
`wPayOrAPay` decimal(18,2) DEFAULT 0.00 COMMENT '现金金额',
|
||||
`pointsPrice` decimal(18,2) DEFAULT 0.00 COMMENT '消费积分',
|
||||
`invoiceCode` varchar(100) DEFAULT NULL COMMENT '发票代码',
|
||||
`extJson` mediumtext COMMENT '商品扩展信息JSON',
|
||||
`cashPaid` int DEFAULT NULL COMMENT '现金支付状态',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_order_main_order_supplier` (`orderId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_main_user` (`userId`),
|
||||
KEY `idx_points_mall_order_main_state` (`orderState`),
|
||||
KEY `idx_points_mall_order_main_created` (`orderCreateTime`),
|
||||
KEY `idx_points_mall_order_main_logistics` (`logisticsOrderId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城主订单';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_order_sub` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`orderId` varchar(64) NOT NULL COMMENT '子订单ID',
|
||||
`orderNumberId` varchar(64) DEFAULT NULL COMMENT '订单编号',
|
||||
`mainOrderId` varchar(64) DEFAULT NULL COMMENT '主订单ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`userId` varchar(64) DEFAULT NULL COMMENT '用户ID',
|
||||
`aplName` varchar(100) DEFAULT NULL COMMENT '应用名称',
|
||||
`orderCreateTime` datetime DEFAULT NULL COMMENT '订单创建时间',
|
||||
`orderUpdateTime` datetime DEFAULT NULL COMMENT '订单更新时间',
|
||||
`deliveryTime` datetime DEFAULT NULL COMMENT '发货时间',
|
||||
`orderFinishTime` datetime DEFAULT NULL COMMENT '确认收货时间',
|
||||
`orderCompleteTime` datetime DEFAULT NULL COMMENT '完成时间',
|
||||
`deliveryStatus` int DEFAULT NULL COMMENT '发货状态',
|
||||
`freightCost` decimal(18,2) DEFAULT 0.00 COMMENT '运费积分',
|
||||
`wPayOrAPayFreightCost` decimal(18,2) DEFAULT 0.00 COMMENT '运费现金',
|
||||
`refund` decimal(18,2) DEFAULT 0.00 COMMENT '退款积分',
|
||||
`wPayOrAPayRefund` decimal(18,2) DEFAULT 0.00 COMMENT '退款现金',
|
||||
`logisticsOrderId` varchar(100) DEFAULT NULL COMMENT '物流单号',
|
||||
`crrgBsnNm` varchar(100) DEFAULT NULL COMMENT '物流承运商',
|
||||
`orderState` int DEFAULT NULL COMMENT '订单状态',
|
||||
`totalPrice` decimal(18,2) DEFAULT 0.00 COMMENT '订单总金额',
|
||||
`wPayOrAPay` decimal(18,2) DEFAULT 0.00 COMMENT '现金金额',
|
||||
`pointsPrice` decimal(18,2) DEFAULT 0.00 COMMENT '消费积分',
|
||||
`invoiceCode` varchar(100) DEFAULT NULL COMMENT '发票代码',
|
||||
`extJson` mediumtext COMMENT '扩展信息JSON',
|
||||
`reconciliationStatus` int DEFAULT 0 COMMENT '对账状态',
|
||||
`invoiceStatus` int DEFAULT 0 COMMENT '开票状态',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_order_sub_order_supplier` (`orderId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_sub_main` (`mainOrderId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_sub_user_supplier` (`orderId`, `userId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_sub_state` (`orderState`),
|
||||
KEY `idx_points_mall_order_sub_invoice` (`invoiceStatus`),
|
||||
KEY `idx_points_mall_order_sub_reconciliation` (`reconciliationStatus`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城子订单';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_order_sub_product` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`orderSubId` varchar(64) NOT NULL COMMENT '子订单ID',
|
||||
`sku` varchar(100) DEFAULT NULL COMMENT '商品SKU',
|
||||
`number` int DEFAULT 0 COMMENT '购买数量',
|
||||
`price` decimal(18,2) DEFAULT 0.00 COMMENT '商品单价',
|
||||
`name` varchar(300) DEFAULT NULL COMMENT '商品名称',
|
||||
`taxRate` decimal(10,4) DEFAULT NULL COMMENT '税率',
|
||||
`picInfo` varchar(1000) DEFAULT NULL COMMENT '商品图片信息',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_order_sub_product_order` (`orderSubId`),
|
||||
KEY `idx_points_mall_order_sub_product_sku` (`sku`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城子订单商品';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_order_exchange` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`orderMainId` varchar(64) DEFAULT NULL COMMENT '关联主订单ID',
|
||||
`orderId` varchar(64) NOT NULL COMMENT '售后订单ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`userId` varchar(64) DEFAULT NULL COMMENT '用户ID',
|
||||
`aplName` varchar(100) DEFAULT NULL COMMENT '应用名称',
|
||||
`orderCreateTime` datetime DEFAULT NULL COMMENT '订单创建时间',
|
||||
`orderUpdateTime` datetime DEFAULT NULL COMMENT '订单更新时间',
|
||||
`orderCompleteTime` datetime DEFAULT NULL COMMENT '完成时间',
|
||||
`deliveryStatus` int DEFAULT NULL COMMENT '发货状态',
|
||||
`freightCost` decimal(18,2) DEFAULT 0.00 COMMENT '运费',
|
||||
`refund` decimal(18,2) DEFAULT 0.00 COMMENT '退款',
|
||||
`logisticsOrderId` varchar(100) DEFAULT NULL COMMENT '物流单号',
|
||||
`crrgBsnNm` varchar(100) DEFAULT NULL COMMENT '物流承运商',
|
||||
`orderState` int DEFAULT NULL COMMENT '订单状态',
|
||||
`totalPrice` decimal(18,2) DEFAULT 0.00 COMMENT '订单总金额',
|
||||
`wPayOrAPay` decimal(18,2) DEFAULT 0.00 COMMENT '现金金额',
|
||||
`pointsPrice` decimal(18,2) DEFAULT 0.00 COMMENT '消费积分',
|
||||
`invoiceCode` varchar(100) DEFAULT NULL COMMENT '发票代码',
|
||||
`extJson` mediumtext COMMENT '商品扩展信息JSON',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_order_exchange_order_supplier` (`orderId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_exchange_main` (`orderMainId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_exchange_user` (`userId`),
|
||||
KEY `idx_points_mall_order_exchange_state` (`orderState`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城退换货订单';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_order_event_log` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`supplierId` varchar(64) DEFAULT NULL COMMENT '供应商编码',
|
||||
`orderType` int DEFAULT NULL COMMENT '订单类型:1主单,2子单,3售后单',
|
||||
`orderId` varchar(64) DEFAULT NULL COMMENT '订单ID',
|
||||
`mainOrderId` varchar(64) DEFAULT NULL COMMENT '主订单ID',
|
||||
`userId` varchar(64) DEFAULT NULL COMMENT '用户ID',
|
||||
`eventTime` datetime DEFAULT NULL COMMENT '事件时间',
|
||||
`message` mediumtext COMMENT '事件消息',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_order_event_order` (`orderId`, `supplierId`),
|
||||
KEY `idx_points_mall_order_event_main` (`mainOrderId`),
|
||||
KEY `idx_points_mall_order_event_time` (`eventTime`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城订单事件日志';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_invoice_main` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`settlementId` varchar(100) DEFAULT NULL COMMENT '结算单号',
|
||||
`bSuccess` int DEFAULT NULL COMMENT '开票结果:0成功,1失败',
|
||||
`sucOrderIds` mediumtext COMMENT '可开票订单列表',
|
||||
`failOrderIds` mediumtext COMMENT '无法开票订单列表',
|
||||
`failMsg` varchar(1000) DEFAULT NULL COMMENT '开票失败原因',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_invoice_main_settlement` (`settlementId`),
|
||||
KEY `idx_points_mall_invoice_main_success` (`bSuccess`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城发票主表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_invoice_info` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`mainId` varchar(32) DEFAULT NULL COMMENT '发票主表ID',
|
||||
`invoiceId` varchar(100) DEFAULT NULL COMMENT '发票号码',
|
||||
`invoiceCode` varchar(100) DEFAULT NULL COMMENT '发票代码',
|
||||
`invoiceDate` date DEFAULT NULL COMMENT '发票日期',
|
||||
`invoiceNakeAmount` decimal(18,2) DEFAULT NULL COMMENT '发票裸价',
|
||||
`invoiceTaxRate` decimal(10,4) DEFAULT NULL COMMENT '发票税率',
|
||||
`invoiceTaxAmount` decimal(18,2) DEFAULT NULL COMMENT '发票税额',
|
||||
`invoiceAmount` decimal(18,2) DEFAULT NULL COMMENT '价税合计',
|
||||
`invoiceType` int DEFAULT NULL COMMENT '发票类型',
|
||||
`url` varchar(1000) DEFAULT NULL COMMENT '电子发票地址',
|
||||
`imageEncode` longtext COMMENT '发票Base64',
|
||||
`fileType` varchar(20) DEFAULT NULL COMMENT '文件类型',
|
||||
`checkCode` varchar(100) DEFAULT NULL COMMENT '校验码',
|
||||
`invoiceAddress` varchar(500) DEFAULT NULL COMMENT '发票地址',
|
||||
`invoiceBank` varchar(200) DEFAULT NULL COMMENT '开户银行',
|
||||
`invoiceAccount` varchar(100) DEFAULT NULL COMMENT '开户账号',
|
||||
`invoiceContact` varchar(100) DEFAULT NULL COMMENT '联系电话',
|
||||
`invoiceContent` varchar(500) DEFAULT NULL COMMENT '开票内容',
|
||||
`taxIdNumber` varchar(100) DEFAULT NULL COMMENT '纳税人识别号',
|
||||
`remark` varchar(1000) DEFAULT NULL COMMENT '备注',
|
||||
`biller` varchar(100) DEFAULT NULL COMMENT '开票人',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_invoice_info_main` (`mainId`),
|
||||
KEY `idx_points_mall_invoice_info_invoice` (`invoiceId`, `invoiceCode`),
|
||||
KEY `idx_points_mall_invoice_info_date` (`invoiceDate`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城发票信息';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_reconciliation_order` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`orderId` varchar(64) NOT NULL COMMENT '订单ID',
|
||||
`userId` varchar(64) DEFAULT NULL COMMENT '用户ID',
|
||||
`totalPrice` decimal(18,2) DEFAULT 0.00 COMMENT '总价含税',
|
||||
`invoiceNakedPrice` decimal(18,2) DEFAULT 0.00 COMMENT '总价不含税',
|
||||
`productInfo` mediumtext COMMENT '商品信息',
|
||||
`queryScope` varchar(200) DEFAULT NULL COMMENT '查询范围',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_reconciliation_order` (`orderId`, `supplierId`),
|
||||
KEY `idx_points_mall_reconciliation_order_user` (`userId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城供应商对账订单';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_reconciliation_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`supplierId` varchar(64) NOT NULL COMMENT '供应商编码',
|
||||
`orderId` varchar(64) NOT NULL COMMENT '订单ID',
|
||||
`userId` varchar(64) DEFAULT NULL COMMENT '用户ID',
|
||||
`pRefund` decimal(18,2) DEFAULT 0.00 COMMENT '平台退款',
|
||||
`pTotalPrice` decimal(18,2) DEFAULT 0.00 COMMENT '平台订单总金额',
|
||||
`pCashAmount` decimal(18,2) DEFAULT 0.00 COMMENT '平台现金金额',
|
||||
`pPointsPrice` decimal(18,2) DEFAULT 0.00 COMMENT '平台消费积分',
|
||||
`sRefund` decimal(18,2) DEFAULT 0.00 COMMENT '供应商退款',
|
||||
`sTotalPrice` decimal(18,2) DEFAULT 0.00 COMMENT '供应商订单总金额',
|
||||
`sCashAmount` decimal(18,2) DEFAULT 0.00 COMMENT '供应商现金金额',
|
||||
`sPointsPrice` decimal(18,2) DEFAULT 0.00 COMMENT '供应商消费积分',
|
||||
`diffReason` varchar(1000) DEFAULT NULL COMMENT '差异原因',
|
||||
`diffType` int DEFAULT NULL COMMENT '差异类型',
|
||||
`batchNo` varchar(100) DEFAULT NULL COMMENT '对账批次号',
|
||||
`noticeStatus` int DEFAULT 0 COMMENT '通知状态:0未推送,1成功,2失败',
|
||||
`pushTime` int DEFAULT 0 COMMENT '推送次数',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_reconciliation_record_order` (`orderId`, `supplierId`),
|
||||
KEY `idx_points_mall_reconciliation_record_batch` (`batchNo`),
|
||||
KEY `idx_points_mall_reconciliation_record_notice` (`noticeStatus`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城对账记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_message_template` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`name` varchar(100) NOT NULL COMMENT '模板名称',
|
||||
`type` int DEFAULT NULL COMMENT '模板类型',
|
||||
`content` mediumtext COMMENT '内容模板',
|
||||
`contentLink` mediumtext COMMENT '内容链接',
|
||||
`status` int DEFAULT 1 COMMENT '状态:0禁用,1启用',
|
||||
`extParam` mediumtext COMMENT '扩展参数',
|
||||
`isSendPoints` int DEFAULT 0 COMMENT '是否发放积分:0否,1是',
|
||||
`sendPoints` decimal(18,2) DEFAULT 0.00 COMMENT '发放积分',
|
||||
`deptIdList` mediumtext COMMENT '目标机构列表',
|
||||
`unionIdList` mediumtext COMMENT '目标工会列表',
|
||||
`festivalDate` varchar(100) DEFAULT NULL COMMENT '节日日期',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_message_template_type` (`type`),
|
||||
KEY `idx_points_mall_message_template_status` (`status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城消息模板';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_message` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`uniqueNo` varchar(128) DEFAULT NULL COMMENT '业务唯一号',
|
||||
`pushType` varchar(50) DEFAULT NULL COMMENT '推送类型',
|
||||
`templateId` varchar(32) DEFAULT NULL COMMENT '模板ID',
|
||||
`touser` mediumtext COMMENT '目标用户',
|
||||
`toparty` mediumtext COMMENT '目标部门',
|
||||
`totag` mediumtext COMMENT '目标标签',
|
||||
`content` mediumtext COMMENT '推送内容',
|
||||
`contentLink` mediumtext COMMENT '内容链接',
|
||||
`planPushTime` datetime DEFAULT NULL COMMENT '计划推送时间',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0未推送,1已推送,2推送中,-1不推送',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_message_unique` (`uniqueNo`),
|
||||
KEY `idx_points_mall_message_template` (`templateId`),
|
||||
KEY `idx_points_mall_message_status_time` (`status`, `planPushTime`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城消息记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_message_schedule` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`templateId` varchar(32) NOT NULL COMMENT '模板ID',
|
||||
`triggerType` int DEFAULT NULL COMMENT '触发类型:1 Cron,2 间隔',
|
||||
`cronExpression` varchar(100) DEFAULT NULL COMMENT 'Cron表达式',
|
||||
`intervalValue` int DEFAULT NULL COMMENT '间隔值',
|
||||
`intervalUnit` varchar(20) DEFAULT NULL COMMENT '间隔单位',
|
||||
`status` int DEFAULT 1 COMMENT '状态:0禁用,1启用',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_points_mall_message_schedule_template` (`templateId`),
|
||||
KEY `idx_points_mall_message_schedule_status` (`status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城消息调度规则';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `points_mall_schedule_user_points_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`templateId` varchar(32) NOT NULL COMMENT '模板ID',
|
||||
`userId` varchar(64) NOT NULL COMMENT '用户ID',
|
||||
`year` int NOT NULL COMMENT '年度',
|
||||
`sendPoints` decimal(18,2) DEFAULT 0.00 COMMENT '发放积分',
|
||||
`status` int DEFAULT 0 COMMENT '状态:0待处理,1成功,2失败',
|
||||
`createdBy` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`createdAt` bigint DEFAULT NULL COMMENT '创建时间',
|
||||
`updatedBy` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`updatedAt` bigint DEFAULT NULL COMMENT '修改时间',
|
||||
`delFlag` tinyint(1) DEFAULT 0 COMMENT '删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_points_mall_schedule_user_points` (`templateId`, `userId`, `year`, `delFlag`),
|
||||
KEY `idx_points_mall_schedule_user_points_user` (`userId`),
|
||||
KEY `idx_points_mall_schedule_user_points_status` (`status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分商城定时发放积分记录';
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.budwk.app;
|
||||
|
||||
import io.minio.*;
|
||||
import io.minio.errors.*;
|
||||
import io.minio.messages.Item;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Map;
|
||||
|
||||
class MinioUtil {
|
||||
MinioClient minioClient = null;
|
||||
String bucketName = "njupt";
|
||||
String endpoint = "http://localhost:9000";
|
||||
String accessKey = "o1MwuzixNqAXh5zqEfMH";
|
||||
String secretKey = "RVnZum91JmGO79qtzWy2gKMBsF6OxAaibGrr7ets";
|
||||
|
||||
public MinioUtil() {
|
||||
//构造方法 minio客户端
|
||||
minioClient = MinioClient.builder()
|
||||
.endpoint(endpoint)
|
||||
.credentials(accessKey, secretKey)
|
||||
.build();
|
||||
System.out.println("Minio客户端链接成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果桶不存在则创建桶
|
||||
*/
|
||||
private void createBucketName() throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
||||
if (exists) {
|
||||
System.out.println(bucketName + " exists");
|
||||
} else {
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||
System.out.println(bucketName + " is created successfully");
|
||||
}
|
||||
}
|
||||
|
||||
public void fileUpload(String path, String fileUploadPath, String fileName) {
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(new File(path));
|
||||
fileUpload(fileInputStream, fileUploadPath, fileName);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void fileUpload(InputStream is, String fileUploadPath, String fileName) throws IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
try {
|
||||
this.createBucketName();
|
||||
} catch (ServerException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
minioClient.putObject(
|
||||
PutObjectArgs
|
||||
.builder()
|
||||
.bucket(bucketName)
|
||||
.object(fileUploadPath + "/" + fileName)
|
||||
.stream(is, -1, 10485760)
|
||||
.build());
|
||||
System.out.println("successfully uploaded as 【" + fileUploadPath + "】 to 【" + bucketName + "】bucket.");
|
||||
}
|
||||
|
||||
private void fileDownload(String filePath, String fileName) throws IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
filePath = filePath.replace("\\", "/");
|
||||
minioClient.downloadObject(
|
||||
DownloadObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(filePath)
|
||||
.filename(fileName)
|
||||
.build());
|
||||
System.out.println("successfully uploaded as 【" + filePath + "/" + fileName + "】 to 【" + bucketName + "】bucket.");
|
||||
}
|
||||
|
||||
public InputStream downloadInputSteam(String filePath) throws IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
filePath = filePath.replace("\\", "/");
|
||||
return minioClient.getObject(
|
||||
GetObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(filePath)
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
public StatObjectResponse getFileInfo(String filePath) throws IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
filePath = filePath.replace("\\", "/");
|
||||
return minioClient.statObject(StatObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(filePath)
|
||||
.build());
|
||||
}
|
||||
|
||||
public Iterable<Result<Item>> getFiles(String path) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
return minioClient.listObjects(ListObjectsArgs.builder().bucket(bucketName).prefix(path).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param bucketName 库名字
|
||||
* @param fileName 文件路径
|
||||
* @return
|
||||
*/
|
||||
public boolean delete(String bucketName, String fileName) {
|
||||
/*
|
||||
* String bucketName = "test2";
|
||||
* String fileName = "/2023-04-07/16808560218465670_img.png";
|
||||
* address+bucketName+fileName 就是访问路径,删除需要后两个参数。
|
||||
*/
|
||||
try {
|
||||
minioClient.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(fileName).build());
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MinioTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
MinioUtil minioUtil = new MinioUtil();
|
||||
// Iterable<Result<Item>> iterable = minioUtil.getFiles("data/");
|
||||
// for (Result<Item> itemResult : iterable) {
|
||||
// Item item = itemResult.get();
|
||||
// System.out.println(item.objectName());
|
||||
// InputStream inputStream = minioUtil.downloadInputSteam(item.objectName());
|
||||
// String targetPath = "D:\\tmp\\" + item.objectName();
|
||||
// File file = new File(targetPath);
|
||||
// FileUtils.copyInputStreamToFile(inputStream, file);
|
||||
// Map<String, String> map = PdfUtil.readPdf2Txt(file.getAbsolutePath());
|
||||
// for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
// System.out.println(entry.getKey() + " " + entry.getValue());
|
||||
// }
|
||||
// }
|
||||
String path = "E:\\DevOpsCode\\zhgh_cug_v4\\README.md";
|
||||
String fileUploadPath = "data";
|
||||
minioUtil.fileUpload(path, fileUploadPath, "README.md");
|
||||
// boolean success = minioUtil.delete("njupt", "data/README.md");
|
||||
// System.out.println(success?"成功":"失败");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user