|
|
@@ -2,14 +2,15 @@ package org.springblade.los.Util;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.sun.org.apache.xpath.internal.operations.Bool;
|
|
|
+import io.reactivex.Single;
|
|
|
import org.springblade.los.edi.dto.InttraSiBillDto;
|
|
|
import org.springblade.los.edi.dto.InttraSiDto;
|
|
|
import org.springblade.los.edi.dto.InttraSoDto;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
@@ -92,6 +93,115 @@ public class RegularUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断字符串长度是否超长
|
|
|
+ *
|
|
|
+ * @param line 内容
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ public static String escapeEDILine(String line) {
|
|
|
+ if(line.isEmpty()){
|
|
|
+ return "";
|
|
|
+ } else {
|
|
|
+ return line.replaceAll("\\?", "??").replaceAll("\\+", "?+").replaceAll("'", "?'").replaceAll(":", "?:");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static int englishToNumber(String englishWord) {
|
|
|
+ String[] words = {"ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX",
|
|
|
+ "SEVEN", "EIGHT", "NINE", "TEN"};
|
|
|
+ int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
|
|
+
|
|
|
+ for (int i = 0; i < words.length; i++) {
|
|
|
+ if (englishWord.equalsIgnoreCase(words[i])) {
|
|
|
+ return numbers[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 3; // 默认 3
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String formatTempNumber(BigDecimal num, int len){
|
|
|
+ String S = num.setScale(3, RoundingMode.HALF_UP).toString();
|
|
|
+ while(S.endsWith("0")){
|
|
|
+ S = S.substring(0, S.length()-1);
|
|
|
+ }
|
|
|
+ if(S.endsWith(".")){
|
|
|
+ S = S.substring(0, S.length()-1);
|
|
|
+ }
|
|
|
+ String symbol = "";
|
|
|
+ if(S.equals("0")) {
|
|
|
+ S="";
|
|
|
+ }else{
|
|
|
+ if (S.startsWith("-")) {
|
|
|
+ symbol = "-";
|
|
|
+ S = S.substring(1);
|
|
|
+ }
|
|
|
+ while (S.length() < len) {
|
|
|
+ S = "0" + S;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return symbol + S;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断字符串长度是否超长
|
|
|
+ *
|
|
|
+ * @param text 内容
|
|
|
+ * @param lineLen 格式化后每行最大长度,最小值为 2
|
|
|
+ * @param Escape 是否做转义处理
|
|
|
+ * @return List<String>结果
|
|
|
+ */
|
|
|
+ public static List<String> reformatEDIText(String text, int lineLen, Boolean Escape) {
|
|
|
+ List<String> lines = new ArrayList<>();
|
|
|
+ if(!text.isEmpty()){
|
|
|
+ String[] buf = text.split("\n");
|
|
|
+ Pattern p1 = Pattern.compile("[a-zA-Z]");
|
|
|
+ for (String item : buf) {
|
|
|
+ String ln = item.trim();
|
|
|
+ while (!ln.isEmpty()) {
|
|
|
+ if (ln.length() <= lineLen) {
|
|
|
+ lines.add(Escape ?escapeEDILine(ln) : ln);
|
|
|
+ ln = "";
|
|
|
+ } else {
|
|
|
+ if (!p1.matcher(ln.charAt(lineLen - 1) + "").matches()) {
|
|
|
+ if (Escape){
|
|
|
+ lines.add(escapeEDILine(ln.substring(0, lineLen)));
|
|
|
+ } else {
|
|
|
+ lines.add(ln.substring(0, lineLen));
|
|
|
+ }
|
|
|
+ ln = ln.substring(lineLen);
|
|
|
+ } else {
|
|
|
+ int p = -1;
|
|
|
+ for (int i = lineLen - 2; i >= 0; i--) {
|
|
|
+ if (!p1.matcher(ln.charAt(i) + "").matches()) {
|
|
|
+ p = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (p == -1) {
|
|
|
+ if (Escape){
|
|
|
+ lines.add(escapeEDILine(ln.substring(0, lineLen)));
|
|
|
+ } else {
|
|
|
+ lines.add(ln.substring(0, lineLen));
|
|
|
+ }
|
|
|
+ ln = ln.substring(lineLen);
|
|
|
+ } else {
|
|
|
+ if (Escape){
|
|
|
+ lines.add(escapeEDILine(ln.substring(0, p + 1)));
|
|
|
+ } else {
|
|
|
+ lines.add(ln.substring(0, p + 1));
|
|
|
+ }
|
|
|
+ ln = ln.substring(p + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return lines;
|
|
|
+ }
|
|
|
|
|
|
public static Map<String, Object> notNullInttraSoDto(InttraSoDto inttraSoDto) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
@@ -258,14 +368,12 @@ public class RegularUtils {
|
|
|
if (regularLength(inttraSoDto.getVolumeOfGoods().toString(), 18)) {
|
|
|
textLength += "货物体积,";
|
|
|
} else {
|
|
|
- inttraSoDto.setVolumeOfGoods(inttraSoDto.getVolumeOfGoods().setScale(0, RoundingMode.HALF_UP).abs());
|
|
|
+ inttraSoDto.setVolumeOfGoods(inttraSoDto.getVolumeOfGoods().setScale(4, RoundingMode.HALF_UP).abs());
|
|
|
}
|
|
|
}
|
|
|
//总箱数
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getTotalBoxNumber())) {
|
|
|
- if (regularLength(inttraSoDto.getTotalBoxNumber().toString(), 18)) {
|
|
|
- textLength += "总箱数,";
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
//付款地代码
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getPaymentLocationCode())) {
|
|
|
@@ -339,17 +447,17 @@ public class RegularUtils {
|
|
|
character += "提单号,";
|
|
|
}
|
|
|
}
|
|
|
- //运费协议号
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getFreightProtocolNumber())) {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getFreightProtocolNumber(),true);
|
|
|
+ //客户订舱约号
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getCorpArgreementNo())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getCorpArgreementNo(),true);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
if (regularLength(mapString.get("susscess"), 30)) {
|
|
|
- textLength += "运费协议号,";
|
|
|
+ textLength += "客户订舱约号,";
|
|
|
} else {
|
|
|
- inttraSoDto.setFreightProtocolNumber(mapString.get("susscess"));
|
|
|
+ inttraSoDto.setCorpArgreementNo(mapString.get("susscess"));
|
|
|
}
|
|
|
} else {
|
|
|
- character += "运费协议号,";
|
|
|
+ character += "客户订舱约号,";
|
|
|
}
|
|
|
}
|
|
|
//主拼号
|
|
|
@@ -425,14 +533,27 @@ public class RegularUtils {
|
|
|
character += "航次,";
|
|
|
}
|
|
|
}
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getBookingRemarks())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getCarrierCode(),false);
|
|
|
+ if ("200".equals(mapString.get("code"))) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ character += "订舱备注,";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
//船司代码
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getVesselCarrierCode())) {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getVesselCarrierCode(),true);
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getCarrierCode())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getCarrierCode(),true);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
- if ("HLCU".equals(mapString.get("susscess"))) {
|
|
|
+ // 赫伯罗特 或者 达飞
|
|
|
+ String CC = mapString.get("susscess");
|
|
|
+ if ("HLCU".equals(CC) || "CMDU".equals(CC) || "ANNU".equals(CC) || "CHNL".equals(CC)) {
|
|
|
String text = "";
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getBillNo())) {
|
|
|
text += inttraSoDto.getBillNo() + ";";
|
|
|
+ }else{
|
|
|
+ text += ";";
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getPaymentType())) {
|
|
|
if ("PP".equals(inttraSoDto.getPaymentType())) {
|
|
|
@@ -446,6 +567,8 @@ public class RegularUtils {
|
|
|
text += "FREIGHT PAYABLE AT " + inttraSoDto.getPaymentLand() + ";";
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ text += ";";
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getTransportTermCode())) {
|
|
|
if ("29".equals(inttraSoDto.getTransportTermCode())) {
|
|
|
@@ -457,20 +580,41 @@ public class RegularUtils {
|
|
|
} else if ("30".equals(inttraSoDto.getTransportTermCode())) {
|
|
|
text += "CY to CY;";
|
|
|
}
|
|
|
+ }else{
|
|
|
+ text += ";";
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getBookingNo())) {
|
|
|
- text += inttraSoDto.getBookingNo() + ";";
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getCorpArgreementNo())) {
|
|
|
+ text += inttraSoDto.getCorpArgreementNo() + ";";
|
|
|
+ }else{
|
|
|
+ text += ";";
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getPlaceDeliveryName())) {
|
|
|
text += inttraSoDto.getPlaceDeliveryName() + ";";
|
|
|
} else {
|
|
|
text += inttraSoDto.getPlaceReceiptName() + ";";
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getCarrySingleRemarks())) {
|
|
|
- text += inttraSoDto.getCarrySingleRemarks() + ";";
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getBookingRemarks())) {
|
|
|
+ String bookingRemarks = inttraSoDto.getBookingRemarks().trim();
|
|
|
+ if(!bookingRemarks.isEmpty()) {
|
|
|
+ String[] bookingRemarksArr = bookingRemarks.replaceAll("\r", "").split("\n");
|
|
|
+ // text += String.join((CharSequence) ",", Arrays.stream(bookingRemarksArr).filter(a->!a.trim().isEmpty()));
|
|
|
+ Boolean firstLine = true;
|
|
|
+ for (int i = 0; i < bookingRemarksArr.length; i++) {
|
|
|
+ String line = bookingRemarksArr[i].trim();
|
|
|
+ if(!line.isEmpty()){
|
|
|
+ if(firstLine){
|
|
|
+ text += escapeEDILine(line);
|
|
|
+ firstLine = false;
|
|
|
+ }else{
|
|
|
+ text += ";" + escapeEDILine(line);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- inttraSoDto.setRemarks(text);
|
|
|
- } else if ("MAEU".equals(mapString.get("susscess"))) {
|
|
|
+ inttraSoDto.setBookingRemarks(text);
|
|
|
+ } else if ("MAEU".equals(CC) || "MCCQ".equals(CC) ) {
|
|
|
+ // 马士基
|
|
|
String text = "";
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getPaymentType())) {
|
|
|
if ("PP".equals(inttraSoDto.getPaymentType())) {
|
|
|
@@ -498,27 +642,47 @@ public class RegularUtils {
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getPackagesNumber()) && ObjectUtils.isNotNull(inttraSoDto.getPackagesCode())) {
|
|
|
text += inttraSoDto.getPageNumber() + " " + inttraSoDto.getPackagesCode();
|
|
|
+ }else{
|
|
|
+ msg += "件数及包装单位,";
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getCarrySingleRemarks())) {
|
|
|
- text += inttraSoDto.getCarrySingleRemarks() + ";";
|
|
|
- }
|
|
|
- inttraSoDto.setRemarks(text);
|
|
|
- } else {
|
|
|
- //备注
|
|
|
- if (ObjectUtils.isNull(inttraSoDto.getRemarks())) {
|
|
|
- msg += "备注,";
|
|
|
- } else {
|
|
|
- Map<String, String> mapString1 = regularEn(inttraSoDto.getRemarks(),false);
|
|
|
- if ("200".equals(mapString1.get("code"))) {
|
|
|
- if (regularLength(mapString1.get("susscess"), 512)) {
|
|
|
- textLength += "备注,";
|
|
|
- } else {
|
|
|
- inttraSoDto.setRemarks(mapString1.get("susscess"));
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getBookingRemarks())) {
|
|
|
+ String bookingRemarks = inttraSoDto.getBookingRemarks().trim();
|
|
|
+ if(!bookingRemarks.isEmpty()) {
|
|
|
+ String[] bookingRemarksArr = bookingRemarks.replaceAll("\r", "").split("\n");
|
|
|
+ // text += String.join((CharSequence) ",", Arrays.stream(bookingRemarksArr).filter(a->!a.trim().isEmpty()));
|
|
|
+ Boolean firstLine = true;
|
|
|
+ for (int i = 0; i < bookingRemarksArr.length; i++) {
|
|
|
+ String line = bookingRemarksArr[i].trim();
|
|
|
+ if(!line.isEmpty()){
|
|
|
+ if(firstLine){
|
|
|
+ text += escapeEDILine(line);
|
|
|
+ firstLine = false;
|
|
|
+ }else{
|
|
|
+ text += ";" + escapeEDILine(line);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- character += "备注,";
|
|
|
}
|
|
|
}
|
|
|
+ inttraSoDto.setBookingRemarks(text);
|
|
|
+ } else {
|
|
|
+ // 其他船公司不写
|
|
|
+ inttraSoDto.setBookingRemarks("");
|
|
|
+ //备注
|
|
|
+// if (ObjectUtils.isNull(inttraSoDto.getBookingRemarks())) {
|
|
|
+// msg += "备注,";
|
|
|
+// } else {
|
|
|
+// Map<String, String> mapString1 = regularEn(inttraSoDto.getBookingRemarks(),false);
|
|
|
+// if ("200".equals(mapString1.get("code"))) {
|
|
|
+// if (regularLength(mapString1.get("susscess"), 512)) {
|
|
|
+// textLength += "备注,";
|
|
|
+// } else {
|
|
|
+// inttraSoDto.setBookingRemarks(mapString1.get("susscess"));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// character += "备注,";
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
inttraSoDto.setVesselCarrierCode(mapString.get("susscess"));
|
|
|
} else {
|
|
|
@@ -645,94 +809,34 @@ public class RegularUtils {
|
|
|
}
|
|
|
}
|
|
|
//发货人
|
|
|
- if (ObjectUtils.isNull(inttraSoDto.getHsHipperOne())) {
|
|
|
+ if (ObjectUtils.isNull(inttraSoDto.getHShipper())) {
|
|
|
msg += "发货人,";
|
|
|
} else {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getHsHipperOne(), false);
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getHShipper(), false);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
- String hipper = mapString.get("susscess");
|
|
|
- /*if (regularLength(hipper, 35)) {
|
|
|
- inttraSoDto.setHsHipperOne(hipper.substring(0, 35));
|
|
|
- if (regularLength(hipper, 35) && hipper.length() <= 70) {
|
|
|
- inttraSoDto.setHsHipperTwo(hipper.substring(35));
|
|
|
- } else if (regularLength(hipper, 70) && hipper.length() <= 105) {
|
|
|
- inttraSoDto.setHsHipperThree(hipper.substring(70));
|
|
|
- } else if (regularLength(hipper, 105) && hipper.length() <= 140) {
|
|
|
- inttraSoDto.setHsHipperFour(hipper.substring(105));
|
|
|
- } else if (regularLength(hipper, 140) && hipper.length() <= 175) {
|
|
|
- inttraSoDto.setHsHipperFive(hipper.substring(140));
|
|
|
- } else {
|
|
|
- inttraSoDto.setHsHipperFive(hipper.substring(174) + "*");
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getProductName())) {
|
|
|
- inttraSoDto.setProductName(inttraSoDto.getProductName() + "*" + hipper.substring(174));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- inttraSoDto.setIdentifying(mapString.get("susscess"));
|
|
|
- }*/
|
|
|
- inttraSoDto.setHsHipperOne(mapString.get("susscess"));
|
|
|
+ inttraSoDto.setHShipper(mapString.get("susscess"));
|
|
|
} else {
|
|
|
character += "发货人,";
|
|
|
}
|
|
|
}
|
|
|
//收货人
|
|
|
- if (ObjectUtils.isNull(inttraSoDto.getHConsigneeOne())) {
|
|
|
+ if (ObjectUtils.isNull(inttraSoDto.getHConsignee())) {
|
|
|
msg += "收货人,";
|
|
|
} else {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getHConsigneeOne(),false);
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getHConsignee(),false);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
- String hConsignee = mapString.get("susscess");
|
|
|
- /*if (regularLength(hConsignee, 35)) {
|
|
|
- inttraSoDto.setHConsigneeOne(hConsignee.substring(0, 35));
|
|
|
- if (regularLength(hConsignee, 35) && hConsignee.length() <= 70) {
|
|
|
- inttraSoDto.setHConsigneeTwo(hConsignee.substring(35));
|
|
|
- } else if (regularLength(hConsignee, 70) && hConsignee.length() <= 105) {
|
|
|
- inttraSoDto.setHConsigneeThree(hConsignee.substring(70));
|
|
|
- } else if (regularLength(hConsignee, 105) && hConsignee.length() <= 140) {
|
|
|
- inttraSoDto.setHConsigneeFour(hConsignee.substring(105));
|
|
|
- } else if (regularLength(hConsignee, 140) && hConsignee.length() <= 175) {
|
|
|
- inttraSoDto.setHConsigneeFive(hConsignee.substring(140));
|
|
|
- } else {
|
|
|
- inttraSoDto.setHConsigneeFive(hConsignee.substring(174) + "*");
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getProductName())) {
|
|
|
- inttraSoDto.setProductName(inttraSoDto.getProductName() + "**" + hConsignee.substring(174));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- inttraSoDto.setIdentifying(mapString.get("susscess"));
|
|
|
- }*/
|
|
|
- inttraSoDto.setHConsigneeOne(mapString.get("susscess"));
|
|
|
+ inttraSoDto.setHConsignee(mapString.get("susscess"));
|
|
|
} else {
|
|
|
character += "收货人,";
|
|
|
}
|
|
|
}
|
|
|
//通知人
|
|
|
- if (ObjectUtils.isNull(inttraSoDto.getHNotifyOne())) {
|
|
|
+ if (ObjectUtils.isNull(inttraSoDto.getHNotify())) {
|
|
|
msg += "通知人,";
|
|
|
} else {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getHConsigneeOne(),false);
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getHNotify(),false);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
- String hNotify = mapString.get("susscess");
|
|
|
- /*if (regularLength(hNotify, 35)) {
|
|
|
- inttraSoDto.setHNotifyOne(hNotify.substring(0, 35));
|
|
|
- if (regularLength(hNotify, 35) && hNotify.length() <= 70) {
|
|
|
- inttraSoDto.setHNotifyTwo(hNotify.substring(35));
|
|
|
- } else if (regularLength(hNotify, 70) && hNotify.length() <= 105) {
|
|
|
- inttraSoDto.setHNotifyThree(hNotify.substring(70));
|
|
|
- } else if (regularLength(hNotify, 105) && hNotify.length() <= 140) {
|
|
|
- inttraSoDto.setHNotifyFour(hNotify.substring(105));
|
|
|
- } else if (regularLength(hNotify, 140) && hNotify.length() <= 175) {
|
|
|
- inttraSoDto.setHNotifyFive(hNotify.substring(140));
|
|
|
- } else {
|
|
|
- inttraSoDto.setHNotifyFive(hNotify.substring(174) + "*");
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getProductName())) {
|
|
|
- inttraSoDto.setProductName(inttraSoDto.getProductName() + "***" + hNotify.substring(174));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- inttraSoDto.setIdentifying(mapString.get("susscess"));
|
|
|
- }*/
|
|
|
- inttraSoDto.setHConsigneeOne(mapString.get("susscess"));
|
|
|
+ inttraSoDto.setHNotify(mapString.get("susscess"));
|
|
|
} else {
|
|
|
character += "通知人,";
|
|
|
}
|
|
|
@@ -750,17 +854,14 @@ public class RegularUtils {
|
|
|
}
|
|
|
//船司称呼
|
|
|
if (ObjectUtils.isNull(inttraSoDto.getCarrierName())) {
|
|
|
- msg += "船司称呼,";
|
|
|
+ msg += "船司名称,";
|
|
|
} else {
|
|
|
Map<String, String> mapString = regularEn(inttraSoDto.getCarrierName(),true);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
- if (regularLength(mapString.get("susscess"), 35)) {
|
|
|
- textLength += "船司称呼,";
|
|
|
- } else {
|
|
|
- inttraSoDto.setCarrierName(mapString.get("susscess"));
|
|
|
- }
|
|
|
+ String S = mapString.get("susscess");
|
|
|
+ inttraSoDto.setCarrierName(S.substring(0, S.length()));
|
|
|
} else {
|
|
|
- character += "船司称呼,";
|
|
|
+ character += "船司名称,";
|
|
|
}
|
|
|
}
|
|
|
//联系信息
|
|
|
@@ -939,7 +1040,7 @@ public class RegularUtils {
|
|
|
}
|
|
|
//货代称呼
|
|
|
if (ObjectUtils.isNull(inttraSoDto.getFreightForwarderName())) {
|
|
|
- msg += "货代称呼,";
|
|
|
+ // msg += "货代称呼,";
|
|
|
} else {
|
|
|
Map<String, String> mapString = regularEn(inttraSoDto.getFreightForwarderName(),true);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
@@ -991,7 +1092,7 @@ public class RegularUtils {
|
|
|
}
|
|
|
//发送方联系电话
|
|
|
if (ObjectUtils.isNull(inttraSoDto.getSenderTel())) {
|
|
|
- msg += "发送方联系电话,";
|
|
|
+ // msg += "发送方联系电话,";
|
|
|
} else {
|
|
|
Map<String, String> mapString = regularEn(inttraSoDto.getSenderTel(),true);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
@@ -1021,9 +1122,6 @@ public class RegularUtils {
|
|
|
}
|
|
|
//提单份数
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getBillLadingNumber())) {
|
|
|
- if (regularLength(inttraSoDto.getBillLadingNumber().toString(), 2)) {
|
|
|
- textLength += "提单份数,";
|
|
|
- }
|
|
|
}
|
|
|
//包装件数
|
|
|
if (ObjectUtils.isNull(inttraSoDto.getPackagesNumbers())) {
|
|
|
@@ -1061,20 +1159,20 @@ public class RegularUtils {
|
|
|
}
|
|
|
//HS 编码
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getHsCode())) {
|
|
|
- if (regularLength(inttraSoDto.getHsCode().toString(), 10)) {
|
|
|
+ if (regularLength(inttraSoDto.getHsCode(), 10)) {
|
|
|
textLength += "HS 编码,";
|
|
|
}
|
|
|
}
|
|
|
//货描
|
|
|
- if (ObjectUtils.isNull(inttraSoDto.getProductName())) {
|
|
|
+ if (ObjectUtils.isNull(inttraSoDto.getGoodsDesc())) {
|
|
|
msg += "货描,";
|
|
|
} else {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getProductName(),false);
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getGoodsDesc(),false);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
if (regularLength(mapString.get("susscess"), 512)) {
|
|
|
textLength += "货描,";
|
|
|
} else {
|
|
|
- inttraSoDto.setProductName(mapString.get("susscess"));
|
|
|
+ inttraSoDto.setGoodsDesc(mapString.get("susscess"));
|
|
|
}
|
|
|
} else {
|
|
|
character += "货描,";
|
|
|
@@ -1098,105 +1196,110 @@ public class RegularUtils {
|
|
|
}
|
|
|
//麦头
|
|
|
if (ObjectUtils.isNull(inttraSoDto.getMarks())) {
|
|
|
- msg += "麦头,";
|
|
|
+ msg += "唛头,";
|
|
|
} else {
|
|
|
Map<String, String> mapString = regularEn(inttraSoDto.getMarks(),true);
|
|
|
if ("200".equals(mapString.get("code"))) {
|
|
|
//35*50
|
|
|
if (regularLength(mapString.get("susscess"), 1750)) {
|
|
|
- textLength += "麦头,";
|
|
|
+ textLength += "唛头,";
|
|
|
} else {
|
|
|
inttraSoDto.setMarks(mapString.get("susscess"));
|
|
|
}
|
|
|
} else {
|
|
|
- character += "麦头,";
|
|
|
+ character += "唛头,";
|
|
|
}
|
|
|
}
|
|
|
//危险品国际编码
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getDgUnCode())) {
|
|
|
- if (regularLength(inttraSoDto.getDgUnCode(), 4)) {
|
|
|
- textLength += "危险品国际编码,";
|
|
|
- }
|
|
|
- }
|
|
|
- //页号
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getPageNumber())) {
|
|
|
- if (regularLength(inttraSoDto.getPageNumber().toString(), 7)) {
|
|
|
- textLength += "页号,";
|
|
|
- }
|
|
|
- }
|
|
|
- //闪点
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getDgFlashPoint())) {
|
|
|
- // todo
|
|
|
- StringBuilder data = new StringBuilder();
|
|
|
- boolean status = false;
|
|
|
- if (inttraSoDto.getDgFlashPoint().indexOf("-") != 0) {
|
|
|
- data = new StringBuilder(inttraSoDto.getDgFlashPoint().substring(0, inttraSoDto.getDgFlashPoint().indexOf("-")));
|
|
|
- status = true;
|
|
|
- }
|
|
|
- if (regularLength(data.toString(), 3)) {
|
|
|
- textLength += "闪点,";
|
|
|
- } else {
|
|
|
- int count = 3 - data.length();
|
|
|
- if (status) {
|
|
|
- for (int i = 0; i < count; i++) {
|
|
|
- data.insert(0, "0");
|
|
|
+ if (inttraSoDto.getCargoType().equals("danger")) {
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getDgUnCode())) {
|
|
|
+ if (regularLength(inttraSoDto.getDgUnCode(), 4)) {
|
|
|
+ textLength += "危险品国际编码,";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ msg += "危险品国际编码,";
|
|
|
+ }
|
|
|
+ //页号
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getPageNumber())) {
|
|
|
+ if (regularLength(inttraSoDto.getPageNumber().toString(), 7)) {
|
|
|
+ textLength += "页号,";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //闪点
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getDgFlashPoint())) {
|
|
|
+ // todo
|
|
|
+ StringBuilder data = new StringBuilder();
|
|
|
+ boolean status = false;
|
|
|
+ if (inttraSoDto.getDgFlashPoint().indexOf("-") != 0) {
|
|
|
+ data = new StringBuilder(inttraSoDto.getDgFlashPoint().substring(0, inttraSoDto.getDgFlashPoint().indexOf("-")));
|
|
|
+ status = true;
|
|
|
+ }
|
|
|
+ if (regularLength(data.toString(), 3)) {
|
|
|
+ textLength += "闪点,";
|
|
|
+ } else {
|
|
|
+ int count = 3 - data.length();
|
|
|
+ if (status) {
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
+ data.insert(0, "0");
|
|
|
+ }
|
|
|
+ inttraSoDto.setDgFlashPoint("-" + data);
|
|
|
}
|
|
|
- inttraSoDto.setDgFlashPoint("-" + data);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- //应急措施号
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getEmergencyMeasureNo())) {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getEmergencyMeasureNo(),true);
|
|
|
- if ("200".equals(mapString.get("code"))) {
|
|
|
- if (regularLength(mapString.get("susscess"), 6)) {
|
|
|
- textLength += "应急措施号,";
|
|
|
+ //应急措施号
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getEmergencyMeasureNo())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getEmergencyMeasureNo(), true);
|
|
|
+ if ("200".equals(mapString.get("code"))) {
|
|
|
+ if (regularLength(mapString.get("susscess"), 6)) {
|
|
|
+ textLength += "应急措施号,";
|
|
|
+ } else {
|
|
|
+ inttraSoDto.setEmergencyMeasureNo(mapString.get("susscess"));
|
|
|
+ }
|
|
|
} else {
|
|
|
- inttraSoDto.setEmergencyMeasureNo(mapString.get("susscess"));
|
|
|
+ character += "应急措施号,";
|
|
|
}
|
|
|
- } else {
|
|
|
- character += "应急措施号,";
|
|
|
}
|
|
|
- }
|
|
|
- //危险品备注
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getDgRemarks())) {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getDgRemarks(),false);
|
|
|
- if ("200".equals(mapString.get("code"))) {
|
|
|
- if (regularLength(mapString.get("susscess"), 30)) {
|
|
|
- textLength += "危险品备注,";
|
|
|
+ //危险品备注
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getDgRemarks())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getDgRemarks(), false);
|
|
|
+ if ("200".equals(mapString.get("code"))) {
|
|
|
+ if (regularLength(mapString.get("susscess"), 30)) {
|
|
|
+ textLength += "危险品备注,";
|
|
|
+ } else {
|
|
|
+ inttraSoDto.setDgRemarks(mapString.get("susscess"));
|
|
|
+ }
|
|
|
} else {
|
|
|
- inttraSoDto.setDgRemarks(mapString.get("susscess"));
|
|
|
+ character += "危险品备注,";
|
|
|
}
|
|
|
- } else {
|
|
|
- character += "危险品备注,";
|
|
|
}
|
|
|
- }
|
|
|
- //危险品联系人
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getDgContacts())) {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getDgContacts(),true);
|
|
|
- if ("200".equals(mapString.get("code"))) {
|
|
|
- if (regularLength(mapString.get("susscess"), 35)) {
|
|
|
- textLength += "危险品联系人,";
|
|
|
+ //危险品联系人
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getDgContacts())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getDgContacts(), true);
|
|
|
+ if ("200".equals(mapString.get("code"))) {
|
|
|
+ if (regularLength(mapString.get("susscess"), 35)) {
|
|
|
+ textLength += "危险品联系人,";
|
|
|
+ } else {
|
|
|
+ inttraSoDto.setDgContacts(mapString.get("susscess"));
|
|
|
+ }
|
|
|
} else {
|
|
|
- inttraSoDto.setDgContacts(mapString.get("susscess"));
|
|
|
+ character += "危险品联系人,";
|
|
|
}
|
|
|
- } else {
|
|
|
- character += "危险品联系人,";
|
|
|
}
|
|
|
- }
|
|
|
- //危险品电话号码
|
|
|
- if (ObjectUtils.isNotNull(inttraSoDto.getDgTel())) {
|
|
|
- Map<String, String> mapString = regularEn(inttraSoDto.getDgTel(),true);
|
|
|
- if ("200".equals(mapString.get("code"))) {
|
|
|
- if (regularLength(mapString.get("susscess"), 512)) {
|
|
|
- textLength += "危险品电话号码,";
|
|
|
+ //危险品电话号码
|
|
|
+ if (ObjectUtils.isNotNull(inttraSoDto.getDgTel())) {
|
|
|
+ Map<String, String> mapString = regularEn(inttraSoDto.getDgTel(), true);
|
|
|
+ if ("200".equals(mapString.get("code"))) {
|
|
|
+ if (regularLength(mapString.get("susscess"), 512)) {
|
|
|
+ textLength += "危险品电话号码,";
|
|
|
+ } else {
|
|
|
+ inttraSoDto.setDgTel(mapString.get("susscess"));
|
|
|
+ }
|
|
|
} else {
|
|
|
- inttraSoDto.setDgTel(mapString.get("susscess"));
|
|
|
+ character += "危险品电话号码,";
|
|
|
}
|
|
|
- } else {
|
|
|
- character += "危险品电话号码,";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (ObjectUtils.isNull(inttraSoDto.getBox())) {
|
|
|
msg += "箱型代码,";
|
|
|
} else {
|
|
|
@@ -2095,7 +2198,7 @@ public class RegularUtils {
|
|
|
}
|
|
|
//HS 编码
|
|
|
if (ObjectUtils.isNotNull(inttraSoDto.getHsCode())) {
|
|
|
- if (regularLength(inttraSoDto.getHsCode().toString(), 10)) {
|
|
|
+ if (regularLength(inttraSoDto.getHsCode(), 10)) {
|
|
|
textLength += "HS 编码,";
|
|
|
}
|
|
|
}
|