Browse Source

模版修改

java8
han\hanst 2 months ago
parent
commit
7d42608f61
  1. 48
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java
  2. BIN
      src/main/resources/templates/declaration-all-showWeight-template-pdf.xlsx
  3. BIN
      src/main/resources/templates/declaration-all-showWeight-template.xlsx
  4. BIN
      src/main/resources/templates/declaration-all-template-pdf.xlsx
  5. BIN
      src/main/resources/templates/declaration-all-template.xlsx
  6. BIN
      src/main/resources/templates/declaration-packingList-template.xlsx
  7. BIN
      src/main/resources/templates/declaration-packingList2-template.xlsx

48
src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java

@ -2375,11 +2375,16 @@ public class CoDelServiceImpl implements CoDelService {
// 根据partNo获取hsCode
List<Map> hsCodes = coDelMapper.getHsCodeByPartNo(data.getSite(), partNoList);
Map<String, Map> hsCodeMap = new HashMap<>();
// 用于收集每个hsCode对应的SKU列表
Map<String, List<String>> hsCodeSkuListMap = new HashMap<>();
for (int i = 0; i < hsCodes.size(); i++) {
Map eorder = hsCodes.get(i);
String key = eorder.get("hsCode")+"&"+eorder.get("hsCodeDesc");
String sku = eorder.get("sku") != null ? eorder.get("sku").toString() : "";
if (hsCodeMap.containsKey(key)) {
hsCodeMap.get(key).put("sku", hsCodeMap.get(key).get("sku")+"\n "+eorder.get("sku"));
// 将SKU添加到列表中
hsCodeSkuListMap.get(key).add(sku);
} else {
// hscode所有属性
PartSubPropertiesValueData inData = new PartSubPropertiesValueData();
@ -2403,19 +2408,58 @@ public class CoDelServiceImpl implements CoDelService {
}
eorder.put("properties",properties);
hsCodeMap.put(key, eorder);
// 初始化SKU列表
List<String> skuList = new ArrayList<>();
skuList.add(sku);
hsCodeSkuListMap.put(key, skuList);
}
}
// 格式化SKU列表每3个一行
List<Map> list = new ArrayList<>(hsCodeMap.values());
for (int i = 0; i < list.size(); i++) {
Map fMap = list.get(i);
String key = fMap.get("hsCode")+"&"+fMap.get("hsCodeDesc");
List<String> skuList = hsCodeSkuListMap.get(key);
String formattedSku = formatSkuList(skuList);
fMap.put("sku", formattedSku);
fMap.put("content", "HS Code: "+fMap.get("hsCode")+
"\n品名: "+(data.getHsCodeDescType()!=null&& data.getHsCodeDescType().equals("N")?fMap.get("hsCodeDescEn"):fMap.get("hsCodeDesc"))+
"\n"+fMap.get("properties")+
"\n型号: "+fMap.get("sku"));
"\n型号: "+formattedSku);
}
template.addListVarAll(list);
}
/**
* 格式化SKU列表每3个一行从第2行开始前面加17个空格
*
* @param skuList SKU列表
* @return 格式化后的SKU字符串格式如: "10001,10002,10003\n 10004,10005,10006"
*/
private String formatSkuList(List<String> skuList) {
if (skuList == null || skuList.isEmpty()) {
return "";
}
StringBuilder result = new StringBuilder();
for (int i = 0; i < skuList.size(); i++) {
if (i > 0) {
// 每3个换行
if (i % 3 == 0) {
// 换行后添加17个空格
result.append("\n ");
} else {
// 否则用逗号分隔
result.append(",");
}
}
result.append(skuList.get(i));
}
return result.toString();
}
private void extractedInvoice(EcssDeclarationHeaderData data, ExcelTemplate template,
EcssCoDelNotifyHeaderData notifyHeader) {
List<EcssCoDelNotifyDetailData> notifyDetailList = data.getNotifyPartDetailList();

BIN
src/main/resources/templates/declaration-all-showWeight-template-pdf.xlsx

BIN
src/main/resources/templates/declaration-all-showWeight-template.xlsx

BIN
src/main/resources/templates/declaration-all-template-pdf.xlsx

BIN
src/main/resources/templates/declaration-all-template.xlsx

BIN
src/main/resources/templates/declaration-packingList-template.xlsx

BIN
src/main/resources/templates/declaration-packingList2-template.xlsx

Loading…
Cancel
Save