From 1e8ccfec6ebcf7787def13165d9932b0cccefc49 Mon Sep 17 00:00:00 2001 From: liding <756868258@qq.com> Date: 星期五, 20 六月 2025 14:34:45 +0800 Subject: [PATCH] 1.文件上传格式调整 2.表格调整 --- main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql | 47 +++++++---- main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql | 1 ruoyi-common/src/main/java/com/ruoyi/basic/service/impl/StorageBlobServiceImpl.java | 78 ++++++++++++++++--- basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql | 1 main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql | 26 +++--- basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql | 1 main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql | 5 main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql | 2 ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java | 6 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 20 ++--- basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql | 21 ++-- main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql | 4 basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql | 1 main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql | 2 ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 15 ++- 15 files changed, 143 insertions(+), 87 deletions(-) diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql index 85d44bd..fa5fdf7 100644 --- a/basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql +++ b/basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql @@ -6,7 +6,6 @@ maintainer_id int4 NOT NULL DEFAULT 0, -- 缁存姢浜猴紝涓嶅厑璁镐负绌� maintenance_date DATE NOT NULL, -- 缁存姢鏃ユ湡锛屼笉鍏佽涓虹┖ - -- 鏂板瀛楁 deleted int4 NOT NULL DEFAULT 0, -- 鏄惁鍒犻櫎锛堣蒋鍒犻櫎鏍囧織锛� create_by VARCHAR(255), -- 鍒涘缓浜� create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql index f5fdb5b..8e04bea 100644 --- a/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql +++ b/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql @@ -2,7 +2,6 @@ CREATE TABLE coal_field ( id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 - fields VARCHAR(255) NOT NULL, --鐓よ川瀛楁 field_name VARCHAR(255) NOT NULL, -- 鐓よ川鎻忚堪 field_description VARCHAR(255) NOT NULL, -- 鐓よ川鎻忚堪 diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql index d339eec..2d4170c 100644 --- a/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql +++ b/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql @@ -1,17 +1,17 @@ -- 鍒涘缓鐓よ川淇℃伅琛� CREATE TABLE coal_plan ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 + id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 + plan VARCHAR(255) NOT NULL, --鐓よ川鏂规 + field_ids VARCHAR(255) NOT NULL, --鐓よ川鏂规瀛楁id + coal_fields BIGINT NOT NULL, -- 鐓よ川鏂规瀛楁 + scheme_desc VARCHAR(255), -- 瀛楁鎻忚堪 - plan VARCHAR(255) NOT NULL, --鐓よ川鏂规 - field_ids VARCHAR(255) NOT NULL, --鐓よ川鏂规瀛楁id - coal_fields BIGINT NOT NULL, -- 鐓よ川鏂规瀛楁 - - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� - create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� + create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 琛ㄦ敞閲� @@ -22,6 +22,7 @@ COMMENT ON COLUMN coal_plan.plan IS '鐓よ川鏂规'; COMMENT ON COLUMN coal_plan.coal_fields IS '鐓よ川鏂规瀛楁'; COMMENT ON COLUMN coal_plan.field_ids IS '鐓よ川鏂规瀛楁id'; +COMMENT ON COLUMN coal_plan.scheme_desc IS '瀛楁鎻忚堪'; COMMENT ON COLUMN coal_plan.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�'; COMMENT ON COLUMN coal_plan.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛'; COMMENT ON COLUMN coal_plan.create_time IS '璁板綍鍒涘缓鏃堕棿'; diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql index 16355ac..0079081 100644 --- a/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql +++ b/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql @@ -2,7 +2,6 @@ CREATE TABLE coal_value ( id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 - plan_id VARCHAR(255) NOT NULL, --鍏宠仈鐓よ川鏂规涓婚敭ID coal_value VARCHAR(255) NOT NULL, -- 瀛楁鍊� fields VARCHAR(255) NOT NULL, -- 瀛楁 diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql index 2f9b09e..c1e6c28 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql @@ -4,7 +4,6 @@ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID production_master_id BIGINT NOT NULL DEFAULT 0, -- 鐢熶骇涓昏〃ID coal_id BIGINT NOT NULL DEFAULT 0, -- 鐓ょID - coal VARCHAR(50) NOT NULL, -- 鐓ょ production_quantity INT NOT NULL, -- 鐢熶骇鏁伴噺 labor_cost DECIMAL(10, 2) NOT NULL, -- 浜哄伐鎴愭湰 energy_consumption_cost DECIMAL(10, 2) NOT NULL, -- 鑳借�楁垚鏈� @@ -28,7 +27,6 @@ -- 娣诲姞瀛楁娉ㄩ噴 COMMENT ON COLUMN production.id IS '涓婚敭ID'; COMMENT ON COLUMN production.coal_id IS '鐓ょID'; -COMMENT ON COLUMN production.coal IS '鐓ょ'; COMMENT ON COLUMN production.production_quantity IS '鐢熶骇鏁伴噺'; COMMENT ON COLUMN production.labor_cost IS '浜哄伐鎴愭湰'; COMMENT ON COLUMN production.energy_consumption_cost IS '鑳借�楁垚鏈�'; diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql index 37bbf2e..97c44c1 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql @@ -1,27 +1,33 @@ -- 鍒涘缓寰呭叆搴撹〃 CREATE TABLE pending_inventory ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID - supplier_name VARCHAR(255) NOT NULL, -- 渚涜揣鍟嗗悕绉� - coal VARCHAR(50) NOT NULL, -- 鐓ょ - unit VARCHAR(50) NOT NULL, -- 鍗曚綅 - inventory_quantity DECIMAL(10, 2) NOT NULL, -- 搴撳瓨鏁伴噺 - price_including_tax DECIMAL(10, 2) NOT NULL, -- 鍗曚环锛堝惈绋庯級 - total_price_including_tax DECIMAL(10, 2) NOT NULL, -- 鎬讳环锛堝惈绋庯級 - registrant VARCHAR(50) NOT NULL, -- 鐧昏浜� - registration_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 鐧昏鏃堕棿 + id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID + supplier_name VARCHAR(255) NOT NULL, -- 渚涜揣鍟嗗悕绉� + coal VARCHAR(50) NOT NULL, -- 鐓ょ + unit VARCHAR(50) NOT NULL, -- 鍗曚綅 + inventory_quantity NUMERIC(10,2) NOT NULL, -- 搴撳瓨鏁伴噺 + price_including_tax NUMERIC(10,2) NOT NULL, -- 鍗曚环锛堝惈绋庯級 + total_price_including_tax NUMERIC(10,2) NOT NULL, -- 鎬讳环锛堝惈绋庯級 + registrant VARCHAR(50), -- 鐧昏浜� + registration_time TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP, -- 鐧昏鏃堕棿 + price_excluding_tax VARCHAR(255), -- 鍗曚环锛堜笉鍚◣锛� + total_price_excluding_tax VARCHAR(255), -- 鎬讳环锛堜笉鍚◣锛� + registrant_id VARCHAR(32), -- 鐧昏浜篒D + registration_date DATE, -- 鐧昏鏃ユ湡 + supplier_id BIGINT, -- 渚涜揣鍟咺D + coal_id BIGINT, -- 鐓ょID - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� - create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + deleted INTEGER DEFAULT 0, -- 杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄� + create_by VARCHAR(255), -- 鍒涘缓璇ヨ褰曠殑鐢ㄦ埛 + create_time TIMESTAMP(6), -- 璁板綍鍒涘缓鏃堕棿 + update_by VARCHAR(255), -- 鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴� + update_time TIMESTAMP(6) -- 璁板綍鏈�鍚庢洿鏂版椂闂� + ); --- 娣诲姞琛ㄦ敞閲� COMMENT ON TABLE pending_inventory IS '寰呭叆搴撹〃'; --- 娣诲姞瀛楁娉ㄩ噴 +-- 瀛楁娉ㄩ噴 COMMENT ON COLUMN pending_inventory.id IS '涓婚敭ID'; COMMENT ON COLUMN pending_inventory.supplier_name IS '渚涜揣鍟嗗悕绉�'; COMMENT ON COLUMN pending_inventory.coal IS '鐓ょ'; @@ -31,9 +37,16 @@ COMMENT ON COLUMN pending_inventory.total_price_including_tax IS '鎬讳环锛堝惈绋庯級'; COMMENT ON COLUMN pending_inventory.registrant IS '鐧昏浜�'; COMMENT ON COLUMN pending_inventory.registration_time IS '鐧昏鏃堕棿'; +COMMENT ON COLUMN pending_inventory.price_excluding_tax IS '鍗曚环锛堜笉鍚◣锛�'; +COMMENT ON COLUMN pending_inventory.total_price_excluding_tax IS '鎬讳环锛堜笉鍚◣锛�'; +COMMENT ON COLUMN pending_inventory.registrant_id IS '鐧昏浜篒D'; +COMMENT ON COLUMN pending_inventory.registration_date IS '鐧昏鏃ユ湡'; +COMMENT ON COLUMN pending_inventory.supplier_id IS '渚涜揣鍟咺D'; +COMMENT ON COLUMN pending_inventory.coal_id IS '鐓ょID'; COMMENT ON COLUMN pending_inventory.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�'; COMMENT ON COLUMN pending_inventory.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛'; COMMENT ON COLUMN pending_inventory.create_time IS '璁板綍鍒涘缓鏃堕棿'; COMMENT ON COLUMN pending_inventory.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�'; -COMMENT ON COLUMN pending_inventory.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�'; \ No newline at end of file +COMMENT ON COLUMN pending_inventory.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�'; + diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql index 94908ff..a8043a8 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql @@ -14,6 +14,7 @@ registrant_id VARCHAR(50) NOT NULL, -- 鐧昏浜篿d type VARCHAR(50) NOT NULL, -- 鐧昏浜篿d pending_id BIGINT, -- 寰呭叆搴搃d + merge_id BIGINT, -- 鍚堝苟id registration_date TIMESTAMP WITHOUT TIME ZONE, deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� @@ -37,6 +38,7 @@ COMMENT ON COLUMN official_inventory.pending_replenishment IS '寰呰ˉ搴�'; COMMENT ON COLUMN official_inventory.registrant_id IS '鐧昏浜篿d'; COMMENT ON COLUMN official_inventory.registration_date IS '鐧昏鏃ユ湡'; +COMMENT ON COLUMN official_inventory.merge_id IS '鍚堝苟id'; COMMENT ON COLUMN official_inventory.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�'; COMMENT ON COLUMN official_inventory.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛'; diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql b/main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql index b18e909..4d56603 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql @@ -2,7 +2,6 @@ CREATE TABLE tree ( id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 - name VARCHAR(255) NOT NULL, -- 鍚嶇О parent_id BIGINT, -- 鐖秈d diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql b/main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql index 7cd894a..dba4929 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql @@ -1,21 +1,20 @@ -- 鍒涘缓妗f琛� CREATE TABLE archive ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 + id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID + name VARCHAR(255) NOT NULL, -- 妗f鍚嶇О + type VARCHAR(255) NOT NULL, -- 妗f绫诲瀷锛屼緥濡傦細鍚堝悓銆佹姤鍛娿�佽瘉浠剁瓑 + status VARCHAR(50) NOT NULL, -- 妗f鐘舵�侊紝渚嬪锛氭湁鏁堛�佽繃鏈熴�佷綔搴� - name VARCHAR(255) NOT NULL, -- 妗f鍚嶇О - type VARCHAR(255) NOT NULL, -- 妗f绫诲瀷锛堝锛氬悎鍚屻�佹姤鍛娿�佽瘉浠剁瓑锛� - status VARCHAR(50) NOT NULL, -- 鐘舵�侊紙濡傦細鏈夋晥銆佽繃鏈熴�佷綔搴燂級 - - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� - create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 + deleted INTEGER DEFAULT 0 NOT NULL, -- 杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄� + create_by VARCHAR(255), -- 鍒涘缓璇ヨ褰曠殑鐢ㄦ埛 + create_time TIMESTAMP(6), -- 璁板綍鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + update_by VARCHAR(255), -- 鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴� + update_time TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + tree_id BIGINT -- 鏍戣妭鐐笽D ); --- 琛ㄦ敞閲� -COMMENT ON TABLE archive IS '妗f淇℃伅琛紝璁板綍绯荤粺涓悇绫绘。妗堢殑鍩烘湰淇℃伅'; +COMMENT ON TABLE archive IS '妗f淇℃伅琛�'; -- 瀛楁娉ㄩ噴 COMMENT ON COLUMN archive.id IS '涓婚敭ID'; @@ -26,4 +25,5 @@ COMMENT ON COLUMN archive.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛'; COMMENT ON COLUMN archive.create_time IS '璁板綍鍒涘缓鏃堕棿'; COMMENT ON COLUMN archive.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�'; -COMMENT ON COLUMN archive.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�'; \ No newline at end of file +COMMENT ON COLUMN archive.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�'; +COMMENT ON COLUMN archive.tree_id IS '鏍戣妭鐐笽D'; \ No newline at end of file diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql b/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql index f5343db..01a1ba2 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql @@ -2,7 +2,7 @@ CREATE TABLE production_master ( id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID - coal VARCHAR(50) NOT NULL, -- 鐓ょ + coal_id BIGINT, -- 鐓ょID production_quantity INT NOT NULL, -- 鐢熶骇鏁伴噺 labor_cost DECIMAL(10, 2) NOT NULL, -- 浜哄伐鎴愭湰 energy_consumption_cost DECIMAL(10, 2) NOT NULL, -- 鑳借�楁垚鏈� @@ -24,7 +24,7 @@ -- 娣诲姞瀛楁娉ㄩ噴 COMMENT ON COLUMN production_master.id IS '涓婚敭ID'; -COMMENT ON COLUMN production_master.coal IS '鐓ょ'; +COMMENT ON COLUMN production_master.coal_id IS '鐓ょID'; COMMENT ON COLUMN production_master.production_quantity IS '鐢熶骇鏁伴噺'; COMMENT ON COLUMN production_master.labor_cost IS '浜哄伐鎴愭湰'; COMMENT ON COLUMN production_master.energy_consumption_cost IS '鑳借�楁垚鏈�'; diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql index 37318d5..2243aab 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql @@ -4,10 +4,9 @@ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID production_master_id BIGINT NOT NULL DEFAULT 0, -- 鐢熶骇涓昏〃ID coal_id BIGINT NOT NULL DEFAULT 0, -- 鐓ょID - coal VARCHAR(50) NOT NULL, -- 鐓ょ + official_id BIGINT NOT NULL DEFAULT 0, -- 搴撳瓨ID inventory_quantity INT NOT NULL, -- 搴撳瓨鏁伴噺 used_quantity INT NOT NULL, -- 浣跨敤鏁伴噺 - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 @@ -23,7 +22,7 @@ COMMENT ON COLUMN production_inventory.id IS '涓婚敭ID'; COMMENT ON COLUMN production_inventory.production_master_id IS '鐢熶骇涓昏〃ID'; COMMENT ON COLUMN production_inventory.coal_id IS '鐓ょID'; -COMMENT ON COLUMN production_inventory.coal IS '鐓ょ'; +COMMENT ON COLUMN production_inventory.official_id IS '搴撳瓨ID'; COMMENT ON COLUMN production_inventory.inventory_quantity IS '搴撳瓨鏁伴噺'; COMMENT ON COLUMN production_inventory.used_quantity IS '浣跨敤鏁伴噺'; diff --git a/ruoyi-common/src/main/java/com/ruoyi/basic/service/impl/StorageBlobServiceImpl.java b/ruoyi-common/src/main/java/com/ruoyi/basic/service/impl/StorageBlobServiceImpl.java index 1c51d86..cf2094e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/basic/service/impl/StorageBlobServiceImpl.java +++ b/ruoyi-common/src/main/java/com/ruoyi/basic/service/impl/StorageBlobServiceImpl.java @@ -10,16 +10,19 @@ import com.ruoyi.basic.mapper.StorageBlobMapper; import com.ruoyi.basic.service.StorageBlobService; import com.ruoyi.common.core.domain.MinioResult; +import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.exception.file.InvalidExtensionException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.MinioUtils; import com.ruoyi.common.utils.uuid.IdUtils; import lombok.RequiredArgsConstructor; +import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -53,29 +56,76 @@ List<StorageBlobDTO> storageBlobDTOs = new ArrayList<>(); for (MultipartFile file : files) { try { + validateFileExtension(file); + MinioResult res = minioUtils.upload(bucketName, file, false); - StorageBlobDTO dto = new StorageBlobDTO(); - dto.setContentType(file.getContentType()); - dto.setBucketFilename(res.getBucketFileName()); - dto.setOriginalFilename(res.getOriginalName()); - dto.setByteSize(file.getSize()); - dto.setKey(IdUtils.simpleUUID()); - dto.setBucketName(bucketName); - dto.setUrl(minioUtils.getPreviewUrl(res.getBucketFileName(), bucketName, false)); - dto.setDownloadUrl(minioUtils.getDownloadUrl(res.getBucketFileName(), bucketName)); - if (type != null){ - dto.setType(type); - } - // 鎻掑叆鏁版嵁搴� + + StorageBlobDTO dto = buildStorageBlobDTO(file, res, bucketName, type); + storageBlobMapper.insert(dto); storageBlobDTOs.add(dto); + } catch (InvalidExtensionException e) { - throw new RuntimeException("minio鏂囦欢涓婁紶寮傚父锛�" + e); + throw new RuntimeException("涓嶆敮鎸佺殑鏂囦欢绫诲瀷锛�" + file.getOriginalFilename(), e); + } catch (Exception e) { + throw new RuntimeException("涓婁紶鏂囦欢澶辫触锛�" + file.getOriginalFilename(), e); } } return storageBlobDTOs; } + private void validateFileExtension(MultipartFile file) throws InvalidExtensionException { + String filename = file.getOriginalFilename(); + String extension = FilenameUtils.getExtension(filename).toLowerCase(); + List<String> allowedExtensions = Arrays.asList( + // 鍥剧墖 + "jpg", "jpeg", "png", "gif", "bmp", "webp", "tiff", "ico", "svg", + + // 鏂囨。 + "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "rtf", "md", "csv", "odt", + + // 瑙嗛 + "mp4", "mov", "avi", "wmv", "flv", "mkv", "webm", "mpeg", "3gp","MOV", + + // 闊抽 + "mp3", "wav", "ogg", "aac", "flac", "m4a", "wma", "amr", + + // 鍘嬬缉鍖� + "zip", "rar", "7z", "tar", "gz", "bz2", "xz", + + // 缂栫▼浠g爜鏂囦欢 + "java", "py", "js", "ts", "html", "css", "cpp", "c", "cs", "json", "xml", "sql", "yaml", "yml", "sh", "bat", + + // 瀹夎绋嬪簭 & 浜岃繘鍒� + "exe", "apk", "dmg", "msi", "bin", "iso", + + // 璁捐绫� + "psd", "ai", "xd", "sketch", "fig" + ); + + if (!allowedExtensions.contains(extension)) { + throw new BaseException("鏂囦欢绫诲瀷涓嶈鍏佽锛�" + extension); + } + } + + private StorageBlobDTO buildStorageBlobDTO(MultipartFile file, MinioResult res, String bucketName, Long type) { + StorageBlobDTO dto = new StorageBlobDTO(); + dto.setContentType(file.getContentType()); + dto.setBucketFilename(res.getBucketFileName()); + dto.setOriginalFilename(res.getOriginalName()); + dto.setByteSize(file.getSize()); + dto.setKey(IdUtils.simpleUUID()); + dto.setBucketName(bucketName); + dto.setUrl(minioUtils.getPreviewUrl(res.getBucketFileName(), bucketName, false)); + dto.setDownloadUrl(minioUtils.getDownloadUrl(res.getBucketFileName(), bucketName)); + + if (type != null) { + dto.setType(type); + } + + return dto; + } + @Override public int deleteStorageBlobs(StorageAttachment attachment) { List<StorageAttachment> attachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>() diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index d5455c4..682d43b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -1,11 +1,5 @@ package com.ruoyi.common.utils.file; -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.Objects; -import org.apache.commons.io.FilenameUtils; -import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; @@ -14,6 +8,13 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.uuid.Seq; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Objects; /** * 鏂囦欢涓婁紶宸ュ叿绫� @@ -25,7 +26,7 @@ /** * 榛樿澶у皬 50M */ - public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L; + public static final long DEFAULT_MAX_SIZE = 1000 * 1024 * 1024L; /** * 榛樿鐨勬枃浠跺悕鏈�澶ч暱搴� 100 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java index f968f1a..c050fef 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java @@ -22,9 +22,9 @@ public static final String[] FLASH_EXTENSION = { "swf", "flv" }; public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", - "asf", "rm", "rmvb" }; + "asf", "rm", "rmvb","mov","MOV" }; - public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb","mov","MOV" }; public static final String[] DEFAULT_ALLOWED_EXTENSION = { // 鍥剧墖 @@ -34,7 +34,7 @@ // 鍘嬬缉鏂囦欢 "rar", "zip", "gz", "bz2", // 瑙嗛鏍煎紡 - "mp4", "avi", "rmvb", + "mp4", "avi", "rmvb","mov","MOV", // pdf "pdf" }; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 6b82043..f0d3ea4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -1,12 +1,5 @@ package com.ruoyi.framework.web.service; -import jakarta.annotation.Resource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Component; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.UserConstants; @@ -14,11 +7,7 @@ import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.exception.user.BlackListException; -import com.ruoyi.common.exception.user.CaptchaException; -import com.ruoyi.common.exception.user.CaptchaExpireException; -import com.ruoyi.common.exception.user.UserNotExistsException; -import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.exception.user.*; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.StringUtils; @@ -28,6 +17,13 @@ import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysUserService; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; /** * 鐧诲綍鏍¢獙鏂规硶 -- Gitblit v1.9.3