Browse Source

运单协议 调整

mashengyi 1 year ago
parent
commit
baa9833a34

+ 35 - 0
src/main/java/com/jkcredit/invoice/credit/interserver/NoCarInterServiceImpl.java

@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.jkcredit.invoice.common.CommonConst.COMPUTE;
 import static com.jkcredit.invoice.common.CommonConst.NOT_FOUND;
 import static com.jkcredit.invoice.common.CommonConst.ONE;
 import static com.jkcredit.invoice.common.CommonConst.REC_STATUS_UN;
@@ -50,6 +51,8 @@ import static java.util.stream.Collectors.toList;
 @Slf4j
 public class NoCarInterServiceImpl implements NoCarInterService {
 
+    private static final String PDF = "pdf";
+
 
     @Autowired
     NoCarBillWayImportService noCarWaybillMapperImprt;
@@ -338,6 +341,22 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 result.setMsg("日期格式有误");
                 return result;
             }
+
+            if(StringUtils.isNotBlank(waybillFileName) && StringUtils.isNotBlank(base64Str) && null != contractType){
+                String fileType = waybillFileName.substring(waybillFileName.lastIndexOf(".") + 1).toLowerCase();
+                if (!PDF.equals(fileType)) {
+                    result.setMsg("必须是pdf文件!");
+                    return result;
+                }
+                int base64StrLength = base64Str.length();
+                if (COMPUTE < base64StrLength) {
+                    result.setMsg("pdf不可超过10M!");
+                    return result;
+                }
+                base64Str = base64Str.replaceAll(" ", "+");
+            }
+
+
             CustomerRec customerRec = new CustomerRec();
             customerRec.setCustomerName(appKey);
             customerRec.setCompanyReferencenum(taxplayerCode);
@@ -563,6 +582,22 @@ public class NoCarInterServiceImpl implements NoCarInterService {
                 result.setMsg("客户:" + appKey + ";税号" + taxplayerCode + "未在平台备案成功,请先做备案");
                 return result;
             }
+
+            if(StringUtils.isNotBlank(waybillFileName) && StringUtils.isNotBlank(base64Str) && null != contractType){
+                String fileType = waybillFileName.substring(waybillFileName.lastIndexOf(".") + 1).toLowerCase();
+                if (!PDF.equals(fileType)) {
+                    result.setMsg("必须是pdf文件!");
+                    return result;
+                }
+                int base64StrLength = base64Str.length();
+                if (COMPUTE < base64StrLength) {
+                    result.setMsg("pdf不可超过10M!");
+                    return result;
+                }
+                base64Str = base64Str.replaceAll(" ", "+");
+            }
+
+
             NoCarWayBill noCarWayBill = getNoCarWayBills(appKey, num, plateNumber, plateColor, startTime, sourceAddr, destAddr, predictEndTime, fee, titleType, taxplayerCode, customerRec);
 
             noCarWayBill.setWaybillFileName(waybillFileName);

+ 1 - 1
src/main/java/com/jkcredit/invoice/util/QueryDemoTest.java

@@ -114,7 +114,7 @@ public class QueryDemoTest {
          * 具体业务参数放在data中
          */
         JSONObject dataJson = new JSONObject();
-        dataJson.put("num", "1556502451-23");
+        dataJson.put("num", "1556502451-24");
         dataJson.put("plateNumber", "京CF0237");
         dataJson.put("plateColor", 1);
         dataJson.put("startTime", "2023-07-05T19:25:56");