liding
14 小时以前 cb966ac5c02835eab5a99b7b93a5a9a063cf3201
人员优化
已修改11个文件
63 ■■■■ 文件已修改
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/Production.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/ArchiveServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/TreeServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java
@@ -43,4 +43,6 @@
     * 煤种
     */
    private String coal;
    private String registrant;
}
main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.MyBaseEntity;
import lombok.Data;
@@ -81,10 +82,11 @@
     * 登记人
     */
    @TableField(value = "registrant_id")
    private String registrantId;
    private Long registrantId;
    /**
     * 登记日期
     */
    @TableField(value = "registration_date")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate registrationDate;
}
main-business/src/main/java/com/ruoyi/business/entity/Production.java
@@ -76,7 +76,7 @@
     * 生产人ID
     */
    @TableField(value = "producer_id")
    private String producerId;
    private Long producerId;
    /**
     * 生产日期
     */
main-business/src/main/java/com/ruoyi/business/service/impl/ArchiveServiceImpl.java
@@ -57,6 +57,9 @@
        // 1. 分页查询主数据
        LambdaQueryWrapper<Archive> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(Archive::getCreateTime);
        if (archiveDto.getTreeId() != null) {
            queryWrapper.eq(Archive::getTreeId, archiveDto.getTreeId());
        }
        IPage<Archive> archivePage = archiveMapper.selectPage(page, queryWrapper);
        // 2. 无数据提前返回
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
@@ -20,8 +20,10 @@
import com.ruoyi.business.service.InputInventoryRecordService;
import com.ruoyi.business.service.InventorySummaryService;
import com.ruoyi.business.service.PendingInventoryService;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -52,6 +54,8 @@
    private final CoalFieldMapper coalFieldMapper;
    private final CoalInfoMapper coalInfoMapper;
    private final SysUserMapper sysUserMapper;
    private final InputInventoryRecordService inputInventoryRecordService;
@@ -91,6 +95,20 @@
            coalInfoMap = new HashMap<>();
        }
        // 5. 批量查询登记人id
        List<Long> registrantIds = pendingInventoryPage.getRecords().stream()
                .map(PendingInventory::getRegistrantId)
                .distinct()
                .toList();
        // 批量查询登记人
        Map<Long, SysUser> sysUserMap;
        if (!registrantIds.isEmpty()) {
            List<SysUser> sysUsers = sysUserMapper.selectList(registrantIds);
            sysUserMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity()));
        } else {
            sysUserMap = new HashMap<>();
        }
        // 批量查询正式库存信息
        Map<Long, Long> pendingToOfficialMap = getOfficialInventoryMap(pendingIds);
@@ -105,6 +123,12 @@
                dto.setCoal(coalInfo.getCoal());
            }
            // 设置登记人
            SysUser sysUser = sysUserMap.get(record.getRegistrantId());
            if (sysUser != null) {
                dto.setRegistrant(sysUser.getNickName());
            }
            // 从预加载的Map中获取officialId
            dto.setOfficialId(pendingToOfficialMap.getOrDefault(record.getId(), null));
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
@@ -5,7 +5,6 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.entity.CoalInfo;
import com.ruoyi.basic.mapper.CoalInfoMapper;
import com.ruoyi.business.dto.ProductionMasterDto;
import com.ruoyi.business.entity.*;
@@ -18,6 +17,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@@ -211,8 +211,6 @@
            coalIds.add(p.getCoalId());
        }
        List<CoalInfo> coalInfos = coalInfoMapper.selectList(new LambdaQueryWrapper<CoalInfo>().in(CoalInfo::getId, coalIds));
        ProductionMaster master = new ProductionMaster();
        master.setProductionQuantity(totalQuantity);
        master.setTotalCost(totalCost);
@@ -263,7 +261,8 @@
            pending.setSupplierName("生产加工入库");
            pending.setTotalPriceIncludingTax(p.getTotalCost());
            pending.setPriceIncludingTax(p.getPurchasePrice());
            pending.setPriceIncludingTax(p.getPurchasePrice());
            pending.setRegistrantId(p.getProducerId());
            pending.setRegistrationDate(LocalDate.now());
            pendingInventoryMapper.insert(pending);
        }
    }
main-business/src/main/java/com/ruoyi/business/service/impl/TreeServiceImpl.java
@@ -33,6 +33,7 @@
    public List<TreeVo> selectTreeList(TreeDto treeDto) {
        // 查询根节点(parentId 为 null)
        LambdaQueryWrapper<Tree> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(Tree::getCreateTime);
        queryWrapper.isNull(Tree::getParentId);
        // 如果有产品名称条件,添加到查询中
main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
@@ -10,7 +10,7 @@
    equipment_depreciation  DECIMAL(10, 2) NOT NULL,           -- 设备折旧
    purchase_price          DECIMAL(10, 2) NOT NULL,           -- 采购单价
    total_cost              DECIMAL(10, 2) NOT NULL,           -- 总成本
    producer_id             VARCHAR(50),                       -- 生产人id
    producer_id             BIGINT,                       -- 生产人id
    producer                VARCHAR(50),                       -- 生产人
    production_date         DATE,                              -- 生产日期
main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql
@@ -12,7 +12,7 @@
    registration_time         TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP, -- 登记时间
    price_excluding_tax       VARCHAR(255),                           -- 单价(不含税)
    total_price_excluding_tax VARCHAR(255),                           -- 总价(不含税)
    registrant_id             VARCHAR(32),                            -- 登记人ID
    registrant_id             BIGINT,                                 -- 登记人ID
    registration_date         DATE,                                   -- 登记日期
    supplier_id               BIGINT,                                 -- 供货商ID
    coal_id                   BIGINT,                                 -- 煤种ID
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -129,4 +129,6 @@
     * 查询所有用户
     */
    List<SysUser> selectUserListAll();
    List<SysUser> selectList(List<Long> registrantIds);
}
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -144,6 +144,20 @@
    <select id="selectUserListAll" resultType="com.ruoyi.common.core.domain.entity.SysUser">
        select user_id, nick_name from sys_user where del_flag = '0'
    </select>
    <select id="selectList" resultType="com.ruoyi.common.core.domain.entity.SysUser">
        SELECT user_id, nick_name FROM sys_user
        <where>
            <if test="list != null and list.size() > 0">
                user_id IN
                <foreach item="id" collection="list" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            <if test="list == null or list.size() == 0">
                1=0  <!-- 空列表时返回空结果 -->
            </if>
        </where>
    </select>
    <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
         insert into sys_user(