9 小时以前 2b8f88856e90e530ddbfce88aea107a0ec894d5d
yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/tender/SrmTenderBidServiceImpl.java
@@ -88,12 +88,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 +131,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) {