Browse Source

网关日志修改
提取成本区分一,二程费用

纪新园 2 months ago
parent
commit
609535bab6

+ 1 - 1
blade-gateway/src/main/java/org/springblade/gateway/filter/GlobalRequestLogFilter.java

@@ -101,7 +101,7 @@ public class GlobalRequestLogFilter implements GlobalFilter, Ordered {
 
 		beforeReqLog.append("================  Gateway Request End  =================\n");
 		// 打印执行时间
-		log.info(beforeReqLog.toString(), beforeReqArgs.toArray());
+//		log.info(beforeReqLog.toString(), beforeReqArgs.toArray());
 		return chain.filter(exchange);
 	}
 

+ 1 - 1
blade-gateway/src/main/java/org/springblade/gateway/filter/GlobalResponseLogFilter.java

@@ -87,7 +87,7 @@ public class GlobalResponseLogFilter implements GlobalFilter, Ordered {
 
 				responseLog.append("================  Gateway Response End  =================\n");
 				// 打印执行时间
-				log.info(responseLog.toString(), responseArgs.toArray());
+//				log.info(responseLog.toString(), responseArgs.toArray());
 			})
 		);
 	}

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

@@ -783,10 +783,10 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				feeCenter.setBookingAgentEnName(bills.getBookingAgentEnName());
 				feeCenter.setQuantityCntrDescr(bills.getQuantityCntrDescr());
 				feeCenter.setTeu(bills.getTeu());
-				if (ObjectUtils.isNotNull(bills.getBranchId())){
+				if (ObjectUtils.isNotNull(bills.getBranchId())) {
 					feeCenter.setBillBranchId(bills.getBranchId());
 					feeCenter.setBillBranchName(bills.getBranchName());
-				}else{
+				} else {
 					feeCenter.setBillBranchId(deptId);
 					feeCenter.setBillBranchName(deptName);
 				}
@@ -2035,6 +2035,28 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						list1.add(feeCenterD);
 						count++;
 					}
+					//二程费用
+					if (ObjectUtils.isNotNull(items.getOceanFreightTwo()) &&
+						new BigDecimal("0.00").compareTo(items.getOceanFreightTwo()) == 0) {
+						FeeCenter feeCenterChengBrothers = this.addFeeCenterChengBrothers(bills, "C", count, fees, "船公司", items,
+							curExrateList, preContainers, exrateType, "1");
+						if (feeCenterChengBrothers != null) {
+							feeCenterChengBrothers.setBranchId(branchId);
+							feeCenterChengBrothers.setBranchName(deptName);
+							list.add(feeCenterChengBrothers);
+							list1.add(feeCenterChengBrothers);
+							count++;
+						}
+						FeeCenter feeCenterDChengBrothers = this.addFeeCenterChengBrothers(bills, "D", count, fees, "国内直接客户", items,
+							curExrateList, preContainers, exrateType, "2");
+						if (feeCenterDChengBrothers != null) {
+							feeCenterDChengBrothers.setBranchId(branchId);
+							feeCenterDChengBrothers.setBranchName(deptName);
+							list.add(feeCenterDChengBrothers);
+							list1.add(feeCenterDChengBrothers);
+							count++;
+						}
+					}
 				} else if ("MM".equals(bills.getBillType())) {
 					FeeCenter feeCenter = this.addFeeCenter(bills, "C", count, fees, "船公司", items,
 						curExrateList, preContainers, exrateType, "1");
@@ -2066,6 +2088,40 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 							count++;
 						}
 					}
+					//二程费用
+					if (ObjectUtils.isNotNull(items.getOceanFreightTwo()) &&
+						new BigDecimal("0.00").compareTo(items.getOceanFreightTwo()) == 0) {
+						FeeCenter feeCenterChengBrothers = this.addFeeCenterChengBrothers(bills, "C", count, fees, "船公司", items,
+							curExrateList, preContainers, exrateType, "1");
+						if (feeCenterChengBrothers != null) {
+							feeCenterChengBrothers.setBranchId(branchId);
+							feeCenterChengBrothers.setBranchName(deptName);
+							list.add(feeCenterChengBrothers);
+							list1.add(feeCenterChengBrothers);
+							count++;
+						}
+						if ("COC".equals(bills.getBoxBelongsTo())) {
+							FeeCenter feeCenterDChengBrothers = this.addFeeCenterChengBrothers(bills, "D", count, fees, "国内直接客户", items,
+								curExrateList, preContainers, exrateType, "3");
+							if (feeCenterDChengBrothers != null) {
+								feeCenterDChengBrothers.setBranchId(branchId);
+								feeCenterDChengBrothers.setBranchName(deptName);
+								list.add(feeCenterDChengBrothers);
+								list1.add(feeCenterDChengBrothers);
+								count++;
+							}
+						} else {
+							FeeCenter feeCenter1ChengBrothers = this.addFeeCenterChengBrothers(bills, "C", count, feesFjf, "船公司", items,
+								curExrateList, preContainers, exrateType, "5");
+							if (feeCenter1ChengBrothers != null) {
+								feeCenter1ChengBrothers.setBranchId(branchId);
+								feeCenter1ChengBrothers.setBranchName(deptName);
+								list.add(feeCenter1ChengBrothers);
+								list1.add(feeCenter1ChengBrothers);
+								count++;
+							}
+						}
+					}
 				} else if ("MH".equals(bills.getBillType())) {
 					throw new RuntimeException("只能提取主单,直单单据成本");
 					/*FeeCenter feeCenter = this.addFeeCenter(bills, "C", count, fees, "国内直接客户", items,
@@ -2582,21 +2638,13 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			feeCenter.setCorpCnName(bills.getCarrierCnName());
 			feeCenter.setCorpEnName(bills.getCarrierEnName());
 			feeCenter.setShortName(bills.getCarrierShortName());
-			if (ObjectUtils.isNotNull(bills.getPotId())) {
-				feeCenter.setPrice(items.getOceanFreight().add(items.getOceanFreightTwo()));
-			} else {
-				feeCenter.setPrice(items.getOceanFreight());
-			}
+			feeCenter.setPrice(items.getOceanFreight());
 		} else if ("2".equals(type)) {
 			feeCenter.setCorpId(bills.getCorpId());
 			feeCenter.setCorpCnName(bills.getCorpCnName());
 			feeCenter.setCorpEnName(bills.getCorpEnName());
 			feeCenter.setShortName(bills.getShortName());
-			if (ObjectUtils.isNotNull(bills.getPotId())) {
-				feeCenter.setPrice(items.getSalesPrice().add(items.getSalesPriceTwo()));
-			} else {
-				feeCenter.setPrice(items.getSalesPrice());
-			}
+			feeCenter.setPrice(items.getSalesPrice());
 		} else if ("3".equals(type)) {
 			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
 				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
@@ -2609,11 +2657,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			feeCenter.setCorpCnName(bCorps.getCnName());
 			feeCenter.setCorpEnName(bCorps.getEnName());
 			feeCenter.setShortName(bCorps.getShortName());
-			if (ObjectUtils.isNotNull(bills.getPotId())) {
-				feeCenter.setPrice(items.getSalesPrice().add(items.getSalesPriceTwo()));
-			} else {
-				feeCenter.setPrice(items.getSalesPrice());
-			}
+			feeCenter.setPrice(items.getSalesPrice());
 		} else if ("4".equals(type)) {
 			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
 				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
@@ -2626,11 +2670,138 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			feeCenter.setCorpCnName(bCorps.getCnName());
 			feeCenter.setCorpEnName(bCorps.getEnName());
 			feeCenter.setShortName(bCorps.getShortName());
-			if (ObjectUtils.isNotNull(bills.getPotId())) {
-				feeCenter.setPrice(items.getSalesPrice().add(items.getSalesPriceTwo()));
+			feeCenter.setPrice(items.getSalesPrice());
+		} else if ("5".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getAdditionalFee());
+		}
+		BCorps corps = bCorpsService.getById(feeCenter.getCorpId());
+		if (corps != null) {
+			feeCenter.setGenerationCorpId(corps.getBookingAgentId());
+			feeCenter.setGenerationCorpCnName(corps.getBookingAgentCnName());
+			feeCenter.setGenerationCorpEnName(corps.getBookingAgentEnName());
+		}
+		feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+		if (ObjectUtils.isNull(feeCenter.getAmount())) {
+			feeCenter.setAmount(new BigDecimal("0"));
+		}
+		if (exrateType.equals(feeCenter.getCurCode())) {
+			feeCenter.setAmountLoc(feeCenter.getAmount());
+		} else {
+			if (new BigDecimal("0").compareTo(feeCenter.getAmount()) != 0) {
+				feeCenter.setAmountLoc(feeCenter.getAmount().multiply(feeCenter.getExrate()));
 			} else {
-				feeCenter.setPrice(items.getSalesPrice());
+				feeCenter.setAmountLoc(new BigDecimal("0"));
+			}
+		}
+		feeCenter.setUnsettledAmount(feeCenter.getAmount());
+		if (new BigDecimal("0.00").compareTo(feeCenter.getAmount()) == 0) {
+			return null;
+		} else {
+			return feeCenter;
+		}
+	}
+
+	private FeeCenter addFeeCenterChengBrothers(Bills bills, String dc, int count, BFees fees, String corpType, RouteCostItem
+		items,
+												List<BCurExrate> curExrateList, List<PreContainers> preContainers,
+												String exrateType, String type) {
+		FeeCenter feeCenter = new FeeCenter();
+		feeCenter.setBranchId(bills.getBranchId());
+		feeCenter.setBranchName(bills.getBranchName());
+		feeCenter.setBookingAgentId(bills.getBookingAgentId());
+		feeCenter.setBookingAgentCnName(bills.getBookingAgentCnName());
+		feeCenter.setBookingAgentEnName(bills.getBookingAgentEnName());
+		feeCenter.setQuantityCntrDescr(bills.getQuantityCntrDescr());
+		feeCenter.setBillBranchId(bills.getBranchId());
+		feeCenter.setBillBranchName(bills.getBranchName());
+		feeCenter.setTeu(bills.getTeu());
+		feeCenter.setPid(bills.getId());
+		feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
+		feeCenter.setBillNo(bills.getBillNo());
+		feeCenter.setBusinessType(bills.getBusinessType());
+		feeCenter.setBillType(bills.getBillType());
+		feeCenter.setBillDate(bills.getBillDate());
+		feeCenter.setBillCorpId(bills.getCorpId());
+		feeCenter.setBillCorpCnName(bills.getCorpCnName());
+		feeCenter.setBillCorpEnName(bills.getCorpEnName());
+		feeCenter.setBillShortName(bills.getCorpCnName());
+		feeCenter.setLineId(bills.getLineId());
+		feeCenter.setLineCnName(bills.getLineCnName());
+		feeCenter.setLineEnName(bills.getLineEnName());
+		feeCenter.setVesselId(bills.getVesselId());
+		feeCenter.setVesselCnName(bills.getVesselCnName());
+		feeCenter.setVesselEnName(bills.getVesselEnName());
+		feeCenter.setVoyageNo(bills.getVoyageNo());
+		feeCenter.setMblno(bills.getMblno());
+		feeCenter.setHblno(bills.getHblno());
+		feeCenter.setEtd(bills.getEtd());
+		feeCenter.setEta(bills.getEta());
+		feeCenter.setPolId(bills.getPolId());
+		feeCenter.setPolCode(bills.getPolCode());
+		feeCenter.setPolCnName(bills.getPolCnName());
+		feeCenter.setPolEnName(bills.getPolEnName());
+		feeCenter.setPodId(bills.getPodId());
+		feeCenter.setPodCode(bills.getPodCode());
+		feeCenter.setPodCnName(bills.getPodCnName());
+		feeCenter.setPodEnName(bills.getPodEnName());
+		feeCenter.setDc(dc);
+		feeCenter.setPaymode(bills.getMpaymode());
+		feeCenter.setSort(count);
+		feeCenter.setFeeId(fees.getId());
+		feeCenter.setCorpType(corpType);
+		feeCenter.setFeeCode(fees.getCode());
+		feeCenter.setFeeCnName(fees.getCnName());
+		feeCenter.setFeeEnName(fees.getEnName());
+		feeCenter.setUnitNo(items.getBoxType());
+		feeCenter.setCurCode(items.getCurCode());
+		feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
+		Integer quantity = preContainers.stream().filter(e -> items.getBoxType().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
+		if (quantity == 0) {
+			return null;
+		}
+		feeCenter.setQuantity(new BigDecimal(quantity + ""));
+		if ("1".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getOceanFreightTwo());
+		} else if ("2".equals(type)) {
+			feeCenter.setCorpId(bills.getCorpId());
+			feeCenter.setCorpCnName(bills.getCorpCnName());
+			feeCenter.setCorpEnName(bills.getCorpEnName());
+			feeCenter.setShortName(bills.getShortName());
+			feeCenter.setPrice(items.getSalesPriceTwo());
+		} else if ("3".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getEnName, bills.getBranchName()));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到往来单位" + bills.getBranchName());
+			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			feeCenter.setPrice(items.getSalesPriceTwo());
+		} else if ("4".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getCode, "ZBYF"));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到编码为‘ZBYF’往来单位");
 			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			feeCenter.setPrice(items.getSalesPriceTwo());
 		} else if ("5".equals(type)) {
 			feeCenter.setCorpId(bills.getCarrierId());
 			feeCenter.setCorpCnName(bills.getCarrierCnName());