|
|
|
@ -252,6 +252,8 @@ public class QuoteServiceImpl extends ServiceImpl<QuoteMapper, Quote> implements |
|
|
|
@Transactional |
|
|
|
public List<Long> batchSaveQuoteByQuotation(List<QuotationInformationVo> list) { |
|
|
|
List<Long> ids = new ArrayList<>();// 获取保存成功的报价单ID |
|
|
|
// 按 site 缓存下一个可用报价序号,避免批量处理时重复扫描 plm_quote 获取最大号 |
|
|
|
Map<String, Integer> siteNextQuoteNoMap = new HashMap<>(); |
|
|
|
for (QuotationInformationVo quotation : list) { |
|
|
|
if (Objects.isNull(quotation.getCurrency())){ |
|
|
|
throw new RuntimeException("币种不能为空"); |
|
|
|
@ -278,8 +280,16 @@ public class QuoteServiceImpl extends ServiceImpl<QuoteMapper, Quote> implements |
|
|
|
quote.setCreateDate(new Date()); |
|
|
|
quote.setQuoteDate(new Date()); |
|
|
|
// quote.setCustomerInquiryNo(quotation.getCustomer()); |
|
|
|
// 2、获取报价单号 |
|
|
|
String quoteNo = Constant.BJ+baseMapper.queryQuoteNo(quote); |
|
|
|
// 2、获取报价单号(按站点批量缓存起始号,循环内递增) |
|
|
|
Integer nextQuoteNo = siteNextQuoteNoMap.get(quote.getSite()); |
|
|
|
if (Objects.isNull(nextQuoteNo)) { |
|
|
|
Quote seedQuote = new Quote(); |
|
|
|
seedQuote.setSite(quote.getSite()); |
|
|
|
String quoteNoSeed = baseMapper.queryQuoteNo(seedQuote); |
|
|
|
nextQuoteNo = StringUtils.hasText(quoteNoSeed) ? Integer.parseInt(quoteNoSeed) : 1; |
|
|
|
} |
|
|
|
String quoteNo = Constant.BJ + String.format("%08d", nextQuoteNo); |
|
|
|
siteNextQuoteNoMap.put(quote.getSite(), nextQuoteNo + 1); |
|
|
|
quote.setQuoteNo(quoteNo); |
|
|
|
quote.setVersionNo("A001"); |
|
|
|
quote.setQuoteVersionNo(quote.getQuoteNo() + "-" + quote.getVersionNo()); |
|
|
|
|