fix: 收票指定应付调试数据
This commit is contained in:
@@ -32,8 +32,10 @@ import feign.Util;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +72,32 @@ public class CustomFeignLogger extends Logger {
|
|||||||
bodyStr = new String(body, StandardCharsets.UTF_8);
|
bodyStr = new String(body, StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("===> [{}] {} {} | Headers: {} | Body: {}", configKey, method, url, headers, flattenBody(bodyStr));
|
String queryParams = extractQueryParams(url);
|
||||||
|
if ("GET".equalsIgnoreCase(method) && !queryParams.isEmpty()) {
|
||||||
|
log.info("===> [{}] {} {} | Headers: {} | Params: {} | Body: {}", configKey, method, url, headers, queryParams, flattenBody(bodyStr));
|
||||||
|
} else {
|
||||||
|
log.info("===> [{}] {} {} | Headers: {} | Body: {}", configKey, method, url, headers, flattenBody(bodyStr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractQueryParams(String url) {
|
||||||
|
int queryStart = url.indexOf('?');
|
||||||
|
if (queryStart < 0 || queryStart >= url.length() - 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String queryString = url.substring(queryStart + 1);
|
||||||
|
Map<String, String> params = new LinkedHashMap<>();
|
||||||
|
for (String pair : queryString.split("&")) {
|
||||||
|
int eqPos = pair.indexOf('=');
|
||||||
|
if (eqPos > 0) {
|
||||||
|
String key = URLDecoder.decode(pair.substring(0, eqPos), StandardCharsets.UTF_8);
|
||||||
|
String value = URLDecoder.decode(pair.substring(eqPos + 1), StandardCharsets.UTF_8);
|
||||||
|
params.put(key, value);
|
||||||
|
} else if (!pair.isEmpty()) {
|
||||||
|
params.put(URLDecoder.decode(pair, StandardCharsets.UTF_8), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+25
-1
@@ -239,7 +239,31 @@ public class KingdeeReceivedInvoiceSyncSupport {
|
|||||||
// 【必填】单价:该行运输单价(与应付单同源;单据头 isincludetax=true 录入价税合计,单价仅作参考)
|
// 【必填】单价:该行运输单价(与应付单同源;单据头 isincludetax=true 录入价税合计,单价仅作参考)
|
||||||
entry.setPrice(entryGroup.price());
|
entry.setPrice(entryGroup.price());
|
||||||
// 【必填】物料编码.编码:按项目业务类型/业务模式/装卸大类映射(与应付单同源)
|
// 【必填】物料编码.编码:按项目业务类型/业务模式/装卸大类映射(与应付单同源)
|
||||||
entry.setMaterialNumber(entryGroup.materialNumber());
|
String materialNumber = entryGroup.materialNumber();
|
||||||
|
// 调试:物料编码和计量单位编码映射(收票单场景)
|
||||||
|
if (true) {
|
||||||
|
Map<String, String[]> comboMap = Map.of(
|
||||||
|
"国际货运代理服务费", new String[]{"Item-00001081", "ci"},
|
||||||
|
"物流配送", new String[]{"Item-00001080", "TON"},
|
||||||
|
"国内道路货物运输服务-公路运输-吨", new String[]{"Item-00001080", "TON"},
|
||||||
|
"国内道路货物运输服务-公路运输-公斤", new String[]{"Item-00001080", "KG"},
|
||||||
|
"装卸", new String[]{"Item-00001080", "KG"}
|
||||||
|
);
|
||||||
|
String measureunitName = entryGroup.measureunitNumber();
|
||||||
|
String comboKey = materialNumber;
|
||||||
|
if (materialNumber.contains("国内道路货物运输服务")) {
|
||||||
|
comboKey = materialNumber + "-" + measureunitName;
|
||||||
|
}
|
||||||
|
if (comboMap.containsKey(comboKey)) {
|
||||||
|
String[] combo = comboMap.get(comboKey);
|
||||||
|
materialNumber = combo[0];
|
||||||
|
} else {
|
||||||
|
List<String[]> combos = new ArrayList<>(comboMap.values());
|
||||||
|
String[] randomCombo = combos.get(new java.util.Random().nextInt(combos.size()));
|
||||||
|
materialNumber = randomCombo[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entry.setMaterialNumber(materialNumber);
|
||||||
// 金额(不含税):该行结算金额(不含税)(与应付单 e_amount 同源取数;结算合计费用项行无不含税金额不传)
|
// 金额(不含税):该行结算金额(不含税)(与应付单 e_amount 同源取数;结算合计费用项行无不含税金额不传)
|
||||||
if (entryGroup.amountNoTax() != null) {
|
if (entryGroup.amountNoTax() != null) {
|
||||||
entry.setEAmount(kingdeeApBillSyncSupport.money(entryGroup.amountNoTax()));
|
entry.setEAmount(kingdeeApBillSyncSupport.money(entryGroup.amountNoTax()));
|
||||||
|
|||||||
Reference in New Issue
Block a user