|
@@ -1,8 +1,22 @@
|
|
|
package com.jkcredit.invoice.hub.service.apiCompany;
|
|
|
|
|
|
+import cn.com.taiji.sdk.comm.ETCCommHelper;
|
|
|
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryRequest;
|
|
|
+import cn.com.taiji.sdk.model.comm.protocol.eoms.company.CompanyQueryResponse;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.jkcredit.invoice.hub.constant.CommonConstant;
|
|
|
+import com.jkcredit.invoice.hub.enums.ApiResponseCodeEnum;
|
|
|
+import com.jkcredit.invoice.hub.service.base.BaseService;
|
|
|
+import com.jkcredit.invoice.hub.spi.lang.exception.ServiceException;
|
|
|
+import com.jkcredit.invoice.hub.spi.rest.data.ApiResponseData;
|
|
|
+import io.netty.util.internal.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.sql.rowset.serial.SerialException;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
|
|
|
* @description:
|
|
|
* @author: xusonglin
|
|
@@ -11,37 +25,34 @@ import org.springframework.stereotype.Service;
|
|
|
**/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
-public class ApiCompanyServiceImpl implements ApiCompanyService {
|
|
|
+public class ApiCompanyServiceImpl extends BaseService implements ApiCompanyService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ApiResponseData companyQuery(JSONObject param) {
|
|
|
+ long costTimeStart = System.currentTimeMillis();
|
|
|
+ String result;
|
|
|
+
|
|
|
+ CompanyQueryRequest request = new CompanyQueryRequest();
|
|
|
+ request.setCompanyName(param.get("companyName").toString().trim());
|
|
|
+ request.setTaxpaterCode(param.get("taxplayerCode").toString().trim());
|
|
|
+ String fileName = request.getFilename();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ CompanyQueryResponse response = ETCCommHelper.upload(fileName, request, CompanyQueryResponse.class);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ result = response.toJson();
|
|
|
+ long costTimeEnd = System.currentTimeMillis();
|
|
|
+ log.info("[-companyQuery-] result is " + result.replaceAll("\r|\n", "") + " , request is "
|
|
|
+ + param + ",costtime=" + (costTimeEnd - costTimeStart) + ",startTime=" + costTimeStart
|
|
|
+ + ",endTime=" + costTimeEnd);
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.info("[-companyQuery-] 网络异常 " + e);
|
|
|
+ throw new ServiceException(CommonConstant.QUERY_FAILED);
|
|
|
+ } catch (Exception apie) {
|
|
|
+ log.info("[-companyQuery-] 错误信息:" + apie.getMessage());
|
|
|
+ throw new ServiceException(CommonConstant.QUERY_FAILED);
|
|
|
+ }
|
|
|
+ return analyzeApiResult(result);
|
|
|
+ }
|
|
|
}
|