|
|
@@ -1,8 +1,10 @@
|
|
|
package com.usoftchina.saas.purchase.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.netflix.discovery.converters.Auto;
|
|
|
+import com.rabbitmq.tools.json.JSONUtil;
|
|
|
import com.usoftchina.saas.account.dto.CompanyDTO;
|
|
|
import com.usoftchina.saas.commons.cache.ConfigsCache;
|
|
|
import com.usoftchina.saas.document.api.AddressApi;
|
|
|
@@ -54,6 +56,7 @@ import com.usoftchina.saas.transfers.dto.MessageInfo;
|
|
|
import com.usoftchina.saas.utils.BeanMapper;
|
|
|
import com.usoftchina.saas.utils.CollectionUtils;
|
|
|
import com.usoftchina.saas.utils.JsonUtils;
|
|
|
+import feign.Response;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -61,6 +64,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.Reader;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
@@ -895,10 +900,28 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
|
|
|
public void DealInquiry(InquiryDealReqDTO inquiryDealReqDTO) {
|
|
|
Long enUU = companyApi.getCompanyById(BaseContextHolder.getCompanyId()).getData().getUu();
|
|
|
Long userUU = accountApi.getAccountById(BaseContextHolder.getUserId()).getData().getUu();
|
|
|
+ Response response = null;
|
|
|
if (inquiryDealReqDTO.getStatus() == 1){
|
|
|
- inquiryApi.adoptQuote(inquiryDealReqDTO.getId(), inquiryDealReqDTO.getStatus(), enUU, userUU);
|
|
|
+ response = inquiryApi.adoptQuote(inquiryDealReqDTO.getId(), inquiryDealReqDTO.getStatus(), enUU, userUU);
|
|
|
}else{
|
|
|
- inquiryApi.refuseQuote(inquiryDealReqDTO.getId(), inquiryDealReqDTO.getStatus(), enUU, userUU, inquiryDealReqDTO.getRefusereason());
|
|
|
+ response = inquiryApi.refuseQuote(inquiryDealReqDTO.getId(), inquiryDealReqDTO.getStatus(), enUU, userUU, inquiryDealReqDTO.getRefusereason());
|
|
|
+ }
|
|
|
+ if (response.status() == 500){
|
|
|
+ try {
|
|
|
+ Reader reader = response.body().asReader();
|
|
|
+ int size = response.body().length();
|
|
|
+ char[] ch = new char[size];
|
|
|
+ int temp = 0, len = 0;
|
|
|
+ while ((temp = reader.read()) != -1){
|
|
|
+ ch[len] = (char) temp;
|
|
|
+ len++;
|
|
|
+ }
|
|
|
+ reader.close();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(new String(ch));
|
|
|
+ throw new BizException(79320, jsonObject.getString("message"));
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|