| | |
| | | @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(); |
| | | } |
| | |
| | | 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) { |