| | |
| | | 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) { |
| | |
| | | @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) { |