Sfoglia il codice sorgente

模版导入接口结算单位取简称

纪新园 6 mesi fa
parent
commit
4cdd7f4129

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

@@ -25,6 +25,7 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.los.Util.IDeptUtils;
 import org.springblade.los.basic.corps.entity.BCorps;
+import org.springblade.los.basic.corps.mapper.CorpsMapper;
 import org.springblade.los.basic.corps.service.IBCorpsService;
 import org.springblade.los.basic.cur.entity.BCurrency;
 import org.springblade.los.basic.cur.service.IBCurrencyService;
@@ -91,6 +92,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 
 	private final FinAccBillsMapper finAccBillsMapper;
 
+	private final CorpsMapper corpsMapper;
+
 	@Override
 	public IPage<FeeCenterVO> selectFeeCenterPage(IPage<FeeCenterVO> page, FeeCenterVO feeCenter) {
 		return page.setRecords(baseMapper.selectFeeCenterPage(page, feeCenter));
@@ -208,6 +211,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				.eq(PreContainers::getIsDeleted, 0)
 				.eq(PreContainers::getPid, bills.getId()));
 			if (!losBFeesTemplate.getFeesTemplateItemsList().isEmpty()) {
+				List<Long> idList = new ArrayList<>();
+				idList.add(bills.getCorpId());
+				idList.add(bills.getCyId());
+				idList.add(bills.getCarrierId());
+				idList.add(bills.getBookingAgentId());
+				idList.add(bills.getMconsigneeId());
+				idList.add(bills.getMnotifyId());
+				idList.addAll(losBFeesTemplate.getFeesTemplateItemsList().stream().map(FeesTemplateItems::getCorpId).filter(Objects::nonNull).collect(Collectors.toList()));
+				List<BCorps> corpsList = new ArrayList<>();
+				if (!idList.isEmpty()) {
+					corpsList = corpsMapper.selectList(new LambdaQueryWrapper<BCorps>()
+						.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+						.eq(BCorps::getIsDeleted, 0)
+						.in(BCorps::getId, idList));
+				}
 				int count = 1;
 				for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
 					FeeCenter feeCenter = new FeeCenter();
@@ -252,45 +270,59 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					count++;
 					if ("客户".equals(items.getCorpType())) {
 						feeCenter.setCorpId(bills.getCorpId());
-						feeCenter.setCorpCnName(bills.getCorpCnName());
+						feeCenter.setCorpCnName(bills.getShortName());
 						feeCenter.setCorpEnName(bills.getCorpEnName());
 						feeCenter.setShortName(bills.getShortName());
 					} else if ("船公司".equals(items.getCorpType())) {
 						feeCenter.setCorpId(bills.getCarrierId());
-						feeCenter.setCorpCnName(bills.getCarrierCnName());
+						feeCenter.setCorpCnName(bills.getCarrierShortName());
 						feeCenter.setCorpEnName(bills.getCarrierEnName());
-						feeCenter.setShortName(bills.getCarrierCnName());
-					}/*else if ("工厂".equals(items.getCorpType())){
-
-					}*/ else if ("场站".equals(items.getCorpType())) {
+						feeCenter.setShortName(bills.getCarrierShortName());
+					} else if ("场站".equals(items.getCorpType())) {
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getCyId())).findFirst().orElse(null);
+						}
 						feeCenter.setCorpId(bills.getCyId());
-						feeCenter.setCorpCnName(bills.getCyCnName());
+						feeCenter.setCorpCnName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
 						feeCenter.setCorpEnName(bills.getCyEnName());
-						feeCenter.setShortName(bills.getCyCnName());
+						feeCenter.setShortName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
 					} else if ("订舱代理".equals(items.getCorpType())) {
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getBookingAgentId())).findFirst().orElse(null);
+						}
 						feeCenter.setCorpId(bills.getBookingAgentId());
-						feeCenter.setCorpCnName(bills.getBookingAgentCnName());
+						feeCenter.setCorpCnName(bCorps == null ? bills.getBookingAgentCnName() : bCorps.getShortName());
 						feeCenter.setCorpEnName(bills.getBookingAgentEnName());
-						feeCenter.setShortName(bills.getBookingAgentCnName());
-					}/*else if ("BGH".equals(items.getCorpType())){
-
-					}else if ("LYGS".equals(items.getCorpType())){
-
-					}*/ else if ("收货代理".equals(items.getCorpType())) {
+						feeCenter.setShortName(bCorps == null ? bills.getBookingAgentCnName() : bCorps.getShortName());
+					} else if ("收货代理".equals(items.getCorpType())) {
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getMconsigneeId())).findFirst().orElse(null);
+						}
 						feeCenter.setCorpId(bills.getMconsigneeId());
-						feeCenter.setCorpCnName(bills.getMconsigneeCnName());
+						feeCenter.setCorpCnName(bCorps == null ? bills.getMconsigneeCnName() : bCorps.getShortName());
 						feeCenter.setCorpEnName(bills.getMconsigneeEnName());
-						feeCenter.setShortName(bills.getMconsigneeCnName());
+						feeCenter.setShortName(bCorps == null ? bills.getMconsigneeCnName() : bCorps.getShortName());
 					} else if ("MBL通知人".equals(items.getCorpType())) {
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getMnotifyId())).findFirst().orElse(null);
+						}
 						feeCenter.setCorpId(bills.getMnotifyId());
-						feeCenter.setCorpCnName(bills.getMnotifyCnName());
+						feeCenter.setCorpCnName(bCorps == null ? bills.getMnotifyCnName() : bCorps.getShortName());
 						feeCenter.setCorpEnName(bills.getMnotifyEnName());
-						feeCenter.setShortName(bills.getMnotifyCnName());
+						feeCenter.setShortName(bCorps == null ? bills.getMnotifyCnName() : bCorps.getShortName());
 					} else {
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
+						}
 						feeCenter.setCorpId(items.getCorpId());
-						feeCenter.setCorpCnName(items.getCorpCnName());
+						feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
 						feeCenter.setCorpEnName(items.getCorpEnName());
-						feeCenter.setShortName(items.getCorpCnName());
+						feeCenter.setShortName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
 					}
 					feeCenter.setFeeId(items.getFeeId());
 					feeCenter.setFeeCode(items.getFeeCode());