|
|
@@ -171,6 +171,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
declareCustoms.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
declareCustoms.setStatus(0);
|
|
|
declareCustoms.setAuditStatus("录入");
|
|
|
+ declareCustoms.setDeclareStatus("暂存");
|
|
|
baseMapper.insert(declareCustoms);
|
|
|
} else {
|
|
|
declareCustoms.setUpdateTime(new Date());
|
|
|
@@ -853,12 +854,30 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
//加载PDF测试文档
|
|
|
PdfDocument pdf = new PdfDocument(file.getInputStream());
|
|
|
|
|
|
+ //线上地址
|
|
|
+ //创建文件夹
|
|
|
+ File packageFile = new File("/home/minio/file/"+AuthUtil.getTenantId()+"-bladex/upload");
|
|
|
+ //文件夹是否创建成功
|
|
|
+ if (!packageFile.getParentFile().exists()) {
|
|
|
+ boolean a = packageFile.mkdirs();
|
|
|
+ if (a) {
|
|
|
+ System.out.println("文件夹创建成功");
|
|
|
+ } else {
|
|
|
+ System.out.println("文件夹创建失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
//保存为Excel文档
|
|
|
- pdf.saveToFile("D:\\excel\\"+declareCustoms.getSysNo()+".xlsx", FileFormat.XLSX);
|
|
|
+ pdf.saveToFile("/home/minio/file/"+AuthUtil.getTenantId()+"-bladex/upload/"+declareCustoms.getSysNo()+".xlsx", FileFormat.XLSX);
|
|
|
pdf.dispose();
|
|
|
+ //根据excel坐标获得数据
|
|
|
+ File f = new File("/home/minio/file/"+AuthUtil.getTenantId()+"-bladex/upload/"+declareCustoms.getSysNo()+".xlsx");
|
|
|
|
|
|
+ //本地测试地址
|
|
|
+ /*pdf.saveToFile("D:\\excel\\"+declareCustoms.getSysNo()+".xlsx", FileFormat.XLSX);
|
|
|
+ pdf.dispose();
|
|
|
//根据excel坐标获得数据
|
|
|
- File f = new File("D:\\excel\\"+declareCustoms.getSysNo()+".xlsx");
|
|
|
+ File f = new File("D:\\excel\\"+declareCustoms.getSysNo()+".xlsx");*/
|
|
|
+
|
|
|
Workbook wb = readExcel(new FileInputStream(f),f.getName());
|
|
|
Row row = null;
|
|
|
String[] strings = null;
|
|
|
@@ -873,14 +892,13 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
String preEntryNo = row.getCell(2).toString();//预录入编号
|
|
|
strings = preEntryNo.split(":");
|
|
|
if (strings.length >= 2){
|
|
|
- System.out.println("预录入编号======>"+strings[1]);
|
|
|
declareCustoms.setPreEntryNo(strings[1]);
|
|
|
}
|
|
|
String customsNo = row.getCell(3).toString();//海关编号
|
|
|
strings = customsNo.split(":");
|
|
|
if (strings.length >= 2){
|
|
|
- System.out.println("海关编号======>"+strings[1]);
|
|
|
declareCustoms.setCustomsNo(strings[1]);
|
|
|
+ declareCustoms.setUnifiedNumbering(strings[1]);//统一编号
|
|
|
}
|
|
|
|
|
|
//获取第五行
|
|
|
@@ -891,7 +909,6 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
Integer lastIndexOf = domesticCustomsNo.lastIndexOf(")");
|
|
|
//截取,从'('开始-到')'为下标结束,不包含')'
|
|
|
domesticCustomsNo = domesticCustomsNo.substring(6, lastIndexOf);
|
|
|
- System.out.println("境内收货人海关号======>"+domesticCustomsNo);
|
|
|
declareCustoms.setDomesticCustomsNo(domesticCustomsNo);
|
|
|
}
|
|
|
|
|
|
@@ -903,28 +920,23 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
if (corpsDesc.isSuccess() && corpsDesc.getData() != null){
|
|
|
declareCustoms.setDomesticNo(corpsDesc.getData().getId().toString());
|
|
|
}
|
|
|
- System.out.println("境内收货人名称======>"+domesticName);
|
|
|
declareCustoms.setDomesticName(domesticName);
|
|
|
|
|
|
String exitCustoms = row.getCell(3).toString();//进境关别
|
|
|
- System.out.println("进境关别======>"+exitCustoms);
|
|
|
declareCustoms.setExitCustoms(exitCustoms);
|
|
|
+ declareCustoms.setCustomsDeclarationPlace(exitCustoms);//申报地海关
|
|
|
|
|
|
String importExportDate = row.getCell(5).toString();//进口日期
|
|
|
if (ObjectUtil.isNotEmpty(importExportDate) && importExportDate.length() == 8){
|
|
|
Date importExport = getDate(importExportDate);
|
|
|
declareCustoms.setImportExportDate(importExport);
|
|
|
- System.out.println("进口日期======>"+importExport);
|
|
|
}
|
|
|
String declareDate = row.getCell(7).toString();//申报日期
|
|
|
if (ObjectUtil.isNotEmpty(declareDate) && declareDate.length() == 8){
|
|
|
Date declare = getDate(declareDate);
|
|
|
declareCustoms.setDeclareDate(declare);
|
|
|
- System.out.println("申报日期======>"+declare);
|
|
|
-
|
|
|
}
|
|
|
String filingNo = row.getCell(10).toString();//备案号
|
|
|
- System.out.println("备案号======>"+filingNo);
|
|
|
declareCustoms.setFilingNo(filingNo);
|
|
|
|
|
|
//获取第7行
|
|
|
@@ -935,7 +947,6 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
Integer lastIndexOf = abroadConsigneeShipper.lastIndexOf(")");
|
|
|
//截取,从'('开始-到')'为下标结束,不包含')'
|
|
|
abroadConsigneeShipper = abroadConsigneeShipper.substring(6, lastIndexOf);
|
|
|
- System.out.println("境外发货人海关号======>"+abroadConsigneeShipper);
|
|
|
declareCustoms.setAbroadCustomsNo(abroadConsigneeShipper);
|
|
|
}
|
|
|
|
|
|
@@ -947,25 +958,27 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
if (corpsDesc.isSuccess() && corpsDesc.getData() != null){
|
|
|
declareCustoms.setAbroadNo(corpsDesc.getData().getId().toString());
|
|
|
}
|
|
|
- System.out.println("境外发货人名称======>"+abroadName);
|
|
|
declareCustoms.setAbroadName(abroadName);
|
|
|
|
|
|
String transportType = row.getCell(3).toString();//运输方式
|
|
|
- System.out.println("运输方式======>"+transportType);
|
|
|
+
|
|
|
declareCustoms.setTransportType(transportType);
|
|
|
|
|
|
String conveyanceName = row.getCell(5).toString();//运输工具名称及航次号
|
|
|
- System.out.println("运输工具名称及航次号======>"+conveyanceName);
|
|
|
- declareCustoms.setConveyanceName(conveyanceName);
|
|
|
+ strings = conveyanceName.split("/");
|
|
|
+ if (strings.length >= 2){
|
|
|
+ declareCustoms.setConveyanceName(strings[0]);
|
|
|
+ declareCustoms.setVoyageNo(strings[1]);
|
|
|
+ }
|
|
|
|
|
|
String deliveryNumbers = row.getCell(7).toString();//提运单号
|
|
|
- System.out.println("提运单号======>"+deliveryNumbers);
|
|
|
declareCustoms.setDeliveryNumbers(deliveryNumbers);
|
|
|
|
|
|
if (declareCustoms.getImportExportSigns().equals("BGJK")){
|
|
|
- String storagePlaceGoods = row.getCell(10).toString();//货物存放地点
|
|
|
- System.out.println("货物存放地点======>"+storagePlaceGoods);
|
|
|
- declareCustoms.setStoragePlaceGoods(storagePlaceGoods);
|
|
|
+ if (ObjectUtil.isNotEmpty(row.getCell(10))){
|
|
|
+ String storagePlaceGoods = row.getCell(10).toString();//货物存放地点
|
|
|
+ declareCustoms.setStoragePlaceGoods(storagePlaceGoods);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//获取第9行
|
|
|
@@ -976,7 +989,6 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
Integer lastIndexOf = consumptionUnitCustomsNo.lastIndexOf(")");
|
|
|
//截取,从'('开始-到')'为下标结束,不包含')'
|
|
|
consumptionUnitCustomsNo = consumptionUnitCustomsNo.substring(7, lastIndexOf);
|
|
|
- System.out.println("消费使用单位海关号======>"+consumptionUnitCustomsNo);
|
|
|
declareCustoms.setConsumptionUnitCustomsNo(consumptionUnitCustomsNo);
|
|
|
}
|
|
|
|
|
|
@@ -988,42 +1000,35 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
if (corpsDesc.isSuccess() && corpsDesc.getData() != null){
|
|
|
declareCustoms.setConsumptionUnitNo(corpsDesc.getData().getId().toString());
|
|
|
}
|
|
|
- System.out.println("消费使用单位名称======>"+consumptionUnitName);
|
|
|
declareCustoms.setConsumptionUnitName(consumptionUnitName);
|
|
|
|
|
|
String superviseMode = row.getCell(3).toString();//监管方式
|
|
|
- System.out.println("监管方式======>"+superviseMode);
|
|
|
declareCustoms.setSuperviseMode(superviseMode);
|
|
|
|
|
|
String expropriationExemptionNature = row.getCell(5).toString();//征免性质
|
|
|
- System.out.println("征免性质======>"+expropriationExemptionNature);
|
|
|
declareCustoms.setExpropriationExemptionNature(expropriationExemptionNature);
|
|
|
|
|
|
String licenseKey = row.getCell(7).toString();//许可证号
|
|
|
- System.out.println("许可证号======>"+licenseKey);
|
|
|
declareCustoms.setLicenseKey(licenseKey);
|
|
|
|
|
|
if (declareCustoms.getImportExportSigns().equals("BGJK")){
|
|
|
- String portDepartureName = row.getCell(10).toString();//启运港名称
|
|
|
- declareCustoms.setPortDepartureId(getPortId(portDepartureName));//启运港id
|
|
|
- System.out.println("启运港名称======>"+portDepartureName);
|
|
|
- declareCustoms.setPortDepartureName(portDepartureName);
|
|
|
+ if (ObjectUtil.isNotEmpty(row.getCell(10))){
|
|
|
+ String portDepartureName = row.getCell(10).toString();//启运港名称
|
|
|
+ declareCustoms.setPortDepartureId(getPortId(portDepartureName));//启运港id
|
|
|
+ declareCustoms.setPortDepartureName(portDepartureName);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//获取第12行
|
|
|
row = sheet.getRow(11);
|
|
|
String contractAgreementNo = row.getCell(2).toString();//合同协议号
|
|
|
- System.out.println("合同协议号======>"+contractAgreementNo);
|
|
|
declareCustoms.setContractAgreementNo(contractAgreementNo);
|
|
|
|
|
|
String tradeCountryName = row.getCell(3).toString();//贸易国名称
|
|
|
declareCustoms.setTradeCountryId(getPortId(tradeCountryName));//贸易国id
|
|
|
- System.out.println("贸易国名称======>"+tradeCountryName);
|
|
|
declareCustoms.setTradeCountryName(tradeCountryName);
|
|
|
|
|
|
String countryOriginName = row.getCell(5).toString();//启运国或运抵国名称
|
|
|
- System.out.println("启运国或运抵国名称======>"+countryOriginName);
|
|
|
- System.out.println("启运国或运抵国id======>"+getPortId(countryOriginName));
|
|
|
if (declareCustoms.getImportExportSigns().equals("BGJK")){
|
|
|
declareCustoms.setCountryOriginId(getPortId(countryOriginName));//启运国或运抵国id
|
|
|
declareCustoms.setCountryOriginName(countryOriginName);
|
|
|
@@ -1032,10 +1037,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
declareCustoms.setOuntryArrivalName(countryOriginName);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
String stopOverHarborName = row.getCell(7).toString();//经停港或指运港名称
|
|
|
- System.out.println("经停港名称======>"+stopOverHarborName);
|
|
|
if (declareCustoms.getImportExportSigns().equals("BGJK")){
|
|
|
declareCustoms.setStopOverHarborId(getPortId(stopOverHarborName));//经停港或指运港id
|
|
|
declareCustoms.setStopOverHarborName(stopOverHarborName);
|
|
|
@@ -1044,62 +1046,51 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
|
|
|
declareCustoms.setPortDestinationName(stopOverHarborName);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
String portEntryName = row.getCell(10).toString();//入境口岸名称
|
|
|
declareCustoms.setPortEntryId(getPortId(portEntryName));//入境口岸id
|
|
|
- System.out.println("入境口岸名称======>"+portEntryName);
|
|
|
declareCustoms.setPortDepartureName(portEntryName);
|
|
|
|
|
|
//获取第14行
|
|
|
row = sheet.getRow(13);
|
|
|
String packing = row.getCell(2).toString();//包装种类
|
|
|
- System.out.println("包装种类======>"+packing);
|
|
|
declareCustoms.setPacking(packing);
|
|
|
|
|
|
String number = row.getCell(3).toString();//件数
|
|
|
if (ObjectUtil.isNotEmpty(number)){
|
|
|
- System.out.println("件数======>"+number);
|
|
|
declareCustoms.setNumber(new BigDecimal(number));
|
|
|
}
|
|
|
|
|
|
String grossWeight = row.getCell(4).toString();//毛重
|
|
|
if (ObjectUtil.isNotEmpty(grossWeight)){
|
|
|
- System.out.println("毛重======>"+grossWeight);
|
|
|
declareCustoms.setGrossWeight(new BigDecimal(grossWeight));
|
|
|
}
|
|
|
|
|
|
String netWeight = row.getCell(5).toString();//净重
|
|
|
if (ObjectUtil.isNotEmpty(netWeight)){
|
|
|
- System.out.println("净重======>"+netWeight);
|
|
|
declareCustoms.setNetWeight(new BigDecimal(netWeight));
|
|
|
}
|
|
|
|
|
|
String transactionMode = row.getCell(6).toString();//成交方式
|
|
|
- System.out.println("成交方式======>"+transactionMode);
|
|
|
declareCustoms.setTransactionMode(transactionMode);
|
|
|
|
|
|
String freight = row.getCell(7).toString();//运费
|
|
|
if (ObjectUtil.isNotEmpty(freight)){
|
|
|
- System.out.println("运费======>"+freight);
|
|
|
declareCustoms.setFreight(new BigDecimal(freight));
|
|
|
}
|
|
|
|
|
|
String insurance = row.getCell(9).toString();//保费
|
|
|
if (ObjectUtil.isNotEmpty(insurance)){
|
|
|
- System.out.println("保费======>"+insurance);
|
|
|
declareCustoms.setInsurance(new BigDecimal(insurance));
|
|
|
}
|
|
|
|
|
|
String sundryFees = row.getCell(11).toString();//杂费
|
|
|
if (ObjectUtil.isNotEmpty(sundryFees)){
|
|
|
- System.out.println("件数======>"+sundryFees);
|
|
|
declareCustoms.setNumber(new BigDecimal(sundryFees));
|
|
|
}
|
|
|
|
|
|
//获取第18行
|
|
|
row = sheet.getRow(17);
|
|
|
String remark = row.getCell(2).toString();//备注
|
|
|
- System.out.println("备注======>"+remark);
|
|
|
declareCustoms.setRemark(remark);
|
|
|
|
|
|
}
|