Przeglądaj źródła

2022年12月16 18:16

wangzhuo 3 lat temu
rodzic
commit
125c13209c

+ 24 - 0
blade-service-api/blade-box-tube-api/src/main/java/org/springblade/box/tube/entity/DeclareCustoms.java

@@ -512,6 +512,30 @@ public class DeclareCustoms implements Serializable {
 	private String importExportSigns;
 
 	/**
+	 * 运抵国id
+	 */
+	@ApiModelProperty(value = "运抵国id")
+	private Long ountryArrivalId;
+
+	/**
+	 * 运抵国名称
+	 */
+	@ApiModelProperty(value = "运抵国名称")
+	private String ountryArrivalName;
+
+	/**
+	 * 指运港id
+	 */
+	@ApiModelProperty(value = "指运港id")
+	private Long portDestinationId;
+
+	/**
+	 * 指运港名称
+	 */
+	@ApiModelProperty(value = "指运港名称")
+	private String  portDestinationName;
+
+	/**
 	 * 商品明细
 	 */
 	@TableField(exist = false)

+ 33 - 1
blade-service/blade-box-tube/pom.xml

@@ -148,8 +148,40 @@
             <version>2.8.2.RELEASE</version>
             <scope>compile</scope>
         </dependency>
+        <!-- PDF -->
+        <dependency>
+            <groupId>org.apache.pdfbox</groupId>
+            <artifactId>pdfbox</artifactId>
+            <version>2.0.23</version>
+        </dependency>
+        <dependency>
+            <groupId>e-iceblue</groupId>
+            <artifactId>spire.pdf</artifactId>
+            <version>3.8.5</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.6.6</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.jimmyshi</groupId>
+            <artifactId>bean-query</artifactId>
+            <version>1.1.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+            <version>4.4</version>
+        </dependency>
+        <!-- PDF -->
     </dependencies>
-
+    <repositories>
+        <repository>
+            <id>com.e-iceblue</id>
+            <url>http://repo.e-iceblue.cn/repository/maven-public/</url>
+        </repository>
+    </repositories>
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>

+ 17 - 1
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/declare/DeclareCustomsController.java

@@ -9,7 +9,6 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import org.springblade.box.tube.entity.DeclareCustoms;
-import org.springblade.box.tube.entity.TradingBox;
 import org.springblade.box.tube.excel.DeclareCustomsExcel;
 import org.springblade.box.tube.service.IDeclareCustomsService;
 import org.springblade.box.tube.vo.DeclareCustomsVo;
@@ -23,9 +22,12 @@ import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.io.IOException;
+import java.text.ParseException;
 import java.util.List;
 
 /**
@@ -246,4 +248,18 @@ public class DeclareCustomsController extends BladeController {
 		ExcelUtil.export(response, "报关" + typeName, "报关" + typeName, excelList, DeclareCustomsExcel.class);
 	}
 
+	/**
+	 * 导入PDF 读取信息
+	 */
+	@PostMapping("/importPDF")
+	@ApiOperationSupport(order = 14)
+	@ApiOperation(value = "导入PDF", notes = "传入PDF")
+	public void importPDF(@RequestParam("file") MultipartFile file,
+						  @RequestParam("id") Long id) throws IOException, ParseException {
+		if (id == null){
+			throw new SecurityException("缺少必要参数");
+		}
+		declareCustomsService.importPDF(file, id);
+	}
+
 }

+ 9 - 1
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/IDeclareCustomsService.java

@@ -3,9 +3,12 @@ package org.springblade.box.tube.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.box.tube.entity.DeclareCustoms;
-import org.springblade.box.tube.entity.TradingBox;
 import org.springblade.box.tube.vo.DeclareCustomsVo;
 import org.springblade.core.tool.api.R;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.text.ParseException;
 
 /**
  * 进出口报关表 服务类
@@ -70,4 +73,9 @@ public interface IDeclareCustomsService extends IService<DeclareCustoms> {
 	 * @param declareCustoms
 	 */
 	DeclareCustoms revoke(DeclareCustoms declareCustoms);
+
+	/**
+	 * 导入pdf
+	 */
+	void importPDF(MultipartFile file, Long id) throws IOException, ParseException;
 }

+ 405 - 68
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/impl/DeclareCustomsServiceImpl.java

@@ -6,8 +6,15 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.spire.pdf.FileFormat;
+import com.spire.pdf.PdfDocument;
 import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springblade.box.tube.entity.*;
 import org.springblade.box.tube.mapper.*;
 import org.springblade.box.tube.service.IDeclareCustomsService;
@@ -16,8 +23,12 @@ import org.springblade.check.dto.AuditProecessDTO;
 import org.springblade.check.entity.AuditPathsActs;
 import org.springblade.check.entity.AuditPathsLevels;
 import org.springblade.check.feign.ICheckClient;
+import org.springblade.client.entity.BasicPortDesc;
+import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.Message;
+import org.springblade.client.feign.ICorpsDescClient;
 import org.springblade.client.feign.IMessageClient;
+import org.springblade.client.feign.IPortClient;
 import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
@@ -33,9 +44,12 @@ import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.*;
 import java.math.BigDecimal;
-import java.math.MathContext;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -61,6 +75,8 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	private final ISysClient sysClient;
 
 	private IUserClient userClient;//获取用户信息
+	private ICorpsDescClient corpsDescClient;//获取客户信息
+	private IPortClient portClient;//获取港口信息
 
 	private final IMessageClient messageClient;//消息
 
@@ -69,11 +85,11 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	 */
 	@Override
 	public DeclareCustoms getDetail(DeclareCustoms declareCustoms) {
-		if (declareCustoms.getId() == null){
+		if (declareCustoms.getId() == null) {
 			throw new SecurityException("缺少必要参数");
 		}
 		DeclareCustoms detail = baseMapper.selectById(declareCustoms.getId());
-		if (ObjectUtil.isNotEmpty(detail)){
+		if (ObjectUtil.isNotEmpty(detail)) {
 			//获得商品明细
 			LambdaQueryWrapper<DeclareCustomsItem> itemLambdaQueryWrapper = new LambdaQueryWrapper<>();
 			itemLambdaQueryWrapper.eq(DeclareCustomsItem::getPid, detail.getId())
@@ -100,9 +116,9 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 
 			//费用明细
 			LambdaQueryWrapper<DeclareCustomsFees> feesLambdaQueryWrapper = new LambdaQueryWrapper<>();
-			documentsLambdaQueryWrapper.eq(DeclareCustomsDocuments::getPid, detail.getId())
-				.eq(DeclareCustomsDocuments::getIsDeleted, 0)
-				.eq(DeclareCustomsDocuments::getTenantId, AuthUtil.getTenantId());
+			feesLambdaQueryWrapper.eq(DeclareCustomsFees::getPid, detail.getId())
+				.eq(DeclareCustomsFees::getIsDeleted, 0)
+				.eq(DeclareCustomsFees::getTenantId, AuthUtil.getTenantId());
 			List<DeclareCustomsFees> feesList = feesMapper.selectList(feesLambdaQueryWrapper);
 			detail.setFeesList(feesList);
 
@@ -133,12 +149,12 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	@Transactional(rollbackFor = Exception.class)
 	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public DeclareCustoms add(DeclareCustoms declareCustoms) {
-		if (declareCustoms.getId() == null){
+		if (declareCustoms.getId() == null) {
 			//获取系统编号
 			R billNo = new R();
-			if (declareCustoms.getImportExportSigns().equals("BGJK")){
+			if (declareCustoms.getImportExportSigns().equals("BGJK")) {
 				billNo = serialClient.getBillNo(declareCustoms.getImportExportSigns(), "JK", declareCustoms.getImportExportSigns());
-			}else if (declareCustoms.getImportExportSigns().equals("BGCK")){
+			} else if (declareCustoms.getImportExportSigns().equals("BGCK")) {
 				billNo = serialClient.getBillNo(declareCustoms.getImportExportSigns(), "CK", declareCustoms.getImportExportSigns());
 			}
 
@@ -155,7 +171,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			declareCustoms.setStatus(0);
 			declareCustoms.setAuditStatus("录入");
 			baseMapper.insert(declareCustoms);
-		}else {
+		} else {
 			declareCustoms.setUpdateTime(new Date());
 			declareCustoms.setUpdateUser(AuthUtil.getUserId());
 			baseMapper.updateById(declareCustoms);
@@ -163,15 +179,15 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 
 		//商品明细
 		List<DeclareCustomsItem> itemList = declareCustoms.getItemList();
-		if (ObjectUtil.isNotEmpty(itemList) && itemList.size() > 0){
-			for (DeclareCustomsItem declareCustomsItem : itemList){
-				if (declareCustomsItem.getId() == null){
+		if (ObjectUtil.isNotEmpty(itemList) && itemList.size() > 0) {
+			for (DeclareCustomsItem declareCustomsItem : itemList) {
+				if (declareCustomsItem.getId() == null) {
 					declareCustomsItem.setPid(declareCustoms.getId());
 					declareCustomsItem.setCreateTime(new Date());
 					declareCustomsItem.setCreateUser(AuthUtil.getUserId());
 					declareCustomsItem.setTenantId(AuthUtil.getTenantId());
 					declareCustomsItemMapper.insert(declareCustomsItem);
-				}else {
+				} else {
 					declareCustomsItem.setUpdateTime(new Date());
 					declareCustomsItem.setUpdateUser(AuthUtil.getUserId());
 					declareCustomsItem.setPid(declareCustoms.getId());
@@ -183,15 +199,15 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 
 		//费用明细
 		List<DeclareCustomsFees> feesList = declareCustoms.getFeesList();
-		if (ObjectUtil.isNotEmpty(feesList) && feesList.size() > 0){
-			for (DeclareCustomsFees fees : feesList){
-				if (fees.getId() == null){
+		if (ObjectUtil.isNotEmpty(feesList) && feesList.size() > 0) {
+			for (DeclareCustomsFees fees : feesList) {
+				if (fees.getId() == null) {
 					fees.setPid(declareCustoms.getId());
 					fees.setCreateTime(new Date());
 					fees.setCreateUser(AuthUtil.getUserId());
 					fees.setTenantId(AuthUtil.getTenantId());
 					feesMapper.insert(fees);
-				}else {
+				} else {
 					fees.setUpdateTime(new Date());
 					fees.setUpdateUser(AuthUtil.getUserId());
 					fees.setPid(declareCustoms.getId());
@@ -203,15 +219,15 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 
 		//集装箱明细
 		List<DeclareCustomsContainer> containerList = declareCustoms.getContainerList();
-		if (ObjectUtil.isNotEmpty(containerList) && containerList.size() > 0){
-			for (DeclareCustomsContainer container : containerList){
-				if (container.getId() == null){
+		if (ObjectUtil.isNotEmpty(containerList) && containerList.size() > 0) {
+			for (DeclareCustomsContainer container : containerList) {
+				if (container.getId() == null) {
 					container.setPid(declareCustoms.getId());
 					container.setCreateTime(new Date());
 					container.setCreateUser(AuthUtil.getUserId());
 					container.setTenantId(AuthUtil.getTenantId());
 					containerMapper.insert(container);
-				}else {
+				} else {
 					container.setUpdateTime(new Date());
 					container.setUpdateUser(AuthUtil.getUserId());
 					container.setPid(declareCustoms.getId());
@@ -223,15 +239,15 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 
 		//单证明细
 		List<DeclareCustomsDocuments> documentsList = declareCustoms.getDocumentsList();
-		if (ObjectUtil.isNotEmpty(documentsList) && documentsList.size() > 0){
-			for (DeclareCustomsDocuments documents : documentsList){
-				if (documents.getId() == null){
+		if (ObjectUtil.isNotEmpty(documentsList) && documentsList.size() > 0) {
+			for (DeclareCustomsDocuments documents : documentsList) {
+				if (documents.getId() == null) {
 					documents.setPid(declareCustoms.getId());
 					documents.setCreateTime(new Date());
 					documents.setCreateUser(AuthUtil.getUserId());
 					documents.setTenantId(AuthUtil.getTenantId());
 					documentsMapper.insert(documents);
-				}else {
+				} else {
 					documents.setUpdateTime(new Date());
 					documents.setUpdateUser(AuthUtil.getUserId());
 					documents.setPid(declareCustoms.getId());
@@ -270,14 +286,14 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	 * 复制单据
 	 */
 	@Override
-	public R copyCustoms(DeclareCustoms declareCustoms){
+	public R copyCustoms(DeclareCustoms declareCustoms) {
 		LambdaQueryWrapper<DeclareCustoms> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(DeclareCustoms::getId, declareCustoms.getId())
 			.eq(DeclareCustoms::getTenantId, AuthUtil.getTenantId())
 			.eq(DeclareCustoms::getIsDeleted, 0);
 		DeclareCustoms customs = baseMapper.selectOne(lambdaQueryWrapper);
 
-		if (ObjectUtil.isEmpty(customs)){
+		if (ObjectUtil.isEmpty(customs)) {
 			throw new SecurityException("信息获取异常");
 		}
 
@@ -297,7 +313,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			.eq(DeclareCustomsItem::getIsDeleted, 0)
 			.eq(DeclareCustomsItem::getTenantId, AuthUtil.getTenantId());
 		List<DeclareCustomsItem> itemList = declareCustomsItemMapper.selectList(itemLambdaQueryWrapper);
-		itemList.forEach(e ->{
+		itemList.forEach(e -> {
 			e.setId(null);
 			e.setPid(null);
 			e.setCreateUser(AuthUtil.getUserId());
@@ -312,7 +328,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			.eq(DeclareCustomsContainer::getIsDeleted, 0)
 			.eq(DeclareCustomsContainer::getTenantId, AuthUtil.getTenantId());
 		List<DeclareCustomsContainer> containerList = containerMapper.selectList(containerLambdaQueryWrapper);
-		containerList.forEach(e ->{
+		containerList.forEach(e -> {
 			e.setId(null);
 			e.setPid(null);
 			e.setCreateUser(AuthUtil.getUserId());
@@ -327,7 +343,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			.eq(DeclareCustomsDocuments::getIsDeleted, 0)
 			.eq(DeclareCustomsDocuments::getTenantId, AuthUtil.getTenantId());
 		List<DeclareCustomsDocuments> documentsList = documentsMapper.selectList(documentsLambdaQueryWrapper);
-		documentsList.forEach(e ->{
+		documentsList.forEach(e -> {
 			e.setId(null);
 			e.setPid(null);
 			e.setCreateUser(AuthUtil.getUserId());
@@ -342,7 +358,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			.eq(DeclareCustomsDocuments::getIsDeleted, 0)
 			.eq(DeclareCustomsDocuments::getTenantId, AuthUtil.getTenantId());
 		List<DeclareCustomsFees> feesList = feesMapper.selectList(feesLambdaQueryWrapper);
-		feesList.forEach(e ->{
+		feesList.forEach(e -> {
 			e.setId(null);
 			e.setPid(null);
 			e.setCreateUser(AuthUtil.getUserId());
@@ -358,7 +374,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			.eq(DeclareCustomsFiles::getType, "1")
 			.eq(DeclareCustomsFiles::getPid, declareCustoms.getId());
 		List<DeclareCustomsFiles> filesList = filesMapper.selectList(filesLambdaQueryWrapper);
-		filesList.forEach(e ->{
+		filesList.forEach(e -> {
 			e.setId(null);
 			e.setPid(null);
 			e.setCreateUser(AuthUtil.getUserId());
@@ -380,7 +396,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 		DeclareCustoms declare = baseMapper.selectById(declareCustoms.getId());
 		if (declare.getStatus() == 1) {
 			throw new SecurityException("订单已开启审核,请勿重复提交");
-		}else if (declare.getStatus() == 5){
+		} else if (declare.getStatus() == 5) {
 			throw new SecurityException("订单已开启复审,请勿重复提交");
 		}
 
@@ -392,15 +408,15 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 		AuditPathsActs pathsActs = null;
 
 		//报关进口审批流程
-		if ("BGJK".equals(declareCustoms.getImportExportSigns())){
-			if (declare.getStatus() == 0){
+		if ("BGJK".equals(declareCustoms.getImportExportSigns())) {
+			if (declare.getStatus() == 0) {
 				//是否开启流程
 				pathsActs = iCheckClient.getActsByActId(17, "status");
 				//获取审批信息
 				auditPathsLevels = iCheckClient.listLevelsByActId(17, "status");
 				auditProecessDTO.setTimes(1);
 				auditProecessDTO.setProcessType("报关进口审批");
-			}else if (declare.getStatus() == 4){
+			} else if (declare.getStatus() == 4) {
 				//是否开启流程
 				pathsActs = iCheckClient.getActsByActId(19, "status");
 				//获取审批信息
@@ -409,15 +425,15 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 				auditProecessDTO.setProcessType("报关进口复审审批");
 			}
 
-		}else if ("BGCK".equals(declareCustoms.getImportExportSigns())){//报关出口审批流程
-			if(declare.getStatus() == 0){
+		} else if ("BGCK".equals(declareCustoms.getImportExportSigns())) {//报关出口审批流程
+			if (declare.getStatus() == 0) {
 				//是否开启流程
 				pathsActs = iCheckClient.getActsByActId(18, "status");
 				//获取审批信息
 				auditPathsLevels = iCheckClient.listLevelsByActId(18, "status");
 				auditProecessDTO.setTimes(1);
 				auditProecessDTO.setProcessType("报关出口审批");
-			}else if (declare.getStatus() == 4){
+			} else if (declare.getStatus() == 4) {
 				//是否开启流程
 				pathsActs = iCheckClient.getActsByActId(20, "status");
 				//获取审批信息
@@ -425,7 +441,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 				auditProecessDTO.setTimes(2);
 				auditProecessDTO.setProcessType("报关出口复审审批");
 			}
-		}else {
+		} else {
 			throw new SecurityException("缺少必要参数,审批失败");
 		}
 
@@ -452,12 +468,12 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 				.eq(DeclareCustomsItem::getPid, declare.getId());
 			List<DeclareCustomsItem> itemList = declareCustomsItemMapper.selectList(itemLambdaQueryWrapper);
 
-			if (ObjectUtil.isNotEmpty(itemList)){
+			if (ObjectUtil.isNotEmpty(itemList)) {
 				//数量
 				auditProecessDTO.setOrderQuantity(itemList.stream().map(DeclareCustomsItem::getTransactionsNumber).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 				//金额
 				auditProecessDTO.setAmount(itemList.stream().map(DeclareCustomsItem::getTotalPrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-			}else {
+			} else {
 				auditProecessDTO.setOrderQuantity(BigDecimal.ZERO);
 				auditProecessDTO.setAmount(BigDecimal.ZERO);
 			}
@@ -512,10 +528,10 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			}
 		}
 
-		if (declare.getStatus() == 0){
+		if (declare.getStatus() == 0) {
 			declare.setStatus(1);
 			declare.setAuditStatus("初审提交审核");
-		}else if (declare.getStatus() == 4){
+		} else if (declare.getStatus() == 4) {
 			declare.setStatus(5);
 			declare.setAuditStatus("复审提交审核");
 		}
@@ -532,19 +548,19 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	@Override
 	public R passCheck(Long id) {
 		DeclareCustoms declareCustoms = baseMapper.selectById(id);
-		if (declareCustoms == null){
+		if (declareCustoms == null) {
 			throw new SecurityException("审批通过失败");
 		}
-		if (declareCustoms.getStatus() == 4){
+		if (declareCustoms.getStatus() == 4) {
 			throw new SecurityException("订单已审批通过请勿重复审批");
-		}else if (declareCustoms.getStatus() == 7){
+		} else if (declareCustoms.getStatus() == 7) {
 			throw new SecurityException("订单已复审通过请勿重复审批");
 		}
 
-		if (declareCustoms.getStatus() == 1 || declareCustoms.getStatus() == 2){
+		if (declareCustoms.getStatus() == 1 || declareCustoms.getStatus() == 2) {
 			declareCustoms.setStatus(4);
 			declareCustoms.setAuditStatus("初审完成");
-		}else if (declareCustoms.getStatus() == 5 || declareCustoms.getStatus() == 6){
+		} else if (declareCustoms.getStatus() == 5 || declareCustoms.getStatus() == 6) {
 			//生成账单
 			this.paymentApply(declareCustoms, declareCustoms.getImportExportSigns(), declareCustoms.getImportExportSigns());
 			declareCustoms.setStatus(7);
@@ -561,14 +577,14 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	@Override
 	public R underReview(Long id) {
 		DeclareCustoms declareCustoms = baseMapper.selectById(id);
-		if (declareCustoms == null){
+		if (declareCustoms == null) {
 			throw new SecurityException("审批通过失败");
 		}
 
-		if (declareCustoms.getStatus() == 1 || declareCustoms.getStatus() == 2){
+		if (declareCustoms.getStatus() == 1 || declareCustoms.getStatus() == 2) {
 			declareCustoms.setStatus(2);
 			declareCustoms.setAuditStatus("初审审批中");
-		}else if (declareCustoms.getStatus() == 5 || declareCustoms.getStatus() == 6){
+		} else if (declareCustoms.getStatus() == 5 || declareCustoms.getStatus() == 6) {
 			declareCustoms.setStatus(6);
 			declareCustoms.setAuditStatus("复审审批中");
 		}
@@ -584,19 +600,19 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	@Override
 	public R passCancel(Long id) {
 		DeclareCustoms declareCustoms = baseMapper.selectById(id);
-		if (declareCustoms == null){
+		if (declareCustoms == null) {
 			throw new SecurityException("审批驳回失败,未找到单据");
 		}
-		if (declareCustoms.getStatus() == 0){
+		if (declareCustoms.getStatus() == 0) {
 			throw new SecurityException("订单已驳回或未提交审批,请勿重复操作");
-		}else if (declareCustoms.getStatus() == 4){
+		} else if (declareCustoms.getStatus() == 4) {
 			throw new SecurityException("订单已驳回或未提交复审,请勿重复操作");
 		}
 
-		if (declareCustoms.getStatus() == 1 || declareCustoms.getStatus() == 2){
+		if (declareCustoms.getStatus() == 1 || declareCustoms.getStatus() == 2) {
 			declareCustoms.setStatus(0);
 			declareCustoms.setAuditStatus("录入");
-		}else if (declareCustoms.getStatus() == 5 || declareCustoms.getStatus() == 6){
+		} else if (declareCustoms.getStatus() == 5 || declareCustoms.getStatus() == 6) {
 			declareCustoms.setStatus(4);
 			declareCustoms.setAuditStatus("初审完成");
 		}
@@ -612,26 +628,26 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
-	public DeclareCustoms revoke(DeclareCustoms declareCustoms){
+	public DeclareCustoms revoke(DeclareCustoms declareCustoms) {
 		DeclareCustoms customs = baseMapper.selectById(declareCustoms.getId());
-		if (ObjectUtil.isEmpty(customs)){
+		if (ObjectUtil.isEmpty(customs)) {
 			throw new SecurityException("撤销失败,未找到单据");
 		}
-		if (customs.getStatus().equals(2)){
+		if (customs.getStatus().equals(2)) {
 			throw new SecurityException("撤销失败,订单正在审批中");
-		}else if (customs.getStatus().equals(3)){
+		} else if (customs.getStatus().equals(3)) {
 			throw new SecurityException("撤销失败,订单已审核通过");
-		}else if (customs.getStatus().equals(0)){
+		} else if (customs.getStatus().equals(0)) {
 			throw new SecurityException("撤销失败,订单未提交审核");
-		}else if (customs.getStatus().equals(6)){
+		} else if (customs.getStatus().equals(6)) {
 			throw new SecurityException("撤销失败,订单正在复审审批中");
-		}else if (customs.getStatus().equals(7)){
+		} else if (customs.getStatus().equals(7)) {
 			throw new SecurityException("撤销失败,订单复审已审核通过");
-		}else if (customs.getStatus().equals(4)){
+		} else if (customs.getStatus().equals(4)) {
 			throw new SecurityException("撤销失败,订单未提交复审审核");
 		}
 
-		if (customs.getStatus() == 1){
+		if (customs.getStatus() == 1) {
 			//修改单据状态
 			customs.setStatus(0);
 			customs.setAuditStatus("初审撤销");
@@ -639,7 +655,7 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 			customs.setUpdateTime(new Date());
 			//撤销
 			iCheckClient.deteleByBillIdOrGrade(declareCustoms.getId(), 1);
-		}else if (customs.getStatus() == 5){
+		} else if (customs.getStatus() == 5) {
 			//获取账单信息
 			Acc acc = new Acc();
 			acc.setSrcParentId(customs.getId());
@@ -792,5 +808,326 @@ public class DeclareCustomsServiceImpl extends ServiceImpl<DeclareCustomsMapper,
 		}
 	}
 
+	/**
+	 * 导入PDF
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	public void importPDF(MultipartFile file, Long id) throws IOException, ParseException {
+		DeclareCustoms declareCustoms = baseMapper.selectById(id);
+		if (ObjectUtil.isEmpty(declareCustoms)){
+			throw new SecurityException("信息获取异常");
+		}
+		//加载PDF测试文档
+		PdfDocument pdf = new PdfDocument(file.getInputStream());
+
+		//保存为Excel文档
+		pdf.saveToFile("D:\\excel\\"+declareCustoms.getSysNo()+".xlsx", FileFormat.XLSX);
+		pdf.dispose();
+
+		//根据excel坐标获得数据
+		File f = new File("D:\\excel\\"+declareCustoms.getSysNo()+".xlsx");
+		Workbook wb = readExcel(new FileInputStream(f),f.getName());
+		Row row = null;
+		String[] strings = null;
+		R<CorpsDesc> corpsDesc;
+
+		if(wb != null){
+			//获取第一个sheet
+			Sheet sheet = wb.getSheetAt(0);
+
+			//获取最大行数
+			int rownum = sheet.getPhysicalNumberOfRows();
+			System.out.println("最大行数===》"+rownum);
+
+			//获取第四行
+			row = sheet.getRow(3);
+			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]);
+			}
+
+			//获取第五行
+			row = sheet.getRow(4);
+			String domesticCustomsNo = row.getCell(2).toString();//境内收货人海关号
+			if (domesticCustomsNo.length() > 5){
+				//获取最后一个')'的下标值
+				Integer lastIndexOf = domesticCustomsNo.lastIndexOf(")");
+				//截取,从'('开始-到')'为下标结束,不包含')'
+				domesticCustomsNo = domesticCustomsNo.substring(6, lastIndexOf);
+				System.out.println("境内收货人海关号======>"+domesticCustomsNo);
+				declareCustoms.setDomesticCustomsNo(domesticCustomsNo);
+			}
+
+			//获取第六行
+			row = sheet.getRow(5);
+			String domesticName = row.getCell(2).toString();//境内收货人名称
+			//根据名称查询客户id
+			corpsDesc = corpsDescClient.getCorpByName(domesticName, AuthUtil.getTenantId());
+			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);
+
+			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行
+			row = sheet.getRow(6);
+			String abroadConsigneeShipper = row.getCell(2).toString();//境外发货人海关号
+			if (abroadConsigneeShipper.length() > 5){
+				//获取最后一个')'的下标值
+				Integer lastIndexOf = abroadConsigneeShipper.lastIndexOf(")");
+				//截取,从'('开始-到')'为下标结束,不包含')'
+				abroadConsigneeShipper = abroadConsigneeShipper.substring(6, lastIndexOf);
+				System.out.println("境外发货人海关号======>"+abroadConsigneeShipper);
+				declareCustoms.setAbroadCustomsNo(abroadConsigneeShipper);
+			}
+
+			//获取第8行
+			row = sheet.getRow(7);
+			String abroadName = row.getCell(2).toString();//境外发货人名称
+			//根据名称查询客户id
+			corpsDesc = corpsDescClient.getCorpByName(abroadName, AuthUtil.getTenantId());
+			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);
+
+			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);
+			}
+
+			//获取第9行
+			row = sheet.getRow(8);
+			String consumptionUnitCustomsNo = row.getCell(2).toString();//消费使用单位海关号
+			if (consumptionUnitCustomsNo.length() > 6){
+				//获取最后一个')'的下标值
+				Integer lastIndexOf = consumptionUnitCustomsNo.lastIndexOf(")");
+				//截取,从'('开始-到')'为下标结束,不包含')'
+				consumptionUnitCustomsNo = consumptionUnitCustomsNo.substring(7, lastIndexOf);
+				System.out.println("消费使用单位海关号======>"+consumptionUnitCustomsNo);
+				declareCustoms.setConsumptionUnitCustomsNo(consumptionUnitCustomsNo);
+			}
+
+			//获取第10行
+			row = sheet.getRow(9);
+			String consumptionUnitName = row.getCell(2).toString();//消费使用单位名称
+			//根据名称查询客户id
+			corpsDesc = corpsDescClient.getCorpByName(consumptionUnitName, AuthUtil.getTenantId());
+			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);
+			}
+
+			//获取第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);
+			}else if (declareCustoms.getImportExportSigns().equals("BGCK")){
+				declareCustoms.setOuntryArrivalId(getPortId(countryOriginName));//启运国或运抵国id
+				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);
+			}else if (declareCustoms.getImportExportSigns().equals("BGCK")){
+				declareCustoms.setPortDestinationId(getPortId(stopOverHarborName));//经停港或指运港id
+				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);
+
+		}
+
+		baseMapper.updateById(declareCustoms);
+	}
+
+	public static Workbook readExcel(InputStream is, String extString){
+		Workbook wb = null;
+		extString = extString.substring(extString.lastIndexOf("."));
+		try {
+			if(".xls".equals(extString)){
+				return wb = new HSSFWorkbook(is);
+			}else if(".xlsx".equals(extString)){
+				return wb = new XSSFWorkbook(is);
+			}else {
+				return wb = null;
+			}
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return wb;
+	}
+
+	public Date getDate(String dateString) throws ParseException {
+		//1、定义转换格式
+		SimpleDateFormat formatter  = new SimpleDateFormat("yyyy-MM-dd");
+		SimpleDateFormat formatter2  = new SimpleDateFormat("yyyyMMdd");
+		//2、调用formatter2.parse(),将"yyyymmdd"转化为date类型  输出为:Sat Mar 23 00:00:00 GMT+08:00 1957
+		Date date = formatter2.parse(dateString);
+
+		//3、将date类型  (Sat Mar 23 00:00:00 GMT+08:00 1957)转化为String类型
+		//注意现在用的是formatter来做转换,输出为String类型的:"1957-03-23"
+		String  dString = formatter.format(date);
+
+		//4、将String转化为date,需要注意java.sql.Date.valueOf()函数只能接受参数类型为yyyy-MM-dd类型的
+		Date data = java.sql.Date.valueOf(dString);
+		return data;
+	}
+
+	//根据名称查询港口id
+	public Long getPortId(String name){
+		Long portId = null;
+		//根据名称查询港口id
+		BasicPortDesc portDesc = new BasicPortDesc();
+		portDesc.setName(name);
+		BasicPortDesc basicPortDesc = portClient.getPortData(portDesc);
+		if (ObjectUtil.isNotEmpty(basicPortDesc)){
+			portId = basicPortDesc.getId();
+		}
+		return portId;
+	}
+
+
 
 }