瀏覽代碼

无车优化,自有车接口返回

Administrator 2 年之前
父節點
當前提交
ff9539dbcf

二進制
lib/sdk-waybill-protocol-1.3.11.jar


二進制
lib/sdk-waybill-protocol-1.3.12.jar


+ 2 - 2
pom.xml

@@ -300,11 +300,11 @@
 
         <!--无车-->
         <dependency>
-            <groupId>sdk-waybill-protocol-1.3.11</groupId>
+            <groupId>sdk-waybill-protocol-1.3.12</groupId>
             <artifactId>sdk</artifactId>
             <scope>system</scope>
             <version>1.0</version>
-            <systemPath>${project.basedir}/lib/sdk-waybill-protocol-1.3.11.jar</systemPath>
+            <systemPath>${project.basedir}/lib/sdk-waybill-protocol-1.3.12.jar</systemPath>
         </dependency>
         <!--有车-->
         <dependency>

+ 9 - 4
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/NoCarServiceImpl.java

@@ -890,14 +890,21 @@ public class NoCarServiceImpl implements NoCarService {
             log.info("取月票失败啦:NoCarServiceImpl.hCInvoiceQuery{},msg{}", monthAccountQueryVo, "企业未备案成功,查询失败");
             return new RespR(false, "企业未备案成功,查询失败");
         }
-        WaybillCountQueryRequest waybillCountQueryRequest = new WaybillCountQueryRequest();
+        String [] dates = DateUtil.getMouthDays(monthAccountQueryVo.getTradeMonth());
+        WaybillCountPageRequest waybillCountQueryRequest = new WaybillCountPageRequest();
         String companyNum = paramService.getParamsByParamName("REQUEST_COMPANY_NUM").getParamValue();
         waybillCountQueryRequest.setCompanyNum(companyNum);
         waybillCountQueryRequest.setTaxCode(customerRec.getCompanyReferencenum());
-        waybillCountQueryRequest.setTradeMonth(monthAccountQueryVo.getTradeMonth());
         waybillCountQueryRequest.setWaybillSource(monthAccountQueryVo.getWaybillSource());
         waybillCountQueryRequest.setPageNo(monthAccountQueryVo.getPageNo());
         waybillCountQueryRequest.setPageSize(1000);
+        for(int i=0;i<dates.length;i++){
+            waybillCountQueryRequest.setTradeDate(dates[i]);
+            updateOneDayAcc(waybillCountQueryRequest,customerRec,monthAccountQueryVo);
+        }
+        return new RespR(true);
+    }
+    public void updateOneDayAcc(WaybillCountPageRequest waybillCountQueryRequest,CustomerRec customerRec,MonthAccountQueryVo monthAccountQueryVo){
         RespR<WaybillCountQueryResponse> waybillCountQueryResponseRespR = noCarInterface.waybillCountQuery(waybillCountQueryRequest);
         if (waybillCountQueryResponseRespR.getCode() != 1) {
             dealMouthAcc(waybillCountQueryResponseRespR, customerRec);
@@ -913,9 +920,7 @@ public class NoCarServiceImpl implements NoCarService {
         }
 
         log.info("更新取月票啦:NoCarServiceImpl.monthAccQueryUpdate{},msg{}", waybillCountQueryResponseRespR, waybillCountQueryResponseRespR.getMsg());
-        return new RespR(true);
     }
-
     public void dealMouthAcc(RespR<WaybillCountQueryResponse> waybillCountQueryResponseRespR, CustomerRec customerRec) {
         String customerName = customerRec.getCustomerName();
         String companyName = customerRec.getCompanyBelongName();

+ 9 - 0
src/main/java/com/jkcredit/invoice/service/upservice/NoCarInterface.java

@@ -86,4 +86,13 @@ public interface NoCarInterface {
      * @return
      */
     RespR<WaybillCountQueryResponse> waybillCountQuery(WaybillCountQueryRequest waybillCountQueryRequest);
+
+    /**
+     * 账单查询接口
+     *
+     * @param waybillCountQueryRequest
+     * @return
+     */
+    RespR<WaybillCountQueryResponse> waybillCountQuery(WaybillCountPageRequest waybillCountQueryRequest);
+
 }

+ 23 - 0
src/main/java/com/jkcredit/invoice/service/upservice/impl/NoCarInterfaceImpl.java

@@ -225,4 +225,27 @@ public class NoCarInterfaceImpl implements NoCarInterface {
             return new RespR(false, apie.getMessage());
         }
     }
+
+    @Override
+    public RespR<WaybillCountQueryResponse> waybillCountQuery(WaybillCountPageRequest waybillCountQueryRequest) {
+        String fileName = waybillCountQueryRequest.getFilename();
+        long startTime = System.currentTimeMillis();
+
+        try {
+            log.info("NoCarInterfaceImpl.waybillCountQuery上游请求参数:{}", waybillCountQueryRequest.toString());
+            //(4)指定协议的响应模型(IssuerUploadResponse),调用upload 发送数据
+            WaybillCountQueryResponse response = ETCCommHelper.upload(fileName, waybillCountQueryRequest, WaybillCountQueryResponse.class);
+            log.info("NoCarInterfaceImpl.waybillCountQuery上游接口返回:{},请求参数:{},cost={}ms", response.toString(), waybillCountQueryRequest.toString(), System.currentTimeMillis() - startTime);
+
+            return new RespR<>(response);
+        } catch (IOException e) {
+            log.error(e.getMessage() + " ,请求参数:" + waybillCountQueryRequest.toString() + " ,cost=" + (System.currentTimeMillis() - startTime) + "ms");
+            e.printStackTrace();
+            return new RespR(false, "网络异常,请联系管理人员");
+        } catch (ApiRequestException apie) {
+            log.error(apie.getMessage().replaceAll("[\r\n]", "") + " ,请求参数:" + waybillCountQueryRequest.toString() + " ,cost=" + (System.currentTimeMillis() - startTime) + "ms");
+            apie.printStackTrace();
+            return new RespR(false, apie.getMessage());
+        }
+    }
 }

+ 23 - 2
src/main/java/com/jkcredit/invoice/util/DateUtil.java

@@ -10,6 +10,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
 
 /**
  * @description: 日期时间工具类
@@ -340,10 +341,30 @@ public class DateUtil {
 
         System.out.println(isValidDate("2022-12-01T23:59:59"));
         System.out.println(isValidDate("2022-11-31T23:59:59"));
-
+        System.out.println(getMouthDays("2022-5"));
         // System.out.println(DateUtil.getDistanceHoursTwo("2022-02-26 09:02:26","2022-03-01 09:02:58"));
     }
-
+    public static String[] getMouthDays(String mounth){
+        DateFormat format = new SimpleDateFormat("yyyy-MM");
+        String [] dates = null;
+        try {
+            Date date = format.parse(mounth);
+            Calendar calendar = new GregorianCalendar();
+            calendar.setTime(date);
+            int minDate = calendar.getActualMinimum(Calendar.DATE);
+            int maxDate = calendar.getActualMaximum(Calendar.DATE);
+            dates = new String[maxDate];
+            for (int i=minDate;i<=maxDate;i++){
+                System.out.print(i+"");
+                String dateStr = mounth+String.format("-%02d", i).toUpperCase();
+                dates[i-1]=dateStr;
+            }
+            System.out.print(dates);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return dates;
+    }
     /**
      * 判断时间格式化
      *