Browse Source

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

Administrator 1 year ago
parent
commit
74f3e577c4

+ 26 - 0
db_invoice_t_SellCarTrade.sql

@@ -0,0 +1,26 @@
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (3, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030201102021101715000121', '2021-10-17 15:38:01', 950, 3, 'b4187dd0ab43411998b3c75d16984c95', '交科信用管理有限公司', '2021-10-22 14:18:09', '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (4, 'jkxyzyc', '10004704', '11011201230001533684', 'S001111001001021200702021100823000041', '2021-10-08 23:29:07', 475, 3, 'b4187dd0ab43411998b3c75d16984c95', '交科信用管理有限公司', '2021-10-22 14:18:09', '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (5, 'jkxyzyc', '10004704', '11011201230001533684', 'S001111001001021200902021100800000020', '2021-10-08 00:59:52', 475, 3, 'b4187dd0ab43411998b3c75d16984c95', '交科信用管理有限公司', '2021-10-22 14:18:09', '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (6, 'jkxyzyc', '10004704', '11011201230001533684', 'S002811001001021200202021101018000113', '2021-10-10 18:15:53', 475, 3, 'b4187dd0ab43411998b3c75d16984c95', '交科信用管理有限公司', '2021-10-22 14:18:09', '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (7, 'jkxyzyc', '10004704', '11011201230001533684', 'S002811001001021200302021100819000087', '2021-10-08 19:17:45', 475, 3, 'b4187dd0ab43411998b3c75d16984c95', '交科信用管理有限公司', '2021-10-22 14:18:09', '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (8, 'jkxyzyc', '10004704', '11011201230001533684', 'S002811001001021200302021101218000166', '2021-10-12 18:20:57', 475, 3, 'b4187dd0ab43411998b3c75d16984c95', '交科信用管理有限公司', '2021-10-22 14:18:09', '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (10, 'jkxyzyc', '10004704', '11011201230001533684', 'S001111001001021200802021090416000237', '2021-09-04 16:46:48', 285, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (11, 'jkxyzyc', '10004704', '11011201230001533684', 'S001111001001021200802021092616000209', '2021-09-26 16:33:14', 475, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (12, 'jkxyzyc', '10004704', '11011201230001533684', 'S001111001003022200402021090414000058', '2021-09-04 14:54:16', 285, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (13, 'jkxyzyc', '10004704', '11011201230001533684', 'S002811001001021200302021092615000166', '2021-09-26 15:34:42', 475, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (14, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030100602021082213000051', '2021-08-22 13:20:18', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (15, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030100702021081322000084', '2021-08-13 22:45:17', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (16, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030100702021081520000042', '2021-08-15 20:17:19', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (17, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030201002021081320000103', '2021-08-13 20:30:02', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (18, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030201102021080720000028', '2021-08-07 20:10:50', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (19, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030201102021081515000130', '2021-08-15 15:40:35', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (20, 'jkxyzyc', '10004704', '11011201230001533684', 'G010311001003030201102021082210000065', '2021-08-22 10:22:18', 950, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 1, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (23, 'jkxyzyc', '10004704', '11011201230001533684', 'G000611001002021200502021041816000082', '2021-04-18 16:19:36', 4999, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (25, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001001021200402021112709000486', '2021-11-27 09:52:02', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (26, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001001021200502021111013000048', '2021-11-10 13:10:12', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (27, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001001021201102021112508000064', '2021-11-25 08:30:56', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (28, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001005022400502021111015000256', '2021-11-10 15:58:42', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (29, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001005022400502021112610000143', '2021-11-26 10:36:37', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (31, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001001021200302021062307000187', '2021-06-23 07:59:15', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (32, 'jkxyzyc', '10004704', '11011201230001416969', 'G000411001005022400502021061323000060', '2021-06-13 23:36:58', 380, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);
+INSERT INTO db_invoice.t_SellCarTrade (id, customId, companyNum, cardId, tradeId, exTime, fee, status, applId, companyName, aclTime, companyReferencenum, interType, updateTime) VALUES (33, 'jkxyzyc', '10004704', '11011201230001416969', 'G450111004004023200302021062316000055', '2021-06-23 16:26:52', 1774, 1, null, '交科信用管理有限公司', null, '91330109MA28WBGN2F', 0, null);

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

@@ -30,6 +30,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FileUtils;
+import org.apache.ibatis.annotations.Param;
 import org.apache.poi.util.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -505,6 +506,9 @@ public class NoCarController {
             }
             for(int i=0;i<files.length;i++){
                File  fileTemp = files[i];
+               if(fileTemp.isDirectory() || !(fileTemp.getName().contains(".pdf")||fileTemp.getName().contains(".PDF"))){
+                   continue;
+               }
                NoCarWayBillFileInfo noCarWayBillFileInfo = new NoCarWayBillFileInfo();
                noCarWayBillFileInfo.setCustomerId(customerName);
                noCarWayBillFileInfo.setBatchNum(batchNumber);
@@ -837,11 +841,11 @@ public class NoCarController {
     }
     @GetMapping("/downloadWayBillFile")
     @ApiOperation(value = "运单文件下载", notes = "运单文件下载")
-    public RespR downloadWayBillFile(@NotNull(message = "运单文件下载,运单号") String wayBillNum, HttpServletResponse response) {
+    public RespR downloadWayBillFile(@Param("wayBillNum") String wayBillNum, @Param("batchNum")String batchNum, HttpServletResponse response) {
         OutputStream outputStream = null;
         InputStream inputStream = null;
         try {
-            NoCarWayBillFileInfo noCarWayBillFileInfo = wayBillFileService.selectFileInfo(null,wayBillNum);
+            NoCarWayBillFileInfo noCarWayBillFileInfo = wayBillFileService.selectFileInfo(batchNum,wayBillNum);
             byte[] bytes = Base64Utils.DECODER_64.decode(noCarWayBillFileInfo.getBase64Str());
             ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes);
             response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(noCarWayBillFileInfo.getFileName(), "UTF-8"));

+ 33 - 20
src/main/java/com/jkcredit/invoice/credit/interserver/NoCarInterServiceImpl.java

@@ -343,16 +343,23 @@ public class NoCarInterServiceImpl implements NoCarInterService {
             noCarWayBill.setBase64Str(base64Str);
             noCarWayBill.setContractType(contractType);
            DataResult dataResult = getDataResult(appKey, data, costtimestart, result, customerRec, noCarWayBill);
-            if(dataResult.getCode() == 0){
-                NoCarWayBillFileInfo noCarWayBillFileInfo = new NoCarWayBillFileInfo();
-                noCarWayBillFileInfo.setBase64Str(base64Str);
-                noCarWayBillFileInfo.setFileName(waybillFileName);
-                noCarWayBillFileInfo.setWayBillNum(num);
-                noCarWayBillFileInfo.setCustomerId(appKey);
-                noCarWayBillFileInfo.setCompanyName(noCarWayBill.getCompanyName());
-                noCarWayBillFileInfo.setUpdateTime(DateUtil.getCurrentDateStr());
-                wayBillFileService.insert(noCarWayBillFileInfo);
+            try {
+                if(dataResult.getCode() == 0){
+                    NoCarWayBillFileInfo noCarWayBillFileInfo = new NoCarWayBillFileInfo();
+                    noCarWayBillFileInfo.setBase64Str(base64Str);
+                    noCarWayBillFileInfo.setFileName(waybillFileName);
+                    noCarWayBillFileInfo.setBatchNum("接口运单");
+                    noCarWayBillFileInfo.setWayBillNum(num);
+                    noCarWayBillFileInfo.setCustomerId(appKey);
+                    noCarWayBillFileInfo.setCompanyName(noCarWayBill.getCompanyName());
+                    noCarWayBillFileInfo.setUpdateTime(DateUtil.getCurrentDateStr());
+                    wayBillFileService.insert(noCarWayBillFileInfo);
+                }
+            }catch (Exception e){
+                e.printStackTrace();
+                log.info("文件入表失败{}",noCarWayBill.getBillNum());
             }
+
             return dataResult;
         } catch (Exception e) {
             log.error("[-NoCarInterServiceImpl.noCarBillStart-] get httpclient exception is "
@@ -576,18 +583,24 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 return result;
             }
             RespR respR = noCarService.noCarHisWaybillStart(noCarWayBill);
-            if(respR.getCode() == 0){
-                //上传成功后文件入库
-                NoCarWayBillFileInfo noCarWayBillFileInfo = new NoCarWayBillFileInfo();
-                noCarWayBillFileInfo.setBase64Str(base64Str);
-                noCarWayBillFileInfo.setFileName(waybillFileName);
-                noCarWayBillFileInfo.setBatchNum("接口运单");
-                noCarWayBillFileInfo.setWayBillNum(num);
-                noCarWayBillFileInfo.setUpdateTime(DateUtil.getCurrentDateStr());
-                noCarWayBillFileInfo.setCustomerId(appKey);
-                noCarWayBillFileInfo.setCompanyName(noCarWayBill.getCompanyName());
-                wayBillFileService.insert(noCarWayBillFileInfo);
+            try {
+                if(respR.getCode() == 0){
+                    //上传成功后文件入库
+                    NoCarWayBillFileInfo noCarWayBillFileInfo = new NoCarWayBillFileInfo();
+                    noCarWayBillFileInfo.setBase64Str(base64Str);
+                    noCarWayBillFileInfo.setFileName(waybillFileName);
+                    noCarWayBillFileInfo.setBatchNum("接口运单");
+                    noCarWayBillFileInfo.setWayBillNum(num);
+                    noCarWayBillFileInfo.setUpdateTime(DateUtil.getCurrentDateStr());
+                    noCarWayBillFileInfo.setCustomerId(appKey);
+                    noCarWayBillFileInfo.setCompanyName(noCarWayBill.getCompanyName());
+                    wayBillFileService.insert(noCarWayBillFileInfo);
+                }
+            }catch (Exception e){
+                e.printStackTrace();
+                log.info("文件入表失败{}",noCarWayBill.getBillNum());
             }
+
             return getDataResultss(data, costtimestart, result, respR, "[-NoCarInterServiceImpl.noCarHisWaybillStart-] result is ");
         } catch (Exception e) {
             log.error("[-NoCarInterServiceImpl.noCarHisWaybillStart-] get httpclient exception is "

+ 1 - 1
src/main/java/com/jkcredit/invoice/model/entity/waybill/NoCarWayBill.java

@@ -165,7 +165,7 @@ public class NoCarWayBill implements Cloneable {
     /**
      * 协议类型
      */
-    private Integer contractType;
+    private Integer contractType=1;
 
     /**
      * 平台操作批次号

+ 5 - 2
src/main/java/com/jkcredit/invoice/service/lowerservice/impl/NoCarServiceImpl.java

@@ -634,14 +634,14 @@ public class NoCarServiceImpl implements NoCarService {
             return new RespR(true);
         }else{
             RespR<WaybillHistoryEndResponse> waybillEndResponseRespR = noCarInterface.waybillHistoryEnd(waybillEndRequest);
-            if (waybillEndResponseRespR.getCode() == 1) {
+            if (waybillEndResponseRespR.getCode() == 1 && !(waybillEndResponseRespR.getMsg()!=null && waybillEndResponseRespR.getMsg().contains("结束指令已上传"))) {
                 noCarWayBillDb.setBillwayStatus(-3);
                 noCarWayBillDb.setFailReason(waybillEndResponseRespR.getMsg());
                 insertOrUpdateBillEnd(noCarWayBillDb);
                 log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, waybillEndResponseRespR.getMsg());
 
                 return new RespR(false, waybillEndResponseRespR.getMsg());
-            } else if (FOR.equals(waybillEndResponseRespR.getData().getInfo())) {
+            } else if (waybillEndResponseRespR.getData()!=null && FOR.equals(waybillEndResponseRespR.getData().getInfo())) {
                 noCarWayBill.setBillwayStatus(4);
                 insertOrUpdateBillEnd(noCarWayBillDb);
                 log.info("历史运单结束上传失败:NoCarServiceImpl.noCarHisWaybillEnd{},msg{}", noCarWayBillDb, "运单已经超时,请拆分");
@@ -649,6 +649,9 @@ public class NoCarServiceImpl implements NoCarService {
             }
             noCarWayBillDb.setBillwayStatus(2);
             insertOrUpdateBillEnd(noCarWayBillDb);
+            if(waybillEndResponseRespR.getMsg()!=null && waybillEndResponseRespR.getMsg().contains("结束指令已上传")){
+                return new RespR("已上传");
+            }
             return new RespR(waybillEndResponseRespR.getData());
         }