8 小时以前 db46314b9c56256a31c9114bd45d9bd63368cbd8
yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/tender/SrmTenderBidServiceImpl.java
@@ -51,6 +51,10 @@
        if (!supplierApplyMapper.existsApprovedBySupplierId(createReqVO.getSupplierId())) {
            throw ServiceExceptionUtil.exception(ErrorCodeConstants.BID_SUPPLIER_NOT_APPROVED);
        }
        // 校验投标编号是否重复
        if (tenderBidMapper.existsByBidNo(createReqVO.getBidNo())) {
            throw ServiceExceptionUtil.exception(ErrorCodeConstants.BID_NO_EXISTS);
        }
        // 校验供应商是否已参与投标
        SrmTenderBidDO existing = tenderBidMapper.selectByTenderAndSupplier(createReqVO.getTenderProjectId(), createReqVO.getSupplierId());
        if (existing != null) {
@@ -88,12 +92,15 @@
    @Override
    public Long createQuote(SrmSupplierQuoteSaveReqVO createReqVO) {
        // 校验投标状态(撤标后不允许报价)
        validateBidNotWithdrawn(createReqVO.getBidId());
        SrmTenderBidDO bid = validateBidNotWithdrawn(createReqVO.getBidId());
        // 校验同一投标下物料不可重复报价
        if (supplierQuoteMapper.existsByBidAndMaterial(createReqVO.getBidId(), createReqVO.getTenderMaterialId())) {
            throw ServiceExceptionUtil.exception(ErrorCodeConstants.QUOTE_MATERIAL_DUPLICATE);
        }
        SrmSupplierQuoteDO quote = BeanUtils.toBean(createReqVO, SrmSupplierQuoteDO.class);
        // 从投标记录中获取招标项目ID和供应商ID,避免前端遗漏导致数据库约束失败
        quote.setTenderProjectId(bid.getTenderProjectId());
        quote.setSupplierId(bid.getSupplierId());
        supplierQuoteMapper.insert(quote);
        return quote.getId();
    }
@@ -128,11 +135,12 @@
        return bid;
    }
    private void validateBidNotWithdrawn(Long bidId) {
    private SrmTenderBidDO validateBidNotWithdrawn(Long bidId) {
        SrmTenderBidDO bid = validateBidExists(bidId);
        if (BidStatusEnum.WITHDRAWN.getCode().equals(bid.getBidStatus())) {
            throw ServiceExceptionUtil.exception(ErrorCodeConstants.BID_WITHDRAWN_CANNOT_QUOTE);
        }
        return bid;
    }
    private void validateTenderStatus(Long tenderProjectId) {