Browse Source

2024年2月4日17:23:36

纪新园 1 year ago
parent
commit
8a89690160

+ 5 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/entity/LosBFeesTemplate.java

@@ -102,6 +102,11 @@ public class LosBFeesTemplate implements Serializable {
 	@ApiModelProperty(value = "业务类型英文名称")
 	private String businessTypeEnName;
 	/**
+	 * 业务类型编码
+	 */
+	@ApiModelProperty(value = "业务类型编码")
+	private String businessTypeCode;
+	/**
 	 * 模版编号
 	 */
 	@ApiModelProperty(value = "模版编号")

+ 1 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/fees/controller/LosBFeesTemplateController.java

@@ -200,6 +200,7 @@ public class LosBFeesTemplateController extends BladeController {
 			.eq(LosBFeesTemplate::getIsDeleted, 0)
 			.eq(LosBFeesTemplate::getDc, losBFeesTemplate.getDc())
 			.like(ObjectUtils.isNotNull(losBFeesTemplate.getCode()), LosBFeesTemplate::getCode, losBFeesTemplate.getCode())
+			.like(LosBFeesTemplate::getBusinessTypeCode, losBFeesTemplate.getType())
 			.like(ObjectUtils.isNotNull(losBFeesTemplate.getCnName()), LosBFeesTemplate::getCnName, losBFeesTemplate.getCnName())
 			.like(ObjectUtils.isNotNull(losBFeesTemplate.getEnName()), LosBFeesTemplate::getEnName, losBFeesTemplate.getEnName())
 			.eq(ObjectUtils.isNotNull(losBFeesTemplate.getStatus()), LosBFeesTemplate::getStatus, losBFeesTemplate.getStatus())

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

@@ -178,7 +178,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R<List<FeeCenter>> templateImport(LosBFeesTemplate losBFeesTemplate) {
 		List<FeeCenter> list = new ArrayList<>();
-		if ("HYCK".equals(losBFeesTemplate.getType()) || "HYJK".equals(losBFeesTemplate.getType())) {
+		if ("HYCK".equals(losBFeesTemplate.getBusinessTypeCode()) || "HYJK".equals(losBFeesTemplate.getBusinessTypeCode())) {
 			Bills bills = billsMapper.selectById(losBFeesTemplate.getBillNoId());
 			if (bills == null) {
 				throw new RuntimeException("未找到主表信息");
@@ -354,7 +354,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				}
 			}
 			this.saveOrUpdateBatch(list);
-		} else if ("KYCK".equals(losBFeesTemplate.getType()) || "KYJK".equals(losBFeesTemplate.getType())) {
+		} else if ("KYCK".equals(losBFeesTemplate.getBusinessTypeCode()) || "KYJK".equals(losBFeesTemplate.getBusinessTypeCode())) {
 			AeaBills bills = aeaBillsMapper.selectById(losBFeesTemplate.getBillNoId());
 			if (bills == null) {
 				throw new RuntimeException("未找到主表信息");
@@ -438,6 +438,88 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				}
 			}
 			this.saveOrUpdateBatch(list);
+		} else if ("BGSE".equals(losBFeesTemplate.getBusinessTypeCode()) || "BGSI".equals(losBFeesTemplate.getBusinessTypeCode())
+			|| "BGAE".equals(losBFeesTemplate.getBusinessTypeCode()) || "BGAI".equals(losBFeesTemplate.getBusinessTypeCode())) {
+			CustomsDeclaration bills = customsDeclarationMapper.selectById(losBFeesTemplate.getBillNoId());
+			if (bills == null) {
+				throw new RuntimeException("未找到主表信息");
+			}
+			if (losBFeesTemplate.getFeesTemplateItemsList().size() > 0) {
+				int count = 1;
+				for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
+					FeeCenter feeCenter = new FeeCenter();
+
+					feeCenter.setElementsCnName(items.getElementsCnName());
+					feeCenter.setElementsEnName(items.getElementsEnName());
+					feeCenter.setElementsId(items.getElementsId());
+					feeCenter.setElementsCode(items.getElementsCode());
+
+					feeCenter.setPid(bills.getId());
+					feeCenter.setBillNo(bills.getBillNo());
+					feeCenter.setBusinessType(bills.getBusinessType());
+					feeCenter.setBillType(bills.getSeaType());
+					feeCenter.setBillDate(bills.getBillDate());
+					feeCenter.setBillCorpId(bills.getCorpId());
+					feeCenter.setBillCorpCnName(bills.getCorpCnName());
+					feeCenter.setBillCorpEnName(bills.getCorpEnName());
+					feeCenter.setMblno(bills.getMblno());
+					feeCenter.setEtd(bills.getEtdDate());
+					feeCenter.setDc(losBFeesTemplate.getDc());
+					feeCenter.setSort(count);
+					count++;
+					feeCenter.setCorpId(items.getCorpId());
+					feeCenter.setCorpCnName(items.getCorpCnName());
+					feeCenter.setCorpEnName(items.getCorpEnName());
+					feeCenter.setFeeId(items.getFeeId());
+					feeCenter.setFeeCode(items.getFeeCode());
+					feeCenter.setFeeCnName(items.getFeeCnName());
+					feeCenter.setFeeEnName(items.getFeeEnName());
+					feeCenter.setUnitNo(items.getUnitNo());
+					feeCenter.setPrice(items.getPrice());
+					feeCenter.setCurCode(items.getCurCode());
+					if (ObjectUtils.isNotNull(feeCenter.getCurCode())) {
+						BCurrency bCurrency = new BCurrency();
+						bCurrency.setDate(bills.getEtdDate());
+						bCurrency.setDc(losBFeesTemplate.getDc());
+						List<BCurrency> bCurrencyList = bCurrencyService.getExrate(bCurrency);
+						if (bCurrencyList.size() > 0) {
+							BCurrency currency = bCurrencyList.stream().filter(e -> e.getCode().equals(feeCenter.getCurCode())).findFirst().orElse(null);
+							if (currency != null) {
+								feeCenter.setExrate(currency.getExrate());
+							} else {
+								throw new RuntimeException("未找到汇率信息");
+							}
+						}
+					}
+					if ("2".equals(items.getQuantityRule())) {
+						if ("JOB".equals(items.getUnitNo())) {
+							feeCenter.setQuantity(new BigDecimal("1"));
+							feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
+						} else {
+							continue;
+						}
+					} else if ("3".equals(items.getQuantityRule())) {
+						if ("KGS".equals(items.getUnitNo())) {
+							feeCenter.setQuantity(bills.getGrossWeight());
+							feeCenter.setAmount(items.getPrice().multiply(bills.getGrossWeight()));
+						} else {
+							continue;
+						}
+					} else if ("5".equals(items.getQuantityRule())) {
+						if ("CBM".equals(items.getUnitNo())) {
+							feeCenter.setQuantity(new BigDecimal("1"));
+							feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
+						} else {
+							continue;
+						}
+					} else {
+						feeCenter.setQuantity(new BigDecimal("1"));
+						feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
+					}
+					list.add(feeCenter);
+				}
+			}
+			this.saveOrUpdateBatch(list);
 		}
 
 		return R.data(list);