|
|
@@ -38,6 +38,9 @@ import com.usoftchina.saas.purchase.service.ProdInOutService;
|
|
|
import com.usoftchina.saas.purchase.service.PurchaseService;
|
|
|
import com.usoftchina.saas.utils.BeanMapper;
|
|
|
import com.usoftchina.saas.utils.CollectionUtils;
|
|
|
+import com.usoftchina.saas.utils.JsonUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -45,6 +48,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -81,6 +85,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
@Autowired
|
|
|
private AccountApi accountApi;
|
|
|
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(PurchaseServiceImpl.class);
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<PurchaseList> getListData(PageRequest page, ListReqDTO req) {
|
|
|
@@ -758,8 +763,25 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
purcInquiry.setInquiryItems(purcInquiryItemSet);
|
|
|
purcInquiryList.add(purcInquiry);
|
|
|
}
|
|
|
- //调用商城ap,保存询价
|
|
|
-
|
|
|
+ //开启线程调用商城ap,保存询价
|
|
|
+ int length = purcInquiryList.size();
|
|
|
+ CountDownLatch latch = new CountDownLatch(length);
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
+ PurcInquiry purcInquiry = purcInquiryList.get(i);
|
|
|
+ new Thread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ inquiryApi.saveInquiry(purcInquiry);
|
|
|
+ latch.countDown();
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ latch.await();
|
|
|
+ LOGGER.info("发起询价,成功,传入数据: {}", JsonUtils.toJsonString(inquiryAddDTOList));
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|