Преглед изворни кода

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

mashengyi пре 2 година
родитељ
комит
7cada65d3b

+ 2 - 0
src/main/java/com/jkcredit/invoice/controller/business/NoCarController.java

@@ -681,6 +681,8 @@ public class NoCarController {
                 fileName = "自有车交易查询模板.xlsx";
             }else if("7".equals(fileName)){
                 fileName = "自有车发票查询模板.xlsx";
+            }else if("8".equals(fileName)){
+                fileName = "自有车按交易查询申请模板.xlsx";
             }
             OutputStream outputStream = null;
             InputStream inputStream = null;

+ 48 - 0
src/main/java/com/jkcredit/invoice/controller/interserver/SelfCarServiceController.java

@@ -170,4 +170,52 @@ public class SelfCarServiceController {
     public RespR customerCarUnRec(@RequestBody List<CustomerCarRec> customerCarRecs){
         return selfCarService.customerCarUnRec(customerCarRecs);
     }
+
+
+    /**
+     * @param tradeApplyQueryInvVo
+     * @return
+     */
+    @PostMapping("/getApplyQueryByTradeIds")
+    @ApiOperation(value="按交易查申请", notes="按交易查申请")
+    @LoginRequired
+    public RespR getApplyQueryByTradeId(TradeApplyQueryInvVo tradeApplyQueryInvVo){
+        try {
+        if(StringUtils.isEmpty(tradeApplyQueryInvVo.getCompanyNum()) || StringUtils.isEmpty(tradeApplyQueryInvVo.getTradeId()) || StringUtils.isEmpty(tradeApplyQueryInvVo.getCardId())){
+            return new RespR(false,"参数不能为空");
+        }
+
+        List<TradeApplyQueryInvVo> tradeApplyQueryInvVos = new ArrayList<>();
+
+        if(!org.springframework.util.StringUtils.isEmpty(tradeApplyQueryInvVo.getCompanyNum()) &&
+                !org.springframework.util.StringUtils.isEmpty(tradeApplyQueryInvVo.getCardId()) &&
+                !org.springframework.util.StringUtils.isEmpty(tradeApplyQueryInvVo.getTradeId())){
+            String [] companyNumArr = tradeApplyQueryInvVo.getCompanyNum().split(",");
+            String [] cardIdArr = tradeApplyQueryInvVo.getCardId().split(",");
+            String [] tradeIdArr=  tradeApplyQueryInvVo.getTradeId().split(",");
+
+
+            for (int i=0;i<cardIdArr.length;i++){
+                TradeApplyQueryInvVo tradeApplyQueryInvVoTmp = new TradeApplyQueryInvVo();
+                tradeApplyQueryInvVoTmp.setCardId(cardIdArr[i]);
+                if(tradeIdArr!=null && tradeIdArr.length>=i+1){
+                    tradeApplyQueryInvVoTmp.setTradeId(tradeIdArr[i]);
+                }else{
+                    tradeApplyQueryInvVoTmp.setTradeId("");
+                }
+                if(companyNumArr!=null && companyNumArr.length>=i+1){
+                    tradeApplyQueryInvVoTmp.setCompanyNum(companyNumArr[i]);
+                }else{
+                    tradeApplyQueryInvVoTmp.setCompanyNum("");
+                }
+                tradeApplyQueryInvVos.add(tradeApplyQueryInvVoTmp);
+            }
+
+        }
+        return selfCarService.getApplyQueryByTradeIds(tradeApplyQueryInvVos);
+        } catch (Exception e){
+            e.printStackTrace();
+            return new RespR(false,"查询数据有误,请排查");
+        }
+    }
 }

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

@@ -201,6 +201,7 @@ public class SimpleCORSFilter implements Filter {
             "/selfCarService/customerETCRec",
             "/selfCarService/customerETCRecValid",
             "/selfCarService/customerCarUnRec",
+            "/selfCarService/getApplyQueryByTradeIds",
 
             "/auth/login",
             "/role/list",

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

@@ -89,7 +89,12 @@ public interface SelfCarServiceL {
 
 
     /**
-     * 5.6按交易查申请
+     * 5.6按交易查申请 接口使用
      */
     RespR getApplyQueryByTradeId(TradeApplyQueryInvVo tradeApplyQueryInvVo);
+
+    /**
+     * 5.6按交易查申请 平台使用
+     */
+    RespR getApplyQueryByTradeIds(List<TradeApplyQueryInvVo> tradeApplyQueryInvVos);
 }

+ 36 - 0
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/SelfCarServiceLImpl.java

@@ -604,4 +604,40 @@ public class SelfCarServiceLImpl implements SelfCarServiceL {
         }
 
     }
+
+
+    @Override
+    public RespR getApplyQueryByTradeIds(List<TradeApplyQueryInvVo> tradeApplyQueryInvVos) {
+
+        TradeApplyQueryInvVo data = new TradeApplyQueryInvVo();
+        List<TradeApplyQueryResponse> result = new ArrayList<>();
+
+
+        for(TradeApplyQueryInvVo tradeApplyQueryInvVo:tradeApplyQueryInvVos){
+            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{
+                TradeApplyQueryResponse tradeApplyQueryResponse = new TradeApplyQueryResponse();
+                tradeApplyQueryResponse.setCardId(respR.getData().getCardId());
+                tradeApplyQueryResponse.setApplyId(respR.getData().getApplyId());
+                tradeApplyQueryResponse.setTradeCount(respR.getData().getTradeCount());
+                tradeApplyQueryResponse.setInvoiceCount(respR.getData().getInvoiceCount());
+                tradeApplyQueryResponse.setInvoiceAmount(respR.getData().getInvoiceAmount());
+                tradeApplyQueryResponse.setTaxAmount(respR.getData().getTaxAmount());
+                tradeApplyQueryResponse.setInvoicedCount(respR.getData().getInvoicedCount());
+                tradeApplyQueryResponse.setInvoicedAmount(respR.getData().getInvoicedAmount());
+                tradeApplyQueryResponse.setApplyStatus(respR.getData().getApplyStatus());
+                result.add(tradeApplyQueryResponse);
+
+            }
+        }
+        data.setResult(result);
+        return new RespR(data);
+    }
 }

+ 39 - 1
src/main/java/com/jkcredit/invoice/service/lowerservice/vo/TradeApplyQueryInvVo.java

@@ -1,6 +1,10 @@
 package com.jkcredit.invoice.service.lowerservice.vo;
 
-public class TradeApplyQueryInvVo {
+import cn.com.taiji.sdk.model.comm.protocol.tts.trade.service.TradeApplyQueryResponse;
+
+import java.util.List;
+
+public class TradeApplyQueryInvVo{
 
 
     /**
@@ -18,6 +22,37 @@ public class TradeApplyQueryInvVo {
      */
     private String tradeId;
 
+
+    private String info;
+
+    private String receiveTime;
+
+    private List<TradeApplyQueryResponse> result;
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+
+    public String getReceiveTime() {
+        return receiveTime;
+    }
+
+    public void setReceiveTime(String receiveTime) {
+        this.receiveTime = receiveTime;
+    }
+
+    public List<TradeApplyQueryResponse> getResult() {
+        return result;
+    }
+
+    public void setResult(List<TradeApplyQueryResponse> result) {
+        this.result = result;
+    }
+
     public String getCompanyNum() {
         return companyNum;
     }
@@ -48,6 +83,9 @@ public class TradeApplyQueryInvVo {
                 "companyNum='" + companyNum + '\'' +
                 ", cardId='" + cardId + '\'' +
                 ", tradeId='" + tradeId + '\'' +
+                ", info='" + info + '\'' +
+                ", receiveTime='" + receiveTime + '\'' +
+                ", result=" + result +
                 '}';
     }
 }

+ 13 - 0
src/main/java/com/jkcredit/invoice/service/upService/impl/SelfCarInterfaceImpl.java

@@ -311,6 +311,19 @@ public class SelfCarInterfaceImpl  implements SelfCarInterface{
             log.info("SelfCarInterfaceImpl.queryApplyQueryByTradeId上游请求参数:{}", tradeApplyQueryRequest.toString());
             //(4)指定协议的响应模型(IssuerUploadResponse),调用upload 发送数据
             TradeApplyQueryResponse response=ETCCommHelper.upload(fileName, tradeApplyQueryRequest, TradeApplyQueryResponse.class);
+
+            //TradeApplyQueryResponse response= new TradeApplyQueryResponse();
+            //response.setInfo("成功");
+            //response.setReceiveTime("2022-12-20T17:02:05");
+            //response.setCardId("43012101239418084384");
+            //response.setApplyId("afa5d7888ec246118134e2c06e950374");
+            //response.setTradeCount(65);
+            //response.setInvoiceCount(45);
+            //response.setInvoiceAmount((long) 1235);
+            //response.setTaxAmount((long) 1199);
+            //response.setInvoicedCount(78);
+            //response.setInvoicedAmount((long) 36);
+            //response.setApplyStatus(3);
             log.info("SelfCarInterfaceImpl.queryApplyQueryByTradeId上游接口返回:{},请求参数:{},cost={}ms", response.toString(), tradeApplyQueryRequest.toString(),System.currentTimeMillis()-startTime);
             return new RespR<>(response);
         } catch (IOException e) {

BIN
src/main/resources/static/templates/excel/自有车按交易查询申请模版.xlsx