From c0cf736ff001bbaec59b7da6239f4670464952fd Mon Sep 17 00:00:00 2001 From: liding <756868258@qq.com> Date: 星期四, 12 六月 2025 16:32:05 +0800 Subject: [PATCH] 1.销售模块 2.时区优化 --- basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java | 2 basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql | 22 ++- main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java | 11 + main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql | 4 basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql | 4 basic-server/src/main/resources/db/migration/postgresql/V20250530152701__create_table_supply.sql | 4 ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql | 8 main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql | 38 +++--- main-business/src/main/resources/mapper/OfficialInventoryMapper.xml | 2 main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java | 2 main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql | 4 ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102200__create_province.sql | 4 main-business/src/main/java/com/ruoyi/business/dto/ProductionDto.java | 6 + ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102500__create_district.sql | 4 main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql | 4 main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql | 4 ruoyi-system/src/main/java/com/ruoyi/basic/entity/City.java | 5 main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql | 32 ++-- main-business/src/main/resources/mapper/PendingInventoryMapper.xml | 2 main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java | 9 + main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql | 4 basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java | 4 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/MyBaseEntity.java | 9 ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102300__create_city.sql | 4 ruoyi-system/src/main/java/com/ruoyi/basic/entity/Province.java | 5 main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java | 5 main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java | 26 ++++ basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql | 6 ruoyi-system/src/main/java/com/ruoyi/basic/entity/District.java | 5 ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java | 46 ++---- main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql | 49 ++++---- basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql | 4 basic-server/src/main/resources/db/migration/postgresql/V20250530171701__create_table_customer.sql | 4 33 files changed, 191 insertions(+), 151 deletions(-) diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java index 4a9b8b5..f487ca1 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java +++ b/basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java @@ -46,7 +46,7 @@ } /** - * 鏂板淇敼 + * 瀹㈡埛鏂板淇敼 */ @PostMapping("/addOrEditCustomer") public R addOrEditSupply(@RequestBody CustomerDto customerDto) { diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java index 06a6be5..cf41007 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java +++ b/basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java @@ -38,7 +38,7 @@ } /** - * 渚涘簲鍟� + * 渚涘簲鍟唋ist */ @GetMapping("/supplyList") public R<List<Supply>> list() { @@ -46,7 +46,7 @@ } /** - * 鏂板淇敼 + * 渚涘簲鍟嗘柊澧炰慨鏀� */ @PostMapping("/addOrEditSupply") public R addOrEditSupply(@RequestBody SupplyDto supplyDto) { diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250530152701__create_table_supply.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250530152701__create_table_supply.sql index 5b006fb..8c5807f 100644 --- a/basic-server/src/main/resources/db/migration/postgresql/V20250530152701__create_table_supply.sql +++ b/basic-server/src/main/resources/db/migration/postgresql/V20250530152701__create_table_supply.sql @@ -18,9 +18,9 @@ c_district_id BIGINT NOT NULL DEFAULT 0, -- 鑱旂郴鍦板潃鍖篿d deleted int4 NOT NULL DEFAULT 0, -- 鏄惁鍒犻櫎锛堣蒋鍒犻櫎鏍囧織锛� create_by VARCHAR(255), -- 鍒涘缓浜� - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉 - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 contact_phone VARCHAR(255) -- 鑱旂郴浜虹數璇� ); diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250530171701__create_table_customer.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250530171701__create_table_customer.sql index f99ebd3..10ef5bb 100644 --- a/basic-server/src/main/resources/db/migration/postgresql/V20250530171701__create_table_customer.sql +++ b/basic-server/src/main/resources/db/migration/postgresql/V20250530171701__create_table_customer.sql @@ -20,9 +20,9 @@ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); COMMENT ON COLUMN customer.id IS '瀹㈡埛鍞竴鏍囪瘑锛屼富閿�'; 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 a59dcd0..85d44bd 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 @@ -9,9 +9,9 @@ -- 鏂板瀛楁 deleted int4 NOT NULL DEFAULT 0, -- 鏄惁鍒犻櫎锛堣蒋鍒犻櫎鏍囧織锛� create_by VARCHAR(255), -- 鍒涘缓浜� - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉 - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_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 6651721..f5fdb5b 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 @@ -9,9 +9,9 @@ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 琛ㄦ敞閲� 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 9daa595..d339eec 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 @@ -4,13 +4,14 @@ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 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 WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 琛ㄦ敞閲� @@ -20,6 +21,7 @@ COMMENT ON COLUMN coal_plan.id IS '涓婚敭ID'; 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.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 59d6491..16355ac 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 @@ -1,18 +1,19 @@ -- 鍒涘缓鐓よ川淇℃伅琛� CREATE TABLE coal_value ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 + id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑 - plan_id VARCHAR(255) NOT NULL, --鍏宠仈鐓よ川鏂规涓婚敭ID - coal_value VARCHAR(255) NOT NULL, -- 瀛楁鍊� - fields VARCHAR(255) NOT NULL, -- 瀛楁 - field_name VARCHAR(255) NOT NULL, -- 瀛楁鍚� + plan_id VARCHAR(255) NOT NULL, --鍏宠仈鐓よ川鏂规涓婚敭ID + coal_value VARCHAR(255) NOT NULL, -- 瀛楁鍊� + fields VARCHAR(255) NOT NULL, -- 瀛楁 + field_name VARCHAR(255) NOT NULL, -- 瀛楁鍚� + type VARCHAR(255) NOT NULL, -- 1 閲囪喘/ 2 姝e紡 鍏ュ簱 - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� - create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 琛ㄦ敞閲� @@ -24,6 +25,7 @@ COMMENT ON COLUMN coal_value.coal_value IS '瀛楁鍊�'; COMMENT ON COLUMN coal_value.fields IS '瀛楁'; COMMENT ON COLUMN coal_value.field_name IS '瀛楁鍚�'; +COMMENT ON COLUMN coal_value.type IS '1 閲囪喘/ 2 姝e紡 鍏ュ簱'; COMMENT ON COLUMN coal_value.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�'; COMMENT ON COLUMN coal_value.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛'; COMMENT ON COLUMN coal_value.create_time IS '璁板綍鍒涘缓鏃堕棿'; diff --git a/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java b/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java index 196e7ad..4dca675 100644 --- a/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java +++ b/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.business.dto.OfficialInventoryDto; +import com.ruoyi.business.entity.OfficialInventory; import com.ruoyi.business.service.OfficialInventoryService; import com.ruoyi.business.vo.OfficialInventoryVo; import com.ruoyi.common.core.domain.R; @@ -39,12 +40,20 @@ /** * 姝e紡搴撶叅绉嶉儴鍒嗕俊鎭痩ist */ - @GetMapping("/OfficialList") + @GetMapping("/officialList") public R<List<OfficialInventoryVo>> officialList(OfficialInventoryVo officialInventoryVo) { return R.ok(officialInventoryService.selectOfficialList(officialInventoryVo)); } /** + * 姝e紡搴撶叅绉嶇敓浜у姞宸ラ�夋嫨list + */ + @GetMapping("/officialAll") + public R<List<OfficialInventory>> officialAll() { + return R.ok(officialInventoryService.selectOfficialAll()); + } + + /** * 姝e紡搴撲慨鏀� */ @PostMapping("/editOfficial") diff --git a/main-business/src/main/java/com/ruoyi/business/dto/ProductionDto.java b/main-business/src/main/java/com/ruoyi/business/dto/ProductionDto.java index 942be24..2c73818 100644 --- a/main-business/src/main/java/com/ruoyi/business/dto/ProductionDto.java +++ b/main-business/src/main/java/com/ruoyi/business/dto/ProductionDto.java @@ -3,6 +3,12 @@ import com.ruoyi.business.entity.Production; import lombok.Data; +import java.util.List; + @Data public class ProductionDto extends Production { + + private List officialList; + + } diff --git a/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java b/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java index 7f5d55c..703bd29 100644 --- a/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java +++ b/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java @@ -46,7 +46,7 @@ * 鐓ょid */ @TableField(value = "coal_id") - private String coalId; + private Long coalId; /** * 鐓ょ */ @@ -61,7 +61,7 @@ * 搴撳瓨鏁伴噺 */ @TableField(value = "inventory_quantity") - private Long inventoryQuantity; + private BigDecimal inventoryQuantity; /** * 鍗曚綅 */ @@ -103,6 +103,11 @@ @TableField(value = "net_profit") private BigDecimal netProfit; /** + * 杩愯垂 + */ + @TableField(value = "freight") + private BigDecimal freight; + /** * 鐧昏浜篿d */ @TableField(value = "registrant_id") diff --git a/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java b/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java index 59b2bf3..392ef27 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java +++ b/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java @@ -26,4 +26,6 @@ int editOfficial(OfficialInventoryDto officialInventoryDto); List<OfficialInventoryVo> selectOfficialList(OfficialInventoryVo officialInventoryVo); + + List<OfficialInventory> selectOfficialAll(); } diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java index f964ab8..76ef631 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java +++ b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java @@ -125,6 +125,11 @@ .collect(Collectors.toList()); } + @Override + public List<OfficialInventory> selectOfficialAll() { + return officialInventoryMapper.selectList(null); + } + @Transactional @Override public int mergeAll(OfficialInventoryDto officialInventoryDto) { diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java index ae66aa0..118561a 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java +++ b/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java @@ -8,7 +8,9 @@ import com.ruoyi.basic.entity.Customer; import com.ruoyi.basic.mapper.CustomerMapper; import com.ruoyi.business.dto.SalesRecordDto; +import com.ruoyi.business.entity.OfficialInventory; import com.ruoyi.business.entity.SalesRecord; +import com.ruoyi.business.mapper.OfficialInventoryMapper; import com.ruoyi.business.mapper.SalesRecordMapper; import com.ruoyi.business.service.SalesRecordService; import com.ruoyi.common.core.domain.entity.SysUser; @@ -39,6 +41,8 @@ private final CustomerMapper customerMapper; + private final OfficialInventoryMapper officialInventoryMapper; + @Override public IPage<SalesRecord> selectSalesRecordList(Page page, SalesRecordDto salesRecordDto) { LambdaQueryWrapper<SalesRecord> queryWrapper = new LambdaQueryWrapper<>(); @@ -52,8 +56,20 @@ // 鍙傛暟鏍¢獙 validateSalesRecordDto(salesRecordDto); + // 鏇存柊姝e紡搴撳緟琛ュ簱鏁伴噺 + OfficialInventory officialInventory = officialInventoryMapper.selectById(salesRecordDto.getCoalId()); + if (officialInventory == null) { + throw new BaseException("姝e紡搴撶叅绉嶄俊鎭笉瀛樺湪"); + } + if (salesRecordDto.getSaleQuantity().compareTo(officialInventory.getInventoryQuantity()) > 0){ + throw new BaseException("閿�鍞暟閲忎笉鑳藉ぇ浜庡簱瀛樻暟閲�"); + } + officialInventory.setInventoryQuantity(officialInventory.getInventoryQuantity().subtract(salesRecordDto.getSaleQuantity())); + officialInventory.setPendingReplenishment(salesRecordDto.getSaleQuantity()); + officialInventoryMapper.updateById(officialInventory); + // 鏋勫缓閿�鍞褰曞疄浣� - SalesRecord salesRecord = buildSalesRecord(salesRecordDto); + SalesRecord salesRecord = buildSalesRecord(salesRecordDto,officialInventory.getCoal()); // 澶勭悊鏂板/鏇存柊閫昏緫 if (salesRecordDto.getId() == null) { @@ -73,9 +89,12 @@ if (dto.getCustomerId() == null) { throw new BaseException("瀹㈡埛ID涓嶈兘涓虹┖"); } + if (dto.getCoalId() == null) { + throw new BaseException("璇烽�夋嫨涓�鏉$叅绉嶄俊鎭�"); + } } - private SalesRecord buildSalesRecord(SalesRecordDto dto) { + private SalesRecord buildSalesRecord(SalesRecordDto dto,String coal) { SalesRecord record = new SalesRecord(); BeanUtils.copyProperties(dto, record); @@ -109,6 +128,9 @@ record.setRegistrationDate(existing.getRegistrationDate()); } + // 鐓ょ + record.setCoal(coal); + return record; } diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql b/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql index 4016199..92dd4e6 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql @@ -18,9 +18,9 @@ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 涓鸿〃娣诲姞娉ㄩ噴 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 b96e9f5..31bc9b2 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 @@ -16,9 +16,9 @@ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 娣诲姞琛ㄦ敞閲� 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 9ee25e8..37bbf2e 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,22 +1,21 @@ -- 鍒涘缓寰呭叆搴撹〃 CREATE TABLE pending_inventory ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID - supplier_name VARCHAR(255) NOT NULL, -- 渚涜揣鍟嗗悕绉� - coal_type 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, -- 鎬讳环锛堝惈绋庯級 - cost_per_unit 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 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, -- 鐧昏鏃堕棿 - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� - create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 ); -- 娣诲姞琛ㄦ敞閲� @@ -25,12 +24,11 @@ -- 娣诲姞瀛楁娉ㄩ噴 COMMENT ON COLUMN pending_inventory.id IS '涓婚敭ID'; COMMENT ON COLUMN pending_inventory.supplier_name IS '渚涜揣鍟嗗悕绉�'; -COMMENT ON COLUMN pending_inventory.coal_type IS '鐓ょ'; +COMMENT ON COLUMN pending_inventory.coal IS '鐓ょ'; COMMENT ON COLUMN pending_inventory.unit IS '鍗曚綅'; COMMENT ON COLUMN pending_inventory.inventory_quantity IS '搴撳瓨鏁伴噺'; COMMENT ON COLUMN pending_inventory.price_including_tax IS '鍗曚环锛堝惈绋庯級'; COMMENT ON COLUMN pending_inventory.total_price_including_tax IS '鎬讳环锛堝惈绋庯級'; -COMMENT ON COLUMN pending_inventory.cost_per_unit IS '鎴愭湰鍗曚环'; COMMENT ON COLUMN pending_inventory.registrant IS '鐧昏浜�'; COMMENT ON COLUMN pending_inventory.registration_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 3df2c94..94908ff 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 @@ -1,23 +1,26 @@ -- 鍒涘缓姝e紡搴撹〃 CREATE TABLE official_inventory ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID - supplier_name VARCHAR(255) NOT NULL, -- 渚涜揣鍟嗗悕绉� - coal_type 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, -- 鎬讳环锛堝惈绋庯級 - cost_per_unit DECIMAL(10, 2) NOT NULL, -- 鎴愭湰鍗曚环 - pending_replenishment DECIMAL(10, 2) NOT NULL, -- 寰呰ˉ搴� - registrant_id VARCHAR(50) NOT NULL, -- 鐧昏浜篿d - registration_date TIMESTAMP WITH TIME ZONE 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 DECIMAL(10, 2) NOT NULL, -- 搴撳瓨鏁伴噺 + price_including_tax DECIMAL(10, 2) NOT NULL, -- 鍗曚环锛堝惈绋庯級 + total_price_including_tax DECIMAL(10, 2) NOT NULL, -- 鎬讳环锛堝惈绋庯級 + price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 涓嶅惈绋庡崟浠� + total_price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 涓嶅惈绋庢�讳环 + pending_replenishment DECIMAL(10, 2) NOT NULL, -- 寰呰ˉ搴� + registrant_id VARCHAR(50) NOT NULL, -- 鐧昏浜篿d + type VARCHAR(50) NOT NULL, -- 鐧昏浜篿d + pending_id BIGINT, -- 寰呭叆搴搃d + registration_date TIMESTAMP WITHOUT TIME ZONE, - deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� - create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 + 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 ); -- 娣诲姞琛ㄦ敞閲� @@ -26,12 +29,11 @@ -- 娣诲姞瀛楁娉ㄩ噴 COMMENT ON COLUMN official_inventory.id IS '涓婚敭ID'; COMMENT ON COLUMN official_inventory.supplier_name IS '渚涜揣鍟嗗悕绉�'; -COMMENT ON COLUMN official_inventory.coal_type IS '鐓ょ'; +COMMENT ON COLUMN official_inventory.coal IS '鐓ょ'; COMMENT ON COLUMN official_inventory.unit IS '鍗曚綅'; COMMENT ON COLUMN official_inventory.inventory_quantity IS '搴撳瓨鏁伴噺'; COMMENT ON COLUMN official_inventory.price_including_tax IS '鍗曚环锛堝惈绋庯級'; COMMENT ON COLUMN official_inventory.total_price_including_tax IS '鎬讳环锛堝惈绋庯級'; -COMMENT ON COLUMN official_inventory.cost_per_unit IS '鎴愭湰鍗曚环'; 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 '鐧昏鏃ユ湡'; 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 ac435ff..b18e909 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 @@ -8,9 +8,9 @@ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 ); -- 琛ㄦ敞閲� 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 f820f42..7cd894a 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 @@ -9,9 +9,9 @@ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿-- 鐧昏鏃ユ湡 ); -- 琛ㄦ敞閲� diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql b/main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql index 4eb5921..4611ab6 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql @@ -11,8 +11,8 @@ file_type VARCHAR(50), -- 鏂囦欢绫诲瀷锛堝锛歩mage/png, application/pdf锛� file_size VARCHAR(50), -- 鏂囦欢澶у皬锛堝崟浣嶏細瀛楄妭锛� - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 涓婁紶鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + create_time TIMESTAMP WITHOUT TIME ZONE, -- 涓婁紶鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + update_time TIMESTAMP WITHOUT TIME ZONE, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 create_by VARCHAR(255), -- 涓婁紶浜虹敤鎴峰悕 update_by VARCHAR(255), -- 鏈�鍚庝慨鏀逛汉鐢ㄦ埛鍚� deleted INT NOT NULL DEFAULT 0 -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql b/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql index b963e59..082816e 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql @@ -1,31 +1,32 @@ -- 鍒涘缓閿�鍞褰曡〃 CREATE TABLE sales_record ( - id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID - sale_date DATE NOT NULL, -- 閿�鍞棩鏈� - customer_id BIGINT, -- 瀹㈡埛id - customer VARCHAR(255) NOT NULL, -- 瀹㈡埛 - coal_id VARCHAR(255) NOT NULL, -- 鐓ょ id - coal VARCHAR(255) NOT NULL, -- 鐓ょ - price_including_tax DECIMAL(10, 2) NOT NULL, -- 鍗曚环锛堝惈绋庯級 - inventory_quantity DECIMAL(10, 0) NOT NULL, -- 搴撳瓨鏁伴噺 - unit VARCHAR(100) NOT NULL, -- 鍗曚綅 - sale_quantity DECIMAL(10, 2) NOT NULL, -- 閿�鍞暟閲� - sale_price DECIMAL(10, 2) NOT NULL, -- 閿�鍞崟浠� (鍚◣) - total_amount DECIMAL(10, 2) NOT NULL, -- 閿�鍞�讳环 (鍚◣) - tax_coal VARCHAR(36), -- 璐攢鐓ょ◣鐜�13% - tax_trans VARCHAR(36), -- 杩愯緭绋庣巼9% - gross_profit DECIMAL(10, 2), -- 姣涘埄娑� - net_profit DECIMAL(10, 2), -- 鍑�鍒╂鼎 - registrant_id BIGINT, -- 鐧昏浜篿d - registrant VARCHAR(255) NOT NULL, -- 鐧昏浜� - registration_date DATE NOT NULL, -- 鐧昏鏃ユ湡 + id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID + sale_date DATE NOT NULL, -- 閿�鍞棩鏈� + customer_id BIGINT, -- 瀹㈡埛id + customer VARCHAR(255) NOT NULL, -- 瀹㈡埛 + coal_id VARCHAR(255) NOT NULL, -- 鐓ょ id + coal VARCHAR(255) NOT NULL, -- 鐓ょ + price_including_tax DECIMAL(10, 2) NOT NULL, -- 鍗曚环锛堝惈绋庯級 + inventory_quantity DECIMAL(10, 0) NOT NULL, -- 搴撳瓨鏁伴噺 + unit VARCHAR(100) NOT NULL, -- 鍗曚綅 + sale_quantity DECIMAL(10, 2) NOT NULL, -- 閿�鍞暟閲� + sale_price DECIMAL(10, 2) NOT NULL, -- 閿�鍞崟浠� (鍚◣) + total_amount DECIMAL(10, 2) NOT NULL, -- 閿�鍞�讳环 (鍚◣) + freight DECIMAL(10, 2) NOT NULL, -- 杩愯垂 + tax_coal VARCHAR(36), -- 璐攢鐓ょ◣鐜�13% + tax_trans VARCHAR(36), -- 杩愯緭绋庣巼9% + gross_profit DECIMAL(10, 2), -- 姣涘埄娑� + net_profit DECIMAL(10, 2), -- 鍑�鍒╂鼎 + registrant_id BIGINT, -- 鐧昏浜篿d + registrant VARCHAR(255) NOT NULL, -- 鐧昏浜� + registration_date DATE NOT NULL, -- 鐧昏鏃ユ湡 - create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 涓婁紶鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� - update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 - create_by VARCHAR(255), -- 涓婁紶浜虹敤鎴峰悕 - update_by VARCHAR(255), -- 鏈�鍚庝慨鏀逛汉鐢ㄦ埛鍚� - deleted INT NOT NULL DEFAULT 0 -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� + create_time TIMESTAMP WITHOUT TIME ZONE, -- 涓婁紶鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂� + update_time TIMESTAMP WITHOUT TIME ZONE, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿 + create_by VARCHAR(255), -- 涓婁紶浜虹敤鎴峰悕 + update_by VARCHAR(255), -- 鏈�鍚庝慨鏀逛汉鐢ㄦ埛鍚� + deleted INT NOT NULL DEFAULT 0 -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� ); -- 琛ㄦ敞閲� diff --git a/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml b/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml index 7fdf772..cc25283 100644 --- a/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml +++ b/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml @@ -28,7 +28,7 @@ create_time, update_by, update_time, - id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, pending_replenishment, registrant_id, registration_date + id, supplier_name, coal, unit, inventory_quantity, price_including_tax, total_price_including_tax, pending_replenishment, registrant_id, registration_date </sql> </mapper> \ No newline at end of file diff --git a/main-business/src/main/resources/mapper/PendingInventoryMapper.xml b/main-business/src/main/resources/mapper/PendingInventoryMapper.xml index c8d125e..5c503b8 100644 --- a/main-business/src/main/resources/mapper/PendingInventoryMapper.xml +++ b/main-business/src/main/resources/mapper/PendingInventoryMapper.xml @@ -27,7 +27,7 @@ create_time, update_by, update_time, - id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, registrant, registration_time + id, supplier_name, coal, unit, inventory_quantity, price_including_tax, total_price_including_tax, registrant, registration_time </sql> </mapper> \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql b/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql index 0062192..2a01533 100644 --- a/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql +++ b/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql @@ -16,9 +16,9 @@ status CHAR(1) DEFAULT '0', -- 閮ㄩ棬鐘舵�侊紙0姝e父 1鍋滅敤锛� del_flag CHAR(1) DEFAULT '0', -- 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� create_by VARCHAR(64) DEFAULT '', -- 鍒涘缓鑰� - create_time TIMESTAMP, -- 鍒涘缓鏃堕棿 + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿 update_by VARCHAR(64) DEFAULT '', -- 鏇存柊鑰� - update_time TIMESTAMP -- 鏇存柊鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE -- 鏇存柊鏃堕棿 ); COMMENT ON TABLE sys_dept IS '閮ㄩ棬琛�'; @@ -86,9 +86,9 @@ login_ip VARCHAR(128) DEFAULT '', -- 鏈�鍚庣櫥褰旾P login_date TIMESTAMP, -- 鏈�鍚庣櫥褰曟椂闂� create_by VARCHAR(64) DEFAULT '', -- 鍒涘缓鑰� - create_time TIMESTAMP, -- 鍒涘缓鏃堕棿 + create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿 update_by VARCHAR(64) DEFAULT '', -- 鏇存柊鑰� - update_time TIMESTAMP, -- 鏇存柊鏃堕棿 + update_time TIMESTAMP WITHOUT TIME ZONE, -- 鏇存柊鏃堕棿 remark VARCHAR(500) DEFAULT NULL -- 澶囨敞 ); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/MyBaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/MyBaseEntity.java index e819ecb..ab2a5f7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/MyBaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/MyBaseEntity.java @@ -1,13 +1,14 @@ package com.ruoyi.common.core.domain; import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableLogic; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; -import java.time.OffsetDateTime; +import java.time.LocalDateTime; @Data public class MyBaseEntity implements Serializable { @@ -23,8 +24,8 @@ /** 鍒涘缓鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT) - private OffsetDateTime createTime; + @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER) + private LocalDateTime createTime; /** 鏇存柊鑰� */ @TableField(fill = FieldFill.INSERT_UPDATE) @@ -33,5 +34,5 @@ /** 鏇存柊鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) - private OffsetDateTime updateTime; + private LocalDateTime updateTime; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java b/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java index 81c6558..1ec12de 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java @@ -5,44 +5,32 @@ import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; -import java.time.OffsetDateTime; +import java.time.LocalDateTime; @Component public class MyMetaObjectHandler implements MetaObjectHandler { @Override - public void insertFill(MetaObject metaObject) { - // 鍒ゆ柇瀛楁鏄惁瀛樺湪锛屽瓨鍦ㄦ墠濉厖 - if (metaObject.hasSetter("createBy")) { - Long userId; - try { - if (SecurityUtils.getLoginUser() != null) { - userId = SecurityUtils.getLoginUser().getUserId(); - this.strictInsertFill(metaObject, "createBy", String.class, userId.toString()); - } - } catch (Exception ignored) { - } + public void insertFill(MetaObject meta) { + LocalDateTime now = LocalDateTime.now(); + Long uid = SecurityUtils.getLoginUser().getUserId(); + if (uid != null) { + strictInsertFill(meta, "createBy", String.class, uid.toString()); + strictInsertFill(meta, "updateBy", String.class, uid.toString()); } - - if (metaObject.hasSetter("createTime")) { - this.strictInsertFill(metaObject, "createTime", OffsetDateTime.class, OffsetDateTime.now()); - } - - if (metaObject.hasSetter("updateTime")) { - this.strictUpdateFill(metaObject, "updateTime", OffsetDateTime.class, OffsetDateTime.now()); - } + strictInsertFill(meta, "createTime", LocalDateTime.class, now); + strictInsertFill(meta, "updateTime", LocalDateTime.class, now); } @Override - public void updateFill(MetaObject metaObject) { - // 鍒ゆ柇瀛楁鏄惁瀛樺湪锛屽瓨鍦ㄦ墠濉厖 - if (metaObject.hasSetter("updateBy")) { - Long userId = SecurityUtils.getLoginUser().getUserId(); - this.strictUpdateFill(metaObject, "updateBy", String.class, userId.toString()); + public void updateFill(MetaObject meta) { + LocalDateTime now = LocalDateTime.now(); + Long uid = SecurityUtils.getLoginUser().getUserId(); + if (uid != null) { + strictUpdateFill(meta, "updateBy", String.class, uid.toString()); } - - if (metaObject.hasSetter("updateTime")) { - this.strictUpdateFill(metaObject, "updateTime", OffsetDateTime.class, OffsetDateTime.now()); - } + // 寮哄埗瑕嗙洊 updateTime + setFieldValByName("updateTime", now, meta); } + } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/basic/entity/City.java b/ruoyi-system/src/main/java/com/ruoyi/basic/entity/City.java index 3b3a350..67f4cb8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/basic/entity/City.java +++ b/ruoyi-system/src/main/java/com/ruoyi/basic/entity/City.java @@ -6,7 +6,6 @@ import java.io.Serializable; import java.time.LocalDateTime; -import java.time.OffsetDateTime; /** * 鍩庡競琛� 瀹炰綋绫� @@ -39,10 +38,10 @@ /** 鍒涘缓鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT) - private OffsetDateTime createTime; + private LocalDateTime createTime; /** 鏇存柊鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) - private OffsetDateTime updateTime; + private LocalDateTime updateTime; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/basic/entity/District.java b/ruoyi-system/src/main/java/com/ruoyi/basic/entity/District.java index bb2f20d..2ecfa27 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/basic/entity/District.java +++ b/ruoyi-system/src/main/java/com/ruoyi/basic/entity/District.java @@ -6,7 +6,6 @@ import java.io.Serializable; import java.time.LocalDateTime; -import java.time.OffsetDateTime; /** * 鍖鸿〃 瀹炰綋绫� @@ -39,10 +38,10 @@ /** 鍒涘缓鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT) - private OffsetDateTime createTime; + private LocalDateTime createTime; /** 鏇存柊鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) - private OffsetDateTime updateTime; + private LocalDateTime updateTime; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/basic/entity/Province.java b/ruoyi-system/src/main/java/com/ruoyi/basic/entity/Province.java index 592a2a9..4ba71d6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/basic/entity/Province.java +++ b/ruoyi-system/src/main/java/com/ruoyi/basic/entity/Province.java @@ -6,7 +6,6 @@ import java.io.Serializable; import java.time.LocalDateTime; -import java.time.OffsetDateTime; /** * 鐪佽〃 瀹炰綋绫� @@ -34,10 +33,10 @@ /** 鍒涘缓鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT) - private OffsetDateTime createTime; + private LocalDateTime createTime; /** 鏇存柊鏃堕棿 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) - private OffsetDateTime updateTime; + private LocalDateTime updateTime; } \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102200__create_province.sql b/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102200__create_province.sql index 2dd8e10..8b02d7d 100644 --- a/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102200__create_province.sql +++ b/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102200__create_province.sql @@ -3,8 +3,8 @@ CREATE TABLE province ( id bigserial PRIMARY KEY, - create_time timestamp with time zone NOT NULL, - update_time timestamp with time zone NOT NULL, + create_time TIMESTAMP WITHOUT TIME ZONE, + update_time TIMESTAMP WITHOUT TIME ZONE, name varchar(100) DEFAULT '' NOT NULL ); diff --git a/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102300__create_city.sql b/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102300__create_city.sql index 4423191..c0bd0db 100644 --- a/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102300__create_city.sql +++ b/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102300__create_city.sql @@ -3,8 +3,8 @@ CREATE TABLE city ( id bigserial PRIMARY KEY, - create_time timestamp with time zone NOT NULL, - update_time timestamp with time zone NOT NULL, + create_time TIMESTAMP WITHOUT TIME ZONE, + update_time TIMESTAMP WITHOUT TIME ZONE, name varchar(100) DEFAULT '' NOT NULL, province_id bigint DEFAULT 0 NOT NULL ); diff --git a/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102500__create_district.sql b/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102500__create_district.sql index 75414aa..ac9807b 100644 --- a/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102500__create_district.sql +++ b/ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102500__create_district.sql @@ -3,8 +3,8 @@ CREATE TABLE district ( id bigserial PRIMARY KEY, - create_time timestamp with time zone NOT NULL, - update_time timestamp with time zone NOT NULL, + create_time TIMESTAMP WITHOUT TIME ZONE, + update_time TIMESTAMP WITHOUT TIME ZONE, name varchar(100) DEFAULT '' NOT NULL, city_id bigint DEFAULT 0 NOT NULL ); -- Gitblit v1.9.3