|
@@ -723,7 +723,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
* @param inquiryAddDTOList
|
|
* @param inquiryAddDTOList
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public void saveInquiry(List<InquiryAddDTO> inquiryAddDTOList) {
|
|
|
|
|
|
|
+ public List<Map<String, String>> saveInquiry(List<InquiryAddDTO> inquiryAddDTOList) {
|
|
|
List<PurcInquiry> purcInquiryList = new ArrayList<PurcInquiry>();
|
|
List<PurcInquiry> purcInquiryList = new ArrayList<PurcInquiry>();
|
|
|
CompanyRspDTO companyRspDTO = companyApi.getCompanyRspDTOById(BaseContextHolder.getCompanyId()).getData();
|
|
CompanyRspDTO companyRspDTO = companyApi.getCompanyRspDTOById(BaseContextHolder.getCompanyId()).getData();
|
|
|
AccountDTO accountDTO = accountApi.getAccountById(BaseContextHolder.getUserId()).getData();
|
|
AccountDTO accountDTO = accountApi.getAccountById(BaseContextHolder.getUserId()).getData();
|
|
@@ -739,6 +739,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
PurcInquiry purcInquiry = new PurcInquiry();
|
|
PurcInquiry purcInquiry = new PurcInquiry();
|
|
|
//询价主表信息
|
|
//询价主表信息
|
|
|
purcInquiry.setEnterprise(enterprise);
|
|
purcInquiry.setEnterprise(enterprise);
|
|
|
|
|
+ purcInquiry.setEnUU(companyRspDTO.getUu());
|
|
|
purcInquiry.setEnName(companyRspDTO.getName());
|
|
purcInquiry.setEnName(companyRspDTO.getName());
|
|
|
purcInquiry.setRecorderUU(accountDTO.getUu());
|
|
purcInquiry.setRecorderUU(accountDTO.getUu());
|
|
|
purcInquiry.setDate(new Date());
|
|
purcInquiry.setDate(new Date());
|
|
@@ -766,22 +767,33 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
//开启线程调用商城ap,保存询价
|
|
//开启线程调用商城ap,保存询价
|
|
|
int length = purcInquiryList.size();
|
|
int length = purcInquiryList.size();
|
|
|
CountDownLatch latch = new CountDownLatch(length);
|
|
CountDownLatch latch = new CountDownLatch(length);
|
|
|
|
|
+ List<Map<String, String>> result = new ArrayList<Map<String, String>>(); //失败数据
|
|
|
for (int i = 0; i < length; i++) {
|
|
for (int i = 0; i < length; i++) {
|
|
|
PurcInquiry purcInquiry = purcInquiryList.get(i);
|
|
PurcInquiry purcInquiry = purcInquiryList.get(i);
|
|
|
new Thread(new Runnable() {
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
|
- inquiryApi.saveInquiry(purcInquiry);
|
|
|
|
|
- latch.countDown();
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ inquiryApi.saveInquiry(purcInquiry);
|
|
|
|
|
+ latch.countDown();
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ LOGGER.info("发起询价,失败,传入数据: {}, 失败原因: {}", JsonUtils.toJsonString(purcInquiry), e.getMessage());
|
|
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
+ map.put("errCode", purcInquiry.getInquiryItems().iterator().next().getProdCode());
|
|
|
|
|
+ result.add(map);
|
|
|
|
|
+ latch.countDown();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}).start();
|
|
}).start();
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
latch.await();
|
|
latch.await();
|
|
|
- LOGGER.info("发起询价,成功,传入数据: {}", JsonUtils.toJsonString(inquiryAddDTOList));
|
|
|
|
|
|
|
+ LOGGER.info("发起询价,处理完成,传入数据: {}", JsonUtils.toJsonString(inquiryAddDTOList));
|
|
|
|
|
+ return result;
|
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|