|
@@ -13,8 +13,10 @@ import com.diagbot.service.impl.InquiryDetailServiceImpl;
|
|
|
import com.diagbot.service.impl.InquiryInfoServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.SaveInquiryVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -47,7 +49,15 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
|
|
|
public SaveInquiryDTO saveInquiry(SaveInquiryVO saveInquiryVO) {
|
|
|
SaveInquiryDTO saveInquiryDTO = new SaveInquiryDTO();
|
|
|
- String retUrl = getUrl(saveInquiryVO);
|
|
|
+ List<String> naliRetList = getUrl(saveInquiryVO);
|
|
|
+ String retUrl = naliRetList.get(0);
|
|
|
+ saveInquiryDTO.setBody(retUrl);
|
|
|
+ saveInquiryDTO.setResponse(naliRetList.get(1));
|
|
|
+
|
|
|
+ if (StringUtil.isBlank(retUrl)){
|
|
|
+ return saveInquiryDTO;
|
|
|
+ }
|
|
|
+
|
|
|
Date now = DateUtil.now();
|
|
|
|
|
|
InquiryInfo inquiryInfo = new InquiryInfo();
|
|
@@ -65,26 +75,26 @@ public class InquiryInfoFacade extends InquiryInfoServiceImpl {
|
|
|
});
|
|
|
inquiryDetailService.saveBatch(inquiryDetailList);
|
|
|
|
|
|
- saveInquiryDTO.setBody(retUrl);
|
|
|
return saveInquiryDTO;
|
|
|
}
|
|
|
|
|
|
- private String getUrl(SaveInquiryVO saveInquiryVO) {
|
|
|
+ private List<String> getUrl(SaveInquiryVO saveInquiryVO) {
|
|
|
+ List<String> ret = Lists.newArrayList();
|
|
|
String retUrl = null;
|
|
|
+ Response response = null;
|
|
|
try {
|
|
|
String encodingAesKey = "";
|
|
|
Client client = new Client(apiUrl, appKey, appSecret, encodingAesKey);
|
|
|
- Response response = client.execute(getltcs(saveInquiryVO));
|
|
|
+ response = client.execute(getltcs(saveInquiryVO));
|
|
|
if (response.isSuccess()) {
|
|
|
JSONResponseBean result = response.getJsonResponseBean();
|
|
|
retUrl = result.getBody().toString();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
- if (StringUtil.isBlank(retUrl)) {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR, "提交失败");
|
|
|
- }
|
|
|
- return retUrl;
|
|
|
+ ret.add(retUrl);
|
|
|
+ ret.add(FastJsonUtils.getBeanToJson(response));
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
private Request getltcs(SaveInquiryVO saveInquiryVO) {
|