liding
3 天以前 c0cf736ff001bbaec59b7da6239f4670464952fd
1.销售模块 2.时区优化
已修改33个文件
238 ■■■■■ 文件已修改
basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/db/migration/postgresql/V20250530152701__create_table_supply.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/db/migration/postgresql/V20250530171701__create_table_customer.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/db/migration/postgresql/V20250603102701__create_table_coal_info.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/ProductionDto.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250610161312__create_table_tree.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250610161313__create_table_archive.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/mapper/OfficialInventoryMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/mapper/PendingInventoryMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/MyBaseEntity.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/basic/entity/City.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/basic/entity/District.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/basic/entity/Province.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102200__create_province.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102300__create_city.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/db/migration/postgresql/V20250531102500__create_district.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -46,7 +46,7 @@
    }
    /**
     * 新增修改
     * 客户新增修改
     */
    @PostMapping("/addOrEditCustomer")
    public R addOrEditSupply(@RequestBody CustomerDto customerDto) {
basic-server/src/main/java/com/ruoyi/basic/controller/SupplyController.java
@@ -38,7 +38,7 @@
    }
    /**
     * 供应商
     * 供应商list
     */
    @GetMapping("/supplyList")
    public R<List<Supply>> list() {
@@ -46,7 +46,7 @@
    }
    /**
     * 新增修改
     * 供应商新增修改
     */
    @PostMapping("/addOrEditSupply")
    public R addOrEditSupply(@RequestBody SupplyDto supplyDto) {
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,                 -- 联系地址区id
    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)                                        -- 联系人电话
);
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 '客户唯一标识,主键';
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  -- 最后更新时间,默认当前时间
);
-- 为表添加注释
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  -- 最后更新时间,默认当前时间
);
-- 表注释
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 '记录创建时间';
basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql
@@ -7,12 +7,13 @@
    coal_value  VARCHAR(255) NOT NULL,                              -- 字段值
    fields      VARCHAR(255) NOT NULL,                              -- 字段
    field_name  VARCHAR(255) NOT NULL,                              -- 字段名
    type        VARCHAR(255) NOT NULL,           -- 1 采购/ 2 正式   入库
    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      -- 最后更新时间,默认当前时间
);
-- 表注释
@@ -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 正式   入库';
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 '记录创建时间';
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 @@
    /**
     * 正式库煤种部分信息list
     */
    @GetMapping("/OfficialList")
    @GetMapping("/officialList")
    public R<List<OfficialInventoryVo>> officialList(OfficialInventoryVo officialInventoryVo) {
        return R.ok(officialInventoryService.selectOfficialList(officialInventoryVo));
    }
    /**
     * 正式库煤种生产加工选择list
     */
    @GetMapping("/officialAll")
    public R<List<OfficialInventory>> officialAll() {
        return R.ok(officialInventoryService.selectOfficialAll());
    }
    /**
     * 正式库修改
     */
    @PostMapping("/editOfficial")
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;
}
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;
    /**
     * 登记人id
     */
    @TableField(value = "registrant_id")
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();
}
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) {
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);
        // 更新正式库待补库数量
        OfficialInventory officialInventory = officialInventoryMapper.selectById(salesRecordDto.getCoalId());
        if (officialInventory == null) {
            throw new BaseException("正式库煤种信息不存在");
        }
        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;
    }
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  -- 最后更新时间,默认当前时间
);
-- 为表添加注释
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  -- 最后更新时间,默认当前时间
);
-- 添加表注释
main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql
@@ -3,20 +3,19 @@
(
    id                        BIGSERIAL PRIMARY KEY,                                 -- 主键ID
    supplier_name             VARCHAR(255)   NOT NULL,                            -- 供货商名称
    coal_type                 VARCHAR(50)    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,                            -- 总价(含税)
    cost_per_unit             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, -- 创建时间,默认当前时间
    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                        -- 最后更新时间,默认当前时间
);
-- 添加表注释
@@ -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 '登记时间';
main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
@@ -3,21 +3,24 @@
(
    id                         BIGSERIAL PRIMARY KEY,                                 -- 主键ID
    supplier_name              VARCHAR(255)   NOT NULL,                            -- 供货商名称
    coal_type                  VARCHAR(50)    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,                            -- 总价(含税)
    cost_per_unit              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,                            -- 登记人id
    registration_date          TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    type             VARCHAR(50)    NOT NULL,           -- 登记人id
    pending_id                BIGINT,                            -- 待入库id
    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, -- 创建时间,默认当前时间
    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        -- 最后更新时间,默认当前时间-- 登记日期
);
-- 添加表注释
@@ -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 '登记人id';
COMMENT ON COLUMN official_inventory.registration_date IS '登记日期';
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  -- 最后更新时间,默认当前时间-- 登记日期
);
-- 表注释
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  -- 最后更新时间,默认当前时间-- 登记日期
);
-- 表注释
main-business/src/main/resources/db/migration/postgresql/V20250610161314__create_table_file.sql
@@ -11,8 +11,8 @@
    file_type     VARCHAR(50),                                        -- 文件类型(如:image/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=已删除
main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql
@@ -13,6 +13,7 @@
    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),                                     -- 毛利润
@@ -21,8 +22,8 @@
    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_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=已删除
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>
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>
ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql
@@ -16,9 +16,9 @@
    status      CHAR(1)     DEFAULT '0',  -- 部门状态(0正常 1停用)
    del_flag    CHAR(1)     DEFAULT '0',  -- 删除标志(0代表存在 2代表删除)
    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 '',   -- 最后登录IP
    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  -- 备注
);
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;
}
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());
    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());
                }
            } catch (Exception ignored) {
            }
        }
        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());
        }
        // 强制覆盖 updateTime
        setFieldValByName("updateTime", now, meta);
        }
        if (metaObject.hasSetter("updateTime")) {
            this.strictUpdateFill(metaObject, "updateTime", OffsetDateTime.class, OffsetDateTime.now());
        }
    }
}
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;
}
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;
}
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;
}
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
);
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
);
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
);