Browse Source

增加按照交易查询申请接口

mashengyi 2 years ago
parent
commit
d675f7a1b0

BIN
lib/sdk-b2b-protocol-1.5.3.jar


+ 5 - 0
src/main/java/com/jkcredit/invoice/credit/InterfaceCheckServer.java

@@ -185,6 +185,11 @@ public class InterfaceCheckServer {
             case "B2B_CHANGE_CARD_QUERY_V1"://自有车 用户卡换绑查询。
                 result = selfCarInterService.customerCardChangeQuery(appKey,api,data,requestid);
                 break;
+            case "B2B_QUERY_TRADE_APPLY_V1"://自有车 按交易查申请。
+                result = selfCarInterService.tradeApplyQuery(appKey,api,data,requestid);
+                break;
+
+
 
             //----------------------------无车下游接口---------------------------------//
             case "VEHICLE_REGISTER"://无车 车辆备案接口

+ 2 - 0
src/main/java/com/jkcredit/invoice/credit/SimpleCORSFilter.java

@@ -83,6 +83,8 @@ public class SimpleCORSFilter implements Filter {
             put( "B2B_INVOICE_APPL_QUERY_V1" ,  "1");//按照申请ID查询发票
             put( "B2B_CHANGE_CARD_V1" ,  "1");//用户卡换绑
             put( "B2B_CHANGE_CARD_QUERY_V1" ,  "1");//用户卡换绑查询
+            put( "B2B_QUERY_TRADE_APPLY_V1" ,  "1");//按交易查申请
+
         }
     };
 

+ 4 - 3
src/main/java/com/jkcredit/invoice/credit/interserver/SelfCarInterService.java

@@ -7,7 +7,6 @@ public interface SelfCarInterService {
     //自有车 用户卡列表查询接口;
     DataResult customerETCQuery(String appKey, String api, String data, String requestid);
 
-
     //自有车 卡信息查询接口
     DataResult customerQueryEtcInfo(String appKey, String api, String data, String requestid);
 
@@ -28,17 +27,19 @@ public interface SelfCarInterService {
 
     //自有车 已开发票查询接口 渠道通过此接口可以根据该公司的申请信息查询开票信息
     DataResult getSelfCarInvoicesByAppl(String appKey, String api, String data, String requestid);
+
     //自有车 发票下载 渠道通过此接口可以下载某公司某个月份开具的发票。
     DataResult getSelfCarInvoicePackage(String appKey, String api, String data, String requestid);
 
-
     //自有车 卡解绑接口。
     DataResult customerCarUnRec(String appKey, String api, String data, String requestid);
 
     //自有车 卡换绑绑接口。
     DataResult customerCardChange(String appKey, String api, String data, String requestid);
 
-
     //自有车 卡换绑绑查询接口。
     DataResult customerCardChangeQuery(String appKey, String api, String data, String requestid);
+
+    //自有车 按交易查申请接口。
+    DataResult tradeApplyQuery(String appKey, String api, String data, String requestid);
 }

+ 68 - 0
src/main/java/com/jkcredit/invoice/credit/interserver/SelfCarInterServiceImpl.java

@@ -980,4 +980,72 @@ public class SelfCarInterServiceImpl implements SelfCarInterService {
         }
         return result;
     }
+
+
+
+    @Override
+    public DataResult tradeApplyQuery(String appKey, String api, String data, String requestid) {
+        long costtimestart = System.currentTimeMillis();
+
+        DataResult result = new DataResult();
+
+        result.setData(3);
+        result.setCode(200);
+        result.setRequestid(requestid);
+        result.setMsg("无法认证");
+
+        try {
+            log.info("[-SelfCarInterServiceImpl.tradeApplyQuery-] request appKey=" + appKey + " ,api=" + api + " ,data=" +data+ " ,requestid=" +requestid);
+            JSONObject jsonObject = JSONObject.parseObject(data);
+            String companyNum =  jsonObject.getString("companyNum");//企业编号 必输 不超过32个字符
+            String cardId =  jsonObject.getString("cardId");//卡号 必输 20位数字字符
+            String tradeId =  jsonObject.getString("tradeId");//交易ID 必输 字符串
+            if(StringUtils.isEmpty(data)|| null == jsonObject || StringUtils.isEmpty(companyNum)
+                    || StringUtils.isEmpty(cardId)
+                    || StringUtils.isEmpty(tradeId)
+            ){
+                result.setCode(200);
+                result.setMsg("必传参数有为空情况,请核实后再试");
+                return  result;
+            }
+
+
+            CustomerRec customerRec = new CustomerRec();
+            customerRec.setCustomerName(appKey);
+            customerRec.setCompanyNum(companyNum);
+            CustomerRec customerRec1 = customerRecMapper.selectByCustomerNameAndCompanyNum(customerRec);
+            if (null == customerRec1){
+                result.setCode(200);
+                result.setMsg("该企业编号在平台中不存在,请联系管理员核实!");
+                return result;
+            }
+
+            TradeApplyQueryInvVo tradeApplyQueryInvVo  = new TradeApplyQueryInvVo();
+            tradeApplyQueryInvVo.setCompanyNum(companyNum);
+            tradeApplyQueryInvVo.setCardId(cardId);
+            tradeApplyQueryInvVo.setTradeId(tradeId);
+
+            RespR rs = selfCarService.getApplyQueryByTradeId(tradeApplyQueryInvVo);
+
+            long costtimeend = System.currentTimeMillis();
+            log.info("[-SelfCarInterServiceImpl.tradeApplyQuery-] result is "
+                    + rs.toString() + ", request is " + data + " ,costtime="
+                    + (costtimeend - costtimestart));
+            if(null != rs && rs.getCode() == 0){
+                result.setData(1);
+                result.setCode(200);
+                result.setMsg(rs.getData().toString());
+                return result;
+            } else {
+                result.setData(3);
+                result.setCode(200);
+                result.setMsg(rs.getMsg());
+                return result;
+            }
+        } catch (Exception e) {
+            log.error("[-SelfCarInterServiceImpl.tradeApplyQuery-] get httpclient exception is "
+                    + e + ", request is " + data);
+        }
+        return result;
+    }
 }

+ 6 - 5
src/main/java/com/jkcredit/invoice/service/lowerservice/SelfCarServiceL.java

@@ -2,15 +2,12 @@ package com.jkcredit.invoice.service.lowerservice;
 
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.B2BInvoiceListModel;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.B2BInvoiceQueryByApplyModel;
-import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.B2BInvoiceQueryByApplyResponse;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.B2bInvoicePackageModel;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeModel;
 import com.jkcredit.invoice.credit.dto.CardChangeDto;
 import com.jkcredit.invoice.credit.dto.CardChangeQueryDto;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerRec;
-import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
-import com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice;
 import com.jkcredit.invoice.service.lowerservice.vo.*;
 import com.jkcredit.invoice.util.RespR;
 
@@ -40,8 +37,6 @@ public interface SelfCarServiceL {
      */
     RespR<List<B2BInvoiceQueryByApplyModel>> getSelfCarInvoicesByApplyIds(ApplQueryInvVo applQueryInvVo);
 
-
-
     /**
      *已开发票查询接口
      */
@@ -91,4 +86,10 @@ public interface SelfCarServiceL {
 
     //自有车 卡换绑绑查询接口。
     RespR customerCardChangeQuery(CardChangeQueryDto cardChangeQueryDto);
+
+
+    /**
+     * 5.6按交易查申请
+     */
+    RespR getApplyQueryByTradeId(TradeApplyQueryInvVo tradeApplyQueryInvVo);
 }

+ 26 - 5
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java

@@ -1,9 +1,8 @@
 package com.jkcredit.invoice.service.lowerservice.impl;
+
 import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.*;
-import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeModel;
-import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeRequest;
-import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeResponse;
+import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.*;
 import com.jkcredit.invoice.common.CommonConstants;
 import com.jkcredit.invoice.credit.dto.CardChangeDto;
 import com.jkcredit.invoice.credit.dto.CardChangeQueryDto;
@@ -18,8 +17,8 @@ import com.jkcredit.invoice.mapper.waybill.SellCarTradeMapper;
 import com.jkcredit.invoice.model.entity.calculate.SelfCarCalculateInfor;
 import com.jkcredit.invoice.model.entity.customer.Customer;
 import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
-import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.model.entity.customer.CustomerEtcChangeInfo;
+import com.jkcredit.invoice.model.entity.customer.CustomerRec;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarAppl;
 import com.jkcredit.invoice.model.entity.invoice.SelfCarInvoice;
 import com.jkcredit.invoice.model.entity.waybill.SelfCarTrade;
@@ -27,7 +26,9 @@ import com.jkcredit.invoice.service.customer.CustomerService;
 import com.jkcredit.invoice.service.lowerservice.SelfCarServiceL;
 import com.jkcredit.invoice.service.lowerservice.vo.*;
 import com.jkcredit.invoice.service.upService.SelfCarInterface;
-import com.jkcredit.invoice.util.*;
+import com.jkcredit.invoice.util.DateUtil;
+import com.jkcredit.invoice.util.MathUtil;
+import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -569,6 +570,8 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
     }
     @Autowired
     CustomerChangeInfoMapper customerChangeInfoMapper;
+
+
     @Override
     public RespR customerCardChangeQuery(CardChangeQueryDto cardChangeQueryDto) {
         CardChangeQueryRequest cardChangeQueryRequest = new CardChangeQueryRequest();
@@ -583,4 +586,22 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
             return new RespR(respR.getData());
         }
     }
+
+    @Override
+    public RespR getApplyQueryByTradeId(TradeApplyQueryInvVo tradeApplyQueryInvVo) {
+
+        TradeApplyQueryRequest tradeApplyQueryRequest = new TradeApplyQueryRequest();
+        tradeApplyQueryRequest.setCompanyNum(tradeApplyQueryInvVo.getCompanyNum());
+        tradeApplyQueryRequest.setCardId(tradeApplyQueryInvVo.getCardId());
+        tradeApplyQueryRequest.setTradeId(tradeApplyQueryInvVo.getTradeId());
+        RespR<TradeApplyQueryResponse> respR = selfCarInterface.queryApplyQueryByTradeId(tradeApplyQueryRequest);
+
+        if(respR.getCode() == 1){
+            log.info("自有车 按交易查申请接口查询失败:SelfCarServiceLImpl.getApplyQueryByTradeId{},msg",tradeApplyQueryInvVo,respR.getMsg());
+            return new RespR(false,respR.getMsg());
+        }else{
+            return new RespR(respR.getData());
+        }
+
+    }
 }

+ 53 - 0
src/main/java/com/jkcredit/invoice/service/lowerservice/vo/TradeApplyQueryInvVo.java

@@ -0,0 +1,53 @@
+package com.jkcredit.invoice.service.lowerservice.vo;
+
+public class TradeApplyQueryInvVo {
+
+
+    /**
+     * 公司编号
+     */
+    private String companyNum;
+
+    /**
+     * 卡号
+     */
+    private String cardId;
+
+    /**
+     * 交易id
+     */
+    private String tradeId;
+
+    public String getCompanyNum() {
+        return companyNum;
+    }
+
+    public void setCompanyNum(String companyNum) {
+        this.companyNum = companyNum;
+    }
+
+    public String getCardId() {
+        return cardId;
+    }
+
+    public void setCardId(String cardId) {
+        this.cardId = cardId;
+    }
+
+    public String getTradeId() {
+        return tradeId;
+    }
+
+    public void setTradeId(String tradeId) {
+        this.tradeId = tradeId;
+    }
+
+    @Override
+    public String toString() {
+        return "TradeApplyQueryInvVo{" +
+                "companyNum='" + companyNum + '\'' +
+                ", cardId='" + cardId + '\'' +
+                ", tradeId='" + tradeId + '\'' +
+                '}';
+    }
+}

+ 10 - 1
src/main/java/com/jkcredit/invoice/service/upService/SelfCarInterface.java

@@ -1,10 +1,11 @@
 package com.jkcredit.invoice.service.upService;
 
-import cn.com.taiji.sdk.model.comm.protocol.eoms.company.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeRequest;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeResponse;
+import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryResponse;
 import com.jkcredit.invoice.util.RespR;
 
 /**
@@ -95,4 +96,12 @@ public interface SelfCarInterface {
      * @return
      */
     RespR<CardChangeQueryResponse> queryChangeCard(CardChangeQueryRequest cardChangeQueryRequest);
+
+
+    /**
+     * 5.6按交易查申请
+     * @param tradeApplyQueryRequest
+     * @return
+     */
+    RespR<TradeApplyQueryResponse> queryApplyQueryByTradeId(TradeApplyQueryRequest tradeApplyQueryRequest);
 }

+ 7 - 7
src/main/java/com/jkcredit/invoice/service/upService/impl/CommInterFaceImpl.java

@@ -29,7 +29,7 @@ public class CommInterFaceImpl implements CommInterFace{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error("CommInterFaceImpl.companyQuery:{}",apie.getMessage()+ " ,请求参数:"+companyQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error("CommInterFaceImpl.companyQuery:{}",apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+companyQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }catch (Exception e) {
@@ -55,7 +55,7 @@ public class CommInterFaceImpl implements CommInterFace{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error("CommInterFaceImpl.addCompany:{}", apie.getMessage()+ " ,请求参数:"+companyAddRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error("CommInterFaceImpl.addCompany:{}", apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+companyAddRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -67,18 +67,18 @@ public class CommInterFaceImpl implements CommInterFace{
         long startTime = System.currentTimeMillis();
 
         try {
-            log.info("CommInterFaceImpl.b2bContractAdd上游请求参数:{}",contractAddRequest.toString());
+            log.info("CommInterFaceImpl.b2bContractAdd上游请求参数,Filename:{},CompanyNum:{},ContractFileName:{},ServiceStartTime:{},ServiceEndTime:{},ServiceType:{}",contractAddRequest.getFilename(),contractAddRequest.getCompanyNum(),contractAddRequest.getContractFileName(),contractAddRequest.getServiceStartTime(),contractAddRequest.getServiceEndTime(),contractAddRequest.getServiceType());
             //(4)指定协议的响应模型(IssuerUploadResponse),调用upload 发送数据
             B2bContractAddResponse response=ETCCommHelper.upload(fileName, contractAddRequest, B2bContractAddResponse.class);
-            log.info("CommInterFaceImpl.b2bContractAdd上游接口返回:{},请求参数:{},cost={}ms", response.toString(), contractAddRequest.toString(),System.currentTimeMillis()-startTime);
+            log.info("CommInterFaceImpl.b2bContractAdd上游接口返回:{}   ,请求参数-Filename:{},CompanyNum:{},ContractFileName:{},ServiceStartTime:{},ServiceEndTime:{},ServiceType:{},cost={}ms", response.toString(), contractAddRequest.getFilename(),contractAddRequest.getCompanyNum(),contractAddRequest.getContractFileName(),contractAddRequest.getServiceStartTime(),contractAddRequest.getServiceEndTime(),contractAddRequest.getServiceType(),System.currentTimeMillis()-startTime);
             log.info("conName"+response.getContrantNum());
             return new RespR<>(response);
         } catch (IOException e) {
             e.printStackTrace();
-            log.error("CommInterFaceImpl.b2bContractAdd:{}",e.getMessage()+ " ,请求参数:"+contractAddRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error("CommInterFaceImpl.b2bContractAdd:{} ,请求参数-Filename:{},CompanyNum:{},ContractFileName:{},ServiceStartTime:{},ServiceEndTime:{},ServiceType:{},cost={}ms",e.getMessage(),contractAddRequest.getFilename(),contractAddRequest.getCompanyNum(),contractAddRequest.getContractFileName(),contractAddRequest.getServiceStartTime(),contractAddRequest.getServiceEndTime(),contractAddRequest.getServiceType(),System.currentTimeMillis()-startTime);
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error("CommInterFaceImpl.b2bContractAdd:{}",apie.getMessage()+ " ,请求参数:"+contractAddRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error("CommInterFaceImpl.b2bContractAdd:{} ,请求参数-Filename:{},CompanyNum:{},ContractFileName:{},ServiceStartTime:{},ServiceEndTime:{},ServiceType:{},cost={}ms",apie.getMessage().replaceAll("[\r\n]", ""),contractAddRequest.getFilename(),contractAddRequest.getCompanyNum(),contractAddRequest.getContractFileName(),contractAddRequest.getServiceStartTime(),contractAddRequest.getServiceEndTime(),contractAddRequest.getServiceType(),System.currentTimeMillis()-startTime);
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -101,7 +101,7 @@ public class CommInterFaceImpl implements CommInterFace{
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
             apie.printStackTrace();
-            log.error("CommInterFaceImpl.b2bContractQuery:{}",  apie.getMessage()+ " ,请求参数:"+b2bContractQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error("CommInterFaceImpl.b2bContractQuery:{}",  apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+b2bContractQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             return new RespR(false,apie.getMessage());
         }
     }

+ 9 - 9
src/main/java/com/jkcredit/invoice/service/upService/impl/NoCarInterfaceImpl.java

@@ -34,7 +34,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
             apie.printStackTrace();
-            log.error(apie.getMessage()+ " ,请求参数:"+registerRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+registerRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             return new RespR(false,apie.getMessage());
         }
     }
@@ -55,7 +55,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+vehicleQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+vehicleQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
 
             return new RespR(false,apie.getMessage());
@@ -78,7 +78,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillStartRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillStartRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -100,7 +100,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillEndRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillEndRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -124,7 +124,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillHistoryStartRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillHistoryStartRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -147,7 +147,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillHistoryEndRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillHistoryEndRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -170,7 +170,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillNumFindInvoiceRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillNumFindInvoiceRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -193,7 +193,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillInvoiceRedQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillInvoiceRedQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -216,7 +216,7 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+waybillCountQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+waybillCountQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }

+ 39 - 12
src/main/java/com/jkcredit/invoice/service/upService/impl/SelfCarInterfaceImpl.java

@@ -6,6 +6,8 @@ import cn.com.taiji.sdk.model.comm.protocol.tts.card.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.invoice.server.*;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeRequest;
 import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.CardTradeResponse;
+import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryRequest;
+import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryResponse;
 import com.jkcredit.invoice.service.upService.SelfCarInterface;
 import com.jkcredit.invoice.util.RespR;
 import lombok.extern.slf4j.Slf4j;
@@ -35,7 +37,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardBindQueryListToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardBindQueryListToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -58,7 +60,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardQueryCardToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardQueryCardToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -82,7 +84,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardBindingToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardBindingToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -106,7 +108,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardValidCodeToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardValidCodeToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -130,7 +132,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardUnbindToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardUnbindToBRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -154,7 +156,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请稍后再试");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardTradeRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardTradeRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -176,7 +178,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+b2BInvoiceApplyRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+b2BInvoiceApplyRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -200,7 +202,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+b2BInvoiceQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+b2BInvoiceQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -223,7 +225,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+b2BInvoiceQueryByApplyRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+b2BInvoiceQueryByApplyRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -246,7 +248,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+b2bInvoicePackageRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+b2bInvoicePackageRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -269,7 +271,7 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardChangeTitleRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardChangeTitleRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
@@ -292,9 +294,34 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             e.printStackTrace();
             return new RespR(false,"网络异常,请联系管理人员");
         }catch (ApiRequestException apie) {
-            log.error(apie.getMessage()+ " ,请求参数:"+cardChangeQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+cardChangeQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
             apie.printStackTrace();
             return new RespR(false,apie.getMessage());
         }
     }
+
+    @Override
+    public RespR<TradeApplyQueryResponse> queryApplyQueryByTradeId(TradeApplyQueryRequest tradeApplyQueryRequest) {
+
+
+        String fileName = tradeApplyQueryRequest.getFilename();
+        long startTime = System.currentTimeMillis();
+
+        try {
+            log.info("SelfCarInterfaceImpl.queryApplyQueryByTradeId上游请求参数:{}", tradeApplyQueryRequest.toString());
+            //(4)指定协议的响应模型(IssuerUploadResponse),调用upload 发送数据
+            TradeApplyQueryResponse response=ETCCommHelper.upload(fileName, tradeApplyQueryRequest, TradeApplyQueryResponse.class);
+            log.info("SelfCarInterfaceImpl.queryApplyQueryByTradeId上游接口返回:{},请求参数:{},cost={}ms", response.toString(), tradeApplyQueryRequest.toString(),System.currentTimeMillis()-startTime);
+            return new RespR<>(response);
+        } catch (IOException e) {
+            log.error(e.getMessage()+ " ,请求参数:"+tradeApplyQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            e.printStackTrace();
+            return new RespR(false,"网络异常,请联系管理人员");
+        }catch (ApiRequestException apie) {
+            log.error(apie.getMessage().replaceAll("[\r\n]", "")+ " ,请求参数:"+tradeApplyQueryRequest.toString()+" ,cost="+(System.currentTimeMillis()-startTime)+"ms");
+            apie.printStackTrace();
+            return new RespR(false,apie.getMessage());
+        }
+
+    }
 }

+ 145 - 0
src/main/java/com/jkcredit/invoice/util/LogUtils.java

@@ -0,0 +1,145 @@
+package com.jkcredit.invoice.util;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.security.Key;
+
+/**
+ * Created by Administrator on 2017/11/25.
+ * base64加解密工具类
+ */
+public class LogUtils {
+	private static final String PASSWORD_CRYPT_KEY = "3cm.xin.";
+    /**
+     * @param bytes
+     * @return
+     * @throws Exception 
+     */
+    public static String decode(String data) throws Exception {
+    	JSONObject object = JSONObject.parseObject(data);
+    	if(object.get("mobile") != null) {
+    		object.put("mobile", decryptDES(object.getString("mobile")));
+    	}
+    	if(object.get("name") != null) {
+    		object.put("name", decryptDES(object.getString("name")));
+    	}
+    	if(object.get("id_number") != null) {
+    		object.put("id_number", decryptDES(object.getString("id_number")));
+    	}
+    	if(object.get("idcard") != null) {
+    		object.put("idcard", decryptDES(object.getString("idcard")));
+    	}
+    	if(object.get("bank_card_number") != null) {
+    		object.put("bank_card_number", decryptDES(object.getString("bank_card_number")));
+    	}
+    	if(object.get("bank_no") != null) {
+    		object.put("bank_no", decryptDES(object.getString("bank_no")));
+    	}
+        return object.toString();
+    }
+
+    /**
+     * 二进制数据编码为BASE64字符串
+     *
+     * @param bytes
+     * @return
+     * @throws Exception
+     */
+    public static String encode(String data) {
+    	try {
+			data = URLDecoder.decode(data, "utf-8");
+			JSONObject object = JSONObject.parseObject(data);
+	    	if(object.get("mobile") != null) {
+	    		object.put("mobile", encryptDES(object.getString("mobile")));
+	    	}
+	    	if(object.get("name") != null) {
+	    		object.put("name",encryptDES(object.getString("name")));
+	    	}
+	    	if(object.get("id_number") != null) {
+	    		object.put("id_number", encryptDES(object.getString("id_number")));
+	    	}
+	    	if(object.get("idcard") != null) {
+	    		object.put("idcard", encryptDES(object.getString("idcard")));
+	    	}
+	    	if(object.get("bank_card_number") != null) {
+	    		object.put("bank_card_number", encryptDES(object.getString("bank_card_number")));
+	    	}
+	    	if(object.get("bank_no") != null) {
+	    		object.put("bank_no", encryptDES(object.getString("bank_no")));
+	    	}
+	        return object.toString();
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+    	return data;
+    }
+    
+    /**
+	 * 加密数据
+	 * @param encryptString  注意:这里的数据长度只能为8的倍数
+	 * @param encryptKey
+	 * @return
+	 * @throws Exception
+	 */
+	public static String encryptDES(String encryptString) {
+		try {
+			StringBuffer sb = new StringBuffer();
+			sb.append(encryptString);
+			for (int i = 0; i < 8 - encryptString.getBytes("UTF-8").length % 8 ; i++) {
+				sb.append("=");
+			}
+			encryptString = sb.toString();
+			SecretKeySpec key = new SecretKeySpec(getKey(PASSWORD_CRYPT_KEY), "DES");
+			Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding");
+			cipher.init(Cipher.ENCRYPT_MODE, key);
+			byte[] encryptedData = cipher.doFinal(encryptString.getBytes("UTF-8"));
+			return Base64.encodeBase64String(encryptedData);
+		} catch (Exception e) {
+			// TODO: handle exception
+		}
+		return encryptString;
+	}
+	
+	/***
+	 * 解密数据
+	 * @param decryptString
+	 * @param decryptKey
+	 * @return
+	 * @throws Exception
+	 */
+	public static String decryptDES(String decryptString) throws Exception {
+		SecretKeySpec key = new SecretKeySpec(getKey(PASSWORD_CRYPT_KEY), "DES");
+		Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding");
+		cipher.init(Cipher.DECRYPT_MODE, key);
+		byte decryptedData[] = cipher.doFinal(Base64.decodeBase64(decryptString));
+		return new String(decryptedData).replaceAll("=", "");
+	}
+	
+	/**
+	 * 自定义一个key
+	 * @param string 
+	 */
+	public static byte[] getKey(String keyRule) {
+		Key key = null;
+		byte[] keyByte = keyRule.getBytes();
+		// 创建一个空的八位数组,默认情况下为0
+		byte[] byteTemp = new byte[8];
+		// 将用户指定的规则转换成八位数组
+		for (int i = 0; i < byteTemp.length && i < keyByte.length; i++) {
+			byteTemp[i] = keyByte[i];
+		}
+		key = new SecretKeySpec(byteTemp, "DES");
+		return key.getEncoded();
+	}
+    public static void main(String[] args) throws Exception {
+		String a = "{\"id_number\":\"15805810769\",\"bank_card_number\":\"6214680048545055\",\"name\":\"刘玺\",\"mobile\":\"15991856264\",\"sign\":\"a93471e386fed0427c68bd6e9967011b\"}";
+		System.out.println(encode(a));
+		//String b = "{\"sign\":\"a93471e386fed0427c68bd6e9967011b\",\"id_number\":\"NjEyMzIzMTk5MjA5MDg0ODcy\",\"name\":\"5YiY5466\",\"bank_card_number\":\"NjIxNDY4MDA0ODU0NTA1NQ==\",\"mobile\":\"MTU4NzMwNTI4MzY=\"}";
+		System.out.println(decode(encode(a))); 
+    }
+}

+ 202 - 0
src/main/java/com/jkcredit/invoice/util/QueryDemoScm_Test.java

@@ -0,0 +1,202 @@
+package com.jkcredit.invoice.util;
+
+import net.sf.json.JSONObject;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+
+/**
+ * Created by zhangqingxin Date : 16/11/6 Time : 10:41
+ * <p/>
+ * 参考一(HttpClient):http://mvnrepository.com/artifact/commons-httpclient/commons-
+ * httpclient/3.1
+ * 参考一(json-lib):http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4
+ */
+public class QueryDemoScm_Test {
+
+	/**
+	 * 测试地址
+	 */
+	//	private static final String URL = "http://110.88.150.74:80/credit?api=credit.sec.data";
+	//private static final String URL = "http://110.88.150.74/credit?api=credit.sec.data";
+	//	private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data";
+	//private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data";
+//		private static final String URL = "http://www.h11.site/gateway?api=credit.sec.data";//北京节点
+	//private static final String URL = "http://jk.h11.site/gateway?api=credit.sec.data";
+	private static final String URL = "http://110.88.150.68:8000/gateway?api=credit.sec.data";
+	//			private static final String URL = "http://110.88.150.68:8000/gateway?api=credit.sec.data_test";
+	//	private static final String URL = "http://110.88.150.72:8000/gateway?api=credit.sec.data_test";
+	//	private static final String URL = "http://60.205.114.163:8000/gateway?api=credit.sec.data";
+	//private static final String URL = " http://45.126.120.88/gateway?api=credit.sec.data_test";
+	//		private static final String URL = " http://45.126.120.88/gateway?api=credit.sec.data";
+	//	private static final String URL = " http://119.18.195.163/gateway?api=credit.sec.data"; 
+
+	/**
+	 * 分配的appKey
+	 */
+	private static final String appKey = "DATA_TEST";
+	// 	 private static final String appKey = "junxin_test";
+
+	//			  	 private static final String appKey = "DATA_TEST";
+	//private static final String appKey = "JIAO_KE";
+	//private static final String appKey = "HANGZHOU_JUNXIN_72";
+
+	/**
+	 * 290dec3f6a243889e5ed3210cf1ad499
+	 * 方法入口
+	 *
+	 * @param args
+	 */
+	public static void main(String args[]) throws Exception {
+		QueryDemoScm_Test demo = new QueryDemoScm_Test();
+		demo.runMainService();
+	}
+
+	/**
+	 * 流转字符串
+	 *
+	 * @param is
+	 * @return
+	 */
+	public static String convertStreamToString(InputStream is) {
+		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+		StringBuilder builder = new StringBuilder();
+		String line = null;
+		try {
+			while ((line = reader.readLine()) != null) {
+				builder.append(line + "\n");
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				is.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return builder.toString();
+	}
+
+	/**
+	 * 调用主接口
+	 */
+	public void runMainService() {
+		try {
+			/**
+			 *	 实名demo
+			 */
+			JSONObject paramJsonObj = initParamJsonObj_Realname();
+			String ret = postClient(URL, paramJsonObj);
+			System.out.println(ret);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 整合参数(实名认证)
+	 *
+	 * @return
+	 */
+	public JSONObject initParamJsonObj_Realname() {
+		/**
+		 *	 基本参数
+		 */
+		JSONObject paramJsonObj = new JSONObject();
+		paramJsonObj.put("api", "CMCC_REENTRYNET_QUERY_V5");//CMCC_MOBILE_CHECK_V8//CMCC_3RD_V2//CMCC_3RD_DETAIL_V1//
+		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1//CMCC_ONLINE_CHECK_V5
+		paramJsonObj.put("appKey", appKey);
+		paramJsonObj.put("appSecret",
+				//		"D78C393359BF128715C65D91C67051478A4DFC13");
+				"C41DF125F0C23FBBB83E461F5045A30ACB3FF55A");
+
+
+		/**
+		 * 	业务参数
+		 */
+		JSONObject dataJson = initMainServiceParamJsonObj_Realname();
+		paramJsonObj.put("data", dataJson);
+		return paramJsonObj;
+	}
+
+	/*
+	 * 	初始化业务参数(实名认证)
+	 *
+	 *	 姓名,身份证,手机号
+	 *
+	 * @return
+	 */
+	public JSONObject initMainServiceParamJsonObj_Realname() {
+		/**
+		 * 具体业务参数放在data中
+		 */
+		JSONObject dataJson = new JSONObject();
+	 /*     dataJson.put("id_number","45032719990321321X");
+	      dataJson.put("name","刘伟");//"id_number":"131126199009280345","name":"王聪","mobile":"18322155936"
+	      dataJson.put("mobile","18929408405");*///15201563103,,,15201563013
+		dataJson.put("mobile", "19530103205");//15201563103,,,15201563013
+		dataJson.put("date", "20221126");//15201563103,,,15201563013
+
+	     /* dataJson.put("name","3febda274935a59ce9ff44e2bd0f690aa33fe8ec2c7df3ce384ee0868126decf");
+	      dataJson.put("id_number","bdbcb76a4c74b6f7770e469d647d30ae674b9d089e1cb01615cc46e258201255");
+	      dataJson.put("mobile","54f3746ad9998989ebcb7a3444b5edb694314472cbb74a2fd6458dd64b378b02");
+	      dataJson.put("encrypt","SHA256");*/
+		//dataJson.put("bank_card_number","6253624025440494");
+          /*dataJson.put("name",MD5Util.MD5("周凤云"));
+	      dataJson.put("id_number",MD5Util.MD5("370523197112090723"));
+	      dataJson.put("mobile",MD5Util.MD5("13490329255"));*/
+		// dataJson.put("appkey","6222350107122010");
+	   /*   dataJson.put("mobileCaller","13911084965");
+	      dataJson.put("mobileCalled","13691459653");*/
+		 /* List<String> list = new ArrayList<>();
+			list.add("13752639577");
+	        dataJson.put("msisdnmd5list",list);*/
+		return dataJson;
+	}
+
+	/**
+	 * 实现http post请求 注意编码 UTF-8
+	 *
+	 * @param url
+	 * @param paramObj
+	 * @return
+	 */
+	public String postClient(String url, JSONObject paramObj) {
+		String str = "";
+		HttpClient client = null;
+		PostMethod method = null;
+		try {
+			client = new HttpClient();
+			method = new PostMethod(url);
+			method.setRequestHeader("Content-Type", "application/json;charset=utf-8");
+			NameValuePair[] param = new NameValuePair[paramObj.size()];
+			@SuppressWarnings("unchecked")
+			Iterator<String> keys = paramObj.keys();
+			int i = 0;
+			while (keys.hasNext()) {
+				String key = (String) keys.next();
+				String value = paramObj.getString(key);
+				param[i] = new NameValuePair(key, value);
+				i++;
+			}
+			method.setRequestBody(param);
+			client.executeMethod(method);
+			str = convertStreamToString(method.getResponseBodyAsStream());
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			if (method != null) {
+				method.releaseConnection();
+			}
+		}
+		return str;
+	}
+
+}

+ 6 - 6
src/main/java/com/jkcredit/invoice/util/QueryDemo_3rd.java

@@ -25,7 +25,7 @@ public class QueryDemo_3rd {
 	private static final String appKey = "xxxxxx";
 
 	static String filename = "/Users/mashengyi/Desktop/";
-	static String logname = "编辑1.txt";
+	static String logname = "20221012.txt";
 
 	/**
 	 * 方法入口
@@ -74,14 +74,14 @@ public class QueryDemo_3rd {
 					String str1 = getsrt("\"msg\":\"", "\"", str);
 					System.out.println(str1);**/
 
-				String mobile = getsrt("mobile:", "idcard:", str).trim();
-					
-				String idcard = getsrt("idcard:", "name:", str).trim();
+				String mobile = getsrt("tradeIds=[", "]},", str).trim();
+					System.out.println(mobile);
+				//String idcard = getsrt("idcard:", "name:", str).trim();
 
-				String name = getsrt1("name:",str).trim();
+				//String name = getsrt1("name:",str).trim();
 
 
-				demo.runMainService(name,idcard,mobile);
+				//demo.runMainService(name,idcard,mobile);
 
 				} catch (Exception e) {
 

+ 146 - 172
src/main/java/com/jkcredit/invoice/util/QueryDemo_Test.java

@@ -8,179 +8,153 @@ import org.apache.commons.httpclient.methods.PostMethod;
 import java.io.*;
 import java.util.Iterator;
 
-/**
- * Created by zhangqingxin Date : 16/11/6 Time : 10:41
- * <p/>
- * 参考一(HttpClient):http://mvnrepository.com/artifact/commons-httpclient/commons-
- * httpclient/3.1
- * 参考一(json-lib):http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4
- */
 public class QueryDemo_Test {
 
-	/**
-	 * 测试地址
-	 */
-          private static final String URL = "http://etc.jkcredit.com:9999/api/rest";
-
-	 	//private static final String URL = "http://110.88.150.74:80/credit?api=credit.sec.data_test";
-	  	//private static final String URL = "http://110.88.150.74/credit?api=credit.sec.data";
-		//private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data_test";
-		//private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data";
-	//	private static final String URL = "http://www1.h11.site/gateway?api=credit.sec.data";
-	//	private static final String URL = "http://110.88.150.68:8000/gateway?api=credit.sec.data";
-		//private static final String URL = "http://60.205.114.163:8000/gateway?api=credit.sec.data";
-	 	//private static final String URL = " http://45.126.120.88/gateway?api=credit.sec.data";
-		//private static final String URL = "http://119.18.195.163/gateway?api=credit.sec.data";
-
-	/**
-	 * 分配的appKey
-	 */
-	 	//private static final String appKey = "junxin_test";
-	
-		private static final String appKey = "jkxy";
-	 	//private static final String appKey = "ccx";
-
-	/**
-	 * 方法入口
-	 *
-	 * @param args
-	 */
-	public static void main(String args[]) throws Exception {
-		   QueryDemo_Test demo = new QueryDemo_Test();
-		demo.runMainService();
-	}
-
-	/**
-	 * 调用主接口
-	 */
-	public void runMainService() {
-		try {
-			/**
-			 * 实名demo
-			 */
-			JSONObject paramJsonObj = initParamJsonObj_Realname();
-			String ret = postClient(URL, paramJsonObj);
-			System.out.println(ret);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * 整合参数(实名认证)
-	 *
-	 * @return
-	 */
-	public JSONObject initParamJsonObj_Realname() {
-		/**
-		 * 基本参数
-		 */
-		JSONObject paramJsonObj = new JSONObject();
-		paramJsonObj.put("api", "RED_INK_INVOICE_QUERY");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
-		 //paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
-		paramJsonObj.put("appKey", appKey);
-	    paramJsonObj.put("appSecret",
-		"7697CE9BB9D5A856CFDDE738320AD34EA53E483C");
-		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");
-
-	   
-
-		/**
-		 * 业务参数
-		 */
-		JSONObject dataJson = initMainServiceParamJsonObj_Realname();
-		paramJsonObj.put("data", dataJson);
-		return paramJsonObj;
-	}
-
-	/*
-	 * 初始化业务参数(实名认证)
-	 *
-	 * 姓名,身份证,手机号
-	 *
-	 * @return
-	 */
-	public JSONObject initMainServiceParamJsonObj_Realname() {
-		/**
-		 * 具体业务参数放在data中
-		 */
-		  JSONObject dataJson = new JSONObject();
-        	/*   dataJson.put("name", "王同");
-	      dataJson.put("id_number","371081198911276112");
-	      dataJson.put("mobile","15562139518");*/
-		   dataJson.put("taxplayerCode", "91149900MA0LBCKM6F");
-	       dataJson.put("month", "2022-04");
-		  dataJson.put("pageNo", 4);
-		  dataJson.put("pageSize",10); //没有就默认1000
-
-		 /* List<String> list = new ArrayList<>();
-			list.add("13752639577");
-	        dataJson.put("msisdnmd5list",list);*/
-		  return dataJson;
-	}
-
-	/**
-	 * 实现http post请求 注意编码 UTF-8
-	 *
-	 * @param url
-	 * @param paramObj
-	 * @return
-	 */
-	public String postClient(String url, JSONObject paramObj) {
-		String str = "";
-		HttpClient client = null;
-		PostMethod method = null;
-		try {
-			client = new HttpClient();
-			method = new PostMethod(url);
-			method.setRequestHeader("Content-Type", "application/json;charset=utf-8");
-			NameValuePair[] param = new NameValuePair[paramObj.size()];
-			@SuppressWarnings("unchecked")
-			Iterator<String> keys = paramObj.keys();
-			int i = 0;
-			while (keys.hasNext()) {
-				String key = (String) keys.next();
-				String value = paramObj.getString(key);
-				param[i] = new NameValuePair(key, value);
-				i++;
-			}
-			method.setRequestBody(param);
-			client.executeMethod(method);
-			str = convertStreamToString(method.getResponseBodyAsStream());
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			if (method != null) {
-				method.releaseConnection();
-			}
-		}
-		return str;
-	}
-
-	/**
-	 * 流转字符串
-	 *
-	 * @param is
-	 * @return
-	 */
-	public static String convertStreamToString(InputStream is) {
-		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-		StringBuilder builder = new StringBuilder();
-		String line = null;
-		try {
-			while ((line = reader.readLine()) != null) {
-				builder.append(line + "\n");
-			}
-		} catch (IOException e) {
-			e.printStackTrace();
-		} finally {
-			try {
-				is.close();
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-		return builder.toString();
-	}
+    /**
+     * 测试地址
+     */
+    private static final String URL = "http://127.0.0.1:18081/gateway?api=credit.sec.data";
+
+    /**
+     * 分配的appKey
+     */
+    private static final String appKey = "jkxy";
+
+    /**
+     * 分配的appSecret
+     */
+    private static final String appSecret = "7697CE9BB9D5A856CFDDE738320AD34EA53E483C";
+
+    /**
+     * 企业编号
+     */
+    private static final String companyNum = "10004616";
+
+    /**
+     * 方法入口
+     *
+     * @param args
+     */
+    public static void main(String args[]) throws Exception {
+        QueryDemo_Test demo = new QueryDemo_Test();
+        demo.runMainService();
+    }
+
+    /**
+     * 调用主接口
+     */
+    public void runMainService() {
+        try {
+            /**
+             * 实名demo
+             */
+            JSONObject paramJsonObj = initParamJsonObj_Realname();
+            String ret = postClient(URL, paramJsonObj);
+            System.out.println(ret);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 整合参数
+     *
+     * @return
+     */
+    public JSONObject initParamJsonObj_Realname() {
+        /**
+         * 基本参数
+         */
+        JSONObject paramJsonObj = new JSONObject();
+        paramJsonObj.put("api", "PROTOCOL_ADD_V1");//CMCC_MOBILE_CHECK_V8//CMCC_3RD_V2//CMCC_3RD_DETAIL_V1//
+        paramJsonObj.put("appKey", appKey);
+        paramJsonObj.put("appSecret", appSecret);
+
+
+        /**
+         * 业务参数
+         */
+        JSONObject dataJson = initMainServiceParamJsonObj_Realname();
+        paramJsonObj.put("data", dataJson);
+        return paramJsonObj;
+    }
+
+    public JSONObject initMainServiceParamJsonObj_Realname() {
+        /**
+         * 具体业务参数放在data中
+         */
+        JSONObject dataJson = new JSONObject();
+        dataJson.put("companyNum", companyNum);
+        dataJson.put("serviceStartTime", "2022-05-11T17:30:37");
+        dataJson.put("serviceEndTime", "2023-05-11T21:30:37");
+        dataJson.put("contractFileName", "etc高速开票抵扣(1).pdf");
+        dataJson.put("serviceType", "3");
+        dataJson.put("base64Str", Base64Utils.fileToBase64Str(new File("/Users/mashengyi/Desktop/etc高速开票抵扣(1).pdf")));
+        return dataJson;
+    }
+
+    /**
+     * 实现http post请求 注意编码 UTF-8
+     *
+     * @param url
+     * @param paramObj
+     * @return
+     */
+    public String postClient(String url, JSONObject paramObj) {
+        String str = "";
+        HttpClient client = null;
+        PostMethod method = null;
+        try {
+            client = new HttpClient();
+            method = new PostMethod(url);
+            method.setRequestHeader("Content-Type", "application/json;charset=utf-8");
+            NameValuePair[] param = new NameValuePair[paramObj.size()];
+            @SuppressWarnings("unchecked")
+            Iterator<String> keys = paramObj.keys();
+            int i = 0;
+            while (keys.hasNext()) {
+                String key = (String) keys.next();
+                String value = paramObj.getString(key);
+                param[i] = new NameValuePair(key, value);
+                i++;
+            }
+            method.setRequestBody(param);
+            client.executeMethod(method);
+            str = convertStreamToString(method.getResponseBodyAsStream());
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+        }
+        return str;
+    }
+
+    /**
+     * 流转字符串
+     *
+     * @param is
+     * @return
+     */
+    public static String convertStreamToString(InputStream is) {
+        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+        StringBuilder builder = new StringBuilder();
+        String line = null;
+        try {
+            while ((line = reader.readLine()) != null) {
+                builder.append(line + "\n");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return builder.toString();
+    }
 
 }

+ 0 - 4
src/main/resources/logback-spring.xml

@@ -41,8 +41,4 @@
         <appender-ref ref="FILE"/>
     </root>
 
-
-  <logger name="com.jkcredit.invoice" level="INFO">
-        <appender-ref ref="FILE"/>
-    </logger>
 </configuration>