发布于2021-06-14 10:44 阅读(838) 评论(0) 点赞(4) 收藏(3)
版本:
SpringBoot 2.4
camel 3.5.0
最近在做跟一个第三方系统的对接,主要流程就是对方生成XML格式的报文,需要我方将其报文发送到海关申报,然后将申报完的数据再组装成XML报文格式发回到对方的FTP服务器。功能其实挺简单,用Apache的camel-ftp很容易就能实现,下面看看具体如何做吧。
<!-- camel-spring-boot-starter -->
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
<!-- camel ftp组件-->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
<version>3.5.0</version>
</dependency>
# camel配置
camel:
# camel ftp服务路由地址
route:
id: XMLRoute
ftp:
server: sftp://119.22.77.152:22/Export/Pre-CDF?username=root&password=123456&passiveMode=true&move=backup&moveFailed=error&delay=5000&exceptionHandler=#errorExceptionHandler&onCompletionExceptionHandler=#errorExceptionHandler
# server: file:e:/test?recursive=true&move=.backup&moveFailed=.error&exceptionHandler=#errorExceptionHandler&onCompletionExceptionHandler=#errorExceptionHandler
file:
download:
local:
# camel 文件内容下载到本地地址(配置中文乱码)
address: file:/home/platform/ex-dec/receive/
# camel 文件下载到本地备份地址
backup:
address: file:/home/platform/ex-dec/receive/backup/
package com.yorma.ex.camel.filter;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.Predicate;
import org.apache.camel.component.file.GenericFileMessage;
import org.springframework.stereotype.Component;
import java.io.RandomAccessFile;
/**
* camel过滤器
*
* @author ZHANGCHAO
* @date 2021/6/8 14:27
* @since 1.0.0
*/
@Slf4j
@Component
public class FtpDownloadFileFilter implements Predicate {
@Override
public boolean matches(Exchange exchange) {
boolean bMatches;
GenericFileMessage<RandomAccessFile> inFileMessage = (GenericFileMessage<RandomAccessFile>) exchange.getIn();
String fileName = inFileMessage.getGenericFile().getFileName();
// 只需要处理.xml格式的文件
bMatches = fileName.endsWith(".xml");
log.info("fileName:"+fileName+", matches:"+bMatches);
return bMatches;
}
}
package com.yorma.ex.camel.handle;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.spi.ExceptionHandler;
import org.apache.camel.spring.SpringCamelContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
/**
* 错误处理
*
* @author ZHANGCHAO
* @date 2021/6/9 8:44
* @since 1.0.0
*/
@Slf4j
@Component
public class ErrorExceptionHandler implements ExceptionHandler {
/**
* camel路由ID
*/
@Value("${camel.route.id}")
private String routeId;
@Override
public void handleException(Throwable exception) {
this.handleException(null, null, exception);
}
@Override
public void handleException(String message, Throwable exception) {
this.handleException(message, null, exception);
}
@Override
public void handleException(String message, Exchange exchange, Throwable exception) {
log.info("系统在处理下行数据时出现异常,获取Exchange对象是否为空:{},异常信息是:", null != exchange ? "不为空" : "为空", exception);
if (null != exchange) {
if (exchange.getContext() instanceof SpringCamelContext) {
SpringCamelContext springCamelContext = (SpringCamelContext) exchange.getContext();
// 关闭路由
stop(springCamelContext);
// 启动路由
start(springCamelContext);
} else {
log.info("系统在处理下行数据时出现异常,获取getContext不是SpringCamelContext");
exchange.getFromEndpoint().stop();
exchange.getContext().stop();
}
}
}
/**
* 关闭路由
*
* @param springCamelContext SpringCamelContext对象
*/
private void stop(SpringCamelContext springCamelContext) {
try {
log.info("路由ID:{},即将关闭", routeId);
springCamelContext.stopRoute(routeId);
log.info("路由ID:{},关闭完成", routeId);
} catch (Exception e) {
log.error("路由ID:{},在关闭路由时出现异常,异常信息是:", routeId, e);
}
}
/**
* 启动路由
*
* @param springCamelContext SpringCamelContext对象
*/
private void start(SpringCamelContext springCamelContext) {
// 获取当前时间
long currentTime = System.currentTimeMillis();
// 设置1小时后执行
currentTime += 60 * 60 * 1000;
Date date = new Date(currentTime);
log.info("路由ID:{},系统将在:{},启动此路由", routeId, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
// 启动路由
start(springCamelContext, date);
}
/**
* 指定时间启动路由
*
* @param springCamelContext SpringCamelContext对象
* @param startDate 启动时间
*/
private void start(SpringCamelContext springCamelContext, Date startDate) {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
try {
log.info("路由ID:{},即将启动", routeId);
springCamelContext.startRoute(routeId);
log.info("路由ID:{},启动完成", routeId);
} catch (Exception e) {
log.error("路由ID:{},在启动路由时出现异常,异常信息是:", routeId, e);
}
}
}, startDate);
}
}
package com.yorma.ex.camel.route;
import com.yorma.ex.camel.filter.FtpDownloadFileFilter;
import com.yorma.ex.camel.process.DataProcessor;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class CamelRouteBuilder extends RouteBuilder {
/**
* FTP服务器地址
*/
@Value("${camel.route.ftp.server}")
private String ftpServer;
/**
* 文件下载根路径
*/
@Value("${camel.file.download.local.address}")
private String basePath;
/**
* 备份目录根目录
*/
@Value("${camel.file.download.local.backup.address}")
private String backupBasePath;
@Autowired
private DataProcessor dataProcessor;
@Autowired
private FtpDownloadFileFilter ftpDownloadFileFilter;
@Override
public void configure() {
try {
from(ftpServer)
.log("原始xml文件: ${file:name}开始处理")
.filter(ftpDownloadFileFilter)
.toD(basePath)
// .toD(backupBasePath)
.log("原始xml文件: ${file:name}下载成功")
.process(dataProcessor);
} catch (Exception e) {
log.info("系统路由在执行任务时发生异常,异常信息是:", e);
}
}
}
package com.yorma.ex.camel.process;
import cn.hutool.core.io.IoUtil;
import com.yorma.dcl.api.DecApi;
import com.yorma.dcl.entity.DecHead;
import com.yorma.entity.YmMsg;
import com.yorma.ex.utils.JSONObject;
import com.yorma.ex.utils.XML;
import com.yorma.util.RequestKit;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import static cn.hutool.core.util.ObjectUtil.isNotEmpty;
import static cn.hutool.core.util.StrUtil.isBlank;
import static com.yorma.ex.utils.XmlUtils.setDecFromXML;
/**
* 文件处理
*
* @author Administrator
*/
@Slf4j
@Component
public class DataProcessor implements Processor {
@Autowired
private DecApi decApi;
/**
* 文件下载根路径
*/
@Value("${camel.file.download.local.address}")
private String basePath;
@Override
public void process(Exchange exchange) throws IOException {
// 获取文件名称
String fileName = String.valueOf(exchange.getIn().getHeader(Exchange.FILE_NAME));
if (isBlank(fileName)) {
log.info("获取文件名称为空或空字符串,系统终止操作");
return;
}
File file = new File(basePath.replaceFirst("file:", "") + fileName);
if (!file.exists()) {
log.info("未查找到下载的本地报文!");
return;
}
InputStream in = new FileInputStream(file);
String xml = IoUtil.read(in, StandardCharsets.UTF_8);
in.close();
JSONObject jsonObject = XML.toJSONObject(xml);
System.out.println("jsonObject==> " + jsonObject);
DecHead decHead = new DecHead();
setDecFromXML(decHead, jsonObject);
RequestKit.addHeader("apiKey", "461277322-943d-4b2f-b9b6-3f860d746ffd");
RequestKit.addHeader("apiUser", "exDecUser");
RequestKit.addHeader("Tenant-Id", "1310053879995457537");
RequestKit.addHeader("Customer-Id", "1310053881811587074");
YmMsg<DecHead> decHeadYmMsg = decApi.saveDecForEx(decHead);
if (isNotEmpty(decHeadYmMsg.getData())) {
DecHead resultHead = decHeadYmMsg.getData();
log.info("===> 已生成报关单草单" + resultHead.toString());
}
}
}
思路:将文件转为JSONObject,然后从里面get取值。
主要取值逻辑代码:
package com.yorma.ex.utils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.yorma.dcl.entity.*;
import com.yorma.ex.domain.CopLimit;
import com.yorma.ex.domain.LicenceEntity;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static cn.hutool.core.util.ObjectUtil.isEmpty;
import static cn.hutool.core.util.ObjectUtil.isNotEmpty;
import static com.yorma.ex.utils.Const.*;
/**
* @author ZHANGCHAO
* @date 2021/6/8 16:59
* @since 1.0.0
*/
@Slf4j
public class XmlUtils {
// public static final Map<String, String> map;
//
// static {
// map = new ConcurrentHashMap<>(16);
// Field[] fields = DecHead.class.getDeclaredFields();
// for (Field field : fields) {
// map.put(field.getName(), "666");
// }
// System.out.println("map==> " + map);
//
// }
/**
* 从解析的XML报文中赋值报关单
*
* @param decHead
* @param jsonObject
* @return void
* @author ZHANGCHAO
* @date 2021/6/9 9:21
*/
public static void setDecFromXML(DecHead decHead, JSONObject jsonObject) {
if (isEmpty(decHead) || isEmpty(jsonObject)) {
return;
}
JSONObject rootNode = jsonObject.getJSONObject(SHIPMENT_CDF_INBOUND_V2);
if (isEmpty(rootNode)) {
log.info("未找到报文[SHIPMENT_CDF_INBOUND_V2]根节点!");
throw new RuntimeException("未找到报文[SHIPMENT_CDF_INBOUND_V2]根节点!");
}
if (isEmpty(rootNode.getJSONObject(INTEGRATION_MESSAGE_CONTROL))) {
log.info("未找到报文[INTEGRATION_MESSAGE_CONTROL]节点!");
throw new RuntimeException("未找到报文[INTEGRATION_MESSAGE_CONTROL]节点!");
}
JSONObject controlNode = rootNode.getJSONObject(INTEGRATION_MESSAGE_CONTROL);
// 业务流水号 对应PART_ID,同一个预报关单号,发送多次这个流水号是不同的
decHead.setPartId(isNotEmpty(controlNode.get("BATCH_ID")) ? controlNode.get("BATCH_ID").toString() : null);
if (isNotEmpty(controlNode.getJSONObject(BUS_KEY))) {
// 工作编号 对应我们的委托编号APPLY_ID
decHead.setApplyId(isNotEmpty(controlNode.getJSONObject(BUS_KEY).get("SHIPMENT_NUMBER")) ? controlNode.getJSONObject(BUS_KEY).getString("SHIPMENT_NUMBER") : null);
}
if (isEmpty(rootNode.getJSONObject(CCS_HEADER))) {
log.info("未找到报文[CCS_HEADER]节点!");
throw new RuntimeException("未找到报文[CCS_HEADER]节点!");
}
JSONObject headerNode = rootNode.getJSONObject(CCS_HEADER);
/*
* 处理表头
* 2021/6/10 12:40
* ZHANGCHAO
*/
dealDecHead(decHead, headerNode);
/*
* 处理表体
* 2021/6/9 15:30
* ZHANGCHAO
*/
List<DecList> decLists = new ArrayList<>(16);
if (isNotEmpty(headerNode.getJSONArray(CCS_DETAIL))) {
log.info("===> [CCS_DETAIL]有多个表体...");
for (Object o : headerNode.getJSONArray(CCS_DETAIL)) {
JSONObject detailNode = (JSONObject) o;
DecList decList = dealDecList(decHead, detailNode);
decLists.add(decList);
}
} else if (isNotEmpty(headerNode.getJSONObject(CCS_DETAIL))) {
log.info("===> [CCS_DETAIL]只有一个表体...");
JSONObject detailNode = headerNode.getJSONObject(CCS_DETAIL);
DecList decList = dealDecList(decHead, detailNode);
decLists.add(decList);
} else {
log.info("===> [CCS_DETAIL]无表体或未知的节点类型!");
}
decHead.setDecLists(decLists);
/*
* 处理集装箱
* 2021/6/10 12:40
* ZHANGCHAO
*/
List<DecContainer> decContainerList = new ArrayList<>(16);
if (isNotEmpty(headerNode.getJSONArray(CONTAINER_DETAIL))) {
for (Object o : headerNode.getJSONArray(CONTAINER_DETAIL)) {
JSONObject containerO = (JSONObject) o;
DecContainer container = dealDecContainer(containerO);
decContainerList.add(container);
}
} else if (isNotEmpty(headerNode.getJSONObject(CONTAINER_DETAIL))) {
JSONObject containerO = headerNode.getJSONObject(CONTAINER_DETAIL);
DecContainer container = dealDecContainer(containerO);
decContainerList.add(container);
} else {
log.info("===> [CONTAINER_DETAIL]无集装箱或未知的节点类型!");
}
decHead.setDecContainers(decContainerList);
/*
* 处理随附单证
* 2021/6/10 13:02
* ZHANGCHAO
*/
List<DecLicenseDocus> decLicenseDocusList = new ArrayList<>(16);
if (isNotEmpty(headerNode.getJSONArray(ATTACHED_DOCUMENT_DETAIL))) {
for (Object o : headerNode.getJSONArray(ATTACHED_DOCUMENT_DETAIL)) {
JSONObject licenseDocusO = (JSONObject) o;
DecLicenseDocus licenseDocus = dealDecLicenseDocus(licenseDocusO);
decLicenseDocusList.add(licenseDocus);
}
} else if (isNotEmpty(headerNode.getJSONObject(ATTACHED_DOCUMENT_DETAIL))) {
JSONObject licenseDocusO = headerNode.getJSONObject(ATTACHED_DOCUMENT_DETAIL);
DecLicenseDocus licenseDocus = dealDecLicenseDocus(licenseDocusO);
decLicenseDocusList.add(licenseDocus);
} else {
log.info("===> [ATTACHED_DOCUMENT_DETAIL]无集装箱或未知的节点类型!");
}
decHead.setDecLicenseDocuses(decLicenseDocusList);
// 其他包装类型
if (isNotEmpty(headerNode.getJSONObject("DecOtherPack"))) {
decHead.setPackType(isNotEmpty(headerNode.getJSONObject("DecOtherPack").get("PackType")) ? headerNode.getJSONObject("DecOtherPack").get("PackType").toString() : null);
}
/*
* 企业资质
* 2021/6/10 13:28
* ZHANGCHAO
*/
if (isNotEmpty(headerNode.getJSONObject("DecCopLimits"))) {
List<CopLimit> copLimits = new ArrayList<>(16);
if (isNotEmpty(headerNode.getJSONArray("DecCopLimit"))) {
for (Object o : headerNode.getJSONArray("DecCopLimit")) {
JSONObject copLimitO = (JSONObject) o;
CopLimit copLimit = new CopLimit();
// 企业资质编号
copLimit.setEntQualifNo(isNotEmpty(copLimitO.get("EntQualifNo")) ? copLimitO.get("EntQualifNo").toString() : null);
// 企业资质类别代码
copLimit.setEntQualifTypeCode(isNotEmpty(copLimitO.get("EntQualifTypeCode")) ? copLimitO.get("EntQualifTypeCode").toString() : null);
copLimits.add(copLimit);
}
} else if (isNotEmpty(headerNode.getJSONObject("DecCopLimit"))) {
JSONObject copLimitO = headerNode.getJSONObject("DecCopLimit");
CopLimit copLimit = new CopLimit();
// 企业资质编号
copLimit.setEntQualifNo(isNotEmpty(copLimitO.get("EntQualifNo")) ? copLimitO.get("EntQualifNo").toString() : null);
// 企业资质类别代码
copLimit.setEntQualifTypeCode(isNotEmpty(copLimitO.get("EntQualifTypeCode")) ? copLimitO.get("EntQualifTypeCode").toString() : null);
copLimits.add(copLimit);
} else {
log.info("===> [DecCopLimit]无企业资质或未知的节点类型!");
}
if (isNotEmpty(copLimits)) {
// 创建JSON数组
JSONArray jsonArray = new JSONArray();
jsonArray.add(copLimits);
String copLimitType = jsonArray.toJSONString().substring(1);
copLimitType = copLimitType.substring(0, copLimitType.length() - 1);
copLimitType = copLimitType.replaceAll("entQualifNo", "EntQualifNo")
.replaceAll("entQualifTypeCode", "EntQualifTypeCode");
decHead.setCopLimitType(copLimitType);
}
}
/*
* 处理报关单随附单据
* 2021/6/10 13:45
* ZHANGCHAO
*/
List<DecAttachment> decAttachmentList = new ArrayList<>(16);
if (isNotEmpty(headerNode.getJSONArray(CCS_DOCUMENT))) {
for (Object o : headerNode.getJSONArray(CCS_DOCUMENT)) {
JSONObject attachmentO = (JSONObject) o;
decAttachmentList.add(dealDecAttachment(attachmentO));
}
} else if (isNotEmpty(headerNode.getJSONObject(CCS_DOCUMENT))) {
JSONObject attachmentO = headerNode.getJSONObject(CCS_DOCUMENT);
decAttachmentList.add(dealDecAttachment(attachmentO));
} else {
log.info("===> [CCS_DOCUMENT]无随附单据或未知的节点类型!");
}
decHead.setDecAttachments(decAttachmentList);
}
/**
* 处理报关单表头
*
* @param decHead
* @param headerNode
* @return void
* @author ZHANGCHAO
* @date 2021/6/10 11:41
*/
private static void dealDecHead(DecHead decHead, JSONObject headerNode) {
// 进出口标志
decHead.setIeFlag(isNotEmpty(headerNode.getString("INCOMING_STATUS")) ? headerNode.getString("INCOMING_STATUS") : null);
// 海关编号 对应我们的海关编号 报关单号
decHead.setClearanceNo(isNotEmpty(headerNode.get("CCS_NUMBER")) ? headerNode.get("CCS_NUMBER").toString() : null);
// 预报关单号 对应我们的报关单客户端编号 判断一票报关单的唯一性
decHead.setCustomsCode(isNotEmpty(headerNode.get("INTERNAL_CCS")) ? headerNode.get("INTERNAL_CCS").toString() : null);
// 备案号(手册编号)
decHead.setRecordNumber(isNotEmpty(headerNode.get("HANDBOOK_NUMBER")) ? headerNode.get("HANDBOOK_NUMBER").toString() : null);
// 申报地海关
decHead.setDeclarePlace(isNotEmpty(headerNode.get("DECLARATION_PORT")) ? headerNode.get("DECLARATION_PORT").toString() : null);
// 进出境关别(进出口岸)
decHead.setOutPortCode(isNotEmpty(headerNode.get("IMPORT_EXPORT_PORT")) ? headerNode.get("IMPORT_EXPORT_PORT").toString() : null);
// 合同号
decHead.setContract(isNotEmpty(headerNode.get("CONTRACT_NUMBER")) ? headerNode.get("CONTRACT_NUMBER").toString() : null);
// 进/出口日期
decHead.setOutDate(isNotEmpty(headerNode.get("IMPORT_EXPORT_DATE")) ? headerNode.get("IMPORT_EXPORT_DATE").toString() : null);
// 申报日期
decHead.setAppDate(isNotEmpty(headerNode.get("DECLARATION_DATE")) ? DateUtil.parse(headerNode.get("DECLARATION_DATE").toString(), "yyyy-MM-dd") : null);
// 提运单号
decHead.setBillCode(isNotEmpty(headerNode.get("BL_NUMBER")) ? headerNode.get("BL_NUMBER").toString() : null);
// 运输方式
decHead.setShipTypeCode(isNotEmpty(headerNode.get("TRANSPORTATION_METHOD")) ? headerNode.get("TRANSPORTATION_METHOD").toString() : null);
// 运输工具名称
decHead.setShipName(isNotEmpty(headerNode.get("TRAF_NAME")) ? headerNode.get("TRAF_NAME").toString() : null);
// 航次号
decHead.setVoyage(isNotEmpty(headerNode.get("VOYAGE_NUMBER")) ? headerNode.get("VOYAGE_NUMBER").toString() : null);
// 集装箱数量
decHead.setContainerNum(isNotEmpty(headerNode.get("QUANTITY_OF_CONTAINERS")) ? headerNode.get("QUANTITY_OF_CONTAINERS").toString() : null);
// 境内收发货人编号
decHead.setOptUnitId(isNotEmpty(headerNode.get("TRADING_COMPANY_CODE")) ? headerNode.get("TRADING_COMPANY_CODE").toString() : null);
// 境内收发货人名称
decHead.setOptUnitName(isNotEmpty(headerNode.get("TRADING_COMPANY_NAME")) ? headerNode.get("TRADING_COMPANY_NAME").toString() : null);
// 消费使用单位/生产销售单位代码
decHead.setDeliverUnit(isNotEmpty(headerNode.get("RECEIVER_COMPANY_CODE")) ? headerNode.get("RECEIVER_COMPANY_CODE").toString() : null);
// 消费使用单位/生产销售单位
decHead.setDeliverUnitName(isNotEmpty(headerNode.get("RECEIVER_COMPANY_NAME")) ? headerNode.get("RECEIVER_COMPANY_NAME").toString() : null);
// 申报单位编码
decHead.setDeclareUnit(isNotEmpty(headerNode.get("CUSTOMS_BROKER_CODE")) ? headerNode.get("CUSTOMS_BROKER_CODE").toString() : null);
// 申报单位名称
decHead.setDeclareUnitName(isNotEmpty(headerNode.get("CUSTOMS_BROKER_NAME")) ? headerNode.get("CUSTOMS_BROKER_NAME").toString() : null);
// 起抵运国(地区)
decHead.setArrivalArea(isNotEmpty(headerNode.get("COUNTRY")) ? headerNode.get("COUNTRY").toString() : null);
// 监管方式
decHead.setTradeTypeCode(isNotEmpty(headerNode.get("TRADE_MODE")) ? headerNode.get("TRADE_MODE").toString() : null);
// 经停港/指运港(装卸货港)
decHead.setDesPort(isNotEmpty(headerNode.get("DESTINATION_PORT")) ? headerNode.get("DESTINATION_PORT").toString() : null);
// 成交方式
decHead.setTermsTypeCode(isNotEmpty(headerNode.get("TRANSACTION_METHOD")) ? headerNode.get("TRANSACTION_METHOD").toString() : null);
// 征免性质
decHead.setTaxTypeCode(isNotEmpty(headerNode.get("TAX_OPTION")) ? headerNode.get("TAX_OPTION").toString() : null);
// 运费标志
decHead.setShipFeeCode(isNotEmpty(headerNode.get("FREIGHT_COST_BASIS")) ? headerNode.get("FREIGHT_COST_BASIS").toString() : null);
// 运费/率
decHead.setShipFee(isNotEmpty(headerNode.get("FREIGHT_RATE")) ? new BigDecimal(headerNode.get("FREIGHT_RATE").toString()) : null);
// 运费币制
decHead.setShipCurrencyCode(isNotEmpty(headerNode.get("FREIGHT_CURRENCY")) ? headerNode.get("FREIGHT_CURRENCY").toString() : null);
// 许可证号
decHead.setLicenceNumber(isNotEmpty(headerNode.get("PERMIT")) ? headerNode.get("PERMIT").toString() : null);
// 保险费标志
decHead.setInsuranceCode(isNotEmpty(headerNode.get("INSURANCE_FEE_BASIS")) ? headerNode.get("INSURANCE_FEE_BASIS").toString() : null);
// 保险费/率
decHead.setInsurance(isNotEmpty(headerNode.get("INSURANCE_RATE")) ? new BigDecimal(headerNode.get("INSURANCE_RATE").toString()) : null);
// 保险费币制
decHead.setInsuranceCurr(isNotEmpty(headerNode.get("INSURANCE_CURRENCY")) ? headerNode.get("INSURANCE_CURRENCY").toString() : null);
// 杂费标志
decHead.setExtrasCode(isNotEmpty(headerNode.get("MISCELLANEOUS_EXPENSE_BASIS")) ? headerNode.get("MISCELLANEOUS_EXPENSE_BASIS").toString() : null);
// 杂费/率
decHead.setExtras(isNotEmpty(headerNode.get("MISCELLANEOUS_EXPENSE_RATE")) ? new BigDecimal(headerNode.get("MISCELLANEOUS_EXPENSE_RATE").toString()) : null);
// 杂费币制
decHead.setOtherCurr(isNotEmpty(headerNode.get("MISCELLANEOUS_EXPENSE_CURRENCY")) ? headerNode.get("MISCELLANEOUS_EXPENSE_CURRENCY").toString() : null);
// 包装种类
decHead.setPacksKinds(isNotEmpty(headerNode.get("PACKAGING_TYPE")) ? headerNode.get("PACKAGING_TYPE").toString() : null);
// 件数
decHead.setPacks(isNotEmpty(headerNode.get("PIECES")) ? Integer.valueOf(headerNode.get("PIECES").toString()) : null);
// 净重
decHead.setNetWeight(isNotEmpty(headerNode.get("NET_WEIGHT")) ? new BigDecimal(headerNode.get("NET_WEIGHT").toString()) : null);
// 毛重
decHead.setGrossWeight(isNotEmpty(headerNode.get("GROSS_WEIGHT")) ? new BigDecimal(headerNode.get("GROSS_WEIGHT").toString()) : null);
// 备注
decHead.setMarkNumber(isNotEmpty(headerNode.get("REMARK")) ? headerNode.get("REMARK").toString() : null);
// 报关单类型
decHead.setClearanceType(isNotEmpty(headerNode.get("CCS_TYPE")) ? headerNode.get("CCS_TYPE").toString() : null);
// 数据中心统一编号
decHead.setSeqNo(isNotEmpty(headerNode.get("E_PORT_DECLARATION_ID")) ? headerNode.get("E_PORT_DECLARATION_ID").toString() : null);
// 担保验放标志
decHead.setSuretyFlag(isNotEmpty(headerNode.get("ChkSurety")) ? headerNode.get("ChkSurety").toString() : null);
// 备案清单类型
decHead.setBillType(isNotEmpty(headerNode.get("BillType")) ? headerNode.get("BillType").toString() : null);
// 申报单位统一编码
decHead.setDeclareUnitSocialCode(isNotEmpty(headerNode.get("AgentCodeScc")) ? headerNode.get("AgentCodeScc").toString() : null);
// 消费使用单位/生产销售单位统一编码
decHead.setDeliverUnitSocialCode(isNotEmpty(headerNode.get("OwnerCodeScc")) ? headerNode.get("OwnerCodeScc").toString() : null);
// 境内收发货人统一编码
decHead.setOptUnitSocialCode(isNotEmpty(headerNode.get("TradeCodeScc")) ? headerNode.get("TradeCodeScc").toString() : null);
// 承诺事项
if (isNotEmpty(headerNode.get("PromiseItmes"))) {
String promiseItems = headerNode.get("PromiseItmes").toString();
if (promiseItems.length() > 1) {
char[] chars = promiseItems.toCharArray();
decHead.setPromiseItmes(CollUtil.join(Collections.singletonList(chars), "|"));
}
}
// 贸易国别
decHead.setTradeCountry(isNotEmpty(headerNode.get("TradeAreaCode")) ? headerNode.get("TradeAreaCode").toString() : null);
// 报关转关类型
decHead.setTranferType(isNotEmpty(headerNode.get("ENTRY_TRANSIT_TYPE")) ? headerNode.get("ENTRY_TRANSIT_TYPE").toString() : null);
// 监管仓号
decHead.setBonNo(isNotEmpty(headerNode.get("BONDED_NUMBER")) ? headerNode.get("BONDED_NUMBER").toString() : null);
// 关联报关单号
decHead.setRelId(isNotEmpty(headerNode.get("RELATIVE_ID")) ? headerNode.get("RELATIVE_ID").toString() : null);
// 关联备案号
decHead.setRelManNo(isNotEmpty(headerNode.get("RELATIVE_MANUAL_NO")) ? headerNode.get("RELATIVE_MANUAL_NO").toString() : null);
// 申报人员证号
decHead.setDeclarantNo(isNotEmpty(headerNode.get("DECLARE_NUMBER")) ? headerNode.get("DECLARE_NUMBER").toString() : null);
// EDI申报备注(单据类型) 对应我们的DEC_TYPE 客户推过来的草单可能没值 edi报文通道类型?
decHead.setDecType(isNotEmpty(headerNode.get("Type")) ? headerNode.get("Type").toString() : null);
// 境外发货人代码
decHead.setOverseasConsignorCode(isNotEmpty(headerNode.get("OverseasConsignorCode")) ? headerNode.get("OverseasConsignorCode").toString() : null);
// 境外发货人名称(外文)
decHead.setOverseasConsignorEname(isNotEmpty(headerNode.get("OverseasConsignorCname")) ? headerNode.get("OverseasConsignorCname").toString() : null);
// 境外收货人编码
decHead.setOverseasConsigneeCode(isNotEmpty(headerNode.get("OverseasConsigneeCode")) ? headerNode.get("OverseasConsigneeCode").toString() : null);
// 境外收货人名称(外文)
decHead.setOverseasConsigneeEname(isNotEmpty(headerNode.get("OverseasConsigneeEname")) ? headerNode.get("OverseasConsigneeEname").toString() : null);
// 货物存放地点
decHead.setGoodsPlace(isNotEmpty(headerNode.get("GoodsPlace")) ? headerNode.get("GoodsPlace").toString() : null);
// 标记唛码
decHead.setMarkNo(isNotEmpty(headerNode.get("MarkNo")) ? headerNode.get("MarkNo").toString() : null);
// 启运港
decHead.setDespPortCode(isNotEmpty(headerNode.get("DespPortCode")) ? headerNode.get("DespPortCode").toString() : null);
// 入境口岸/离境口岸
decHead.setEntyPortCode(isNotEmpty(headerNode.get("EntyPortCode")) ? headerNode.get("EntyPortCode").toString() : null);
// 无其他包装
decHead.setNoOtherPack(isNotEmpty(headerNode.get("NoOtherPack")) ? headerNode.get("NoOtherPack").toString() : null);
// 报关标志
decHead.setEdiId(isNotEmpty(headerNode.get("EdiId")) ? headerNode.get("EdiId").toString() : null);
// B/L号
decHead.setBlNo(isNotEmpty(headerNode.get("BLNo")) ? headerNode.get("BLNo").toString() : null);
// 口岸检验检疫机关
decHead.setInspOrgCode(isNotEmpty(headerNode.get("InspOrgCode")) ? headerNode.get("InspOrgCode").toString() : null);
// 特种业务标识
decHead.setSpecDeclFlag(isNotEmpty(headerNode.get("SpecDeclFlag")) ? headerNode.get("SpecDeclFlag").toString() : null);
// 目的地检验检疫机关
decHead.setPurpOrgCode(isNotEmpty(headerNode.get("PurpOrgCode")) ? headerNode.get("PurpOrgCode").toString() : null);
// 启运日期
decHead.setDespDate(isNotEmpty(headerNode.get("DespDate")) ? headerNode.get("DespDate").toString() : null);
// 卸毕日期
decHead.setCmplDschrgDt(isNotEmpty(headerNode.get("CmplDschrgDt")) ? headerNode.get("CmplDschrgDt").toString() : null);
// 关联理由
decHead.setCorrelationReasonFlag(isNotEmpty(headerNode.get("CorrelationReasonFlag")) ? headerNode.get("CorrelationReasonFlag").toString() : null);
// 领证机关
decHead.setVsaOrgCode(isNotEmpty(headerNode.get("VsaOrgCode")) ? headerNode.get("VsaOrgCode").toString() : null);
// 原集装箱标识
decHead.setOrigBoxFlag(isNotEmpty(headerNode.get("OrigBoxFlag")) ? headerNode.get("OrigBoxFlag").toString() : null);
// 关联号码
decHead.setCorrelationNo(isNotEmpty(headerNode.get("CorrelationNo")) ? headerNode.get("CorrelationNo").toString() : null);
// 境内收发货人检验检疫编码
decHead.setTradeCiqCode(isNotEmpty(headerNode.get("TradeCiqCode")) ? headerNode.get("TradeCiqCode").toString() : null);
// 消费使用/生产销售单位检验检疫编码
decHead.setOwnerCiqCode(isNotEmpty(headerNode.get("OwnerCiqCode")) ? headerNode.get("OwnerCiqCode").toString() : null);
// 申报单位检验检疫编码
decHead.setDeclCiqCode(isNotEmpty(headerNode.get("DeclCiqCode")) ? headerNode.get("DeclCiqCode").toString() : null);
// 检验检疫受理机关
decHead.setOrgCode(isNotEmpty(headerNode.get("OrgCode")) ? headerNode.get("OrgCode").toString() : null);
}
/**
* 处理报关单表体
*
* @param detailNode
* @return com.yorma.dcl.entity.DecList
* @author ZHANGCHAO
* @date 2021/6/10 11:32
*/
private static DecList dealDecList(DecHead decHead, JSONObject detailNode) {
DecList decList = new DecList();
// 序号
decList.setItem(isNotEmpty(detailNode.get("SEQUENCE_NUMBER")) ? detailNode.getInt("SEQUENCE_NUMBER") : null);
// 备案序号
decList.setRecordItem(isNotEmpty(detailNode.get("CUSTOMS_ITEM_NUMBER")) ? detailNode.getInt("CUSTOMS_ITEM_NUMBER") : null);
// 单耗版本号
decList.setExgVersion(isNotEmpty(detailNode.get("PRODUCT_VERSION_NUMBER")) ? detailNode.get("PRODUCT_VERSION_NUMBER").toString() : null);
// 商品编号
decList.setHscode(isNotEmpty(detailNode.get("HS_CODE")) ? detailNode.get("HS_CODE").toString() : null);
// 商品名称
decList.setHsname(isNotEmpty(detailNode.get("CHINESE_DESCRIPTION")) ? detailNode.get("CHINESE_DESCRIPTION").toString() : null);
// 规格型号
decList.setHsmodel(isNotEmpty(detailNode.get("MODEL")) ? detailNode.get("MODEL").toString() : null);
// 申报数量
decList.setGoodsCount(isNotEmpty(detailNode.get("DECLARATION_QTY")) ? new BigDecimal(detailNode.get("DECLARATION_QTY").toString()) : null);
// 申报计量单位
decList.setUnitCode(isNotEmpty(detailNode.get("CUSTOMS_UM")) ? detailNode.get("CUSTOMS_UM").toString() : null);
// 第一法定数量
decList.setCount1(isNotEmpty(detailNode.get("CUSTOMS_QUANTITY")) ? new BigDecimal(detailNode.get("CUSTOMS_QUANTITY").toString()) : null);
// 法定第一计量单位
decList.setUnit1(isNotEmpty(detailNode.get("FIRST_CUSTOMS_UM")) ? detailNode.get("FIRST_CUSTOMS_UM").toString() : null);
// 第二法定数量
decList.setCount2(isNotEmpty(detailNode.get("SECOND_CUSTOMS_QUANTITY")) ? new BigDecimal(detailNode.get("SECOND_CUSTOMS_QUANTITY").toString()) : null);
// 法定第二计量单位
decList.setUnit2(isNotEmpty(detailNode.get("SECOND_CUSTOMS_UM")) ? detailNode.get("SECOND_CUSTOMS_UM").toString() : null);
// 单价
decList.setPrice(isNotEmpty(detailNode.get("UNIT_PRICE")) ? new BigDecimal(detailNode.get("UNIT_PRICE").toString()) : null);
// 总价
decList.setTotal(isNotEmpty(detailNode.get("TOTAL_AMOUNT")) ? new BigDecimal(detailNode.get("TOTAL_AMOUNT").toString()) : null);
// 币制
decList.setCurrencyCode(isNotEmpty(detailNode.get("CURRENCY")) ? detailNode.get("CURRENCY").toString() : null);
// 对于出口报关单,表体的originalCountry需要填目的国,destinationCountry填的是原产国。
// 对于进口报关单,表体的originalCountry需要填原产国,destinationCountry填的是目的国。"
if (I.equalsIgnoreCase(decHead.getIeFlag())) {
// 产销国
decList.setDesCountry(isNotEmpty(detailNode.get("COUNTRY")) ? detailNode.get("COUNTRY").toString() : null);
// 最终目的国(地区)
decList.setDestinationCountry(isNotEmpty(detailNode.get("DestinationCountry")) ? detailNode.get("DestinationCountry").toString() : null);
} else if (E.equalsIgnoreCase(decHead.getIeFlag())) {
// 产销国
decList.setDesCountry(isNotEmpty(detailNode.get("DestinationCountry")) ? detailNode.get("DestinationCountry").toString() : null);
// 最终目的国(地区)
decList.setDestinationCountry(isNotEmpty(detailNode.get("COUNTRY")) ? detailNode.get("COUNTRY").toString() : null);
}
// 征免方式
decList.setFaxTypeCode(isNotEmpty(detailNode.get("TAX_OPTION")) ? detailNode.get("TAX_OPTION").toString() : null);
// 检验检疫编码
decList.setCiqCode(isNotEmpty(detailNode.get("CiqCode")) ? detailNode.get("CiqCode").toString() : null);
// 境内目的地/境内货源地
decList.setDistrictCode(isNotEmpty(detailNode.get("DistrictCode")) ? detailNode.get("DistrictCode").toString() : null);
// 目的地行政区划
decList.setDestCode(isNotEmpty(detailNode.get("DESTINATION_DISTRICT")) ? detailNode.get("DESTINATION_DISTRICT").toString() : null);
// 原产地区代码
decList.setOrigPlaceCode(isNotEmpty(detailNode.get("OrigPlaceCode")) ? detailNode.get("OrigPlaceCode").toString() : null);
// 用途代码
decList.setPurpose(isNotEmpty(detailNode.get("Purpose")) ? detailNode.get("Purpose").toString() : null);
// 产品有效期
decList.setProdValidDt(isNotEmpty(detailNode.get("ProdValidDt")) ? detailNode.get("ProdValidDt").toString() : null);
// 产品保质期
decList.setProdQgp(isNotEmpty(detailNode.get("ProdQgp")) ? detailNode.get("ProdQgp").toString() : null);
// 货物属性代码
decList.setGoodsAttr(isNotEmpty(detailNode.get("GoodsAttr")) ? detailNode.get("GoodsAttr").toString() : null);
// 成份/原料/组份
decList.setStuff(isNotEmpty(detailNode.get("Stuff")) ? detailNode.get("Stuff").toString() : null);
// UN编码
decList.setUncode(isNotEmpty(detailNode.get("Uncode")) ? detailNode.get("Uncode").toString() : null);
// 危险货物名称
decList.setDangName(isNotEmpty(detailNode.get("DangName")) ? detailNode.get("DangName").toString() : null);
// 危包类别
decList.setDangPackType(isNotEmpty(detailNode.get("DangPackType")) ? detailNode.get("DangPackType").toString() : null);
// 危包规格
decList.setDangPackSpec(isNotEmpty(detailNode.get("DangPackSpec")) ? detailNode.get("DangPackSpec").toString() : null);
// 境外生产企业名称
decList.setEngManEntCnm(isNotEmpty(detailNode.get("EngManEntCnm")) ? detailNode.get("EngManEntCnm").toString() : null);
// 非危险化学品
decList.setNoDangFlag(isNotEmpty(detailNode.get("NoDangFlag")) ? detailNode.get("NoDangFlag").toString() : null);
// 货物型号
decList.setGoodsModel(isNotEmpty(detailNode.get("GoodsModel")) ? detailNode.get("GoodsModel").toString() : null);
// 货物品牌
decList.setGoodsBrand(isNotEmpty(detailNode.get("GoodsBrand")) ? detailNode.get("GoodsBrand").toString() : null);
// 生产日期
decList.setProduceDate(isNotEmpty(detailNode.get("ProduceDate")) ? detailNode.get("ProduceDate").toString() : null);
// 生产批号
decList.setProdBatchNo(isNotEmpty(detailNode.get("ProdBatchNo")) ? detailNode.get("ProdBatchNo").toString() : null);
// 检验检疫名称
decList.setCiqName(isNotEmpty(detailNode.get("CiqName")) ? detailNode.get("CiqName").toString() : null);
// 生产单位注册号
decList.setMnufctrRegNo(isNotEmpty(detailNode.get("MnufctrRegno")) ? detailNode.get("MnufctrRegno").toString() : null);
// 生产单位名称
decList.setMnufctrRegName(isNotEmpty(detailNode.get("MnufctrRegName")) ? detailNode.get("MnufctrRegName").toString() : null);
/*
* 处理许可证节点
* 2021/6/10 11:21
* ZHANGCHAO
*/
JSONObject licenceNode = detailNode.getJSONObject(DEC_GOODS_LIMITS);
if (isNotEmpty(licenceNode)) {
List<LicenceEntity> licenceEntityList = new ArrayList<>(16);
if (isNotEmpty(licenceNode.getJSONArray(DEC_GOODS_LIMIT))) {
for (Object limit : licenceNode.getJSONArray(DEC_GOODS_LIMIT)) {
JSONObject limitO = (JSONObject) limit;
LicenceEntity licence = dealLicence(limitO);
licenceEntityList.add(licence);
}
} else if (isNotEmpty(licenceNode.getJSONObject(DEC_GOODS_LIMIT))) {
JSONObject limitO = licenceNode.getJSONObject(DEC_GOODS_LIMIT);
LicenceEntity licence = dealLicence(limitO);
licenceEntityList.add(licence);
} else {
log.info("===> [DEC_GOODS_LIMITS]无许可证信息!");
}
if (isNotEmpty(licenceEntityList)) {
// 创建JSON数组
JSONArray jsonArray = new JSONArray();
jsonArray.add(licenceEntityList);
String goodsLimitType = jsonArray.toJSONString().substring(1);
goodsLimitType = goodsLimitType.substring(0, goodsLimitType.length() - 1);
goodsLimitType = goodsLimitType.replaceAll("licTypeCode", "LicTypeCode")
.replaceAll("licWrtofDetailNo", "LicWrtofDetailNo")
.replaceAll("licWrtofQty", "LicWrtofQty")
.replaceAll("licWrtofQtyUnit", "LicWrtofQtyUnit")
.replaceAll("vIN", "VIN")
.replaceAll("licenceNo", "LicenceNo");
decList.setGoodsLimitType(goodsLimitType);
}
}
return decList;
}
/**
* 处理报关单表体的许可证信息
*
* @param jsonObject
* @return void
* @author ZHANGCHAO
* @date 2021/6/10 10:27
*/
private static LicenceEntity dealLicence(JSONObject jsonObject) {
LicenceEntity licenceEntity = new LicenceEntity();
licenceEntity.setLicenceNo(isNotEmpty(jsonObject.get("LicenceNo")) ? jsonObject.get("LicenceNo").toString() : null);
licenceEntity.setLicTypeCode(isNotEmpty(jsonObject.get("LicTypeCode")) ? jsonObject.get("LicTypeCode").toString() : null);
licenceEntity.setLicWrtofDetailNo(isNotEmpty(jsonObject.get("LicWrtofDetailNo")) ? jsonObject.get("LicWrtofDetailNo").toString() : null);
licenceEntity.setLicWrtofQty(isNotEmpty(jsonObject.get("LicWrtofQty")) ? jsonObject.get("LicWrtofQty").toString() : null);
licenceEntity.setLicWrtofQtyUnit(isNotEmpty(jsonObject.get("LicWrtofQtyUnit")) ? jsonObject.get("LicWrtofQtyUnit").toString() : null);
/*
* 不再处理VIN信息!
* 2021/6/10 11:46
* ZHANGCHAO
*/
// List<LicenceVinEntity> vinEntityList = new ArrayList<>(16);
// if (isNotEmpty(jsonObject.getJSONArray(DEC_GOODS_LIMITS_VIN))) {
// for (Object vinObject : jsonObject.getJSONArray(DEC_GOODS_LIMITS_VIN)) {
// JSONObject vinO = (JSONObject) vinObject;
// LicenceVinEntity vinEntity = new LicenceVinEntity();
// vinEntity.setLicenceNoVin(isNotEmpty(vinO.get("LicenceNo")) ? vinO.get("LicenceNo").toString() : null);
// vinEntity.setLicTypeCodeVin(isNotEmpty(vinO.get("LicTypeCode")) ? vinO.get("LicTypeCode").toString() : null);
// vinEntityList.add(vinEntity);
// }
// } else if (isNotEmpty(jsonObject.getJSONObject(DEC_GOODS_LIMITS_VIN))) {
// JSONObject vinO = jsonObject.getJSONObject(DEC_GOODS_LIMITS_VIN);
// LicenceVinEntity vinEntity = new LicenceVinEntity();
// vinEntity.setLicenceNoVin(isNotEmpty(vinO.get("LicenceNo")) ? vinO.get("LicenceNo").toString() : null);
// vinEntity.setLicTypeCodeVin(isNotEmpty(vinO.get("LicTypeCode")) ? vinO.get("LicTypeCode").toString() : null);
// vinEntityList.add(vinEntity);
// } else {
// log.info("===> 无许可证Vin信息!");
// }
// if (isNotEmpty(vinEntityList)) {
// // 创建JSON数组
// JSONArray jsonArray = new JSONArray();
// jsonArray.add(vinEntityList);
// String vin = jsonArray.toJSONString().substring(1);
// vin = vin.substring(0, vin.length() - 1);
// vin = vin.replaceAll("licenceNoVin", "LicenceNoVin")
// .replaceAll("licTypeCodeVin", "LicTypeCodeVin");
// licenceEntity.setVIN(vin);
// }
return licenceEntity;
}
/**
* 处理报关单的集装箱信息
*
* @param containerO
* @return com.yorma.dcl.entity.DecContainer
* @author ZHANGCHAO
* @date 2021/6/10 12:45
*/
private static DecContainer dealDecContainer(JSONObject containerO) {
DecContainer container = new DecContainer();
// 集装箱号
container.setContainerId(isNotEmpty(containerO.get("CONTAINER_NUMBER")) ? containerO.get("CONTAINER_NUMBER").toString() : null);
// 集装箱规格
container.setContainerMd(isNotEmpty(containerO.get("CONTAINER_TYPE")) ? containerO.get("CONTAINER_TYPE").toString() : null);
// 集装箱自重
container.setGoodsContaWt(isNotEmpty(containerO.get("CONTAINER_TARE_WEIGHT")) ? new BigDecimal(containerO.get("CONTAINER_TARE_WEIGHT").toString()) : null);
// 商品项号
container.setGoodsNo(isNotEmpty(containerO.get("GoodsNo")) ? containerO.get("GoodsNo").toString() : null);
// 箱货重量
// container.setGoodsContaWt(isNotEmpty(containerO.get("GoodsContaWt")) ? containerO.get("GoodsContaWt").toString() : null);
return container;
}
/**
* 处理报关单的随附单证
*
* @param licenseDocusO
* @return com.yorma.dcl.entity.DecLicenseDocus
* @author ZHANGCHAO
* @date 2021/6/10 13:05
*/
private static DecLicenseDocus dealDecLicenseDocus(JSONObject licenseDocusO) {
DecLicenseDocus licenseDocus = new DecLicenseDocus();
// 随附单证类型
licenseDocus.setDocuCode(isNotEmpty(licenseDocusO.get("DOCUMENT_TYPE")) ? licenseDocusO.get("DOCUMENT_TYPE").toString() : null);
// 随附单证编号
licenseDocus.setCertCode(isNotEmpty(licenseDocusO.get("DOCUMENT_NUMBER")) ? licenseDocusO.get("DOCUMENT_NUMBER").toString() : null);
return licenseDocus;
}
/**
* 处理报关单的随附单据
*
* @param attachmentO
* @return com.yorma.dcl.entity.DecAttachment
* @author ZHANGCHAO
* @date 2021/6/10 13:51
*/
private static DecAttachment dealDecAttachment(JSONObject attachmentO) {
DecAttachment attachment = new DecAttachment();
// 文档内容
// 文档大小
// 文档类型
// 文件名称
attachment.setAttachmentName(isNotEmpty(attachmentO.get("FILE_NAME")) ? attachmentO.get("FILE_NAME").toString() : null);
return attachment;
}
}
用camel-ftp做报文监听传输很方便的,就是网上文档资料太少,而且很多是错误的。需要各位多多自动动手实践。
原文链接:https://blog.csdn.net/qq_26030541/article/details/117817084
作者:skdk
链接:http://www.javaheidong.com/blog/article/222652/6b5a9d60bf48e1d67326/
来源:java黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 java黑洞网 All Rights Reserved 版权所有,并保留所有权利。京ICP备18063182号-2
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!