Переглянути джерело

Merge remote-tracking branch 'origin/dev' into dev

liyuan 3 місяців тому
батько
коміт
0283282408

+ 113 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java

@@ -2235,4 +2235,117 @@ public class Bills implements Serializable {
 	 */
 	@TableField(exist = false)
 	private Boolean isAMS;
+
+	/**
+	 * Int Flag
+	 */
+	@TableField(exist = false)
+	private Integer intFlag;
+
+	/**
+	 * String Flag
+	 */
+	@TableField(exist = false)
+	private String strFlag;
+
+	/**
+	 * 唛头
+	 */
+	@TableField(exist = false)
+	private String attachedMark;
+
+	/**
+	 * 货描
+	 */
+	@TableField(exist = false)
+	private String attachedGoodsdesc;
+
+	/**
+	 * 附页
+	 */
+	@TableField(exist = false)
+	private String attached;
+
+	/**
+	 * 联系人
+	 */
+	@TableField(exist = false)
+	private String contacts;
+
+	/**
+	 * 电话
+	 */
+	@TableField(exist = false)
+	private String phone;
+	/**
+	 * 传真
+	 */
+	@TableField(exist = false)
+	private String fax;
+
+	/**
+	 * bookingAgencyCode
+	 */
+	@TableField(exist = false)
+	private String bookingAgencyCode;
+
+	/**
+	 * RFA Number
+	 */
+	@TableField(exist = false)
+	private String rfaNumber;
+
+	/**
+	 * ALL IN RATE
+	 */
+	@TableField(exist = false)
+	private String allInRate;
+
+	/**
+	 * REQUEST FREE TIME @POD
+	 */
+	@TableField(exist = false)
+	private String requestFreeTimePod;
+
+	/**
+	 * BOF
+	 */
+	@TableField(exist = false)
+	private String bof;
+
+	/**
+	 * IHCD
+	 */
+	@TableField(exist = false)
+	private String ihcd;
+
+	/**
+	 * REMARK
+	 */
+	@TableField(exist = false)
+	private String remark;
+
+	/**
+	 * 箱子要求
+	 */
+	@TableField(exist = false)
+	private String boxRequire;
+
+	/**
+	 * PIL SALES签字确认
+	 */
+	@TableField(exist = false)
+	private String pilSales;
+
+	/**
+	 * PP 付费地点
+	 */
+	@TableField(exist = false)
+	private String prepaidAt;
+
+	/**
+	 * CC 付费地点
+	 */
+	@TableField(exist = false)
+	private String payableAt;
 }

+ 2 - 1
blade-service/blade-los/src/main/java/org/springblade/los/basic/corps/service/impl/BCorpsServiceImpl.java

@@ -535,8 +535,9 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
 	 */
 	public static String getSpells(String characters) {
 		StringBuffer buffer = new StringBuffer();
-		for (int i = 0; i < characters.length(); i++) {
+		characters = characters.replaceAll("[^a-zA-Z0-9]", "");
 
+		for (int i = 0; i < characters.length(); i++) {
 			char ch = characters.charAt(i);
 			if ((ch >> 7) == 0) {
 				// 判断是否为汉字,如果左移7为为0就不是汉字,否则是汉字

+ 4 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/locks/controller/BillLocksController.java

@@ -33,6 +33,7 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.los.business.locks.entity.BillLocks;
 import org.springblade.los.business.locks.service.IBillLocksService;
 import org.springblade.los.business.locks.vo.BillLocksVO;
+import org.springblade.los.business.sea.entity.Bills;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -81,6 +82,9 @@ public class BillLocksController extends BladeController {
 			.eq(ObjectUtils.isNotNull(billLocks.getSrcVesselId()), BillLocks::getSrcVesselId, billLocks.getSrcVesselId())
 			.like(ObjectUtils.isNotNull(billLocks.getSrcVoyageNo()), BillLocks::getSrcVoyageNo, billLocks.getSrcVoyageNo())
 			.orderByDesc(BillLocks::getCreateTime);
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.eq(BillLocks::getCreateDept, AuthUtil.getDeptId());
+		}
 		IPage<BillLocks> pages = billLocksService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);
 	}

+ 4 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/locks/service/impl/BillLocksServiceImpl.java

@@ -125,6 +125,8 @@ public class BillLocksServiceImpl extends ServiceImpl<BillLocksMapper, BillLocks
 								billLocks1.setCreateTime(new Date());
 								billLocks1.setCreateUser(AuthUtil.getUserId());
 								billLocks1.setCreateUserName(AuthUtil.getUserName());
+								billLocks1.setCreateDept(item.getAccDept());
+								billLocks1.setCreateDeptName(item.getAccDeptName());
 								billLocks1.setBranchId(item.getBranchId());
 								billLocks1.setBillNo(item.getBillNo());
 								billLocks1.setBillDate(item.getBillDate());
@@ -151,6 +153,8 @@ public class BillLocksServiceImpl extends ServiceImpl<BillLocksMapper, BillLocks
 							billLocks1.setCreateTime(new Date());
 							billLocks1.setCreateUser(AuthUtil.getUserId());
 							billLocks1.setCreateUserName(AuthUtil.getUserName());
+							billLocks1.setCreateDept(item.getAccDept());
+							billLocks1.setCreateDeptName(item.getAccDeptName());
 							billLocks1.setBranchId(item.getBranchId());
 							billLocks1.setBillNo(item.getBillNo());
 							billLocks1.setBillDate(item.getBillDate());

+ 82 - 59
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/MscZipImportImpl.java

@@ -47,6 +47,8 @@ import org.springblade.los.business.sea.entity.Containers;
 import org.springblade.los.business.sea.service.IContainersService;
 import org.springblade.los.business.sea.entity.ContainersCommodity;
 import org.springblade.los.business.sea.service.IContainersCommodityService;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+import org.springblade.los.finance.fee.service.IFeeCenterService;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.feign.IUserClient;
@@ -87,6 +89,8 @@ public class MscZipImportImpl extends ServiceImpl<BillsMapper, Bills> implements
 	private final IBPackagesService bPackagesService;
 	private final IBCntrTypesService bCntrTypesService;
 
+	private final IFeeCenterService feeCenterService;
+
 	private final ISysClient sysClient;
 	private final IUserClient userClient;
 	private final IDeptUtils deptUtils;
@@ -1198,31 +1202,24 @@ public class MscZipImportImpl extends ServiceImpl<BillsMapper, Bills> implements
 			}
 
 			// 测试用,只保存一票
-			Random rand = new Random();
-			int billIdx = rand.nextInt(mhBills.size()) + 1;
-			int currIdx = 0;
+			// Random rand = new Random();
+			// int billIdx = rand.nextInt(mhBills.size()) + 1;
+			// int currIdx = 0;
 
 			for (Bills mhBill : mhBills) {
-				// 测试用,只保存一票
-				currIdx++;
-				if(currIdx!=billIdx){
-					continue;
-				}
+				// // 测试用,只保存一票
+				// currIdx++;
+				// if(currIdx!=billIdx){
+				// 	continue;
+				// }
 
 				Object object = StringTools.handle(mhBill, "Bills");
 				Bills bills = JSONObject.parseObject(JSONObject.toJSONString(object), Bills.class);
 
-				if (ObjectUtils.isNull(bills.getBillNo())) {
-					BusinessBillNo businessBillNo = new BusinessBillNo();
-					businessBillNo.setBusinessTypeId(businessType.getId());
-					businessBillNo.setCode(bills.getBillNoFormat());
-					R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
-					if (!clientBillNo.isSuccess()) {
-						TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-						return R.fail(500, "生成订单编号失败");
-					}
-					bills.setBillNo((String) clientBillNo.getData());
-				}
+				// 导入标志 0 未处理 200 成功 >=400 失败
+				bills.setIntFlag(0);
+				// 导入信息
+				bills.setStrFlag("");
 
 				if (ObjectUtils.isNull(bills.getId())) {
 					bills.setCreateTime(new Date());
@@ -1232,6 +1229,7 @@ public class MscZipImportImpl extends ServiceImpl<BillsMapper, Bills> implements
 					bills.setVersion("1");
 
 					this.save(bills);
+					bills.setIntFlag(200);
 				} else {
 					Bills dataSourceBill = baseMapper.selectOne(new LambdaQueryWrapper<Bills>().select(Bills::getId, Bills::getVersion).eq(Bills::getId, bills.getId()));
 					if (!Objects.equals(dataSourceBill.getVersion(), bills.getVersion())) {
@@ -1247,55 +1245,80 @@ public class MscZipImportImpl extends ServiceImpl<BillsMapper, Bills> implements
 					bills.setUpdateUserName(AuthUtil.getUserName());
 
 					// 查一下是否有生成账单的费用,有的话不允许更改
-
-					this.updateById(bills);
-
-					bPreContainersService.remove(new LambdaQueryWrapper<PreContainers>()
-						.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
-						.eq(PreContainers::getPid, bills.getId())
-					);
-
-					bContainersService.remove(new LambdaQueryWrapper<Containers>()
-						.eq(Containers::getTenantId, AuthUtil.getTenantId())
-						.eq(Containers::getPid, bills.getId())
-					);
-
-					bContainersCommodityService.remove(new LambdaQueryWrapper<ContainersCommodity>()
-						.eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
-						.eq(ContainersCommodity::getPpId, bills.getId())
-					);
+					int feeCount = feeCenterService.count(new LambdaQueryWrapper<FeeCenter>()
+						.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+						.eq(FeeCenter::getPid, bills.getId())
+						.eq(FeeCenter::getAccStatus, 1L)
+						.gt(FeeCenter::getAccBillId, 0L));
+
+					if(feeCount>0){
+						bills.setIntFlag(400);
+						bills.setStrFlag("订舱号 " + bills.getBookingNo() + " 费用已经生产账单,不可导入!");
+					}else {
+						this.updateById(bills);
+						bills.setIntFlag(200);
+
+						bPreContainersService.remove(new LambdaQueryWrapper<PreContainers>()
+							.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
+							.eq(PreContainers::getPid, bills.getId())
+						);
+
+						bContainersService.remove(new LambdaQueryWrapper<Containers>()
+							.eq(Containers::getTenantId, AuthUtil.getTenantId())
+							.eq(Containers::getPid, bills.getId())
+						);
+
+						bContainersCommodityService.remove(new LambdaQueryWrapper<ContainersCommodity>()
+							.eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
+							.eq(ContainersCommodity::getPpId, bills.getId())
+						);
+					}
 				}
 
-				SeaBillsDetail seaBillsDetail = bills.getDetail();
-				if(ObjectUtils.isNotNull(seaBillsDetail)) {
-					seaBillsDetail.setPid(bills.getId());
-					bSeaBillsDetailService.saveOrUpdate(seaBillsDetail);
-				}
+				if(bills.getIntFlag()==200){
+					if (ObjectUtils.isNull(bills.getBillNo())) {
+						BusinessBillNo businessBillNo = new BusinessBillNo();
+						businessBillNo.setBusinessTypeId(businessType.getId());
+						businessBillNo.setCode(bills.getBillNoFormat());
+						R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+						if (!clientBillNo.isSuccess()) {
+							TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+							return R.fail(500, "生成订单编号失败");
+						}
+						bills.setBillNo((String) clientBillNo.getData());
+					}
 
-				List<PreContainers> preContainers = bills.getPreContainersList();
-				if(ObjectUtils.isNotNull(preContainers)) {
-					for (PreContainers preContainer : preContainers) {
-						preContainer.setPid(bills.getId());
+					SeaBillsDetail seaBillsDetail = bills.getDetail();
+					if (ObjectUtils.isNotNull(seaBillsDetail)) {
+						seaBillsDetail.setPid(bills.getId());
+						bSeaBillsDetailService.saveOrUpdate(seaBillsDetail);
 					}
-				}
-				bPreContainersService.saveOrUpdateBatch(preContainers);
 
-				List<Containers> containers = bills.getContainersList();
-				if(ObjectUtils.isNotNull(containers)) {
-					for (Containers container : containers) {
-						container.setPid(bills.getId());
+					List<PreContainers> preContainers = bills.getPreContainersList();
+					if (ObjectUtils.isNotNull(preContainers)) {
+						for (PreContainers preContainer : preContainers) {
+							preContainer.setPid(bills.getId());
+						}
 					}
+					bPreContainersService.saveOrUpdateBatch(preContainers);
+
+					List<Containers> containers = bills.getContainersList();
+					if (ObjectUtils.isNotNull(containers)) {
+						for (Containers container : containers) {
+							container.setPid(bills.getId());
+						}
 
-					bContainersService.saveOrUpdateBatch(containers);
+						bContainersService.saveOrUpdateBatch(containers);
 
-					for (Containers container : containers) {
-						List<ContainersCommodity> cntrCommoditys = container.getContainersCommodityList();
-						if(ObjectUtils.isNotNull(cntrCommoditys)) {
-							for (ContainersCommodity cntrCommodity : cntrCommoditys) {
-								cntrCommodity.setPpId(bills.getId());
-								cntrCommodity.setPid(container.getId());
+						for (Containers container : containers) {
+							List<ContainersCommodity> cntrCommoditys = container.getContainersCommodityList();
+							if (ObjectUtils.isNotNull(cntrCommoditys)) {
+								for (ContainersCommodity cntrCommodity : cntrCommoditys) {
+									cntrCommodity.setPpId(bills.getId());
+									cntrCommodity.setPid(container.getId());
+								}
+								bContainersCommodityService.saveOrUpdateBatch(cntrCommoditys);
 							}
-							bContainersCommodityService.saveOrUpdateBatch(cntrCommoditys);
 						}
 					}
 				}

+ 7 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/update/service/impl/UpdateServiceImpl.java

@@ -514,6 +514,13 @@ public class UpdateServiceImpl extends ServiceImpl<UpdateMapper, Update> impleme
 					assignmentCorps(bills, null, null, null, null, null, bCorps, item.getMainFieldCname(), "1", "3");
 					assignmentCorps(bills, null, null, null, null, null, bCorps, item.getMainFieldEname(), "1", "4");
 				}
+			} else if ("OP".equals(item.getQueryType())) {
+				R<User> res = userClient.userInfoById(Long.parseLong(item.getFieldValueNew()));
+				if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+					user = res.getData();
+					assignmentUser(bills, null, null, null, null, null, user, item.getMainFieldId(), "1", "1");
+					assignmentUser(bills, null, null, null, null, null, user, item.getMainFieldId(), "1", "3");
+				}
 			} else if ("港口".equals(item.getQueryType())) {
 				bPorts = bPortsService.getById(Long.parseLong(item.getFieldValueNew()));
 				if (bPorts != null) {

+ 67 - 15
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java

@@ -24,6 +24,7 @@ import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.los.Util.IDeptUtils;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.corps.mapper.CorpsMapper;
@@ -136,6 +137,15 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				feeCenter.setCreateDeptName(deptName);
 			}
 		} else {
+			FeeCenter dataSourceBill = baseMapper.selectOne(new LambdaQueryWrapper<FeeCenter>()
+				.select(FeeCenter::getId, FeeCenter::getVersion).eq(FeeCenter::getId, feeCenter.getId()));
+			if (!Objects.equals(dataSourceBill.getVersion(), feeCenter.getVersion())) {
+				return R.fail(601, "数据已被其他用户更新,请等待刷新后重试");
+			}
+			// 每更新一次往上累加一次版本
+			// 旧数据处理
+			int version = StringUtil.isBlank(dataSourceBill.getVersion()) ? 1 : Integer.parseInt(dataSourceBill.getVersion());
+			feeCenter.setVersion(String.valueOf(version + 1));
 			feeCenter.setUpdateUser(AuthUtil.getUserId());
 			feeCenter.setUpdateTime(new Date());
 			feeCenter.setUpdateUserName(AuthUtil.getUserName());
@@ -237,7 +247,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setElementsCode(items.getElementsCode());
 
 					feeCenter.setPid(bills.getId());
-					feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
+//					feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
 					feeCenter.setBillNo(bills.getBillNo());
 					feeCenter.setBusinessType(bills.getBusinessType());
 					feeCenter.setBillType(bills.getBillType());
@@ -599,6 +609,14 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			List<BCorps> bCorpsList = bCorpsService.list(new LambdaQueryWrapper<BCorps>()
 				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
 				.eq(BCorps::getIsDeleted, 0));
+			List<FeeCenter> feeCenters1 = new ArrayList<>();
+			List<Long> idList = list.stream().map(FeeCenter::getId).filter(Objects::nonNull).collect(Collectors.toList());
+			if (!idList.isEmpty()){
+				feeCenters1 = baseMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
+					.eq(FeeCenter::getTenantId,AuthUtil.getTenantId())
+					.eq(FeeCenter::getIsDeleted,0)
+					.in(FeeCenter::getId,idList));
+			}
 			for (FeeCenter feeCenter : list) {
 				if (!bCorpsList.isEmpty()) {
 					BCorps bCorps = bCorpsList.stream().filter(e -> e.getId().equals(feeCenter.getCorpId())).findFirst().orElse(null);
@@ -620,6 +638,19 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCreateDeptName(deptName);
 					}
 				} else {
+					if (!feeCenters1.isEmpty()){
+						FeeCenter dataSourceBill = feeCenters1.stream().filter(e-> e.getId().equals(feeCenter.getId()))
+							.findFirst().orElse(null);
+						if (dataSourceBill != null){
+							if (!Objects.equals(dataSourceBill.getVersion(), feeCenter.getVersion())) {
+								return R.fail(601, "数据已被其他用户更新,请等待刷新后重试");
+							}
+							// 每更新一次往上累加一次版本
+							// 旧数据处理
+							int version = StringUtil.isBlank(dataSourceBill.getVersion()) ? 1 : Integer.parseInt(dataSourceBill.getVersion());
+							feeCenter.setVersion(String.valueOf(version + 1));
+						}
+					}
 					feeCenter.setUpdateUser(AuthUtil.getUserId());
 					feeCenter.setUpdateTime(new Date());
 					feeCenter.setUpdateUserName(AuthUtil.getUserName());
@@ -967,8 +998,16 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 		List<FeeCenter> feeCenterList = new ArrayList<>();
 		if (ObjectUtils.isNotNull(list) && !list.isEmpty()) {
 			Date date = list.get(0).getBillDate();
-			BigDecimal exrateD = bCurrencyService.getCnyExrate(date, "USD", "D", "1");
-			BigDecimal exrateC = bCurrencyService.getCnyExrate(date, "USD", "C", "1");
+//			BigDecimal exrateD = bCurrencyService.getCnyExrate(date, "USD", "D", "1");
+//			BigDecimal exrateC = bCurrencyService.getCnyExrate(date, "USD", "C", "1");
+			List<FeeCenter> feeCenters1 = new ArrayList<>();
+			List<Long> idList = list.stream().map(FeeCenter::getId).filter(Objects::nonNull).collect(Collectors.toList());
+			if (!idList.isEmpty()){
+				feeCenters1 = baseMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
+					.eq(FeeCenter::getTenantId,AuthUtil.getTenantId())
+					.eq(FeeCenter::getIsDeleted,0)
+					.in(FeeCenter::getId,idList));
+			}
 			for (FeeCenter feeCenter : list) {
 				if (feeCenter.getId() == null) {
 					feeCenter.setCreateTime(new Date());
@@ -980,6 +1019,19 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCreateDeptName(deptName);
 					}
 				} else {
+					if (!feeCenters1.isEmpty()){
+						FeeCenter dataSourceBill = feeCenters1.stream().filter(e-> e.getId().equals(feeCenter.getId()))
+							.findFirst().orElse(null);
+						if (dataSourceBill != null){
+							if (!Objects.equals(dataSourceBill.getVersion(), feeCenter.getVersion())) {
+								return R.fail(601, "数据已被其他用户更新,请等待刷新后重试");
+							}
+							// 每更新一次往上累加一次版本
+							// 旧数据处理
+							int version = StringUtil.isBlank(dataSourceBill.getVersion()) ? 1 : Integer.parseInt(dataSourceBill.getVersion());
+							feeCenter.setVersion(String.valueOf(version + 1));
+						}
+					}
 					feeCenter.setUpdateUser(AuthUtil.getUserId());
 					feeCenter.setUpdateTime(new Date());
 					feeCenter.setUpdateUserName(AuthUtil.getUserName());
@@ -1019,17 +1071,10 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setAmountLoc(amount);
 					feeCenter.setAmountDiscountLoc(amount);
 				} else {
-					if ("D".equals(feeCenter.getDc())) {
-						feeCenter.setAmountNetLoc(amountNet.multiply(exrateD));
-						feeCenter.setAmountTaxLoc(amountTax.multiply(exrateD));
-						feeCenter.setAmountLoc(amount.multiply(exrateD));
-						feeCenter.setAmountDiscountLoc(amount.multiply(exrateD));
-					} else {
-						feeCenter.setAmountNetLoc(amountNet.multiply(exrateC));
-						feeCenter.setAmountTaxLoc(amountTax.multiply(exrateC));
-						feeCenter.setAmountLoc(amount.multiply(exrateC));
-						feeCenter.setAmountDiscountLoc(amount.multiply(exrateC));
-					}
+					feeCenter.setAmountNetLoc(amountNet.multiply(feeCenter.getExrate()));
+					feeCenter.setAmountTaxLoc(amountTax.multiply(feeCenter.getExrate()));
+					feeCenter.setAmountLoc(amount.multiply(feeCenter.getExrate()));
+					feeCenter.setAmountDiscountLoc(amount.multiply(feeCenter.getExrate()));
 				}
 				feeCenter.setAmountNet(amountNet);
 				feeCenter.setAmountTax(amountTax);
@@ -1060,6 +1105,13 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				for (String item : accBillNoList) {
 					BCorps bCorps = new BCorps();
 					bCorps.setAccBillNo(item);
+					List<FeeCenter> feeCenters = feeCenterList.stream().filter(e-> e.getAccBillNo().equals(item)).collect(Collectors.toList());
+					if (!feeCenters.isEmpty()){
+						bCorps.setCnName(feeCenters.get(0).getCorpCnName());
+						bCorps.setEnName(feeCenters.get(0).getCorpEnName());
+						bCorps.setShortName(feeCenters.get(0).getShortName());
+						bCorps.setId(feeCenters.get(0).getCorpId());
+					}
 					bCorpsList.add(bCorps);
 				}
 			}
@@ -1438,7 +1490,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setElementsId(items.getElementsId());
 					feeCenter.setElementsCode(items.getElementsCode());
 					feeCenter.setPid(bills.getId());
-					feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
+//					feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
 					feeCenter.setBillNo(bills.getBillNo());
 					feeCenter.setBusinessType(bills.getBusinessType());
 					feeCenter.setBillType(bills.getBillType());

+ 9 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FinAccBillsServiceImpl.java

@@ -24,6 +24,7 @@ import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.los.Util.IDeptUtils;
 import org.springblade.los.basic.business.entity.BusinessType;
 import org.springblade.los.basic.business.service.IBusinessTypeService;
@@ -339,6 +340,8 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 				feeCenterItem.setAccById(AuthUtil.getUserId());
 				feeCenterItem.setAccByName(AuthUtil.getUserName());
 				feeCenterItem.setAuditStatus("2");
+				int version = StringUtil.isBlank(feeCenterItem.getVersion()) ? 1 : Integer.parseInt(feeCenterItem.getVersion());
+				feeCenterItem.setVersion(String.valueOf(version + 1));
 				feeCenterList.add(feeCenterItem);
 			}
 		}
@@ -461,6 +464,8 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 			feeCenterItem.setAccStatus(0);
 			feeCenterItem.setAccById(0L);
 			feeCenterItem.setAccByName("");
+			int version = StringUtil.isBlank(feeCenterItem.getVersion()) ? 1 : Integer.parseInt(feeCenterItem.getVersion());
+			feeCenterItem.setVersion(String.valueOf(version + 1));
 			feeCenterList.add(feeCenterItem);
 		}
 		feeCenterService.saveOrUpdateBatch(feeCenterList);
@@ -757,6 +762,8 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 				feeCenterItem.setAccById(AuthUtil.getUserId());
 				feeCenterItem.setAccByName(AuthUtil.getUserName());
 				feeCenterItem.setAuditStatus("2");
+				int version = StringUtil.isBlank(feeCenterItem.getVersion()) ? 1 : Integer.parseInt(feeCenterItem.getVersion());
+				feeCenterItem.setVersion(String.valueOf(version + 1));
 				feeCenterList.add(feeCenterItem);
 			}
 		}
@@ -883,6 +890,8 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 			feeCenterItem.setAccStatus(0);
 			feeCenterItem.setAccById(0L);
 			feeCenterItem.setAccByName("");
+			int version = StringUtil.isBlank(feeCenterItem.getVersion()) ? 1 : Integer.parseInt(feeCenterItem.getVersion());
+			feeCenterItem.setVersion(String.valueOf(version + 1));
 			feeCenterList.add(feeCenterItem);
 		}
 		feeCenterService.saveOrUpdateBatch(feeCenterList);

+ 118 - 90
blade-service/blade-los/src/main/java/org/springblade/los/gmy/service/impl/GmyDataExchangApiServiceImpl.java

@@ -46,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.springblade.common.http.HttpHelper;
 
 import java.math.BigDecimal;
@@ -89,86 +90,86 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 		ObjectNode jn = objMap.createObjectNode();
 		jn.put("sucess", success);
 		jn.put("success", success);
-		if(!success) {
+		if (!success) {
 			jn.put("Error", message);
 		}
 		response.getWriter().write(jn.toString());
 	}
 
-	private static String getJsonObjValueAsString(JsonNode jn, String fieldName){
-		if(ObjectUtils.isNotNull(jn) && jn.has(fieldName)){
+	private static String getJsonObjValueAsString(JsonNode jn, String fieldName) {
+		if (ObjectUtils.isNotNull(jn) && jn.has(fieldName)) {
 			return jn.get(fieldName).asText().trim();
-		}else{
+		} else {
 			return "";
 		}
 	}
 
-	private static Date getJsonObjValueAsDateTime(JsonNode jn, String fieldName){
+	private static Date getJsonObjValueAsDateTime(JsonNode jn, String fieldName) {
 		String s = getJsonObjValueAsString(jn, fieldName);
-		if(s.isEmpty()){
+		if (s.isEmpty()) {
 			return null;
-		}else{
+		} else {
 			Date r;
-			try{
+			try {
 				DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 				r = df.parse(s);
-			}catch (Exception e){
+			} catch (Exception e) {
 				r = null;
 			}
 			return r;
 		}
 	}
 
-	private static Integer getJsonObjValueAsInteger(JsonNode jn, String fieldName){
+	private static Integer getJsonObjValueAsInteger(JsonNode jn, String fieldName) {
 		String s = getJsonObjValueAsString(jn, fieldName);
-		if(s.isEmpty()){
+		if (s.isEmpty()) {
 			return 0;
-		}else{
+		} else {
 			Integer r;
-			try{
+			try {
 				r = Integer.parseInt(s);
-			}catch (Exception e){
+			} catch (Exception e) {
 				r = 0;
 			}
 			return r;
 		}
 	}
 
-	private static BigDecimal getJsonObjValueAsBigDecimal(JsonNode jn, String fieldName){
+	private static BigDecimal getJsonObjValueAsBigDecimal(JsonNode jn, String fieldName) {
 		String s = getJsonObjValueAsString(jn, fieldName);
-		if(s.isEmpty()){
+		if (s.isEmpty()) {
 			BigDecimal r = new BigDecimal("0").setScale(3, BigDecimal.ROUND_HALF_UP);
 			return r;
-		}else{
+		} else {
 			BigDecimal r;
-			try{
+			try {
 				r = new BigDecimal(s);
-			}catch (Exception e){
+			} catch (Exception e) {
 				r = new BigDecimal("0");
 			}
 			return r.setScale(3, BigDecimal.ROUND_HALF_UP);
 		}
 	}
 
-	public BCorps getCorpByGmyCode(List<BCorps> corps, String code){
+	public BCorps getCorpByGmyCode(List<BCorps> corps, String code) {
 		BCorps corp = null;
 		if (ObjectUtils.isNotNull(code)) {
-			if(ObjectUtils.isNotNull(corps)){
+			if (ObjectUtils.isNotNull(corps)) {
 				Optional<BCorps> corpsOptional = corps.stream()
 					.filter(v -> {
-						return code.compareToIgnoreCase(v.getType())==0;
+						return code.compareToIgnoreCase(v.getType()) == 0;
 					})
 					.findFirst();
 				corp = corpsOptional.isPresent() ? corpsOptional.get() : null;
 			}
 
-			if(ObjectUtils.isNull(corp)) {
+			if (ObjectUtils.isNull(corp)) {
 				corp = corpService.getOne(new LambdaQueryWrapper<BCorps>()
 					.eq(BCorps::getTenantId, AuthUtil.getTenantId())
 					.eq(BCorps::getIsDeleted, 0)
 					.like(BCorps::getGmyCode, code)
 					.last("limit 1"));
-				if(ObjectUtils.isNotNull(corp)){
+				if (ObjectUtils.isNotNull(corp)) {
 					corp.setType(code);
 					corps.add(corp);
 				}
@@ -178,25 +179,25 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 		return corp;
 	}
 
-	public BCountrys getCountryByGmyCode(List<BCountrys> cntrys, String code){
+	public BCountrys getCountryByGmyCode(List<BCountrys> cntrys, String code) {
 		BCountrys cntry = null;
 		if (ObjectUtils.isNotNull(code)) {
-			if(ObjectUtils.isNotNull(cntrys)){
+			if (ObjectUtils.isNotNull(cntrys)) {
 				Optional<BCountrys> optional = cntrys.stream()
 					.filter(v -> {
-						return code.compareToIgnoreCase(v.getGmyCode())==0;
+						return code.compareToIgnoreCase(v.getGmyCode()) == 0;
 					})
 					.findFirst();
 				cntry = optional.isPresent() ? optional.get() : null;
 			}
 
-			if(ObjectUtils.isNull(cntry)) {
+			if (ObjectUtils.isNull(cntry)) {
 				cntry = countrysService.getOne(new LambdaQueryWrapper<BCountrys>()
 					.eq(BCountrys::getTenantId, AuthUtil.getTenantId())
 					.eq(BCountrys::getIsDeleted, 0)
 					.eq(BCountrys::getGmyCode, code)
 					.last("limit 1"));
-				if(ObjectUtils.isNotNull(cntry)){
+				if (ObjectUtils.isNotNull(cntry)) {
 					cntrys.add(cntry);
 				}
 			}
@@ -229,36 +230,36 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 			String billNo = getJsonObjValueAsString(jnHead, "BILL_NO");
 			JsonNode jnGoods = jsPayload.get("GOODS_LIST");
 			Boolean canProcess = false;
-			if(!declNo.isEmpty() && !billNo.isEmpty()){
+			if (!declNo.isEmpty() && !billNo.isEmpty()) {
 				GmyDeclHead declHead = gmyDeclHeadService.getOne(new LambdaQueryWrapper<GmyDeclHead>()
 					.eq(GmyDeclHead::getTenantId, TENANT_ID)
 					.eq(GmyDeclHead::getBranchId, BRANCH_ID)
 					.eq(GmyDeclHead::getIsDeleted, 0)
 					.eq(GmyDeclHead::getBillNo, billNo)
 					.last("limit 1"));
-				if(ObjectUtils.isNull(declHead)){
+				if (ObjectUtils.isNull(declHead)) {
 					declHead = new GmyDeclHead();
 					// 0 新建 5 已删除 9 已处理
 					declHead.setStatus(0);
 					canProcess = true;
-				}else{
-					if(declHead.getStatus()==5){
+				} else {
+					if (declHead.getStatus() == 5) {
 						declHead.setStatus(0);
 					}
-					if(declHead.getStatus()==9){
+					if (declHead.getStatus() == 9) {
 						message = "已处理";
 					}
-					canProcess = declHead.getStatus()==0;
+					canProcess = declHead.getStatus() == 0;
 				}
 
-				if(canProcess) {
+				if (canProcess) {
 					declHead.setTenantId(TENANT_ID);
 					declHead.setBranchId(BRANCH_ID);
 					declHead.setDeclNo(declNo);
 					declHead.setBillNo(billNo);
 
 					// from BUSINESS_ORDER_INFO
-					if(ObjectUtils.isNotNull(jnOrdrInfo)) {
+					if (ObjectUtils.isNotNull(jnOrdrInfo)) {
 						declHead.setCorpNo(getJsonObjValueAsString(jnOrdrInfo, "EXPORT_CODE"));//  客户编号
 						declHead.setWorkNo(getJsonObjValueAsString(jnOrdrInfo, "WORK_NO"));//业务关联号
 						declHead.setCorpCnName(getJsonObjValueAsString(jnOrdrInfo, "EXPORT_NAME"));//客户名称
@@ -380,28 +381,28 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 					declHead.setOrigBoxFlag(getJsonObjValueAsString(jnHead, "ORIG_BOX_FLAG"));//原箱运输
 					declHead.setEntryVersion(getJsonObjValueAsInteger(jnHead, "ENTRY_VERSION"));//报关单版本
 
-					if(ObjectUtils.isNotNull(declHead.getId())){
+					if (ObjectUtils.isNotNull(declHead.getId())) {
 						gmyDeclGoodsService.remove(new LambdaQueryWrapper<GmyDeclGoods>()
 							.eq(GmyDeclGoods::getTenantId, TENANT_ID)
 							.eq(GmyDeclGoods::getBranchId, BRANCH_ID)
 							.eq(GmyDeclGoods::getPid, declHead.getId()));
 					}
 
-					if(gmyDeclHeadService.saveOrUpdate(declHead)) {
+					if (gmyDeclHeadService.saveOrUpdate(declHead)) {
 						// from GOODS_LIST
 						List<GmyDeclGoods> declGoods = new ArrayList<>();
 
 						Long haad_id = declHead.getId();
 
 						if (ObjectUtils.isNotNull(jnGoods) && jnGoods.isArray()) {
-							jnGoods.forEach(jnGood1->{
+							jnGoods.forEach(jnGood1 -> {
 								JsonNode jnGood = jnGood1.get("DECL_GOODS");
 								System.out.println(jnGood.toString());
 								System.out.println("isObject: " + jnGood.isObject());
 								System.out.println("isArray: " + jnGood.isArray());
 								System.out.println("fieldNames: " + jnGood.fieldNames().toString());
 
-							// for (JsonNode jnGood : jnGoods) {
+								// for (JsonNode jnGood : jnGoods) {
 								GmyDeclGoods declGood = new GmyDeclGoods();
 								declGood.setTenantId(TENANT_ID);
 								declGood.setBranchId(BRANCH_ID);
@@ -463,21 +464,21 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 								declGood.setDeclGoodsEname1(getJsonObjValueAsString(jnGood, "DECL_GOODS_ENAME1'"));//商品英文名称
 
 								declGoods.add(declGood);
-							// }
+								// }
 							});
 						}
 
-						if(!declGoods.isEmpty()){
+						if (!declGoods.isEmpty()) {
 							gmyDeclGoodsService.saveBatch(declGoods);
 						}
 
 						success = true;
 					}
 				}
-			}else {
+			} else {
 				message = "Body 数据解析失败 1!";
 			}
-		}else{
+		} else {
 			message = "Body 数据解析失败 2!";
 		}
 
@@ -542,15 +543,15 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 					declCosts.add(declCost);
 				}
 
-				if(!declCosts.isEmpty()){
+				if (!declCosts.isEmpty()) {
 					gmyDeclCostsService.saveOrUpdateBatch(declCosts);
 
 					success = true;
 				}
-			}else{
+			} else {
 				message = "缺少 COSTS 节!";
 			}
-		}else{
+		} else {
 			message = "Body 数据解析失败!";
 		}
 
@@ -566,8 +567,8 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 		String transTypeCode = ObjectUtils.isNotNull(decl.getTransTypeCode()) ? decl.getTransTypeCode() : "";
 		String ieType = ObjectUtils.isNotNull(decl.getIeType()) ? decl.getIeType() : "";
 
-		if(id<=0){
-			if(transTypeCode.isEmpty() || ieType.isEmpty()) {
+		if (id <= 0) {
+			if (transTypeCode.isEmpty() || ieType.isEmpty()) {
 				throw new RuntimeException("缺少运输方式和进出口标志参数!");
 			}
 		}
@@ -576,7 +577,7 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 		lambdaQueryWrapper.eq(GmyDeclHead::getIsDeleted, 0)
 			.eq(GmyDeclHead::getTenantId, AuthUtil.getTenantId())
 			.eq(GmyDeclHead::getBranchId, BRANCH_ID)
-			.eq(id>0, GmyDeclHead::getId, id)
+			.eq(id > 0, GmyDeclHead::getId, id)
 			// 2 海运 5 空运
 			.eq(ObjectUtils.isNotNull(transTypeCode), GmyDeclHead::getTransTypeCode, transTypeCode)
 			// E 出口 I 进口
@@ -594,6 +595,12 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 			lambdaQueryWrapper.ge(GmyDeclHead::getDeclDate, decl.getDeclDateList().get(0));
 			lambdaQueryWrapper.le(GmyDeclHead::getDeclDate, decl.getDeclDateList().get(1));
 		}
+		if (ObjectUtils.isNotNull(decl.getStatus())) {
+			lambdaQueryWrapper.eq(GmyDeclHead::getStatus, decl.getStatus());
+		} else {
+			lambdaQueryWrapper.eq(GmyDeclHead::getStatus, 0);
+		}
+
 		IPage<GmyDeclHead> pages = gmyDeclHeadService.page(Condition.getPage(query), lambdaQueryWrapper);
 
 		return R.data(pages);
@@ -601,9 +608,9 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 
 	@Override
 	public R<GmyDeclHead> detail(String id) throws Exception {
-		if(ObjectUtils.isNotNull(id)){
+		if (ObjectUtils.isNotNull(id)) {
 			GmyDeclHead declHead = gmyDeclHeadService.getById(id);
-			if(ObjectUtils.isNotNull(declHead)) {
+			if (ObjectUtils.isNotNull(declHead)) {
 				List<GmyDeclGoods> goodsList = gmyDeclGoodsService.list(new LambdaQueryWrapper<GmyDeclGoods>()
 					.eq(GmyDeclGoods::getIsDeleted, 0)
 					.eq(GmyDeclGoods::getTenantId, AuthUtil.getTenantId())
@@ -615,7 +622,7 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 			}
 
 			return R.data(declHead);
-		}else {
+		} else {
 			return R.data(new GmyDeclHead());
 		}
 	}
@@ -623,7 +630,8 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R<List<GmyDeclHead>> importDecl(String ids) throws Exception {
-		if(ObjectUtils.isNotNull(ids)) {
+		String message = "";
+		if (ObjectUtils.isNotNull(ids)) {
 			List<GmyDeclHead> declHeads = gmyDeclHeadService.list(new LambdaQueryWrapper<GmyDeclHead>()
 				.eq(GmyDeclHead::getIsDeleted, 0)
 				.eq(GmyDeclHead::getTenantId, AuthUtil.getTenantId())
@@ -632,7 +640,7 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 				.in(GmyDeclHead::getId, ids)
 				.eq(GmyDeclHead::getStatus, 0));
 
-			if(ObjectUtils.isNotNull(declHeads) && !declHeads.isEmpty()){
+			if (ObjectUtils.isNotNull(declHeads) && !declHeads.isEmpty()) {
 				List<BCorps> corps = new ArrayList<>();
 				List<BCountrys> cntrys = new ArrayList<>();
 				List<String> updateIds = new ArrayList<>();
@@ -647,19 +655,22 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 					String ieType = ObjectUtils.isNotNull(declHead.getIeType()) ? declHead.getIeType() : "";
 					// BGSE=海运出口报关 BGSI=海运进口报关 BGAE=空运出口报关 BGAI=空运进口报关
 					String declBusinessType = "";
-					if("2".equals(transTypeCode)){
-						declBusinessType = ieType=="E" ? "BGSE" : "BGSI";
+					String billNoFormat = "";
+					if ("2".equals(transTypeCode)) {
+						declBusinessType = ieType.equals("E") ? "BGSE" : "BGSI";
+						billNoFormat = ieType.equals("E") ? "BG-HYCK" : "BG-HYJK";
 					}
-					if("5".equals(transTypeCode)){
-						declBusinessType = ieType=="E" ? "BGAE" : "BGAI";
+					if ("5".equals(transTypeCode)) {
+						declBusinessType = ieType.equals("E") ? "BGAE" : "BGAI";
+						billNoFormat = ieType.equals("E") ? "BG-KYCK" : "BG-KYJK";
 					}
 
 					String import_message = "";
 
-					if(!declBusinessType.isEmpty() && ObjectUtils.isNotNull(declHead.getBillNo())) {
+					if (!declBusinessType.isEmpty() && ObjectUtils.isNotNull(declHead.getBillNo())) {
 						BCorps corp = null;
 						BCountrys cntry = null;
-							// 1 校验是否允许导入
+						// 1 校验是否允许导入
 						// a: 导入的提单号在系统中已存在  cusDecl.getMblno()=>declHead.getBillNo()
 						CustomsDeclaration cusDecltmp = customsDeclarationService.getOne(new LambdaQueryWrapper<CustomsDeclaration>()
 							.eq(CustomsDeclaration::getTenantId, AuthUtil.getTenantId())
@@ -669,12 +680,12 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 							.eq(CustomsDeclaration::getMblno, declHead.getBillNo())
 							.notLike(CustomsDeclaration::getBillNo, "TAOCD")
 							.last("limit 1"));
-						if(ObjectUtils.isNotNull(cusDecltmp)){
+						if (ObjectUtils.isNotNull(cusDecltmp)) {
 							canImport = false;
 							import_message += "导入的提单号在系统中已存在!\n";
 						}
 						// b: 导入的报关单号在系统中已存在 cusDecl.getCustomsDeclarationNumber()=>declHead.getCustomsNo()
-						if(canImport){
+						if (canImport) {
 							CustomsDeclaration cusDecltmp2 = customsDeclarationService.getOne(new LambdaQueryWrapper<CustomsDeclaration>()
 								.eq(CustomsDeclaration::getTenantId, AuthUtil.getTenantId())
 								.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid() + "")
@@ -683,24 +694,24 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 								.eq(CustomsDeclaration::getCustomsDeclarationNumber, declHead.getCustomsNo())
 								.notLike(CustomsDeclaration::getBillNo, "TAOCD")
 								.last("limit 1"));
-							if(ObjectUtils.isNotNull(cusDecltmp2)){
+							if (ObjectUtils.isNotNull(cusDecltmp2)) {
 								canImport = false;
 								import_message += "导入的报关单号在系统中已存在!\n";
 							}
 						}
 						// c: 客户编号未匹配,不允许导入,请进行维护 bCorps.getGmyCode()=>
-						if(canImport){
+						if (canImport) {
 							corp = getCorpByGmyCode(corps, declHead.getCorpNo());
-							if(ObjectUtils.isNotNull(corp)){
+							if (ObjectUtils.isNull(corp)) {
 								canImport = false;
 								import_message += "客户编号未匹配,不允许导入,请进行维护!\n";
 							}
 						}
 
 						// d: 国家编号未匹配(运抵国 or 指运港),不允许导入,请进行维护!
-						if(canImport){
+						if (canImport) {
 							cntry = getCountryByGmyCode(cntrys, declHead.getCountryCode());
-							if(ObjectUtils.isNotNull(cntry)){
+							if (ObjectUtils.isNull(cntry)) {
 								canImport = false;
 								import_message += "国家编号未匹配(运抵国 or 指运港),不允许导入,请进行维护!\n";
 							}
@@ -709,54 +720,70 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 						// e: 导入的数据中没有费用,不允许导入 费用编号未匹配,不允许导入,请进行维护!
 						List<GmyDeclCosts> declCosts = null;
 						List<BFees> bFees = null;
-						if(canImport){
+						if (canImport) {
 							declCosts = gmyDeclCostsService.list(new LambdaQueryWrapper<GmyDeclCosts>()
 								.eq(GmyDeclCosts::getTenantId, AuthUtil.getTenantId())
 								.eq(GmyDeclCosts::getBranchId, BRANCH_ID + "")
 								.eq(GmyDeclCosts::getIsDeleted, 0)
 								.eq(GmyDeclCosts::getWorkNo, declHead.getWorkNo()));
-							if(ObjectUtils.isNull(declCosts) || declCosts.isEmpty()){
+							if (ObjectUtils.isNull(declCosts) || declCosts.isEmpty()) {
 								canImport = false;
 								import_message += "导入的数据中没有费用,不允许导入!\n";
 							}
 						}
 
-						if(canImport){
+						if (canImport) {
 							List<String> feeTypeCodes = declCosts.stream().map(GmyDeclCosts::getFeeTypeCode).distinct().collect(Collectors.toList());
-							if(!feeTypeCodes.isEmpty()){
+							if (!feeTypeCodes.isEmpty()) {
 								bFees = feeService.list(new LambdaQueryWrapper<BFees>()
 									.eq(BFees::getTenantId, AuthUtil.getTenantId())
 									.eq(BFees::getIsDeleted, 0)
 									.in(BFees::getGmyCode, feeTypeCodes));
 							}
 
-							if(ObjectUtils.isNull(bFees)){
+							if (ObjectUtils.isNull(bFees)) {
 								bFees = new ArrayList<>();
 							}
 
 							for (String feeTypeCode : feeTypeCodes) {
-								if(bFees.stream().filter(f->f.getGmyCode()==feeTypeCode).count()==0){
+								if (bFees.stream().noneMatch(f -> f.getGmyCode().equals(feeTypeCode))) {
 									canImport = false;
 									import_message += "关贸云费用代码 " + feeTypeCode + " 没有维护!\n";
 								}
 							}
 						}
 						// 2 导入生成新的报关单
-						if(canImport) {
+						if (canImport) {
 							CustomsDeclaration cusDecl = new CustomsDeclaration();
 							List<CustomsDeclarationGoods> cusDeclGoods = new ArrayList<>();
 
 							// 1 维护主表
 							cusDecl.setBusinessType(declBusinessType);
 							cusDecl.setBusinessTypeCode(declBusinessType);
+							cusDecl.setBillNoFormat(billNoFormat);
 							cusDecl.setCorpId(corp.getId());
 							cusDecl.setCorpCnName(corp.getCnName());
 							cusDecl.setCorpEnName(corp.getEnName());
 							// if ((Pos('_01',Acds.Fieldbyname('BILL_NO').asString)>0) and (Copy(Acds.Fieldbyname('BILL_NO').asString,Pos('_01',Acds.Fieldbyname('BILL_NO').asString),20)<>''))
 							// or  ((Pos('_',Acds.Fieldbyname('BILL_NO').asString)>0) and (Pos('_01',Acds.Fieldbyname('BILL_NO').asString)=0)) then
 							// Parambyname('MBLNO').asString:=Copy(Acds.Fieldbyname('BILL_NO').asString,Pos('_',Acds.Fieldbyname('BILL_NO').asString),20)
-						    // else Parambyname('MBLNO').asString:=Copy(Acds.Fieldbyname('BILL_NO').asString,1,20);
-							String billNo=declHead.getBillNo(), mblNo = billNo.contains("_") ? billNo.substring(billNo.indexOf("_"), billNo.indexOf("_") + 20) : billNo.substring(0, 20);
+							// else Parambyname('MBLNO').asString:=Copy(Acds.Fieldbyname('BILL_NO').asString,1,20);
+							String billNo = declHead.getBillNo();
+							String mblNo;
+							if (billNo.contains("_")) {
+								String temporary = billNo.substring(billNo.indexOf("_"));
+								if (temporary.length()>20){
+									mblNo = billNo.substring(billNo.indexOf("_"), billNo.indexOf("_") + 20);
+								}else{
+									mblNo = billNo.substring(billNo.indexOf("_"));
+								}
+							}else{
+								if (billNo.length()>20){
+									mblNo = billNo.substring(0, 20);
+								}else{
+									mblNo = billNo;
+								}
+							}
 							cusDecl.setMblno(mblNo);
 							cusDecl.setDeliveryNumbers(declHead.getContrNo());
 							cusDecl.setEtdDate(declHead.getIeDate());
@@ -789,7 +816,7 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 								.eq(GmyDeclGoods::getIsDeleted, 0)
 								// 根据 dcclNo 关联
 								.eq(GmyDeclGoods::getDeclNo, declHead.getDeclNo()));
-							if(ObjectUtils.isNotNull(declGoods)){
+							if (ObjectUtils.isNotNull(declGoods)) {
 								for (GmyDeclGoods declGood : declGoods) {
 									CustomsDeclarationGoods cusDeclGood = new CustomsDeclarationGoods();
 									cusDeclGood.setSort(declGood.getGoodsSeq()); // cusDeclGoods.size() + 1
@@ -810,31 +837,32 @@ public class GmyDataExchangApiServiceImpl implements IGmyDataExchangApiService {
 							// 3 更新单据状态
 							declHead.setStatus(9);
 							updateIds.add(declHead.getId().toString());
+							message += "报关单号 " + declHead.getCustomsNo() + " 导入成功!<br/>";
+						}else{
+							message += "报关单号 " + declHead.getCustomsNo() + " 导入失败:" + import_message + "<br/>";
 						}
-
 					}
 					declHead.setImportMessage(import_message.trim());
 				}
 
 				// 更新数据库
-				if(!addedCusDecls.isEmpty()){
-					for (CustomsDeclaration addedCusDecl: addedCusDecls) {
+				if (!addedCusDecls.isEmpty()) {
+					for (CustomsDeclaration addedCusDecl : addedCusDecls) {
 						// submit 同时保存商品和费用
 						customsDeclarationService.submit(addedCusDecl);
 					}
 				}
-				if(!updateIds.isEmpty()) {
-					LambdaUpdateWrapper<GmyDeclHead> uw = Wrappers.<GmyDeclHead>update().lambda();
-					uw.set(GmyDeclHead::getStatus, 9);
-					uw.in(GmyDeclHead::getId, updateIds.stream().collect(Collectors.joining(",")));
-
-					gmyDeclHeadService.update(uw);
+				if (!updateIds.isEmpty()) {
+					gmyDeclHeadService.update(null, new LambdaUpdateWrapper<GmyDeclHead>()
+						.set(GmyDeclHead::getStatus, 9)
+						.in(GmyDeclHead::getId, updateIds)
+					);
 				}
 			}
 
-			return R.data(declHeads);
 		}else {
-			return R.data(new ArrayList<>());
+			message = "没有可导入关贸云报关单!";
 		}
+		return R.success(message);
 	}
 }

+ 6 - 0
blade-service/blade-los/src/main/java/org/springblade/los/statisticAnalysis/service/impl/StatisticAnalysisServiceImpl.java

@@ -142,6 +142,8 @@ public class StatisticAnalysisServiceImpl extends ServiceImpl<FinanceProfitMappe
 			if (ObjectUtils.isNotNull(financeProfit.getExamine())) {
 				lambdaQueryWrapper.eq(Amends::getStatus, 3);
 			}
+			lambdaQueryWrapper.gt(ObjectUtils.isNotNull(financeProfit.getStatisticsDateStart()), Amends::getEtd, financeProfit.getStatisticsDateStart());
+			lambdaQueryWrapper.lt(ObjectUtils.isNotNull(financeProfit.getStatisticsDateEnd()), Amends::getEtd, financeProfit.getStatisticsDateEnd());
 			List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
 			List<FeeCenter> feeCenterList = new ArrayList<>();
 			if (!amendsList.isEmpty()) {
@@ -1039,6 +1041,8 @@ public class StatisticAnalysisServiceImpl extends ServiceImpl<FinanceProfitMappe
 			if (ObjectUtils.isNotNull(financeProfit.getExamine())) {
 				lambdaQueryWrapper.eq(Amends::getStatus, 3);
 			}
+			lambdaQueryWrapper.gt(ObjectUtils.isNotNull(financeProfit.getStatisticsDateStart()), Amends::getEtd, financeProfit.getStatisticsDateStart());
+			lambdaQueryWrapper.lt(ObjectUtils.isNotNull(financeProfit.getStatisticsDateEnd()), Amends::getEtd, financeProfit.getStatisticsDateEnd());
 			List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
 			List<FeeCenter> feeCenterList = new ArrayList<>();
 			if (!amendsList.isEmpty()) {
@@ -1219,6 +1223,8 @@ public class StatisticAnalysisServiceImpl extends ServiceImpl<FinanceProfitMappe
 			if (ObjectUtils.isNotNull(financeProfit.getExamine())) {
 				lambdaQueryWrapper.eq(Amends::getStatus, 3);
 			}
+			lambdaQueryWrapper.gt(ObjectUtils.isNotNull(financeProfit.getStatisticsDateStart()), Amends::getEtd, financeProfit.getStatisticsDateStart());
+			lambdaQueryWrapper.lt(ObjectUtils.isNotNull(financeProfit.getStatisticsDateEnd()), Amends::getEtd, financeProfit.getStatisticsDateEnd());
 			List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
 			List<FeeCenter> feeCenterList = new ArrayList<>();
 			if (!amendsList.isEmpty()) {