Merge branch 'test' of https://git.lionquexpress.com/wuweihua/BMS
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
@@ -35,15 +35,15 @@ public class OracleOrderBillMapper
|
|||||||
req.setUpstreamRow(row);
|
req.setUpstreamRow(row);
|
||||||
req.setCustomerCode(firstStr(row, "CUSTOMER_CODE"));
|
req.setCustomerCode(firstStr(row, "CUSTOMER_CODE"));
|
||||||
req.setCustomerName(firstStr(row, "CUSTOMER_NAME"));
|
req.setCustomerName(firstStr(row, "CUSTOMER_NAME"));
|
||||||
// Upstream product identity: TAB_ORDER.LINE_CODE / LINE_NAME only
|
// Upstream product identity: LINE_CODE / LINE_NAME (fallback PRODUCT_*).
|
||||||
// (BMS product_code_mapping applied later in quote / persist).
|
// (BMS product_code_mapping applied later in quote / persist).
|
||||||
String product = firstStr(row, "LINE_CODE");
|
String product = firstStr(row, "LINE_CODE", "PRODUCT_CODE");
|
||||||
if (StringUtils.isEmpty(product))
|
if (StringUtils.isEmpty(product))
|
||||||
{
|
{
|
||||||
product = defaultProductCode;
|
product = defaultProductCode;
|
||||||
}
|
}
|
||||||
req.setProductCode(product);
|
req.setProductCode(product);
|
||||||
req.setProductName(firstStr(row, "LINE_NAME"));
|
req.setProductName(firstStr(row, "LINE_NAME", "PRODUCT_NAME"));
|
||||||
req.setCountryCode(firstStr(row, "COUNTRY"));
|
req.setCountryCode(firstStr(row, "COUNTRY"));
|
||||||
String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY");
|
String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY");
|
||||||
req.setCountryName(countryName);
|
req.setCountryName(countryName);
|
||||||
|
|||||||
+27
-7
@@ -1698,17 +1698,18 @@ public class BmsProductServiceImpl implements IBmsProductService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String code = cellString(row.getCell(colCode));
|
String rawCode = cellString(row.getCell(colCode));
|
||||||
if (StringUtils.isEmpty(code) || code.contains("对接代码"))
|
if (StringUtils.isEmpty(rawCode) || rawCode.contains("对接代码"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!code.matches("(?i)^[A-Z0-9_-]+$"))
|
String code = normalizeImportProductCode(rawCode);
|
||||||
|
if (StringUtils.isEmpty(code))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BmsProduct p = new BmsProduct();
|
BmsProduct p = new BmsProduct();
|
||||||
p.setProductCode(code.trim());
|
p.setProductCode(code);
|
||||||
p.setProductName(cellString(row.getCell(colName)));
|
p.setProductName(cellString(row.getCell(colName)));
|
||||||
p.setServiceLevel(cellString(row.getCell(colLevel)));
|
p.setServiceLevel(cellString(row.getCell(colLevel)));
|
||||||
p.setCargoAttr(cellString(row.getCell(colCargo)));
|
p.setCargoAttr(cellString(row.getCell(colCargo)));
|
||||||
@@ -1725,6 +1726,25 @@ public class BmsProductServiceImpl implements IBmsProductService
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strip vendor suffixes such as "WSP046(中性)" / "WSP046(中性)" -> "WSP046".
|
||||||
|
* Returns null when no leading product-code token remains.
|
||||||
|
*/
|
||||||
|
private static String normalizeImportProductCode(String raw)
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(raw))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String s = raw.trim().replaceAll("[\\((][^\\))]*[\\))]", "").trim();
|
||||||
|
java.util.regex.Matcher m = java.util.regex.Pattern.compile("(?i)^([A-Z0-9_-]+)").matcher(s);
|
||||||
|
if (!m.find())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
|
||||||
/** Header column, or the legacy fixed offset when the title is absent. */
|
/** Header column, or the legacy fixed offset when the title is absent. */
|
||||||
private static int catalogColumn(Row headerRow, String keyword, int fallback)
|
private static int catalogColumn(Row headerRow, String keyword, int fallback)
|
||||||
{
|
{
|
||||||
@@ -2476,8 +2496,8 @@ public class BmsProductServiceImpl implements IBmsProductService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String code = cellString(row.getCell(colCode));
|
String code = normalizeImportProductCode(cellString(row.getCell(colCode)));
|
||||||
if (StringUtils.isEmpty(code) || !code.matches("(?i)^[A-Z0-9_-]+$"))
|
if (StringUtils.isEmpty(code))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2487,7 +2507,7 @@ public class BmsProductServiceImpl implements IBmsProductService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BmsProduct p = new BmsProduct();
|
BmsProduct p = new BmsProduct();
|
||||||
p.setProductCode(code.trim());
|
p.setProductCode(code);
|
||||||
p.setProductName(name.trim());
|
p.setProductName(name.trim());
|
||||||
if (colService >= 0)
|
if (colService >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
+27
-7
@@ -1529,17 +1529,18 @@ public class BmsRedlineProductServiceImpl implements IBmsRedlineProductService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String code = cellString(row.getCell(colCode));
|
String rawCode = cellString(row.getCell(colCode));
|
||||||
if (StringUtils.isEmpty(code) || code.contains("对接代码"))
|
if (StringUtils.isEmpty(rawCode) || rawCode.contains("对接代码"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!code.matches("(?i)^[A-Z0-9_-]+$"))
|
String code = normalizeImportProductCode(rawCode);
|
||||||
|
if (StringUtils.isEmpty(code))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BmsRedlineProduct p = new BmsRedlineProduct();
|
BmsRedlineProduct p = new BmsRedlineProduct();
|
||||||
p.setProductCode(code.trim());
|
p.setProductCode(code);
|
||||||
p.setProductName(cellString(row.getCell(colName)));
|
p.setProductName(cellString(row.getCell(colName)));
|
||||||
p.setServiceLevel(cellString(row.getCell(colLevel)));
|
p.setServiceLevel(cellString(row.getCell(colLevel)));
|
||||||
p.setCargoAttr(cellString(row.getCell(colCargo)));
|
p.setCargoAttr(cellString(row.getCell(colCargo)));
|
||||||
@@ -1556,6 +1557,25 @@ public class BmsRedlineProductServiceImpl implements IBmsRedlineProductService
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strip vendor suffixes such as "WSP046(中性)" / "WSP046(中性)" -> "WSP046".
|
||||||
|
* Returns null when no leading product-code token remains.
|
||||||
|
*/
|
||||||
|
private static String normalizeImportProductCode(String raw)
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(raw))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String s = raw.trim().replaceAll("[\\((][^\\))]*[\\))]", "").trim();
|
||||||
|
java.util.regex.Matcher m = java.util.regex.Pattern.compile("(?i)^([A-Z0-9_-]+)").matcher(s);
|
||||||
|
if (!m.find())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
|
||||||
/** Header column, or the legacy fixed offset when the title is absent. */
|
/** Header column, or the legacy fixed offset when the title is absent. */
|
||||||
private static int catalogColumn(Row headerRow, String keyword, int fallback)
|
private static int catalogColumn(Row headerRow, String keyword, int fallback)
|
||||||
{
|
{
|
||||||
@@ -2286,8 +2306,8 @@ public class BmsRedlineProductServiceImpl implements IBmsRedlineProductService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String code = cellString(row.getCell(colCode));
|
String code = normalizeImportProductCode(cellString(row.getCell(colCode)));
|
||||||
if (StringUtils.isEmpty(code) || !code.matches("(?i)^[A-Z0-9_-]+$"))
|
if (StringUtils.isEmpty(code))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2297,7 +2317,7 @@ public class BmsRedlineProductServiceImpl implements IBmsRedlineProductService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BmsRedlineProduct p = new BmsRedlineProduct();
|
BmsRedlineProduct p = new BmsRedlineProduct();
|
||||||
p.setProductCode(code.trim());
|
p.setProductCode(code);
|
||||||
p.setProductName(name.trim());
|
p.setProductName(name.trim());
|
||||||
if (colService >= 0)
|
if (colService >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
+39
@@ -2848,6 +2848,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
req.setCustomerCode(bill.getCustomerCode());
|
req.setCustomerCode(bill.getCustomerCode());
|
||||||
req.setCustomerName(bill.getCustomerName());
|
req.setCustomerName(bill.getCustomerName());
|
||||||
req.setProductCode(bill.getProductCode());
|
req.setProductCode(bill.getProductCode());
|
||||||
|
req.setProductName(resolveBillProductName(bill));
|
||||||
req.setCountryCode(bill.getCountryCode());
|
req.setCountryCode(bill.getCountryCode());
|
||||||
req.setCountryName(bill.getCountryName());
|
req.setCountryName(bill.getCountryName());
|
||||||
req.setDestPostcode(bill.getDestPostcode());
|
req.setDestPostcode(bill.getDestPostcode());
|
||||||
@@ -2880,6 +2881,44 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefer bill.productName; when missing or equal to productCode, recover from ext LINE_NAME / PRODUCT_NAME.
|
||||||
|
*/
|
||||||
|
private String resolveBillProductName(PrcOrderBill bill)
|
||||||
|
{
|
||||||
|
if (bill == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String code = StringUtils.trim(bill.getProductCode());
|
||||||
|
String name = StringUtils.trim(bill.getProductName());
|
||||||
|
if (StringUtils.isNotEmpty(name) && (StringUtils.isEmpty(code) || !name.equalsIgnoreCase(code)))
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(bill.getBillId()) || orderBillExtMapper == null)
|
||||||
|
{
|
||||||
|
return StringUtils.isNotEmpty(name) ? name : null;
|
||||||
|
}
|
||||||
|
PrcOrderBillExt ext = orderBillExtMapper.selectByBillId(bill.getBillId());
|
||||||
|
if (ext == null)
|
||||||
|
{
|
||||||
|
return StringUtils.isNotEmpty(name) ? name : null;
|
||||||
|
}
|
||||||
|
String lineName = StringUtils.trim(ext.getLineName());
|
||||||
|
if (StringUtils.isNotEmpty(lineName) && (StringUtils.isEmpty(code) || !lineName.equalsIgnoreCase(code)))
|
||||||
|
{
|
||||||
|
return lineName;
|
||||||
|
}
|
||||||
|
String upstreamName = StringUtils.trim(ext.getProductName());
|
||||||
|
if (StringUtils.isNotEmpty(upstreamName)
|
||||||
|
&& (StringUtils.isEmpty(code) || !upstreamName.equalsIgnoreCase(code)))
|
||||||
|
{
|
||||||
|
return upstreamName;
|
||||||
|
}
|
||||||
|
return StringUtils.isNotEmpty(name) ? name : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Date resolveBizDate(String bizDate)
|
private Date resolveBizDate(String bizDate)
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-2
@@ -473,9 +473,15 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
attemptedPriceMatch = true;
|
attemptedPriceMatch = true;
|
||||||
|
// Prefer package product name only when it is a real name (not equal to product code).
|
||||||
|
// Otherwise keep upstream LINE_NAME / catalog name (e.g. "标快鞋盒-包税(中性)").
|
||||||
if (setProduct != null && StringUtils.isNotEmpty(setProduct.getProductName()))
|
if (setProduct != null && StringUtils.isNotEmpty(setProduct.getProductName()))
|
||||||
{
|
{
|
||||||
productName = setProduct.getProductName();
|
String spn = setProduct.getProductName().trim();
|
||||||
|
if (StringUtils.isEmpty(productName) || !spn.equalsIgnoreCase(productCode))
|
||||||
|
{
|
||||||
|
productName = spn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String setType = StringUtils.isEmpty(set.getSetType()) ? TYPE_FIXED : set.getSetType();
|
String setType = StringUtils.isEmpty(set.getSetType()) ? TYPE_FIXED : set.getSetType();
|
||||||
@@ -1074,9 +1080,18 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
|||||||
TmsPriceQuoteResult r = new TmsPriceQuoteResult();
|
TmsPriceQuoteResult r = new TmsPriceQuoteResult();
|
||||||
r.setMatchSource(source);
|
r.setMatchSource(source);
|
||||||
r.setProductCode(productCode);
|
r.setProductCode(productCode);
|
||||||
|
// Prefer detail name only when it is not a code placeholder; keep upstream/catalog otherwise.
|
||||||
if (detail != null && StringUtils.isNotEmpty(detail.getProductName()))
|
if (detail != null && StringUtils.isNotEmpty(detail.getProductName()))
|
||||||
{
|
{
|
||||||
r.setProductName(detail.getProductName());
|
String dpn = detail.getProductName().trim();
|
||||||
|
if (StringUtils.isEmpty(productName) || !dpn.equalsIgnoreCase(productCode))
|
||||||
|
{
|
||||||
|
r.setProductName(dpn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r.setProductName(productName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user